SpatialMap¶
- class SpatialMap(data: ndarray, positions: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | AbstractSites, sublattices: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None)¶
Represents some spatially dependent property: data mapped to site positions
Attributes
callsig1D array of values for each site, i.e. maps directly to x, y, z site coordinates.
Total number of lattice sites
Lattice site positions.
1D array of sublattices IDs, short for
.sublattices1D array of sublattices IDs
1D array of coordinates, short for
.positions.xReturn a new array with shape=(N, 3).
1D array of coordinates, short for
.positions.y1D array of coordinates, short for
.positions.zMethods
__getitem__(idx)Same rules as numpy indexing
_decorate_plot([ax])_make_crop_indices(limits)Return the indices into
objwhich retain only the data within the given limitsclipped(v_min, v_max)Clip (limit) the values in the
dataarray, 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_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 | _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) SpatialMap¶
Same rules as numpy indexing
- clipped(v_min: int, v_max: int) SpatialMap¶
Clip (limit) the values in the
dataarray, 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_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) SpatialMap¶
Return a copy of this object with different data mapped to the sites
- property data: ndarray¶
1D array of values for each site, i.e. maps directly to x, y, z site coordinates
- property positions: Positions¶
Lattice site positions. Named tuple with x, y, z fields, each a 1D array.
- property sub: ndarray¶
1D array of sublattices IDs, short for
.sublattices