Masks

Boolean masks for borders, corners, staggered sublattices, and OBC lattice regions.

Examples

For a 2D lattice lvals = (4, 5):

  • border_mask(lvals, "mx") selects the first row,

  • border_mask(lvals, "py") selects the last column,

  • corner_mask(lvals, ["mx", "py"]) selects the top-right corner,

  • obc_mask(lvals) returns a dictionary with "core", borders, and corners.

Boolean masks for selecting lattice regions and staggered sublattices.

This module provides convenience functions to build masks for borders, corners, staggered subsets, and open-boundary-condition decompositions of hypercubic lattices.

edlgt.modeling.masks.border_mask(lvals, border, stag_label=None)[source]

Build a mask selecting one lattice border.

Parameters:
  • lvals (tuple) – Lattice shape (one entry per lattice axis).

  • border (str) – Border label (e.g. "mx", "px", "my", "py").

  • stag_label (str, optional) – Optional staggered filter ("even" or "odd").

Returns:

Boolean mask of shape lvals.

Return type:

numpy.ndarray

edlgt.modeling.masks.staggered_mask(lvals, stag_label)[source]

Build a mask selecting even or odd staggered lattice sites.

Parameters:
  • lvals (tuple) – Lattice shape (one entry per lattice axis).

  • stag_label (str) – "even" or "odd".

Returns:

Boolean mask of shape lvals.

Return type:

numpy.ndarray

edlgt.modeling.masks.corner_mask(lvals, borders, stag_label=None)[source]

Build a mask selecting corners defined by a set of borders.

Parameters:
  • lvals (tuple) – Lattice shape (one entry per lattice axis).

  • borders (list[str]) – Border labels that define the corner(s).

  • stag_label (str, optional) – Optional staggered filter ("even" or "odd").

Returns:

Boolean mask of shape lvals.

Return type:

numpy.ndarray

edlgt.modeling.masks.obc_mask(lvals, stag_label=None)[source]

Build a dictionary of masks for OBC lattice regions.

Parameters:
  • lvals (tuple) – Lattice shape (one entry per lattice axis).

  • stag_label (str, optional) – Optional staggered filter applied to every mask.

Returns:

Dictionary containing masks for the core, borders, and corners.

Return type:

dict