convspec#
- torchspin.convspec(spec, dx, fwhm_g=0.0, fwhm_l=0.0, deriv=0, phase=0.0)[source]#
Convolve a spectrum with a Gaussian and/or Lorentzian line shape (EasySpin
convspec).- Parameters:
spec (Tensor) – Input spectrum, shape
(N,). Should be real.dx (float) – Abscissa step size (e.g., mT per point).
fwhm_g (float) – Gaussian FWHM in the same units as
dx. Zero = no Gaussian.fwhm_l (float) – Lorentzian FWHM in the same units as
dx. Zero = no Lorentzian.deriv (int) – Derivative order: 0 = absorption, 1 = first derivative, 2 = second derivative (applied through the line shape).
phase (float) – Dispersion phase (rad) of the line shape (EasySpin
phase).
- Returns:
torch.Tensor – Convolved spectrum, same shape as
spec.- Return type:
Notes
Port of EasySpin’s
convspec: the line shape is sampled on the extended 2N+1 grid (no analytic renormalisation), so sub-increment widths reproduce EasySpin’s behavior bit for bit. Gaussian and Lorentzian parts are applied sequentially (as pepper.m does), which is the same as a Voigt convolution; the derivative is carried by the first.With both widths zero and
deriv > 0the spectrum is differentiated spectrally (FFT), a torchspin extension.