Skip to content

ENH: Added Crop and Clip Methods to Function Class - #817

Merged
Gui-FernandesBR merged 2 commits into
RocketPy-Team:developfrom
Rickisterr:enh/function-crop-clip-methods
Aug 13, 2025
Merged

Gui-FernandesBR merged 2 commits into
RocketPy-Team:developfrom
Rickisterr:enh/function-crop-clip-methods

Conversation

@Rickisterr

@Rickisterr Rickisterr commented May 12, 2025

Copy link
Copy Markdown
Contributor

Pull request type

  • Code changes (enhancement, features)

Checklist

  • Lint (black rocketpy/ tests/) has passed locally
  • All tests (pytest tests --runslow) have passed locally
  • 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 - #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

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Closed

Development

Successfully merging this pull request may close these issues.

ENH: give me a scissor or apply Function.clip and Function.crop

4 participants