astropy / astropy-tutorials

Tutorials for the Astropy Project
BSD 3-Clause "New" or "Revised" License
291 stars 176 forks source link

Computing Galactic Orbits of Stars with Gala #499

Closed karenlmasters closed 2 years ago

karenlmasters commented 2 years ago

Main problem - importing gala (I'm doing this in Sciserver and did !pip install astro-gala in a cell in the notebook to get it installed - it has astroquery already) results in the following error:

`ValueErrorTraceback (most recent call last)

in 12 13 # gala imports ---> 14 import gala.dynamics as gd 15 import gala.potential as gp 16 from gala.units import galactic ~/miniconda3/envs/py38/lib/python3.8/site-packages/gala/__init__.py in 24 if not _ASTROPY_SETUP_: 25 from . import coordinates ---> 26 from . import dynamics 27 from . import integrate 28 from . import potential ~/miniconda3/envs/py38/lib/python3.8/site-packages/gala/dynamics/__init__.py in ----> 1 from .core import PhaseSpacePosition 2 from .orbit import Orbit, CartesianOrbit 3 from .analyticactionangle import * 4 from .actionangle import * 5 from .nonlinear import * ~/miniconda3/envs/py38/lib/python3.8/site-packages/gala/dynamics/core.py in 16 from .plot import plot_projections 17 from ..io import quantity_to_hdf5, quantity_from_hdf5 ---> 18 from ..units import UnitSystem, DimensionlessUnitSystem, _greek_letters 19 from ..util import atleast_2d 20 ~/miniconda3/envs/py38/lib/python3.8/site-packages/gala/units.py in 207 208 # define galactic unit system --> 209 galactic = UnitSystem(u.kpc, u.Myr, u.Msun, u.radian, 210 u.km/u.s, u.mas/u.yr) 211 ~/miniconda3/envs/py38/lib/python3.8/site-packages/gala/units.py in __init__(self, units, *args) 75 for phys_type in self._required_physical_types: 76 if phys_type not in self._registry: ---> 77 raise ValueError("You must specify a unit with physical type '{0}'".format(phys_type)) 78 self._core_units.append(self._registry[phys_type]) 79 ValueError: You must specify a unit with physical type 'length'` Minor thing: this link to documentation for `gala` also breaks: http://gala.adrian.pw/en/latest/potential/define-milky-way-model.html
adrn commented 2 years ago

Hey @karenlmasters!

Aha! I need to update the installation instructions -- in the last release (which fixes this issue), I renamed the pip package name from astro-gala -> gala. Can you do:

!pip uninstall astro-gala
!pip install gala

and try running again? I'll update the tutorial. Thanks for reporting this!

karenlmasters commented 2 years ago

That didn't work for me in the notebook (because there's a prompt answer), but it looks like I was able to do it command line. Thanks.

adrn commented 2 years ago

Great!