Skip to content

Commit

Permalink
Do not use per-mode taggers, it is computed on the run
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiopasra committed May 16, 2019
1 parent bc3a681 commit 4d7deeb
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 22 deletions.
2 changes: 1 addition & 1 deletion megaradrp/datamodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__(
Expand Down
34 changes: 17 additions & 17 deletions megaradrp/drp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 7 additions & 1 deletion megaradrp/recipes/calibration/modelmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 11 additions & 3 deletions megaradrp/recipes/calibration/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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

Expand Down

0 comments on commit 4d7deeb

Please sign in to comment.