desihub / desispec

DESI spectral pipeline
BSD 3-Clause "New" or "Revised" License
33 stars 24 forks source link

Add necessary code to run linear QuasarNET #2230

Closed dylanagreen closed 2 months ago

dylanagreen commented 2 months ago

This PR makes the necessary changes to run the linear version of QuasarNET rather than the logarithmic. The code will automatically determine whether to use the linear grid or not by checking if the word "linear" appears in the weights file name.

This means that script is backwards compatible, such that if the environment variable $QN_MODEL_FILE is set to the old weights file (at science/lya/qn_models/boss_dr12/qn_train_coadd_indtrain_0_0_boss10.h5) then this script should reproduce previous results. Also unchanged is the default weights file, if no QN_MODEL_FILE is provided qsoqn.py will still load the old weights file by default. I am not opposed to changing this.

The new linear QuasarNET weights file is now located at science/lya/qn_models/desi/qn_train_desi_guadalupe_linear.h5. In order to use the new weights file, $QN_MODEL_FILE should be set to the new location.

I've never run QuasarNET through the afterburner before so I'm unsure exactly the best way to run and test this. In my tests on QuasarNET alone, only ~1.3% of exposures changed classification when using the new weights file versus the old one. It is likely sufficient to pick a few quasar heavy files, run qsoqn.py with both the old and new weights file, and check if there are any significant differences in classification and redshift.

Note that this code requires QuasarNP 0.1.6.