Skip to content

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

Merged
wahln merged 5 commits into
devfrom
bugfix/scenario_gridpoints
Jun 3, 2026
Merged

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

Conversation

@wahln

@wahln wahln commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

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

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

Copy link
Copy Markdown

Documentation build overview

📚 matRad | 🛠️ Build #32971040 | 📁 Comparing b9f6671 against latest (c014dc8)

  🔍 Preview build  

36 files changed · + 1 added · ± 35 modified

+ Added

± Modified

@codecov

codecov Bot commented Mar 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.83333% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.02%. Comparing base (174e756) to head (b9f6671).

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.96%   55.02%   +0.06%     
==========================================
  Files         322      322              
  Lines       20618    20622       +4     
==========================================
+ Hits        11333    11348      +15     
+ Misses       9285     9274      -11     

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

@github-actions

github-actions Bot commented Mar 26, 2026

Copy link
Copy Markdown

Test Results

    3 files  ±0      3 suites  ±0   32m 22s ⏱️ +10s
  370 tests +3    370 ✅ +3  0 💤 ±0  0 ❌ ±0 
1 206 runs  +9  1 201 ✅ +9  5 💤 ±0  0 ❌ ±0 

Results for commit b9f6671. ± Comparison against base commit 174e756.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

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

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

Code Coverage

Package Line Rate Health
coverage Package 1 55%
Summary 55% (11347 / 20622)

@wahln wahln merged commit 3c87b71 into dev Jun 3, 2026
18 checks passed
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