Skip to content

Commit

Permalink
ENH: add randomization to mc_flight
Browse files Browse the repository at this point in the history
  • Loading branch information
MateusStano committed Dec 15, 2023
1 parent a08b562 commit 7287caa
Show file tree
Hide file tree
Showing 2 changed files with 148 additions and 57 deletions.
183 changes: 126 additions & 57 deletions docs/notebooks/dispersion_analysis/dispersion_class_usage.ipynb

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions rocketpy/monte_carlo/mc_flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,28 @@ def _validate_initial_solution(self, initial_solution):
else:
raise TypeError("`initial_solution` must be a tuple of numbers")

# TODO: these call dict_generator a lot of times unecessaryly
def _randomize_rail_length(self):
"""Randomizes the rail length of the flight. Follows the standard input
format of Dispersion Models.
"""
generated_dict = next(self.dict_generator())
return generated_dict["rail_length"]

def _randomize_inclination(self):
"""Randomizes the inclination of the flight. Follows the standard input
format of Dispersion Models.
"""
generated_dict = next(self.dict_generator())
return generated_dict["inclination"]

def _randomize_heading(self):
"""Randomizes the heading of the flight. Follows the standard input
format of Dispersion Models.
"""
generated_dict = next(self.dict_generator())
return generated_dict["heading"]

def create_object(self):
"""Creates and returns a Flight object from the randomly generated input
arguments.
Expand Down

0 comments on commit 7287caa

Please sign in to comment.