desihub / desisim

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

quickcat coefficients need to be updated #355

Closed moustakas closed 6 years ago

moustakas commented 6 years ago

The coefficients in desisim/bin/quickcat haven't been updated in more than two years, since the redmonster + zdc1 era. We desperately need to do this update so that quicksurvey can use our latest and greatest simulation inputs / outputs (see also https://github.com/desihub/desitarget/pull/307).

moustakas commented 6 years ago

@londumas Do you by chance have any of these coefficients handy (I can update the code)? (Note: we also need the redshift success rate as a function of observing conditions and apparent magnitude.)

#- redshift errors and zwarn fractions from DESI-1657
#- sigmav = c sigmaz / (1+z)
_sigma_v = {
    'ELG': 19.,
    'LRG': 40.,
    'BGS': 13.,
    'QSO': 423.,
    'STAR': 18.,
    'SKY': 9999,      #- meaningless
    'UNKNOWN': 9999,  #- meaningless
}

_zwarn_fraction = {
    'ELG': 0.14,       # 1 - 4303/5000
    'LRG': 0.015,      # 1 - 4921/5000
    'QSO': 0.18,       # 1 - 4094/5000
    'BGS': 0.01,
    'STAR': 0.05,
    'SKY': 1.0,
    'UNKNOWN': 1.0,
}

_cata_fail_fraction = {
   # Catastrophic error fractions from redmonster on oak (ELG, LRG, QSO)
    'ELG': 0.08,
    'LRG': 0.013,
    'QSO': 0.20,
    'BGS': 0.,
    'STAR': 0.,
    'SKY': 0.,
    'UNKNOWN': 0.,
}
londumas commented 6 years ago

Would you like these coefficients from desisim? We could take the results of desitest. Or you would like the results from the SDSS data?

julienguy commented 6 years ago

We would need to have the coefficients calibrated on desi simulations, and ideally based on CCD images simulations. We have such CCD image simulations and the redshift catalog, matched to the truth. This only possible limitation is the statistics. I will put a link to this data set today. It would be great if one of you can have a look at it.

londumas commented 6 years ago

@julienguy, I volunteer as tribute.

moustakas commented 6 years ago

For reference, the current set of quickcat coefficients are based on this study-- Redmonster run on ZDC1 sample

julienguy commented 6 years ago

Helion and others, you can have a look at the following redshift catalog /project/projectdirs/desi/datachallenge/redwood/spectro/redux/redwood/zcatalog-redwood-target-truth.fits It has been run with version 0.13.0 of redrock (and software release18.6 for the rest of the software) See email of Stephen on data system list for more details on the redwood prod. In brief, this is the most realistic set of sims we have for DESI.

londumas commented 6 years ago

@julienguy, Thanks, I am computing the different statistic now.

londumas commented 6 years ago

@moustakas, Here are the results and the code to get them:

Is that what you want or you need more?

import scipy as sp
import fitsio
import matplotlib.pyplot as plt
from redrock.fitz import get_dv

def main():
    path = '/project/projectdirs/desi/datachallenge/redwood/spectro/redux/redwood/'
    h = fitsio.FITS(path+'/zcatalog-redwood-target-truth.fits')
    dv = get_dv(h['ZCATALOG']['Z'][:],h['ZCATALOG']['TRUEZ'][:])

    ###
    for spectype in sp.unique(h['ZCATALOG']['TEMPLATETYPE'][:]):
        print('\n')
        w = h['ZCATALOG']['TEMPLATETYPE'][:]==spectype
        ww = w.copy() & (h['ZCATALOG']['ZWARN'][:]!=0)
        print(spectype, '_zwarn_fraction: ', 1.*ww.sum()/w.sum() )
        ww = w.copy() & (h['ZCATALOG']['ZWARN'][:]==0) & (sp.absolute(dv)>1000.)
        print(spectype, '_cata_fail_fraction: ', 1.*ww.sum()/w.sum() )
        ww = w.copy() & (h['ZCATALOG']['ZWARN'][:]==0) & (sp.absolute(dv)<=1000.)
        print(spectype, '_sigma_v: ', sp.std(dv[ww]) )

    return
main()
b'0.0       ' _zwarn_fraction:  0.901349659107
b'0.0       ' _cata_fail_fraction:  0.09684151941
b'0.0       ' _sigma_v:  516.932772619

b'BGS       ' _zwarn_fraction:  0.0240823783425
b'BGS       ' _cata_fail_fraction:  0.00332170735758
b'BGS       ' _sigma_v:  37.7034302508

b'ELG       ' _zwarn_fraction:  0.086735213275
b'ELG       ' _cata_fail_fraction:  0.0198853032
b'ELG       ' _sigma_v:  38.0252072725

b'LRG       ' _zwarn_fraction:  0.0074137035463
b'LRG       ' _cata_fail_fraction:  0.00184162062615
b'LRG       ' _sigma_v:  67.3787383731

b'QSO       ' _zwarn_fraction:  0.0203632361035
b'QSO       ' _cata_fail_fraction:  0.011557512383
b'QSO       ' _sigma_v:  182.164628444

b'STAR      ' _zwarn_fraction:  0.344952380952
b'STAR      ' _cata_fail_fraction:  0.0500952380952
b'STAR      ' _sigma_v:  51.5065606385

b'WD        ' _zwarn_fraction:  0.0939597315436
b'WD        ' _cata_fail_fraction:  0.0
b'WD        ' _sigma_v:  54.3481663135
julienguy commented 6 years ago

thanks. it would be nice to also recalibrate the rest of the redshift efficiency calculation which is a function of magnitudes and [OII] fluxes. see https://github.com/desihub/desisim/blob/2362b20825c73ee78b324a61cb5b21d86bca8346/py/desisim/quickcat.py#L133

for instance, does quickcat reproduces the following efficiency curve derived from the same redwood set of simulations: elg-efficiency-vs-oii-flux

londumas commented 6 years ago

@julienguy, I don't think I will have the time to do that part.

londumas commented 6 years ago

@moustakas, Should I update the values in https://github.com/desihub/desisim/blob/master/py/desisim/quickcat.py? from line 40 to 72? Idon't have results for UNKNOWN and SKY. And for stars, it is very bad for MW targets, but normally it is good for Standard stars.

julienguy commented 6 years ago

I am working on the quickcat calibration in the branch quickcat-calib. All is done in a notebook: https://github.com/desihub/desisim/blob/quickcat-calib/doc/nb/quickcat-calibration.ipynb

michaelJwilson commented 6 years ago

Thanks Julien!

M

On Thu, 27 Sep 2018 at 17:13, julienguy notifications@github.com wrote:

I am working on the quickcat calibration in the branch quickcat-calib. All is done in a notebook:

https://github.com/desihub/desisim/blob/quickcat-calib/doc/nb/quickcat-calibration.ipynb

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/desihub/desisim/issues/355#issuecomment-425280960, or mute the thread https://github.com/notifications/unsubscribe-auth/AFwSkl1YUxNkCQts5X24tMZcxs8VabFnks5ufWmagaJpZM4TlEM5 .

-- Dr. Michael Wilson

Cosmology Postdoctoral Fellow

http://www.roe.ac.uk/~mjw/

Lawrence Berkeley National Lab 1 Cyclotron Road, M/S 50A5104 Berkeley, CA 94720, USA

Tel: (+01) 510-502-3448 (+44) 7742 373026

moustakas commented 6 years ago

Done in #430.