Skip to content

enh: show Young's modulus warnings in the plots - #250

Merged
paulmueller merged 1 commit into
DC-analysis:mainfrom
paulmueller-agent:enh/emodulus-warnings-plots
Nov 20, 2026
Merged

paulmueller merged 1 commit into
DC-analysis:mainfrom
paulmueller-agent:enh/emodulus-warnings-plots

Conversation

@paulmueller-agent

Copy link
Copy Markdown
Contributor

Closes #144

When the Young's modulus is plotted (as an axis or as feature-based marker hue), the plots now show warnings about inaccurate Young's modulus data. They are shown directly in the plots like "Please reduce KDE spacing" (red, bottom left, above that label), with a detailed description as tooltip.

Warnings

Label Condition Tooltip
87% of events outside LUT more than 10% of the (filtered) events are not covered by the look-up table (same threshold as dclab's YoungsModulusLookupTableExceededWarning) percentage and LUT identifier
Temperature out of range the temperature (from the configuration or the temp feature) is outside of the valid range of the viscosity model (dclab's TemperatureOutOfRangeWarning, known media only) dclab's warning message including the valid range, e.g. [22, 37] degC

dclab caches the Young's modulus, so its warnings are only issued when the Young's modulus is computed for the first time. Capturing them during plotting would therefore not work reliably (the labels would disappear on the next redraw). Instead, pipeline_plot_compute.get_emodulus_warnings(rtdc_ds, plot_state) deduces both conditions from the data (fraction of nan values) and by evaluating the viscosity model for the temperatures.

Implementation

  • PipelinePlotItem.add_warning_labels shows each warning once per plot item (e.g. for merged plots with several datasets). It is called by the scatter and contour handlers.
  • add_label now returns the label item (for setting the tooltip).
  • The labels are as short as "Please reduce KDE spacing", so that they fit into small subplots. A first version with "Young's modulus: ..." did not fit next to a colorbar.

Tests: tests/test_gui_pipeline_plot_compute.py (LUT exceeded, marker hue, temperature out of range, filtered events, no warnings) and test_emodulus_warning_in_plot_issue_144 (extreme_shear.rtdc, 87% of events outside the LUT; label in the scatter and the contour plot). The full test suite passes locally.

🤖 Generated with Claude Code

When the Young's modulus is plotted (axis or marker hue), the plots
show the warnings that dclab issues when computing the Young's modulus
(dclab caches the Young's modulus, so the warnings are deduced from
the data):

- "N% of events outside LUT" if more than 10% of the events are not
  covered by the look-up table
- "Temperature out of range" if the temperature is outside of the
  valid range of the viscosity model

The labels are shown like "Please reduce KDE spacing" and have the
detailed description as tooltip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.74468% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.01%. Comparing base (a441c5a) to head (6a6ff07).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
dcscope/gui/pipeline_plot_compute.py 97.14% 1 Missing ⚠️
dcscope/gui/pipeline_plot_item.py 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #250      +/-   ##
==========================================
+ Coverage   76.89%   77.01%   +0.11%     
==========================================
  Files          76       76              
  Lines        8535     8582      +47     
==========================================
+ Hits         6563     6609      +46     
- Misses       1972     1973       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@paulmueller
paulmueller merged commit 61108f3 into DC-analysis:main Nov 20, 2026
5 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.

Properly visualize warnings when the Young's modulus model is inaccurate

2 participants