jjhelmus / nmrglue

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

How to Process and display multiple 1D Bruker data #199

Closed Ricmelis80 closed 1 year ago

Ricmelis80 commented 1 year ago

Hi, I tried reading and processing multiple raw 1D Bruker NMR files by using the follow code :

"root_folder = 'nmr' zero_fill_size = 32768 data = [] # <1> for folder in os.listdir(root_folder): dic, fid = ng.fileio.bruker.read(os.path.join(root_folder,folder)) fid = ng.bruker.remove_digital_filter(dic, fid) fid = ng.proc_base.zf_size(fid, zero_fill_size) # <2> fid = ng.proc_base.rev(fid) # <3> fid = ng.proc_base.fft(fid) data.append(fid) data = np.array(data)"

However, as 1D fids are located in specific subfolders named "1" (i.e the orginal Topspin EXPNO number) , I'm not able to find them with the bruker. read function. For more clarity I have attached a zip files containing the data structure of the root folder

nmr.zip

Any suggestions? Thanks in adavance!

kaustubhmote commented 1 year ago

ng.bruker.read needs to be pointed to the folder where the ser/ fid and the acquNs files exist. So dic, fid = ng.bruker.read(os.path.join(root_folder, folder, '1')) should work here. If the numbers are not always '1', you will have to use os.listdir one more time to get the subfolder.

Ricmelis80 commented 1 year ago

I see... Thanks a lot Dr Kaustubh R. Mote !

jjhelmus commented 1 year ago

Closing as this has been answered. @Ricmelis80 feel free to re-open if you need additional help with this problem.