Add Snap method to set units to physical quantities
dmentipl opened this issue · comments
Is your feature request related to a problem? Please describe
It would be nice to have a method, say snap.physical_units()
that sets the snap to give arrays and other values in physical units rather than having to multiply by the appropriate combination of snap.properties['utime']
, snap.properties['udist']
, snap.properties['umass']
.
Describe the solution you'd like
Implement a method on the snap like snap.physical_units()
with arguments to set the time, mass, distance units, such that when accessing arrays like snap['position']
they return an array with physical units.
This solution could return a NumPy array in the correct units. Or, perhaps a better option is to return a Pint array which contains the units along with the array.
Describe alternatives you've considered
The alternative is to continue to do this manually with the units provided in snap.properties
.
Additional context
We could use unyt or Astropy units instead.