pyepr.Pulse

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

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.

flipanglefloat, optional

The target flip angle of the pulse in radians, defaults to None.

namestr, optional

The name of the pulse, defaults to None.

pcyclist, optional

The phase cycle of the pulse given as a diction with keys “Phases” and “DetSigns”, defaults to None.

Attributes

name = None
uuid
property bandwidth
property amp_factor

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

Methods

removePhaseCycle()[source]

Clears the attached phase cycle.

build_shape(ax=None, full_output=False)[source]

Creates the time domain representation of the pulse shape, using the method func.

Parameters:
axnp.ndarray, optional

The axis to build the shape on. If None, uses the internal ax attribute.

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.

plot(pad=1000, freqs=None)[source]

Plots the time domain representation of this pulse alongside its Mz inversion profile.

Parameters:
padint, optional

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

freqsnp.ndarray, optional

The frequency axis to calculate the Mz inversion profile over. If not given, a default range is calculated by exciteprofile.

flip()[source]

Flips the sweep direction of the pulse. Has no meaning for monochromatic pulses.

exciteprofile(freqs=None, resonator=None, trajectory=False)[source]

Excitation profile

Generates the exciatation profiles for this pulse, using the two-level system model developed by Jeschke et al. [1]. And then optimised in the PulseShape software package by Maxx Tessmer, reproduced under the GNU GPL v3 license [2].

Parameters:
freqs: np.ndarray, optional

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

resonator: ad.ResonatorProfile, optional

The resonator profile to apply resonator compensation.

trajectory: bool, optional

If True, the function will return the magnetisation at each time point. Default is False.

Returns:
Mag: np.ndarray

The magnetisation in the X, Y, and Z directions.

References

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

[2] https://github.com/mtessmer/PulseShape

copy(clear=False, reset_uuid=True, **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). If the phase cycle is changed, the UUID of the pulse will be reset.

Parameters:
reset_uuidbool, optional

If True, the UUID of the copied pulse will be reset to a new value. Default is True.

**kwargsdict

Keyword arguments representing the parameters to be changed in the copied pulse. Includes ‘t’, ‘tp’, ‘scale’, ‘flipangle’, and ‘pcyc’, and any other attributes of the pulse.

Returns
——-
Pulse

A deep copy of the pulse

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 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.