#nmr #ist #nonuniform-sampling #nus

no-std nmr-schedule

Algorithms for NMR Non-Uniform Sampling

1 unstable release

new 0.1.0 Apr 7, 2025

#1699 in Algorithms

MIT license

160KB
3.5K SLoC

nmr-schedule

This crate implements algorithms for Non-Uniform Sampling in NMR spectroscopy.

This crate primarily implements algorithms for generating and filtering sampling schedules. It includes various base schedules along with various post-processing filters for schedules.

This library currently only supports 1D schedules, however there are plans to support higher dimensional schedules in the future and the architecture is already generic over dimension.

Examples

// Generate a 64x256 schedule with Quantiles with QSin weighting, 8 points backfill, and TMPF filtering
let sched = Quantiles::new(|len| qsin(len, QSinBias::Low, 3.))
    .fill_corners(|_, _| [8, 1]) // Any function of the count and length of the schedule
    .tm_filter()
    .polish_psf(0.1, 0.32, DisplayMode::Abs)
    .generate(64, Ix1(256));

println!("{sched}");
// Apply TMPF filtering to an existing schedule
let sched_encoded = "0\n1\n2\n5\n7\n9\n20";
let sched =
    Schedule::decode(sched_encoded, EncodingType::ZeroBased, |dim| Ok(dim)).unwrap();

let filtered =
    PSFPolisher::new(0.1, 0.32, DisplayMode::Abs).filter(TMFilter::new().filter(sched));

let encoded = filtered.encode(EncodingType::ZeroBased);
println!("{encoded}");

Dependencies

~5.5MB
~102K SLoC