Band structure parametrization (fuller.generator)
¶
-
class
fuller.generator.
BrillouinZoner
(folder='', bands=[], axis=0, mask=None, kvals=[[], []])¶ Class for truncating the band mapping data to the first Brillouin zone.
-
bandcutter
(nx=None, ny=None, dmean=False, resampled=False, ret=False, **kwargs)¶ Truncate the band within the first Brillouin zone.
Parameters
- nx, ny: int, int | None, None
Pixel numbers of the cut band along the image axes.
- dmean: bool | False
Option to subtract the mean from the band structure.
- resampled: bool | False
Option to resample the energy band in another k-grid.
- ret: bool | False
Specifications for return values.
- **kwargs: keyword arguments
- mask: 2D array |
self.mask
Mask matrix to apply to image.
- margins: list/tuple |
self.margins
Four-sided margins for the truncated band structure.
- selector: list/slice object/None | None
Selector along the band index axis.
- offsx, offsy: int, int | 0, 0
Offsets to a square along x and y directions.
- mask: 2D array |
-
findlandmarks
(method='daofind', direction='ccw', center_det='centroidnn', ret=False, **kwargs)¶ Determine the landmark locations, further details see
mpes.analysis.peakdetect2d()
.Parameters
- method: str | ‘daofind’
Method for detecting landmarks (‘daofind’ or ‘maxfind’).
- direction: str | ‘ccw’
Direction to arrange the detected vertices (‘cw’ for clockwise or ‘ccw’ for counterclockwise).
- center_det: str | ‘centroidnn’
Method to determine the center position.
- ret: bool | False
Option to return the outcome.
- **kwargs: keyword arguments
- image: 2D array |
self.bands[0,...]
Image to extract landmark from.
- image_ofs: list/tuple | [0, 0, 0, 0]
Systematic offsets applied to the detected landmarks.
- image: 2D array |
-
load_data
(filename, loadfunc=None, ret=False, **kwargs)¶ Load band structure data (energy values and momentum axes).
-
maskgen
(ret='all', **kwargs)¶ Generate a mask using given parameters.
Parameters
See
fuller.generator.hexmask()
.
-
property
nbands
¶ Number of bands.
-
resample
(kvals, band, nx=None, ny=None, ret='all', **kwargs)¶ Resample the energy band in a finer grid.
Parameters
See
fuller.utils.interpolate2d()
.
-
save_data
(form='h5', save_addr='./bandcuts.h5', **kwargs)¶ Save truncated band structure data.
Parameters
- form: str | ‘h5’
Format of the file to save.
- save_addr: str | ‘./bandcuts’
File-saving address.
- **kwargs: keyword arguments
Additional arguments for the file-saving functions.
-
select_slice
(selector, axis=None)¶ Select the image slice for landmark detection.
Parameters
- selector: slice object
A slice object for selection of image stacks for feature detection.
-
set_bands
(bands)¶ Set the energy bands.
-
set_eaxis
(axis)¶ Set the index of the energy axis.
-
set_kvals
(kvals)¶ Set the k values.
-
set_landmarks
(landmarks)¶ Set the landmark locations for the image features.
-
set_mask
(mask)¶ Set the mask for the energy band.
-
summary
(rettype='dict')¶ A container of truncated band structure and parameters.
Parameters
- rettype: str | ‘dict’
Data type of the returned summary (
'dict'
or'list'
).
-
visualize
(image, figsize=4, 4, origin='lower', annotated=False, points=None, scatterkws={}, **kwargs)¶ Display (cut) bands.
-
-
class
fuller.generator.
EBandSynthesizer
(nbands, **kwargs)¶ Class for synthesizing electronic band structure from basis functions.
-
basisgen
(nterms, npix, vertical=True, outside=0, basis_type='Zernike')¶ Generate polynomial bases for energy band synthesis.
-
coeffgen
(nterms, method='rand_gauss', **kwargs)¶ Generate coefficients for energy band synthesis.
-
save_bands
(form, save_addr='', **kwargs)¶ Save the synthesized energy bands.
-
set_kvals
(kvals)¶ Set momentum values.
-
set_mask
(mask)¶ Set the mask for the synthesized data.
-
set_nbands
(nbands)¶ Set the number of energy bands to synthesize.
-
set_spacing
(spacing)¶ Set the energy spacing between energy bands.
-
summary
(rettype='dict')¶ A container of synthetic band structure and parameters.
-
synthesize
(basis_type='Zernike', **kwargs)¶ Generate 3D electronic band structure.
-
visualize
(selector=None, indaxis=0, backend='plotly', **kwargs)¶ Plot synthesized band structure.
-
-
class
fuller.generator.
MPESDataGenerator
(bands, lineshape, baxis=0, **kwargs)¶ Class for generating three-dimensional photoemssion data.
-
add_bands
(bands, edir='lower')¶ Add an energy band the existing list.
-
generate_data
(matrix_elements='off')¶ Generate photoemission data.
-
property
nbands
¶ Number of bands used in the simulation.
-
property
parameters
¶ A dictionary of lineshape parameters.
-
save_data
(form='h5', save_addr='', save_items='all', **kwargs)¶ Save generated photoemission data.
-
select_bands
(selector)¶ Select energy bands by their indices.
-
set_amplitude
(amplitude)¶ Set the amplitude of the lineshape function.
-
set_bands
(bands)¶ Set the energy band positions.
-
set_energy
(energy)¶ Set the binding energy of the photoelectrons.
-
set_kvals
(kvals)¶ Set the momentum values for the data.
-
set_lineshape
(lineshape)¶ Set the lineshape function.
-
set_linewidth
(gamma)¶ Set the intrinsic linewidth of electronic state.
-
set_matrix_elements
(matelems)¶ Set the matrix element intensity modulation in photoemission process.
-
set_srfwidth
(sigma)¶ Set the width of the system response function (SRF).
-
summary
(rettype='dict')¶ A container of synthetic band mapping data and parameters.
-
-
fuller.generator.
bandstack
(data, baxis=2, nvb=None, ncb=None, gap_id=None, pbar=True, pbenv='classic', **kwargs)¶ Construct a stack of energy bands after symmetrization.
Parameters
- data: 3D array
Patches of band structure data with the axes in any ordering of (kx, ky, band_index).
- baxis: int | 2
Axis of the band index.
- nvb, ncb: int, int | None, None
Number of valence and conduction bands to extract.
- gap_id: int | None
Index number of the topmost valence band or bottommost conduction band, depending on the stacking order in the data variable.
- pbar: bool | True
Option to turn on/off the progress bar in computation.
- pbenv: str | ‘classic’
Progress bar environment (‘classic’ or ‘notebook’).
**kwargs: keyword arguments
Returns
- vbands, cbands: 3D array, 3D array
Stacked valence and conduction bands after symmetrization.
-
fuller.generator.
cutedge
(image, check_axis=1, boundary='square', ret='cutimage')¶ Cutting out the region beyond the edge of an image.
Parameters
- image: 2D array
Image (containing nan or 0 outside the region of interest) before cutting.
- check_axis: int | 1
The long axis for determining the boundary.
- boundary: str | ‘square’
'square'
Square image boundary.'tight'
Tightest rectangular image boundary. The shape of the image boundary.- ret: str | ‘cutimage’
Option to specify return quantity (‘cutimage’, ‘cutrange’, ‘all’).
-
fuller.generator.
decomposition_hex2d
(band, bases=None, baxis=0, nterms=100, basis_type='Zernike', ret='coeffs')¶ Decompose energy band in 3D momentum space using the orthogonal polynomials in a hexagon.
Parameters
- band: 2D array
2D electronic band structure.
- bases: 3D array | None
Matrix composed of bases to decompose into.
- baxis: int | 0
Axis of the basis index.
- nterms: int | 100
Number of basis terms.
- basis_type: str | ‘Zernike’
Type of basis to use.
- ret: str | ‘coeffs’
Options for the return values.
-
fuller.generator.
hexfilter
(images, center, axis=0, rotrange=[- 30, - 25, - 20, - 15, - 10, - 5, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 200, 205, 210, 215, 220, 225, 230, 235, 240, 245, 250, 255, 260, 265, 270, 275, 280, 285, 290, 295, 300, 305, 310, 315, 320, 325], lookahead=4, pbar=True, pbenv='classic', ret='all')¶ Filter out sixfold-symmetric images.
Parameters
- images: 3D array
Stack of 2D images.
- center: list/tuple/1D array
Image center pixel coordinates.
- axis: int | 0
Axis to extract images from stack.
- rotrange: list/tuple | list(range(-30, 330, 5))
All rotations tested.
- lookahead: int | 4
Number of points ahead taken into consideration in peak detection.
- pbar: bool | True
Option to turn on/off progress bar.
- pbenv: str | ‘classic’
Notebook environment.
- ret: str | ‘all’
Option for return (‘filtered’ returns only filtered images, ‘all’ returns filtered images and the indices of symmetric images within the stack).
-
fuller.generator.
hexmask
(hexdiag=128, imside=256, image=None, padded=False, margins=[], pad_top=None, pad_bottom=None, pad_left=None, pad_right=None, vertical=True, outside='nan', ret='mask', **kwargs)¶ Generate a hexagonal mask. To use the function, either the argument
imside
orimage
should be given. The image padding on four sides could be specified with eithermargins
altogether or separately with the individual argumentspad_xxx
. For the latter, at least two independent padding values are needed.Parameters
- hexdiag: int | 128
Number of pixels along the hexagon’s diagonal.
- imside: int | 256
Number of pixels along the side of the (square) reference image.
- image: 2D array | None
2D reference image to construct the mask for. If the reference (image) is given, each side of the generated mask is at least that of the smallest dimension of the reference.
- padded: bool | False
Option to pad the image (need to set to True to enable the margins).
- margins: list/tuple | []
Margins of the image [top, bottom, left, right]. Overrides the pad_xxx arguments.
- pad_top, pad_bottom, pad_left, pad_rightint, int, int, int | None, None, None, None
Number of padded pixels on each of the four sides of the image.
- vertical: bool | True
Option to align the diagonal of the hexagon with the vertical image axis.
- outside: numeric/str | ‘nan’
Pixel value outside the masked region.
- ret: str | ‘mask’
Return option (‘mask’, ‘masked_image’, ‘all’).
-
fuller.generator.
hexpad
(img, cvd, edgepad=None, **kwargs)¶ Symmetrically pad an image in directions perpendicular to the hexagonal edges.
Parameters
- img: 2d array
Image to pad.
- cvd: numeric
Center-vertex distance of the hexagon.
- edgepad: list/tuple
Number of padded pixels on the edge of the image, ((left, right), (top, bottom)).
- **kwargs: keyword arguments
- op, op_package: str, str | ‘nanmax’, ‘numpy’
Namestring of the function and package using for image padding (package.function will be executed and applied when merging the original and the paddings).
- mask: str | ‘numpy’
Mask applied to the unpadded image before merging with the paddings (used to suppress the potential discontinuities of boundary pixels).
- edgevals: numeric |
np.nan
Edge values outside the boundary of the mask.
Return
- padded_view: 2d array
Rectangular image after padding hexagonally.
-
fuller.generator.
hextiler
(image, final_size, cvd, method='geometric', op='nanmax', op_package='numpy', ret='final')¶ Tiling the image plane with hexagonal patterns.
Parameters
- image: 2D array
Base image before hexagonal tiling.
- final_size: list/tuple
Final size of the padded image (row_size, colum_size).
- cvd: numeric
Center-vertex distance.
- method: str | ‘geometric’
Method for hexagonal tiling.
- op: str | ‘nanmax’
Namestring of the operator.
- op_package: str | ‘numpy’
Namestring of the software package to obtain the operator.
- ret: str | ‘final’
final: Return only the final result. all: Return results from all intermediate steps.
-
fuller.generator.
polydecompose
(trace, deg, ids=None, method='piecewise', polytype='Legendre', **kwds)¶ Decompose the trace into orthogonal polynomials.
-
fuller.generator.
polyreconstruct
(coeffs, ids=None, polytype='Legendre', flatten=True)¶ Reconstruct line segments using provided coefficients.
-
fuller.generator.
projectionfilter
(data, nterms=None, bases=None, npix=None, basis_type='Zernike', outside='nan', basis_kwds={})¶ Filtering reconstructed band structure using orthogonal polynomial approximation.
Parameters
- data: 2D array
Band dispersion in 2D to filter.
- nterms: int | None
Number of terms.
- bases: 3D array | None
Bases for decomposition.
- npix: int | None
Size (number of pixels) in one direction of each basis term.
- basis_type: str | ‘Zernike’
Type of basis to use for filtering.
- outside: numeric/str | ‘nan’
Values to fill for regions outside the Brillouin zone boundary.
- basis_kwds: dictionary | {}
Keywords for basis generator (see poppy.zernike.hexike_basis() if hexagonal Zernike polynomials are used).
-
fuller.generator.
reconstruction_hex2d
(coeffs, bases=None, baxis=0, npix=256, basis_type='Zernike', ret='band')¶ Reconstruction of energy band in 3D momentum space using orthogonal polynomials and the term-wise coefficients.
Parameters
- coeffs: 1D array
Polynomial coefficients to use in reconstruction.
- bases: 3D array | None
Matrix composed of bases to decompose into.
- baxis: int | 0
Axis of the basis index.
- npix: int | 256
Number of pixels along one side in the square image.
- basis_type: str | ‘Zernike’
Type of basis to use.
- ret: str | ‘band’
Options for the return values.
-
fuller.generator.
reflectodeform
(imbase, refangle, center, axis=0, interp_order=1, **kwargs)¶ Reflect the image with respect to the symmetry line across the image center using deformation field.
Parameters
- imbase: 2D array
Base image.
- refangle: numeric
Reflection angle with respect to the image horizontal axis.
- center: list/tuple
Center coordinates of the image.
- axis: int | 0
Axis to reflect along.
-
fuller.generator.
reflectosymmetrize
(image, center, refangles, axis=0, outside='nan')¶ Symmetrize the pattern according to reflection symmetry.
-
fuller.generator.
refsym
(img, op='nanmax', op_package='numpy', axis=0, pbenv='classic', pbar=True)¶ Symmetrize by reflections.
-
fuller.generator.
restore
(img, **kwargs)¶ Restore an image with irregularly distributed missing values (as nan’s).
Parameters
- img: nd array
Multidimensional image array with missing data (as nan’s).
- **kwargs: keyword arguments
Additional arguments supplied to
scipy.interpolate.griddata()
.
-
fuller.generator.
rotodeform
(imbase, angle, center, interp_order=1, **kwargs)¶ Image rotation using deformation field.
Parameters
- imbase: 2D array
Base image before rotation.
- angle: numeric
Angle of rotation.
- center: list/tuple
Center pixel coordinates of the image.
- **kwargs: keyword arguments
See additional arguments in scipy.ndimage.map_coordinates().
Return
- imshift: 2D array
Rotated image.
-
fuller.generator.
rotosymdetect
(image, center, rotrange=[- 30, - 25, - 20, - 15, - 10, - 5, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 200, 205, 210, 215, 220, 225, 230, 235, 240, 245, 250, 255, 260, 265, 270, 275, 280, 285, 290, 295, 300, 305, 310, 315, 320, 325], lookahead=4, pbar=True, pbenv='classic')¶ Detect the degree of rotational symmetry of an image.
Parameters
- image: 2D array
Image for rotational symmetry detection.
- center: list/tuple
Image center coordinates.
- rotrange: list/tuple | list(range(-30, 330, 5))
Rotation values to test.
- lookahead: int | 4
Number of points ahead taken into consideration in peak detection.
- pbar: bool | True
Option to show progress bar.
- pbenv: str | ‘classic’
Progress bar environment (‘classic’ or ‘notebook’).
Return
- nmax: int
Order of rotational symmetry.
-
fuller.generator.
rotosymmetrize
(image, center, rotsym=None, angles=None, outside='nan', **kwargs)¶ Symmetrize the pattern according to the rotational symmetry.
Parameters
- image: 2D array
Image to symmetrize.
- center: list/tuple
Image center pixel position (row, column).
- rotsym: int | None
Order of rotation symmetry (if regular symmetry is assumed). If
rotsym
is specified, the values fromangles
are ignored.- angles: numeric | None
Angles of rotation.
- outside: str/numeric | ‘nan’
The values of the symmetrized image outside the masked boundary.
-
fuller.generator.
transdeform
(imbase, xtrans=0, ytrans=0, interp_order=1, **kwargs)¶ Image translation using deformation field.
Parameters
- imbase: 2D array
Base image before translation.
- xtrans, ytrans: numeric, numeric | 0, 0
Magnitude of translation along the x and y axes.
- **kwargs: keyword arguments
See additional arguments in scipy.ndimage.map_coordinates().