[feat] Introduce fill_between as convencience function similar to errorbar - #299
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The changes are cohesive, covered by targeted tests, and the updated errorbar behavior aligns with the PR’s stated intent without introducing evident regressions.
Pull request overview
This PR adds fill_between / fill_betweenx plotting convenience wrappers to pyerrors, mirroring the existing errorbar helper, and refactors the plotting-value/error extraction logic so that errorbar no longer recomputes uncertainties for Obs that have already been analyzed.
Changes:
- Introduce
pyerrors.misc.fill_betweenandpyerrors.misc.fill_betweenxto plot uncertainty bands directly fromObssequences. - Add
_extract_plot_values/_extract_plot_datahelpers and refactorerrorbarto avoid overwriting pre-existinggamma_methodresults. - Extend tests to cover the new plotting helpers and the updated
errorbarbehavior (mixed numeric/Obs, and “don’t overwrite analyzedObs”).
File summaries
| File | Description |
|---|---|
pyerrors/misc.py |
Adds helper extraction functions, updates errorbar to avoid re-running gamma_method unnecessarily, and introduces fill_between / fill_betweenx wrappers. |
tests/misc_test.py |
Adds unit tests validating the new plotting helpers and the revised errorbar analysis behavior. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
fjosw
approved these changes
Sep 4, 2026
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.
After typing
[o.value + o.dvalue for o in y]hundreds of times, I thought that it would be nice to have thefill_betweenfunctionality built intopyerrorsin the same way aserrorbar. For completeness, I also addedfill_betweenx.To avoid duplication of code, two small helper function have been introduced.
I have realized that the old
errorbarfunction calledgamma_methodon all observables. This is not the intended behavior, I think, because it silently overwrites error estimates that could have been obtained with (non-global) parameters that had been passed to thegamma_methodbefore. The new version only computes uncertainties when they had not been computed before.