RocketPy icon indicating copy to clipboard operation
RocketPy copied to clipboard

ENH: Callback function for collecting additional data from Monte Carlo sims

Open emtee14 opened this issue 1 year ago • 2 comments

Pull request type

  • [x] Code changes (bugfix, features)

Checklist

  • [ ] Tests for the changes have been added (if needed)
  • [ ] Docs have been reviewed and added / updated
  • [ ] Lint (black rocketpy/ tests/) has passed locally
  • [ ] All tests (pytest tests -m slow --runslow) have passed locally
  • [ ] CHANGELOG.md has been updated (if relevant)

Current behaviour

Implementation for this feature suggestion #699 . At the moments users are limited to set variables when exporting data from Monte Carlo experiments.

New behaviour

Now a function can be passed to the MonteCarlo class which takes a Flight object as an argument and returns a dict to be appended to the default outputs.

Breaking change

  • [x] No

Additional information

At the moment the implementation works but there is an existing issue with the RocketPyEncoder for writing the inputs to the .txt file as JSON strings. I've also made it check if the function overwrites existing variables though I feel this may not be necessary. I also had to fix how the previous results are imported as they are errors since text results can now be exported, see line 671.

emtee14 avatar Oct 06 '24 20:10 emtee14