Skip to content

Commit

Permalink
Add a method to validate the FIBERS extension
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiopasra committed Jul 3, 2019
1 parent 1f9ba16 commit 26bc23e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions megaradrp/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ def validate_hdulist(self, hdulist):
ksc = keymap[key]
validate_keyword_exists(hdulist[ksc.ext].header, ksc.key)

def validate_fibers(self, hdulist):
if 'FIBERS' not in hdulist:
msg = '"{}" extension not found'.format('FIBERS')
raise ValidationError(hdulist, msg)

header_f = hdulist['FIBERS'].header

validate_fiber_ext(header_f)


class ProcessedFrame(MegaraFrame):
"""A processed frame"""
Expand All @@ -115,12 +124,7 @@ def validate_hdulist(self, hdulist):
super(ProcessedRSS, self).validate_hdulist(hdulist)
_logger.debug('validate ProcessedRSS')

if 'FIBERS' not in hdulist:
msg = '"{}" extension not found'.format('FIBERS')
raise ValidationError(hdulist, msg)

header_0 = hdulist[0].header
header_f = hdulist['FIBERS'].header

# validate_keyword_value(header_0, 'NUMTYPE', 'MasterBias')
# 4096 for non WCS, and 4300 for WCS
Expand All @@ -129,7 +133,7 @@ def validate_hdulist(self, hdulist):
# This can be 623 or 644
validate_keyword_any_value(header_0, 'NAXIS2', [623, 644])

validate_fiber_ext(header_f)
self.validate_fibers(hdulist)


class ProcessedMultiRSS(ProcessedFrame):
Expand Down

0 comments on commit 26bc23e

Please sign in to comment.