Skip to content

Separation of data preparation and plotting for criterion_plot() #600

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

r3kste
Copy link
Contributor

@r3kste r3kste commented May 26, 2025

Summary of changes

Separated the logic for data preparation and plotting in criterion_plot(). This is done to easily enable the addition of plotting backends.

  1. Dataclass LineData stores required data for plotting a single line.
  2. Dataclass CriterionPlotData stores all backend agnostic data needed for criterion_plot() [lines and multistart_lines if applicable]
  3. Dataclass PlotConfig stores global settings of plots

Additionally, we could add a new parameter such as return_data - which would return the plot_data instead of plotting. This can be discussed, if it is worth looking into.

Copy link

codecov bot commented May 27, 2025

Codecov Report

Attention: Patch coverage is 92.13483% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/optimagic/visualization/history_plots.py 92.13% 7 Missing ⚠️
Files with missing lines Coverage Δ
src/optimagic/visualization/history_plots.py 92.67% <92.13%> (+1.82%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@r3kste r3kste force-pushed the separate_data_from_plot branch from 7fb293a to 839ca0c Compare May 27, 2025 15:45
Copy link
Member

@timmens timmens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very nice already. I have a few remarks.

Let me know if you have any questions; thank you!!

@r3kste
Copy link
Contributor Author

r3kste commented Jun 3, 2025

I have made the suggested changes and I believe that the failing test is unrelated.

@r3kste r3kste requested a review from timmens June 3, 2025 13:47
@r3kste
Copy link
Contributor Author

r3kste commented Jun 16, 2025

mypy is failing due to addition of type hints in criterion_plot(). I am not entirely sure how to tackle this.

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

Successfully merging this pull request may close these issues.

2 participants