Hi Nathan,
Happy to hear that it works well for yt! In astropy's Quantity as
well, it greatly simplifies the code, and has made many operations
about two times faster (which is why I pushed so hard to get
__array_ufunc__ done...). But for now we're stuck with supporting
__array_prepare__ and __ar
I’m using it in yt. If we were able to drop support for all old numpy
versions, switching would allow me to delete hundreds of lines of code.
As-is since we need to simultaneously support old and new versions, it adds
some additional complexity. If you’re ok with only supporting numpy >=
1.13, arra
Hi Peter,
When using units, if `a` is not angular (or dimensionless), I don't
see how one could write code in which your example wouldn't fail...
But I may be missing something, since for your example one would just
realize that cos(ka)+i sin(ka) = exp(ika), in which case the log is
just ika and o
One way would be
```
px, py, pz, w, x, y, z = [arr[mask] for arr in px, py, pz, w, x, y, z]
```
-- Marten
___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion
Just to second Stephan's comment: do try it! I've moved astropy's
Quantity over to it, and am certainly counting on the basic interface
staying put... -- Marten
___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman
Hi Will,
We spent a *long time* sorting out the messy details of __array_ufunc__
[1], especially for handling interactions between different types, e.g.,
between numpy arrays, non-numpy array-like objects, builtin Python objects,
objects that override arithmetic to act in non-numpy-like ways, and
Right before 1.12, I arranged an API around an np.ndarray subclass, making
use of __array_ufunc__ to customize behavior based on structured dtype (we
come from c++ and really like operator overloading). Having seen
__array_ufunc__ featured in Travis Oliphant's Guide to NumPy: 2nd Edition,
I assumed
> Date: Thu, 26 Oct 2017 17:27:33 -0400
> From: Marten van Kerkwijk
>
> That sounds somewhat puzzling as units cannot really propagate without
> them somehow telling how they would change! (e.g., the outcome of
> sin(a) is possible only for angular units and then depends on that
> unit). But in any
In what way does it not work? Does it error out at the `arr = arr[mask]`
step? Or is it that something unexpected happens?
I am guessing that you are trying to mutate the px, py, pz, w, x, y, z
arrays? If so, that for-loop won't do it. In python, a plain simple
assignment merely makes the variable
Hmm, so how come this doesn't work now?
mask = ((px > 2.) & ((py**2 + pz**2) / px**2 < 1.))
for arr in (px, py, pz, w, x, y, z):
arr = arr[mask]
On Mon, 23 Oct 2017 15:05:26 +0200 (CEST), "Andrei Berceanu"
wrote:
> Thank you so much, the solution was much simpler than I expected!
>
> On
10 matches
Mail list logo