[SciPy-User] argsort TypeError

Oleksandr Huziy guziy.sasha@gmail....
Thu Aug 9 15:25:10 CDT 2012


Hi,
your problem is interesting, could you pickle the array result, like this
we could play with it?
But I can tell you one thing, I am not comfortable with the way you are
reshaping arrays... Though it may be correct, try using reshape and copy
the result, rather than inplace changing the arrays.

Cheers
--
Oleksandr (Sasha) Huziy

2012/8/9 Chris Weisiger <cweisiger@msg.ucsf.edu>

> I'm trying to find the indices in an array that have the lowest
> values, so that I can plot the corresponding values in another array.
> numpy.argsort would seem to be the proper approach here, but when I
> try it I get this error:
>
> Traceback (most recent call last):
>   File "../scripts/findWorstFitPixel.py", line 48, in <module>
>     indices = np.argsort(result)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy/core/fromnumeric.py",
> line 680, in argsort
>     return argsort(axis, kind, order)
> TypeError: an integer is required
>
> The weird thing is that when I try to replicate the circumstances in
> the REPL (same argument shape/dtype passed to argsort), it succeeds.
> So there must be something subtle going on here. My input is a
> length-270336 1D array of float32s, each of which was generated by
> scipy.stats.pearsonr and almost all of which have values between .95
> and 1. Any ideas what I can investigate to get this working?
> Unfortunately my script relies on reading a bunch of files, so I can't
> very well upload a working sample, but the script itself is here:
> http://pastebin.com/Rxcbyb8p
>
> Thanks for any assistance!
>
> -Chris
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20120809/f72e9c77/attachment.html 


More information about the SciPy-User mailing list