Metadata

NMRData objects carry metadata on acquisition and processing, filled in automatically when data are loaded and updated by processing functions.

Two levels of metadata

Metadata are attached at two levels:

  1. Spectrum metadata describe the experiment as a whole: number of scans, receiver gain, pulse programme, title, temperature, the noise level (estimated when the spectrum is loaded), acquisition parameters from the acqus files, and the contents of auxiliary files such as vclists and vdlists.
  2. Axis metadata describe one dimension: number of points, the original time-domain size (before zero-filling, linear prediction or extraction of a region), carrier and base frequencies, spectral width, nucleus, window function, phase correction and the dimension's imaginary unit (:mcindex).

Both are dictionaries keyed by symbols such as :ns or :window. The standard keys are listed in Metadata keys.

Looking up metadata

Spectrum metadata are looked up with a key; axis metadata with a dimension and a key. The dimension can be given by type, number or (for frequency dimensions) nucleus:

metadata(spec, :ns)            # spectrum metadata
spec[:ns]                      # the same

metadata(spec, F1Dim, :bf)     # axis metadata
spec[F1Dim, :bf]               # the same
spec[1, :bf]                   # by dimension number

metadata(spec)                 # the whole spectrum dictionary
metadata(spec, F1Dim)          # the whole dictionary for one axis
using NMRTools
spec = exampledata("2D_HN")
spec[:pulseprogram], spec[F2Dim, :nucleus], spec[F1Dim, :window]
("sfhmqcf3gpph.cw", N15, Cos2Window(0.09461759999999972))

Acquisition parameters are kept as parsed from the acqus files and read with acqus, which accepts Bruker parameter names in either case; see Find acquisition parameters.

Metadata types

Where a parameter has structure beyond a single number, NMRTools stores it as a typed object instead of a raw value:

ParameterTypeReference
apodization applied in processingWindowFunctionWindow functions
power levels (PLW, PL)PowerPower levels
frequency lists (fq1list, …)FQListFrequency lists
sample descriptionNMRSampleSample metadata schema
spectrometer channelsDict per channelFind acquisition parameters
pulse programme annotationsDictPulse programme annotations

Times are stored in seconds and frequencies in Hz throughout; see Time and frequency units.

How processing updates metadata

Processing functions record what they did on the dimension they acted on:

  • apodize sets :window;
  • zerofill updates :tdzf, and linearpredict updates :td;
  • ft carries the time-dimension metadata over to the new frequency dimension and sets :grpdly to 0;
  • phase adds to :phase, the total correction applied so far;
  • phase, extract and ft re-estimate the spectrum's :noise.
Shared metadata

Slices and copies of an NMRData share the same metadata dictionary as the original, so changing metadata on one changes it on all of them. Use deepcopy to make an independent copy.