LorentzianSimulator#

class torchsim.simulators.LorentzianSimulator(*args, **kwargs)[source]#

Bases: Simulator

A Z-spectrum as equilibrium minus one Lorentzian line per pool.

Each pool saturates the water signal along a Lorentzian line centred on its own offset [1], and the lines add:

M0 (1 - sum_i A_i (W_i / 2)^2 / ((W_i / 2)^2 + (offset - shift_i)^2))

Pool i, counted from one, exposes pool{i}_amplitude, pool{i}_width (the full width at half maximum) and pool{i}_shift.

Parameters:
  • pools (int) – How many Lorentzian lines.

  • **values – Properties or sequence arguments to fix, as for any simulator.

References

Examples

import torch
from torchsim.simulators import LorentzianSimulator

sequence = LorentzianSimulator(2, offsets=torch.linspace(-5.0, 5.0, 41))
signal = sequence.simulate(
    pool1_amplitude=0.9, pool1_width=1.5, pool1_shift=0.0,
    pool2_amplitude=0.1, pool2_width=2.0, pool2_shift=3.5,
)
print(signal.shape)
torch.Size([41])

Methods

bind

This simulator with more fixed on it, values or settings alike.

describe

Return the description this protocol plays.

evaluate

Evaluate the closed form, no state machine and no description.

from_description

Return a simulator over a stream someone else assembled.

from_pulseq

Return a simulator over one repetition of a Pulseq sequence.

jacobian

Return the signal and its derivative with respect to diff.

layout

Return the operators of one repetition, in the order they play.

played

Return the protocol as it will be laid out.

repetition_s

Return how long one repetition lasts, given what the layout played.

simulate

Return the recorded signal.

evaluate(properties, **sequence)[source]#

Evaluate the closed form, no state machine and no description.