Dimensions
Selectors (At, Near, .., Where, …) and functions such as dims, rebuild and set are re-exported from DimensionalData.jl; see the DimensionalData.jl documentation.
NMRTools.NMRBase.AbstractNMRDataNMRTools.NMRBase.FieldDimensionNMRTools.NMRBase.FrequencyDimensionNMRTools.NMRBase.GradientDimensionNMRTools.NMRBase.HasNonFrequencyDimensionNMRTools.NMRBase.NMRDataNMRTools.NMRBase.NMRDimensionNMRTools.NMRBase.NonFrequencyDimensionNMRTools.NMRBase.OffsetDimensionNMRTools.NMRBase.TimeDimensionNMRTools.NMRBase.UnknownDimensionNMRTools.NMRBase.dataNMRTools.NMRBase.finddimNMRTools.NMRBase.hasnonfrequencydimensionNMRTools.NMRBase.hzNMRTools.NMRBase.missingvalNMRTools.NMRBase.ppmNMRTools.NMRBase.replacedimensionNMRTools.NMRBase.resolvedimNMRTools.NMRBase.setgradientlistNMRTools.NMRBase.setkinetictimesNMRTools.NMRBase.setoffsetsNMRTools.NMRBase.setrelaxtimesNMRTools.NMRBase.setspinlockfieldNMRTools.NMRBase.shiftdim
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:TupleofNMRDimensions for the array.name:Symbolname for the array, which will also retreive named layers ifNMRDatais 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 anAbstractNMRDatarefdims:Tuple ofpositionDimensions the array was sliced from, defaulting to().
NMRTools.NMRBase.AbstractNMRData — Type
AbstractNMRData <: DimensionalData.AbstractDimArrayAbstract 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.
NMRTools.NMRBase.data — Function
data(nmrdimension)Return the numerical data associated with an NMR dimension.
data(nmrdata)Return the numerical data associated with the specified NMRData.
data(nmrdata, dim)Return the numerical data associated with the specified dimension.
NMRTools.NMRBase.missingval — Function
missingval(x)Returns the value representing missing data in the dataset.
Dimension types
NMRTools.NMRBase.NMRDimension — Type
NMRDimensionAbstract supertype for all axes used in NMRData objects.
See also FrequencyDimension and NonFrequencyDimension.
NMRTools.NMRBase.FrequencyDimension — Type
FrequencyDimension <: NMRDimensionAbstract supertype for frequency dimensions used in NMRData objects. Concrete types F1Dim, F2Dim, F3Dim and F4Dim are generated for use in creating objects.
See also NonFrequencyDimension.
NMRTools.NMRBase.NonFrequencyDimension — Type
NonFrequencyDimension <: NMRDimensionAbstract supertype for non-frequency dimensions used in NMRData objects. Sub-types include TimeDimension, GradientDimension, and UnknownDimension.
See also FrequencyDimension.
NMRTools.NMRBase.TimeDimension — Type
TimeDimension <: NonFrequencyDimension <: NMRDimensionAbstract 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.
NMRTools.NMRBase.GradientDimension — Type
GradientDimension <: NonFrequencyDimension <: NMRDimensionAbstract supertype for gradient-encoded dimensions used in NMRData objects. Concrete types G1Dim, G2Dim, G3Dim and G4Dim are generated for use in creating objects.
NMRTools.NMRBase.UnknownDimension — Type
UnknownDimension <: NonFrequencyDimension <: NMRDimensionAbstract supertype for unknown, non-frequency dimensions used in NMRData objects. Concrete types X1Dim, X2Dim, X3Dim and X4Dim are generated for use in creating objects.
NMRTools.NMRBase.OffsetDimension — Type
OffsetDimension <: NonFrequencyDimension <: NMRDimensionAbstract 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.
NMRTools.NMRBase.FieldDimension — Type
FieldDimension <: NonFrequencyDimension <: NMRDimensionAbstract 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.
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!"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)
trueWorking 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 |>.
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 |>.
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 |>.
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.
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.
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.
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 nucleusNMRTools.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))
trueNMRTools.NMRBase.resolvedim — Function
resolvedim(spec, dim_ref) -> IntResolve 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.
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(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).
ppm(f::FQList, ax::FrequencyDimension)Return frequency list values in ppm (in absolute terms, i.e. relative to 0 ppm).
See also: hz
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
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
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