Permission error for Bruker files and not recognizing tnt files

200 просмотров
Перейти к первому непрочитанному сообщению

Grigore Alexandra

не прочитано,
9 июн. 2017 г., 11:07:5409.06.2017
– nmrglue-discuss
Heya,

I just discovered nmrglue and got really excited as getting data manually from TopSpin and TNMR has been my constant nightmare. 

I managed to install all the libraries and run some example scrips, however I am getting some errors for both Bruker and TecMag files. Any help would be appreciated!

1. Bruker - I used the example here and I am getting this error:
...line 1596, in get_fdata
    fdata = np.fromfile(filename, 'float32', 512)
PermissionError: [Errno 13] Permission denied: 'expnmr_00001_1'
- I followed the exact instructions, unpacked the tar and placed it in the same directory as my script. It seems to be related to the fact that the read function needs a file, not a folder. Any quick fix for this? I tried putting the fid file instead, but didn't work.

2. TecMag - I used this reading example and I'm getting this error:
...\tecmag.py", line 254, in read
    with open(filename, 'rb') as tntfile:
FileNotFoundError: [Errno 2] No such file or directory: '13C_EtOH_1pulse'
- it doesn't seem to recognize the file as a tnt file, although it definitely is. I tried with multiple files, including the test example ones that TNMR comes with. Are there different versions that this script doesn't work with?

Thank you very much!

Best,
Alexandra

Jonathan Helmus

не прочитано,
13 июн. 2017 г., 10:27:1813.06.2017
– nmrglue...@googlegroups.com
Alexandra,

    Can you provide some more details on what version of nmrglue you installed and what is triggering the errors you are seeing.  I've tried to reproduce the error you are seeing.

When reading the expnmr_00001_1 Bruker file you linked, you need to use the nmrglue bruker read function.  The following snippet works fine on my machine:

import nmrglue as ng
dic, data = ng.bruker.read('expnmr_00001_1')

If I instead use:

dic, data = ng.pipe.read('expnmr_00001_1')

I get a similar error to what you reported.  Since the files in question are in Bruker format not NMRPipe the nmrglue.pipe.read function should not be used to read this data.

The error you are seeing when reading the TecMag file indicates that the file does not exist in the path that was given.  Can you verify that the "13C_EtOH_1pulse" file exists.  Typically Tecmag files has a .tnt file extension, this extension should be included in the filename provided to the function.  For example to read a Tecmag file named LiCl_ref1.tnt, use the following:

import nmrglue as ng
dic, data = ng.tecmag.read('LiCl_ref1.tnt')


Cheers,

    - Jonathan Helmus
--
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.

Alexandra Grigore

не прочитано,
16 июн. 2017 г., 13:50:2316.06.2017
– nmrglue-discuss
Hi Jonathan,

Thank you very much for your reply!

I have nmrglue-0.5, I just saw the 0.6 version, might upgrade to that.

Regarding the Bruker file issue, I used ng.bruker.read, I basically copied the example in the documentation - and I get the float error. See below the full error message:

Traceback (most recent call last):
  File "C:/Users/nemes/Google Drive/PhD/Python scripts/GettingNMRdata/BrukerExample.py", line 5, in <module>
    dic, data = ng.bruker.read('expnmr_00001_1')
  File "C:\Users\nemes\AppData\Local\Programs\Python\Python35-32\lib\site-packages\nmrglue\fileio\bruker.py", line 327, in read
    null, data = read_binary(f, shape=shape, cplex=cplex, big=big)
  File "C:\Users\nemes\AppData\Local\Programs\Python\Python35-32\lib\site-packages\nmrglue\fileio\bruker.py", line 996, in read_binary
    return dic, data.reshape(shape)
TypeError: 'float' object cannot be interpreted as an integer


I used both the expnmr_00001_1 folder that was given in the example as well as my own data and I always get the same error. Googling the error suggests something about file vs folder issue?!

The Tecmag issue was solved, thank you! The file was indeed a .tnt one, but when I was using .tnt  extension in the file name, I also added it in the file name on my computer and it didn't work (as I tried both with or without extension before). So basically the only way it works is if the file doesn't have any extension in the name itself, but the extension is written in the python script. Now I just need to figure it out how to plot it :)

Thanks again!
Alex

Jonathan Helmus

не прочитано,
16 июн. 2017 г., 14:43:5016.06.2017
– nmrglue...@googlegroups.com
The TypeError is a result of an bug in nmrglue that was fixed last year [1].  Updating to version 0.6 should address the issue.  Alternatively downgrading to NumPy 1.11 or before will also address the issue.

Cheers,

    - Jonathan Helmus

[1] https://github.com/jjhelmus/nmrglue/commit/0dc6faaddd21f8b5b44ae3bc3c1bf90c856c1669

Alexandra Grigore

не прочитано,
18 июн. 2017 г., 17:31:3518.06.2017
– nmrglue-discuss
Perfect, 0.6 solved the problem!

Thanks a lot!
Ответить всем
Отправить сообщение автору
Переслать
0 новых сообщений