Le mardi 29 septembre 2009 à 02:32 +0530, yogesh karpate a écrit : > Dear All, > I'm facing a bog problem in following . the code > snippet is as follows > #################### % Compute the area > indicator################################### > for kT in range(leftbound,rightbound): > # Here the left bound and rightbound both are indexing array is > cutlevel = sum(s[(kT-ptwin):(kT+ptwin)],0)/(ptwin*2+1) > corsig = s[(kT-swin+1):kT]-cutlevel > areavalue1 =sum((corsig),0) > #print areavalue.size > print leftbound, rightbound > Tval=areavalue1[leftbound:rightbound] > Everything works fine till areavalue1, then whenever I try to access > the Tval=areavalue1[leftbound:rightbound] > it says IndexError: invalid index to scalar variable.. > When i try to access areavalue1[0] it gives me entire array but for > areavalue1[2:8]..it gives the same error . > Thanx in advance.. > Regards
Could you please check the shape of areavalue : >>> print type(areavalue) >>> print areavalue.shape Make sure areavalue is not a list or a tuple with the array you are interested in as the first element. If it is such a case, first extract the array or replace areavalue by areavalue[0] in your snipplet. -- Fabrice Silva <si...@lma.cnrs-mrs.fr> LMA UPR CNRS 7051 PS : you need not to personally email your request. I saw your message on the mailing list, but I had no time to answer... _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion