21cmfast / 21cmFAST

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

[BUG][v4-prep] Runs with USE_TS_FLUCT and without USE_MASS_DEPENDENT_ZETA show different power-spectra #358

Open daviesje opened 3 months ago

daviesje commented 3 months ago

Describe the bug: Since the spin temperature code, the mass function integrals and the interpolation tables were refactored in v4-prep, there are differences in the power-spectra when we use spin temperature fluctuations. While there are differences in other parameter sets, the others can be explained by floating point differences or intentional changes. In this case, the global evolution remains the same, but the saved test data shows significantly higher power on small scales.

This is one of the cases which changed the most during the refactor of the spin temperature file. Previously it had its own loop structure for assigning heating terms, where the radius was the innermost loop. Since the structures between the cases with and without the USE_MASS_DEPENDENT_ZETA flag were very similar, they have been combined, but it is likely some factor was specific to the old model which was missed in the refactor.

To Reproduce: Steps to reproduce the behavior:

  1. Run the pytest test_integration_features.py test_power_spectra_coeval[ts_fluct_no_tables] with plots

Additional context The test plot showing differences in the lightcone power-spectra is attached below 21cmFAST.tests.test_integration_features.py--test_power_spectra_lightcone[ts_fluct_no_tables].pdf