Bases

This page describes the general interface for and parameters involved in building and managing kemitter emission bases. For specific implementations and their initializers, refer to the following links.

Basis (interface)

class kemitter.basis.basis.Basis

Abstract base class for all basis types.

This class defines the common interface used for defining sample geometries and building emission bases. Individual basis classes differ in how they implement their build() method, but users interface with them with the methods and attributes defined here.

Notes

Basis should not be instantiated on its own. Only its children, which implement a build() method should be used directly.

basis_names

list of str – denotes the types and column-wise order of bases present in the built basis matrix.

basis_matrix

csc_matrix – sparse matrix containing basis functions. Each column corresponds to a basis function of a particular basis type at a particular wavelength.

is_built

bool – whether or not a basis matrix has been successfully built

pol_angle

int or float – the polarization angle of the basis, in degrees.

basis_parameters

BasisParameters – the parameter object containing information about sample geometry, optical properties, and observation-dependent information. Used by submodules for constructing emission bases.

Warning

Directly modifying the basis_parameters object after it’s construciton is dangerous and should be considered deprecated. Use the child class’s initializer and define_observation_parameters() methods instead to alter basis parameters.

is_defined

bool – whether or not all basis parameters have been properly defined and the basis is ready to be built.

build()

Abstract method for basis building. Implemented by each basis individually

define_observation_parameters(wavelength, k_count, open_slit=True)

Allows setting of basis parameters that depend on intended observation fitting.

Parameters:
  • wavelength (ndarray) – 1D array of wavelength mapping values.
  • k_count (int) – the image size in the momentum dimension. In open slit case, denotes the resolution of the momentum-space basis functions by referring to the grid edge size. That is, each basis function will be calculated on a k_count X k_count sized grid.
  • open_slit (bool) – whether observation and corresponding basis should be of wide-angle type (ux_count > 1).

Basis Parameters

While basis parameters should normally be defined in the initializer of each basis class, advanced users may want to save and set basis parameters directly in their storage format: the BasisParameters class. This can be efficient for repeated calculations. While the parameter object has checks to verify its internal state, basis-specific checks are only handled in the initializers of the individual basis classes. Therefore care should be when creating a custom parameter class, as doing so may bypass these basis-specific helper functions and verification steps.

class kemitter.basis.basis.BasisParameters(basis_type, n0, n1, n2o, n2e, n3, ux_range, uy_range, d, s, l, pol_angle, ux_count=None, uy_count=None, wavelength=None, wavelength_count=None, pad_w=False, trim_w=True)

Parameter object for basis class

Stores all necessary information about sample geometry, optical properties, and observation-dependent conditions such as measurement wavelength and numerical aperture for basis construction. Also holds flags for basis building procedures based on user preferences.

basis_type

str – the type of basis to be built with the object

n0

float – refractive index of the 0 layer (typically vacuum, 1.0)

n1

float – refractive index of the 1 layer

n2o

float – in-plane refractive index of the emitter layer

n2e

float – out-of-plane refractive index of the emitter layer

n3

float – refractive index of the substrate layer (typically quartz, 1.5)

ux_range

tuple of float – the minimum and maximum normalized wavenumbers in the x direction e.g. (-NA, NA) for open slit

uy_range

tuple of float – the minimum and maximum normalized wavenumbers in the y direction e.g. (-NA, NA) for open slit

d

float – distance from emitter center to 2-3 layer interface, in nanometers

s

float – distance from emitter center to 1-2 layer interface, in nanometers

l

float – thickness of n1 layer

pol_angle_rad

float – the polarization angle, given in degrees (stored in radians)

ux_count

int – the number of samples in the x-momentum dimension

uy_count

int – the number of samples in the y-momentum dimension

wavelength

ndarray – 1D array of wavelength mapping values (with or without padding)

wavelength_count

int – the number of wavelength values to be calculated (with or without padding)

pad_w

bool – construct basis by padding wavelength values near edges of image (False by default)

trim_w

bool – trim the basis matrix to the desired image dimensions by wavelength (True by default)

orig_wavelength

ndarry – 1D array of wavelength mapping values (without padding)

orig_wavelength_length

int – the number of wavelength values in the observation image (without padding)

Warning

Polarization angle is entered in the initializer in degrees, like other areas of the public interface, but is then converted to radians for basis calculations. Functions that use basis parameters should refer to the pol_angle_rad attribute when making any calculation with polarization angle, NOT the degree value stored in the basis object itself.

set_wavelength(wavelength)

Setter for the wavelength mapping values

Parameters:wavelength (ndarray) – 1D array of wavelength mapping values. May be padded upon setting.