Metadata
NMRData objects can store various metadata associated with the spectrum and each of the dimensions.
Metadata are stored as dictionaries using symbols as keys (e.g. :ns). They can be accessed using the metadata function, or directly from an NMRData object using a dictionary-style lookup. Metadata associated with axes are accessed by providing an additional reference, either as a dimension number or type (e.g. F1Dim, F2Dim etc.).
metadata(nmrdata, key) # spectrum metadata
nmrdata[key]
metadata(nmrdata, dimension, key) # axis metadata
nmrdata[dimension, key]DimensionalData.Dimensions.Lookups.metadata — Function
metadata(nmrdata, key)
metadata(nmrdata, dim, key)
metadata(nmrdimension, key)Return the metadata for specified key, or nothing if not found. Keys are passed as symbols.
Examples (spectrum metadata)
:ns: number of scans:ds: number of dummy scans:rg: receiver gain:ndim: number of dimensions:title: spectrum title (contents of title pdata file):filename: spectrum filename:pulseprogram: title of pulse program used for acquisition:experimentfolder: path to experiment:noise: RMS noise level
Examples (dimension metadata)
:pseudodim: flag indicating non-frequency domain data:npoints: final number of (real) data points in dimension (after extraction):td: number of complex points acquired:tdzf: number of complex points when FT executed, including LP and ZF:bf: base frequency, in Hz:sf: carrier frequency, in Hz:offsethz: carrier offset from bf, in Hz:offsetppm: carrier offset from bf, in ppm:swhz: spectrum width, in Hz:swppm: spectrum width, in ppm:region: extracted region, expressed as a range in points, otherwise missing:window:WindowFunctionindicating applied apodization:referenceoffset: referencing (in ppm) applied to the dimension
See also estimatenoise!.
Labels
DimensionalData.Dimensions.label — Function
label(nmrdata)
label(nmrdata, dim)
label(nmrdimension)Return a short label associated with an NMRData structure or an NMRDimension. By default, for a spectrum this is obtained from the first line of the title file. For a frequency dimension, this is normally something of the form 1H chemical shift (ppm).
See also label!.
NMRTools.NMRBase.label! — Function
label!(nmrdata, labeltext)
label!(nmrdata, dim, labeltext)
label!(nmrdimension, labeltext)Set the label associated with an NMRData structure or an NMRDimension.
See also label.
DimensionalData.Dimensions.Lookups.units — Function
units(nmrdata)
units(nmrdata, dim)
units(nmrdimension)Return the physical units associated with an NMRData structure or an NMRDimension.
Acquisition data
When spectra are loaded, the contents of the acqus file are parsed (as are the acqu2s files etc. too, if present). These can be accessed with :acqus and :acqu2s keys, etc. For convenience though, the additional function acqus is provided to access acquisiton data directly.
NMRTools.NMRBase.acqus — Function
acqus(nmrdata)
acqus(nmrdata, key)
acqus(nmrdata, key, index)Return data from a Bruker acqus file, or nothing if it does not exist. Keys can be passed as symbols or strings. If no key is specified, a dictionary is returned representing the entire acqus file.
If present, the contents of auxilliary files such as vclist and vdlist can be accessed using this function.
Examples
julia> acqus(expt, :pulprog)
"zgesgp"
julia> acqus(expt, "TE")
276.9988
julia> acqus(expt, :p, 1)
9.2
julia> acqus(expt, "D", 1)
0.1
julia> acqus(expt, :vclist)
11-element Vector{Int64}:
[...]See also metadata.
Auxilliary files
acqus can also be used to access the contents of auxilliary files (and if not present, nothing will be returned). Note that NMRTools will perform automatic unit conversion as follows:
:vclist: variable loopcounter:vdlist: variable delays, in seconds:valist: variable amplitude, in dB (converted from Watts if necessary):vplist: variable pulse lengths, in seconds:fq1listup to:fq8list: frequency lists – see the Frequency lists page for more information.
Frequency list API
Frequency lists can be specified on the spectrometer in a number of ways - in Hz, in ppm, and relative to the spectrometer frequency or the base frequency (0 ppm). Frequency lists are therefore stored in NMRTools as FQList structures which encode this additional information.
NMRTools.NMRIO.FQList — Type
FQList(values, unit::Symbol, relative::Bool)Represents a frequency list. unit can be :Hz or :ppm, and relative indicates whether the frequency is given relative to SFO (true) or BF (false).
Raw values can be extracted using the data function, or (better) as absolute chemical shifts (in ppm) or relative offsets (in Hz) using ppm and hz functions.
NMRTools.NMRBase.ppm — Function
ppm(axis)Return the ppm values for points along a frequency axis.
ppm(offset, axis)Return the chemical shifts for a given offset or list of offsets along a frequency axis.
ppm(f::FQList, ax::FrequencyDimension)Return frequency list values in ppm (in absolute terms, i.e. relative to 0 ppm).
See also: hz
NMRTools.NMRBase.hz — Function
hz(p::Power, ref_p::Power, ref_Hz)Convert power to radiofrequency strength in Hz using a reference power and known Hz value.
Uses the relationship: Hz = ref_Hz * 10^(-ΔdB/20) where ΔdB is the power difference.
Arguments
p::Power: Power to convertref_p::Power: Reference power with known Hz valueref_Hz: Radiofrequency strength in Hz at the reference power
Returns
Radiofrequency strength in Hz for power p
hz(p::Power, ref_p::Power, ref_pulselength, ref_pulseangle_deg)Convert power to radiofrequency strength in Hz using reference pulse parameters.
Arguments
p::Power: Power to convertref_p::Power: Reference powerref_pulselength: Reference pulse length in microsecondsref_pulseangle_deg: Reference pulse flip angle in degrees
Returns
Radiofrequency strength in Hz for power p
hz(axis)Return the offsets (in Hz) for points along a frequency axis.
hz(δ, axis)Return the offset (in Hz) for a chemical shift (or list of shifts) on a frequency axis.
hz(f::FQList, ax::FrequencyDimension)Return frequency list values as offsets relative to the spectrometer frequency, in Hz.
See also: ppm
Raw numerical data can be accessed using the data() function, but it is recommended to use ppm and hz functions to access frequency data safely. See the Frequency lists page for detailed examples.
Standard metadata: spectra
| Key | Description |
|---|---|
:acqusfilename | path to acqus file |
:acqus | contents of acqus file, as a dictionary |
:acqu2s, :acqu3s | contents of acqu2s/acqu3s files (if present) |
:experimentfolder | path to experiment |
:filename | spectrum filename |
:format | input file format (:nmrpipe or :pdata) |
:label | short label (first line of title pdata file) |
:ndim | number of dimensions |
:noise | RMS noise level (see estimatenoise!) |
:ns | number of scans |
:pulseprogram | pulse program title |
:rg | receiver gain |
:title | spectrum title (contents of title pdata file) |
:topspin | Topspin version used for acquisition |
Standard metadata: frequency dimensions
| Key | Description |
|---|---|
:aq | acquisition time, in seconds |
:bf | base frequency, in Hz |
:label | short label |
:npoints | final number of real data points in dimension (after extraction) |
:offsethz | carrier offset from bf, in Hz |
:offsetppm | carrier offset from bf, in ppm |
:pseudodim | flag indicating non-frequency domain data (false for frequency domain) |
:region | extracted region, expressed as a range in points, otherwise missing |
:sf | carrier frequency, in Hz |
:swhz | spectrum width, in Hz |
:swppm | spectrum width, in ppm |
:td | number of complex points acquired, including LP |
:tdzf | number of complex points when FT executed, including LP and ZF |
:window | WindowFunction encoding applied apodization |
:referenceoffset | applied referencing, in ppm |