generate a 2rr file from a numpy array

24 views
Skip to first unread message

João Figueira

unread,
Oct 2, 2017, 5:51:08 AM10/2/17
to nmrglue-discuss
As the title says.

I would like to generate the 2rr file from an array. I was trying to make numpy save it as int32, but nothing resembling a spectrum comes out of it.
I can't find any way to do this through NMR glue.

Cheers
JF

Jonathan Helmus

unread,
Oct 2, 2017, 3:42:58 PM10/2/17
to nmrglue...@googlegroups.com
JF,

    nmrglue does not support writing processed Bruker data, only reading this data.  If you are interested in adding support for writing this type of data, I would be happy to review a pull request that added such a feature. 

    The source code for the `read_pdata` [1] and `read_pdata_binary` [2] functions in the bruker module would be a good place to start.  Bruker processed data is stored on disk as four by signed integers (int32) with the endiness given in the metadata files.  The spectrum is divided into smaller sub-matrices, these would need to be formed prior to writing the data. 

My guess is that either the endiness or the lack of sub-matrices is the reason that you are no seeing anything resembling a spectrum.

Cheers,

     - Jonathan Helmus

[1] https://github.com/jjhelmus/nmrglue/blob/master/nmrglue/fileio/bruker.py#L862
[2] https://github.com/jjhelmus/nmrglue/blob/master/nmrglue/fileio/bruker.py#L1076
--
You received this message because you are subscribed to the Google Groups "nmrglue-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nmrglue-discu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

João Figueira

unread,
Oct 4, 2017, 5:30:29 AM10/4/17
to nmrglue-discuss
Hi Jonathan

I had no idea about the submatrices. Where can I find more information on that? I don't think I will ever be able to write something to be added to nmrglue though.

Thanks for your time!
JF

Jonathan Helmus

unread,
Oct 4, 2017, 10:31:07 AM10/4/17
to nmrglue...@googlegroups.com
The Bruker manuals provide details on the submatrix format.  In the XWIN-NMR manual, chapter 15 "File Formats" covers this topic in the 2D and 3D spectra sections.  I'm not sure where this information is in newer manuals.

    - Jonathan Helmus
Reply all
Reply to author
Forward
0 new messages