nmrglue.proc_base

A collection of NMR spectral processing functions which operate on the last dimension (1) of 2D arrays. These functions are wrapped by other processing modules but can also be used directly. All parameter are assumed to be in units of points unless otherwise noted.

This module is imported as nmrglue.proc_base and can be called as such.

Apodization

em(data[, lb, inv, rev]) Exponential apodization
gm(data[, g1, g2, g3, inv, rev]) Lorentz-to-Gauss apodization
gmb(data[, a, b, inv, rev]) Modified gaussian apodization
jmod(data[, e, off, end, inv, rev]) Exponentially damped J-modulation apodization
sp(data[, off, end, pow, inv, rev]) Shifted sine-bell apodization
sine(data[, off, end, pow, inv, rev]) Shifted sine-bell apodization
tm(data[, t1, t2, inv, rev]) Trapezoid Apodization
tri(data[, loc, lHi, rHi, inv, rev]) Triangle apodization.

Shifts

rs(data[, pts]) Right shift and zero fill.
ls(data[, pts]) Left shift and fill with zero
cs(data[, pts, neg]) Circular shift
roll(data[, pts, neg]) Roll axis
fsh(data, pts) Frequency shift by Fourier transform.

Transforms

rft(x) Real Fourier transform.
irft(xp) Inverse real fourier transform
fft(data) Fourier transform, NMR ordering of results.
fft_norm(data) Fourier transform, total power preserved, NMR ordering of results
fft_positive(data) Fourier transform with positive exponential, NMR ordering of results
ifft(data) Inverse fourier transform, NMR ordering of results.
ifft_norm(data) Inverse fourier transform, total power preserved, NMR ordering of results
ifft_positive(data) Inverse fourier transform with positive exponential, NMR ordered results.
ha(data) Hadamard Transform
ht(data[, N]) Hilbert transform.

Standard NMR

di(data) Delete imaginary from data
ps(data[, p0, p1, inv]) Linear phase correction
ps_exp(data[, p0, tc, inv]) Exponential Phase Correction
tp(data[, hyper]) Transpose data.
ytp(data[, hyper]) Transpose data.
xy2yx(data[, hyper]) Transpose data.
tp_hyper(data) Hypercomplex tranpose.
zf_inter(data[, pts]) Zero fill between points.
zf_pad(data[, pad, mid]) Zero fill by padding with zeros.
zf(data[, pad, mid]) Zero fill by padding with zeros.
zf_double(data, n[, mid]) Zero fill by doubling original data size once or multiple times.
zf_size(data, size[, mid]) Zero fill to given size.
zf_auto(data[, mid]) Zero fill to next largest power of two.

Basic Utilities

add(data[, r, i, c]) Add constant.
add_ri(data) Add real and imaginary components.
dx(data) Derivative by central difference
ext(data[, x0, xn, y0, yn]) Extract region.
ext_left(data) Extract the left half of spectrum.
ext_right(data) Extract the right half of the spectrum.
ext_mid(data) Extract the middle of the spectrum.
integ(data) Integrate by cumulative sum.
mc(data) Modulus calculation.
mc_pow(data) Modulus calculation.
mir_left(data) Append a mirror image of the data on the left.
mir_right(data) Append a mirror image of the data on the right.
mir_center(data) Append a mirror image of the data in the center.
mir_center_onepoint(data) Append a mirror image of the data in the center with a one point shift amd negate appended imaginary data.
mult(data[, r, i, c]) Multiply by a constant.
rev(data) Reverse data.
set(data, c) Set to a constant.
set_complex(data, v) Set real and imaginary portions of data to a constant.
set_real(data, v) Set real component of data to a constant.
set_imag(data, v) Set imaginary portion of data to a constant.
ri2c(data) Interleave real and imaginary data into a real array.
interleave_complex(data) Unpack complex data into an interleaved real, imaginary array.
unpack_complex(data) Unpacks complex array into real array (interleaves values).
c2ri(data) Seperate interleaved real, imaginary data into complex array.
seperate_interleaved(data) Seperate interleaved real, imaginary data into complex array.
pack_complex(data) Packs interleaved real array into complex array.
decode_States(data) Decode data collected using States (seperates interleaved data).
ri2rr(data) Append imaginary data to end of real data, returning a real array.
append_imag(data) Append imaginary data to end of real data, returning a real array.
rr2ri(data) Unappend real and imaginary data returning a complex array.
unappend_imag(data) Unappend real and imaginary data returning a complex array.
exlr(data) Exchange left and right halves of array.
exchange_lr(data) Exchange left and right halves of array.
rolr(data) Rotate left and right halves of array.
rotate_lr(data) Rotate left and right halves of array.
swap(data) Swap real and imaginary data.
swap_ri(data) Swap real and imaginary data.
bswap(data) Byteswap data
byte_swap(data) Byteswap data
neg_left(data) Negate left half.
neg_right(data) Negate right half.
neg_middle(data) Negate middle half.
neg_edges(data) Negate edge half (non-middle) of spectra.
neg_all(data) Negate data
neg_real(data) Negate real data
neg_imag(data) Negate imaginary data
neg_even(data) Negate even points
neg_odd(data) Negate odd points
neg_alt(data) Negate alternate (odd) points.
abs(data) Replace data with absolute value of data (abs of real, imag seperately)
sign(data) Replace data with sign (-1 or 1) of data (seperately on each channel)

Misc

coadd(data, clist[, axis]) Coadd data.
coad(data, clist[, axis]) Coadd data.
thres(data[, thres]) Mark values less than thres as invalid (for use with filters)
conv(data[, kern, m, c]) Convolute data with kernel.
convolute(data[, kern, m, c]) Convolute data with kernel.
corr(data[, kern, m, c]) Correlate data with a kernel (weights).
correlate(data[, kern, m, c]) Correlate data with a kernel (weights).
filter_median(data[, s, m, c]) Apply a median filter.
filter_min(data[, s, m, c]) Apply a minimum filter.
filter_max(data[, s, m, c]) Apply a maximum filter.
filter_percentile(data, percentile[, s, m, c]) Apply a percentile filter.
filter_rank(data, rank[, s, m, c]) Apply a rank filter.
filter_amin(data[, s, m, c]) Apply an absolute minimum filter.
filter_amax(data[, s, m, c]) Apply an absolute maximum filter.
filter_range(data[, s, m, c]) Apply a range filter.
filter_avg(data[, s, m, c]) Apply an average filter.
filter_dev(data[, s, m, c]) Apply a standard deviation filter.
filter_sum(data[, s, m, c]) Apply a summation filter.
filter_generic(data, filter[, s, m, c]) Apply a generic filter.
nmr_reorder(data) Reorder spectrum after FT transform to NMR order (swap halves and reverse).
qart(data[, a, f]) Scale Quad Artifacts.
qart_auto(data) Scale quad artifacts by values from Gram-Schmidt orthogonalization.
gram_schmidt(data) Calculate Gram-Schmidt orthogonalization parameters.
qmix(data, carr) Mix input and output channels provided coefficient array.
smo(data, n) Smooth data.
center(data, n) Center data.
zd(data, window[, x0, slope]) Zero Diagonal band with generic window function.
zd_boxcar(data[, wide, x0, slope]) Zero diagonal band with a boxcar function.
zd_triangle(data[, wide, x0, slope]) Zero diagonal band with triangle function
zd_sinebell(data[, wide, x0, slope]) Zero diagonal band with sinebell function.
zd_gaussian(data[, wide, x0, slope, g]) Zero Diagonal band with gaussian function

Low-Level Functions

The following are functions called by other processing functions. They are included here for completeness.

int2bin(n[, digits]) Integer to binary string
bin2int(s) binary string to integer
gray(n) Calculate n-bit gray code
amin_flt(arr)
amax_flt(arr)
range_flt(arr)
avg_flt(arr)
std_flt(arr)
sum_flt(arr)
largest_power_of_2(value) Find the nearest power of two equal to or larger than a value.