CESTSimulator#
- class torchsim.simulators.CESTSimulator(*args, **kwargs)[source]#
Bases:
SimulatorA Z-spectrum simulated through a train of saturation pulses, pool by pool.
At each offset the magnetization starts from equilibrium, a train of rectangular pulses saturates it while the free water and every exchanging pool precess at their own frequency, relax and exchange, and the longitudinal magnetization left once a spoiled delay has passed is the point of the spectrum. The pools are the Bloch-McConnell model’s [1]:
poolB_*topoolE_*beside the free water, each a fraction ofM0with its own exchange rate, relaxation times and chemical shift in Hz. Each pulse starts at the phase the one before it ended at, so the train is continuous in phase over the time the pulses play and not over the delays between them, which is how a Pulseq CEST protocol accumulates it. This is the sequence BART’ssimplays asCEST.References
Examples
import torch from torchsim.simulators import CESTSimulator sequence = CESTSimulator(offsets=torch.linspace(-5.0, 5.0, 21)) spectrum = sequence.simulate( T1=1300.0, T2=75.0, poolB_fraction=0.001, poolB_exchange=1000.0, poolB_T1=1300.0, poolB_T2=10.0, poolB_shift=3.5 * 127.7, ) print(spectrum.shape)
torch.Size([21])
Methods
bindThis simulator with more fixed on it, values or settings alike.
describeReturn the description this protocol plays.
Return the longitudinal magnetization, offsets last.
from_descriptionReturn a simulator over a stream someone else assembled.
from_pulseqReturn a simulator over one repetition of a Pulseq sequence.
jacobianReturn the signal and its derivative with respect to
diff.Return one saturation train and read per offset.
playedReturn the protocol as it will be laid out.
repetition_sReturn how long one repetition lasts, given what the layout played.
simulateReturn the recorded signal.
- layout(*, offsets, field_strength=3.0, B1sat=1.0, npulses=1, pulse_duration=100.0, interpulse_delay=0.0, recovery=6.5, dwell=0.01)[source]#
Return one saturation train and read per offset.
- Parameters:
offsets (array-like) – Saturation frequency offsets from the free water, in ppm.
field_strength (float, optional) – Main field in tesla, which turns an offset in ppm into Hz.
B1sat (float, optional) – Amplitude of each saturation pulse in microtesla.
npulses (int, optional) – Saturation pulses per offset.
pulse_duration (float, optional) – Duration of each pulse in milliseconds.
interpulse_delay (float, optional) – Time between two pulses in milliseconds.
recovery (float, optional) – Time in milliseconds from the end of the last pulse to the read, over which the transverse magnetization is spoiled.
dwell (float, optional) – How long each sample of a pulse is held, in milliseconds.
- Raises:
ValueError – If a pulse is not a whole number of samples.