21cmfast / 21cmFAST

Official repository for 21cmFAST: a code for generating fast simulations of the cosmological 21cm signal
MIT License
58 stars 38 forks source link

Reading compatibility #425

Closed daviesje closed 2 months ago

daviesje commented 2 months ago

There is currently a behaviour in global_params.use() which, unlike other parameter structures, raises an error when a keyword not in the parameter set is passed. This made it impossible to read in boxes from different versions that had differing parameters. I've made it behave like the other parameter sets now, which simply send out a warning.

However, to keep things safer, I've added a flag to the high-level output reading functions which ensure that all the parameters are there, if the flag is on and the parameters are mismatched it raises an error. if the flag is off it emits a warning detailing which parameters are missing / extra.

Tests have also been written to ensure the desired behaviour.

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 92.30769% with 2 lines in your changes missing coverage. Please review.

Project coverage is 82.23%. Comparing base (2414803) to head (6f1ab6b). Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
src/py21cmfast/cache_tools.py 66.66% 1 Missing :warning:
src/py21cmfast/outputs.py 95.23% 0 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #425 +/- ## ========================================== + Coverage 82.19% 82.23% +0.04% ========================================== Files 13 13 Lines 3140 3153 +13 Branches 854 861 +7 ========================================== + Hits 2581 2593 +12 Misses 400 400 - Partials 159 160 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.