Skip to content

BUG: MonteCarlo simulations not working when there are StochasticParachutes #804

@Lucas-Prates

Description

@Lucas-Prates

Describe the bug

The MonteCarlo.simulate method encounters a ValueError when evaluating the pressure on the parachutes.

To Reproduce

Try to run a Monte Carlo simulation with a StochasticParachute. Otherwise, just run the monte_carlo_class_usage notebook.

Error debugging

I debugged the code for a bit and the problem seems to be that the time_overshoot has a default of None in the StochasticFlight class, introduced in #785 . A Flight object is created with time_overshoot=None, which in turn makes the __simulate method skip running the __calculate_and_save_pressure_signals function, which in turn makes parachute.clean_pressure_signal empty and, finally, causes an error in __transform_pressure_signals_lists_to_functions since an empty argument is passed to a Function.

Possible fix

When I set time_overshoot=True, that works just fine.

When I set time_overshoot=False, an ValueError is encountered once again, this time because several arrays related to contain NaN or Inf when trying to create the cache ? (See the screenshot)

An easy fix is to make time_overshoot equals of the base flight when it is None:

if time_overshoot is None:
    self.time_overshoot = flight.time_overshoot
else:
    self.time_overshoot = time_overshoot

However, that will not fix the problem when time_overshoot is False for the base flight. This is probably connected to issue #802 . It might be better to take a closer look.

Screenshots

Bug encountered in pressure evaluation (time_overshoot=None):
Image

Bug encountered (time_overshoot=False)

Image

Additional context

Shout-out to MRT014 [LURA], a discord member that found the bug and provided me good feedback. Thank you :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingMonte CarloMonte Carlo and related contents

    Type

    Projects

    Status

    Closed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions