Developing/Testing QA Frame Class (v1.1)


In [1]:
# imports
from desispec.qa import qa_exposure as qa_exp
from desispec.io import qa as desio_qa

Instantiate


In [3]:
reload(qa_exp)
qaframe = qa_exp.QA_Frame(flavor='arc')
print(qaframe)


QA_Frame: camera=none, flavor=arc

Init SkySub


In [5]:
reload(qa_exp)
qaframe = qa_exp.QA_Frame(flavor='science')
qaframe.init_skysub()
print(qaframe.data)


{u'SKYSUB': {u'PARAM': {'PCHI_RESID': 0.05}}, 'flavor': 'science', 'camera': u'none'}

I/O


In [6]:
from desispec.io import read_qa_frame

In [7]:
reload(desio_qa)


Out[7]:
<module 'desispec.io.qa' from '/Users/xavier/DESI/desispec/py/desispec/io/qa.pyc'>

In [8]:
desio_qa.write_qa_frame('tmp.yaml', qaframe)


Out[8]:
'tmp.yaml'

In [9]:
qaframe = desio_qa.read_qa_frame('tmp.yaml')

In [10]:
qaframe


Out[10]:
QA_Frame: camera=none, flavor=science

Test FiberFlat QA

On JXP laptop first

desi_compute_fiberflat.py \
    --infile /Users/xavier/DESI/TST/dogwood/exposures/20150211/00000001/frame-b0-00000001.fits \
    --outfile /Users/xavier/DESI/TST/dogwood/calib2d/20150211/jxp-fflat-b0-00000001.fits \
    --fibermap /Users/xavier/DESI/TST/data/20150211/fibermap-00000002.fits \
    --qafile /Users/xavier/DESI/TST/dogwood/exposures/20150211/00000001/qa-b0-00000001.yaml \
    --qafig /Users/xavier/DESI/TST/dogwood/exposures/20150211/00000001/qa-fflat-b0-00000001.pdf

Now Edison (see below for setup)


In [ ]:

Test SkySub QA

On JXP laptop first

desi_compute_sky.py \
    --infile /Users/xavier/DESI/TST/dogwood/exposures/20150211/00000002/frame-b0-00000002.fits \
    --fibermap /Users/xavier/DESI/TST/data/20150211/fibermap-00000002.fits \
    --fiberflat /Users/xavier/DESI/TST/dogwood/calib2d/20150211/fiberflat-b0-00000001.fits \
    --outfile /Users/xavier/DESI/TST/dogwood/exposures/20150211/00000002/sky2-b0-00000002.fits \
    --qafile /Users/xavier/DESI/TST/dogwood/exposures/20150211/00000002/qa-b0-00000002.yaml \
    --qafig /Users/xavier/DESI/TST/dogwood/exposures/20150211/00000002/qa-b0-00000002.pdf \
    > tmp.log

In [11]:
# Read and print
qaframe = desio_qa.read_qa_frame('/Users/xavier/DESI/TST/dogwood/exposures/20150211/00000002/qa-b0-00000002.yaml')
qaframe.data


Out[11]:
{u'SKYSUB': {u'PARAM': {'PCHI_RESID': 0.05},
  u'QA': {'MED_RESID': 0.7486834745211439, 'NBAD_PCHI': 38, 'NSKY_FIB': 45}},
 'camera': 'b0',
 'flavor': 'science'}

Now Edison

[edison ~] source env.sh
[edison ~] cd Python/desispec
[edison ~] git pull
[edison ~] cd
[edison ~] module use ~xavier/modules
[edison ~] module switch desispec/qa_exposure
[edison ~] cd qa_test

desi_compute_sky.py \
    --infile /project/projectdirs/desi/spectro/redux/sjb/dogwood/exposures/20150211/00000002/frame-b0-00000002.fits \
    --fibermap /project/projectdirs/desi/spectro/sim/alpha-5/20150211/fibermap-00000002.fits \
    --fiberflat /project/projectdirs/desi/spectro/redux/sjb/dogwood/calib2d/20150211/fiberflat-b0-00000001.fits \
    --outfile sky-b0-00000002.fits \
    --qafile qa-b0-00000002.yaml \
    --qafig qa-b0-00000002.pdf \        
    > qa_tst.log

In [ ]: