Dimensions

Selectors (At, Near, .., Where, …) and functions such as dims, rebuild and set are re-exported from DimensionalData.jl; see the DimensionalData.jl documentation.

Data

NMRTools.NMRBase.NMRData — Type
NMRData <: AbstractNMRData
NMRData(A::AbstractArray{T,N}, dims; kw...)
NMRData(A::AbstractNMRData; kw...)

A generic AbstractNMRData for NMR array data. It holds memory-backed arrays.

Keywords

  • dims: Tuple of NMRDimensions for the array.
  • name: Symbol name for the array, which will also retreive named layers if NMRData is used on a multi-layered file like a NetCDF.
  • missingval: value representing missing data, normally detected from the file. Set manually when you know the value is not specified or is incorrect. This will not change any values in the NMRData, it simply assigns which value is treated as missing.

Internal Keywords

In some cases it is possible to set these keywords as well.

  • data: can replace the data in an AbstractNMRData

  • refdims: Tuple of position Dimensions the array was sliced from, defaulting to ().

source
NMRTools.NMRBase.AbstractNMRData — Type
AbstractNMRData <: DimensionalData.AbstractDimArray

Abstract supertype for objects that wrap an array of NMR data, and metadata about its contents.

AbstractNMRDatas inherit from AbstractDimArray from DimensionalData.jl. They can be indexed as regular Julia arrays or with DimensionalData.jl Dimensions.

source
NMRTools.NMRBase.data — Function
data(nmrdimension)

Return the numerical data associated with an NMR dimension.

source
data(nmrdata)

Return the numerical data associated with the specified NMRData.

source
data(nmrdata, dim)

Return the numerical data associated with the specified dimension.

source

Dimension types

NMRTools.NMRBase.TimeDimension — Type
TimeDimension <: NonFrequencyDimension <: NMRDimension

Abstract supertype for time dimensions used in NMRData objects. Concrete types T1Dim, T2Dim, T3Dim and T4Dim are generated for time-domains representing frequency evolution, and TrelaxDim and TkinDim are generated for representing relaxation and real-time kinetics.

source
NMRTools.NMRBase.GradientDimension — Type
GradientDimension <: NonFrequencyDimension <: NMRDimension

Abstract supertype for gradient-encoded dimensions used in NMRData objects. Concrete types G1Dim, G2Dim, G3Dim and G4Dim are generated for use in creating objects.

source
NMRTools.NMRBase.UnknownDimension — Type
UnknownDimension <: NonFrequencyDimension <: NMRDimension

Abstract supertype for unknown, non-frequency dimensions used in NMRData objects. Concrete types X1Dim, X2Dim, X3Dim and X4Dim are generated for use in creating objects.

source
NMRTools.NMRBase.OffsetDimension — Type
OffsetDimension <: NonFrequencyDimension <: NMRDimension

Abstract supertype for frequency offset dimensions used in NMRData objects. Used for CEST saturation offsets, R1rho off-resonance offsets, etc. Concrete type OffsetDim is generated for use in creating objects.

source
NMRTools.NMRBase.FieldDimension — Type
FieldDimension <: NonFrequencyDimension <: NMRDimension

Abstract supertype for RF field strength dimensions used in NMRData objects. Used for spinlock power in R1rho dispersion experiments. Concrete type SpinlockDim is generated for use in creating objects.

source
NMRTools.NMRBase.HasNonFrequencyDimension — Type
@traitdef HasNonFrequencyDimension{D}

A trait indicating whether the data object has a non-frequency domain dimension.

Example

@traitfn f(x::X) where {X; HasNonFrequencyDimension{X}} = "This spectrum has a non-frequency domain dimension!"
@traitfn f(x::X) where {X; SimpleTraits.Not{HasNonFrequencyDimension{X}}} = "This is a pure frequency-domain spectrum!"
source
NMRTools.NMRBase.hasnonfrequencydimension — Function
hasnonfrequencydimension(spectrum)

Return true if the spectrum contains a non-frequency domain dimension.

Example

julia> y2=loadnmr("exampledata/2D_HN/test.ft2");
julia> hasnonfrequencydimension(y2)
false
julia> y3=loadnmr("exampledata/pseudo3D_HN_R2/ft/test%03d.ft2");
julia> hasnonfrequencydimension(y3)
true
source

Working with dimensions

NMRTools.NMRBase.replacedimension — Function
replacedimension(nmrdata, olddimnumber, newdim)
replacedimension(olddimnumber, newdim)

Return a new NMRData, in which the numbered axis is replaced by a new Dimension.

The forms without the data argument return a function for use with |>.

source
NMRTools.NMRBase.setrelaxtimes — Function
setrelaxtimes(A::NMRData, [dimnumber], tvals, units="")
setrelaxtimes([dimnumber], tvals, units="")

Return a new NMRData with a relaxation time axis containing the passed values (and optionally, units). If a dimension number is specified, that dimension will be replaced with a TrelaxDim. If not, the function will search for a unique non-frequency dimension, and replace that. If there are multiple non-frequency dimensions, the dimension number must be specified explicitly, and the function will throw an error.

The forms without the data argument return a function for use with |>.

source
NMRTools.NMRBase.setkinetictimes — Function
setkinetictimes(A::NMRData, [dimnumber], tvals, units="")
setkinetictimes([dimnumber], tvals, units="")

Return a new NMRData with a kinetic time axis containing the passed values (and optionally, units). If a dimension number is specified, that dimension will be replaced with a TkinDim. If not, the function will search for a unique non-frequency dimension, and replace that. If there are multiple non-frequency dimensions, the dimension number must be specified explicitly, and the function will throw an error.

The forms without the data argument return a function for use with |>.

source
NMRTools.NMRBase.setgradientlist — Function
setgradientlist(A::NMRData, [dimnumber], relativegradientlist, Gmax=nothing)
setgradientlist([dimnumber], relativegradientlist, Gmax=nothing)

Return a new NMRData with a gradient axis containing the passed values. If no maximum strength is specified, a default gradient strength of 0.55 T m⁻¹ will be set, but a warning raised for the user.

The forms without the data argument return a function for use with |>.

If a dimension number is specified, that dimension will be replaced. If not, the function will search for a unique non-frequency dimension, and replace that. If there are multiple non-frequency dimensions, the dimension number must be specified explicitly, and the function will throw an error.

source
NMRTools.NMRBase.setoffsets — Function
setoffsets(A::NMRData, dimnumber, offsets, units="ppm")

Return a new NMRData with an offset axis (for CEST, R1rho off-resonance, etc.). Dimension number must be specified explicitly.

source
NMRTools.NMRBase.setspinlockfield — Function
setspinlockfield(A::NMRData, dimnumber, fields, units="Hz")

Return a new NMRData with a spinlock field strength axis. Dimension number must be specified explicitly.

source
NMRTools.NMRBase.shiftdim — Function
shiftdim(data::NMRData, dim_ref, offset)
shiftdim(dim_ref, offset)

Add an offset to a frequency dimension in an NMRData object. The dimension can be specified as a numerical index, a dimension type like F1Dim, or a Nucleus enum (e.g., H1, C13).

The forms without the data argument return a function for use with |>.

The metadata is copied using replacedimension, and an entry is added or updated in the dimension metadata to record the offset change.

Examples

spec2 = shiftdim(spec, 1, 0.5)       # Using dimension index
spec2 = shiftdim(spec, F1Dim, 0.5)   # Using dimension type
spec2 = shiftdim(spec, H1, 0.5)      # Using nucleus

See also reference, finddim.

source
NMRTools.NMRBase.finddim — Function
finddim(spec, nucleus::Nucleus)

Find the dimension index in an NMRData object that corresponds to the given nucleus. Returns the dimension index (1-based) or nothing if not found.

Examples

julia> spec = exampledata("2D_HN");     # a ¹H,¹⁵N spectrum

julia> finddim(spec, H1)
1

julia> finddim(spec, N15)
2

julia> isnothing(finddim(spec, C13))
true

See also shiftdim, reference.

source
NMRTools.NMRBase.resolvedim — Function
resolvedim(spec, dim_ref) -> Int

Resolve a dimension reference to a dimension index. Accepts:

  • Int: dimension index (returned as-is)
  • Dimension type (e.g., F1Dim): finds first matching dimension
  • Nucleus (e.g., H1, C13): finds dimension with matching nucleus

Returns the dimension index or throws an error if not found.

source
NMRTools.NMRBase.ppm — Function
ppm(axis)

Return the ppm values for points along a frequency axis.

source
ppm(offset, axis)

Return the chemical shifts for a given offset or list of offsets along a frequency axis.

source
ppm(peak)
ppm(peak, n)
ppm(n)

The position of a peak in ppm: a tuple ordered like the spectrum's dimensions, or the nth coordinate on its own. ppm(n) returns the function peak -> ppm(peak, n), for use with sort, filter or broadcasting, e.g. sort(pks; by=ppm(1)) or ppm(2).(pks).

source
ppm(f::FQList, ax::FrequencyDimension)

Return frequency list values in ppm (in absolute terms, i.e. relative to 0 ppm).

See also: hz

source
ppm(f::FQList)

Return frequency list values in ppm (in absolute terms, i.e. relative to 0 ppm), using the reference frequencies (:bf, :sfo) stored on the list. Throws an error if no reference is attached — see withreference.

See also: hz

source
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 convert
  • ref_p::Power: Reference power with known Hz value
  • ref_Hz: Radiofrequency strength in Hz at the reference power

Returns

Radiofrequency strength in Hz for power p

source
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 convert
  • ref_p::Power: Reference power
  • ref_pulselength: Reference pulse length in microseconds
  • ref_pulseangle_deg: Reference pulse flip angle in degrees

Returns

Radiofrequency strength in Hz for power p

source
hz(axis)

Return the offsets (in Hz) for points along a frequency axis.

source
hz(δ, axis)

Return the offset (in Hz) for a chemical shift (or list of shifts) on a frequency axis.

source
hz(f::FQList, ax::FrequencyDimension)

Return frequency list values as offsets relative to the spectrometer frequency, in Hz.

See also: ppm

source
hz(f::FQList)

Return frequency list values as offsets relative to the spectrometer carrier frequency, in Hz, using the reference frequencies (:bf, :sfo) stored on the list. Throws an error if no reference is attached — see withreference.

See also: ppm

source