Skip to content

Fixes GriddedScenario to allow single grid point (i.e., only scenario model) for a certain error type#898

Open
wahln wants to merge 3 commits into
devfrom
bugfix/scenario_gridpoints
Open

Fixes GriddedScenario to allow single grid point (i.e., only scenario model) for a certain error type#898
wahln wants to merge 3 commits into
devfrom
bugfix/scenario_gridpoints

Conversation

@wahln
Copy link
Copy Markdown
Contributor

@wahln wahln commented Mar 26, 2026

This pull request refactors and improves the handling of grid points and scenario combinations in the gridded scenario classes, especially for worst-case scenarios. It allows to set the number of grid points to 1, which then reduces to only the nominal scenario for the corresponding error type. Additionally, new tests are added to verify the correct behavior of grid point assignments.

Enhancements to grid point handling and validation:

  • Added custom setter methods for numOfSetupGridPoints and numOfRangeGridPoints in matRad_WorstCaseScenarios to enforce that only 1 or 3 are valid values, with clear error messages for invalid assignments.
  • Updated property declarations in both matRad_GriddedScenariosAbstract and matRad_WorstCaseScenarios to use MATLAB's property syntax without semicolons, improving style consistency. [1] [2]

Improvements to scenario grid generation logic:

  • Refactored the setup and range shift grid generation in matRad_GriddedScenariosAbstract to explicitly handle the case where only one grid point is used (assigning zero shift and using the nominal scenario properties), and removed commented-out legacy code. [1] [2]

Testing improvements:

  • Added a new test, test_worstCaseScenarioGridPoints, to verify correct scenario counts and to ensure that invalid grid point assignments throw appropriate errors.

General code cleanup and documentation:

  • Improved comments and error messages for clarity and consistency, and removed unused/commented-out code sections. [1] [2] [3]
  • Minor whitespace and formatting cleanups in test files. [1] [2]

…nts is 1, which will reduce to the nominal scenario in this dimension. Also provides corresponding tests for this case
@wahln wahln requested a review from remocristoforetti March 26, 2026 17:29
@wahln wahln self-assigned this Mar 26, 2026
@wahln wahln added the bug label Mar 26, 2026
@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented Mar 26, 2026

Documentation build overview

📚 matRad | 🛠️ Build #32546500 | 📁 Comparing d57d645 against latest (c014dc8)

  🔍 Preview build  

35 files changed · + 1 added · ± 34 modified

+ Added

± Modified

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 26, 2026

Codecov Report

❌ Patch coverage is 90.83333% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.86%. Comparing base (adf48b0) to head (d57d645).

Files with missing lines Patch % Lines
matRad/scenarios/matRad_ScenarioModel.m 76.92% 9 Missing ⚠️
matRad/scenarios/matRad_GriddedScenariosAbstract.m 97.10% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #898      +/-   ##
==========================================
+ Coverage   54.80%   54.86%   +0.05%     
==========================================
  Files         320      320              
  Lines       20548    20552       +4     
==========================================
+ Hits        11261    11275      +14     
+ Misses       9287     9277      -10     

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 26, 2026

Test Results

    3 files  ±0      3 suites  ±0   29m 53s ⏱️ - 1m 59s
  360 tests +3    356 ✅  - 1  0 💤 ±0  4 ❌ +4 
1 176 runs  +9  1 167 ✅ +5  5 💤 ±0  4 ❌ +4 

For more details on these failures, see this check.

Results for commit d57d645. ± Comparison against base commit adf48b0.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

This PR was automatically marked as stale it has been open 30 days with no activity. Please review/update/merge this PR.

@github-actions github-actions Bot added stale Automatic label for stale issues and removed stale Automatic label for stale issues labels May 1, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

Code Coverage

Package Line Rate Health
coverage Package 1 55%
Summary 55% (11274 / 20552)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant