Skip to content

GalacticDynamics/galactic_dynamics_interoperability

Repository files navigation

galactic_dynamics_interoperability

Interoperability Between Galactic Dynamics Libraries

Warning

This package is under active development and is not ready for public use.

galactic_dynamics_interoperability provides tools for converting objects between galactic dynamics Python libraries.

Installation

PyPI platforms PyPI version

pip install galactic_dynamics_interoperability

Documentation

Documentation Status

The main docs are in development.

Quick Start

galactic_dynamics_interoperability provides type objects for representing different galactic dynamics libraries. These types are used for dispatching to converters:

  • AbstractInteroperableLibrary : the base class
  • AgamaLibrary : represents agama
  • GalaLibrary : represents gala
  • GalaxLibrary : represents galax
  • GalpyLibrary : represents galpy

To convert potential objects between libraries use convert_potential. As an example, here is converting from a gala Potential to a galax Potential.

>>> from galactic_dynamics_interoperability import convert_potential, GalaxLibrary
>>> import gala.potential
>>> from gala.units import galactic
>>> import galax.potential

>>> potential = gala.potential.KeplerPotential(m=1e11, units=galactic)
>>> convert_potential(GalaxLibrary, potential)
KeplerPotential(
    units=LTMAUnitSystem( length=Unit("kpc"), ...),
    constants=ImmutableMap({'G': ...}),
    m_tot=ConstantParameter( value=Quantity[...](value=f64[], unit=Unit("solMass")) )
)

Q & A

  • Why have the argument order convert_potential(to, from), not convert_potential(from, to)?

    This is because of how Julia structures its conversions (convert), from which this library draws inspiration. We aim to increase interoperability between galactic dynamics libraries and with the ongoing development of Python-Julia bridges, Julia-wrapped-into-Python galactic dynamics libraries are well within our remit.

Citation

DOI

If you found this library to be useful and want to support the development and maintenance of lower-level code libraries for the scientific community, please consider citing this work.

Development

codecov Actions Status GitHub Discussion

We welcome contributions!

About

Interoperability Between Galactic Dynamics Libraries

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages