Skip to content

Commit

Permalink
minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
adrn committed Feb 21, 2025
1 parent d362c17 commit 70f53d0
Showing 1 changed file with 14 additions and 31 deletions.
45 changes: 14 additions & 31 deletions tutorials/astropy-coordinates/3-Coordinates-Velocities.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"import numpy as np\n",
"!pip install \"astroquery\"\n",
"\n",
"from astropy import units as u\n",
"from astropy.coordinates import SkyCoord, Distance, Galactic\n",
Expand Down Expand Up @@ -96,22 +95,12 @@
"outputs": [],
"source": [
"SkyCoord(\n",
" ra=10*u.deg, \n",
" ra=10*u.deg,\n",
" dec=20*u.deg,\n",
" pm_ra_cosdec=1*u.mas/u.yr,\n",
" pm_dec=2*u.mas/u.yr)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "v6EeE4KsfSpq"
},
"source": [
"**Thought Questions:**\n",
"What value did we put in for our right ascension? What about our declination? What units are they in?"
]
},
{
"cell_type": "markdown",
"metadata": {
Expand All @@ -132,7 +121,7 @@
"outputs": [],
"source": [
"SkyCoord(\n",
" ra=np.linspace(0, 10, 5)*u.deg, \n",
" ra=np.linspace(0, 10, 5)*u.deg,\n",
" dec=np.linspace(5, 20, 5)*u.deg,\n",
" pm_ra_cosdec=np.linspace(-5, 5, 5)*u.mas/u.yr,\n",
" pm_dec=np.linspace(-5, 5, 5)*u.mas/u.yr)"
Expand All @@ -158,7 +147,7 @@
"outputs": [],
"source": [
"velocity_coord = SkyCoord(\n",
" ra=10*u.deg, \n",
" ra=10*u.deg,\n",
" dec=20*u.deg,\n",
" pm_ra_cosdec=1*u.mas/u.yr,\n",
" pm_dec=2*u.mas/u.yr,\n",
Expand Down Expand Up @@ -272,7 +261,7 @@
"# This cell will NOT work (you will receive an ConvertError warning) - this is expected!\n",
"\n",
"test_coord_1 = SkyCoord(\n",
" ra=10*u.deg, \n",
" ra=10*u.deg,\n",
" dec=20*u.deg,\n",
" pm_ra_cosdec=1*u.mas/u.yr,\n",
" pm_dec=2*u.mas/u.yr)\n",
Expand All @@ -298,7 +287,7 @@
"outputs": [],
"source": [
"test_coord_2 = SkyCoord(\n",
" ra=10*u.deg, \n",
" ra=10*u.deg,\n",
" dec=20*u.deg,\n",
" distance=10*u.pc,\n",
" pm_ra_cosdec=1*u.mas/u.yr,\n",
Expand Down Expand Up @@ -332,7 +321,7 @@
"outputs": [],
"source": [
"# Skip this cell if you are not connected to the internet\n",
"gaia_tbl = Gaia.query_object(SkyCoord.from_name('HD 219829'), \n",
"gaia_tbl = Gaia.query_object(SkyCoord.from_name('HD 219829'),\n",
" radius=1*u.arcmin)"
]
},
Expand All @@ -350,9 +339,9 @@
"outputs": [],
"source": [
"# the .read() below produces some warnings that we can safely ignore\n",
"with warnings.catch_warnings(): \n",
"with warnings.catch_warnings():\n",
" warnings.simplefilter('ignore', UserWarning)\n",
" \n",
"\n",
" gaia_tbl = QTable.read('HD_219829_query_results.ecsv')"
]
},
Expand Down Expand Up @@ -397,7 +386,7 @@
"outputs": [],
"source": [
"hd219829_coord = SkyCoord(\n",
" ra=hd219829_row['ra'], \n",
" ra=hd219829_row['ra'],\n",
" dec=hd219829_row['dec'],\n",
" distance=Distance(parallax=hd219829_row['parallax']),\n",
" pm_ra_cosdec=hd219829_row['pmra'],\n",
Expand Down Expand Up @@ -466,7 +455,7 @@
"hdu = fits.open(dss_cutout_filename)[0]\n",
"wcs = WCS(hdu.header)\n",
"\n",
"fig, ax = plt.subplots(1, 1, figsize=(8, 8), \n",
"fig, ax = plt.subplots(1, 1, figsize=(8, 8),\n",
" subplot_kw=dict(projection=wcs))\n",
"ax.imshow(hdu.data, origin='lower', cmap='Greys_r')\n",
"ax.set_xlabel('RA')\n",
Expand Down Expand Up @@ -520,9 +509,9 @@
"outputs": [],
"source": [
"# this produces some warnings that we can safely ignore\n",
"with warnings.catch_warnings(): \n",
"with warnings.catch_warnings():\n",
" warnings.simplefilter('ignore', UserWarning)\n",
" \n",
"\n",
" hd219829_coord_1950 = hd219829_coord.apply_space_motion(\n",
" new_obstime=Time('J1950'))"
]
Expand All @@ -544,7 +533,7 @@
},
"outputs": [],
"source": [
"fig, ax = plt.subplots(1, 1, figsize=(8, 8), \n",
"fig, ax = plt.subplots(1, 1, figsize=(8, 8),\n",
" subplot_kw=dict(projection=wcs))\n",
"ax.imshow(hdu.data, origin='lower', cmap='Greys_r')\n",
"ax.set_xlabel('RA')\n",
Expand Down Expand Up @@ -616,11 +605,6 @@
"name": "3-Coordinates-Velocities.ipynb",
"provenance": []
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
Expand All @@ -630,8 +614,7 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 70f53d0

Please sign in to comment.