Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to import multiple Bruker 1D spectra #3

Open
Ricmelis80 opened this issue Sep 12, 2023 · 8 comments
Open

How to import multiple Bruker 1D spectra #3

Ricmelis80 opened this issue Sep 12, 2023 · 8 comments

Comments

@Ricmelis80
Copy link

Hi, I triead reading and processing multiple raw 1D Bruker NMR spectra with NMRpy. Bruker fids are orinally located in specific subfolders es "1" (i.e the original Topspin EXPNO number) , For more clarity I have attached a zip files containing the data structure of the original root folder nmr.zip.

How I can process and display them? Thank you in advance!

@jmrohwer
Copy link
Collaborator

jmrohwer commented Sep 15, 2023

If you want to just load them individually, you specify the path up to the folder below the exp no subfolders (1/2/3). I.e. in your case:

fid_array_1 = nmrpy.from_path('root_folder/P_1')
fid_array_2 = nmrpy.from_path('root_folder/P_2')
fid_array_3 = nmrpy.from_path('root_folder/P_3')

Then each FID array will only contain one spectrum. If you want to load all the spectra into a single FID array, NMRPy expects a different folder structure where the experiment subfolders are located all imediately below the root folder, e.g.

root_folder/1
           /2
           /3

So you'd have to move the various "1" folders from P_1, P_2, P_3 to the root folder and rename them in sequence. In my experience Topspin saves these experiments like this automatically when queuing a number of experiments as in a time series.

Then you can simply do:

fid_array = nmrpy.from_path('root_folder')

and the FID array will contain all three spectra.

Hope this helps.

@Ricmelis80
Copy link
Author

Hi Johann,

Thanks a lot for useful suggestions! I'll try to implement it

@jmrohwer
Copy link
Collaborator

Can this issue be closed?

@AdriennR
Copy link

Hi,
I kind of have the same issue, but my experiment folders with different numbers are in the same root folder as they have been generated by Topspin. When I try to import all the fid data into one FidArray, I receive the error message: "fid_path does not specify a valid .fid directory." I only can import fid data if the root folder contains one experiment folder only.
Any suggestions?

@Ricmelis80
Copy link
Author

Hy,

Sorry, I'm totally forget to close this iussue. I have implemented the author's suggestion and it works well!

@AdriennR
Copy link

Hi,
Interesting. It does not work for me though. :(

@jmrohwer
Copy link
Collaborator

Hi, I kind of have the same issue, but my experiment folders with different numbers are in the same root folder as they have been generated by Topspin. When I try to import all the fid data into one FidArray, I receive the error message: "fid_path does not specify a valid .fid directory." I only can import fid data if the root folder contains one experiment folder only. Any suggestions?

Can you post the directory tree structure of your files? In the nmrpy install directory (under site-packages) there is some example test Bruker data, the structure looks like this:

tests/test_data/bruker2
├── 1
│   ├── WS_FTP.LOG
│   ├── acqu
│   ├── acqum
│   ├── acqums
│   ├── acqus
│   ├── cpdprg2
│   ├── fid
│   ├── format.temp
│   ├── pdata
│   │   └── 1
│   │       ├── 1i
│   │       ├── 1r
│   │       ├── WS_FTP.LOG
│   │       ├── meta
│   │       ├── meta.ext
│   │       ├── outd
│   │       ├── proc
│   │       └── procs
│   ├── pulseprogram
│   └── scon
├── 2
│   ├── WS_FTP.LOG
│   ├── acqu
│   ├── acqum
│   ├── acqums
│   ├── acqus
│   ├── cpdprg2
│   ├── fid
│   ├── format.temp
│   ├── pdata
│   │   └── 1
│   │       ├── 1i
│   │       ├── 1r
│   │       ├── WS_FTP.LOG
│   │       ├── meta
│   │       ├── meta.ext
│   │       ├── outd
│   │       ├── proc
│   │       └── procs
│   ├── pulseprogram
│   └── scon
├── 3
│   ├── WS_FTP.LOG
│   ├── acqu
│   ├── acqum
│   ├── acqums
│   ├── acqus
│   ├── cpdprg2
│   ├── fid
│   ├── format.temp
│   ├── pdata
│   │   └── 1
│   │       ├── 1i
│   │       ├── 1r
│   │       ├── WS_FTP.LOG
│   │       ├── meta
│   │       ├── meta.ext
│   │       ├── outd
│   │       ├── proc
│   │       └── procs
│   ├── pulseprogram
│   └── scon
...
...

You would import that with fid_array = nmrpy.from_path('tests/test_data/bruker2') (obviously you have to specify this relative to the current directory). The individual experiment folders are 1, 2, 3, ... under "bruker2" which is the root folder.

@AdriennR
Copy link

AdriennR commented Nov 2, 2023

Yes, I first tried with the bruker2 experimental files. If I did that, it told me that there are only 3 fid files that can be imported (instead of the 20 ones present in the bruker2 folder's subfolders).

Then I also tried with my files, and it has written the error message OSError: Data could not be imported..
My command: fid_array = nmrpy.from_path('/Users/User/Desktop/doktori/Lyon-Strassbourg/NMR/DNP/Measuremens/20230228_LNP_C2')

cd /Users/User/Desktop/doktori/Lyon-Strassbourg/NMR/DNP/Measuremens/20230228_LNP_C2
tree
.
|____11
| |____uxnmr.par
| |____format.ased
| |____pulseprogram
| |____format.temp
| |____audita.txt
| |____spnam0
| |____pdata
| | |____1
| | | |____proc
| | | |____title
| | | |____auditp.txt
| | | |____assocs
| | | |____1r
| | | |____1i
| | | |____procs
| | | |____outd
| | | |____thumb.png
| |____cpdprg2
| |____fid
| |____shimvalues
| |____uxnmr.info
| |____scon2
| |____acqu
| |____acqus
| |____specpar

|____1
| |____uxnmr.par
| |____popt.protocol
| |____format.ased
| |pulseprogram
| |
.DS_Store
| |____format.temp
| |____audita.txt
| |____pdata
| | |____999
| | | |____proc
| | | |____title
| | | |____auditp.txt
| | | |____1r
| | | |____1i
| | | |____procs
| | | |____outd
| | | |____used_from
| | | |thumb.png
| | |
.DS_Store
| | |____1
| | | |____proc
| | | |____title
| | | |____auditp.txt
| | | |____assocs
| | | |____1r
| | | |____1i
| | | |____procs
| | | |____outd
| | | |____thumb.png
| |____popt.array
| |____fq1list
| |____fid
| |____popt.protocol.999
| |____shimvalues
| |____uxnmr.info
| |____scon2
| |____acqu
| |____acqus
| |____specpar
|____10

| |____uxnmr.par
| |____pulseprogram
| |____format.temp
| |____audita.txt
| |____pdata
| | |____1
| | | |____proc
| | | |____title
| | | |____auditp.txt
| | | |____assocs
| | | |____1r
| | | |____1i
| | | |____procs
| | | |____outd
| | | |____thumb.png
| |____fq1list
| |____fid
| |____shimvalues
| |____uxnmr.info
| |____scon2
| |____acqu
| |____acqus
| |____specpar

|____12
| |____uxnmr.par
| |____format.ased
| |____pulseprogram
| |____format.temp
| |____audita.txt
| |____pdata
| | |____1
| | | |____proc
| | | |____title
| | | |____auditp.txt
| | | |____1r
| | | |____1i
| | | |____procs
| | | |____outd
| | | |____thumb.png
| |____fid
| |____shimvalues
| |____uxnmr.info
| |____scon2
| |____acqu
| |____acqus
| |____specpar

|____2
| |____uxnmr.par
| |____format.ased
| |____pulseprogram
| |____format.temp
| |____audita.txt
| |____spnam0
| |____pdata
| | |____1
| | | |____proc
| | | |____title
| | | |____auditp.txt
| | | |____1r
| | | |____1i
| | | |____procs
| | | |____outd
| | | |____thumb.png
| |____cpdprg2
| |____fq1list
| |____shimvalues
| |____uxnmr.info
| |____scon2
| |____acqu
| |____acqus
| |____specpar

|____13
| |____uxnmr.par
| |____popt.protocol
| |____format.ased
| |____pulseprogram
| |____format.temp
| |____audita.txt
| |____spnam0
| |____pdata
| | |____999
| | | |____proc
| | | |____title
| | | |____auditp.txt
| | | |____assocs
| | | |____1r
| | | |____1i
| | | |____procs
| | | |____outd
| | | |____used_from
| | | |____thumb.png
| | |____1
| | | |____proc
| | | |____title
| | | |____auditp.txt
| | | |____assocs
| | | |____1r
| | | |____1i
| | | |____procs
| | | |____outd
| | | |____thumb.png
| |____cpdprg2
| |____popt.array
| |____fid
| |____popt.protocol.999
| |____shimvalues
| |____uxnmr.info
| |____scon2
| |____acqu
| |____acqus
| |____specpar
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants