eprsave#

torchspin.eprsave(filename, x, y, params=None, title='', xunit='mT')[source]#

Write an EPR spectrum to Bruker BES3T (.DTA / .DSC) format.

Parameters:
  • filename (str | Path) – Output file path. The extension is replaced with .DTA and .DSC automatically — do not include the extension.

  • x (ArrayLike) – Abscissa axis (field in mT, or time/frequency in other units). Must be uniformly spaced.

  • y (ArrayLike) – Spectrum intensity, same length as x. Complex data is written as interleaved real/imaginary pairs (IKKF=CPLX).

  • params (dict[str, Any] | None) – Optional dict of additional parameters to write into the .DSC file. Keys and values are written as KEY  value lines. Values already computed from x and y (XMIN, XWID, XPTS, …) take precedence over anything in params.

  • title (str) – Optional experiment title (written as TITL).

  • xunit (str) – X-axis unit string written to XUNI. Default 'mT'.

Examples

>>> B, spec = pepper(sys, exp)
>>> eprsave('output/my_sim', B.numpy(), spec.numpy(), title='S=1/2 sim')
>>> x, y, p = eprload('output/my_sim.DTA')  # round-trip

Notes

Data is written as big-endian IEEE 754 double precision (BSEQ=BIG, IRFMT=D), which maximizes compatibility with EasySpin and Xepr.