Simulations of the average Hamiltonian.
Project description
FrameDynamics
FrameDynamics is a python package that provides numerical simulations for the field of pulse sequence development in magnetic resonance.
A coupling Hamiltonian is modulated in the toggling or interaction frame according to the specified pulse sequence and offset frequencies.
The trajectory of the time-dependent Hamiltonian can be plotted or used to calculate the zeroth order average Hamiltonian (higher order terms might be available in following versions of FrameDynamics).
Theoretical background can be found in the publication (coming soon...).
Installation
The python package can be installed via PyPI:
pip install FrameDynamics
Simulations
Two examples shall be given: the WAHUHA sequence and a heteronuclear echo consisting of a shaped pulse and a hard 180° pulse.
More examples can be found in the FrameDynamics github-repository (link).
Example #1: WAHUHA sequence
Initialize frame:
from FrameDynamics import Frame
frame = Frame(["I", "J"])
Specify the interaction:
interaction = frame.set_interaction("I", "J", "Dstrong")
Define the pulse sequence:
tau = 5 * 10**(-5)
frame.delay(tau)
frame.pulse(["I", "J"], 90, 10**(5), 0)
frame.delay(tau)
frame.pulse(["I", "J"], 90, 10**(5), 3)
frame.delay(2*tau)
frame.pulse(["I", "J"], 90, 10**(5), 1)
frame.delay(tau)
frame.pulse(["I", "J"], 90, 10**(5), 2)
frame.delay(tau)
Start the simulations:
frame.start(Traject=True)
Plot the trajectories:
frame.plot_traject(interaction, save="WAHUHA.png")
Example #2: Reburp pulse
Load Frame and Block class. Block class is used to align different blocks in the pulse sequence (e.g. Reburp pulse and 180° hard pulse in heteronuclear echo)
import numpy as np
from FrameDynamics import Frame, Block
frame = Frame(["I", "S"])
Specify the interaction:
interaction = frame.set_interaction("I", "S", "Jweak")
Specify offset frequencies:
off = 5000
offsetsI = np.linspace(-off, off, 61)
offsetsS = np.linspace(-off, off, 61)
frame.set_offset("I", offsetsI)
frame.set_offset("S", offsetsS)
Load pulse shape to array:
Reburp = frame.load_shape("Reburp.1000")
After the interaction and offsets are set for the Frame object, one can now initialize the Block class for each block. This has to be done block1 = Block(frame, ["I"]) block2 = Block(frame, ["S"])
Define a Reburp pulse on "I" and hard pulse on "S":
block1.shape(["I"], Reburp, 1000*10**(-6), 6264.8, 1)
block2.pulse(["S"], 180, 10**(5), 1)
Align Reburp ("I") and hard pulse ("S") and start simulation without multiprocessing (MP=False):
frame.align(block1, block2, alignment="center")
frame.start(MP=False, Traject=True)
Create offset-dependent 2D graph that is plotted against both offsets:
frame.plot_AHT2D(interaction)
Create offset-dependent 1D graph that is plotted against specified offsets ("S"):
frame.plot_AHT1D(interaction, "S", offset=0.)
Plot trajectories for specified interaction and operators (the given operators are default values).
frame.plot_traject(interaction, operators=["x1","y1","z1","xx","yy","zz"])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for FrameDynamics-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b5d2f25c02e921f9cec0801139971c048386aa60c3349261c00a27be3d17ee9 |
|
MD5 | 9061bfa4e06fbf72a671eec5325acbe1 |
|
BLAKE2b-256 | e473db7659a6b3dc842dbcd9a4eea162396397f4436d327c76b963052d54e67c |