Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-24517: Reading of raws from existing imsim & phosim repos broken by DM-23584 #203

Merged
merged 4 commits into from
Apr 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
91 changes: 91 additions & 0 deletions policy/imsim/imsimMapper.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
exposures:
_raw:
template: raw/%(run)s/%(raftName)s/%(expId)08d-%(raftName)s-%(detectorName)s-det%(detector)03d.fits[0]
raw_amp:
template: raw/%(run)s/%(raftName)s/%(expId)08d-%(raftName)s-%(detectorName)s-det%(detector)03d.fits[%(channel)d]
postISRCCD:
template: postISRCCD/%(expId)08d-%(filter)s/%(raftName)s/postISRCCD_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
postISRCCD_uninterpolated:
template: postISRCCD/%(expId)08d-%(filter)s/%(raftName)s/postISRCCD_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d-preInterp.fits
calexp:
template: calexp/%(expId)08d-%(filter)s/%(raftName)s/calexp_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
icExp:
template: icExp/%(expId)08d-%(filter)s/%(raftName)s/icExp_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
wcs:
template: wcs/%(expId)08d-%(filter)s/%(raftName)s/wcs_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
fcr:
template: fcr/%(expId)08d-%(filter)s/%(raftName)s/fcr_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
deepDiff_differenceExp:
template: deepDiff/v%(expId)08d-f%(filter)s/%(raftName)s/diffexp_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
deepDiff_matchedExp:
template: deepDiff/v%(expId)08d-f%(filter)s/%(raftName)s/matchexp_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
dcrDiff_differenceExp:
template: dcrDiff/v%(expId)08d-f%(filter)s/%(raftName)s/diffexp_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
dcrDiff_matchedExp:
template: dcrDiff/v%(expId)08d-f%(filter)s/%(raftName)s/matchexp_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits

datasets:
apCorr:
template: apCorr/%(expId)08d-%(filter)s/%(raftName)s/apCorr_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.pickle
calexpBackground:
template: calexp/%(expId)08d-%(filter)s/%(raftName)s/bkgd_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
calexp_camera:
template: calexp_camera/%(expId)08d-%(filter)s/%(raftName)s/calexp_camera_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
skyCorr:
template: skyCorr/%(expId)08d-%(filter)s/%(raftName)s/skyCorr_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
dcrDiff_diaSrc:
template: dcrDiff/v%(expId)08d-f%(filter)s/%(raftName)s/diaSrc_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
dcrDiff_kernelSrc:
template: dcrDiff/v%(expId)08d-f%(filter)s/%(raftName)s/kernelSrc_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
dcrDiff_metadata:
template: dcrDiff/v%(expId)08d-f%(filter)s/%(raftName)s/metadata_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.yaml
deepDiff_diaSrc:
template: deepDiff/v%(expId)08d-f%(filter)s/%(raftName)s/diaSrc_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
deepDiff_kernelSrc:
template: deepDiff/v%(expId)08d-f%(filter)s/%(raftName)s/kernelSrc_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
deepDiff_metadata:
template: deepDiff/v%(expId)08d-f%(filter)s/%(raftName)s/metadata_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.yaml
forced_metadata:
template: forced_metadata/%(expId)08d-%(filter)s/%(raftName)s/forcedMetadata_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.yaml
forced_src:
template: forced/%(expId)08d-%(filter)s/%(raftName)s/forced_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
forcedPhotCcd_metadata:
template: forcedPhotCcd_metadata/%(expId)08d-%(filter)s/%(raftName)s/forcedPhotCcd_metadata_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.yaml
icExpBackground:
template: icExp/%(expId)08d-%(filter)s/%(raftName)s/icExp_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
icSrc:
template: icSrc/%(expId)08d-%(filter)s/%(raftName)s/icSrc_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
processCcd_metadata:
template: processCcd_metadata/%(expId)08d-%(filter)s/%(raftName)s/processCcdMetadata_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.yaml
raw_hdu:
template: raw/%(run)s/%(raftName)s/%(expId)08d-%(raftName)s-%(detectorName)s-det%(detector)03d.fits[0]
src:
template: src/%(expId)08d-%(filter)s/%(raftName)s/src_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
srcMatch:
template: srcMatch/%(expId)08d-%(filter)s/%(raftName)s/srcMatch_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
transformSrcMeasurement_metadata:
template: transformSrcMeasurement_metadata/%(expId)08d-%(filter)s/%(raftName)s/transformSrcMeasurementMetadata_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.yaml
transformed_src:
template: transformedSrc/%(expId)08d-%(filter)s/%(raftName)s/transformedSrc_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
apPipe_metadata:
template: apPipe_metadata/%(expId)08d-%(filter)s/%(raftName)s/apPipeMetadata_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.yaml
runIsr_metadata:
template: runIsr_metadata/%(expId)08d-%(filter)s/%(raftName)s/runIsrMetadata_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.yaml
ossThumb:
template: thumbs/%(expId)08d-%(filter)s/%(raftName)s/ossThumb_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.png
flattenedThumb:
template: thumbs/%(expId)08d-%(filter)s/%(raftName)s/flattenedThumb_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.png
deepDiff_forced_diaSrc:
template: deepDiff/v%(expId)08d-f%(filter)s/%(raftName)s/diaForced_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
imageDifferenceDriver_metadata:
template: imageDifferenceDriver_metadata/%(expId)08d-%(filter)s/%(tract)d/%(patch)s/imageDifferenceDriverMetadata_%(expId)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.yaml

# Focal plane summary plots
focal_plane_fits:
template: focal_plane/%(dstype)s-v%(expId)08d.fits
focal_plane_png:
template: focal_plane/%(dstype)s-v%(expId)08d.png
binned_sensor_fits:
template: binned_sensor/%(dstype)s-v%(expId)08d/%(raftName)s/%(detectorName)s.fits
binned_sensor_fits_halves:
template: binned_sensor/%(dstype)s-v%(expId)08d/%(raftName)s/%(detectorName)s_%(half)s.fits
1 change: 1 addition & 0 deletions python/lsst/obs/lsst/imsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class ImsimMapper(LsstCamMapper):
MakeRawVisitInfoClass = ImsimMakeRawVisitInfo

_cameraName = "imsim"
yamlFileList = ["imsim/imsimMapper.yaml"] + list(LsstCamMapper.yamlFileList)

def bypass_ccdExposureId_bits(self, datasetType, pythonType, location, dataId):
"""How many bits are required for the maximum exposure ID"""
Expand Down
1 change: 1 addition & 0 deletions python/lsst/obs/lsst/phosim.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class PhosimMapper(LsstCamMapper):
MakeRawVisitInfoClass = PhosimRawVisitInfo

_cameraName = "phosim"
yamlFileList = ["imsim/imsimMapper.yaml"] + list(LsstCamMapper.yamlFileList)

def bypass_ccdExposureId_bits(self, datasetType, pythonType, location, dataId):
"""How many bits are required for the maximum exposure ID"""
Expand Down
8 changes: 7 additions & 1 deletion python/lsst/obs/lsst/translators/phosim.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import astropy.units as u
import astropy.units.cds as cds
from astropy.coordinates import Angle

from astro_metadata_translator import cache_translation
from astro_metadata_translator.translators.helpers import tracking_from_degree_headers, \
Expand Down Expand Up @@ -52,7 +53,6 @@ class LsstPhoSimTranslator(LsstSimTranslator):
"exposure_time": ("EXPTIME", dict(unit=u.s)),
"temperature": ("TEMPERA", dict(unit=u.deg_C)),
"pressure": ("PRESS", dict(unit=cds.mmHg)),
"boresight_rotation_angle": (["ROTANGZ", "ROTANGLE"], dict(unit=u.deg)),
"boresight_airmass": "AIRMASS",
"detector_name": "SENSNAME",
"detector_serial": "LSST_NUM",
Expand Down Expand Up @@ -100,3 +100,9 @@ def to_altaz_begin(self):
self.to_datetime_begin(), is_zd=set(["ZENITH"]))
else:
return super().to_altaz_begin()

@cache_translation
def to_boresight_rotation_angle(self):
angle = Angle(90.*u.deg) - Angle(self.quantity_from_card(["ROTANGZ", "ROTANGLE"], u.deg))
angle = angle.wrap_at("360d")
return angle
8 changes: 4 additions & 4 deletions tests/test_imsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def setUp(self):
)

path_to_raw = os.path.join(self.data_dir, "raw", "204595", "R11",
"0000000204595-R11-S20-det042.fits")
"00204595-R11-S20-det042.fits")
keys = set(('filter', 'patch', 'tract', 'visit', 'channel', 'amp', 'style', 'detector', 'dstype',
'snap', 'run', 'calibDate', 'half', 'detectorName', 'raftName', 'label',
'numSubfilters', 'fgcmcycle', 'name', 'pixel_id', 'description', 'subfilter', 'expId',
Expand All @@ -111,10 +111,10 @@ def setUp(self):
map_python_std_type = lsst.afw.image.ExposureF
map_cpp_type = 'DecoratedImageF'
map_storage_name = 'FitsStorage'
metadata_output_path = os.path.join('processCcd_metadata', '0000000204595-i', 'R11',
'processCcdMetadata_0000000204595'
metadata_output_path = os.path.join('processCcd_metadata', '00204595-i', 'R11',
'processCcdMetadata_00204595'
'-i-R11-S20-det042.yaml')
raw_filename = '0000000204595-R11-S20-det042.fits'
raw_filename = '00204595-R11-S20-det042.fits'
default_level = 'visit'
raw_levels = (('skyTile', set(['expId', 'detector', 'run', 'detectorName', 'raftName'])),
('filter', set(['expId', 'detector', 'run', 'detectorName', 'raftName'])),
Expand Down
4 changes: 2 additions & 2 deletions tests/test_parsetask.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def test_parsetask_ts3_translator(self):

def test_parsetask_imsim_translator(self):
"""Run the gen 2 metadata extraction code for Imsim"""
test_data = (("raw/204595/R11/0000000204595-R11-S20-det042.fits",
test_data = (("raw/204595/R11/00204595-R11-S20-det042.fits",
dict(
expTime=30.0,
object='UNKNOWN',
Expand All @@ -289,7 +289,7 @@ def test_parsetask_imsim_translator(self):

def test_parsetask_phosim_translator(self):
"""Run the gen 2 metadata extraction code for Phosim"""
test_data = (("raw/204595/R11/0000000204595-R11-S20-det042.fits",
test_data = (("raw/204595/R11/00204595-R11-S20-det042.fits",
dict(
expTime=30.0,
object='UNKNOWN',
Expand Down
10 changes: 4 additions & 6 deletions tests/test_phosim.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ def setUp(self):
linearizer_type=linearizer_type
)

path_to_raw = os.path.join(self.data_dir, "raw", "204595", "R11",
"0000000204595-R11-S20-det042.fits")
path_to_raw = os.path.join(self.data_dir, "raw", "204595", "R11", "00204595-R11-S20-det042.fits")
keys = set(('filter', 'patch', 'tract', 'visit', 'channel', 'amp', 'style', 'detector', 'dstype',
'snap', 'run', 'calibDate', 'half', 'detectorName', 'raftName', 'label',
'numSubfilters', 'fgcmcycle', 'name', 'pixel_id', 'description', 'subfilter', 'expId',
Expand All @@ -83,10 +82,9 @@ def setUp(self):
map_python_std_type = lsst.afw.image.ExposureF
map_cpp_type = 'DecoratedImageF'
map_storage_name = 'FitsStorage'
metadata_output_path = os.path.join('processCcd_metadata', '0000000204595-i', 'R11',
'processCcdMetadata_0000000204595'
'-i-R11-S20-det042.yaml')
raw_filename = '0000000204595-R11-S20-det042.fits'
metadata_output_path = os.path.join('processCcd_metadata', '00204595-i', 'R11',
'processCcdMetadata_00204595-i-R11-S20-det042.yaml')
raw_filename = '00204595-R11-S20-det042.fits'
default_level = 'visit'
raw_levels = (('skyTile', set(['expId', 'detector', 'run', 'detectorName', 'raftName'])),
('filter', set(['expId', 'detector', 'run', 'detectorName', 'raftName'])),
Expand Down