RocketPy
RocketPy copied to clipboard
ENH: Added Crop and Clip Methods to Function Class
Pull request type
- [x] Code changes (enhancement, features)
Checklist
- [x] Lint (black rocketpy/ tests/) has passed locally
- [ ] All tests (pytest tests --runslow) have passed locally
- [x] CHANGELOG.md has been updated (if relevant)
Current behavior
RocketPy Function class has no methods to crop or clip the input and output values of a function to a specific range.
This PR is related to the following issue:
ENH: give me a scissor or apply Function.clip and Function.crop - https://github.com/RocketPy-Team/RocketPy/issues/546
New behavior
It is now possible to specify a limited range of values for input or output variables for an object created from the Function class at any point after initialization of the object by using the crop and clip methods respectively. These methods work for any type of allowed Function source.
Breaking change
No
Additional information
To use the new methods, some examples are provided below to exemplify their syntax in brief:
f.crop([(-1, 1), (-2, 2)]) - For two input variables
f.clip([(-2, 2)]) - For output variable