saffron#

torchspin.saffron(sys, exp, opt=None)[source]#

Simulate pulse EPR signals and spectra.

Parameters:
Returns:

  • x (ndarray or list of ndarray) – Time or frequency axes.

  • signal (ndarray) – Simulated signal (time domain; complex) or ENDOR spectrum. When the spin system carries tensors that require grad, signal and info['td']/info['fd'] are torch tensors on the autograd graph instead.

  • info (dict) – Contains the 'td' and 'fd' fields.

Return type:

tuple

Notes

Opt.SimulationMode selects the engine, as in EasySpin: 'fast' is the ideal-pulse algorithm implemented here, 'thyme' the real-pulse density-matrix engine in torchspin.saffron_thyme.saffron_thyme. Left unset, the engine is inferred: real pulses (nonzero Exp.tp), a list-valued Exp.Sequence or an Exp.DetWindow select 'thyme'.

The real-pulse engine has a different output contract – one detected point per increment for single-point detection, with the transient axis appended to the indirect axes otherwise – and requires Exp.mwFreq. See its docstring.