Last active
October 16, 2020 13:21
-
-
Save adrn/b1e1af67809d5d046485794fa79ca5cb to your computer and use it in GitHub Desktop.
projects/Untitled5.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"metadata": { | |
"ExecuteTime": { | |
"start_time": "2020-10-15T19:25:39.008852Z", | |
"end_time": "2020-10-15T19:25:39.012805Z" | |
}, | |
"trusted": true | |
}, | |
"cell_type": "code", | |
"source": "import astropy.coordinates as coord\nimport astropy.table as at\nfrom astropy.time import Time\nimport astropy.units as u\nimport matplotlib as mpl\nimport matplotlib.pyplot as plt\n%matplotlib inline\nimport numpy as np", | |
"execution_count": 3, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"ExecuteTime": { | |
"start_time": "2020-10-15T19:29:02.782694Z", | |
"end_time": "2020-10-15T19:29:02.786870Z" | |
}, | |
"trusted": true | |
}, | |
"cell_type": "code", | |
"source": "c = coord.SkyCoord(\n ra=15.424*u.deg, \n dec=53.117*u.deg,\n distance=17.235*u.pc,\n pm_ra_cosdec=0.513*u.arcsecond/u.yr,\n pm_dec=0.8134*u.arcsecond/u.yr,\n radial_velocity=25.5235*u.km/u.s,\n obstime=Time('J2015.5')\n)", | |
"execution_count": 29, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"ExecuteTime": { | |
"start_time": "2020-10-15T19:29:03.790916Z", | |
"end_time": "2020-10-15T19:29:03.794699Z" | |
}, | |
"trusted": true | |
}, | |
"cell_type": "code", | |
"source": "ts = c.obstime + np.arange(0, 10, 1/365) * u.year", | |
"execution_count": 30, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"ExecuteTime": { | |
"start_time": "2020-10-15T19:33:33.298491Z", | |
"end_time": "2020-10-15T19:33:33.302931Z" | |
}, | |
"trusted": true | |
}, | |
"cell_type": "code", | |
"source": "c.velocity", | |
"execution_count": 40, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"execution_count": 40, | |
"data": { | |
"text/plain": "<CartesianDifferential (d_x, d_y, d_z) in km / s\n (-47.62171267, 30.3404001, 60.30130237)>" | |
}, | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"ExecuteTime": { | |
"start_time": "2020-10-15T19:34:16.628255Z", | |
"end_time": "2020-10-15T19:34:16.635012Z" | |
}, | |
"trusted": true | |
}, | |
"cell_type": "code", | |
"source": "pos_at_ts = c.data.to_cartesian() + c.velocity.to_cartesian() * (ts - c.obstime)\n\n# Assume constant velocity:\nvel_at_ts = c.velocity + coord.CartesianDifferential(np.zeros((3, len(ts))) * u.km/u.s)", | |
"execution_count": 42, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"ExecuteTime": { | |
"start_time": "2020-10-15T19:34:24.640284Z", | |
"end_time": "2020-10-15T19:34:24.649194Z" | |
}, | |
"trusted": true | |
}, | |
"cell_type": "code", | |
"source": "c_at_ts = coord.SkyCoord(pos_at_ts.with_differentials(vel_at_ts), \n obstime=ts)", | |
"execution_count": 45, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"ExecuteTime": { | |
"start_time": "2020-10-15T20:37:35.502724Z", | |
"end_time": "2020-10-15T20:37:35.535019Z" | |
}, | |
"trusted": true | |
}, | |
"cell_type": "code", | |
"source": "(c_at_ts[-1].radial_velocity - c_at_ts[0].radial_velocity).to(u.m/u.s)", | |
"execution_count": 48, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"execution_count": 48, | |
"data": { | |
"text/plain": "<Quantity 3.66202397 m / s>", | |
"text/latex": "$3.662024 \\; \\mathrm{\\frac{m}{s}}$" | |
}, | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"trusted": true | |
}, | |
"cell_type": "code", | |
"source": "", | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"trusted": true | |
}, | |
"cell_type": "code", | |
"source": "", | |
"execution_count": null, | |
"outputs": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"name": "conda-root-py", | |
"display_name": "Python [conda env:root] *", | |
"language": "python" | |
}, | |
"toc": { | |
"nav_menu": {}, | |
"number_sections": true, | |
"sideBar": true, | |
"skip_h1_title": false, | |
"base_numbering": 1, | |
"title_cell": "Table of Contents", | |
"title_sidebar": "Contents", | |
"toc_cell": false, | |
"toc_position": {}, | |
"toc_section_display": true, | |
"toc_window_display": false | |
}, | |
"language_info": { | |
"name": "python", | |
"version": "3.8.3", | |
"mimetype": "text/x-python", | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"pygments_lexer": "ipython3", | |
"nbconvert_exporter": "python", | |
"file_extension": ".py" | |
}, | |
"gist": { | |
"id": "", | |
"data": { | |
"description": "projects/Untitled5.ipynb", | |
"public": true | |
} | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 4 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment