Skip to content

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

@Gui-FernandesBR

Description

@Gui-FernandesBR

Is your feature request related to a problem? Please describe.

Mutating Function objects is magical because sometimes we need to do some particular operations with them.
This issue requests two new methods to create new Function objects from other array-based Function objects.

Describe the solution you'd like

Please implement the following:

  • Function.clip : limits the y_array to a certain range, for instance, limit the sin function to be constrained between -1 an 1. This should delete any datapoint with the y value out of the range.
  • Function.crop : limits the x_array to a certain range, for instance, limit the domain of a R1->R1 function to be limited by x=0 and x=1. This should delete any datapoint with the x values out of the range.

Some considerations:

  • The methods should take the array source of the Function, remove the undesired data, return
  • Once we remove data from the array and recreate a function object, all the interpolation coefficients will be recalculated. Should that be a problem?

I'm not sure how we would do (if possible) the same operations in non array-based Functions, so I'm leaving them out of the scope here.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNew feature or request, including adjustments in current codesFunctionEverything related to the Function classGood first issueGood for newcomers

    Projects

    Status

    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions