utils.spectra
utils.spectra
Functions¶
| Name | Description |
|---|---|
| calculate_hz_axis | Calculate the frequency (Hz) axis for a spectrum. |
| calculate_ppm_axis | Calculate the chemical shift (ppm) axis for a spectrum. |
calculate_hz_axis¶
utils.spectra.calculate_hz_axis(spectral_width=None, npts=None, header=None)Calculate the frequency (Hz) axis for a spectrum.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
| spectral_width | float | Spectral width in Hz. Read from header if not given. | None |
| npts | int | Number of spectral points. Read from header if not given. | None |
| header | dict | Raw header dict to fall back on for spectral_width/npts. | None |
Returns¶
| Name | Type | Description |
|---|---|---|
| npt.NDArray[np.float64] | Frequency axis in Hz, centered on zero. |
calculate_ppm_axis¶
utils.spectra.calculate_ppm_axis(
spectral_width=None,
frequency=None,
carrier_ppm=None,
nucleus=None,
npts=None,
header=None,
)Calculate the chemical shift (ppm) axis for a spectrum.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
| spectral_width | float | Spectral width in Hz. Read from header if not given. | None |
| frequency | float | Spectrometer frequency in MHz. Read from header if not given. | None |
| carrier_ppm | float | Carrier frequency offset in ppm. Derived from nucleus if not given. | None |
| nucleus | int or str | Nucleus identifier (e.g. "1H" or 1) used to derive carrier_ppm when it is not provided directly. | None |
| npts | int | Number of spectral points. Read from header if not given. | None |
| header | dict | Raw header dict to fall back on for the other parameters. | None |
Returns¶
| Name | Type | Description |
|---|---|---|
| npt.NDArray[np.float64] | Chemical shift axis in ppm. |