Comments (4)
perhaps, although I doubt this is really useful in practice.
the setUnits() directive should be called at the beginning of the script (or never, if the convention G=1 is used throughout), before creating any physically relevant objects such as potentials, DFs, etc. - otherwise the values returned by their methods will be hopelessly screwed. So the only reason for existence of getUnits() could be that the user has forgotten what s/he wrote at the beginning of the script! do you think this is really needed?
from agama.
I see another case: I write some code that uses both Gala and Agama internally, so it needs to know what unit system Agama is working in to properly compare with Gala outputs. That code could internally call setUnits(), but that changes the global state -- what if the user had previously called setUnits() and is not expecting the values to have changed outside of the function I provide? getUnits() would allow my code to just grab the previous unit state.
from agama.
ah ok, so this could be used in a function called from the user script, but the function itself doesn't know how the units were set up.
okay, so the most recent commit has getUnits(), which returns a dictionary with four dimensional units (only three are independent): mass, velocity, length, time. If astropy is installed in the system, they will be provided as astropy.Quantity (maybe makes more sense to give them as astropy.UnitBase? I am not too fluent in this to appreciate the difference..), otherwise just as plain numbers expressing the units in terms of Msun, km/s, kpc and Myr.
Btw, the setUnits() function can now accept astropy quantities as well (instead of plain numbers in the same base units as listed above). But the remaining functions and classes in the library still do not accept or return astropy-compatible arrays of Quantity or whatever is in vogue these days. Agama is optimized for speed and astropy sometimes introduces too much overhead, that's why I actually created a lightweight custom coordinate conversion subsystem in agama.
from agama.
Thanks @eugvas ! Returning the units as Quantity
objects is fine.
from agama.
Related Issues (20)
- Allow setting value of G HOT 4
- Simulation with binary SMBH and two component mass function crashing after some timesteps
- Feature request: enclosed mass in Python interface HOT 4
- artificial density oscillations in the outskirt of Spheroid potential HOT 3
- Generating randomized N-body initial conditions with Agama HOT 1
- Problems of installing agama on mac osx HOT 13
- Number of sampling points of an orbit not equal to the requested value. HOT 2
- Cannot install Agama on my Apple Silicon Monterey HOT 23
- Inner cutoff radius for spherical models HOT 4
- Error when Importing Agama: dlopen symbol not found in flat namespace HOT 4
- Memory leak? HOT 1
- Use of new models HOT 4
- explicitly including G in the calculation of Toomre Q in the example? HOT 1
- Generating rotating star clusters HOT 10
- Sampling refinement procedure error HOT 3
- Discrepancy with Galpy when using agama.GalpyPotential HOT 2
- central density of King profile HOT 2
- Gadget-4 plugin HOT 1
- Example python scripts do not work on newer python versions HOT 4
- document of Einasto profile HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from agama.