WrightTools.kit module

General-purpose tool kit.

INI(filepath)

Handle communication with an INI file.

Spline(xi, yi[, k, s, ignore_nans])

Spline.

TimeStamp([at, timezone])

Class for representing a moment in time.

Timer([verbose])

Context manager for timing code.

closest_pair(arr[, give])

Find the pair of indices corresponding to the closest elements in an array.

diff(xi, yi[, order])

Take the numerical derivative of a 1D array.

discover_dimensions(arr, cols)

Discover the dimensions of a flattened multidimensional array.

enforce_mask_shape(mask, shape)

Reduce a boolean mask to fit a given shape.

fft(xi, yi[, axis])

Compute a discrete Fourier Transform along one axis of an N-dimensional array and also compute the 1D frequency coordinates of the transform.

flatten_list(items[, seqtypes, in_place])

Flatten an irregular sequence.

fluence(power_mW, color, beam_radius, ...[, ...])

Calculate the fluence of a beam.

get_index(lis, argument)

Find the index of an item, given either the item or index as an argument.

get_path_matching(name)

Non-recursive search for path to the folder "name".

glob_handler(extension[, directory, ...])

Return a list of all files matching specified inputs.

intersperse(lis, value)

Put value between each existing item in list.

joint_shape(*args)

Given a set of arrays, return the joint shape.

leastsqfitter(p0, datax, datay, function[, ...])

Conveniently call scipy.optmize.leastsq().

mask_reduce(mask)

Reduce a boolean mask, removing all false slices in any dimension.

mono_resolution(grooves_per_mm, slit_width, ...)

Calculate the resolution of a monochromator.

nm_width(center, width[, units])

Given a center and width, in energy units, get back a width in nm.

orthogonal(*args)

Determine if a set of arrays are orthogonal.

pairwise(iterable)

s -> (s0,s1), (s1,s2), (s2, s3), ...

remove_nans_1D(*args)

Remove nans in a set of 1D arrays.

share_nans(*arrs)

Take a list of nD arrays and return a new list of nD arrays.

smooth_1D(arr[, n, smooth_type])

Smooth 1D data using a window function.

string2identifier(s[, replace])

Turn a string into a valid python identifier.

svd(a[, i])

Singular Value Decomposition.

symmetric_sqrt(x[, out])

Compute the 'symmetric' square root: sign(x) * sqrt(abs(x)).

timestamp_from_RFC3339(RFC3339)

Generate a Timestamp object from a RFC3339 formatted string.

unique(arr[, tolerance])

Return unique elements in 1D array, within tolerance.

valid_index(index, shape)

Get a valid index for a broadcastable shape.

zoom2D(xi, yi, zi[, xi_zoom, yi_zoom, ...])

Zoom a 2D array, with axes.