StructureMap¶
- class StructureMap(data: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], sites: Sites, hoppings: Hoppings, boundaries=())¶
A subclass of
SpatialMap
that also includes hoppings between sitesAttributes
Boundary hoppings between different translation units (only for infinite systems)
callsig
1D array of values for each site, i.e. maps directly to x, y, z site coordinates.
Sparse matrix of hopping IDs
Total number of lattice sites
Lattice site positions.
Just the
SpatialMap
subset without hoppings1D array of sublattices IDs, short for
.sublattices
1D array of sublattices IDs
1D array of coordinates, short for
.positions.x
Return a new array with shape=(N, 3).
1D array of coordinates, short for
.positions.y
1D array of coordinates, short for
.positions.z
Methods
__getitem__
(idx)Same rules as numpy indexing
_decorate_plot
([ax])_make_crop_indices
(limits)Return the indices into
obj
which retain only the data within the given limitsclipped
(v_min, v_max)Clip (limit) the values in the
data
array, seeclip()
convolve
([sigma])Convolve the data with a Gaussian kernel of the given standard deviation
cropped
(**limits)Return a copy which retains only the sites within the given limits
plot
([cmap, site_radius, num_periods, ax])Plot the spatial structure with a colormap of
data
at the lattice sitesplot_contour
([ax])Contour plot of the xy plane
plot_contourf
([num_levels, ax])Filled contour plot of the xy plane
plot_pcolor
([ax])Color plot of the xy plane
save_txt
(filename)with_data
(data)Return a copy of this object with different data mapped to the sites
- __getitem__(idx: int | List[int]) StructureMap ¶
Same rules as numpy indexing
- clipped(v_min: int, v_max: int) SpatialMap ¶
Clip (limit) the values in the
data
array, seeclip()
- convolve(sigma: float = 0.25)¶
Convolve the data with a Gaussian kernel of the given standard deviation
- Parameters:
- sigmafloat
Standard deviation of the Gaussian kernel
- cropped(**limits) SpatialMap ¶
Return a copy which retains only the sites within the given limits
- Parameters:
- **limits
Attribute names and corresponding limits. See example.
Examples
Leave only the data where -10 <= x < 10 and 2 <= y < 4:
new = original.cropped(x=[-10, 10], y=[2, 4])
- plot(cmap: str = 'YlGnBu', site_radius: List[float] | float | Tuple[float, float] = (0.03, 0.05), num_periods: int = 1, ax: Axes | None = None, **kwargs) CircleCollection | None ¶
Plot the spatial structure with a colormap of
data
at the lattice sitesBoth the site size and color are used to display the data.
- Parameters:
- cmapstr
Matplotlib colormap to be used for the data.
- site_radiusUnion[List[float], float, Tuple[float, float]]
Min and max radius of lattice sites. This range will be used to visually represent the magnitude of the data.
- num_periodsint
Number of times to repeat periodic boundaries.
- axOptional[plt.Axes]
The axis to plot on.
- **kwargs
Additional plot arguments as specified in
structure_plot_properties()
.
- plot_contour(ax: Axes | None = None, **kwargs) TriContourSet ¶
Contour plot of the xy plane
- Parameters:
- axOptional[plt.Axes]
The axis to plot on.
- **kwargs
Forwarded to
tricontour()
.
- plot_contourf(num_levels: int = 50, ax: Axes | None = None, **kwargs) TriContourSet ¶
Filled contour plot of the xy plane
- Parameters:
- num_levelsint
Number of contour levels.
- axOptional[plt.Axes]
The axis to plot on.
- **kwargs
Forwarded to
tricontourf()
.
- plot_pcolor(ax: Axes | None = None, **kwargs) TriMesh | PolyCollection ¶
Color plot of the xy plane
- Parameters:
- axOptional[plt.Axes]
The axis to plot on.
- **kwargs
Forwarded to
tripcolor()
.
- with_data(data) StructureMap ¶
Return a copy of this object with different data mapped to the sites
- property boundaries: list¶
Boundary hoppings between different translation units (only for infinite systems)
- property data: ndarray¶
1D array of values for each site, i.e. maps directly to x, y, z site coordinates
- property hoppings: Hoppings¶
Sparse matrix of hopping IDs
- property positions: Positions¶
Lattice site positions. Named tuple with x, y, z fields, each a 1D array.
- property spatial_map: SpatialMap¶
Just the
SpatialMap
subset without hoppings
- property sub: ndarray¶
1D array of sublattices IDs, short for
.sublattices