Created
November 19, 2020 18:46
-
-
Save jmbarr/5c185eb1c106a98568b0b8a81d2f7fc9 to your computer and use it in GitHub Desktop.
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": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### Demonstrate initiation of OrbitalState object" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# Necessary imports\n", | |
"import numpy as np\n", | |
"from datetime import datetime\n", | |
"from stonesoup.types.array import StateVector\n", | |
"\n", | |
"# The class in question is\n", | |
"from stonesoup.types.orbitalstate import OrbitalState" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"#### initiate from Cartesian coordinates" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# The state vector is (in km)\n", | |
"orb_st_vec = StateVector([-6045, -3490, 2500, -3.457, 6.618, 2.533])\n", | |
"\n", | |
"# Create the state, and ensure that the Gravitational parameter is in km^3 s^-2, because by default it's in m^3 s^-2\n", | |
"orb_st = OrbitalState(orb_st_vec, grav_parameter=3.986004418e5, timestamp=datetime.now())" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Check whether that gives you something sensible:" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"StateVector([[1.71211182e-01],\n", | |
" [8.78808177e+03],\n", | |
" [2.67470361e+00],\n", | |
" [4.45546404e+00],\n", | |
" [3.50255117e-01],\n", | |
" [4.96472955e-01]])" | |
] | |
}, | |
"execution_count": 3, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"orb_st.keplerian_elements" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"These should be $e = 0.1712$, $a = 8788$, $i = 2.674$, $\\Omega = 4.456$, $\\omega = 0.3503$, $\\theta = 0.4965$ according to the textbooks." | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"That's the simplest way of doing it, but other intiations (from Keplerian elements or Equinocital elements should also work). Of note might be the option of initiating directly from a TLE. See this link: https://gist.github.com/jmbarr/f1ce08fc4c3e2b5a09fde68c0633cb17" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"#### Covariances" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"None\n" | |
] | |
} | |
], | |
"source": [ | |
"print(orb_st.covar)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"By default there's no covariance specified (i.e. covar=None). That's deliberate because there's no strong reason to presume that the uncertainty is Gauss-distributed. And certainly not in the Cartesian frame. Note though that if you were to do inference using a Kalman-type filter, you'd be making this assumption implicitly. Many (most?) current inference schemes assume Gaussianity in a different frame (roughly corresponding to radial, along-track, and normal 'RTN' coordinates). `OrbitalState` would have to be adjusted to cope with this. In fact it might be better to derive a new class to do this..." | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"So further developments might create `GaussianOrbitalState`, `ParticleOrbitalState` or somesuch. Or perhaps something like an `RTNGaussianOrbitalState` in which the covar could be used by the Kalman-type filters." | |
] | |
} | |
], | |
"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.7.6" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 4 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment