Comments (17)
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.
@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.
Here you are, in 4 parts because of github limits.
Data4.zip
Concatenate with cat Data*.zip > data.zip
from nmrglue.
next:
Data3.zip
from nmrglue.
next:
Data2.zip
from nmrglue.
& last:
Data1.zip
from nmrglue.
tested to concatenate - did not work out.
Don't know how to provide you with the original Data.zip of 28 MB
from nmrglue.
@eisenmenger Can you upload the file to dropbox or a similar file sharing site?
from nmrglue.
To send you a download link & password requires an e-mail address of yours.
from nmrglue.
jjhelmus [at] gmail works.
from nmrglue.
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.
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.
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.
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.
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.
Great to hear you found a fix.
from nmrglue.
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)
- Support for Spinsolve Files? HOT 10
- Top and bottom halves of data are inverted HOT 8
- Echo anti-echo aquisition HOT 10
- CSDM conversion? HOT 2
- so this might be off-topic. nmrglue to recreate peaks from point measurements and S/D/T/Q peak hierarchy? HOT 1
- Spectra trace simulation from tabel HOT 1
- Bug in unit_conversion().ppm_scale() HOT 2
- STOCSY for python/Jupyter within nmrglue
- Converting nmrML spectra to Bruker format HOT 10
- nmrglue import fails with scipy=1.8 HOT 4
- Problem number of points in 2D experiments HOT 6
- nmrglue import fails with scipy=1.8
- Installation fails with setuptools v61.2.0 HOT 2
- Import error - scipy version 1.8.0 HOT 1
- integrate_2d: how to get limits.in? HOT 2
- Problem with 1D plotting - maybe HOT 3
- Failed to load Bruker Data HOT 2
- Give up on Python 3.6 HOT 1
- Process_pipe_3d:There seems to be some issues with the processing script HOT 13
- nmrglue fails loading due to scipy.minpack deprecation (1.9.3) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nmrglue.