Expand fitted temperature range of impurities - #4521
Conversation
f233594 to
24adec2
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4521 +/- ##
==========================================
+ Coverage 49.43% 49.46% +0.03%
==========================================
Files 150 150
Lines 29880 29912 +32
==========================================
+ Hits 14771 14797 +26
- Misses 15109 15115 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
5ffc809 to
a91ba5e
Compare
| @@ -54,7 +54,7 @@ class ImpurityRadiationData: | |||
| ) | |||
|
|
|||
| n_charge_impurity_profile: list[float] = field( | |||
| default_factory=lambda: np.zeros((N_IMPURITIES, 200)) | |||
| default_factory=lambda: np.zeros((N_IMPURITIES, 600)) | |||
There was a problem hiding this comment.
Could we make 600 a constant at the top of this file?
|
Requesting modeller review to confirm changes to unit tests and regression tests are acceptable |
As long as you can confirm you have checked that Lz and are the close to the old values for the old temperature range I don't there will be a problem. I find the high value of Lz for Fe below 1 eV surprising, but since we never use temperatures below 1 eV, and we never use Fe, this is hardly an issue. |
|
@mkovari here is a plot of the old data and new data (only the new data on the old time range). There is very little difference. |
| @@ -31,7 +34,8 @@ def initialise_imprad(data: DataStructure): | |||
| """ | |||
| errorflag = 0 | |||
|
|
|||
| table_length = 200 # Number of temperature and Lz values in data file | |||
| # Number of temperature and Lz values in data file | |||
| table_length = N_IMPURITIY_LOSS_FUNCTION_POINTS | |||
There was a problem hiding this comment.
I agree with Tim's comment here - instead of having table_length = N_IMPURITIY_LOSS_FUNCTION_POINTS and then setting len_tab=table_length in all the calls to init_imp_element(), you can use len_tab=N_IMPURITIY_LOSS_FUNCTION_POINTS instead
| if Path(data_folder).is_dir(): | ||
| fig, ax = plt.subplots(figsize=(8, 6)) | ||
| plot_line_brem_loss_function_profile(ax, impp=data_folder) | ||
| else: |
There was a problem hiding this comment.
I don't think this else will ever be hit. Ik this if/else comes from summary.py so I think this was just super outdated and doesn't work as intended any more:
resources.path() returns a pathlib.Path object, so imp_path is always a path to Ar_lz_tau.dat, and then data_folder is always pointing to the lz_non_corona_14_elements folder, so Path(data_folder).is_dir() is always True, so it will never hit this else
I tried to hit the else - by deleting the lz_non_corona_14_elements folder, deleting all the entries in this folder, deleting some of the entries in this folder - but always end up with a FileNotFoundError or ModuleNotFoundError.
I think that removing the if/else and instead just calling the plotting function here and in summary.py will work the same, and if any .dat files are missing then that will be covered by the FileNotFoundErrors
… 200 to 600 to accommodate larger datasets. Updated relevant initialisation parameters in `impurity_radiation_variables.py` and `impurity_radiation.py`.
…date documentation
- Introduced `impurity_loss_functions.py` to plot Line and Bremsstrahlung loss function profiles.
- Updated the electron density in plasma radiation documentation from \(10^{19} \text{m}^{-3}\) to \(10^{20} \text{m}^{-3}\).
- Increased the source data points from 200 to 600 and adjusted the fitted temperature range.
…etter visualization
…s function points and update related calculations
Co-authored-by: clmould <86794332+clmould@users.noreply.github.com>
ecd167c to
d48efdd
Compare
* Increase array dimensions for impurity radiation data structures from 200 to 600 to accommodate larger datasets. Updated relevant initialisation parameters in `impurity_radiation_variables.py` and `impurity_radiation.py`. * Add plotting script for total impurity radiation loss function and update documentation - Introduced `impurity_loss_functions.py` to plot Line and Bremsstrahlung loss function profiles. - Updated the electron density in plasma radiation documentation from . - Increased the source data points from 200 to 600 and adjusted the fitted temperature range. * Update expected values in unit tests for impurity radiation calculations * Enhance impurity loss function plotting with varied line styles for better visualization * Refactor impurity radiation data structures to use a constant for loss function points and update related calculations * Update documentation/source/physics-models/plasma_radiation.md Co-authored-by: clmould <86794332+clmould@users.noreply.github.com> * Fix impurity path error catching * use N_IMPURITIY_LOSS_FUNCTION_POINTS directly instead of `table_length` alias * Remove redundant assignment to impurity path --------- Co-authored-by: clmould <86794332+clmould@users.noreply.github.com>
* Increase array dimensions for impurity radiation data structures from 200 to 600 to accommodate larger datasets. Updated relevant initialisation parameters in `impurity_radiation_variables.py` and `impurity_radiation.py`. * Add plotting script for total impurity radiation loss function and update documentation - Introduced `impurity_loss_functions.py` to plot Line and Bremsstrahlung loss function profiles. - Updated the electron density in plasma radiation documentation from 10^19 10^20. - Increased the source data points from 200 to 600 and adjusted the fitted temperature range. * Update expected values in unit tests for impurity radiation calculations * Enhance impurity loss function plotting with varied line styles for better visualization * Refactor impurity radiation data structures to use a constant for loss function points and update related calculations * Update documentation/source/physics-models/plasma_radiation.md * Fix impurity path error catching * use N_IMPURITIY_LOSS_FUNCTION_POINTS directly instead of `table_length` alias * Remove redundant assignment to impurity path --------- Co-authored-by: Christopher Ashe <91618944+chris-ashe@users.noreply.github.com>

Description
Updates the loss function data for impurities to comprise of 600 elements from 0.25 eV up to 500 keV
Checklist
I confirm that I have completed the following checks: