+
+ +
+

Base classes

+

Information about the base classes, the building blocks of data processing classes.

+

@author: R. Patrick Xian

+
+
+class mpes.base.FileCollection(files=[], file_sorting=True, folder='')
+

File collecting and sorting class.

+
+
+property fileID
+

The sequence IDs of the files.

+
+ +
+
+filter(wexpr=None, woexpr=None, str_start=None, str_end=None)
+

Filter filenames by keywords.

+
+
Parameters
+
+
wexprstr | None

Expression in a name to leave in the filename list (w = with).

+
+
woexprstr | None

Expression in a name to leave out of the filename list (wo = without).

+
+
str_start, str_endint, int | None, None

Starting and ending indices of the filename string.

+
+
+
+
Return
+
+
filteredFileslist

List of filtered filenames.

+
+
+
+
+
+ +
+
+gather(folder='', identifier='/*.h5', f_start=None, f_end=None, f_step=1, file_sorting=True)
+

Gather files from a folder (specified at instantiation).

+
+
Parameters
+
+
identifierstr | r’/*.h5’

File identifier used for glob.glob().

+
+
f_start, f_end, f_stepint, int, int | None, None, 1

Starting, ending file id and the step. Used to construct a file selector.

+
+
file_sortingbool | True

Option to sort the files by their names.

+
+
+
+
+
+ +
+
+property nallfiles
+

Total number of files with the same attributes. +# of allfiles >= # of files (equal when no selection criterion is applied).

+
+ +
+
+property nfiles
+

Total number of files for a specific workflow.

+
+ +
+
+select(ids=[], update='', ret=False)
+

Select gathered files by the filename ids.

+
+
Parameters
+
+
idslist/1D array | []

File IDs for selection.

+
+
updatestr | ‘’

File address list update condition, +‘remove’ = remove the selected files. +‘keep’ = keep the selected files and remove the rest. +others strings or no action = do nothing. +‘’ = nothing happens (can be used in combination with ret=True +to retrieve filtered file names).

+
+
retstr | ‘selected’

Return option, +:’selected’: Return of the selected files. +:’rest’: Return the rest of the files (not selected). +:False: No action (return).

+
+
+
+
+
+ +
+ +
+
+class mpes.base.MapParser(files=[], file_sorting=True, folder=None, **kwds)
+

Parser of recorded parameters and turn into functional maps.

+
+
+property EMap
+

The ToF to energy coordinate transform function.

+
+
Parameter
+
+
parse_keystr | ‘coeffs’

Parsing key for extracting parameters.

+
+
+
+
+
+ +
+
+property Efile
+

File containing the energy calibration information.

+
+ +
+
+property bfile
+

File containing the binning parameters.

+
+ +
+
+property kMap
+

The (row, column) to momentum coordinate transform function.

+
+ +
+
+property kfile
+

File containing the momentum correction and calibration information.

+
+ +
+
+static listfind(namelist, name, itemlist)
+

Find item in the itemlist according to the name index in the namelist.

+
+ +
+
+static mapConstruct(mapfunc, **kwds)
+

Construct mapping function (partial function) by filling in certain +known parameters.

+
+ +
+
+static parse(parse_map, **mapkeys)
+

Parse map parameters stored in files.

+
+
Parameter
+
+
parse_mapfunction

Run parse_map function to populate the class namespace.

+
+
+
+
Return
+
+
flagint (0 or 1)

Returns 1 if successful, 0 if not.

+
+
+
+
+
+ +
+
+parse_Emap(key='coeffs')
+

Retrieve the parameters to construct the energy conversion function.

+
+ +
+
+parse_bfile()
+

Retrieve the binning parameters.

+
+ +
+
+parse_kmap(key='coeffs')
+

Retrieve the parameters to construct the momentum conversion function.

+
+ +
+
+parse_wmap(key='warping')
+

Retrieve the parameters to construct the distortion correction function

+
+ +
+
+property wMap
+

The distortion correction transform function.

+
+ +
+ +
+
+mpes.base.correctnd(data, warping, func=<built-in function warpPerspective>, **kwds)
+

Apply a 2D transform to 2D in n-dimensional data.

+
+ +
+
+mpes.base.detrc2krc(rdet, cdet, rstart, cstart, r0, c0, fr, fc, rstep, cstep)
+

Conversion from detector coordinates (rdet, cdet) to momentum coordinates (kr, kc).

+
+ +
+
+mpes.base.detxy2kxy(xdet, ydet, xstart, ystart, x0, y0, fx, fy, xstep, ystep)
+

Conversion from detector coordinates (xd, yd) to momentum coordinates (kx, ky).

+
+
Parameters
+
+
xdet, ydetnumeric, numeric

Pixel coordinates in the detector coordinate system.

+
+
xstart, ystartnumeric, numeric

The starting pixel number in the detector coordinate system +along the x and y axes used in the binning.

+
+
x0, y0numeric, numeric

The center pixel position in binned image used in calibration.

+
+
fx, fynumeric, numeric

Scaling factor along the x and y axes (in binned image).

+
+
xstep, ystepnumeric, numeric

Binning step size along x and y directions.

+
+
+
+
+
+ +
+
+mpes.base.dfieldapply(edf, dfield, X='X', Y='Y', newX='Xm', newY='Ym')
+

Application of the inverse displacement-field to the dataframe coordinates

+
+ +
+
+mpes.base.generateDfield(rdeform_field, cdeform_field)
+

Generate inverse deformation field using inperpolation with griddata +Assuming the binning range of the input rdeform_field and cdeform_field covers the whole detector

+
+ +
+
+mpes.base.imrc2krc(r, c, r0, c0, fr, fc)
+

Conversion from image coordinate (row, column) to momentum coordinates (kr, kc).

+
+ +
+
+mpes.base.imxy2kxy(x, y, x0, y0, fx, fy)
+

Conversion from Cartesian coordinate in binned image (x, y) to momentum coordinates (kx, ky).

+
+ +
+
+mpes.base.loadClassAttributes(form, load_addr)
+

Load class from saved attributes.

+
+
Parameters
+
+
formdump

Format to load from (only works for ‘dump’ right now).

+
+
load_addrstr

The address to load the attributes from.

+
+
+

returns the loaded class

+
+
+
+ +
+
+mpes.base.mapping(data, f, **kwds)
+

Mapping a generic function to multidimensional data with +the possibility to supply keyword arguments.

+
+
Parameter
+
+
datanumpy.ndarray

Data to map the function to.

+
+
ffunction

Function to map to data.

+
+
**kwdskeyword arguments

Keyword arguments of the function map.

+
+
+
+
+
+ +
+
+mpes.base.perspectiveTransform(x, y, M)
+

Implementation of the perspective transform (homography) in 2D.

+
+
Parameters
+
+
x, ynumeric, numeric

Pixel coordinates of the original point.

+
+
M2d array

Perspective transform matrix.

+
+
+
+
Return
+
+
xtrans, ytransnumeric, numeric

Pixel coordinates after projective/perspective transform.

+
+
+
+
+
+ +
+
+mpes.base.reshape2d(data, apply_axis)
+

Reshape matrix to apply 2D function to.

+
+
Parameters
+
+
datanumpy.ndarray

N-dimensional numerical array.

+
+
apply_axistuple/list of int

The index of the axes to apply the transform to.

+
+
+
+
Return
+
+
datanumpy.ndarray

Reshaped n-dimensional array.

+
+
+
+
+
+ +
+
+mpes.base.saveClassAttributes(clss, form, save_addr)
+

Save class attributes.

+
+
Parameters
+
+
clssinstance

Handle of the instance to be saved.

+
+
formstr

Format to save in (‘h5’/’hdf5’, ‘mat’, or ‘dmp’/’dump’).

+
+
save_addrstr

The address to save the attributes in.

+
+
+
+
+
+ +
+
+mpes.base.tof2evpoly(a, E0, t)
+

Polynomial approximation of the time-of-flight to electron volt +conversion formula.

+
+
Parameters
+
+
a1D array

Polynomial coefficients.

+
+
E0float

Energy offset.

+
+
tnumeric array

Drift time of electron.

+
+
+
+
Return
+
+
Enumeric array

Converted energy

+
+
+
+
+
+ +
+ + +
+
+ +
+