Reference/API
Baseline-determination
Please refer to the tutorial on baseline-determination for some examples.
Iterative method of baseline-determination based on the dual-tree complex wavelet transform. |
|
Iterative method of baseline determination, based on the discrete wavelet transform. |
|
1D Dual-tree complex wavelet transform [1]_ along an axis. |
|
1D Inverse dual-tree complex wavelet transform [1]_ along an axis. |
|
Iterable of available wavelet filters compatible with the dual-tree complex wavelet transform. |
|
Iterable of available wavelet filters compatible with the first stage of dual-tree complex wavelent transform. |
Structure manipulation
Structure manipulation is provided by the crystals library. A summary of the documentation is provided below.
The |
|
Container object for atomic data. |
Bases classes
The Lattice
class allows for manipulating lattice information separately from
atomic information.
Container class for lattice information and manipulations. |
|
Lattice system enumeration. |
|
Base class for atomic structures. |
Parsers
Structure parsers are used to build Crystal
instances, mostly through Crystal
class methods.
Collection of methods that parses CIF files based on cif2cell. |
|
Collection of methods that parses CIF files retrieved from the Crystallography Open Database. |
|
Collection of methods that parses Protein DataBank (PDB) files. |
Time-series Analysis
Time-series exploration and analysis.
Time-zero tracking
Measurement of time-shifts between physically-equivalent time traces:
Measure the time shift between a time trace and a reference trace by normalized cross correlation. |
|
Measure the time shifts between time traces and a reference by cross-correlation. |
Robust statistics
Element-wise median absolute deviation (MAD) of a signal. |
Fitting
Exponential curve with onset. |
|
Bi-exponential curve with onset. |
|
This decorator factory that applies a Gaussian impulse response function (IRF) to a fitting function. |
Non-uniform Fast Fourier Transform
Non-uniform Fast Fourier Transform (NFFT) computed on a uniform frequency grid. |
|
Compute the frequency range used in nfft for M frequency bins. |
Time-series Selections
Abstract base class for time-series selection masks. |
|
Rectangular selection mask. |
|
Disk selection mask. |
|
Ring selection mask, i.e. 2-torus. |
|
Selection patch for a partial 2-torus. |
|
Arbirary selection mask, represented by a boolean array. |
Image Analysis
Combine the routines below with npstreams to process diffraction data in parallel. Refer to the tutorial on image manipulation for some examples.
Symmetry
Returns an images averaged according to n-fold rotational symmetry. |
|
Symmetrize an image according to a reflection plane. |
Polycrystalline diffraction
This function returns an azimuthally-averaged pattern computed from an image, e.g. |
Calibrations
Determine the scattering vector q corresponding to a polycrystalline diffraction pattern and a known crystal structure. |
Center-finding
Find the center of a diffraction pattern automatically. |
Image alignment
Align a diffraction image to a reference. |
|
Generator of aligned diffraction images. |
|
Generator function that tracks a diffraction peak in a stream of images. |
Image masking
Determine binary mask from a set of images. |
|
Combine multiple pixel masks into one. |
|
Fill invalid pixels in an image with another value, according to a pixel mask. |
Image noise
Signal-to-noise ratio (SNR) on a per-pixel basis, for images in a collection. |
|
Streaming, pixelwise signal-to-noise ratio (SNR). |
|
Trim values in an array that fall below (i.e. |
|
Trim values in an array that fall above (i.e. |
Single-crystal indexing
Extract the position of Bragg peaks in a single-crystal diffraction pattern. |
|
Extract the position of Bragg peaks in a single-crystal diffraction pattern using 2D persistence of the image landscape. |
|
Generate Brillouin zone projections in the particular 2D geometry based on Bragg peak locations. |
Simulation
Computation of the static structure factor for electron diffraction. |
|
Atomic form factors for electrons, for neutral atoms. |
|
Simulates polycrystalline diffraction pattern. |
|
Propagate a plane wave through a crystal and compute the resulting diffraction pattern, in the kinematic approximation (thin specimen). |
|
Electrostatic potential from a crystal calculated on a real-space mesh, assuming an infinite crystal. |
|
Projected electrostatic potential from a crystal calculated on a real-space mesh, assuming an infinite crystal in x and y. |
Visualization
Compute the electrostatic potential from powder diffraction data. |
|
Synthesize the electrostatic potential from a list of experimental reflections and associated diffracted intensities. |
|
Computation of the patterson pair-distribution function from azimuthally-averaged diffraction pattern. |
Input/Output
General diffraction image I/O and plotting. Note that
for diffshow()
, the packages PyQtGraph and PyQt5 must be
installed.
Load an image from a file. |
|
Display an image (from an array or from a file) in an interactive window. |
Note
You should prefer to use diffread()
to the specific format
functions like mibread()
and dmread()
Digital Micrograph DM3/DM4:
Read a DM3/DM4 (Digital Micrograph) file into a NumPy array. |
Merlin Image Binary (.mib) files:
Get an image header from a Merlin Image Binary file. |
|
Read a MIB (Merlin Image Binary) file into a NumPy array. |
|
Generator of images contained in a Merlin Image Binary file as NumPy arrays. |
Plot Utilities
Generates a set of RGB colors corresponding to the visible spectrum (i.e. |
|
Rainbow-style Matplotlib colormap generated from |
|
Generate a set of RGB colors as a linear sweep between two RGB colors source and dest. |
|
Returns a Matplotlib-compatible string representation of Miller indices, in LaTeX/Mathjax format. |
Array Utilities
Reverse array over many axes. |
|
Create a composite array from repeated copies of an array |
|
Transform cartesian coordinates to polar coordinates. |
|
Transform polar coordinates to cartesian coordinates. |
|
Transform cartesian coordinates into spherical coordinates . |
|
Transform spherical coordinates into cartesian coordinates. |
|
Generate a spatial mesh for a plane defined by two vectors. |
Electron Properties
Relativistic wavelength \(\lambda\) of an accelerated electron. |
|
Relativistic velocity \(v_e\) of an accelerated electron. |
|
Interaction parameter from relativistic electron wavelength. |
|
Relativistic factor \(\gamma\), defined as \(\gamma = \frac{1}{\sqrt{1 - v^2/c^2}}\) |
Thin Film Optical Properties
Calculate the reflection, transmission, and absorption coefficients of a thin-film (possibly on a substrate). |
Voigt Profile
Unit integral Gaussian function. |
|
Unit integral Lorenzian function. |
|
Unit integral pseudo-Voigt profile. |
Affine Transforms
Extends 3x3 transform matrices to 4x4, i.e. general affine transforms. |
|
Applies a matrix transform on an array. |
|
Returns the matrix that goes from one basis to the other. |
|
Changes the basis of meshgrid arrays. |
|
Returns true if the set of vectors forms a basis. |
|
Checks whether a matrix is orthogonal with unit determinant (1 or -1), properties of rotation matrices. |
|
Returns a periodic array according to the minimum image convention. |
|
Return matrix to rotate about axis defined by direction around the origin [0,0,0]. |
|
Return matrix to translate by direction vector. |
|
Returns a 4x4 matrix that includes a rotation and a translation. |