Skip to content

Commit

Permalink
Merge pull request #117 from teweitsai/tickets/DM-19837
Browse files Browse the repository at this point in the history
Support the eimage in phosim.
  • Loading branch information
SimonKrughoff committed Jun 13, 2019
2 parents 1cba479 + e4007ac commit 9823f3b
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 4 deletions.
25 changes: 25 additions & 0 deletions config/phosim/ingestEimg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This file is part of obs_lsst.
#
# Developed for the LSST Data Management System.
# This product includes software developed by the LSST Project
# (http://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
# for details of code ownership.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.

from lsst.obs.lsst.phosim import PhosimEimgParseTask

config.parse.retarget(PhosimEimgParseTask)
Binary file not shown.
Binary file modified data/input/phosim/registry.sqlite3
Binary file not shown.
4 changes: 2 additions & 2 deletions policy/lsstCamMapper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ exposures:
template: wcs/%(visit)08d-%(filter)s/%(raftName)s/wcs_%(visit)08d-%(filter)s-%(raftName)s-%(detectorName)s-det%(detector)03d.fits
eimage:
level: Ccd
persistable: DecoratedImageU
python: lsst.afw.image.DecoratedImageU
persistable: DecoratedImageF
python: lsst.afw.image.DecoratedImageF
storage: FitsStorage
tables: raw
template: eimage/%(visit)d/E%(snap)03d/%(raftName)s/eimage_%(visit)08d_%(raftName)s_%(detectorName)s_E%(snap)03d.fits.gz
Expand Down
32 changes: 31 additions & 1 deletion python/lsst/obs/lsst/phosim.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from .ingest import LsstCamParseTask
from .translators import PhosimTranslator

__all__ = ["PhosimMapper", "PhosimParseTask"]
__all__ = ["PhosimMapper", "PhosimParseTask", "PhosimEimgParseTask"]


class PhosimRawVisitInfo(LsstCamMakeRawVisitInfo):
Expand All @@ -50,3 +50,33 @@ class PhosimParseTask(LsstCamParseTask):

_mapperClass = PhosimMapper
_translatorClass = PhosimTranslator


class PhosimEimgParseTask(PhosimParseTask):
"""Parser suitable for phosim eimage data.
"""

def getDestination(self, butler, info, filename):
"""Get destination for the file.
Parameters
----------
butler : `lsst.daf.persistence.Butler`
Data butler
info : data ID
File properties, used as dataId for the butler.
filename : `str`
Input filename.
Returns
-------
`str`
Destination filename.
"""

eimage = butler.get("eimage_filename", info)[0]
# Ensure filename is devoid of cfitsio directions about HDUs
c = eimage.find("[")
if c > 0:
eimage = eimage[:c]
return eimage
25 changes: 24 additions & 1 deletion tests/test_parsetask.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from lsst.obs.lsst.auxTel import AuxTelParseTask
from lsst.obs.lsst.ts8 import Ts8ParseTask
from lsst.obs.lsst.ts3 import Ts3ParseTask
from lsst.obs.lsst.phosim import PhosimParseTask
from lsst.obs.lsst.phosim import PhosimParseTask, PhosimEimgParseTask
from lsst.obs.lsst.imsim import ImsimParseTask
from lsst.obs.lsst.ucd import UcdParseTask
from lsst.obs.lsst.ingest import LsstCamParseTask
Expand Down Expand Up @@ -288,6 +288,29 @@ def test_parsetask_phosim_translator(self):
)
self.assertParseCompare(DATADIR, CONFIGDIR, "phosim", PhosimParseTask, test_data)

def test_parsetask_phosim_eimg_translator(self):
"""Run the gen 2 metadata extraction code for Phosim"""
test_data = (("eimage/9006002/E000/R22/eimage_09006002_R22_S00_E000.fits.gz",
dict(
expTime=15.0,
object='UNKNOWN',
imageType='SKYEXP',
testType='PHOSIM',
lsstSerial='R22_S00',
date='2021-12-31T23:59:52.500',
dateObs='2021-12-31T23:59:52.500',
run='9006002',
wavelength=-666,
raftName='R22',
detectorName='S00',
detector=90,
snap=0,
filter='g',
visit=9006002,
)),
)
self.assertParseCompare(DATADIR, CONFIGDIR, "phosim", PhosimEimgParseTask, test_data)

def test_parsetask_ucd_translator(self):
"""Run the gen 2 metadata extraction code for UCDCam"""
self.maxDiff = None
Expand Down

0 comments on commit 9823f3b

Please sign in to comment.