Closed BradGreig closed 1 year ago
Oh, I forgot to say that you need to update the CHANGELOG
Tests are failing due to a compilation error from a missing {
, so that should be easy to fix.
I've made some updates to the code. I noted that the original usage of floats could cause issues on the periodic boundary conditions when re-distributing the mass over neighbouring cells. Upon replacement of this with doubles, the spike in the density PDF at overdensities of -1 has gone away as shown here here. Everything else has remained relatively unchanged.
Updating this double/float issue and correctly applying omp atomic statements has resolved almost all issues with the tests. One remaining test fail, which I haven't yet properly looked into. Though not immediately obvious why it is failing...
Hey @steven-murray I've established why that one test is failing. The relative tolerance is too high, causing it to fail. Changing rtol from the default 1e-5 to 1e-4 seems to alleviate the issue.
Under it's current state the main culprit is T_S, with 4961 cell fails. For T_k and x_e it's only 5 and 2.
In terms of an actual change to the numbers the failures on T_S are at the fourth/fifth decimal place. E.g. 26.2885 compared to 26.29 (this is one of the largest variants). In terms of a fractional change, this is < 0.01%.
Why this has now appeared I am not so sure. And I'm a little uncomfortable about it. Possibly the change to the density field may have amplified some rounding issues in the density field. And/or maybe there are larger variations in the density field owing to a broader distribution of possible densities. I'm not sure how much digging this requires, or whether it is comfortable enough just to raise the relative tolerance...
Hey @steven-murray @andreimesinger, in order to get the final test to pass I had to reduce the relative tolerance for that test data (see my comments above).
This PR now also includes a modification following #305. Changelog has been updated to reflect these changes.
Base: 86.54% // Head: 86.53% // Decreases project coverage by -0.00%
:warning:
Coverage data is based on head (
98f81a7
) compared to base (9e0a81b
). Patch has no changes to coverable lines.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
Thanks @BradGreig, and apologies for the slow response on this (I'm out at the Global 21cm Workshop this week). I'm a little uncomfortable with the tolerance change as well. I mean, the different is still very small, and it probably not a problem, but it bugs me that there's any difference at all. There shouldn't be essentially any randomness, right?
I think I'm happy for us to merge this, because it's not an urgent/significant problem, but I'd feel happier if we made an issue to remind ourselves to look into it a bit further.
What is the hold-up for merging this?
This is a PR to fix an issue with the statistics of the perturbed density field as pointed out by @rajeshmondal18.
Previously, when calculating the perturbed density, all the mass of a perturbed cell was placed into a single cell. This features replaces this step with an implementation of cloud in cell to re-distribute the mass over the 8 neighbouring cells based on their distance from the centre of the perturbed cell.
This removes spiky features from the density field PDF and corresponding oscillatory features from the velocity PDF. The linear/log PDF of the density and velocity fields highlighting the issue are shown here while following this fix the correspond PDFs remove the sharp/oscillatory features.
Comparing the light-cones appears to show very little difference (see here). Reionisation histories and global signals remain unaffected. Looking at the 21-cm PS across the light-cone the largest differences occur at increasing z on the smallest scales. This difference is due to the fact that the previous implementation over estimated the small-scale power at increasing z. However, in all inference work, the thermal noise completely dominates at these scales and thus previous results should remain unaffected.
All test-data will need to be updated as a result of this fix.
I suspect this issue arose due to the
PERTURB_ON_HIGH_RES
option. The previous approach to just move all the mass into the new cell would work when perturbing directory onto theHII_DIM
box. But since we now have the option to perturb directly onto theDIM
box, the resolution difference would have amplified the effect.