[Numpy-discussion] Are masked arrays slower for processing than ndarrays?

Robert Kern robert.kern@gmail....
Wed May 13 18:53:37 CDT 2009


On Wed, May 13, 2009 at 18:36, Matt Knox <mattknox.ca@gmail.com> wrote:
> Hi Pierre,
>
>> Here's the catch: it's basically cheating. I got rid of the pre-
>> processing (where a mask was calculated depending on the domain and
>> the input set to a filling value depending on this mask, before the
>> actual computation). Instead, I  force
>> np.seterr(divide='ignore',invalid='ignore') before calling the ufunc
>
> This isn't a thread safe approach and could cause wierd side effects in a
> multi-threaded application. I think modifying global options/variables inside
> any function where it generally wouldn't be expected by the user is a bad idea.

seterr() uses thread-local storage.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the Numpy-discussion mailing list