Refactor Generic Plot to Dispatch to Specialized Plotters#268
Open
abdelghanibelgaid wants to merge 2 commits into
Open
Refactor Generic Plot to Dispatch to Specialized Plotters#268abdelghanibelgaid wants to merge 2 commits into
abdelghanibelgaid wants to merge 2 commits into
Conversation
|
|
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #233.
This PR refactors the plotting call structure so that the generic
plot()function acts as a dispatcher, while result-specific plotting logic is owned by the specialized plotting functions.Previously, specialized plotting functions such as
plot_lambda()andplot_logical_error_probability_per_round()delegated back to the genericplot()implementation. This inverted the intended responsibility: the generic function contained rendering logic, while the specialized functions mainly prepared/interpolated data.After this change:
plot()only dispatches based on result type.plot_lambda()owns Lambda-specific rendering.plot_logical_error_probability_per_round()owns LEPPR-specific rendering.Motivation
The goal is to make the plotting API easier to maintain and extend.
The generic
plot()function should provide a convenient high-level entry point, but it should not contain result-specific rendering details. Moving that logic into the specialized functions keeps responsibilities clearer and makes future plotting extensions easier to implement.Files changed
deltakit-explorer/src/deltakit_explorer/plotting/plotting.pyplot()into a pure dispatcher.LambdaResulttoplot_lambda().LogicalErrorProbabilityPerRoundResulttoplot_logical_error_probability_per_round().deltakit-explorer/src/deltakit_explorer/plotting/_lambda.pyLambdaDataand already-interpolatedLambdaResult.plot_lambda()when raw Lambda data is passed.deltakit-explorer/src/deltakit_explorer/plotting/_leppr.pyLogicalErrorProbabilityPerRoundDataand already-interpolatedLogicalErrorProbabilityPerRoundResult.deltakit-explorer/src/deltakit_explorer/plotting/_utils.pyFigureandAxesobjects.fig/axvalidation logic across plotters.deltakit-explorer/tests/plotting/test_results_and_plot.pyplot()dispatches to the correct specialized plotter.Technical changes
plot().fig,ax, andtitlearguments.Validation
Notes
This PR is intended as a focused refactor for #233 and does not aim to change the user-facing plotting API.