Skip to content

Add signal-decomposition degradation analysis#518

Open
bmeyers wants to merge 22 commits into
masterfrom
sigdecomp
Open

Add signal-decomposition degradation analysis#518
bmeyers wants to merge 22 commits into
masterfrom
sigdecomp

Conversation

@bmeyers

@bmeyers bmeyers commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Ports the CVXPY seasonal-trend decomposition prototype into a new
rdtools.signal_decomposition module and wires it end-to-end through
TrendAnalysis.

New module (rdtools/signal_decomposition.py):

  • Public degradation() entry point returning (Rd_pct, Rd_CI, sd_trend_results)
  • Three trend types: linear, pwl, monotone
  • Four loss functions: l2, l1, huber, quantile
  • Missing data handled natively via masked equality constraint
  • Stability analysis: analyze_fit_stability, get_valid_endpoints, plot_stability
  • Plotting/display: plot_decomposition, animate_degradation, format_degradation_report
  • log_transform path via extract_degradation_rate_log

TrendAnalysis wiring (rdtools/analysis_chains.py):

  • _signal_decomposition_degradation private method
  • sensor_analysis / clearsky_analysis accept 'signal_decomposition' in analyses
    list and sd_kwargs passthrough
  • plot_signal_decomposition_summary method

Dependencies:

  • cvxpy >= 1.7.5 and spcqe >= 0.3.0 added as hard runtime dependencies
  • scipy floor raised from 1.8.1 to 1.13.0 (required by cvxpy's transitive deps)
  • cvxpy and spcqe excluded from check_dependencies.py min-pin enforcement
    (their transitive scipy requirement is incompatible with pinning an exact
    lower-bound version alongside scipy==1.13.0 on Python 3.10)

Tests and docs:

  • rdtools/test/signal_decomposition_test.py (29 tests)

  • Additions to analysis_chains_test.py (fixtures, plot tests, bad-case coverage)

  • api.rst updated with Signal Decomposition section and new TrendAnalysis method

  • Code changes are covered by tests

  • Code changes have been evaluated for compatibility/integration with TrendAnalysis

  • [ ] New functions added to __init__.py
    We are intentionally not doing this. The new function should be imported as rdtools.signal_decomposition.degradation / from rdtools.signal_decomposition import degradation to avoid clashes with the rdtools.degradation module.

  • API.rst is up to date, along with other sphinx docs pages

  • Example notebooks are rerun and differences in results scrutinized

  • Updated changelog

martin-springer and others added 11 commits July 14, 2026 17:15
Ports the CVXPY seasonal-trend decomposition prototype into a new
rdtools.signal_decomposition module and wires it end-to-end through
TrendAnalysis.

New module (rdtools/signal_decomposition.py):
- Public degradation() entry point returning (Rd_pct, Rd_CI, sd_trend_results)
- Three trend types: linear, pwl, monotone
- Four loss functions: l2, l1, huber, quantile
- Missing data handled natively via masked equality constraint
- Stability analysis: analyze_fit_stability, get_valid_endpoints, plot_stability
- Plotting/display: plot_decomposition, animate_degradation, format_degradation_report
- log_transform path via extract_degradation_rate_log

TrendAnalysis wiring (rdtools/analysis_chains.py):
- _signal_decomposition_degradation private method
- sensor_analysis / clearsky_analysis accept 'signal_decomposition' in analyses
  list and sd_kwargs passthrough
- plot_signal_decomposition_summary method

Dependencies:
- cvxpy >= 1.7.5 and spcqe >= 0.3.0 added as hard runtime dependencies
- scipy floor raised from 1.8.1 to 1.13.0 (required by cvxpy's transitive deps)
- cvxpy and spcqe excluded from check_dependencies.py min-pin enforcement
  (their transitive scipy requirement is incompatible with pinning an exact
  lower-bound version alongside scipy==1.13.0 on Python 3.10)

Tests and docs:
- rdtools/test/signal_decomposition_test.py (29 tests)
- Additions to analysis_chains_test.py (fixtures, plot tests, bad-case coverage)
- api.rst updated with Signal Decomposition section and new TrendAnalysis method
@bmeyers

bmeyers commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator Author

Just finishing up examples and package dependency testing. Ready for general review. Open item: minimum scipy version support.

bmeyers added 7 commits July 15, 2026 14:12
…repeated calls to analysis_chains.TrendAnalysis.sensor_analysis
analyze_fit_stability and animate_degradation both call
make_problem(y_full[:n], **make_problem_kwargs). When callers pass
sd_trend_results['args'] directly (which includes 'y' because _get_kwargs
captures the full make_problem signature), this caused a "multiple values
for argument 'y'" TypeError. Strip 'y' from the dict at the top of each
function so passing args through is always safe.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.02817% with 156 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.45%. Comparing base (b5eb6e2) to head (84267c0).

Files with missing lines Patch % Lines
rdtools/signal_decomposition.py 71.24% 132 Missing ⚠️
rdtools/degradation.py 84.55% 21 Missing ⚠️
rdtools/plotting.py 95.31% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #518      +/-   ##
==========================================
- Coverage   96.79%   92.45%   -4.34%     
==========================================
  Files          12       13       +1     
  Lines        2342     3050     +708     
==========================================
+ Hits         2267     2820     +553     
- Misses         75      230     +155     

☔ 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.

bmeyers added 3 commits July 16, 2026 12:38
dict of CI arrays rather than a single [lo, hi] for the overall rate.
degradation() merges these into sd_trend_results as ci_<rate_key>
entries, giving ci_rate_pre/post_pct_yr for pwl and ci_rate_yearly_pct_yr
(shape 2×n_years) for monotone. Rd_CI is unchanged.
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