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

Fixing Interpolation Table Test Failures #367

Open daviesje opened 3 months ago

daviesje commented 3 months ago

There have been a range of added tests in v4-prep, mostly regarding the interpolation tables and mass function integrals. These tables are very accurate in the majority of bins, but there are some bins (usually near critical density or where turnover masses are extreme) where the error can rise significantly. We should examine these results and determine both a reasonable passing criteria (which may depend on the bin) and possible improvements to these integrals.

This should also involve improvements to the interpolation table for the inverse CDF of the conditional mass function (used for sampling). This is currently implemented by interpolating the CDF, however this can get unstable at the rarest masses. We should try to implement a rootfind method which is fast enough to construct this table.

In addition, the inverse CDF table is built with log-probability as it's y-axis for the initial cell sampling, and with probability as it's y-axis for progenitor sampling due to the shape of the CMF as delta approaches the critical value. This is both faster and more accurate for small timesteps but will encounter issues with larger timesteps