autodeer

Subpackages

Submodules

Package Contents

Classes

FieldSweepAnalysis

Analysis and calculation of FieldSweep Experiment.

ResonatorProfileAnalysis

Analysis and calculation of resonator profiles.

Sequence

Represents an experimental pulse sequence.

CarrPurcellAnalysis

Analysis and calculation of Carr Purcell decay.

ReptimeAnalysis

Analysis and calculation of Reptime based saturation recovery.

RefocusedEcho2DAnalysis

Analysis and calculation of Refocused Echo 2D data.

Parameter

Represents a sequence or pulse parameter.

Interface

Represents the interface connection from autoEPR to the spectrometer.

Parameter

Represents a sequence or pulse parameter.

Pulse

Represents a general experimental pulse.

Detection

Represents a detection pulse.

Delay

DEPRECATION WARNING: THIS WILL BE REMOVED SOON.

RectPulse

Represents a rectangular monochromatic pulse.

Sequence

Represents an experimental pulse sequence.

DEERSequence

Represents a DEER/PELDOR sequence.

HahnEchoSequence

Represents a Hahn-Echo 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.

RefocusedEcho2DSequence

Represents a 2D Refocused-echo Sequence.

ResonatorProfileSequence

Builds nutation based Resonator Profile sequence.

TWTProfileSequence

Builds TWT based Resonator Profile sequence.

Parameter

Represents a sequence or pulse parameter.

Pulse

Represents a general experimental pulse.

Detection

Represents a detection pulse.

Delay

DEPRECATION WARNING: THIS WILL BE REMOVED SOON.

RectPulse

Represents a rectangular monochromatic pulse.

GaussianPulse

Represents a Gaussian monochromatic pulse.

FrequencySweptPulse

A general parent class for Frequency Swept Pulses.

HSPulse

Represents a hyperboilc secant frequency-swept pulse.

ChirpPulse

Represents a linear frequency-swept pulse.

SincPulse

Represents a general experimental pulse.

Pulse

Represents a general experimental pulse.

Detection

Represents a detection pulse.

Parameter

Represents a sequence or pulse parameter.

Interface

Represents the interface connection from autoEPR to the spectrometer.

Sequence

Represents an experimental pulse sequence.

DEERSequence

Represents a DEER/PELDOR sequence.

EPRAccessor

Reporter

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

round_step(value, step)

optimise_spectra_position(resonator_profile, fieldsweep)

detect_ESEEM(dataset[, type, threshold])

Detect if the dataset is an ESEEM experiment.

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

Create a superimposed plot of relaxation data and fits.

build_table(source, params, params_widths)

autoEPRDecoder(dct)

build_table(source, params, params_widths)

sop(spins, comps)

Spin Operator Matricies.

autoEPRDecoder(dct)

build_default_pulses([AWG, SPFU, tp])

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_dataset_from_bruker(filepath)

combo_figure(EDFS, respro, pulses, relaxation, ...[, ...])

Creates a 2x2 summary figure.

Attributes

autodeer.__version__ = "'0.8'"[source]
autodeer.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)

autodeer.build_table(source, params, params_widths)[source]
autodeer.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

autodeer.transpose_dict_of_list(d)[source]

Turns a dictionary of lists into a list of dictionaries.

autodeer.transpose_list_of_dicts(d)[source]

Turns a list of dictionaries into a dictionary of lists.

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

Generates the greatest common dividor on a list of floats

Parameters:
valueslist

_description_

Parameters:

values (list)

autodeer.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
autodeer.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
autodeer.round_step(value, step)[source]
class autodeer.FieldSweepAnalysis(dataset)[source]

Analysis and calculation of FieldSweep Experiment.

Parameters:
datasetxarray.Dataarray

_description_

Parameters:

dataset (xarray.DataArray)

data
find_max()[source]

Calculates the maximum field

Returns:
float

Max field

Return type:

float

calc_gyro(LO=None)[source]

Calculates the gyromagnetic ratio for a given frequency

Parameters:
det_frqfloat

The detection frequency for the field sweep.

Returns:
float

The gyromagnetic ratio in G/GHz.

Parameters:

LO (float)

Return type:

float

calc_noise_level(SNR_target=30)[source]
smooth(*args, **kwargs)[source]

Generates a smoothed version of the data using a 1D smoothing spline.

Returns:
np.ndarray

The smoothed data.

fit(spintype='N', **kwargs)[source]
plot(norm=True, axis='field', axs=None, fig=None)[source]

Generate a field sweep plot

Parameters:
normbool, optional

Nomarlisation of the plot to a maximum of 1, by default True

axisstr, optional

plot field sweep on either the “field” axis or “freq” axis

Returns:
Matplotlib.Figure

matplotlib figure

Parameters:
  • norm (bool)

  • axis (str)

Return type:

matplotlib.figure.Figure

class autodeer.ResonatorProfileAnalysis(dataset, f_lims=(32, 36))[source]

Analysis and calculation of resonator profiles.

Parameters:
datasetxr.xarray

The dataset containing the nutations. It must have both a ‘LO’ axis and a ‘pulse0_tp’ axis.

f_limstuple, optional

The frequency limits of the resonator profile, by default (33,35)

dataset
n_files
t
f_lims
process_nutations(noisedensity=None, threshold=2, nfft=1000)[source]

Uses a power series to extract the resonator profile.

Parameters:
noisedensitytuple, optional

If not given the first trace is assumed to be so far off resonance that it is just noise.

nfft: int, optional

The length of the fft to be used, zero padded if requred, default is 1000.

threshold: int, optional

The multiples above the noise a single must be to not be excluded, default is 2.

Returns:
prof_data: np.ndarray

The resonator profile, give in nutation frequency (GHz)

prof_frqs: np.ndarray

The frequency axis in GHz

Parameters:
  • noisedensity (float)

  • threshold (int)

  • nfft (int)

_process_fit(R_limit=0.5)[source]
fit(f_diff_threshold=2, cores=1, multi_mode=False, fc_guess=None)[source]

Fit the resonator profile with a sum of lorentzians.

Parameters:
f_diff_thresholdfloat, optional

The difference between two peaks at which they will be merged into one, by default 0.03

plot(fieldsweep=None, axs=None, fig=None)[source]

plot.

Parameters:
fieldsweepFieldSweepAnalysis, optional

Overlays the FieldSweep if provided, by default None

axsmatplotlib.Axes, optional

Axes to plot on, by default None

figmatplotlib.Figure, optional

Figure to plot on, by default None

Returns:
Matplotlib.Figure

matplotlib figure object

autodeer.optimise_spectra_position(resonator_profile, fieldsweep, verbosity=0)[source]
class autodeer.Sequence(*, name, B, LO, reptime, averages, shots, **kwargs)[source]

Represents an experimental pulse sequence.

Represents an experimental pulse sequence.

Parameters:
namestr

The name of this pulse sequence

Bfloat

The magnetic field for this sequence in Gauss.

LOfloat

The central frequency of this sequence. I.e. The frequnecy at which a zero offset pulse is at.

reptimefloat

The shot repetition time in us.

averagesint

The number of scans to be accumulated.

shotsitn

The number of shots per point.

property seqtable_steps
pulses = '[]'
num_pulses
axes_uuid = '[]'
reduce_uuid = '[]'
LO
averages
shots
name
progTable
plot()[source]
Return type:

None

plot_pulse_exc(FieldSweep=None, ResonatorProfile=None)[source]
addPulse(pulse)[source]

Adds a pulse to the next position in the sequence.

Parameters:
pulsePulse

The object describing the pulse.

_estimate_time()[source]

Calculates the estimated experiment time in seconds.

_buildPhaseCycle()[source]
evolution(params, reduce=[])[source]
shift_detfreq_to_zero()[source]
isPulseFocused()[source]

Is the sequence expressed to contain only pulses and no delays?

isDelayFocused()[source]

Is the sequence expressed to contain both pulses and delays?

convert(*, reduce=True)[source]

Converts the current sequence to either pulse focused or delay focused depending on the current state

Parameters:
reducebool, optional

Reduce to the smallest number of objects, by default True

_convert_to_delay()[source]
_convert_to_pulses()[source]
_checkRect()[source]

Checks if all the pulses in the sequence are rectangular.

Return type:

bool

__str__()[source]
copy()[source]
_to_dict()[source]
_to_json()[source]
save(filename)[source]

Save the sequence to a JSON file.

Parameters:
filenamestr

Path to the JSON file.

Returns:
None
Raises:
TypeError

If the object cannot be serialized to JSON.

classmethod _from_dict(dct)[source]
classmethod _from_json(JSONstring)[source]
classmethod load(filename)[source]

Load an object from a JSON file.

Parameters:
filenamestr

Path to the JSON file.

Returns:
objSequence

The Sequence loaded from the JSON file.

Raises:
FileNotFoundError

If the file does not exist.

class autodeer.CarrPurcellAnalysis(dataset, sequence=None)[source]

Analysis and calculation of Carr Purcell decay.

Parameters:
dataset

_description_

Parameters:

sequence (autodeer.sequences.Sequence)

dataset
data
fit(type='mono')[source]

Fit the experimental CP decay

Parameters:
typestr, optional

Either a mono or double exponential decay model, by default “mono”

Parameters:

type (str)

plot(norm=True, axs=None, fig=None)[source]

Plot the carr purcell decay with fit, if avaliable.

Parameters:
normbool, optional

Normalise the fit to a maximum of 1, by default True

Returns:
Figure

The figure.

Parameters:

norm (bool)

Return type:

matplotlib.figure.Figure

check_decay(level=0.05)[source]

Checks that the data has decayed by over 5% in the entire length and less than 5% in the first 30% of the data.

Parameters:
levelfloat, optional

The level to check the decay, by default 0.05

Returns:
int

0 if both conditions are met, 1 if the decay is less than 5% in the first 30% of the data, and -1 if the decay is less than 5% in the entire length.

find_optimal(SNR_target, target_time, target_step, averages=None)[source]

Calculate the optimal inter pulse delay for a given total measurment time.

Parameters:
SNR_target: float,

The Signal to Noise ratio target.

target_timefloat

The target time in hours

target_shrtfloat

The shot repettition time of target in seconds

target_step: float

The target step size in ns.

averagesint, optional

The total number of shots taken, by default None. If None, the number of shots will be calculated from the dataset.

Returns:
float

The calculated optimal time in us

Parameters:

target_time (float)

Return type:

float

class autodeer.ReptimeAnalysis(dataset, sequence=None)[source]

Analysis and calculation of Reptime based saturation recovery.

Parameters:
dataset

The dataset to be analyzed.

sequenceSequence, optional

The sequence object describing the experiment. (not currently used)

Parameters:

sequence (autodeer.sequences.Sequence)

axis
seq
fit(**kwargs)[source]
plot(axs=None, fig=None)[source]
calc_optimal_reptime(recovery=0.9)[source]
autodeer.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.

autodeer.cmap = "['#D95B6F', '#42A399']"[source]
autodeer.plot_1Drelax(*args, fig=None, axs=None, cmap=cmap)[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

class autodeer.RefocusedEcho2DAnalysis(dataset, sequence=None)[source]

Analysis and calculation of Refocused Echo 2D data.

Parameters:
dataset

The dataset to be analyzed.

sequenceSequence, optional

The sequence object describing the experiment. (not currently used)

Parameters:

sequence (autodeer.sequences.Sequence)

axis = '[]'
dataset
data
_smooth(elements=3)[source]

Used SVD to smooth the 2D data.

Parameters:
elementsint, optional

The number of elements to use in the smoothing, by default 3

Returns:
np.ndarray

The smoothed data.

plot2D(contour=True, smooth=False, norm='Normal', axs=None, fig=None)[source]

Create a 2D plot of the 2D relaxation data.

Parameters:
contourbool, optional

Plot the contour of the data, by default True

normstr, optional

Normalise the data, by default ‘Normal’. Options are ‘Normal’ and ‘tau2’. With ‘tau2’ normalisation, the data is normalised to the maximum of each row.

axsAxes, optional

The axes to plot to, by default None

figFigure, optional

The figure to plot to, by default None

plot1D(axs=None, fig=None)[source]

Create a 1D plot of the 2D relaxation data.

Parameters:
axsAxes, optional

The axes to plot to, by default None

figFigure, optional

The figure to plot to, by default None

find_optimal(type, SNR_target, target_time, target_step, averages=None)[source]

Calculate the optimal inter pulse delay for a given total measurment time, using either 4pulse or 5pulse data.

Parameters:
typestr

The type of data to use, either ‘4pDEER’ or ‘5pDEER’

SNR_targetfloat

The Signal to Noise ratio target.

target_timefloat

The target time in hours

target_step: float

The target step size in ns.

averagesint, optional

The total number of shots taken, by default None. If None, the number of shots will be calculated from the dataset.

Returns:
tau1: float

The calculated optimal tau1 in us

tau2: float

The calculated optimal tau2 in us

Parameters:
  • type (str)

  • target_time (float)

Return type:

float

optimal_tau1(tau2=None)[source]
class autodeer.Parameter(name, value, unit='', description='', virtual=False, **kwargs)[source]

Represents a sequence or pulse parameter.

A general parameter.

Parameters:
namestr

The parameter name

valuefloat or int

The parameter value, eithe initial or static

unitstr, optional

The unit of parameter, by default None. Leave as None if unitless.

descriptionstr, optional

A brief description of the parameter, by default None

axisnp.ndarray, optional

The difference from the intial value for each position in a dynamic axis. Can be n-dimensional, by default None.

ax_idlist, optional
virtual: bool, optional

A virtual paramter is only used to vary other parameters, it is not varied itself and will not be directly passed to a spectrometer. This parameter is never inherited. By default, False

Attributes:
progressivebool

Is the parameter used in any progression or is it constant

progdict

A dict containing progressive programs for this parameter. This list has two elements. 1) The axis_id”s and 2) the “axis” of values.

Examples

Creating a static parameter ``` Par1 = Parameter(

name=”Par1”, value=10, unit=”us”, description=”The first parameter”)

` Creating a dynamic parameter ` Par1 = Parameter(

name=”Par1”, value=10, unit=”us”, description=”The first parameter”, axis=np.arange(0,10,1), axis_id=0)

```

Adding a parameter and a number: ``` Par1 = Parameter(

name=”Par1”, value=10, unit=”us”, description=”The first parameter”)

Par2 = Par1 + 2

property dim
name
unit
description
virtual
axis = '[]'
ax_id = '[]'
add_axis(axis_id, axis)[source]
get_axis()[source]
remove_dynamic()[source]
is_static()[source]
Return type:

bool

__eq__(__o)[source]
Parameters:

__o (object)

Return type:

bool

__add__(__o)[source]
Parameters:

__o (object)

__sub__(__o)[source]
Parameters:

__o (object)

__mul__(__o)[source]
Parameters:

__o (object)

__rmul__(__o)[source]
Parameters:

__o (object)

copy()[source]
_to_dict()[source]
_to_json()[source]
save(filename)[source]

Save the parameter to a JSON file.

Parameters:
filenamestr

Path to the JSON file.

Returns:
None
Raises:
TypeError

If the object cannot be serialized to JSON.

static _from_dict(dict)[source]
classmethod _from_json(JSONstring)[source]
classmethod load(filename)[source]

Load a Parameter object from a JSON file.

Parameters:
filenamestr

Path to the JSON file.

Returns:
objParameter

The Pulse loaded from the JSON file.

Raises:
FileNotFoundError

If the file does not exist.

class autodeer.Interface(log=None)[source]

Represents the interface connection from autoEPR to the spectrometer.

pulses
savefolder
savename = "''"
resonator = 'None'
connect()[source]
Return type:

None

acquire_dataset(data)[source]

Acquires the dataset.

launch(sequence, savename)[source]

Launches the experiment and initialises autosaving.

Parameters:
sequenceSequence

The sequence to be launched

savenamestr

The savename for this measurement. A timestamp will be added to the value.

Parameters:

savename (str)

isrunning()[source]
Return type:

bool

terminate()[source]

Terminates the experiment immediately.

Return type:

None

terminate_at(criterion, test_interval=2, keep_running=True, verbosity=0, autosave=True)[source]

Terminates the experiment upon a specific condition being satisified.

Parameters:
criterion_type_

The criteria to be tested.

test_intervalint, optional

How often should the criteria be tested in minutes, by default 10.

keep_runningbool, optional

If True, an error will not be raised if the experiment finishes before the criteria is met, by default True.

verbosityint, optional

The verbosity level, by default 0.

autosavebool, optional

If True, the data will be autosaved, by default True.

class autodeer.Parameter(name, value, unit='', description='', virtual=False, **kwargs)[source]

Represents a sequence or pulse parameter.

A general parameter.

Parameters:
namestr

The parameter name

valuefloat or int

The parameter value, eithe initial or static

unitstr, optional

The unit of parameter, by default None. Leave as None if unitless.

descriptionstr, optional

A brief description of the parameter, by default None

axisnp.ndarray, optional

The difference from the intial value for each position in a dynamic axis. Can be n-dimensional, by default None.

ax_idlist, optional
virtual: bool, optional

A virtual paramter is only used to vary other parameters, it is not varied itself and will not be directly passed to a spectrometer. This parameter is never inherited. By default, False

Attributes:
progressivebool

Is the parameter used in any progression or is it constant

progdict

A dict containing progressive programs for this parameter. This list has two elements. 1) The axis_id”s and 2) the “axis” of values.

Examples

Creating a static parameter ``` Par1 = Parameter(

name=”Par1”, value=10, unit=”us”, description=”The first parameter”)

` Creating a dynamic parameter ` Par1 = Parameter(

name=”Par1”, value=10, unit=”us”, description=”The first parameter”, axis=np.arange(0,10,1), axis_id=0)

```

Adding a parameter and a number: ``` Par1 = Parameter(

name=”Par1”, value=10, unit=”us”, description=”The first parameter”)

Par2 = Par1 + 2

property dim
name
unit
description
virtual
axis = '[]'
ax_id = '[]'
add_axis(axis_id, axis)[source]
get_axis()[source]
remove_dynamic()[source]
is_static()[source]
Return type:

bool

__eq__(__o)[source]
Parameters:

__o (object)

Return type:

bool

__add__(__o)[source]
Parameters:

__o (object)

__sub__(__o)[source]
Parameters:

__o (object)

__mul__(__o)[source]
Parameters:

__o (object)

__rmul__(__o)[source]
Parameters:

__o (object)

copy()[source]
_to_dict()[source]
_to_json()[source]
save(filename)[source]

Save the parameter to a JSON file.

Parameters:
filenamestr

Path to the JSON file.

Returns:
None
Raises:
TypeError

If the object cannot be serialized to JSON.

static _from_dict(dict)[source]
classmethod _from_json(JSONstring)[source]
classmethod load(filename)[source]

Load a Parameter object from a JSON file.

Parameters:
filenamestr

Path to the JSON file.

Returns:
objParameter

The Pulse loaded from the JSON file.

Raises:
FileNotFoundError

If the file does not exist.

class autodeer.Pulse(*, tp, t=None, scale=None, flipangle=None, pcyc=[0], name=None, **kwargs)[source]

Represents a general experimental pulse.

The class for a general pulse.

Parameters:
tpfloat

The pulse length in ns.

scalefloat

The arbitary experimental pulse amplitude, 0-1.

tfloat, optional

The pulse start time in ns.

property bandwidth
property amp_factor

The B1 amplitude factor (nutation frequency) for the pulse in GHz

name
Progression = 'False'
_addPhaseCycle(phases, detections=None)[source]

Adds a phase cycle to the pulse sequence.

Args:

phases (list): List of phases to add to the phase cycle. detections (list, optional): List of detection signs. Defaults to None. If None then all cycles are summed.

Returns:

None

_buildFMAM(func, ax=None)[source]

Builds the amplitude modulation (AM) and frequency modulation (FM) of a given function.

Args:

func: A function that takes in an array of values and returns two arrays, representing the AM and FM of the function.

Returns:

Two arrays representing the AM and FM of the function.

build_shape(ax=None)[source]
build_table()[source]

Builds a table of variables, axes, and UUIDs for all non-static Parameters in the object.

Returns:

dict: A dictionary containing the following keys: “Variable”, “axis”, and “uuid”. The values for each key are lists of the corresponding values for each non-static Parameter.

is_static()[source]

Check if all parameters in the pulse object are static.

Returns:

bool: True if all parameters are static, False otherwise.

isDelayFocused()[source]

Does the pulse contain a specified time, t?

If so then it is not delay focused.

isPulseFocused()[source]

Does the pulse contain a specified time, t?

If so then it is delay focused.

plot(pad=1000)[source]

Plots the time domain representation of this pulse.

Parameters:
padint, optional

The number of zeros to pad the data with, by default 1000

_calc_fft(pad=10000)[source]
exciteprofile(freqs=None, resonator=None)[source]

Excitation profile

Generates the exciatation profiles for this pulse.

This function is ported from EasySpin (https://easyspin.org/easyspin/documentation/sop.html) [1-2], and based upon the method from Gunnar Jeschke, Stefan Pribitzer and Andrin Doll[3].

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)

[3] Jeschke, G., Pribitzer, S. & DollA. Coherence Transfer by Passage Pulses in Electron Paramagnetic Resonance Spectroscopy. J. Phys. Chem. B 119, 13570-13582 (2015)

Parameters:
freqs: np.ndarray, optional

The frequency axis. Caution: A larger number of points will linearly increase computation time.

resonator: ad.ResonatorProfile, optional
Returns:
Mx: np.ndarray

The magentisation in the X direction.

My: np.ndarray

The magentisation in the Y direction.

Mz: np.ndarray

The magentisation in the Z direction.

plot_fft()[source]
_pcyc_str()[source]
__str__()[source]
copy(clear=False, **kwargs)[source]

Creates a deep-copy of the pulse. I.e. Every parameter object is re-created at another memory space.

Parameter can be chaged at this stage by adding them as keyword- arguments (kwargs).

Returns:
Pulse

A deep copy of the pulse

_to_dict()[source]
_to_json()[source]
save(filename)[source]

Save the Pulse to a JSON file.

Parameters:
filenamestr

Path to the JSON file.

Returns:
None
Raises:
TypeError

If the object cannot be serialized to JSON.

classmethod _from_dict(dct)[source]
classmethod _from_json(JSONstring)[source]
classmethod load(filename)[source]

Load a Pulse object from a JSON file.

Parameters:
filenamestr

Path to the JSON file.

Returns:
objPulse

The Pulse loaded from the JSON file.

Raises:
FileNotFoundError

If the file does not exist.

class autodeer.Detection(*, tp, t=None, freq=0, **kwargs)[source]

Bases: Pulse

Represents a detection pulse.

A general detection pulse.

Parameters:
tpfloat

The total time of the detection event. The detection event will be symetrical about the centre time.

tfloat, optional

The centre time of the detection event

freq: float, optional

The detection frequency, not all spectrometer support this functionality, by default 0 MHz

scale = 'None'
freq
pcyc = 'None'
class autodeer.Delay(*, tp, t=None)[source]

Bases: Pulse

DEPRECATION WARNING: THIS WILL BE REMOVED SOON.

Represents a inter-pulse delay pulse.

The class for a general pulse.

Parameters:
tpfloat

The pulse length in ns.

scalefloat

The arbitary experimental pulse amplitude, 0-1.

tfloat, optional

The pulse start time in ns.

tp
pcyc = 'None'
scale = 'None'
class autodeer.RectPulse(tp=16, freq=0, t=None, flipangle=None, **kwargs)[source]

Bases: Pulse

Represents a rectangular monochromatic pulse.

Parameters:
tpflaot, optional

Pulse Length in ns, by default 16

freqfloat,optional

Frequency in MHz, by default 0

tfloat, optional

Time position in ns, by default None

flipangle_type_, optional

The flip angle in radians, by default None

freq
func(ax)[source]
autodeer.build_table(source, params, params_widths)[source]
autodeer.autoEPRDecoder(dct)[source]
class autodeer.Sequence(*, name, B, LO, reptime, averages, shots, **kwargs)[source]

Represents an experimental pulse sequence.

Represents an experimental pulse sequence.

Parameters:
namestr

The name of this pulse sequence

Bfloat

The magnetic field for this sequence in Gauss.

LOfloat

The central frequency of this sequence. I.e. The frequnecy at which a zero offset pulse is at.

reptimefloat

The shot repetition time in us.

averagesint

The number of scans to be accumulated.

shotsitn

The number of shots per point.

property seqtable_steps
pulses = '[]'
num_pulses
axes_uuid = '[]'
reduce_uuid = '[]'
LO
averages
shots
name
progTable
plot()[source]
Return type:

None

plot_pulse_exc(FieldSweep=None, ResonatorProfile=None)[source]
addPulse(pulse)[source]

Adds a pulse to the next position in the sequence.

Parameters:
pulsePulse

The object describing the pulse.

_estimate_time()[source]

Calculates the estimated experiment time in seconds.

_buildPhaseCycle()[source]
evolution(params, reduce=[])[source]
shift_detfreq_to_zero()[source]
isPulseFocused()[source]

Is the sequence expressed to contain only pulses and no delays?

isDelayFocused()[source]

Is the sequence expressed to contain both pulses and delays?

convert(*, reduce=True)[source]

Converts the current sequence to either pulse focused or delay focused depending on the current state

Parameters:
reducebool, optional

Reduce to the smallest number of objects, by default True

_convert_to_delay()[source]
_convert_to_pulses()[source]
_checkRect()[source]

Checks if all the pulses in the sequence are rectangular.

Return type:

bool

__str__()[source]
copy()[source]
_to_dict()[source]
_to_json()[source]
save(filename)[source]

Save the sequence to a JSON file.

Parameters:
filenamestr

Path to the JSON file.

Returns:
None
Raises:
TypeError

If the object cannot be serialized to JSON.

classmethod _from_dict(dct)[source]
classmethod _from_json(JSONstring)[source]
classmethod load(filename)[source]

Load an object from a JSON file.

Parameters:
filenamestr

Path to the JSON file.

Returns:
objSequence

The Sequence loaded from the JSON file.

Raises:
FileNotFoundError

If the file does not exist.

class autodeer.DEERSequence(*, tau1, tau2, tau3=None, tau4=None, dt, B, LO, reptime, averages, shots, ESEEM_avg=None, **kwargs)[source]

Bases: Sequence

Represents a DEER/PELDOR sequence.

Build a DEER sequence using rectangular pulses

Parameters:
tau1int or float

The first interpulse delay in us

tau2int or float

The second interpulse delay in us

dtint or float

The time step for DEER measurment in ns

Bint or float

The B0 field, in Guass

LOint or float

The LO frequency in GHz

reptime_type_

The shot repetition time in us

averagesint

The number of scans.

shotsint

The number of shots per point

tau3int or float, optional

The delay between the first static pump pulse in 5-pulse DEER and the 1st refocusing pulse in us, by default None. If the value is None then a 4-pulse sequence is created, otherwise a 5-pulse.

ESEEM_avg: str

Selecting the ESEEM averaging required. ESEEM averaging works by introducing small stepping in the first tau delay and averaging across them all. Options: * proton - 8 small steps of 8ns * deuteron - 8 small steps of 16ns * None - default

name = "'DEERSequence'"
tau1us
tau1
tau2
dt
deadtime = '200'
ESEEM = 'False'
add_ESEEM_avg(type=None)[source]
three_pulse(tp=16)[source]

Build a four pulse DEER sequence.

Parameters:
tpfloat

Length of default RectPulse in ns, by default 16ns.

four_pulse(tp=16, relaxation=False)[source]

Build a four pulse DEER sequence.

Parameters:
tpfloat

Length of default RectPulse in ns, by default 16ns.

five_pulse(tp=16, relaxation=False, re_step=50, re_dim=100)[source]

Build a five pulse DEER sequence.

Parameters:
tpfloat

Length of default RectPulse in ns, by default 16ns.

seven_pulse(tp=16, relaxation=False)[source]

Build a seven pulse DEER sequence.

Parameters:
tpfloat

Length of default RectPulse in ns, by default 16ns.

nDEER_CP(n, tp=16, relaxation=False, pcyc='Normal')[source]

Generate an nDEER sequence.

The sum of tau1 and tau2 is used as total trace length.

Parameters:
nint

The number of refocusing pulses

tpint, optional

_description_, by default 16

relaxationbool, optional

_description_, by default False

pcyc: str, optional

Normal: Phases cycles pump and observer pulses, no DC cycle NormalDC: Phases cycles pump and observer pulses, DC cycle Obs: Phases cycles observer pulses, no DC cycle ObsDC: Phases cycles and observer pulses, DC cycle

Parameters:

n (int)

select_pcyc(option)[source]

Choose which DEER phase you would like.

Phase cycle

Short Code

Sequence

Steps

Pulse Phase Cycle

Remaining Echoes

Ref.

(x)x|xp|x

DC

ALL

2

[+(+x)-(-x)]

PE12rp, SE(PE12)p3, PE12rpr3

(x)[xp]x

8step_3p

3 pulse

8

[+(+x)-(-x)]

x[x][xp]x

16step_4p

4 pulse

16

[+(+x)-(+y)+(-x)-(-y)]

[+(+x)+(+y)+(-x)+(-y)]

[1]

x|xp|[x][xp]x

16step_5p

5 pulse

16

PEp02r3,b PE1p0r2r3b

[1]

x[x]|xp|(x)(xp)(xp)x

32step_7p

7 pulse

32

[1]

Parameters:
optionstr

The short code of the phase cycle. See table above.

Parameters:

option (str)

simulate()[source]
class autodeer.HahnEchoSequence(*, B, LO, reptime, averages, shots, **kwargs)[source]

Bases: Sequence

Represents a Hahn-Echo sequence.

Build a Hahn-Echo sequence using either rectangular pulses or specified pulses. By default no progression is added to this sequence.

Parameters:
Bint or float

The B0 field, in Guass

LOint or float

The LO frequency in GHz

reptime_type_

The shot repetition time in us

averagesint

The number of scans.

shotsint

The number of shots per point

name = "'HahnEchoSequence'"
class autodeer.T2RelaxationSequence(*, B, LO, reptime, averages, shots, step=40, dim=200, **kwargs)[source]

Bases: HahnEchoSequence

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

Build a Hahn-Echo sequence using either rectangular pulses or specified pulses. By default no progression is added to this sequence.

Parameters:
Bint or float

The B0 field, in Guass

LOint or float

The LO frequency in GHz

reptime_type_

The shot repetition time in us

averagesint

The number of scans.

shotsint

The number of shots per point

tau
name = "'T2RelaxationSequence'"
class autodeer.FieldSweepSequence(*, B, LO, Bwidth, reptime, averages, shots, **kwargs)[source]

Bases: HahnEchoSequence

Represents a Field Sweep (EDFS) sequence.

Build a Field Sweep (EDFS) sequence using either rectangular pulses or specified pulses.

Parameters:
Bint or float

The B0 field, in Guass

Bwidth: int or float

The width of the field sweep, in Gauss

LOint or float

The LO frequency in GHz

reptime_type_

The shot repetition time in us

averagesint

The number of scans.

shotsint

The number of shots per point

name = "'FieldSweepSequence'"
B
class autodeer.ReptimeScan(*, B, LO, reptime, reptime_max, averages, shots, **kwargs)[source]

Bases: HahnEchoSequence

Represents a reptime scan of a Hahn Echo Sequence.

A Hahn echo sequence is perfomed with the shot repetition time increasing.1

Parameters:
Bint or float

The B0 field, in Guass

LOint or float

The LO frequency in GHz

reptime: float

The default reptime, this is used for tuning pulses etc…

reptime_maxnp.ndarray

The maximum shot repetition time in us

averagesint

The number of scans.

shotsint

The number of shots per point

min_reptime = '20'
dim = '100'
step
reptime
name = "'ReptimeScan'"
class autodeer.CarrPurcellSequence(*, B, LO, reptime, averages, shots, tau, n, dim=100, **kwargs)[source]

Bases: Sequence

Represents a Carr-Purcell sequence.

Build a Carr-Purcell dynamical decoupling sequence using either rectangular pulses or specified pulses.

Parameters:
Bint or float

The B0 field, in Guass

LOint or float

The LO frequency in GHz

reptime_type_

The shot repetition time in us

averagesint

The number of scans.

shotsint

The number of shots per point

tauint

The maximum total sequence length in us

nint

The number refocusing pulses

dimint

The number of points in the X axis

name = "'CarrPurcellSequence'"
tau
n
dim
_build_sequence()[source]
class autodeer.RefocusedEcho2DSequence(*, B, LO, reptime, averages, shots, tau, dim=100, **kwargs)[source]

Bases: Sequence

Represents a 2D Refocused-echo Sequence.

Build a 2D Refocused-echo sequence using either rectangular pulses or specified pulses.

Parameters:
Bint or float

The B0 field, in Guass

LOint or float

The LO frequency in GHz

reptime_type_

The shot repetition time in us

averagesint

The number of scans.

shotsint

The number of shots per point

tauint

The maximum total sequence length in us

dim: int

The number of points in both the X and Y axis

name = "'RefocusedEcho2D'"
tau_init = '400'
dt
tau1
tau2
_build_sequence()[source]
class autodeer.ResonatorProfileSequence(*, B, LO, reptime, averages, shots, fwidth=0.3, **kwargs)[source]

Bases: Sequence

Builds nutation based Resonator Profile sequence.

Build a resonator profile nutation sequence using either rectangular pulses or specified pulses.

Parameters:
Bint or float

The B0 field, in Guass

Bwidth: int or float

The width of the field sweep, in Gauss

LOint or float

The LO frequency in GHz

reptime_type_

The shot repetition time in us

averagesint

The number of scans.

shotsint

The number of shots per point

fwidth: float

The frequency width of the resonator profile in GHz, by default 0.3GHz

tau1: float

The delay between the nutating pulse and the Hahn Echo, by default 2000 ns

tau2: float

The interpulse delay in the Hahn Echo, by default 500 ns

name = "'ResonatorProfileSequence'"
gyro
fwidth
_build_sequence()[source]
class autodeer.TWTProfileSequence(*, B, LO, reptime, averages=1, shots=100, **kwargs)[source]

Bases: Sequence

Builds TWT based Resonator Profile sequence.

Represents an experimental pulse sequence.

Parameters:
namestr

The name of this pulse sequence

Bfloat

The magnetic field for this sequence in Gauss.

LOfloat

The central frequency of this sequence. I.e. The frequnecy at which a zero offset pulse is at.

reptimefloat

The shot repetition time in us.

averagesint

The number of scans to be accumulated.

shotsitn

The number of shots per point.

name = "'TWTProfileSequence'"
_build_sequence()[source]
class autodeer.Parameter(name, value, unit='', description='', virtual=False, **kwargs)[source]

Represents a sequence or pulse parameter.

A general parameter.

Parameters:
namestr

The parameter name

valuefloat or int

The parameter value, eithe initial or static

unitstr, optional

The unit of parameter, by default None. Leave as None if unitless.

descriptionstr, optional

A brief description of the parameter, by default None

axisnp.ndarray, optional

The difference from the intial value for each position in a dynamic axis. Can be n-dimensional, by default None.

ax_idlist, optional
virtual: bool, optional

A virtual paramter is only used to vary other parameters, it is not varied itself and will not be directly passed to a spectrometer. This parameter is never inherited. By default, False

Attributes:
progressivebool

Is the parameter used in any progression or is it constant

progdict

A dict containing progressive programs for this parameter. This list has two elements. 1) The axis_id”s and 2) the “axis” of values.

Examples

Creating a static parameter ``` Par1 = Parameter(

name=”Par1”, value=10, unit=”us”, description=”The first parameter”)

` Creating a dynamic parameter ` Par1 = Parameter(

name=”Par1”, value=10, unit=”us”, description=”The first parameter”, axis=np.arange(0,10,1), axis_id=0)

```

Adding a parameter and a number: ``` Par1 = Parameter(

name=”Par1”, value=10, unit=”us”, description=”The first parameter”)

Par2 = Par1 + 2

property dim
name
unit
description
virtual
axis = '[]'
ax_id = '[]'
add_axis(axis_id, axis)[source]
get_axis()[source]
remove_dynamic()[source]
is_static()[source]
Return type:

bool

__eq__(__o)[source]
Parameters:

__o (object)

Return type:

bool

__add__(__o)[source]
Parameters:

__o (object)

__sub__(__o)[source]
Parameters:

__o (object)

__mul__(__o)[source]
Parameters:

__o (object)

__rmul__(__o)[source]
Parameters:

__o (object)

copy()[source]
_to_dict()[source]
_to_json()[source]
save(filename)[source]

Save the parameter to a JSON file.

Parameters:
filenamestr

Path to the JSON file.

Returns:
None
Raises:
TypeError

If the object cannot be serialized to JSON.

static _from_dict(dict)[source]
classmethod _from_json(JSONstring)[source]
classmethod load(filename)[source]

Load a Parameter object from a JSON file.

Parameters:
filenamestr

Path to the JSON file.

Returns:
objParameter

The Pulse loaded from the JSON file.

Raises:
FileNotFoundError

If the file does not exist.

autodeer.build_table(source, params, params_widths)[source]
autodeer.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

autodeer.autoEPRDecoder(dct)[source]
class autodeer.Pulse(*, tp, t=None, scale=None, flipangle=None, pcyc=[0], name=None, **kwargs)[source]

Represents a general experimental pulse.

The class for a general pulse.

Parameters:
tpfloat

The pulse length in ns.

scalefloat

The arbitary experimental pulse amplitude, 0-1.

tfloat, optional

The pulse start time in ns.

property bandwidth
property amp_factor

The B1 amplitude factor (nutation frequency) for the pulse in GHz

name
Progression = 'False'
_addPhaseCycle(phases, detections=None)[source]

Adds a phase cycle to the pulse sequence.

Args:

phases (list): List of phases to add to the phase cycle. detections (list, optional): List of detection signs. Defaults to None. If None then all cycles are summed.

Returns:

None

_buildFMAM(func, ax=None)[source]

Builds the amplitude modulation (AM) and frequency modulation (FM) of a given function.

Args:

func: A function that takes in an array of values and returns two arrays, representing the AM and FM of the function.

Returns:

Two arrays representing the AM and FM of the function.

build_shape(ax=None)[source]
build_table()[source]

Builds a table of variables, axes, and UUIDs for all non-static Parameters in the object.

Returns:

dict: A dictionary containing the following keys: “Variable”, “axis”, and “uuid”. The values for each key are lists of the corresponding values for each non-static Parameter.

is_static()[source]

Check if all parameters in the pulse object are static.

Returns:

bool: True if all parameters are static, False otherwise.

isDelayFocused()[source]

Does the pulse contain a specified time, t?

If so then it is not delay focused.

isPulseFocused()[source]

Does the pulse contain a specified time, t?

If so then it is delay focused.

plot(pad=1000)[source]

Plots the time domain representation of this pulse.

Parameters:
padint, optional

The number of zeros to pad the data with, by default 1000

_calc_fft(pad=10000)[source]
exciteprofile(freqs=None, resonator=None)[source]

Excitation profile

Generates the exciatation profiles for this pulse.

This function is ported from EasySpin (https://easyspin.org/easyspin/documentation/sop.html) [1-2], and based upon the method from Gunnar Jeschke, Stefan Pribitzer and Andrin Doll[3].

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)

[3] Jeschke, G., Pribitzer, S. & DollA. Coherence Transfer by Passage Pulses in Electron Paramagnetic Resonance Spectroscopy. J. Phys. Chem. B 119, 13570-13582 (2015)

Parameters:
freqs: np.ndarray, optional

The frequency axis. Caution: A larger number of points will linearly increase computation time.

resonator: ad.ResonatorProfile, optional
Returns:
Mx: np.ndarray

The magentisation in the X direction.

My: np.ndarray

The magentisation in the Y direction.

Mz: np.ndarray

The magentisation in the Z direction.

plot_fft()[source]
_pcyc_str()[source]
__str__()[source]
copy(clear=False, **kwargs)[source]

Creates a deep-copy of the pulse. I.e. Every parameter object is re-created at another memory space.

Parameter can be chaged at this stage by adding them as keyword- arguments (kwargs).

Returns:
Pulse

A deep copy of the pulse

_to_dict()[source]
_to_json()[source]
save(filename)[source]

Save the Pulse to a JSON file.

Parameters:
filenamestr

Path to the JSON file.

Returns:
None
Raises:
TypeError

If the object cannot be serialized to JSON.

classmethod _from_dict(dct)[source]
classmethod _from_json(JSONstring)[source]
classmethod load(filename)[source]

Load a Pulse object from a JSON file.

Parameters:
filenamestr

Path to the JSON file.

Returns:
objPulse

The Pulse loaded from the JSON file.

Raises:
FileNotFoundError

If the file does not exist.

class autodeer.Detection(*, tp, t=None, freq=0, **kwargs)[source]

Bases: Pulse

Represents a detection pulse.

A general detection pulse.

Parameters:
tpfloat

The total time of the detection event. The detection event will be symetrical about the centre time.

tfloat, optional

The centre time of the detection event

freq: float, optional

The detection frequency, not all spectrometer support this functionality, by default 0 MHz

scale = 'None'
freq
pcyc = 'None'
class autodeer.Delay(*, tp, t=None)[source]

Bases: Pulse

DEPRECATION WARNING: THIS WILL BE REMOVED SOON.

Represents a inter-pulse delay pulse.

The class for a general pulse.

Parameters:
tpfloat

The pulse length in ns.

scalefloat

The arbitary experimental pulse amplitude, 0-1.

tfloat, optional

The pulse start time in ns.

tp
pcyc = 'None'
scale = 'None'
class autodeer.RectPulse(tp=16, freq=0, t=None, flipangle=None, **kwargs)[source]

Bases: Pulse

Represents a rectangular monochromatic pulse.

Parameters:
tpflaot, optional

Pulse Length in ns, by default 16

freqfloat,optional

Frequency in MHz, by default 0

tfloat, optional

Time position in ns, by default None

flipangle_type_, optional

The flip angle in radians, by default None

freq
func(ax)[source]
class autodeer.GaussianPulse(*, tp=32, FWHM=16, freq=0, **kwargs)[source]

Bases: Pulse

Represents a Gaussian monochromatic pulse.

Represents a Gaussian monochromatic pulse.

Parameters:
tpfloat

Pulse length in ns, by default 128

FWHMfloat,

The full width at half maximum of the pulse

freqfloat, optional

The frequency of the pulse, by default 0

freq
FWHM
func(ax)[source]
class autodeer.FrequencySweptPulse(*, tp, t=None, scale=None, flipangle=None, pcyc=[0], name=None, **kwargs)[source]

Bases: Pulse

A general parent class for Frequency Swept Pulses.

The class for a general pulse.

Parameters:
tpfloat

The pulse length in ns.

scalefloat

The arbitary experimental pulse amplitude, 0-1.

tfloat, optional

The pulse start time in ns.

property Qcrit

The critical Q factor for the pulse.

abstract property sweeprate

The sweep rate of the pulse in GHz/ns

property amp_factor

The B1 amplitude factor (nutation frequency) for the pulse in GHz

class autodeer.HSPulse(*, tp=128, order1=1, order2=6, beta=20, **kwargs)[source]

Bases: FrequencySweptPulse

Represents a hyperboilc secant frequency-swept pulse.

The class for a general pulse.

Parameters:
tpfloat

The pulse length in ns.

scalefloat

The arbitary experimental pulse amplitude, 0-1.

tfloat, optional

The pulse start time in ns.

property sweeprate

The sweep rate of the pulse in GHz/ns

order1
order2
beta
func(ax)[source]
class autodeer.ChirpPulse(*, tp=128, **kwargs)[source]

Bases: FrequencySweptPulse

Represents a linear frequency-swept pulse.

The class for a general pulse.

Parameters:
tpfloat

The pulse length in ns.

scalefloat

The arbitary experimental pulse amplitude, 0-1.

tfloat, optional

The pulse start time in ns.

property sweeprate

The sweep rate of the pulse in GHz/ns

func(ax)[source]
class autodeer.SincPulse(*, tp=128, freq=0, order=6, window=None, **kwargs)[source]

Bases: Pulse

Represents a general experimental pulse.

Represents a sinc shaped monochromatic pulse.

Parameters:
tpint

Pulse length in ns, by default 128

freqint, optional

The frequency of the pulse, by default 0

orderint, optional

The order of this sinc function, by default 6

window_type_, optional

The window function, by default None

freq
order
window
func(ax)[source]
autodeer.build_default_pulses(AWG=True, SPFU=False, tp=12)[source]
autodeer.autoEPRDecoder(dct)[source]
class autodeer.Pulse(*, tp, t=None, scale=None, flipangle=None, pcyc=[0], name=None, **kwargs)[source]

Represents a general experimental pulse.

The class for a general pulse.

Parameters:
tpfloat

The pulse length in ns.

scalefloat

The arbitary experimental pulse amplitude, 0-1.

tfloat, optional

The pulse start time in ns.

property bandwidth
property amp_factor

The B1 amplitude factor (nutation frequency) for the pulse in GHz

name
Progression = 'False'
_addPhaseCycle(phases, detections=None)[source]

Adds a phase cycle to the pulse sequence.

Args:

phases (list): List of phases to add to the phase cycle. detections (list, optional): List of detection signs. Defaults to None. If None then all cycles are summed.

Returns:

None

_buildFMAM(func, ax=None)[source]

Builds the amplitude modulation (AM) and frequency modulation (FM) of a given function.

Args:

func: A function that takes in an array of values and returns two arrays, representing the AM and FM of the function.

Returns:

Two arrays representing the AM and FM of the function.

build_shape(ax=None)[source]
build_table()[source]

Builds a table of variables, axes, and UUIDs for all non-static Parameters in the object.

Returns:

dict: A dictionary containing the following keys: “Variable”, “axis”, and “uuid”. The values for each key are lists of the corresponding values for each non-static Parameter.

is_static()[source]

Check if all parameters in the pulse object are static.

Returns:

bool: True if all parameters are static, False otherwise.

isDelayFocused()[source]

Does the pulse contain a specified time, t?

If so then it is not delay focused.

isPulseFocused()[source]

Does the pulse contain a specified time, t?

If so then it is delay focused.

plot(pad=1000)[source]

Plots the time domain representation of this pulse.

Parameters:
padint, optional

The number of zeros to pad the data with, by default 1000

_calc_fft(pad=10000)[source]
exciteprofile(freqs=None, resonator=None)[source]

Excitation profile

Generates the exciatation profiles for this pulse.

This function is ported from EasySpin (https://easyspin.org/easyspin/documentation/sop.html) [1-2], and based upon the method from Gunnar Jeschke, Stefan Pribitzer and Andrin Doll[3].

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)

[3] Jeschke, G., Pribitzer, S. & DollA. Coherence Transfer by Passage Pulses in Electron Paramagnetic Resonance Spectroscopy. J. Phys. Chem. B 119, 13570-13582 (2015)

Parameters:
freqs: np.ndarray, optional

The frequency axis. Caution: A larger number of points will linearly increase computation time.

resonator: ad.ResonatorProfile, optional
Returns:
Mx: np.ndarray

The magentisation in the X direction.

My: np.ndarray

The magentisation in the Y direction.

Mz: np.ndarray

The magentisation in the Z direction.

plot_fft()[source]
_pcyc_str()[source]
__str__()[source]
copy(clear=False, **kwargs)[source]

Creates a deep-copy of the pulse. I.e. Every parameter object is re-created at another memory space.

Parameter can be chaged at this stage by adding them as keyword- arguments (kwargs).

Returns:
Pulse

A deep copy of the pulse

_to_dict()[source]
_to_json()[source]
save(filename)[source]

Save the Pulse to a JSON file.

Parameters:
filenamestr

Path to the JSON file.

Returns:
None
Raises:
TypeError

If the object cannot be serialized to JSON.

classmethod _from_dict(dct)[source]
classmethod _from_json(JSONstring)[source]
classmethod load(filename)[source]

Load a Pulse object from a JSON file.

Parameters:
filenamestr

Path to the JSON file.

Returns:
objPulse

The Pulse loaded from the JSON file.

Raises:
FileNotFoundError

If the file does not exist.

class autodeer.Detection(*, tp, t=None, freq=0, **kwargs)[source]

Bases: Pulse

Represents a detection pulse.

A general detection pulse.

Parameters:
tpfloat

The total time of the detection event. The detection event will be symetrical about the centre time.

tfloat, optional

The centre time of the detection event

freq: float, optional

The detection frequency, not all spectrometer support this functionality, by default 0 MHz

scale = 'None'
freq
pcyc = 'None'
class autodeer.Parameter(name, value, unit='', description='', virtual=False, **kwargs)[source]

Represents a sequence or pulse parameter.

A general parameter.

Parameters:
namestr

The parameter name

valuefloat or int

The parameter value, eithe initial or static

unitstr, optional

The unit of parameter, by default None. Leave as None if unitless.

descriptionstr, optional

A brief description of the parameter, by default None

axisnp.ndarray, optional

The difference from the intial value for each position in a dynamic axis. Can be n-dimensional, by default None.

ax_idlist, optional
virtual: bool, optional

A virtual paramter is only used to vary other parameters, it is not varied itself and will not be directly passed to a spectrometer. This parameter is never inherited. By default, False

Attributes:
progressivebool

Is the parameter used in any progression or is it constant

progdict

A dict containing progressive programs for this parameter. This list has two elements. 1) The axis_id”s and 2) the “axis” of values.

Examples

Creating a static parameter ``` Par1 = Parameter(

name=”Par1”, value=10, unit=”us”, description=”The first parameter”)

` Creating a dynamic parameter ` Par1 = Parameter(

name=”Par1”, value=10, unit=”us”, description=”The first parameter”, axis=np.arange(0,10,1), axis_id=0)

```

Adding a parameter and a number: ``` Par1 = Parameter(

name=”Par1”, value=10, unit=”us”, description=”The first parameter”)

Par2 = Par1 + 2

property dim
name
unit
description
virtual
axis = '[]'
ax_id = '[]'
add_axis(axis_id, axis)[source]
get_axis()[source]
remove_dynamic()[source]
is_static()[source]
Return type:

bool

__eq__(__o)[source]
Parameters:

__o (object)

Return type:

bool

__add__(__o)[source]
Parameters:

__o (object)

__sub__(__o)[source]
Parameters:

__o (object)

__mul__(__o)[source]
Parameters:

__o (object)

__rmul__(__o)[source]
Parameters:

__o (object)

copy()[source]
_to_dict()[source]
_to_json()[source]
save(filename)[source]

Save the parameter to a JSON file.

Parameters:
filenamestr

Path to the JSON file.

Returns:
None
Raises:
TypeError

If the object cannot be serialized to JSON.

static _from_dict(dict)[source]
classmethod _from_json(JSONstring)[source]
classmethod load(filename)[source]

Load a Parameter object from a JSON file.

Parameters:
filenamestr

Path to the JSON file.

Returns:
objParameter

The Pulse loaded from the JSON file.

Raises:
FileNotFoundError

If the file does not exist.

class autodeer.Interface(log=None)[source]

Represents the interface connection from autoEPR to the spectrometer.

pulses
savefolder
savename = "''"
resonator = 'None'
connect()[source]
Return type:

None

acquire_dataset(data)[source]

Acquires the dataset.

launch(sequence, savename)[source]

Launches the experiment and initialises autosaving.

Parameters:
sequenceSequence

The sequence to be launched

savenamestr

The savename for this measurement. A timestamp will be added to the value.

Parameters:

savename (str)

isrunning()[source]
Return type:

bool

terminate()[source]

Terminates the experiment immediately.

Return type:

None

terminate_at(criterion, test_interval=2, keep_running=True, verbosity=0, autosave=True)[source]

Terminates the experiment upon a specific condition being satisified.

Parameters:
criterion_type_

The criteria to be tested.

test_intervalint, optional

How often should the criteria be tested in minutes, by default 10.

keep_runningbool, optional

If True, an error will not be raised if the experiment finishes before the criteria is met, by default True.

verbosityint, optional

The verbosity level, by default 0.

autosavebool, optional

If True, the data will be autosaved, by default True.

class autodeer.Sequence(*, name, B, LO, reptime, averages, shots, **kwargs)[source]

Represents an experimental pulse sequence.

Represents an experimental pulse sequence.

Parameters:
namestr

The name of this pulse sequence

Bfloat

The magnetic field for this sequence in Gauss.

LOfloat

The central frequency of this sequence. I.e. The frequnecy at which a zero offset pulse is at.

reptimefloat

The shot repetition time in us.

averagesint

The number of scans to be accumulated.

shotsitn

The number of shots per point.

property seqtable_steps
pulses = '[]'
num_pulses
axes_uuid = '[]'
reduce_uuid = '[]'
LO
averages
shots
name
progTable
plot()[source]
Return type:

None

plot_pulse_exc(FieldSweep=None, ResonatorProfile=None)[source]
addPulse(pulse)[source]

Adds a pulse to the next position in the sequence.

Parameters:
pulsePulse

The object describing the pulse.

_estimate_time()[source]

Calculates the estimated experiment time in seconds.

_buildPhaseCycle()[source]
evolution(params, reduce=[])[source]
shift_detfreq_to_zero()[source]
isPulseFocused()[source]

Is the sequence expressed to contain only pulses and no delays?

isDelayFocused()[source]

Is the sequence expressed to contain both pulses and delays?

convert(*, reduce=True)[source]

Converts the current sequence to either pulse focused or delay focused depending on the current state

Parameters:
reducebool, optional

Reduce to the smallest number of objects, by default True

_convert_to_delay()[source]
_convert_to_pulses()[source]
_checkRect()[source]

Checks if all the pulses in the sequence are rectangular.

Return type:

bool

__str__()[source]
copy()[source]
_to_dict()[source]
_to_json()[source]
save(filename)[source]

Save the sequence to a JSON file.

Parameters:
filenamestr

Path to the JSON file.

Returns:
None
Raises:
TypeError

If the object cannot be serialized to JSON.

classmethod _from_dict(dct)[source]
classmethod _from_json(JSONstring)[source]
classmethod load(filename)[source]

Load an object from a JSON file.

Parameters:
filenamestr

Path to the JSON file.

Returns:
objSequence

The Sequence loaded from the JSON file.

Raises:
FileNotFoundError

If the file does not exist.

class autodeer.DEERSequence(*, tau1, tau2, tau3=None, tau4=None, dt, B, LO, reptime, averages, shots, ESEEM_avg=None, **kwargs)[source]

Bases: Sequence

Represents a DEER/PELDOR sequence.

Build a DEER sequence using rectangular pulses

Parameters:
tau1int or float

The first interpulse delay in us

tau2int or float

The second interpulse delay in us

dtint or float

The time step for DEER measurment in ns

Bint or float

The B0 field, in Guass

LOint or float

The LO frequency in GHz

reptime_type_

The shot repetition time in us

averagesint

The number of scans.

shotsint

The number of shots per point

tau3int or float, optional

The delay between the first static pump pulse in 5-pulse DEER and the 1st refocusing pulse in us, by default None. If the value is None then a 4-pulse sequence is created, otherwise a 5-pulse.

ESEEM_avg: str

Selecting the ESEEM averaging required. ESEEM averaging works by introducing small stepping in the first tau delay and averaging across them all. Options: * proton - 8 small steps of 8ns * deuteron - 8 small steps of 16ns * None - default

name = "'DEERSequence'"
tau1us
tau1
tau2
dt
deadtime = '200'
ESEEM = 'False'
add_ESEEM_avg(type=None)[source]
three_pulse(tp=16)[source]

Build a four pulse DEER sequence.

Parameters:
tpfloat

Length of default RectPulse in ns, by default 16ns.

four_pulse(tp=16, relaxation=False)[source]

Build a four pulse DEER sequence.

Parameters:
tpfloat

Length of default RectPulse in ns, by default 16ns.

five_pulse(tp=16, relaxation=False, re_step=50, re_dim=100)[source]

Build a five pulse DEER sequence.

Parameters:
tpfloat

Length of default RectPulse in ns, by default 16ns.

seven_pulse(tp=16, relaxation=False)[source]

Build a seven pulse DEER sequence.

Parameters:
tpfloat

Length of default RectPulse in ns, by default 16ns.

nDEER_CP(n, tp=16, relaxation=False, pcyc='Normal')[source]

Generate an nDEER sequence.

The sum of tau1 and tau2 is used as total trace length.

Parameters:
nint

The number of refocusing pulses

tpint, optional

_description_, by default 16

relaxationbool, optional

_description_, by default False

pcyc: str, optional

Normal: Phases cycles pump and observer pulses, no DC cycle NormalDC: Phases cycles pump and observer pulses, DC cycle Obs: Phases cycles observer pulses, no DC cycle ObsDC: Phases cycles and observer pulses, DC cycle

Parameters:

n (int)

select_pcyc(option)[source]

Choose which DEER phase you would like.

Phase cycle

Short Code

Sequence

Steps

Pulse Phase Cycle

Remaining Echoes

Ref.

(x)x|xp|x

DC

ALL

2

[+(+x)-(-x)]

PE12rp, SE(PE12)p3, PE12rpr3

(x)[xp]x

8step_3p

3 pulse

8

[+(+x)-(-x)]

x[x][xp]x

16step_4p

4 pulse

16

[+(+x)-(+y)+(-x)-(-y)]

[+(+x)+(+y)+(-x)+(-y)]

[1]

x|xp|[x][xp]x

16step_5p

5 pulse

16

PEp02r3,b PE1p0r2r3b

[1]

x[x]|xp|(x)(xp)(xp)x

32step_7p

7 pulse

32

[1]

Parameters:
optionstr

The short code of the phase cycle. See table above.

Parameters:

option (str)

simulate()[source]
autodeer.get_all_axes(sequence)[source]
autodeer.get_all_fixed_param(sequence)[source]
autodeer.create_dataset_from_sequence(data, sequence, extra_params={})[source]
Parameters:

sequence (autodeer.sequences.Sequence)

autodeer.create_dataset_from_axes(data, axes, params=None, axes_labels=None)[source]
Parameters:

params (dict)

autodeer.create_dataset_from_bruker(filepath)[source]
class autodeer.EPRAccessor(xarray_obj)[source]
property correctphase
property normalise
property correctphasefull
property SNR
property fft
property sequence
_obj
save(filename, type='netCDF')[source]
class autodeer.Reporter(filepath, pagesize='A4')[source]
pdf
story
frame
template
header(canvas, doc)[source]
footer(canvas, doc)[source]
_build()[source]
add_title(key, title)[source]
add_new_section(key, title)[source]
add_text(key, text, title=None)[source]
add_code_block(key, code, title=None)[source]
add_figure(key, figure, title=None)[source]
add_space(key, height=5)[source]
add_page_break(key)[source]
add_table(key, lists)[source]

Generates a table as a reportlab flowable from a list of lists

autodeer.combo_figure(EDFS, respro, pulses, relaxation, init_deer, long_deer, title=None)[source]
Creates a 2x2 summary figure.
  • The top left plot is the EDFS and resonator profile, overlapped with the optimised pulses.

  • The top right plot is the relaxation data and fits.

  • The bottom left plot is the initial DEER data and fits.

  • The bottom right plot is the final DEER data and fits.

Parameters:
EDFS: ad.FieldSweepAnalysis

The Echo-Detected Field Sweep analysis.

respro: ad.ResonatorProfileAnalysis

The resonator profile analysis

pulses: dict

A dictionary containing the optimised pulses.

relaxation: list

A list containing the relaxation data and fits.

init_deer: deerlab.FitResult

The initial DEER data and fits.

long_deer: deerlab.FitResult

The final DEER data and fits.

title: str, optional

The title of the figure, by default None

Parameters:
  • pulses (dict)

  • relaxation (list)

autodeer.primary_colors = "['#D95B6F', '#42A399', '#E1AE38']"[source]