jjhelmus / nmrglue

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

exception when reading Varian Agilent data #135

Closed andrealorenzon closed 3 years ago

andrealorenzon commented 3 years ago

When using nmrglue.fileio.varian.read() on the folder of Varian Agilent data, I get the following error.

ValueError   Traceback (most recent call last)
<ipython-input-88-89a930f3e363> in <module>
----> 1 dic, data = ng.fileio.varian.read('testSpectra')
[...]
ValueError: could not broadcast input array from shape (3192) into shape (4096)

Can anyone point me to the right direction to debug this?

kaustubhmote commented 3 years ago

Hi @andrealorenzon, Can you share the complete error trace so we can see which line in the given function is giving the error?

andrealorenzon commented 3 years ago

hi @kaustubhmote .

This is the complete stacktrace:

immagine

testSpectra is a local folder where I have the 4 files: fid, log, procpar and text. I'm using numpy==1.19.2 , scipy==1.5.2, on a Python 3.8.3 Jupyter Notebook.

kaustubhmote commented 3 years ago

It seems that the data parameters being read in from procpar are somehow inconsistent with the actual data in fid. In particular, the parameters np from procpar seems to be off. There are a couple of things you can try:

  1. Try reading in the procpar using dic = ng.varian.read_procpar("testSpectra/procpar") and see whether all the size parameters are consistent with what you actually expect.
  2. Try passing the as_2d=True argument to ng.varian.read("testSpectra") (if this is a 2d)

If none of these work, I think I might need to see the actual data to debug the problem. Will it be possible for you to share fid and procpar?

andrealorenzon commented 3 years ago

sorry for the late reply: sorry, but I'm not allowed to post the data. Thank you for your assistance, anyway.