Hi,
I'm stuggeling with fitting of 1D spectra using the
fit_spectrum function.
Below is the code which gives the error and an overview of
my parameters.
# Read in some data
import nmrglue as ng
import numpy as np
dic, data = ng.bruker.read_pdata('./Data
Files/P31_1D/10/pdata/1')
SF=dic['procs']['SF']
SW_p=dic['procs']['SW_p']
SI=dic['procs']['SI']
OFFSET=dic['procs']['OFFSET']
AX=np.linspace(OFFSET,OFFSET-SW_p/SF,SI)
# Peak pick and deconvolute
peaktab = ng.analysis.peakpick.pick(data,np.max(data)*0.02)
# Prepare the inputs for deconvolution
lsh= list(["g" for x in range(np.size(peaktab['X_AXIS']))])
params=[]
for idx,peak in enumerate(peaktab['X_AXIS']):
params.append((peak,500))
amps=list(data[[int(x) for x in peaktab['X_AXIS']]])
bounds=[(0,1000) for x in range(np.size(peaktab['X_AXIS']))]
ampbounds =[(0,amps) for x in
range(np.size(peaktab['X_AXIS']))]
centers = list(peaktab['X_AXIS'])
rIDs = list(tuple(peaktab['cID']))
box_width = tuple([(2000) for x in
range(np.size(peaktab['X_AXIS']))])
a1, a2, a3, a4, a5 =
ng.analysis.linesh.fit_spectrum(data,lsh,params,amps,bounds,ampbounds,centers,rIDs,box_width,0)
This code gives the following error
C:\Anaconda\lib\site-packages\nmrglue\analysis\linesh.py in fit_spectrum(spectrum, lineshapes, params, amps, bounds, ampbounds, centers, rIDs, box_width, error_flag, ve
rb, **kw)
243
244 for i in range(len(shape)):
--> 245 bmin[:, i][np.where(bmin[:, i] < 0)] = 0
246 for i, v in enumerate(shape):
247 bmax[:, i][np.where(bmax[:, i] > v)] = v
IndexError: too many indices for array
Here is an overview of my variables
Variable Type Data/Info
---------------------------------
AX ndarray 131072L: 131072 elems, type `float64`, 1048576 bytes (1 Mb)
OFFSET float 24.89154
SF float 242.937117583
SI int 131072
SW_p float 12175.3246753
ampbounds list n=11
amps list n=11
bounds list n=11
box_width tuple n=11
centers list n=11
data ndarray 131072L: 131072 elems, type `int32`, 524288 bytes (512 kb)
dic dict n=1
idx int 10
lsh list n=11
ng module <module 'nmrglue' from 'C<...>es\nmrglue\__init__.pyc'>
np module <module 'numpy' from 'C:\<...>ages\numpy\__init__.pyc'>
params list n=11
peak float64 69279.0
peaktab recarray [(58584.0, 1, 34.0, 22646<...>021814548, -816324222.0)]
rIDs list n=11
x int 10
--