-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
Description
Just ran across this puzzling behavior with np.ma.std and np.ma.var with Quantity inputs:
>>> import numpy as np
>>> import astropy.units as u
>>> a = np.arange(5.) << u.km
>>> np.std(a)
1.4142136 km
>>> np.ma.std(a) # returns wrong unit!
1.4142136 km(1/2)
>>> np.var(a)
2.0 km2
>>> np.ma.var(a) # returns wrong unit!
2.0 kmnp.ma.mean works fine:
>>> np.mean(a)
2 km
>>> np.ma.mean(a)
2 kmIs this an upstream bug in numpy?
@mhvk