Reading & Creating Data
Reading .DSC Data
- dive.deerload.deerload(name: str, scaling: str | None = None, plot: bool = False) tuple[ndarray, ndarray, dict]
Loads DEER data from a .DSC or .DTA file.
Loads file in BES3T format (Bruker EPR Standard for Spectrum Storage and Transfer)
.DSC: description file .DTA: data file
which is used on Bruker ELEXSYS and EMX machines. Code based on BES3T version 1.2 (Xepr >=2.1).
- Parameters:
name (str) – The full filename, including the .DTA or .DSC extension.
scaling (str, optional) – The scaling to use. Options are ‘n’ (number of scans), ‘G’ (receiver gain), ‘C’ (conversion time), ‘P’ (power), and ‘T’ (temperature).
plot (bool, default=False) – Whether or not to plot the data once loaded.
- Returns:
(abcissa, data, parameters) – The x-axis values, y-axis values, and additional parameters, respectively.
- Return type:
tuple of np.ndarray, np.ndarray, dict
- dive.deerload.read_description_file(name: str) dict
Retrieves the parameters from a .DSC files as a dictionary.
- Parameters:
name (str) – The filename to be read, including the .DSC extension.
- Returns:
Parameters – A dictionary of the parameters in the .DSC file.
- Return type:
dict
Creating Synthetic Data
- dive.test_data.generate_multi_gauss(r0: tuple[float, ...] = [4, 4.8], w: tuple[float, ...] = [0.6, 1.2], a: tuple[float, ...] = [0.6, 0.4], lamb: float = 0.5, k: float = 0.1, V0: float = 1, sigma: float = 0.01, seed: int = 0, nr: int = 800, nt: int = 150, r_lim: tuple[float, float] = [1, 10], t_lim: tuple[float, float] = [-0.1, 2.5]) tuple[dict, dict]
Generates a multi-gauss P(r) and associated V(t).
- Parameters:
r0 (tuple of float, default=[4,4.8]) – The means of the Gaussians.
w (tuple of flaot, default=[0.3,0.6]) – The full widths at half maximum of the Gaussians.
a (tuple of float, default=[0.6,0.4]) – The amplitudes of the Gaussians.
lamb (float, default=0.5) – The modulation depth.
k (float, default=0.1) – The background decay rate.
V0 (float, default=1) – The signal amplitude.
sigma (float, default=0.01) – The noise level.
seed (int, default=0) – The random seed to use.
nr (int, default=800) – The number of points to use for the distance axis.
nt (int, default=150) – The number of points to use for the time axis.
r_lim (tuple of float, float) – The minimum and maximum values of the distance axis.
t_lim (tuple of float, float) – The minimum and maximum values of the time axis.
- Returns:
(data, pars) – The data dictionary contains the P(r) and V(t) data. The ‘pars’ dictionary stores the parameters used for data generation.
- Return type:
tuple of dict, dict
See also
dl.dd_gauss2
- dive.test_data.generate_single_gauss(r0: float = 4, w: float = 0.4, lamb: float = 0.5, k: float = 0.1, V0: float = 1, sigma: float = 0.01, seed: int = 0, nr: int = 800, nt: int = 150, r_lim: tuple[float, float] = [1, 10], t_lim: tuple[float, float] = [-0.1, 2.5]) tuple[dict, dict]
Generates a single-gauss P(r) and associated V(t).
- Parameters:
r0 (float, default=4) – The mean of the Gaussian.
w (float, default=0.4) – The full width at half-maximum of the Gaussian.
lamb (float, default=0.5) – The modulation depth.
k (float, default=0.1) – The background decay rate.
V0 (float, default=1) – The signal amplitude.
sigma (float, default=0.01) – The noise level.
seed (int, default=0) – The random seed to use.
nr (int, default=800) – The number of points to use for the distance axis.
nt (int, default=150) – The number of points to use for the time axis.
r_lim (tuple of float, float) – The minimum and maximum values of the distance axis.
t_lim (tuple of float, float) – The minimum and maximum values of the time axis.
- Returns:
(data, pars) – The data dictionary contains the P(r) and V(t) data. The ‘pars’ dictionary stores the parameters used for data generation.
- Return type:
tuple of dict, dict
See also
dl.dd_gauss
Creating P(r) and B(t)
- dive.deer.bg_exp(t: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], k: float) ndarray
Generates an exponential background decay vector from k.
- Parameters:
t (ArrayLike) – The time axis to generate the background decay on.
k (float) – The exponent of the exponential decay.
- Returns:
B – The background decay vector.
- Return type:
np.ndarray
- dive.deer.bg_hom3d(t: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], conc: float, lamb: float) ndarray
Generates an exponential decay vector from conc and lamb.
Assumes a homogeneous 3D distribution of background spins.
- Parameters:
t (ArrayLike) – The time axis to generate the background decay on.
conc (float) – The spin concentration in micromolars.
lamb (float) – The modulation depth.
- Returns:
B – The background decay vector.
- Return type:
np.ndarray
- dive.deer.dd_gauss(r: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], r0: float | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], fwhm: float | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], a: float | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] = 1) ndarray
Calculates a multi-Gauss distance distribution.
Requires the distance vector r in nanometers and the mean, width, and amplitude of each gaussian distribution. The distance distribution will be normalized such that integrates to 1 over r.
- Parameters:
r (ArrayLike) – The distance axis to generate P on.
r0 (float or ArrayLike of float) – The mean(s) of the Gaussian(s).
fwhm (float or ArrayLike of float) – The full width(s) at half maximum of the Gaussian(s).
a (float or ArrayLike of float, default=1) – The amplitudes of the Gaussians, for a multi-Gauss distribution.
- Returns:
P – A normalized vector of the distance distribution.
- Return type:
np.ndarray
- dive.deer.gauss(r: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], r0: float, sig: float) ndarray
Calculates a single-Gauss distance distribution.
Requires the distance vector r in nanometers and the mean and standard deviation of the Gaussian. The distance distribution will be normalized such that it integrates to 1 over r.
- Parameters:
r (ArrayLike) – The distance axis to generate P on.
r0 (float) – The mean of the Gaussian.
sig (float) – The standard deviation of the Gaussian.
- Returns:
P – A normalized vector of the distance distribution.
- Return type:
np.ndarray