Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

processing.referencing

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

NameDescription
to_hzConvert an absolute chemical shift axis [ppm] to a relative frequency axis [Hz].
to_ppmConvert 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

NameTypeDescriptionDefault
daxr.DataArrayThe input chemical-shift-domain data with a coordinate on dim.required
dimstrThe chemical shift dimension to convert, by default DIMS.chemical_shift.DIMS.chemical_shift

Returns

NameTypeDescription
xr.DataArrayThe 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

NameTypeDescriptionDefault
daxr.DataArrayThe input frequency-domain data with a coordinate on dim.required
dimstrThe relative frequency dimension to convert, by default DIMS.frequency.DIMS.frequency

Returns

NameTypeDescription
xr.DataArrayThe same data indexed by an absolute chemical_shift [ppm] dimension.