desihub / fiberassign

Fiber assignment code for DESI
BSD 3-Clause "New" or "Revised" License
7 stars 8 forks source link

qa-fiberassign on sv sim. #205

Open michaelJwilson opened 5 years ago

michaelJwilson commented 5 years ago

Running qa-fiberassign on the SV sim. results in the following error:

Traceback (most recent call last):
  File "/global/common/software/desi/cori/desiconda/20180709-1.2.6-spec/code/fiberassign/master/bin/qa-fiberassign", line 74, in <module>
    num_no_desitarget = np.count_nonzero(fa['DESI_TARGET'] == 0)
  File "/global/common/software/desi/cori/desiconda/20180709-1.2.6-spec/conda/lib/python3.6/site-packages/astropy/table/table.py", line 1222, in __getitem__
    return self.columns[item]
  File "/global/common/software/desi/cori/desiconda/20180709-1.2.6-spec/conda/lib/python3.6/site-packages/astropy/table/table.py", line 109, in __getitem__
    return OrderedDict.__getitem__(self, item)
KeyError: 'DESI_TARGET'

seems a straightforward fix (to rewrite DESI_TARGET expectation) see fiberassign itself. I'll look at it, but maybe someone (@forero?) will beat me to it ...

Launch script:

/global/homes/m/mjwilson/desi/survey-validation/svdc-summer2019/fiberassign_qa.sh

Also a --outputdir argument would help?

tskisner commented 5 years ago

This "qa-fiberassign" script is copied from the original legacy codebase. We should consider merging this functionality with the fba_run_qa / fba_plot_qa scripts, which generate a json document with assignment stats for each tile and also visualizes those values on the footprint.

forero commented 5 years ago

After running fba_run_qa on the SV data I get the following

INFO: Reading fiber positions from /global/common/software/desi/cori/desiconda/20180709-1.2.6-spec/code/desimodel/master/da
ta/focalplane/fiberpos-all.fits
INFO: Found 91 fiberassign tile files
INFO: Selecting 0 fiberassign tile files

and an empty qa.json file.

What is then the correct way to call the script?

michaelJwilson commented 5 years ago

I think it's failing because of the sv tile ids. Adding --footprint works, but achieves another error.

fba_run_qa --dir /global/cscratch1/sd/mjwilson/svdc2019c/fiberassign --out /global/cscratch1/sd/mjwilson/svdc2019c/fiberassign-qa/qa.json --footprint /global/cscratch1/sd/mjwilson/svdc2019c/survey/SV-tiles.fits

This is because the fiberassign*.fits is split into subdirs, e.g. SV_BGS. This runs to completion:

fba_run_qa --dir /global/cscratch1/sd/mjwilson/svdc2019c/fiberassign/SV_BGS --out /global/cscratch1/sd/mjwilson/svdc2019c/fiberassign-qa/bgs_qa.json --footprint /global/cscratch1/sd/mjwilson/svdc2019c/survey/SV-tiles.fits

Output in the SV dir /fiberasssign-qa/

forero commented 5 years ago

Got it. Thanks.

michaelJwilson commented 5 years ago

I was looking at:

https://desi.lbl.gov/DocDB/cgi-bin/private/RetrieveFile?docid=4247;filename=FiberAssignment_Dawson_Barcelona.pdf;version=1

It'd be great to have a follow-up based on this SV set. Not least, I think Stephen wanted checks that things hadn't gone awry.

forero commented 5 years ago

I will take that as guide to prepare a short report.

Srheft commented 5 years ago

Hi @forero: Any update on this ticket? qa-fiberassign would need to work on CMX as well and the blocking factor seems to be the unrecognizable objtype.

forero commented 5 years ago

Hi @Srheft. Nothing new, fba_run_qa works but the older qa_fiberassign does not. To me the best solution seems to be implementing the qa_fiberassign stats insidefba_run_qa and avoid using DESI_TARGET (OBJTYPE does the work to count science,sky and stars). I will only have time to tackle this in August.

Srheft commented 5 years ago

ok; thanks for the info; fba_run_qa and fiberassign-qa both have useful info. I'll give it shot to work to our taste for cmx/sv.