-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] NaNs in brightness_temp #400
Comments
Thanks @Kojobu for the detailed report. I will try to reproduce. |
I have reproduced the issue with the given script, thank you! Actually, with those parameters I do get NaNs, but only two of them (not 5). I turned on I have not dug any deeper at this point. I wonder if @daviesje might be able to help here as well. |
@steven-murray I'm not 100% sure if this is the issue, but something I've encountered before is that the density field can contain values of exactly -1. See 21cmFAST/src/py21cmfast/src/PerturbField.c Lines 595 to 597 in aefc273
Since there's a strict inequality in the conditional, it can miss some values. Also later on in the same file: 21cmFAST/src/py21cmfast/src/PerturbField.c Lines 654 to 660 in aefc273
Density of -1 results in kinetic temperature being zero, and spin temperature being NaN. In |
Sounds good, thanks @daviesje. I'll go and implement those changes, and see if it fixes the problem |
Hmmm, this didn't seem to fix the problem. |
Describe the bug:
When running the simulator with a specific set of parameters, there are singular NaN values. When slightly alternating one of the parameters, the NaNs disappear. Furthermore, the NaN values are exactly the HII_DIM size away from each other in the z dimension.
E.g. the minimal working example from below yields NaNs at
Note, that this issue does not occur if USE_TS_FLUCT is set to false.
To Reproduce:
Please note that the brightness_temp does not look physical due to NO_RNG = True. It is only set to True for the minimal working example given above. This is a necessary condition to reproduce the error. Although setting the random_seed argument, the brightness_map will differ from run to run if NO_RNG = False.
Furthermore, the crash parameters are not unique. There are other combinations for which the error occurs. They may differ radically and show no obvious coherence.
Expected behavior:
A brightness map without NaNs or at least a warning that this particular choice of parameters causes trouble.
Details:
OS: Linux (behavior is reproducible on local hardware and cluster)
Python version: 3.12.2 and 3.11.2
Package version: pip version from pypi
Additional context
The error occurs during MCMC inference. Each step, the four astro parameters are sampled uniformly and the simulator is called as a sample from the likelihood. The ranges from which the parameters were sampled are:
The text was updated successfully, but these errors were encountered: