nbia-astro / skeletor

Parallel PIC code written in Python and based on the skeleton codes provided by PICKSC
GNU General Public License v3.0
1 stars 0 forks source link

Added `__array_finalize__()` method to ShearField #116

Closed tobson closed 7 years ago

tobson commented 7 years ago

The reason why this is needed is the following. Suppose J is a 3-vector ShearField. As such it has the "azimuthal" wavenumber kx as attribute, which is defined in ShearField.__new__(). Now, The way indexing of structured arrays in Numpy works, J['x'] is a scalar ShearField. It has a different dtype than J but it is nevertheless a ShearField. One would therefore expect J['x'] to also have the attribute kx. ShearField.__array_finalize__ makes sure that it indeed does.