Analysis specifications
How NMRLink corrects, transforms and fits measurement values. See the signal analysis API for arguments and results, or the analysis guide for examples.
On this page
Baseline correction
Each channel uses the mean of its final tailPoints samples as the baseline, subtracting it from every sample. Defaults: 100 samples and truncate:true, applying Math.trunc toward zero after subtraction. Use false to retain fractional values.
The corrected array is new; raw is unchanged. A remaining signal in the tail contributes to the mean. This is not an automatic separation of device offsets from physical signal.
L is the total sample count, K is tailPoints and c is the channel. Truncation, when enabled, is applied to the corrected values.
Complex FFT convention
I and Q denote Data 1 and Data 2. N is the selected sample count; j starts at zero at the beginning of that interval. M is the padded FFT size. A and φ correspond to amplitude and phaseRadians. The forward exponent is negative. This is a two-sided complex spectrum, not a one-sided real-signal spectrum; amplitudes are not doubled.
hz is relative to the receiver frequency. Bins run in ascending order from negative Nyquist to the positive side, excluding positive Nyquist. At the usual 0.02 ms interval, the sampling frequency is 50 kHz and Nyquist is 25 kHz. Reversing the sign of Data 2 reverses the complex frequency direction.
Interval, window and normalization
The FFT interval is [startMs, endMs). Both endpoints are converted to sample indexes using the following expression, capping the end index at the total sample count. Δt is the sample interval. At least four selected samples are required; actualStartMs and actualEndExclusiveMs describe the resulting interval.
hann uses the following symmetric N-sample window. The rectangular window rect uses . Windowed data is padded to the next power of two M. Real, imaginary and amplitude values are normalized by the sum of window weights rather than the padded length.
| Typical default analysis | Value |
|---|---|
| Acquisition | 2048 samples, 0.02 ms spacing, 0–40.96 ms (end excluded) |
| FFT interval | 1–5 ms (end excluded), 200 samples |
| FFT size | 256 points after padding |
| Bin spacing, spacingHz | |
| Resolution estimate, resolutionHz |
Zero padding refines frequency sampling without improving observation-time resolution. Window choice changes spectral broadening and leakage. Frequency display limits are separate from the time interval used for computation.
Peak, amplitude and phase
analyzeMeasurement selects the maximum-amplitude FFT bin across all frequencies; ties choose the first bin in ascending order. evaluateFrequency and related functions restrict the search to a specified band. Reported peak frequencies are bin values, without interpolation.
Phase uses the start of the selected interval as the time origin, without compensation to absolute acquisition time. Do not interpret phase at nearly zero amplitude. Amplitudes are arbitrary units; physical calibration depends on the apparatus.
Common frequency and phase
Pulse calibration and T1 evaluate a complex component at one shared frequency, then subtract a common phase to obtain a signed real projection. They do not align every point independently, retaining pulse sign reversals and negative-to-positive T1 recovery. magnitude is phase-independent magnitude; quadrature is the orthogonal component.
The automatic frequency maximizes summed squared FFT amplitudes, adjusting weights for duplicate scan values. Phase comes from strong points; the pulse sign is oriented positive at short lengths and T1 toward a positive recovery slope. Manual referenceIndex changes the phase reference only; frequency still comes from all points.
Pulse sine fitting
The signed and magnitude models are shown below. Here ℓ is length, the RF cycle count, and . Candidates from measured peaks and crossings are distinct from least-squares estimates. Fitting is attempted from at least three points; candidates outside the measured range are extrapolations. Incoherent phase and low agreement produce warnings.
T1 and T2 exponential fitting
| Property | T1 | T2 |
|---|---|---|
| Model | ||
| Axis and fit range | τ [ms] | 2τ [ms] |
| Signal | Signed projection at common phase | Common-frequency complex magnitude in a moving echo window |
| Background | A is fitted | Fixed at zero |
T2 acquisition time begins after the second pulse; the echo center is at τ, and the analysis window follows it. A manual T2 referenceIndex selects the point that supplies the common frequency.
Repeated τ values are averaged. Fits minimize squared residuals in the original signal values, not a straight line in log amplitude. T1 needs at least five distinct delays with both signal signs; T2 estimates from at least three nonnegative points. See the fitting API for acceptance conditions.
Inspect r2, rmse and warnings along with the estimate. Short-range estimates may be sensitive to the interval or phase reference. Fits never automatically change hardware parameters.
Invalid data
Incomplete pairs, NaN, Infinity, invalid time ranges and arithmetic overflow are errors. Invalid values are not replaced with zero, and intervals are not silently shortened for small records. Keep the raw data and display the error in the calling UI.