makespec#

torchspin.makespec(field_range, n_points, pos, amp=None, *, device='cpu')[source]#

Bin peaks into a stick spectrum.

Parameters:
  • field_range (list[float]) – [Bmin, Bmax] in mT — the sweep range.

  • n_points (int) – Number of points in the output spectrum.

  • pos (Tensor) – Peak positions in mT, shape (nPeaks,).

  • amp (Tensor | None) – Peak amplitudes, shape (nPeaks,). Defaults to ones.

  • device (str) – PyTorch device string.

Returns:

  • x – Field axis (mT), shape (n_points,).

  • spec – Stick spectrum, shape (n_points,).

Return type:

tuple[Tensor, Tensor]