numexpr

Francesc Alted francesc at continuum.io
Mon May 20 11:46:54 EDT 2013


On 5/20/13 1:58 PM, St�fan van der Walt wrote:
> On Mon, May 20, 2013 at 1:47 PM, Johannes Sch�nberger
> <jschoenberger at demuc.de> wrote:
>> Yes, exposure, edge detection, namely all functions that rely on basic array multiplication / ufuncs.
> I'm hesitant.  The added dependency and code modification adds
> complexity, and I don't know how much improvement we will get.  Could
> you do a benchmark of a typical function?

Yes, benchmarking is always a must before taking decisions like this.  
At any rate, you don't need to make a hard dependency of numexpr.  This 
is what I typically do:

try:
     import numexpr
     numexpr_ispresent = True
except ImportError:
     numexpr_ispresent = False

and then, in your code:

if numexpr_ispresent:
     # you numexpr code here
else:
     # your other code path here

That means two code paths, which is a bit more complex, but still 
acceptable in many cases.

-- 
Francesc Alted




More information about the scikit-image mailing list