processing.referencing
Spectral-axis referencing: conversion between relative [Hz] and absolute [ppm] axes.
These converters are pure coordinate swaps (no Fourier transform): they build the
sibling spectral coordinate from the reference_frequency / carrier_ppm
metadata and swap the indexing dimension. Together with to_spectrum /
to_fid they are the only functions in xmris that change a DataArray’s
representation on purpose — the domain decorators route every automatic
conversion through them.
Functions¶
| Name | Description |
|---|---|
| to_hz | Convert an absolute chemical shift axis [ppm] to a relative frequency axis [Hz]. |
| to_ppm | Convert a relative frequency axis [Hz] to an absolute chemical shift axis [ppm]. |
to_hz¶
processing.referencing.to_hz(da, dim=DIMS.chemical_shift)Convert an absolute chemical shift axis [ppm] to a relative frequency axis [Hz].
Computes (ppm - carrier_ppm) * reference_frequency for every point of
the chemical shift coordinate, assigns the result as a new frequency
coordinate, and swaps the indexing dimension to it.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
| da | xr.DataArray | The input chemical-shift-domain data with a coordinate on dim. | required |
| dim | str | The chemical shift dimension to convert, by default DIMS.chemical_shift. | DIMS.chemical_shift |
Returns¶
| Name | Type | Description |
|---|---|---|
| xr.DataArray | The same data indexed by a relative frequency [Hz] dimension. |
to_ppm¶
processing.referencing.to_ppm(da, dim=DIMS.frequency)Convert a relative frequency axis [Hz] to an absolute chemical shift axis [ppm].
Computes carrier_ppm + hz / reference_frequency for every point of the
frequency coordinate, assigns the result as a new chemical_shift
coordinate, and swaps the indexing dimension to it. The original Hz
coordinate is kept alongside, so both views remain available.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
| da | xr.DataArray | The input frequency-domain data with a coordinate on dim. | required |
| dim | str | The relative frequency dimension to convert, by default DIMS.frequency. | DIMS.frequency |
Returns¶
| Name | Type | Description |
|---|---|---|
| xr.DataArray | The same data indexed by an absolute chemical_shift [ppm] dimension. |