Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Snap method to set units to physical quantities #13

Closed
dmentipl opened this issue Jan 13, 2020 · 0 comments · Fixed by #19
Closed

Add Snap method to set units to physical quantities #13

dmentipl opened this issue Jan 13, 2020 · 0 comments · Fixed by #19
Labels
enhancement New feature or request

Comments

@dmentipl
Copy link
Owner

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.

@dmentipl dmentipl added the enhancement New feature or request label Jan 13, 2020
@dmentipl dmentipl mentioned this issue Mar 11, 2020
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant