2008/5/9 Eric Firing <[EMAIL PROTECTED]>: > It seems like some strategic re-thinking may be needed in the long run, > if not immediately. There is a wide range of combinations of arguments > that will trigger invalid results, whether Inf or NaN. The only way to > trap and mask all of these is to use masked_invalid after the > calculation, and this only works if the user has not disabled nan > output. I have not checked recently, but based on earlier strategy > discussions, I suspect that numpy.ma is already strongly depending on > the availability of nan and inf output to prevent exceptions being > raised upon invalid calculations. Maybe this should simply be > considered a requirement for the use of ma.
I think in principle the right answer is to simply run whatever underlying function, and mask any NaNs or Infs in the output. This may be a problem when it comes to seterr - is the behaviour of seterr() even defined in a multithreaded context? Can it be made thread-local? Surely hardware must support thread-local floating-point error flags. If seterr() works this way, then surely the right answer in ma is to use a try/finally block to turn off exceptions and warnings, and clean up NaNs after the fact. Anne _______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
