This seems to be about 3 times faster than numpy.apply_along_axis
arr (numpy.array) criterion (function that returns boolean), e.g. lambda v: v > 2 nresult (str) - number of results (1 means return the first result) result_func (function that accepts (int,value))- by default returns the
index i and the value x i.e. lambda i,x: (i,x)
Find the first index where func(arr) is true along axis func has to return a numpy boolean array
Find the index(indices) of the first nresult value(s) that fulfils func
Find the x along an axis where arr == value using scipy.interpolation.interp1d
Find the x along an axis where arr == value using linear interpolation arr is assumed to be monotonic along the selected axis
Find the x along an axis where arr == value using linear interpolation arr is assumed to be monotonic along the selected axis
Find the x along an axis where arr == value using scipy.interpolation.interp1d
Just to make sure it replicates the builtin numpy function
Find the first nresult values that fulfils func
Add modulo (default 360.) in-place to the points beyond which discontinuity occurs
Arguments: axis – numpy 1d array
Given a numpy array, return a slice that extracts the entries where lower<=array<=upper.
The function also takes an optional argument “modulo” For example, x = numpy.arange(12) getSlice(x,4,9,modulo=6) returns slice(5,
A generator that run the func iteratively in chunk Iterate through the idim_iter-th dimension along arr arr = numpy.array niter = number of iteration (or minus 1) iarg_iter = the index of which element in args is to be iterated over istep would over-run niter For example, x = numpy.arange(34).reshape(17,2) gen = getSlice_chunk(x,niter=3,idim_iter=0) gen.next() —> slice(0,5) gen.next() —> slice(5,10) gen.next() —> slice(10,15) gen.next() —> slice(15,17)