PulseShape is an EasySpin pulse
function clone written in python. The major purpose for
rewriting pulse in Python is to free the function from the proprietary MATLAB universe and
make it easier to use on Linux systems that often ship with e580 spectrometers.
PulseShape is built around the Pulse
object which accepts arguments similar to those
used by the easyspin pulse
function.
PulseShape can be installed and updated using pip
, the python package manager.
pip install PulseShape
PulseShape is tested to work on Python 3.6-3.9. While one of the major purposes of PulseShape is to work on Linux systems, PulseShape works well on all systems (Windows, Mac, and Linux) and only depends on numpy and scipy.
Alternatively, PulseShape can be installed by downloading or cloning the git repository.
git clone https://gitlab.com/StollLab/PulseShape.git
cd PulseShape
python setup.py install
Instructions for setting up Python and PulseShape on the Linux system that usually ships with e580 spectrometers coming soon.
All time
, IQ
, other parameters and data are stored within the Pulse
object itself so it's easy to work with multiple pulses
import numpy as np
import matplotlib.pyplot as plt
from PulseShape import Pulse
profile = np.loadtxt('data/Transferfunction.dat')
st_pulse = Pulse(pulse_time=0.150,
time_step=0.000625,
flip=np.pi,
shape='sech/tanh',
freq=[40, 120],
beta=10,
profile=profile)
g_pulse = Pulse(pulse_time=0.06,
time_step=0.000625,
flip=np.pi,
shape='gaussian',
trunc=0.1)
offsets = np.linspace(-20, 140, 256)
st_pulse.exciteprofile(offsets)
g_pulse.exciteprofile(offsets)
fig, (ax1, ax2) = plt.subplots(2, figsize=(8, 10))
ax1.set_title('Pulse IQ')
ax1.plot(st_pulse.time * 1e3, st_pulse.IQ.real, label=r'sech/tanh $\Re$', color='C0')
ax1.plot(st_pulse.time * 1e3, st_pulse.IQ.imag, label=r'sech/tanh $\Im$', alpha=0.5, color='C0')
ax1.plot(g_pulse.time * 1e3, g_pulse.IQ.real, label='gaussian', color='C1')
ax1.set_ylabel('Amplitude')
ax1.set_ylabel("Time (ns)")
ax1.legend()
ax2.set_title('Excitation Profile')
ax2.plot(offsets, st_pulse.Mz)
ax2.plot(offsets, g_pulse.Mz)
ax2.set_xlabel('Frequency Offset (MHz)')
ax2.set_ylabel('Mz')
plt.show()