Closed kaustubhmote closed 5 years ago
The tests are failing since I seem to have completely missed that the test data for these new functions (to be placed in fileio/tests/data
directory) is not checked in. This is because data
has been included in the .gitignore). I could check it into the tests
directory instead of data
, but it is probably better to have it in a folder where the rest of the data is located.
@jjhelmus , what do you recommend?
Not sure why the Travis-CI still cannot see the fileio/bruker_test_data
folder. Anyways, it is now available in my master
branch for testing and/or copying to the correct location.
@kaustubhmote Thanks for putting this together. Sorry it took so long to review. The bruker test files were not being copied into the correct location when the package was installed. The changes in 597853f42bc9eb6739acf2c17c94bfcca869e26d and ae1aa047d7d25e6ea6e357ce31dfc085b341f4a7 took care of this.
This PR adds a
write_pdata
function to thefileio/bruker.py
module that can write externally processed data from anumpy.ndarray
into Bruker processed-data format. The real part of the dataset is written by default, but imaginary datasets can be written out by manually specifying the binary filename (eg '1i', '2ii', etc) and selecting out the appropriate data structure. Writing 2D slices of a 3D data and 1D slices of 2D datasets are also supported.If a Bruker dictionary is supplied (eg 'procs', 'proc2s', etc ), data can be written in a format that can be automatically read by Topspin. This includes things like making appropriate folders inside the standard
pdata
folder.Two examples in the
examples/bruker_write_pdata
folder show how this can be achieved for 1D and 2D datasets. Data with higher dimensions can be written in a smilar manner.A major caveat:
procNs
files no longer reflect the actual parameters that has gone into the processing the data. Since the main use case of function is likely to be reading back the data into Topspin, writing ofprocNs
files is unavoidable (but still set toFalse
by default). If this is desired, appropriate parameters should be manually put into theprocNs
files. The only place where this is done currently is when writing out slices of a higher dimensional dataset, where the value of thePPARMOD
parameter in theprocNs
directories is updated to reflect the dimension of the data being written out.A minor caveat:
write_pdata
function, but is set toFalse
by default.