Coder Social home page Coder Social logo

Comments (17)

eisenmenger avatar eisenmenger commented on June 8, 2024

Also, with the script from
https://github.com/jjhelmus/nmrglue/wiki/Find-and-fit-peaks-in-a-spectrum

Traceback (most recent call last):
File "fitPeaks.py", line 25, in
peaks = ng.peakpick.pick(data, 25000)
File "/usr/lib/python2.7/site-packages/nmrglue/analysis/peakpick.py", line 222, in pick
c_ndil)
File "/usr/lib/python2.7/site-packages/nmrglue/analysis/peakpick.py", line 291, in clusters
return [labeled_array[i] for i in locations]
IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

from nmrglue.

jjhelmus avatar jjhelmus commented on June 8, 2024

@eisenmenger Can you provide the data file that you are looking at which is causing this error? I tried to replicate the issue with the data from the wiki example and was unable to cause the error.

from nmrglue.

eisenmenger avatar eisenmenger commented on June 8, 2024

Here you are, in 4 parts because of github limits.
Data4.zip

Concatenate with cat Data*.zip > data.zip

from nmrglue.

eisenmenger avatar eisenmenger commented on June 8, 2024

next:
Data3.zip

from nmrglue.

eisenmenger avatar eisenmenger commented on June 8, 2024

next:
Data2.zip

from nmrglue.

eisenmenger avatar eisenmenger commented on June 8, 2024

& last:
Data1.zip

from nmrglue.

eisenmenger avatar eisenmenger commented on June 8, 2024

tested to concatenate - did not work out.
Don't know how to provide you with the original Data.zip of 28 MB

from nmrglue.

jjhelmus avatar jjhelmus commented on June 8, 2024

@eisenmenger Can you upload the file to dropbox or a similar file sharing site?

from nmrglue.

eisenmenger avatar eisenmenger commented on June 8, 2024

To send you a download link & password requires an e-mail address of yours.

from nmrglue.

jjhelmus avatar jjhelmus commented on June 8, 2024

jjhelmus [at] gmail works.

from nmrglue.

jjhelmus avatar jjhelmus commented on June 8, 2024

I got the data file and ran the following script without any error:

import nmrglue as ng
dic, data = ng.bruker.read_pdata('../Data/3/pdata/1')
print data.shape
print data
thres = data.std() * 2
peakList = ng.analysis.peakpick.pick( data, pthres = thres )

Can you verify that you have the latest version of nmrglue and provide details about what NumPy and Python version you are using?

from nmrglue.

eisenmenger avatar eisenmenger commented on June 8, 2024

Thank you for your help !

OS: Linux Fedora 23 (64bit)
$ python
Python 2.7.11 (default, Sep 29 2016, 13:33:00)
[GCC 5.3.1 20160406 (Red Hat 5.3.1-6)] on linux2

import numpy
print( numpy.version )
1.13.0
import nmrglue
print( nmrglue.version )
0.7-dev
import nmrglue as ng
dic, data = ng.bruker.read_pdata('../Data/3/pdata/1')
print data.shape
(1024, 2048)
print data
[[ 14099.25 15660.5 15820.25 ..., 441.5 13453.5 17852.25]
[ 22354.75 24070.25 16389. ..., 2944. -547.75 7666. ]
[ 17501.5 21159. 3769.25 ..., 866.5 -10845.5 -4526. ]
...,
[ 1695.5 -15082.25 -16300.75 ..., 1921. 17331. 22866.25]
[ -6796.25 -16138.25 -11376.75 ..., 4678.75 24169.25 22745.75]
[ -512.5 -2591.5 1098.5 ..., 2588.5 24818.75 23191. ]]
thres = data.std() * 2
peakList = ng.analysis.peakpick.pick( data, pthres = thres )
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/site-packages/nmrglue/analysis/peakpick.py", line 215, in pick
ls_classes)
File "/usr/lib/python2.7/site-packages/nmrglue/analysis/peakpick.py", line 383, in guess_params_slice
r = extract_1d(region, rlocation, axis)
File "/usr/lib/python2.7/site-packages/nmrglue/analysis/peakpick.py", line 398, in extract_1d
return np.atleast_1d(np.squeeze(data[s]))
TypeError: slice indices must be integers or None or have an index method

from nmrglue.

eisenmenger avatar eisenmenger commented on June 8, 2024

Same error on a CentOS 7 (64bit) with Python 2.7.5 & numpy 1.12 & nmrglue (0.7_dev, i.e. from git-sources)

from nmrglue.

jjhelmus avatar jjhelmus commented on June 8, 2024

I've tried to replicate this on my own system with the same version of python and numpy without any luck. The peak picking does not raise an error.

I'm at a bit of a loss on what else to try. Perhaps the scipy version is causing issue, what version of SciPy is installed.

Also, what is the output from:

import nmrglue as ng
dic, data = ng.bruker.read_pdata('../Data/3/pdata/1')
thres = data.std() * 2
ploc, pseg = ng.analysis.peakpick.find_all_connected(data, thres, True, False)
print(thres)
print(ploc)
print(pseg)

find_all_connected is being run inside the peak picker to generate the region limits. If it gives odd results that could explain the error.

from nmrglue.

eisenmenger avatar eisenmenger commented on June 8, 2024

Thank you very much for your patience and support. You're right, with pointing at scipy version !

import nmrglue as ng
dic, data = ng.bruker.read_pdata('../Data/3/pdata/1')
thres = data.std() * 2
ploc, pseg = ng.analysis.peakpick.find_all_connected(data, thres, True, False)

works WITHOUT problems on MAC OSX (python 2.7.12 from Xcode, numpy & scipy 0.17 added by Homebrew), as well as on Fedora 24 (python 2.7.13, numpy 1.11, scipy 0.16.1).

Finally, the problem has been solved by updating 'scipy' (originally vers. 14.1 on Fedora 23) via "pip install --upgrade scipy" (as root) !!

from nmrglue.

jjhelmus avatar jjhelmus commented on June 8, 2024

Great to hear you found a fix.

from nmrglue.

janEbert avatar janEbert commented on June 8, 2024

I stumbled upon the same error. For me, downgrading SciPy from 1.8.1 to 1.7.0 also fixed the problem.

from nmrglue.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.