Skip to content

Commit

Permalink
Merge pull request #70 from luigigisolfi/feature/restore_lars_changes…
Browse files Browse the repository at this point in the history
…_fix_NO_API

Feature/restore lars changes fix (no api)
  • Loading branch information
DominicDirkx authored Oct 11, 2024
2 parents ebc3588 + e0a1aef commit 218e30c
Show file tree
Hide file tree
Showing 58 changed files with 3,981 additions and 3,842 deletions.
49 changes: 9 additions & 40 deletions estimation/covariance_estimated_parameters.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,6 @@
"The first part of this example deals with the setup of all relevant (environment, propagation, and estimation) modules, so feel free to skip these steps if you're already familiar with them!"
]
},
{
"cell_type": "raw",
"id": "cdc4c9a7-f484-4600-ba59-f4a99863088a",
"metadata": {},
"source": [
"## Key API References\n",
" Here's a comprehensive list of the _modules_ and _methods_ that are relevant to this example, or that will be introduced here for the first time.\n",
"\n",
"| Module | | Methods |➡️ | | | \n",
"| --- | --- | --- | --- | --- | --- |\n",
"| [numerical_simulation.estimation_setup.observation](https://py.api.tudat.space/en/latest/observation.html) | [**body_reference_point_link_end_id**](https://py.api.tudat.space/en/latest/observation.html#tudatpy.numerical_simulation.estimation_setup.observation.body_reference_point_link_end_id) | [**LinkDefinition**](https://py.api.tudat.space/en/latest/observation.html#tudatpy.numerical_simulation.estimation_setup.observation.LinkDefinition) | [**one_way_doppler_instantaneous**](https://py.api.tudat.space/en/latest/observation.html#tudatpy.numerical_simulation.estimation_setup.observation.one_way_doppler_instantaneous) | [**add_gaussian_noise_to_observable**](https://py.api.tudat.space/en/latest/observation.html#tudatpy.numerical_simulation.estimation_setup.observation.add_gaussian_noise_to_observable) | [**elevation_angle_viability**](https://py.api.tudat.space/en/latest/observation.html#tudatpy.numerical_simulation.estimation_setup.observation.elevation_angle_viability) |[**tabulated_simulation_settings**](https://py.api.tudat.space/en/latest/observation.html#tudatpy.numerical_simulation.estimation_setup.observation.tabulated_simulation_settings)|\n",
"| [numerical_simulation.estimation_setup](https://py.api.tudat.space/en/latest/estimation_setup.html)|[**parameter**](https://py.api.tudat.space/en/latest/parameter.html) |[**create_parameter_set**](https://py.api.tudat.space/en/latest/estimation_setup.html#tudatpy.numerical_simulation.estimation_setup.create_parameter_set) | | | | |\n",
"| [numerical_simulation.Estimator](https://py.api.tudat.space/en/latest/numerical_simulation.html#tudatpy.numerical_simulation.Estimator) | [**observation_simulators**](https://py.api.tudat.space/en/latest/numerical_simulation.html#tudatpy.numerical_simulation.Estimator.observation_simulators) | [**compute_covariance**](https://py.api.tudat.space/en/latest/numerical_simulation.html#tudatpy.numerical_simulation.Estimator.compute_covariance) | [**perform_estimation**](https://py.api.tudat.space/en/latest/numerical_simulation.html#tudatpy.numerical_simulation.Estimator.perform_estimation) | [**state_transition_interface**](https://py.api.tudat.space/en/latest/numerical_simulation.html#tudatpy.numerical_simulation.Estimator.state_transition_interface) | |\n",
"| [numerical_simulation.estimation](https://py.api.tudat.space/en/latest/estimation.html) | [**simulate_observations**](https://py.api.tudat.space/en/latest/estimation.html#tudatpy.numerical_simulation.estimation.simulate_observations) | [**CovarianceAnalysisInput**](https://py.api.tudat.space/en/latest/estimation.html#tudatpy.numerical_simulation.estimation.CovarianceAnalysisInput) | [**estimation_convergence_checker**](https://py.api.tudat.space/en/latest/estimation.html#tudatpy.numerical_simulation.estimation.EstimationConvergenceChecker) |[**EstimationInput**](https://py.api.tudat.space/en/latest/estimation.html#tudatpy.numerical_simulation.estimation.EstimationInput)|\n",
"| [astro.time_conversion](https://py.api.tudat.space/en/latest/time_conversion.html) | [**DateTime**]() | \n",
"| [astro.element_conversion](https://py.api.tudat.space/en/latest/element_conversion.html) | [**geodetic_position_type**]() | \n",
"\n",
"\n",
"🧐 **Missing something**? You can find out more on the [TudatPy API Reference](https://py.api.tudat.space/en/latest/), or you can [reach out to us](https://docs.tudat.space/en/latest/_src_about/contribute_to_tudat.html)!"
]
},
{
"cell_type": "markdown",
"id": "e99cbeda",
Expand Down Expand Up @@ -122,9 +101,7 @@
"### Create the main bodies\n",
"To create the systems of bodies for the simulation, one first has to define a list of strings of all bodies that are to be included. Note that the default body settings (such as atmosphere, body shape, rotation model) are taken from the `SPICE` kernel.\n",
"\n",
"These settings, however, can be adjusted. Please refer to the [Available Environment Models](https://tudat-space.readthedocs.io/en/latest/_src_user_guide/state_propagation/environment_setup/create_models/available.html#available-environment-models) in the user guide for more details.\n",
"\n",
"Finally, the system of bodies is created using the settings. This system of bodies is stored into the variable `bodies`."
"These settings, however, can be adjusted. Please refer to the [Available Environment Models](https://tudat-space.readthedocs.io/en/latest/_src_user_guide/state_propagation/environment_setup/create_models/available.html#available-environment-models) in the user guide for more details."
]
},
{
Expand Down Expand Up @@ -165,10 +142,10 @@
"body_settings.get(\"Delfi-C3\").constant_mass = 2.2 #kg\n",
"\n",
"# Create aerodynamic coefficient interface settings\n",
"reference_area = (4*0.3*0.1+2*0.1*0.1)/4 # Average projection area of a 3U CubeSat\n",
"reference_area_drag = (4*0.3*0.1+2*0.1*0.1)/4 # Average projection area of a 3U CubeSat\n",
"drag_coefficient = 1.2\n",
"aero_coefficient_settings = environment_setup.aerodynamic_coefficients.constant(\n",
" reference_area, [drag_coefficient, 0.0, 0.0]\n",
" reference_area_drag, [drag_coefficient, 0.0, 0.0]\n",
")\n",
"# Add the aerodynamic interface to the environment\n",
"body_settings.get(\"Delfi-C3\").aerodynamic_coefficient_settings = aero_coefficient_settings\n",
Expand Down Expand Up @@ -218,12 +195,15 @@
"source": [
"### Create the acceleration model\n",
"Subsequently, all accelerations (and there settings) that act on `Delfi-C3` have to be defined. In particular, we will consider:\n",
"\n",
"* Gravitational acceleration using a spherical harmonic approximation up to 8th degree and order for Earth.\n",
"* Aerodynamic acceleration for Earth.\n",
"* Gravitational acceleration using a simple point mass model for:\n",
"\n",
" - The Sun\n",
" - The Moon\n",
" - Mars\n",
"\n",
"* Radiation pressure experienced by the spacecraft - shape-wise approximated as a spherical cannonball - due to the Sun.\n",
"\n",
"The defined acceleration settings are then applied to `Delfi-C3` by means of a dictionary, which is finally used as input to the propagation setup to create the acceleration models."
Expand Down Expand Up @@ -704,7 +684,6 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Calculating residuals and partials 39\n",
"Initial_covariance:\n",
"\n",
"[[ 2.16831937e-01 5.77721311e-02 -7.35943531e-02 8.62442596e-05\n",
Expand All @@ -723,6 +702,7 @@
" 2.56615163e+03 2.77851575e+02 2.94641955e+14 -1.66514596e+02]\n",
" [ 1.06862152e-04 5.15555071e-05 -4.04930006e-05 4.58235148e-08\n",
" -9.60473866e-10 1.28824286e-07 -1.66514596e+02 9.66866983e-08]]\n",
"Calculating residuals and partials 39\n",
"\n",
"Formal Error Matrix:\n",
"\n",
Expand Down Expand Up @@ -784,7 +764,7 @@
"print(f'Formal Error Matrix:\\n\\n{diagonal_covariance}\\n')\n",
"\n",
"sigma = 3 # Confidence level\n",
"original_eigenvalues, original_eigenvectors = np.linalg.eig(initial_covariance)\n",
"original_eigenvalues, original_eigenvectors = np.linalg.eig(diagonal_covariance)\n",
"original_diagonal_eigenvalues, original_diagonal_eigenvectors = np.linalg.eig(diagonal_covariance)\n",
"print(f'Estimated state and parameters:\\n\\n {parameters_to_estimate.parameter_vector}\\n')\n",
"print(f'Eigenvalues of Covariance Matrix:\\n\\n {original_eigenvalues}\\n')\n",
Expand Down Expand Up @@ -976,20 +956,9 @@
"plt.legend()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "24d05573-d1a8-4ac0-b9e3-7e7a74b2bb14",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"interpreter": {
"hash": "4a4d53b53330cd83e1499268313a4bcd5eafe4bf50523883929af79f2dd687b2"
},
"kernelspec": {
"display_name": "tudat-bundle",
"language": "python",
Expand All @@ -1005,7 +974,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.10"
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down
17 changes: 6 additions & 11 deletions estimation/covariance_estimated_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@
# To create the systems of bodies for the simulation, one first has to define a list of strings of all bodies that are to be included. Note that the default body settings (such as atmosphere, body shape, rotation model) are taken from the `SPICE` kernel.
#
# These settings, however, can be adjusted. Please refer to the [Available Environment Models](https://tudat-space.readthedocs.io/en/latest/_src_user_guide/state_propagation/environment_setup/create_models/available.html#available-environment-models) in the user guide for more details.
#
# Finally, the system of bodies is created using the settings. This system of bodies is stored into the variable `bodies`.

# In[3]:

Expand All @@ -99,10 +97,10 @@
body_settings.get("Delfi-C3").constant_mass = 2.2 #kg

# Create aerodynamic coefficient interface settings
reference_area = (4*0.3*0.1+2*0.1*0.1)/4 # Average projection area of a 3U CubeSat
reference_area_drag = (4*0.3*0.1+2*0.1*0.1)/4 # Average projection area of a 3U CubeSat
drag_coefficient = 1.2
aero_coefficient_settings = environment_setup.aerodynamic_coefficients.constant(
reference_area, [drag_coefficient, 0.0, 0.0]
reference_area_drag, [drag_coefficient, 0.0, 0.0]
)
# Add the aerodynamic interface to the environment
body_settings.get("Delfi-C3").aerodynamic_coefficient_settings = aero_coefficient_settings
Expand Down Expand Up @@ -137,12 +135,15 @@

# ### Create the acceleration model
# Subsequently, all accelerations (and there settings) that act on `Delfi-C3` have to be defined. In particular, we will consider:
#
# * Gravitational acceleration using a spherical harmonic approximation up to 8th degree and order for Earth.
# * Aerodynamic acceleration for Earth.
# * Gravitational acceleration using a simple point mass model for:
#
# - The Sun
# - The Moon
# - Mars
#
# * Radiation pressure experienced by the spacecraft - shape-wise approximated as a spherical cannonball - due to the Sun.
#
# The defined acceleration settings are then applied to `Delfi-C3` by means of a dictionary, which is finally used as input to the propagation setup to create the acceleration models.
Expand Down Expand Up @@ -464,7 +465,7 @@
print(f'Formal Error Matrix:\n\n{diagonal_covariance}\n')

sigma = 3 # Confidence level
original_eigenvalues, original_eigenvectors = np.linalg.eig(initial_covariance)
original_eigenvalues, original_eigenvectors = np.linalg.eig(diagonal_covariance)
original_diagonal_eigenvalues, original_diagonal_eigenvectors = np.linalg.eig(diagonal_covariance)
print(f'Estimated state and parameters:\n\n {parameters_to_estimate.parameter_vector}\n')
print(f'Eigenvalues of Covariance Matrix:\n\n {original_eigenvalues}\n')
Expand Down Expand Up @@ -589,9 +590,3 @@
plt.legend()
plt.show()


# In[ ]:




52 changes: 11 additions & 41 deletions estimation/covariance_propagation_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,6 @@
"This example will show you how to **propagate the covariance**. We will simulate a series of **one-way** open loop observing sessions of the ``Starlink-32101`` satellite, and we will see simulating a different number of observations affects the evolution of the **formal errors** over time. This example builds up on the [Starlink-32101 Covariance Analysis example](https://docs.tudat.space/en/latest/_src_getting_started/_src_examples/notebooks/estimation/covariance_estimated_parameters.html), so go check that out if you haven't already! "
]
},
{
"cell_type": "raw",
"id": "77d50ba7-f440-4e36-9215-6f2d1bb069da",
"metadata": {},
"source": [
"## Key API References\n",
" Here's a comprehensive list of the _modules_ and _methods_ that are relevant to this example, or that will be introduced here for the first time.\n",
"\n",
"| Module | | Methods | ➡️ || | || | || |\n",
"| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |\n",
"| [numerical_simulation.estimation_setup.observation](https://py.api.tudat.space/en/latest/observation.html) | [**body_reference_point_link_end_id**](https://py.api.tudat.space/en/latest/observation.html#tudatpy.numerical_simulation.estimation_setup.observation.body_reference_point_link_end_id) | [**LinkDefinition**](https://py.api.tudat.space/en/latest/observation.html#tudatpy.numerical_simulation.estimation_setup.observation.LinkDefinition) | [**one_way_doppler_instantaneous**](https://py.api.tudat.space/en/latest/observation.html#tudatpy.numerical_simulation.estimation_setup.observation.one_way_doppler_instantaneous) | [**add_gaussian_noise_to_observable**](https://py.api.tudat.space/en/latest/observation.html#tudatpy.numerical_simulation.estimation_setup.observation.add_gaussian_noise_to_observable) | [**elevation_angle_viability**](https://py.api.tudat.space/en/latest/observation.html#tudatpy.numerical_simulation.estimation_setup.observation.elevation_angle_viability)|[**tabulated_simulation_settings**](https://py.api.tudat.space/en/latest/observation.html#tudatpy.numerical_simulation.estimation_setup.observation.tabulated_simulation_settings)|\n",
"|[numerical_simulation.estimation_setup](https://py.api.tudat.space/en/latest/estimation_setup.html)| [**parameter**](https://py.api.tudat.space/en/latest/parameter.html) |[**create_parameter_set**](https://py.api.tudat.space/en/latest/estimation_setup.html#tudatpy.numerical_simulation.estimation_setup.create_parameter_set) | | | | |\n",
"| [numerical_simulation.Estimator](https://py.api.tudat.space/en/latest/numerical_simulation.html#tudatpy.numerical_simulation.Estimator) | [**observation_simulators**](https://py.api.tudat.space/en/latest/numerical_simulation.html#tudatpy.numerical_simulation.Estimator.observation_simulators) | [**compute_covariance**](https://py.api.tudat.space/en/latest/numerical_simulation.html#tudatpy.numerical_simulation.Estimator.compute_covariance) | [**perform_estimation**](https://py.api.tudat.space/en/latest/numerical_simulation.html#tudatpy.numerical_simulation.Estimator.perform_estimation) | [**state_transition_interface**](https://py.api.tudat.space/en/latest/numerical_simulation.html#tudatpy.numerical_simulation.Estimator.state_transition_interface) | |\n",
"| [numerical_simulation.estimation](https://py.api.tudat.space/en/latest/estimation.html) | [**simulate_observations**](https://py.api.tudat.space/en/latest/estimation.html#tudatpy.numerical_simulation.estimation.simulate_observations) | [**CovarianceAnalysisInput**](https://py.api.tudat.space/en/latest/estimation.html#tudatpy.numerical_simulation.estimation.CovarianceAnalysisInput) | [**estimation_convergence_checker**](https://py.api.tudat.space/en/latest/estimation.html#tudatpy.numerical_simulation.estimation.EstimationConvergenceChecker) |[**EstimationInput**](https://py.api.tudat.space/en/latest/estimation.html#tudatpy.numerical_simulation.estimation.EstimationInput)| [**propagate_formal_errors_split_output**]| [**propagate_covariance_split_output**]()|\n",
"| [astro.frame_conversion](https://py.api.tudat.space/en/latest/frame_conversion.html#) | [**inertial_to_rsw_rotation_matrix**](https://py.api.tudat.space/en/latest/frame_conversion.html#tudatpy.astro.frame_conversion.inertial_to_rsw_rotation_matrix) | \n",
"| [astro.time_conversion](https://py.api.tudat.space/en/latest/time_conversion.html) | [**DateTime**]() | \n",
"| [astro.element_conversion](https://py.api.tudat.space/en/latest/element_conversion.html) | [**geodetic_position_type**]() | \n",
"\n",
"\n",
"🧐 **Missing something**? You can find out more on the [TudatPy API Reference](https://py.api.tudat.space/en/latest/), or you can [reach out to us](https://docs.tudat.space/en/latest/_src_about/contribute_to_tudat.html)! "
]
},
{
"cell_type": "markdown",
"id": "e99cbeda",
Expand Down Expand Up @@ -158,7 +136,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 4,
"id": "1585b93e",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -234,7 +212,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 6,
"id": "ae320f6d",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -280,7 +258,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 7,
"id": "12458abf",
"metadata": {},
"outputs": [],
Expand All @@ -305,7 +283,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 8,
"id": "44edeb70",
"metadata": {},
"outputs": [],
Expand All @@ -327,7 +305,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 9,
"id": "facb90c1",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -363,7 +341,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 10,
"id": "4eebd846",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -396,7 +374,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 11,
"id": "8a19c012",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -444,7 +422,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 12,
"id": "48d30336",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -609,7 +587,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 13,
"id": "7d1256d3-0526-4773-a4e0-99fa4df47878",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -678,7 +656,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 14,
"id": "fa338460-f014-4490-8df1-e80c1fb2add1",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -750,14 +728,6 @@
"plt.tight_layout()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6a8d645d-c170-4ad1-9565-7a91bb8b2f18",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -779,7 +749,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.10"
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down
3 changes: 0 additions & 3 deletions estimation/covariance_propagation_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,3 @@
plt.tight_layout()
plt.show()




Loading

0 comments on commit 218e30c

Please sign in to comment.