{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "4480acaa", "metadata": { "execution": { "iopub.execute_input": "2023-08-05T14:52:27.709829Z", "iopub.status.busy": "2023-08-05T14:52:27.709534Z", "iopub.status.idle": "2023-08-05T14:52:28.139409Z", "shell.execute_reply": "2023-08-05T14:52:28.138661Z" }, "nbsphinx": "hidden" }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 2, "id": "dfcb3255", "metadata": { "execution": { "iopub.execute_input": "2023-08-05T14:52:28.143625Z", "iopub.status.busy": "2023-08-05T14:52:28.143086Z", "iopub.status.idle": "2023-08-05T14:52:28.156730Z", "shell.execute_reply": "2023-08-05T14:52:28.156177Z" }, "nbsphinx": "hidden" }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/runner/work/gala/gala/docs/tutorials/nb_setup:2: DeprecationWarning: `magic(...)` is deprecated since IPython 0.13 (warning added in 8.1), use run_line_magic(magic_name, parameter_s).\n", " get_ipython().magic('config InlineBackend.figure_format = \"retina\"') # noqa\n" ] } ], "source": [ "%run nb_setup" ] }, { "cell_type": "markdown", "id": "09315599", "metadata": {}, "source": [ "# Defining a Milky Way potential model" ] }, { "cell_type": "code", "execution_count": 3, "id": "1225eef1", "metadata": { "execution": { "iopub.execute_input": "2023-08-05T14:52:28.159713Z", "iopub.status.busy": "2023-08-05T14:52:28.159119Z", "iopub.status.idle": "2023-08-05T14:52:28.769772Z", "shell.execute_reply": "2023-08-05T14:52:28.768988Z" } }, "outputs": [], "source": [ "# Third-party dependencies\n", "from astropy.io import ascii\n", "import astropy.units as u\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from scipy.optimize import leastsq\n", "\n", "# Gala\n", "import gala.potential as gp\n", "from gala.units import galactic" ] }, { "cell_type": "markdown", "id": "2cb515f4", "metadata": {}, "source": [ "## Introduction\n", "\n", "`gala` provides a simple and easy way to access and integrate orbits in an\n", "approximate mass model for the Milky Way. The parameters of the mass model are\n", "determined by least-squares fitting the enclosed mass profile of a pre-defined\n", "potential form to recent measurements compiled from the literature. These\n", "measurements are provided with the documentation of `gala` and are shown\n", "below. The radius units are kpc, and mass units are solar masses:" ] }, { "cell_type": "code", "execution_count": 4, "id": "7d6004df", "metadata": { "execution": { "iopub.execute_input": "2023-08-05T14:52:28.773764Z", "iopub.status.busy": "2023-08-05T14:52:28.773265Z", "iopub.status.idle": "2023-08-05T14:52:28.784417Z", "shell.execute_reply": "2023-08-05T14:52:28.783733Z" } }, "outputs": [], "source": [ "tbl = ascii.read('data/MW_mass_enclosed.csv')" ] }, { "cell_type": "code", "execution_count": 5, "id": "7fc84494", "metadata": { "execution": { "iopub.execute_input": "2023-08-05T14:52:28.787285Z", "iopub.status.busy": "2023-08-05T14:52:28.786840Z", "iopub.status.idle": "2023-08-05T14:52:28.793223Z", "shell.execute_reply": "2023-08-05T14:52:28.792677Z" } }, "outputs": [ { "data": { "text/html": [ "
| r | Menc | Menc_err_neg | Menc_err_pos | ref |
|---|---|---|---|---|
| float64 | float64 | float64 | float64 | str27 |
| 0.01 | 30000000.0 | 10000000.0 | 10000000.0 | Feldmeier et al. (2014) |
| 0.12 | 800000000.0 | 200000000.0 | 200000000.0 | Launhardt et al. (2002) |
| 8.1 | 89502860861.52429 | 4994562473.797714 | 4858963492.608627 | Bovy et al. (2012) |
| 8.3 | 110417867208.19055 | 4475949382.696884 | 4387023236.020782 | McMillan (2011) |
| 8.4 | 102421035406.90356 | 16733918715.629944 | 15468328224.531876 | Koposov et al. (2010) |
| 19.0 | 208023299175.30438 | 44317988008.38101 | 34833267089.920685 | Kuepper et al. (2015) |
| 50.0 | 539884832748.48975 | 19995734543.31433 | 268490735257.4718 | Wilkinson & Evans (1999) |
| 50.0 | 529886965173.18726 | 9997867269.659302 | 38536752776.21277 | Sakamoto et al. (2003) |
| 50.0 | 399914690706.92847 | 109976539940.53711 | 72696676468.2511 | Smith et al. (2007) |
| 50.0 | 419910425325.7268 | 39991469076.968506 | 38172735113.64386 | Deason et al. (2012) |
| 60.0 | 399914690957.5188 | 69985070910.63354 | 64344945146.92987 | Xue et al. (2008) |
| 80.0 | 689852841359.0248 | 299936018002.3314 | 110361048549.1029 | Gnedin et al. (2010) |
| 100.0 | 1399701417307.7747 | 899808054059.3811 | 831336271726.1903 | Watkins et al. (2010) |
| 120.0 | 539884832260.29584 | 199957345314.72906 | 123854764645.32489 | Battaglia et al. (2005) |
| 150.0 | 750000000000.0 | 250000000000.0 | 250000000000.0 | Deason et al. (2012) |
| 200.0 | 679854974257.2006 | 409912558030.05396 | 313652012195.06256 | Bhattacherjee et al. (2014) |