natekupp / ffx

Fast Function Extraction
http://trent.st/ffx
Other
80 stars 97 forks source link

using np.amin and np.amax instead of the built-in min and max #13

Closed keyvan-m-sadeghi closed 10 years ago

keyvan-m-sadeghi commented 10 years ago

to avoid misbehaviour on some arrays

jmmcd commented 10 years ago

From experience I guess you mean things like this, which happens with a 2d array:

x = np.ones((2, 3))
min(x)
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I would prefer to find out why a 2d array is appearing where a 1d array was expected, rather than patch it without understanding!

I guess this might be related to #12 since again that seems to be about an array of more dimensions than expected.

It might also be related somehow to #3 since that was again about array shapes. Maybe there is a squeeze or reshape similar to that one causing this new error?

So, can you provide a minimal test script, including a few rows of data? Thanks!

keyvan-m-sadeghi commented 10 years ago

Thanks James. Well observed, it was a mistake on my part in passing the inputs.