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 rerunning redrock the qos-qn afterburner runs the HIZ and LOZ templates separately due to the way RR accepts priors. The intention in the code is to then compare the two results in the overlap region, and keep the one with the lower chi^2 (this is normally done internally in redrock).
When running the two templates separately the afterburner initializes global variables:
When aggregating the output the results are compared to the global variables, and if the fit has a better chi^2 than the globally stored chi^2 variable the fit is accepted and updated in the global variables:
However, the loop neglects to update the global chi2 variable, so line 253 above is always comparing against np.inf * np.ones(targetid.size) as initialized in line 198. The effect of this is that since the HIZ templates are run after the LOZ templates the HIZ results will always overwrite the LOZ results in the overlap region, regardless of whether the fit is better or at a different redshift than the LOZ templates.
This is probably a one line fix, adding
chi2[best_chi2] =chi2_tmp[best_chi2_tmp]
to update the global chi2 variable. after L256 should solve this issue, although validating this might take a little bit of effort. Reminder that the overlap region is 1.4 < z < 1.6.
The text was updated successfully, but these errors were encountered:
Good catch. An arguably better long term solution is to update rrdesi --templates to accept more than one template. Then the afterburner can call Redrock once, let Redrock sort out which HIZ/LOZ is best by its standard algorithm, and then the after burner just uses that. It feels like a lot of the complication / fragility here is that rrdesi currently does not allow you to specify more than one template unless you give it a full directory worth of templates (which then brings in templates that the afterburner doesn't want to use).
When rerunning redrock the qos-qn afterburner runs the HIZ and LOZ templates separately due to the way RR accepts priors. The intention in the code is to then compare the two results in the overlap region, and keep the one with the lower chi^2 (this is normally done internally in redrock).
When running the two templates separately the afterburner initializes global variables:
desispec/py/desispec/scripts/qsoqn.py
Line 198 in e9ac854
When aggregating the output the results are compared to the global variables, and if the fit has a better chi^2 than the globally stored chi^2 variable the fit is accepted and updated in the global variables:
desispec/py/desispec/scripts/qsoqn.py
Lines 251 to 256 in e9ac854
However, the loop neglects to update the global chi2 variable, so line 253 above is always comparing against
np.inf * np.ones(targetid.size)
as initialized in line 198. The effect of this is that since the HIZ templates are run after the LOZ templates the HIZ results will always overwrite the LOZ results in the overlap region, regardless of whether the fit is better or at a different redshift than the LOZ templates.This is probably a one line fix, adding
to update the global chi2 variable. after L256 should solve this issue, although validating this might take a little bit of effort. Reminder that the overlap region is 1.4 < z < 1.6.
The text was updated successfully, but these errors were encountered: