Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@adrn
Copy link
Owner

@adrn adrn commented Sep 26, 2024

Describe your changes

This is a simple implementation, but I found it sitting in a notebook so I decided to just clean it up and add it here. Does this look like it would satisfy your use cases with pyexp @jngaravitoc?

I need to add tests and some documentation...

Checklist

  • Did you add tests?
  • Did you add documentation for your changes?
  • Did you reference any relevant issues?
  • Did you add a changelog entry? (see CHANGES.rst)
  • Are the CI tests passing?
  • Is the milestone set?

@adrn adrn added this to the v1.10 milestone Sep 26, 2024
@adrn
Copy link
Owner Author

adrn commented Sep 26, 2024

@jngaravitoc I'm not sure what EXP gives you or assumes for units, but let's say you have to set a mass scale, time scale, and G=1. If you have output from an EXP sim as positions exp_xyz and exp_vxyz, you could do this:

import astropy.units as u
usys = SimulationUnitSystem(mass=1e6 * u.Msun, time=100*u.Myr)
(exp_xyz * usys["length"]).to(u.kpc)
(exp_vxyz * usys["velocity"]).to(u.km/u.s)

@jngaravitoc
Copy link

Thanks @adrn! I think for EXP when analyzing external simulations what we will do is: usys = SimulationUnitSystem(mass=1 * u.Msun, length=1*u.kpc, G=1)

@The9Cat
Copy link

The9Cat commented Sep 27, 2024

exp assumes nothing about units, other than G=1. In other words, the user provides positions and velocities and that determines the time units. This seemed like a clean choice at the time (EXP actually predates stuff like Gadget).

Anyway, Adrian's solution is tré cool!

@adrn adrn merged commit a109cbe into main Sep 30, 2024
23 checks passed
@adrn adrn deleted the simulation-units branch September 30, 2024 14:44
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.

4 participants