Skip to content

[feat] Introduce fill_between as convencience function similar to errorbar - #299

Merged
fjosw merged 3 commits into
fjosw:developfrom
s-kuberski:feat/fill_between
Sep 4, 2026
Merged

[feat] Introduce fill_between as convencience function similar to errorbar#299
fjosw merged 3 commits into
fjosw:developfrom
s-kuberski:feat/fill_between

Conversation

@s-kuberski

Copy link
Copy Markdown
Collaborator

After typing [o.value + o.dvalue for o in y] hundreds of times, I thought that it would be nice to have the fill_between functionality built into pyerrors in the same way as errorbar. For completeness, I also added fill_betweenx.

To avoid duplication of code, two small helper function have been introduced.

I have realized that the old errorbar function called gamma_method on 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 the gamma_method before. The new version only computes uncertainties when they had not been computed before.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 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_between and pyerrors.misc.fill_betweenx to plot uncertainty bands directly from Obs sequences.
  • Add _extract_plot_values / _extract_plot_data helpers and refactor errorbar to avoid overwriting pre-existing gamma_method results.
  • Extend tests to cover the new plotting helpers and the updated errorbar behavior (mixed numeric/Obs, and “don’t overwrite analyzed Obs”).
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
fjosw merged commit e288e9d into fjosw:develop Sep 4, 2026
11 checks passed
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.

3 participants