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

Units #19

Merged
merged 22 commits into from
Mar 11, 2020
Merged

Units #19

merged 22 commits into from
Mar 11, 2020

Conversation

dmentipl
Copy link
Owner

Description

This implements physical units. It is compatible with Snap, Profile, Visualization. Note that for visualization we do the interpolation in code units.

We use Pint as the underlying Python units library.

Can do things like:

>>> snap.physical_units()
>>> snap['x']
array([-3.69505001e+14, -1.63052677e+15, -7.66283930e+14, ...,
        1.39571712e+15,  9.53716176e+14,  1.21421196e+14]) <Unit('centimeter')>

Fixes #13

In addition:

  • Sinks class is removed and sink particle arrays are stored in the Snap object directly
  • simplified getting arrays on SubSnap objects

Change type

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How is this tested?

No new tests were written. It passes the current tests.

Test Configuration:

  • OS: macOS 10.15
  • Python: 3.7
  • SPH code: Phantom (using data from the example set in documentation)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@dmentipl dmentipl merged commit 22ce377 into master Mar 11, 2020
@dmentipl dmentipl deleted the units branch June 9, 2021 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Snap method to set units to physical quantities
1 participant