Newbie - peakpicking varian nmr -broken? tried github update. varian to pipe flips spectra?

36 views
Skip to first unread message

Harry Robson

unread,
Jun 20, 2023, 10:24:22 AM6/20/23
to nmrglue-discuss
Hi all,

I am a complete newbie to nmrglue (and not an expert on nmr instruments, or python), but figured I would give it a go in the spirit of increasing reproducibility etc.

I am having an issue. Basically I could not get the peakpicking to work as  it was giving an error. But I did notice there was a recently corrected piece of the code which seems along these lines (https://github.com/jjhelmus/nmrglue/pull/196). I have tried updating my version with 

and
(I think these are both correct, and repetition is redundant, but I am new to GitHub too)

I now get a new error "slice indices must be integers or None or have an __index__ method". This is from using the following code:

#import modules
import numpy
import scipy
import matplotlib
import IPython
import nmrglue as ng
import numpy as np
import matplotlib.pyplot as plt

#read in, fourier transform, phase, set threshold and peakpick
dic,data = ng.varian.read("foldername_of_FID")
datamod = ng.proc_base.fft(data) 
datamod = ng.proc_autophase.autops(datamod, 'acme')
threshold = 1e6
peaks = ng.peakpick.pick(datamod, pthres=threshold)

So is this just a newbie being dumb? Possibly I didn't update it correctly? 

Kind regards,

Harry.


Kaustubh Mote

unread,
Jun 20, 2023, 11:19:17 PM6/20/23
to nmrglue-discuss
Hi Harry
Your code is correct, and I can reproduce this error now.

The most likely cause is that `ndimage.find_objects` in scipy now returns slices instead of lists, and we are trying to convert them back to slices, which is no longer correct. The fix is rather simple and I have tested that this does indeed solve the issue. If you open a github issue at this link, I can quickly fix this.

Thanks for pointing this out. I think there may be several other places where such changes may be required due to the changes in numpy/scipy.

Kaustubh.

Kaustubh Mote

unread,
Jun 20, 2023, 11:42:35 PM6/20/23
to nmrglue-discuss
Hi Harry,
Seems like I introduced this bug with a previous commit (#196). So I fixed it already. You should try to reinstall from github and see that the function works now.

Harry Robson

unread,
Jun 23, 2023, 9:59:40 AM6/23/23
to nmrglue-discuss
Thanks so much! And thanks for the advice on opening github issues. I'll take note for future

Harry.

Reply all
Reply to author
Forward
0 new messages