-
Notifications
You must be signed in to change notification settings - Fork 17
Consolidate plot_irf plotting logic into unified container function #174
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
base: combine_plots
Are you sure you want to change the base?
Conversation
Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot There should be only
One irf container plotting function combining the logic from plot irf and plot irf!
thorek1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot There should be only one irf container plotting function combining the logic from plot_irf and plot_irf!
Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
Done! I've consolidated the plotting logic into a single Changes in commit 3e5aae1:
The structure now matches plot_solution exactly - one main container function that checks |
thorek1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot combjne the logic for a single irf plot and multiple irf plots instead of doing if else on the length of the container
Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
Done! I've unified the plotting logic by removing the main if/else branching on container length. Changes in commit 05a52f1:
The structure now:
|
The plotting code for
plot_irfandplot_irf!was duplicated across ~500 lines. This refactoring consolidates the logic into a single container function with unified plotting logic that handles both single and multiple IRF plots.Changes
_plot_irf_from_container: Single consolidated function with unified plotting loop that handles both simple and comparison/stacking casesplot_irf: Removed ~100 lines of inline plotting code, now delegates to_plot_irf_from_containerplot_irf!: Removed ~460 lines of inline plotting code, now delegates to_plot_irf_from_containerImpact
Implementation
The consolidated
_plot_irf_from_containerfunction uses a unified plotting approach:joint_shocksandjoint_variables, iterates over them regardless of container countKey difference from typical container patterns: Instead of separate code branches for single vs multiple cases, the logic is unified with minimal conditional checks embedded only where needed.
Example
Both cases now use the same plotting loop internally, with conditional logic only where behavior differs.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.