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
Flux bug fix in quicktransients simulator #541
Conversation
Note: the failing check in travis seems related to astropy. |
@moustakas could you vet the usage of redshift here? If I understand correctly, this change means that the truth table redshifts are never used for quicktransients, which isn't obviously right to me (vs. fixing why using those redshifts for BGS hosts was resulting in zero flux spectra). I'm checking on the Travis astropy failures; we're pinning the astropy version to 2.0.16 (or at least trying to...) and that version with this branch passes at NERSC, so it isn't yet clear to me what changed at Travis. |
I'll review when I can but I'm focused on DR9 right now. |
@sbailey, I'm certain the truth table redshifts are used correctly in the transients simulation because the generated template spectra are sampled and added in the host rest frame and then the summed template is returned in the observer frame. The redshift argument described here is an array passed to desisim.simexp.simulate_spectra. The values are used to adjust the half-light radii of targets during the simulation (line 558 of desisim.simexp.py) of BGS spectra. That's why they're not applied to other galaxy types. It seems like a few percent of the time the size adjustment produces a divide-by-zero during the spectrum generation. I didn't understand why and instead opted to set |
I looked into it and what's happening is:
The quicktransients script is using the default instrument settings in specsim, which means it's using fastsim. Maybe that is not compatible with the I noticed that quickspectra does not pass a redshift array to |
Thank for digging into this @sybenzvi . It looks like the fundamental issue is that specsim fastsim allows the fiber acceptance fraction to go to zero instead of just a very small number. This could be fixed in specsim, or worked around in desisim by capping the size of the galaxies it considers. I'm not sure if it properly tracks the total flux for galaxies that become gigantinormous either. It should be more correct for the host galaxy sims to use the truth redshift than for them to not use it, and I think FWIW, the travis problem was that recent healpy is incompatible with old astropy=2.x, but its dependencies don't list that correctly so Travis was installing an version of healpy that was incompatible to our pinned astropy=2.x. We're working on upgrading our full stack to astropy=4.x, but don't have the full suite working yet to then upgrade the tests too (goal is to go through one set of tags+software release that supports both astropy=2 py=3.6 and astropy=4 py=3.8 and then deprecate support for the old versions). |
@sbailey, I realized that I never checked if the zero flux issue also depends on observing conditions. I always simulated objects with 1.1 arcsec seeing. Before committing to one solution we should cap the angular size of objects in |
Fixed bug where a small number of spectra generated with quicktransients had zero flux. It was due to a mistake in quicktransients.py; an incorrect redshift argument was being passed to sim_spectra. Fixes issue #540.
While poking around in quicktransients.py, did some additional cleanup: