core subpackge

Scientific Algorithms

cdi.cdi_recon(diffracted_pattern, …[, …])

Run reconstruction with difference map algorithm.

correlation.multi_tau_auto_corr(num_levels, …)

Wraps generator implementation of multi-tau

dpc.recon(gx, gy, scan_xstep, scan_ystep[, …])

Reconstruct the final phase image.

dpc.dpc_runner(ref, image_sequence, …[, …])

Wraps lazy_dpc

recip.process_to_q(setting_angles, …[, …])

This will compute the hkl values for all pixels in a shape specified by detector_size.

Helper Classes

Dictionary-like classes

utils.MD_dict([md_dict])

A class to make dealing with the meta-data scheme for DataExchange easier

utils.verbosedict

A sub-class of dict which raises more verbose errors if a key is not found.

utils.RCParamDict()

A class to make dealing with storing default values easier.

Image warping functions

utils.img_to_relative_xyi(img, cx, cy[, …])

Convert the 2D image to a list of x y I coordinates where x == x_img - detector_center[0] and y == y_img - detector_center[1]

utils.radial_grid(center, shape[, pixel_size])

Convert a cartesian grid (x,y) to the radius relative to some center

utils.angle_grid(center, shape[, pixel_size])

Make a grid of angular positions.

Peak

Peak fitting

feature.peak_refinement(x, y, cands, window, …)

Refine candidate locations

feature.refine_quadratic(x, y[, Rval_thresh])

Attempts to refine the peaks by fitting to a quadratic function.

feature.refine_log_quadratic(x, y[, Rval_thresh])

Attempts to refine the peaks by fitting a quadratic to the log of the y-data.

feature.filter_n_largest(y, cands, N)

Filters the N largest candidate peaks

feature.filter_peak_height(y, cands, thresh)

Filter to remove candidate that are too small.

Peak finding

image.find_ring_center_acorr_1D(input_image)

Find the pixel-resolution center of a set of concentric rings.

spectroscopy.find_largest_peak(x, y[, window])

Finds and estimates the location, width, and height of the largest peak.

Image pre-processing

utils.subtract_reference_images(imgs, …)

Function to subtract a series of measured images from background/dark current/reference images.

Histograms and Integration

Binning

utils.bin_1D(x, y[, nx, min_x, max_x])

Bin the values in y based on their x-coordinates

utils.wedge_integration(src_data, center, …)

Implementation of caking.

utils.grid3d(q, img_stack[, nx, ny, nz, …])

Grid irregularly spaced data points onto a regular grid via histogramming

Helper functions

utils.pairwise(iterable)

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

utils.geometric_series(common_ratio, …[, …])

This will provide the geometric series for the integration.

utils.multi_tau_lags(multitau_levels, …)

Standard multiple-tau algorithm for finding the lag times (delay times).

utils.bin_edges([range_min, range_max, …])

Generate bin edges.

utils.bin_edges_to_centers(input_edges)

Helper function for turning a array of bin edges into an array of bin centers

Generating ROIs

roi.kymograph(images, labels, num)

This function will provide data for graphical representation of pixels variation over time for required ROI.

roi.circular_average(image, calibrated_center)

Circular average of the the image data The circular average is also known as the radial integration

roi.mean_intensity(images, labeled_array[, …])

Compute the mean intensity for each ROI in the image list

roi.roi_pixel_values(image, labels[, index])

This will provide intensities of the ROI’s of the labeled array according to the pixel list eg: intensities of the rings of the labeled array

roi.roi_max_counts(images_sets, label_array)

Return the brightest pixel in any ROI in any image in the image set.

roi.segmented_rings(edges, segments, center, …)

Parameters

roi.ring_edges(inner_radius, width[, …])

Calculate the inner and outer radius of a set of rings.

roi.rings(edges, center, shape)

Draw annual (ring-shaped) shaped regions of interest.

roi.rectangles(coords, shape)

This function wil provide the indices array for rectangle region of interests.

Physical relations

utils.q_to_d(q)

Helper function to convert \(d\) to \(q\).

utils.d_to_q(d)

Helper function to convert \(d\) to \(q\).

utils.q_to_twotheta(q, wavelength)

Helper function to convert q to two-theta.

utils.twotheta_to_q(two_theta, wavelength)

Helper function to convert two-theta to q

utils.radius_to_twotheta(dist_sample, radius)

Converts radius from the calibrated center to scattering angle (2:math:2theta) with known detector to sample distance.

recip.hkl_to_q(hkl_arr)

This module compute the reciprocal space (q) values from known HKL array for each pixel of the detector for all the images

recip.calibrated_pixels_to_q(detector_size, …)

For a given detector and pyfai calibrated geometry give back the q value for each pixel in the detector.

Boolean Logic

arithmetic.logical_nand(x1, x2[, out])

Computes the truth value of NOT (x1 AND x2) element wise.

arithmetic.logical_nor(x1, x2[, out])

Compute truth value of NOT (x1 OR x2)) element wise.

arithmetic.logical_sub(x1, x2[, out])

Compute truth value of x1 AND (NOT (x1 AND x2)) element wise.

Calibration

calibration.estimate_d_blind(name, …)

Estimate the sample-detector distance

calibration.refine_center(image, …[, nx, …])

Refines the location of the center of the beam.