Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The API Function.draw() methods could be simplified #2591

Open
mbaudin47 opened this issue Mar 26, 2024 · 0 comments
Open

The API Function.draw() methods could be simplified #2591

mbaudin47 opened this issue Mar 26, 2024 · 0 comments

Comments

@mbaudin47
Copy link
Collaborator

mbaudin47 commented Mar 26, 2024

What happened?

In this issue, I consider the Function.draw() method. This method has many input arguments, but some of them could be simplified or reduced.

  • The current API requires xMin and xMax to draw the function. But this could be specified as an Interval.
  • The current API requires an outputMarginalIndex. This is useless in practice, since we can use function.getMarginal(outputMarginalIndex).draw(), which is more simple. In this case, the API could remove the outputMarginalIndex input argument and generate an exception if the function has multiple outputs.
  • The centralPoint could be removed because the user can define a ParametricFunction before calling the draw() method.

How to reproduce the issue?

The current implementation requires:

import openturns as ot
from openturns.viewer import View
f = ot.SymbolicFunction('x', 'sin(2*pi_*x)*exp(-x^2/2)')
graph = f.draw(-1.2, 1.2, 100)

This should be:

import openturns as ot
from openturns.viewer import View
f = ot.SymbolicFunction('x', 'sin(2*pi_*x)*exp(-x^2/2)')
interval = ot.Interval([-1.2], [1.2])
graph = f.draw(interval, 100)

Version

1.22

Operating System

unknown

Installation media

unknown

Additional Context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant