Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add latest() for MetaAlmanac #181

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 103 additions & 27 deletions anise-py/notebooks/Tutorial 01 - Querying SPK files.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,88 @@
"print(almanac)"
]
},
{
"cell_type": "markdown",
"id": "3759ef17-cd5f-435e-869d-a68b21eedeee",
"metadata": {},
"source": [
"You may also use the `describe` function to see the details of what is loaded, optionally showing only some of the loaded data."
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "67ee44ce-d5b6-4c86-ba49-7ea89254a9b3",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\u001b[0;31mSignature:\u001b[0m\n",
"\u001b[0malmanac\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdescribe\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mspk\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mbpc\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mplanetary\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mtime_scale\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m \u001b[0mround_time\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n",
"\u001b[0;34m\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mDocstring:\u001b[0m\n",
"Pretty prints the description of this Almanac, showing everything by default. Default time scale is TDB.\n",
"If any parameter is set to true, then nothing other than that will be printed.\n",
"\u001b[0;31mType:\u001b[0m builtin_function_or_method"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"almanac.describe?"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "d120774f-09a5-4e38-bc96-f632e6fd746b",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"=== SPK #0 ===\n",
"┌────────────────┬─────────────────────────────┬───────────────────────────────┬───────────────────────────────────┬───────────────────────────────────┬─────────────┬────────────────────┐\n",
"│ Name │ Target │ Center │ Start epoch │ End epoch │ Duration │ Interpolation kind │\n",
"├────────────────┼─────────────────────────────┼───────────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼─────────────┼────────────────────┤\n",
"│ DE-0440LE-0440 │ Mercury J2000 │ Solar System Barycenter J2000 │ 1849-12-26T00:00:00.000046818 TDB │ 2150-01-21T23:59:59.999955683 TDB │ 109600 days │ Chebyshev Triplet │\n",
"│ DE-0440LE-0440 │ Venus J2000 │ Solar System Barycenter J2000 │ 1849-12-26T00:00:00.000046818 TDB │ 2150-01-21T23:59:59.999955683 TDB │ 109600 days │ Chebyshev Triplet │\n",
"│ DE-0440LE-0440 │ Earth-Moon Barycenter J2000 │ Solar System Barycenter J2000 │ 1849-12-26T00:00:00.000046818 TDB │ 2150-01-21T23:59:59.999955683 TDB │ 109600 days │ Chebyshev Triplet │\n",
"│ DE-0440LE-0440 │ Mars Barycenter J2000 │ Solar System Barycenter J2000 │ 1849-12-26T00:00:00.000046818 TDB │ 2150-01-21T23:59:59.999955683 TDB │ 109600 days │ Chebyshev Triplet │\n",
"│ DE-0440LE-0440 │ Jupiter Barycenter J2000 │ Solar System Barycenter J2000 │ 1849-12-26T00:00:00.000046818 TDB │ 2150-01-21T23:59:59.999955683 TDB │ 109600 days │ Chebyshev Triplet │\n",
"│ DE-0440LE-0440 │ Saturn Barycenter J2000 │ Solar System Barycenter J2000 │ 1849-12-26T00:00:00.000046818 TDB │ 2150-01-21T23:59:59.999955683 TDB │ 109600 days │ Chebyshev Triplet │\n",
"│ DE-0440LE-0440 │ Uranus Barycenter J2000 │ Solar System Barycenter J2000 │ 1849-12-26T00:00:00.000046818 TDB │ 2150-01-21T23:59:59.999955683 TDB │ 109600 days │ Chebyshev Triplet │\n",
"│ DE-0440LE-0440 │ Neptune Barycenter J2000 │ Solar System Barycenter J2000 │ 1849-12-26T00:00:00.000046818 TDB │ 2150-01-21T23:59:59.999955683 TDB │ 109600 days │ Chebyshev Triplet │\n",
"│ DE-0440LE-0440 │ Pluto Barycenter J2000 │ Solar System Barycenter J2000 │ 1849-12-26T00:00:00.000046818 TDB │ 2150-01-21T23:59:59.999955683 TDB │ 109600 days │ Chebyshev Triplet │\n",
"│ DE-0440LE-0440 │ Sun J2000 │ Solar System Barycenter J2000 │ 1849-12-26T00:00:00.000046818 TDB │ 2150-01-21T23:59:59.999955683 TDB │ 109600 days │ Chebyshev Triplet │\n",
"│ DE-0440LE-0440 │ Luna J2000 │ Earth-Moon Barycenter J2000 │ 1849-12-26T00:00:00.000046818 TDB │ 2150-01-21T23:59:59.999955683 TDB │ 109600 days │ Chebyshev Triplet │\n",
"│ DE-0440LE-0440 │ Earth J2000 │ Earth-Moon Barycenter J2000 │ 1849-12-26T00:00:00.000046818 TDB │ 2150-01-21T23:59:59.999955683 TDB │ 109600 days │ Chebyshev Triplet │\n",
"│ DE-0440LE-0440 │ body 199 J2000 │ Mercury J2000 │ 1849-12-26T00:00:00.000046818 TDB │ 2150-01-21T23:59:59.999955683 TDB │ 109600 days │ Chebyshev Triplet │\n",
"│ DE-0440LE-0440 │ body 299 J2000 │ Venus J2000 │ 1849-12-26T00:00:00.000046818 TDB │ 2150-01-21T23:59:59.999955683 TDB │ 109600 days │ Chebyshev Triplet │\n",
"└────────────────┴─────────────────────────────┴───────────────────────────────┴───────────────────────────────────┴───────────────────────────────────┴─────────────┴────────────────────┘\n"
]
}
],
"source": [
"almanac.describe(bpc=True) # This will print nothing because no BPC is loaded\n",
"almanac.describe(spk=True)"
]
},
{
"cell_type": "markdown",
"id": "256e5365-1f6d-4c98-b6cb-f63a8ad18c51",
"metadata": {},
"source": [
"As of version 0.2.1, in Python, one can only perform transformations, and simple translations, but not extract the rotation information like the DCM (it is only available in Rust for now). What this means in practice is that one can query for the state of the Moon in the Earth body fixed frame (IAU Earth for example), and ANISE will perform all of the required transformations, but you cannot only query for the rotation parameters.\n",
"As of version 0.2.2, in Python, one can only perform transformations, and simple translations, but not extract the rotation information like the DCM (it is only available in Rust for now). What this means in practice is that one can query for the state of the Moon in the Earth body fixed frame (IAU Earth for example), and ANISE will perform all of the required transformations, but you cannot only query for the rotation parameters.\n",
"\n",
"**To query something, we need several pieces of information:**\n",
"\n",
Expand All @@ -128,7 +204,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"id": "c4c1d46e-4701-4ccb-9a27-0832265f973e",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -165,7 +241,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"id": "5526b332-d48a-469c-a24d-eb59c85dbd90",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -200,7 +276,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"id": "2ea6b1b1-ce75-45c3-9324-133e05190762",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -232,7 +308,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 9,
"id": "5e234050-3153-48b3-bae1-005c215df7e9",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -289,7 +365,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 10,
"id": "bd49354c-f5cc-46b8-bb56-4ff485da6b35",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -343,7 +419,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 11,
"id": "286bfaf7-8ffd-4f77-bc61-c41b03f52983",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -401,7 +477,7 @@
" '__subclasshook__']"
]
},
"execution_count": 9,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -413,7 +489,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 12,
"id": "e87a0926-8018-4ef8-a581-2d8274e19f9e",
"metadata": {},
"outputs": [
Expand All @@ -437,7 +513,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 13,
"id": "f3e821b2-78f4-4acb-8592-10a741d39674",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -487,7 +563,7 @@
" 'with_orient']"
]
},
"execution_count": 11,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -509,7 +585,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 14,
"id": "c9a2eb6c-0783-49d8-ab5b-8cf914f5803e",
"metadata": {},
"outputs": [
Expand All @@ -520,7 +596,7 @@
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mException\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[12], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43meme2k\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmu_km3_s2\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
"Cell \u001b[0;32mIn[14], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43meme2k\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmu_km3_s2\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
"\u001b[0;31mException\u001b[0m: retrieving gravitational parameter requires the frame Earth J2000 to have mu_km3_s2 defined"
]
}
Expand All @@ -531,7 +607,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 15,
"id": "ad5af23d-3a04-4122-ac51-a818bf4451e4",
"metadata": {},
"outputs": [],
Expand All @@ -552,7 +628,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 16,
"id": "f4374ba5-2c0c-4768-869c-cdb6edb7651b",
"metadata": {},
"outputs": [
Expand All @@ -563,7 +639,7 @@
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mException\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[14], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[43meme2k\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmu_km3_s2\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m)\n",
"Cell \u001b[0;32mIn[16], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[43meme2k\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmu_km3_s2\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m)\n",
"\u001b[0;31mException\u001b[0m: retrieving gravitational parameter requires the frame Earth J2000 to have mu_km3_s2 defined"
]
}
Expand All @@ -582,7 +658,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 17,
"id": "43ac7a62-2c1e-4c34-9b62-4646079c11d0",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -630,7 +706,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 18,
"id": "6ecc0641-ec60-4c62-98b0-efecfbe6ee2c",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -672,17 +748,17 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 19,
"id": "4410e354-d9dc-42a8-94b9-09cffd57dc96",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"LT (@0x7f1b9a1a72c0)"
"LT (@0x7fd4c0478ee0)"
]
},
"execution_count": 17,
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -694,7 +770,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 20,
"id": "935bf989-bf59-49ba-b31f-8b64267f26d1",
"metadata": {},
"outputs": [
Expand All @@ -713,7 +789,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 21,
"id": "fba7ff18-4669-42d1-92c9-00e3568c736c",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -751,7 +827,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 22,
"id": "a2c9b478-e8b0-411b-828a-0bf50cc82a6b",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -786,7 +862,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 23,
"id": "aa3e6682-c0d0-4335-a488-69e9eef0dccf",
"metadata": {},
"outputs": [
Expand All @@ -813,7 +889,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 24,
"id": "0ab91d31-1792-46ca-921f-e3320c226835",
"metadata": {},
"outputs": [
Expand All @@ -840,7 +916,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 25,
"id": "7e50475e-d2a1-44f5-82bb-b721165c2625",
"metadata": {},
"outputs": [
Expand Down
Loading