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-25890: Add method to gen2 mapper to return gen3 instrument #231

Merged
merged 2 commits into from
Jul 13, 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
2 changes: 2 additions & 0 deletions python/lsst/obs/lsst/comCam.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from . import LsstCamMapper, LsstCamMakeRawVisitInfo
from .ingest import LsstCamParseTask
from .translators import LsstComCamTranslator
from ._instrument import LsstComCam

__all__ = ["LsstComCamMapper", "LsstComCamParseTask"]

Expand All @@ -36,6 +37,7 @@ class LsstComCamMapper(LsstCamMapper):
"""The Mapper for the LSST ComCam camera."""
translatorClass = LsstComCamTranslator
MakeRawVisitInfoClass = LsstComCamMakeRawVisitInfo
_gen3instrument = LsstComCam
_cameraName = "comCam"


Expand Down
2 changes: 2 additions & 0 deletions python/lsst/obs/lsst/imsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from . import LsstCamMapper, LsstCamMakeRawVisitInfo
from .ingest import LsstCamParseTask
from .translators import LsstImSimTranslator
from ._instrument import LsstImSim

__all__ = ["ImsimMapper", "ImsimParseTask"]

Expand All @@ -36,6 +37,7 @@ class ImsimMapper(LsstCamMapper):
"""The Mapper for the imsim simulations of the LsstCam."""
translatorClass = LsstImSimTranslator
MakeRawVisitInfoClass = ImsimMakeRawVisitInfo
_gen3instrument = LsstImSim

_cameraName = "imsim"
yamlFileList = ["imsim/imsimMapper.yaml"] + list(LsstCamMapper.yamlFileList)
Expand Down
2 changes: 2 additions & 0 deletions python/lsst/obs/lsst/latiss.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from .ingest import LsstCamParseTask
from .translators import LatissTranslator
from .filters import LATISS_FILTER_DEFINITIONS
from ._instrument import Latiss

__all__ = ["LatissMapper", "LatissParseTask"]

Expand All @@ -40,6 +41,7 @@ class LatissMapper(LsstCamMapper):
"""The Mapper for the LATISS camera."""

MakeRawVisitInfoClass = LatissMakeRawVisitInfo
_gen3instrument = Latiss

_cameraName = "latiss"
yamlFileList = ["latiss/latissMapper.yaml"] + list(LsstCamMapper.yamlFileList)
Expand Down
9 changes: 9 additions & 0 deletions python/lsst/obs/lsst/lsstCamMapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"""The LsstCam Mapper.""" # necessary to suppress D100 flake8 warning.

import os
from functools import lru_cache
import lsst.log
import lsst.geom
import lsst.utils as utils
Expand All @@ -32,6 +33,7 @@
import lsst.daf.persistence as dafPersist
from .translators import LsstCamTranslator
from ._fitsHeader import readRawFitsHeader
from ._instrument import LsstCam

from .filters import LSSTCAM_FILTER_DEFINITIONS
from .assembly import attachRawWcsFromBoresight, fixAmpsAndAssemble
Expand Down Expand Up @@ -166,7 +168,13 @@ def _makeCamera(cls, policy=None, repositoryDir=None, cameraYamlFile=None):
camera : `lsst.afw.cameraGeom.Camera`
Camera geometry.
"""
return cls._makeYamlCamera(cameraYamlFile=cameraYamlFile)

@classmethod
@lru_cache(maxsize=10)
def _makeYamlCamera(cls, cameraYamlFile=None):
"""Helper function for _makeCamera that can be cached.
"""
if not cameraYamlFile:
cameraYamlFile = os.path.join(utils.getPackageDir(cls.packageName), "policy",
("%s.yaml" % cls.getCameraName()))
Expand Down Expand Up @@ -414,3 +422,4 @@ class LsstCamMapper(LsstCamBaseMapper):
translatorClass = LsstCamTranslator
MakeRawVisitInfoClass = LsstCamRawVisitInfo
_cameraName = "lsstCam"
_gen3instrument = LsstCam
2 changes: 2 additions & 0 deletions python/lsst/obs/lsst/phosim.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from . import LsstCamMapper, LsstCamMakeRawVisitInfo
from .ingest import LsstCamParseTask
from .translators import LsstPhoSimTranslator
from ._instrument import LsstPhoSim

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

Expand All @@ -36,6 +37,7 @@ class PhosimMapper(LsstCamMapper):
"""The Mapper for the phosim simulations of the LsstCam."""
translatorClass = LsstPhoSimTranslator
MakeRawVisitInfoClass = PhosimRawVisitInfo
_gen3instrument = LsstPhoSim

_cameraName = "phosim"
yamlFileList = ["imsim/imsimMapper.yaml"] + list(LsstCamMapper.yamlFileList)
Expand Down
2 changes: 2 additions & 0 deletions python/lsst/obs/lsst/ts3.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from . import LsstCamMapper, LsstCamMakeRawVisitInfo
from .ingest import LsstCamParseTask
from .translators import LsstTS3Translator
from ._instrument import LsstTS3

__all__ = ["Ts3Mapper", "Ts3ParseTask"]

Expand All @@ -36,6 +37,7 @@ class Ts3Mapper(LsstCamMapper):
"""The Mapper for the ts3 camera."""
translatorClass = LsstTS3Translator
MakeRawVisitInfoClass = Ts3MakeRawVisitInfo
_gen3instrument = LsstTS3
_cameraName = "ts3"
yamlFileList = ["ts3/ts3Mapper.yaml"] + list(LsstCamMapper.yamlFileList)

Expand Down
2 changes: 2 additions & 0 deletions python/lsst/obs/lsst/ts8.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from . import LsstCamMapper, LsstCamMakeRawVisitInfo
from .ingest import LsstCamParseTask
from .translators import LsstTS8Translator
from ._instrument import LsstTS8

__all__ = ["Ts8Mapper", "Ts8ParseTask"]

Expand All @@ -36,6 +37,7 @@ class Ts8Mapper(LsstCamMapper):
"""The Mapper for the ts8 camera."""
translatorClass = LsstTS8Translator
MakeRawVisitInfoClass = Ts8MakeRawVisitInfo
_gen3instrument = LsstTS8
_cameraName = "ts8"
yamlFileList = ["ts8/ts8Mapper.yaml"] + list(LsstCamMapper.yamlFileList)

Expand Down
2 changes: 2 additions & 0 deletions python/lsst/obs/lsst/ucd.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from . import LsstCamMapper, LsstCamMakeRawVisitInfo
from .ingest import LsstCamParseTask
from .translators import LsstUCDCamTranslator
from ._instrument import LsstUCDCam

__all__ = ["UcdMapper", "UcdParseTask"]

Expand All @@ -36,6 +37,7 @@ class UcdMapper(LsstCamMapper):
"""The Mapper for the UCDavis camera."""
translatorClass = LsstUCDCamTranslator
MakeRawVisitInfoClass = UcdMakeRawVisitInfo
_gen3instrument = LsstUCDCam

_cameraName = "ucd"
yamlFileList = ["ucd/ucdMapper.yaml"] + list(LsstCamMapper.yamlFileList)
Expand Down