Keck-DataReductionPipelines / KPF-Pipeline

KPF-Pipeline
https://kpf-pipeline.readthedocs.io/en/latest/
Other
11 stars 2 forks source link

Handle missing extension(s) in L0->2D recipe #479

Open RussLaher opened 1 year ago

RussLaher commented 1 year ago

The watchfor_kpf_l0.recipe creates 2D FITS files from L0 files. Currently, it does not successfully create a 2D FITS file when the GREEN CCD extensions are missing. The recipe needs to be modified to handle this rainy-day scenario. Here are examples of L0 FITS files with only RED CCD extensions and no GREEN CCD extensions (the file size is a give-away):

-rw-rw-r--. 1 kpfdev citah 71752320 Mar 10 09:27 KP.20230310.62758.32.fits -rw-rw-r--. 1 kpfdev citah 71752320 Mar 10 09:30 KP.20230310.62939.91.fits -rw-rw-r--. 1 kpfdev citah 71755200 Mar 10 09:33 KP.20230310.63065.85.fits -rw-rw-r--. 1 kpfdev citah 71755200 Mar 10 09:37 KP.20230310.63307.37.fits -rw-rw-r--. 1 kpfdev citah 71755200 Mar 10 09:42 KP.20230310.63601.79.fits -rw-rw-r--. 1 kpfdev citah 71755200 Mar 10 09:44 KP.20230310.63775.43.fits -rw-rw-r--. 1 kpfdev citah 71755200 Mar 10 09:53 KP.20230310.64216.16.fits -rw-rw-r--. 1 kpfdev citah 71755200 Mar 10 10:00 KP.20230310.64664.75.fits -rw-rw-r--. 1 kpfdev citah 71755200 Mar 10 10:13 KP.20230310.65470.55.fits

awhoward commented 1 year ago

Tagging @bjfultn as there are design issues here that he, @cwang2016, and @RussLaher especially should think through.

In general, we need ways to handle L0 files that have any combination of {green, red, EM, HK}.

RussLaher commented 1 year ago

I have been doing some debugging and testing and found that the KP_2D.fits are not being generated because bias_subbed = ImageProcessing(L0_with_ffi, masterbias_path, lev0_ffi_exts, data_type, quicklook) raised an exception (this line is in watchfor_kpf_l0.recipe, a sub-recipe of kpf_drp.recipe). If I modify line 71 in KPF-Pipeline//modules/image_processing/src to catch this exception, then the KP_2D.fits are made and the kpf_drp.recipe runs along farther, until the following error:

[KP.20230310.62758.32.log][INFO]:Starting For loop on recipe line 239 with arg masters/kpfMaster_HKwave20220909_sky.csv [KP.20230310.62758.32.log][INFO]:Assign: hk_wavelength_tables <- ['/data/masters/kpfMaster_HKwave20220909_sci.csv', '/data/masters/kpfMaster_HKwave20220909_sky.csv'], type: list [KP.20230310.62758.32.log][INFO]:Assign: output_qlp <- /data/QLP/20230310/, type: str [KP.20230310.62758.32.log][INFO]:Assign: end_of_night_summary <- False, type: bool Exception list index out of range while invoking resume_recipe Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/keckdrpframework/core/framework.py", line 229, in execute action_output = pipeline.get_action(action_name)(action, context) File "/code/KPF-Pipeline/kpfpipe/pipelines/kpfpipeline.py", line 250, in resume_recipe self._recipe_visitor.visit(self._recipe_ast) File "/usr/local/lib/python3.6/ast.py", line 253, in visit return visitor(node) File "/code/KPF-Pipeline/kpfpipe/pipelines/kpf_parse_ast.py", line 138, in visit_Module self.visit(item) File "/usr/local/lib/python3.6/ast.py", line 253, in visit return visitor(node) File "/code/KPF-Pipeline/kpfpipe/pipelines/kpf_parse_ast.py", line 411, in visit_Assign self.visit(node.value) File "/usr/local/lib/python3.6/ast.py", line 253, in visit return visitor(node) File "/code/KPF-Pipeline/kpfpipe/pipelines/kpf_parse_ast.py", line 1067, in visit_Subscript self._load.append(value[sliceName]) IndexError: list index out of range

I am going to fix alg.py this afternoon, but Cindy will have to follow up and fix the above error since it is in her patch.