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

Dependent variable dictionary - definitive and inside hybrid kernel #120

Closed

Conversation

alopezrivera
Copy link
Contributor

@alopezrivera alopezrivera commented Oct 29, 2023

Pull request building on #115 (which can be closed upon merging this one).

Improvements

Naming

Changed to indicate what the class and function do as of today:

  • SimulationVariableDict -> DependentVariableDictionary
  • result2dict -> create_simulation_variable_dictionary

NumPy array conversion

New method DependentVariableDictionary.asarray implemented, allowing users to easily retrieve the time history of each dependent variable as a NumPy array. Paired with the DependentVariableDictionary.time_history attribute this streamlines away the data juggling that was required before to plot dependent variables.

The new method works like this: dep_vars_dict.asarray(<key>), where <key> can be either a SingleDependentVariableSettings object (or children instance), or the string ID of a SingleDependentVariableSettings object. That is, the keys used by this method are the same we use to retrieve dependent variable histories in dictionary form from the DependentVariableDictionary.

See the example below as well.

# Create semantic dependent variable history
dep_vars_dict = create_dependent_variable_dictionary(dynamics_simulator)

# Retrieve dependent variable history as NumPy array of shape (n, A, B)
a_scalar_dependent_variable = dep_vars_dict.asarray(dependent_variables_to_save[0])

# Plot
plt.plot(
    dep_vars_dict.time_history,
    a_scalar_dependent_variable
)

where (A, B) is the shape of the dependent variable. The dependent variables are np.squeezed to remove singleton/trivial dimensions, so in the case of a scalar variable (n, A, B) shape would simply become (n,).

Testing (dependent_variable_dict (tudat-team/tudatpy#115))

Test added to the tudatpy tests which tests:

  • Retrieval of dependent variables
  • DependentVariableDictionary.asarray method to obtain NumPy arrays from dependent variable history dictionaries
  • Saved histories are equal to those obtained from the SingleArcSimulationResults.dependent_variable_history
  • Compatibility of scalar dependent variable dictionaries with tudatpy.util.result2array
  • Dimensions of vectorial dependent variables

DominicDirkx and others added 30 commits February 24, 2023 16:09
…rodynamic_coefficients

Feature/extended aerodynamic coefficients
Temporarily disbaling docs build to update boost version in conda packages
alopezrivera and others added 27 commits October 12, 2023 15:56
- ΔV calculation function default type and default value correctly set
- Refactored porkchop components to solve import bug
…les' into feature/porkchop_and_hybrid_modules
- Silent hybrid module setup by default
- Removed global_frame_orientation argument from porkchop module methods
…id_modules

Porkchop plots and hybrid C++/Python kernel modules v2
Commented out CMakeLists portion reposible
Documented progress and marked as TODO
- CMakeLists-only compilation
- Manual exposure of all kernel modules
- Added asarray function
- Documentation complete
- Relocated to hybrid kernel module `numerical_simulation.propagation`
- Name chosen
- Retrieval
- asarray method
- Results equal to those from previous method
- result2array compatible with scalar dependent variable dictionaries
- Dimensions of vectorial dependent variables
@DominicDirkx
Copy link
Member

Code merged into develop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants