desihub / desisim

DESI simulations
BSD 3-Clause "New" or "Revised" License
16 stars 22 forks source link

Updates in quickquasars to reproduce actual redshift and magnitude distribution as obtained in SV for DESIY5 mocks. #569

Closed HiramHerrera closed 1 year ago

HiramHerrera commented 1 year ago

This PR adds an option to quickquasars --dn_dzdm which expects a 2D table with number of quasars by square degree by redshift and r-band magnitude bins. A default file was added: $DESISIM/py/desisim/data/dn_dzdM_EDR.fits which contains the expected distribution for Y5 based on SV results.

The procedure of this option goes as follows:

  1. Downsampling of quasars by each redshift bin to the number in the table given marginalized over magnitudes.
  2. Random assignation of r-band magnitude following a PDF obtained from dividing the number of quasars for each magnitude bin for a given redshift bin divided by the total quasars in such redshift bin.

This PR also modifies the option --extinction by moving its position in the quickquasars code, and by adding an option that rescales flux in order to mantain the magnitude distribution from the previous file.

andreufont commented 1 year ago

There were a couple of code blocks that I didn't inspect carefully, since they use functions that I'm not familiar with. Have others reviewed this? Are these new mocks much different than the previous once, in terms of quasar luminosities?

HiramHerrera commented 1 year ago

@HiramHerrera - thanks for putting together this PR. Could you also add a plot or two of the luminosity function used? It might be useful to have this together with the PR. I only asked for one change, and it is to add a warning or an error when the downsampling is requested to be larger than 1, we do not want this to silently happen without us noticing.

I'm attaching plots comparing the magnitude and redshift distributions obtained by this branch compared to Palanque-Delabrouille et al. (2015).

zdist_PDB rmagdis_PDB

Also I'm comparing the distributions from EDR mocks compared to actual data. Year 5 Mocks are assumed to follow this same distribution. zdist_fugu-all

magnitude_fugu-all

alxogm commented 1 year ago

The test that is failing is unrelated with this PR and desicode, it seems to be related with Hiram making the PR from within a fork. @sbailey are you ok with us merging this branch with this one test failing?

sbailey commented 1 year ago

@alxogm yes, that is fine. I'll let you do the actual merge when you are ready.