You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When generating an image with a large number of stars (from an external catalog) I occasionally get the condition
counts - counts_so_far being less than zero, which causes a crash.
A workaround that at least allows the code to continue is to replace this line with:
Thanks Michael. Are these stars very bright? I guess in retrospect I can imagine that since the galsim image is floats, then I cast to an integer, and that leads counts_so_far to be too large, and then this goes negative, maybe? It feels like that cast can only go wrong for very large floats, though, where we're talking about injecting about injecting millions of counts.
Obviously your suggestion will resolve the issue, but I'd like to make sure that I understand whether it's masking some other underlying problem or if this is "just" floating point roundoff.
There also must be issues when the number of photons being simulated doesn't cast well to an i4. Maybe the most straightforward approach if that ends up being the issue would be to replace counts -> np.clip(counts, 2**31 - 1).astype('i4') at the beginning.
Line 291 in l1.py:
read = rng_numpy.binomial((counts - counts_so_far).astype('i4'), p)
When generating an image with a large number of stars (from an external catalog) I occasionally get the condition
counts - counts_so_far being less than zero, which causes a crash.
A workaround that at least allows the code to continue is to replace this line with:
Michael Albrow
The text was updated successfully, but these errors were encountered: