Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4121 +/- ##
==========================================
+ Coverage 47.51% 47.74% +0.23%
==========================================
Files 141 141
Lines 29487 29682 +195
==========================================
+ Hits 14010 14172 +162
- Misses 15477 15510 +33 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
50b103f to
c5b7ace
Compare
- Updated test_confinement_time.py to replace direct function calls from the confinement_time module with method calls from the PlasmaConfinementTime class. - Adjusted the parameterized tests to reflect the new method structure. - Modified test_physics.py to call the confinement time calculation method from the confinement attribute of the physics object.
…in PlasmaConfinementTime
…Time logic for model handling
…in Physics and Stellarator classes
…d remove LABELS_CONFINEMENT_SCALINGS
d7153bb to
a90a9c5
Compare
…rison and find_other_h_factors methods to PlasmaConfinementTime class
…onfinement_time_info method in PlasmaConfinementTime class
…ndling in PlasmaConfinementTime class
…ormatting improvements
There was a problem hiding this comment.
Could you update this test to conform to the pattern we use for models in test: the model is instantiated via a fixture, not in the test body.
process/core/io/plot_proc.py
Outdated
|
|
||
| # Calculate confinement times using the scan data | ||
| iter_89p = confine.iter_89p_confinement_time( | ||
| iter_89p = PlasmaConfinementTime().iter_89p_confinement_time( |
There was a problem hiding this comment.
Can we create the model once at the start, its just a bit cleaner:
confine = PlasmaConfinementTime()
...
iter_89p = confine.iter_89p_confinement_time(...)
iter_89_0 = PlasmaConfinementTime().iter_89_0_confinement_time(...)There was a problem hiding this comment.
Your new self.confinement.calculate_double_and_triple_product needs to be added in here now because the Stellarator tests are failing
026-03-17T09:09:29.5035153Z FAILED tests/regression/test_process_input_files.py::test_input_file[helias_5b] - AssertionError: �[0;32m 2 differences: the reference MFile contains different values for some of the variables. See the warnings for a breakdown of the differences.�[0m
2026-03-17T09:09:29.5035230Z assert 2 == 0
2026-03-17T09:09:29.5035922Z + where 2 = len([MFileVariableDifference(name='nttau', ref=3.492800394738822e+21, new=0.0, percentage_change=-100.00000000000001), MFileVariableDifference(name='ntau', ref=4.894472472548276e+20, new=0.0, percentage_change=-100.0)])
| expected_ntau=2.5515877210566689e20, | ||
| expected_nTtau=3.253e21, |
There was a problem hiding this comment.
Can you make a new test for calculate_double_and_triple_product that uses this data
timothy-nunn
left a comment
There was a problem hiding this comment.
Sorry a couple more comments to add to my first review
|
|
||
| else: | ||
| raise ProcessValueError( | ||
| "Illegal value for model", |
There was a problem hiding this comment.
Can this error message be made a bit more explicit
There was a problem hiding this comment.
Actually, I suspect that this is redundant since once of the early try except blocks will catch this
| except ValueError: | ||
| raise ProcessValueError( | ||
| "Illegal value of i_rad_loss", | ||
| i_rad_loss=physics_variables.i_rad_loss, | ||
| ) from None |
There was a problem hiding this comment.
| except ValueError: | |
| raise ProcessValueError( | |
| "Illegal value of i_rad_loss", | |
| i_rad_loss=physics_variables.i_rad_loss, | |
| ) from None | |
| except ValueError as e: | |
| raise ProcessValueError( | |
| "Illegal value of i_rad_loss", | |
| i_rad_loss=physics_variables.i_rad_loss, | |
| ) from e |
| except ValueError: | ||
| raise ProcessValueError( | ||
| "Illegal value for i_confinement_time", | ||
| i_confinement_time=i_confinement_time, | ||
| ) from None |
There was a problem hiding this comment.
| except ValueError: | |
| raise ProcessValueError( | |
| "Illegal value for i_confinement_time", | |
| i_confinement_time=i_confinement_time, | |
| ) from None | |
| except ValueError as e: | |
| raise ProcessValueError( | |
| "Illegal value for i_confinement_time", | |
| i_confinement_time=i_confinement_time, | |
| ) from e |
timothy-nunn
left a comment
There was a problem hiding this comment.
Just one tiny thing
This pull request refactors how confinement time models are accessed and labeled throughout the codebase. The main improvement is the centralization of confinement time calculations and model labels into the
PlasmaConfinementTimeandConfinementTimeModelclasses, which increases code maintainability and clarity. Additionally, hardcoded label lists have been removed, and references to confinement time models are now made through well-defined class properties.Key changes:
Refactoring confinement time model access:
plot_proc.pyare now accessed via thePlasmaConfinementTimeclass, replacing the previous use of theconfinemodule. This change standardizes how these models are instantiated and used.Centralizing and improving model labeling:
LABELS_CONFINEMENT_SCALINGSlist has been removed fromphysics_variables.py, and references to confinement time model labels inplot_proc.pyare now made through theConfinementTimeModelclass'sfull_nameproperty. This ensures label consistency and reduces duplication.Initialization and dependency injection improvements:
PlasmaConfinementTimeclass is now instantiated and injected as a dependency into thePhysicsclass inmain.py, making it easier to manage and test.API updates for downstream usage:
calculate_confinement_timemethod in the stellarator model is now accessed viaself.physics.confinement, reflecting the new structure for confinement time calculations.Documentation and cleanup:
i_confinement_timeinphysics_variables.pyhas been updated to remove references to the deleted label list, reflecting the new approach to model labeling.## DescriptionChecklist
I confirm that I have completed the following checks: