Galactic and gravitational dynamics in Python

Overview

logo

Gala is a Python package for Galactic and gravitational dynamics.

Affiliated package Coverage Status Build status

Documentation

Documentation Status

The documentation for Gala is hosted on Read the docs.

Installation and Dependencies

conda PyPI

The easiest way to get Gala is to install with pip or conda.

The recommended install method is to use pip:

pip install gala

If you are on Linux or Mac, you can also install gala with conda using the conda-forge channel:

conda install gala --channel conda-forge

See the installation instructions in the documentation for more information.

Attribution

JOSS DOI

If you make use of this code, please cite the JOSS paper:

@article{gala,
  doi = {10.21105/joss.00388},
  url = {https://doi.org/10.21105%2Fjoss.00388},
  year = 2017,
  month = {oct},
  publisher = {The Open Journal},
  volume = {2},
  number = {18},
  author = {Adrian M. Price-Whelan},
  title = {Gala: A Python package for galactic dynamics},
  journal = {The Journal of Open Source Software}
}

Please also cite the Zenodo DOI DOI as a software citation - see the documentation for up to date citation information.

License

License

Copyright 2013-2021 Adrian Price-Whelan and contributors.

Gala is free software made available under the MIT License. For details see the LICENSE file.

Contributors

See the AUTHORS.rst file for a complete list of contributors to the project.

Comments
  • Incorporating Mass Evolution into Gala

    Incorporating Mass Evolution into Gala

    I was wondering whether there's a way to incorporate mass evolution or mass accretion over time of a halo into the orbital calculations of gala. I know it only takes a single halo mass numerical value and spits out an orbit, but is it possible to instead include a function for mass rather than a numerical value?

    question feature-request 
    opened by juliaespositon 11
  • [WIP] Simplify PhaseSpacePosition and Orbit classes

    [WIP] Simplify PhaseSpacePosition and Orbit classes

    This makes use of the representation differential classes in astropy/astropy#5871 to clean up a lot of the code. A natural byproduct of this is that CartesianPhaseSpacePosition and CartesianOrbit are no longer needed, since there is now a unified interface to any representations and their respective differentials.

    TODO:

    • [x] support <3D positions so nonlinear integrations work
    • [x] remove the velocity_coord_transforms.py and use the Differential classes instead
    • [x] figure out how to handle velocity frame transforms with the Differential classes
    • [x] update documentation and docstrings
    • [x] clean up all documentation that mentions Orbit or PhaseSpacePosition, check repr's (especially the orbits-in-detail.rst file
    • [x] make sure all mention of Cartesian* is gone
    • [x] make sure all code and doc tests run and don't use the old Cartesian* classes

    API-breaking changes:

    • Velocity frame transforms now return Differential classes
    • Velocity coord transforms are gone
    • CartesianPhaseSpacePosition and CartesianOrbit are deprecated
    opened by adrn 11
  • Add better interaction with and export to sympy, and uses sympy to implement more Hessian functions

    Add better interaction with and export to sympy, and uses sympy to implement more Hessian functions

    Describe your changes

    This adds a .to_sympy() classmethod to the potential classes. I've also then used this method with sympy to compute all of the Hessians, and implemented these using C code generated by sympy.

    Checklist

    • [x] Did you add tests?
    • [x] Did you add documentation for your changes?
    • [x] Did you add a changelog entry? (see CHANGES.rst)
    • [x] Are the CI tests passing?
    • [x] Is the milestone set?

    Amazingly, this closes #159, closes #56, closes #5, and closes #85 !!

    opened by adrn 7
  • plot_contours() requiring optional 'time' argument

    plot_contours() requiring optional 'time' argument

    running plot_contours() on an agama GalaPotential object requires a time object that is supposed to be optional, and forcing the variable to be a single value does not resolve the issue.wasn't encountering this issue until I updated agama and gala to their most recent versions. error stack below:

    grid = np.linspace(-15,15,64)
    fig,ax = plt.subplots(1, 1, figsize=(5,5))
    fig = galapot.plot_contours(grid=(grid,grid,0), cmap='Greys', ax=ax,time=1)
    
    /srv/conda/envs/notebook/lib/python3.8/site-packages/gala/potential/potential/core.py in plot_contours(self, grid, filled, ax, labels, subplots_kw, **kwargs)
        530                 r[ii] = slc
        531 
    --> 532             Z = self.energy(r*self.units['length']).value
        533 
        534             # make default colormap not suck
    
    /srv/conda/envs/notebook/lib/python3.8/site-packages/gala/potential/potential/core.py in energy(self, q, t)
        228         ret_unit = self.units['energy'] / self.units['mass']
        229 
    --> 230         return self._energy(q, t=t).T.reshape(orig_shape[1:]) * ret_unit
        231 
        232     def gradient(self, q, t=0.):
    
    /srv/conda/envs/notebook/lib/python3.8/site-packages/agama/py/pygama.py in <lambda>(q, t)
        898             except TypeError: PotentialBase.__init__(self, dict(), units=units)
        899             _agama.Potential.__init__(self, *args, **kwargs)
    --> 900             self._energy  = lambda q,t=0.: self.potential(q, t=t)
        901             self._density = lambda q,t=0.: _agama.Potential.density(self, q, t=t)
        902             self._gradient= lambda q,t=0.: -self.force(q, t=t)
    
    RuntimeError: Argument 'time', if provided, must be a single number or an array of the same length as points
    
    
    bug 
    opened by liljo0731 6
  • LeapfrogIntegrator will reverse the sign of velocity which may lead to incorrect result

    LeapfrogIntegrator will reverse the sign of velocity which may lead to incorrect result

    Hi, thank you for the great package. I realized the below code in the LeapfrogIntegrator may change the sign of the velocity when _dt is negative, which may change the result of the force function because it could depend on the velocity. In my case I add a dynamical friction term in my force function and LeapfrogIntegrator will give me incorrect results.

    https://github.com/adrn/gala/blob/782a8b1a19c8546d553b7c2122505e6ee82a93db/gala/integrate/pyintegrators/leapfrog.py#L146-L150

    opened by azz147 6
  • Make it so `autolim=True` doesn't set axis limits too small

    Make it so `autolim=True` doesn't set axis limits too small

    Describe your changes

    Added a check of the current axis limits when plotting Orbits with autolim=True to prevent Gala from making the axis limits too small to see everything already plotted.

    Checklist for contributor:

    • [x] Did you add tests?
    • [x] Did you add documentation for your changes?
    • [x] Did you reference any relevant issues?
    • [x] Did you add a changelog entry? (see CHANGES.rst)

    Checklist for maintainers:

    • [x] Are the CI tests passing?
    • [x] Is the milestone set?
    opened by TomWagg 6
  • Installation Issues

    Installation Issues

    Dear Community I´m having some when installing issues. When running the recommended way to install gala, !python -m pip install gala, I get various errors and warnings.

    imagen

    I suspect thsis is the reason why I get errors when running imports such as

    imagen imagen

    Thanks in advance

    opened by jortiz12 6
  • adding STcovar

    adding STcovar

    Describe your changes

    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?
    opened by jngaravitoc 6
  • allow from_frame to be instance

    allow from_frame to be instance

    so that transformation works on skyoffset frames.

    Signed-off-by: Nathaniel Starkman [email protected]

    Describe your changes

    Checklist

    • [x] Did you add tests? There currently are no tests for get_transform_matrix
    • [x] Did you add documentation for your changes? yes
    • [x] Did you reference any relevant issues? yes
    • [ ] Did you add a changelog entry? (see CHANGES.rst)
    • [x] Are the CI tests passing? yes
    • [x] Is the milestone set?
    opened by nstarman 5
  • Segfault and core dump on manipulating hessians

    Segfault and core dump on manipulating hessians

    python 3.7 gala, numpy versions: 1.0, 1.16.4

    I get core dump / seg fault from doing the follwing:

    import astropy.units as u
    from gala.potential import BovyMWPotential2014
    
    BovyMWPotential2014().hessian([[0, 8, 0]]*u.kpc)
    

    Tracebacks: https://gist.github.com/smoh/0e803684b14d87bba4a97e5bb3e33bb0 1.out: beginning of errors from Red Hat 2.out: full traceback from Mac OSX 10.14.4

    In both I did fresh install with conda

    conda create -n gala-test
    conda install -c conda-forge astro-gala
    

    Any ideas?

    bug 
    opened by smoh 5
  • Add

    Add "fast" option to pericenter/apocenter and support multiple orbits

    Right now, .pericenter() and .apocenter() are slow because they do interpolation to figure out a precise value. There should be a fast=True option that skips the interpolation.

    We also need to support these methods for multiple orbits in the same object.

    bug enhancement priority:medium 
    opened by adrn 5
  • Fixed the oph19_to_icrs function

    Fixed the oph19_to_icrs function

    Describe your changes

    Fixed the bug described in this issue where the OrphanKoposov19 coordinate transformation called the wrong function.

    Checklist

    • [ ] Did you add tests?
    • [ ] Did you add documentation for your changes?
    • [x] Did you reference any relevant issues?
    • [x] Did you add a changelog entry? (see CHANGES.rst)
    • [x] Are the CI tests passing?
    • [x] Is the milestone set?
    opened by sophialilleengen 0
  • OrphanKoposov19 stream-to-ICRS transformation uses wrong fct

    OrphanKoposov19 stream-to-ICRS transformation uses wrong fct

    The OprhanKoposov19 oph19_to_icrs() fct returns OrphanNewberg10 matrix instead of Koposov19 matrix. In this line, galactic_to_orp() should be replaced by icrs_to_orp19().

    opened by sophialilleengen 2
  • CylSpline not C-enabled

    CylSpline not C-enabled

    Bug report from @abonaca: Not able to use the CylSpline potential with MockStream functionality because:

    ValueError: Input potential must be C-enabled: one or more components in the input external potential are Python-only.
    
    bug 
    opened by adrn 0
  • Improve speed of CylSplinePotential

    Improve speed of CylSplinePotential

    Right now it is very slow because it must construct a spline object with the input grids each time the energy/gradient/density functions are called. It might be possible to store this object on the Wrapper class and pass a pointer in to C. To do this, we need to add functionality to the potential classes (actually the struct types) to support having an array of pointers that get passed around.

    enhancement feature-request 
    opened by adrn 0
Releases(v1.6.1)
  • v1.6.1(Nov 7, 2022)

    Changelog included below:

    New Features

    • Added a .replicate() method to Potential classes to enable copying potential objects but modifying some parameter values.

    • Added a new potential class MN3ExponentialDiskPotential based on Smith et al. (2015): an approximation of the potential generated by a double exponential disk using a sum of three Miyamoto-Nagai disks.

    • The Orbit.estimate_period() method now returns period estimates in all phase-space components instead of just the radial period.

    • Added a store_all flag to the integrators to control whether to save phase-space information for all timesteps or only the final timestep.

    • Added a plot_rotation_curve() method to all potential objects to make a 1D plot of the circular velocity curve.

    • Added a new potential for representing multipole expansions MultipolePotential.

    • Added a new potential CylSplinePotential for flexible representation of axisymmetric potentials by allowing passing in grids of potential values evaluated grids of R, z values (like the CylSpline potential in Agama).

    • Added a show_time flag to Orbit.animate() to control whether to show the current timestep.

    • Changed Orbit.animate() to allow for different marker_style and segment_style options for individual orbits by passing a list of dicts instead of just a dict.

    • Added an experimental new class SCFInterpolatedPotential that accepts a time series of coefficients and interpolates the coefficient values to any evaluation time.

    Bug fixes

    • Fixed a bug where the NFWPotential energy was nan when evaluating at the origin, and added tests for all potentials to check for a finite value of the potential at the origin (when expected).

    • Fixed a bug in NFWPotential.from_M200_c() where the incorrect scale radius was computed (Cython does not always use Python 3 division rules for dividing integers!).

    • Fixed a bug in the (C-level/internal) estimation of the 2nd derivative of the potential, used to generate mock streams, that affects non-conservative force fields.

    API changes

    • The Orbit.estimate_period() method now returns period estimates in all phase-space components instead of just the radial period.
    Source code(tar.gz)
    Source code(zip)
  • v1.3(Oct 30, 2020)

  • v1.2(Jul 13, 2020)

  • v0.2.2(Oct 7, 2017)

    gala is an Astropy-affiliated Python package for galactic dynamics. Python enables wrapping low-level languages (e.g., C) for speed without losing flexibility or ease-of-use in the user-interface. The API for gala was designed to provide a class-based and user-friendly interface to fast (C or Cython-optimized) implementations of common operations such as gravitational potential and force evaluation, orbit integration, dynamical transformations, and chaos indicators for nonlinear dynamics. gala also relies heavily on and interfaces well with the implementations of physical units and astronomical coordinate systems in the Astropy package (astropy.units and astropy.coordinates).

    Source code(tar.gz)
    Source code(zip)
  • v0.2.1(Jul 21, 2017)

    Gala is a Python package for Galactic astronomy and gravitational dynamics. The bulk of the package centers around implementations of gravitational potentials, numerical integration, and nonlinear dynamics.

    Source code(tar.gz)
    Source code(zip)
  • v0.1.3(Feb 23, 2017)

    Gala is a Python package for Galactic astronomy and gravitational dynamics. The bulk of the package centers around implementations of gravitational potentials, numerical integration, and nonlinear dynamics.

    Source code(tar.gz)
    Source code(zip)
Owner
Adrian Price-Whelan
Adrian Price-Whelan
Like a cowsay but without cows!

Foxsay This is a simple program that generates pictures of a cute fox with a message. It is like a cowsay but without cows! Fox girls are better! Usag

Anastasia Kim 28 Feb 20, 2022
On the Analysis of French Phonetic Idiosyncrasies for Accent Recognition

On the Analysis of French Phonetic Idiosyncrasies for Accent Recognition With the spirit of reproducible research, this repository contains codes requ

0 Feb 24, 2022
Pytorch implementation code for [Neural Architecture Search for Spiking Neural Networks]

Neural Architecture Search for Spiking Neural Networks Pytorch implementation code for [Neural Architecture Search for Spiking Neural Networks] (https

Intelligent Computing Lab at Yale University 28 Nov 18, 2022
Rule Based Classification Project For Python

Rule-Based-Classification-Project (ENG) Business Problem: A game company wants to create new level-based customer definitions (personas) by using some

Deniz Can OĞUZ 4 Oct 29, 2022
Semantic Segmentation for Aerial Imagery using Convolutional Neural Network

This repo has been deprecated because whole things are re-implemented by using Chainer and I did refactoring for many codes. So please check this newe

Shunta Saito 27 Sep 23, 2022
Source code for CAST - Crisis Domain Adaptation Using Sequence-to-sequence Transformers (Accepted to ISCRAM 2021, CorePaper).

Source code for CAST: Crisis Domain Adaptation UsingSequence-to-sequenceTransformers (Paper, BibTeX, Accepted to ISCRAM 2021, CorePaper) Quick start D

Congcong Wang 0 Jul 14, 2021
Rethinking Transformer-based Set Prediction for Object Detection

Rethinking Transformer-based Set Prediction for Object Detection Here are the code for the ICCV paper. The code is adapted from Detectron2 and AdelaiD

Zhiqing Sun 62 Dec 03, 2022
[ECCV 2020] XingGAN for Person Image Generation

Contents XingGAN or CrossingGAN Installation Dataset Preparation Generating Images Using Pretrained Model Train and Test New Models Evaluation Acknowl

Hao Tang 218 Oct 29, 2022
FIRM-AFL is the first high-throughput greybox fuzzer for IoT firmware.

FIRM-AFL FIRM-AFL is the first high-throughput greybox fuzzer for IoT firmware. FIRM-AFL addresses two fundamental problems in IoT fuzzing. First, it

356 Dec 23, 2022
a Lightweight library for sequential learning agents, including reinforcement learning

SaLinA: SaLinA - A Flexible and Simple Library for Learning Sequential Agents (including Reinforcement Learning) TL;DR salina is a lightweight library

Facebook Research 405 Dec 17, 2022
Code for our paper: Online Variational Filtering and Parameter Learning

Variational Filtering To run phi learning on linear gaussian (Fig1a) python linear_gaussian_phi_learning.py To run phi and theta learning on linear g

16 Aug 14, 2022
Python scripts for performing stereo depth estimation using the MobileStereoNet model in ONNX

ONNX-MobileStereoNet Python scripts for performing stereo depth estimation using the MobileStereoNet model in ONNX Stereo depth estimation on the cone

Ibai Gorordo 23 Nov 29, 2022
DANA paper supplementary materials

DANA Supplements This repository stores the data, results, and R scripts to generate these reuslts and figures for the corresponding paper Depth Norma

0 Dec 17, 2021
tensorrt int8 量化yolov5 4.0 onnx模型

onnx模型转换为 int8 tensorrt引擎

123 Dec 28, 2022
Python Jupyter kernel using Poetry for reproducible notebooks

Poetry Kernel Use per-directory Poetry environments to run Jupyter kernels. No need to install a Jupyter kernel per Python virtual environment! The id

Pathbird 204 Jan 04, 2023
Web mining module for Python, with tools for scraping, natural language processing, machine learning, network analysis and visualization.

Pattern Pattern is a web mining module for Python. It has tools for: Data Mining: web services (Google, Twitter, Wikipedia), web crawler, HTML DOM par

Computational Linguistics Research Group 8.4k Jan 03, 2023
Clockwork Variational Autoencoder

Clockwork Variational Autoencoders (CW-VAE) Vaibhav Saxena, Jimmy Ba, Danijar Hafner If you find this code useful, please reference in your paper: @ar

Vaibhav Saxena 35 Nov 06, 2022
Unofficial Tensorflow-Keras implementation of Fastformer based on paper [Fastformer: Additive Attention Can Be All You Need](https://arxiv.org/abs/2108.09084).

Fastformer-Keras Unofficial Tensorflow-Keras implementation of Fastformer based on paper Fastformer: Additive Attention Can Be All You Need. Tensorflo

Yam Peleg 10 Jan 30, 2022
Implementation of the paper Recurrent Glimpse-based Decoder for Detection with Transformer.

REGO-Deformable DETR By Zhe Chen, Jing Zhang, and Dacheng Tao. This repository is the implementation of the paper Recurrent Glimpse-based Decoder for

Zhe Chen 33 Nov 30, 2022
Builds a LoRa radio frequency fingerprint identification (RFFI) system based on deep learning techiniques

This project builds a LoRa radio frequency fingerprint identification (RFFI) system based on deep learning techiniques.

20 Dec 30, 2022