Dear Yunbo,
Thanks for your example. scikit-fmm supports masked arrays so maybe
you want to do something like this:
import skfmm
import numpy as np
import pylab as pl
N = 100
dL = 0.1
function = np.ones((N,N))
function[1,1] = -1.0
mask = np.zeros_like(function, dtype=bool)
mask[80,80]=True
function2 = np.ma.MaskedArray(function, mask)
delta = skfmm.distance(function, dL) - skfmm.distance(function2, dL)
pl.matshow(delta)
pl.colorbar()
pl.show()
I ran both this version and your original code and the calls to
skfmm.distance() seem to take about 0.02 seconds or less. I used the
%time and %timeit magic in ipython to measure the run time. The total
time from starting python on the command line, importing all the
modules, running the code and exiting back to the shell is still less
that 0.1s. Am I misunderstanding something?
It is possible to write numpy expressions which look simple but invoke
costly allocation and copy operations.
Let me know if you still have questions or problems,
Jason
> --
> You received this message because you are subscribed to the Google Groups
> "scikit-fmm" group.
> To post to this group, send email to
sciki...@googlegroups.com.
> To unsubscribe from this group, send email to
>
scikit-fmm+...@googlegroups.com.
> For more options, visit this group at
>
http://groups.google.com/group/scikit-fmm?hl=en.