jjhelmus / nmrglue

A module for working with NMR data in Python
BSD 3-Clause "New" or "Revised" License
211 stars 88 forks source link

Expanding NUS data #189

Closed kaustubhmote closed 1 year ago

kaustubhmote commented 1 year ago

This PR adds some functionality to take care of NUS datasets, as discussed in #187 .

Two new functions are introduced:

  1. ng.bruker.read_nuslist: reads nuslist (in bruker format)

  2. ng.proc_base.expand_nus: expands nus into a full dataset with zeros at the missing fid locations. This allows arbitrary dimension of the dataset, but generating data > 4D is disallowed by default. It allows an arbitrary acquisition order of indirect dimensions, as well as an arbitrary order for the acquisition of quadrature points. The defaults are tested with data acquired on Bruker spectrometers.

The workflow would be something like this for the issue described in #187 :

dic, data = ng.bruker.read(".", shape=(-1, 1024)) # shape kwarg is not necessary, but this makes it explict
nuslist = ng.bruker.read_nuslist(".")
full_data = ng.proc_base.expand_nus(data=data, shape=(128, 128, 1024), nuslist=nuslist)

There are tests added to test these functions with synthetic data.

This is not ready to be merged yet, the documentation of these functions is not yet done. I'll get around to doing that soon, but I'll keep this PR to see if there is any feedback.

jjhelmus commented 1 year ago

@kaustubhmote Thanks for putting this together. Sorry for the long delay in getting this merged.