pyepr

Submodules

Attributes

Classes

Sequence

Represents an experimental pulse sequence.

HahnEchoSequence

Represents a Hahn-Echo sequence.

T1InversionRecoverySequence

Represents a T1 Inversion Recovery Sequence.

T2RelaxationSequence

Represents a T2 relaxation sequence. A Hahn Echo where the interpulse delay increases

FieldSweepSequence

Represents a Field Sweep (EDFS) sequence.

ReptimeScan

Represents a reptime scan of a Hahn Echo Sequence.

CarrPurcellSequence

Represents a Carr-Purcell sequence.

ResonatorProfileSequence

Builds nutation based Resonator Profile sequence.

TWTProfileSequence

Builds TWT based Resonator Profile sequence.

Criteria

A class for defining criteria for terminating experiments. This should

TimeCriteria

A class for defining criteria for terminating experiments. This should

SNRCriteria

A class for defining criteria for terminating experiments. This should

Sequence

Represents an experimental pulse sequence.

EPRAccessor

FieldSweepAnalysis

Analysis and calculation of FieldSweep Experiment.

SpinSystem

Sequence

Represents an experimental pulse sequence.

CarrPurcellAnalysis

Analysis and calculation of Carr Purcell decay.

HahnEchoRelaxationAnalysis

Analysis, fitting and plotting for the HahnEchoRelaxation Sequence.

ReptimeAnalysis

Analysis and calculation of Reptime based saturation recovery.

ResonatorProfileAnalysis

Analysis and calculation of resonator profiles.

Functions

eprload(path[, experiment, type])

A general versions of eprload

build_table(source, params, params_widths)

sop(spins, comps)

Spin Operator Matricies.

transpose_dict_of_list(d)

Turns a dictionary of lists into a list of dictionaries.

transpose_list_of_dicts(d)

Turns a list of dictionaries into a dictionary of lists.

save_file(path, str)

autoEPRDecoder(dct)

gcd(values)

Generates the greatest common dividor on a list of floats

val_in_us(Param[, axis])

Returns the value or axis of a parameter in microseconds

val_in_ns(Param)

Returns the value or axis of a parameter in nanoseconds

add_phaseshift(data, phase)

Adds a phase shift to the data

_gen_ESEEM(t, freq, depth)

Add an ESEEM modulation to a time domain signal

round_step(value, step)

val_in_ns(Param)

Returns the value or axis of a parameter in nanoseconds

val_in_us(Param[, axis])

Returns the value or axis of a parameter in microseconds

add_phaseshift(data, phase)

Adds a phase shift to the data

_gen_ESEEM(t, freq, depth)

Add an ESEEM modulation to a time domain signal

create_Nmodel(mwFreq)

Create the field sweep model for a Nitroxide spin system.

build_table(source, params, params_widths)

autoEPRDecoder(dct)

get_all_axes(sequence)

get_all_fixed_param(sequence)

create_dataset_from_sequence(data, sequence[, ...])

create_dataset_from_axes(data, axes[, params, axes_labels])

Create an xarray dataset from a numpy array and a list of axes.

create_dataset_from_bruker(filepath)

get_waveform_precision()

set_waveform_precision(precision)

sop(spins, comps)

Spin Operator Matricies.

create_Nmodel(mwFreq)

Create the field sweep model for a Nitroxide spin system.

erot(*args)

Passive rotation matrix.

eyekron(M)

Calculates the Kronecker product of the identity matrix with a matrix M.

kroneye(M)

Computes the Kronecker product of a matrix with the identity matrix of the same size.

ham(SpinSystem[, elspins, nucspins])

ham_ez(SpinSystem[, B, espins])

ham_nz(SpinSystem[, B, nspins])

resfields(system, Orientations, mwFreq[, ...])

build_spectrum(system, mwFreq, Range[, knots, ...])

Build a field sweep spectrum

detect_ESEEM(dataset[, type, threshold])

Detect if the dataset is an ESEEM experiment.

plot_1Drelax(*args[, fig, axs, cmap, labels])

Create a superimposed plot of relaxation data and fits.

create_dataset_from_axes(data, axes[, params, axes_labels])

Create an xarray dataset from a numpy array and a list of axes.

phase_correct_respro(dataset)

Phase corrects a resonator profile dataset, by making sure the first point of each frequnecy is real

ceil(number[, decimals])

floor(number[, decimals])

calc_overlap(x, func1, func2)

Calcuates the overlap between two functions.

BSpline_extra(tck_s)

optimise_spectra_position(resonator_profile, fieldsweep)

Package Contents

pyepr.__version__[source]
pyepr.eprload(path, experiment=None, type=None, **kwargs)[source]

A general versions of eprload

Parameters:
pathstr

The file path of the data that should be loaded.

experimentstr, optional

_description_, by default None

typestr, optional

_description_, by default None

Returns:
xarray.Dataarray

_description_

Raises:
ValueError

_description_

RuntimeError

_description_

Parameters:
  • path (str)

  • experiment (str)

  • type (str)

pyepr.build_table(source, params, params_widths)[source]
pyepr.sop(spins, comps)[source]

Spin Operator Matricies.

This function is ported from EasySpin (https://easyspin.org/easyspin/documentation/sop.html)

References:

[1] Stefan Stoll, Arthur Schweiger EasySpin, a comprehensive software package for spectral simulation and analysis in EPR J. Magn. Reson. 178(1), 42-55 (2006)

[2] Stefan Stoll, R. David Britt General and efficient simulation of pulse EPR spectra Phys. Chem. Chem. Phys. 11, 6614-6625 (2009)

Parameters:
spinslist

A list of each spin and its spin qunatum number

compsstr

The type of spin operator matrix to create. Options are: x,y,z,+,-,e

pyepr.transpose_dict_of_list(d)[source]

Turns a dictionary of lists into a list of dictionaries.

pyepr.transpose_list_of_dicts(d)[source]

Turns a list of dictionaries into a dictionary of lists.

pyepr.save_file(path, str)[source]
pyepr.autoEPRDecoder(dct)[source]
pyepr.gcd(values)[source]

Generates the greatest common dividor on a list of floats

Parameters:
valueslist

_description_

Parameters:

values (list)

pyepr.val_in_us(Param, axis=True)[source]

Returns the value or axis of a parameter in microseconds

Parameters:
Paramautodeer.Parameter

The parameter to be converted

Returns:
float or numpy.ndarray
pyepr.val_in_ns(Param)[source]

Returns the value or axis of a parameter in nanoseconds

Parameters:
Paramautodeer.Parameter

The parameter to be converted

Returns:
float or numpy.ndarray
pyepr.add_phaseshift(data, phase)[source]

Adds a phase shift to the data

Parameters:
datanumpy.ndarray

The data to be phase shifted

phasefloat

The phase shift in degrees

Returns:
numpy.ndarray
pyepr._gen_ESEEM(t, freq, depth)[source]

Add an ESEEM modulation to a time domain signal

Parameters:
tnumpy.ndarray

The time domain signal

freqfloat

The modulation frequency

depthfloat

The modulation depth

Returns:
numpy.ndarray

The

pyepr.round_step(value, step)[source]
pyepr.val_in_ns(Param)[source]

Returns the value or axis of a parameter in nanoseconds

Parameters:
Paramautodeer.Parameter

The parameter to be converted

Returns:
float or numpy.ndarray
pyepr.val_in_us(Param, axis=True)[source]

Returns the value or axis of a parameter in microseconds

Parameters:
Paramautodeer.Parameter

The parameter to be converted

Returns:
float or numpy.ndarray
pyepr.add_phaseshift(data, phase)[source]

Adds a phase shift to the data

Parameters:
datanumpy.ndarray

The data to be phase shifted

phasefloat

The phase shift in degrees

Returns:
numpy.ndarray
pyepr._gen_ESEEM(t, freq, depth)[source]

Add an ESEEM modulation to a time domain signal

Parameters:
tnumpy.ndarray

The time domain signal

freqfloat

The modulation frequency

depthfloat

The modulation depth

Returns:
numpy.ndarray

The

pyepr.create_Nmodel(mwFreq)[source]

Create the field sweep model for a Nitroxide spin system.

Parameters:
mwFreqfloat

The microwave frequency in MHz

pyepr.build_table(source, params, params_widths)[source]
pyepr.autoEPRDecoder(dct)[source]
pyepr.log[source]
pyepr.get_all_axes(sequence)[source]
pyepr.get_all_fixed_param(sequence)[source]
pyepr.create_dataset_from_sequence(data, sequence, extra_params={})[source]
Parameters:

sequence (pyepr.sequences.Sequence)

pyepr.create_dataset_from_axes(data, axes, params={}, axes_labels=None)[source]

Create an xarray dataset from a numpy array and a list of axes.

Parameters:
datanp.ndarray

The data to be stored in the dataset.

axeslist

A list of numpy arrays containing the axes for each dimension of the data.

paramsdict, optional

A dictionary containing any additional parameters to be stored in the dataset, by default None

axes_labelslist, optional

A list of labels for each axis, by default None

Parameters:

params (dict)

pyepr.create_dataset_from_bruker(filepath)[source]
pyepr.get_waveform_precision()[source]
pyepr.set_waveform_precision(precision)[source]
pyepr.sop(spins, comps)[source]

Spin Operator Matricies.

This function is ported from EasySpin (https://easyspin.org/easyspin/documentation/sop.html)

References:

[1] Stefan Stoll, Arthur Schweiger EasySpin, a comprehensive software package for spectral simulation and analysis in EPR J. Magn. Reson. 178(1), 42-55 (2006)

[2] Stefan Stoll, R. David Britt General and efficient simulation of pulse EPR spectra Phys. Chem. Chem. Phys. 11, 6614-6625 (2009)

Parameters:
spinslist

A list of each spin and its spin qunatum number

compsstr

The type of spin operator matrix to create. Options are: x,y,z,+,-,e

pyepr.primary_colors = ['#D95B6F', '#42A399', '#E1AE38'][source]
pyepr.ReIm_colors = ['#D61B00', '#00BBD6'][source]
pyepr.create_Nmodel(mwFreq)[source]

Create the field sweep model for a Nitroxide spin system.

Parameters:
mwFreqfloat

The microwave frequency in MHz

pyepr.erot(*args)[source]

Passive rotation matrix.

pyepr.eyekron(M)[source]

Calculates the Kronecker product of the identity matrix with a matrix M.

Parameters: M (np.ndarray): The matrix to be multiplied with the identity matrix.

Returns: np.ndarray: The Kronecker product of the identity matrix with M.

Parameters:

M (numpy.ndarray)

pyepr.kroneye(M)[source]

Computes the Kronecker product of a matrix with the identity matrix of the same size.

Args:

M (numpy.ndarray): The matrix to compute the Kronecker product with.

Returns:

numpy.ndarray: The Kronecker product of M with the identity matrix of the same size.

pyepr.ham(SpinSystem, elspins=None, nucspins=None)[source]
pyepr.ham_ez(SpinSystem, B=None, espins=None)[source]
pyepr.ham_nz(SpinSystem, B=None, nspins=None)[source]
pyepr.resfields(system, Orientations, mwFreq, computeIntensities=True, RejectionRatio=1e-08, Range=(0, 100000000.0), Threshold=0, computeFreq2Field=True)[source]
pyepr.build_spectrum(system, mwFreq, Range, knots=19, npoints=1000, Guass_broadening=0.25)[source]

Build a field sweep spectrum

Parameters:
systemSpinSystem

The spin system it must include: I & S spins, g, A, gn

mwFreqfloat

The microwave frequency in MHz

Rangefloat

The field range in mT

knotsint, optional

The number of knots of orientation averaging, by default 19

npointsint, optional

The number of points in the spectrum, by default 1000

Returns:
xAxis: np.ndarray

The xAxis in mT

y: np.ndarray

The spectrum intensities normalised to 1

pyepr.primary_colors = ['#D95B6F', '#42A399', '#E1AE38'][source]
pyepr.detect_ESEEM(dataset, type='deuteron', threshold=1.5)[source]

Detect if the dataset is an ESEEM experiment.

Parameters:
datasetxr.DataArray

The dataset to be analyzed.

typestr, optional

The type of ESEEM experiment, either deuteron or proton, by default ‘deuteron’

thresholdfloat, optional

The SNR threshold for detection, by default 1.5

Returns:
bool

True if ESEEM is detected, False if not.

pyepr.cmap = ['#D95B6F', '#42A399'][source]
pyepr.plot_1Drelax(*args, fig=None, axs=None, cmap=cmap, labels=None)[source]

Create a superimposed plot of relaxation data and fits.

Parameters:
argsad.Analysis

The 1D relaxation data to be plotted.

figFigure, optional

The figure to plot to, by default None

axsAxes, optional

The axes to plot to, by default None

cmaplist, optional

The color map to use, by default ad.cmap

pyepr.create_dataset_from_axes(data, axes, params={}, axes_labels=None)[source]

Create an xarray dataset from a numpy array and a list of axes.

Parameters:
datanp.ndarray

The data to be stored in the dataset.

axeslist

A list of numpy arrays containing the axes for each dimension of the data.

paramsdict, optional

A dictionary containing any additional parameters to be stored in the dataset, by default None

axes_labelslist, optional

A list of labels for each axis, by default None

Parameters:

params (dict)

pyepr.primary_colors = ['#D95B6F', '#42A399', '#E1AE38'][source]
pyepr.phase_correct_respro(dataset)[source]

Phase corrects a resonator profile dataset, by making sure the first point of each frequnecy is real

pyepr.ceil(number, decimals=0)[source]
pyepr.floor(number, decimals=0)[source]
pyepr.calc_overlap(x, func1, func2)[source]

Calcuates the overlap between two functions.

Parameters:
xnp.ndarray

The x axis of the functions

func1function

The first function

func2function

The second function

Returns:
float

The overlap between the two functions.

pyepr.BSpline_extra(tck_s)[source]
pyepr.optimise_spectra_position(resonator_profile, fieldsweep, verbosity=0)[source]
pyepr.primary_colors = ['#D95B6F', '#42A399', '#E1AE38'][source]