Skip to content

Instantly share code, notes, and snippets.

@rutj3
Created December 14, 2015 07:43
Show Gist options
  • Save rutj3/d6ca3c0e304b6c6b1a26 to your computer and use it in GitHub Desktop.
Save rutj3/d6ca3c0e304b6c6b1a26 to your computer and use it in GitHub Desktop.
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from skyfield.api import load, now\n",
"import os"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"'0.6.1'"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import skyfield\n",
"skyfield.__version__"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[#################################] 100% de421.bsp\n"
]
}
],
"source": [
"planets = load('de421.bsp')\n",
"earth, mars = planets['earth'], planets['mars']\n",
"\n",
"jd = now()\n",
"position = earth.at(jd).observe(mars)\n",
"ra, dec, distance = position.radec()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"13h 09m 51.74s\n",
"-05deg 48' 38.1\"\n",
"1.85105 au\n"
]
}
],
"source": [
"print(ra)\n",
"print(dec)\n",
"print(distance)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment