read bruker processed files

898 views
Skip to first unread message

Kresten Bertelsen

unread,
Mar 8, 2013, 4:23:13 AM3/8/13
to nmrglue...@googlegroups.com
Hi,

I have one request which I will try to implement myself in the "near" future if my programming skills are sufficient :).

Since I have already a number of advanced processing scripts implemented as bruker macros what I really want is to import the processed bruker spectra(/pdata/1r) files together with the Acqus and Procs file.

For the time being this is accomplished  in matlab using the excellent rbnmr.m script (http://www.mathworks.se/matlabcentral/fileexchange/index?utf8=%E2%9C%93&term=rbnmr). But for portability reasons I want to make my NMR data analysis in python.

I'm sure something similar could be done in python. I even think it might already be implemented in a library called mediPy (http://medipy.googlecode.com/hg-history/959e93279fbcfecc4d3e7762845b9b85fa8cee75/lib/medipy/io/rbnmr.py) but my python skills are still not sufficient to understand how to incorporate the library in my scripts which will run in windows.(binaries are only for linux).

Any pointers on how to port the rbnmr rutine to nmrGLUE is greatly appreciated

Jonathan Helmus

unread,
Mar 8, 2013, 11:21:52 AM3/8/13
to nmrglue...@googlegroups.com
Reading 1D spectral data from processed Bruker files in the pdata
directory is very easy with NumPy, the following works to read the real
data when in the pdata/1 or similar directory:

import numpy as np
data = np.fromfile('1r', 'i4')

Depending on the byteorder 'i4' might need to be replaced with '>i4' or
'<i4' (the data is 32-bit integers). The imaginary data can be read
from the 1i file in the same way. From my initial looking the parameter
for units (PPM, etc) are mostly stored in the procs file which can be
read with nmrglue.bruker.read_jcamp.

Reading 2D and 3D data is a bit more tricky as there are more file (2rr,
2ri, 2ir, 2ii, etc) and they are stored in a sub-matrix format. This
mean data reshaping and shuffling, nothing to hard, Sparky data uses a
similar format.

I'll look into adding the ability to read all types of processed Bruker
data into nmrglue, the details are not difficult, but I need to think
about how to fit this into the overall nmrglue architecture.


Hope this helps, I'll keep the list updated on any development on this.

Cheers,

- Jonathan Helmus
> --

Reply all
Reply to author
Forward
0 new messages