kecnry / nparray

High-Level Wrappers for Building and Manipulating Numpy Arrays
https://nparray.readthedocs.io
GNU General Public License v3.0
0 stars 0 forks source link

support astropy units? #12

Closed kecnry closed 6 years ago

kecnry commented 7 years ago
import nparray
import numpy as np
import astropy.units as u

np.linspace(0,1,11) * u.m
# <Quantity [ 0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. ] m>
nparray.linspace(0,1,11) * u.m

Would probably need to create a Quantity class that fakes the behavior of an astropy.Quantity such that quantity.value returns the nparray object and then create this Quantity object on multiplication with a unit.

Addressing #6 may handle this automatically if the __mul__ methods in astropy.units just check the type.