From 4d7deebe4c011f9b467069c4ce852dfd8e10ccca Mon Sep 17 00:00:00 2001 From: Sergio Pascual Date: Thu, 16 May 2019 19:19:25 +0200 Subject: [PATCH] Do not use per-mode taggers, it is computed on the run --- megaradrp/datamodel.py | 2 +- megaradrp/drp.yaml | 34 +++++++++++------------ megaradrp/recipes/calibration/modelmap.py | 8 +++++- megaradrp/recipes/calibration/trace.py | 14 ++++++++-- 4 files changed, 36 insertions(+), 22 deletions(-) diff --git a/megaradrp/datamodel.py b/megaradrp/datamodel.py index 0e4dacc6..a57c7684 100644 --- a/megaradrp/datamodel.py +++ b/megaradrp/datamodel.py @@ -104,7 +104,7 @@ def __init__(self): 'focus': ('FOCUS', 'undefined'), 'osfilter': ('OSFILTER', 'undefined'), 'temp': ('SENTEMP4', 0.0), - 'speclamp': ('SPECLMP', 'undefined'), + 'speclamp': ('SPECLAMP', 'undefined'), 'confid': KeyDefinition('CONFID', ext='FIBERS'), } super(MegaraDataModel, self).__init__( diff --git a/megaradrp/drp.yaml b/megaradrp/drp.yaml index fd53aa64..0d4b7ce7 100644 --- a/megaradrp/drp.yaml +++ b/megaradrp/drp.yaml @@ -32,22 +32,22 @@ modes: summary: Summary of Fiber Flat Image description: Lines and mode lines key: MegaraFiberFlatImage - tagger: megaradrp.taggers.tagger_base_image + tagger: null - name: Image with the fiber MOS summary: Summary of Fiber MOS image description: Lines and mode lines key: MegaraMosImage - tagger: megaradrp.taggers.tagger_base_image + tagger: null - name: Trace Map summary: Summary of Fiber MOS image description: Lines and mode lines key: MegaraTraceMap - tagger: megaradrp.taggers.tagger_base_image + tagger: null - name: Arc Calibration summary: Summary of Arc Calibration description: Process an Arc image key: MegaraArcCalibration - tagger: ['vph', 'insmode', 'speclamp'] + tagger: null - name: Bad Pixel Mask summary: Bad Pixel Mask description: Bad Pixels @@ -57,66 +57,66 @@ modes: summary: Slit Flat description: Slit Flat key: MegaraSlitFlat - tagger: megaradrp.taggers.tagger_base_image + tagger: null - name: ModelMap summary: Computes a ModelMap description: Computes a ModelMap from FlatImages key: MegaraModelMap - tagger: megaradrp.taggers.tagger_base_image + tagger: null - key: MegaraFocusSpectrograph name: Focus Spectrograph - tagger: megaradrp.taggers.tagger_base_image + tagger: null validator: megaradrp.validators.validate_focus - name: Twillight fiber flat summary: Twillight fiber flat spectrum description: Twillight fiber flat spectrum key: MegaraTwilightFlatImage - tagger: megaradrp.taggers.tagger_base_image + tagger: null - name: Image with the LCB summary: Image with the LCB description: Image with the LCB key: MegaraLcbImage - tagger: megaradrp.taggers.tagger_base_image + tagger: null - name: Image with the MOS summary: Image with the MOS description: Image with the MOS key: MegaraMosImage - tagger: megaradrp.taggers.tagger_base_image + tagger: null - name: Extinction Star Recipe summary: Extinction Star Recipe description: Extinction Star Recipe key: MegaraExtinctionStar - tagger: megaradrp.taggers.tagger_base_image + tagger: null - name: LCB Standard Recipe summary: LCB Standard Recipe description: LCB Standard Recipe key: MegaraLcbStdStar - tagger: megaradrp.taggers.tagger_base_image + tagger: null - name: MOS Standard Recipe summary: MOS Standard Recipe description: MOS Standard Recipe key: MegaraMosStdStar - tagger: megaradrp.taggers.tagger_base_image + tagger: null - name: Sensivity Star Recipe summary: Sensivity Star Recipe description: Sensivity Star Recipe key: MegaraSensitivityStar - tagger: megaradrp.taggers.tagger_base_image + tagger: null - name: Telescope Focus summary: Telescope Focus description: Telescope Focus key: MegaraFocusTelescope - tagger: megaradrp.taggers.tagger_base_image + tagger: null - name: Acquisition with the LCB IFU summary: Acquisition with the LCB IFU description: Acquisition with the LCB IFU key: MegaraLcbAcquisition - tagger: megaradrp.taggers.tagger_base_image + tagger: null - name: Acquisition with the Fiber MOS summary: Acquisition with the Fiber MOS description: Acquisition with the Fiber MOS key: MegaraMosAcquisition - tagger: megaradrp.taggers.tagger_base_image + tagger: null pipelines: default: version: 1 diff --git a/megaradrp/recipes/calibration/modelmap.py b/megaradrp/recipes/calibration/modelmap.py index 4764cff2..08c04e6c 100644 --- a/megaradrp/recipes/calibration/modelmap.py +++ b/megaradrp/recipes/calibration/modelmap.py @@ -141,7 +141,13 @@ def run(self, rinput): fiberconf = self.datamodel.get_fiberconf(reduced) model_map.total_fibers = fiberconf.nfibers model_map.missing_fibers = rinput.master_traces.missing_fibers - model_map.tags = obresult.tags + + for key in model_map.tag_names(): + if key in obresult.labels: + model_map.tags[key] = obresult.labels[key] + else: + model_map.tags[key] = reduced[0].header[key] + # model_map.boxes_positions = box_borders # model_map.ref_column = cstart model_map.update_metadata(self) diff --git a/megaradrp/recipes/calibration/trace.py b/megaradrp/recipes/calibration/trace.py index 18f5d98c..fea463df 100644 --- a/megaradrp/recipes/calibration/trace.py +++ b/megaradrp/recipes/calibration/trace.py @@ -130,8 +130,7 @@ def run(self, rinput): self.logger.info('start trace spectra recipe') obresult = rinput.obresult - current_vph = obresult.tags['vph'] - current_insmode = obresult.tags['insmode'] + obresult_meta = obresult.metadata_with(self.datamodel) debug_plot = rinput.debug_plot if self.intermediate_results else 0 @@ -156,6 +155,9 @@ def run(self, rinput): self.logger.debug("original boxes: %s", box_borders0) self.logger.debug("refined boxes: %s", box_borders) + current_vph = reduced[0].header['vph'] + current_insmode = reduced[0].header['insmode'] + if current_insmode in vph_thr and current_vph in vph_thr[current_insmode]: threshold = vph_thr[current_insmode][current_vph] self.logger.info('rel threshold for %s is %4.2f', current_vph, threshold) @@ -166,7 +168,13 @@ def run(self, rinput): final = megaradrp.products.TraceMap(instrument=obresult.instrument) fiberconf = self.datamodel.get_fiberconf(reduced) final.total_fibers = fiberconf.nfibers - final.tags = obresult.tags + + for key in final.tag_names(): + if key in obresult.labels: + final.tags[key] = obresult.labels[key] + else: + final.tags[key] = reduced[0].header[key] + final.boxes_positions = box_borders final.ref_column = cstart