[SciPy-User] idiom for iterators, expr(T) if isscalar(T) else array([expr(t) for t in T])

denis denis-bz-gg@t-online...
Thu Oct 15 10:12:12 CDT 2009


On Oct 15, 9:30 am, Yosef Meller <yosef...@post.tau.ac.il> wrote:
>
> First of all, the candidate for vectorization is f(t) inside spline_2p2s, not
> spline_2p2s itself.

Did anyone try the testcase, and understand why vectorize BREAKS the
function ?
It works as written with funciter()
but vectorize => broadcasting => ValueError.

Vectorize f ?
    return np.vectorize( f ) (t)  # instead of return funciter( f, t )
=> ValueError: setting an array element with a sequence

> Second, since for each t you may get multiple results
> based on the size of pi, mi, you might want to check frompyfunc() instead of
> vectorize().

? p0 p1 m0 m1 are all the same shape, scalars / vecs / arrays to
interpolate
at one or several `t` s.
Anyway frompyfunc broke with ValueError too
but I don't understand pydoc numpy.frompyfunc --
and if (googling) vectorize is a wrapper for frompyfunc, how can that
help ?

cheers
  -- denis



More information about the SciPy-User mailing list