Skip to content

Commit

Permalink
Merge pull request #125 from lsst/tickets/DM-21186
Browse files Browse the repository at this point in the history
DM-21186: Rename auxTel to LATISS
  • Loading branch information
timj committed Sep 6, 2019
2 parents bea5b06 + febd912 commit bed7963
Show file tree
Hide file tree
Showing 38 changed files with 183 additions and 151 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ python/lsst/obs/lsst/version.py
.pytest_cache
tests/.tests
pytest_session.txt
auxTel/CALIB/calibRegistry.sqlite3
auxTel/CALIB/defects/
latiss/CALIB/calibRegistry.sqlite3
latiss/CALIB/defects/
6 changes: 3 additions & 3 deletions SConstruct
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# -*- python -*-
from lsst.sconsUtils import scripts

# Note the ordering here is critical. AuxTel is put at the end here to ensure
# Note the ordering here is critical. LATISS is put at the end here to ensure
# that the tests are run first and version.py is created, because creation of
# of the defect registry required the camera to be instantiated.
# If other cameras add defect generation they should add their build to
# the end of this list, along with auxTel
targetList = ("version", "shebang", "policy",) + scripts.DEFAULT_TARGETS + ("auxTel",)
# the end of this list, along with LATISS
targetList = ("version", "shebang", "policy",) + scripts.DEFAULT_TARGETS + ("latiss",)

scripts.BasicSConstruct("obs_lsst", disableCc=True, defaultTargets=targetList)
8 changes: 4 additions & 4 deletions bin.src/genDefectFits.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
from astropy.io import fits
import collections

from lsst.obs.lsst.auxTel import AuxTelMapper
from lsst.obs.lsst.latiss import LatissMapper

Defect = collections.namedtuple('Defect', ['x0', 'y0', 'width', 'height'])
mapperMap = {'auxTel': AuxTelMapper}
mapperMap = {'latiss': LatissMapper}


def genDefectFits(cameraName, source, targetDir):
Expand Down Expand Up @@ -72,8 +72,8 @@ def genDefectFits(cameraName, source, targetDir):
import argparse

parser = argparse.ArgumentParser()
parser.add_argument("cameraName", type=str, choices=['auxTel'],
help="Camera name: auxTel only at present")
parser.add_argument("cameraName", type=str, choices=['latiss'],
help="Camera name: LATISS only at present")
parser.add_argument("defectsFile", type=str, help="Text file containing list of defects")
parser.add_argument("targetDir", type=str, nargs="?", help="Directory for generated fits files")
parser.add_argument("-f", "--force", action="store_true", help="Force operations")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions config/auxTel/ingest.py → config/latiss/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.

from lsst.obs.lsst.auxTel import AuxTelParseTask
from lsst.obs.lsst.latiss import LatissParseTask

config.parse.retarget(AuxTelParseTask)
config.parse.retarget(LatissParseTask)

del config.parse.translation['testType']

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions doc/lsst.obs.lsst/adding-a-camera.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Adding a new camera
The ``policy`` directory in the ``obs_lsst`` package contains the files
needed to describe cameras made up of LSST chips. The eventual goal is
to describe the real camera, but for now we also have variants to handle
AuxTel data, phosim and imsim simulations (they differ in e.g., the gain and
LATISS data, phosim and imsim simulations (they differ in e.g., the gain and
crosstalk values) and data from various test stands.

Once Butler Gen3 is ready this configuration data will be moved out of
Expand All @@ -28,7 +28,7 @@ To add a new camera (e.g., ``fooCam``, made up of 9 CCDs in a single
``policy/lsstCam/R11.yaml``). Note that you can choose an ITL or E2V
device. Note that you must provide a serial number for each CCD in
the raft as that’s how I know how many CCDs there are in the “raft”
(e.g. auxTel has only one)
(e.g. LATISS has only one)

The geometryWithinRaft field may be omitted, in which case offsets
default to 0.0 and the yaw entry is not generated. These offsets
Expand Down Expand Up @@ -60,20 +60,20 @@ To add a new camera (e.g., ``fooCam``, made up of 9 CCDs in a single
policy)
- add ``fooCam.yaml`` to ``policy/.gitignore``
- Create a new file ``python/lsst/obs/lsst/fooCam.py`` (see
``auxTel.py`` for an example)
``latiss.py`` for an example)

Add a class ``FooCamMapper`` to the same file, setting a class-level
string ``_cameraName`` to “fooCam”. You also need to specify the metadata
translation class to use such as ``LsstFooCamTranslator``. Look at the example in
``python/lsst/obs/lsst/auxTel/auxTel.py`` – you’ll see that this
``python/lsst/obs/lsst/latiss.py`` – you’ll see that this
overrides some entries in ``lsstCamMapper.yaml`` (in the class data
member ``yamlFileList``) with ``auxTelMapper.yaml``. If you want to
member ``yamlFileList``) with ``latissMapper.yaml``. If you want to
provide your own templates you’ll need to do the same thing, adding a
file ``policy/fooCam/fooCamMapper.yaml``

The name you provided as ``_cameraName`` is also used to e.g.,
provide per-camera configuration files (for example
``config/auxTel/ingest.py``)
``config/latiss/ingest.py``)

Don’t forget to add ``FooCamMapper`` to ``__all__``
- Write a header translator for your instrument. This should be placed in
Expand Down Expand Up @@ -105,9 +105,9 @@ To add a new camera (e.g., ``fooCam``, made up of 9 CCDs in a single
``lsst.obs.lsstCam.fooCam.FooCamMapper``
- Retarget ``config.parse`` in ``config/fooCam/ingest.py`` to
``FooCamParseTask``
- You will probably also want to copy e.g., ``config/auxTel/auxTel.py``
- You will probably also want to copy e.g., ``config/latiss/latiss.py``
to ``config/fooCam/fooCam.py`` and also files such as
``config/auxTel/bias.py`` – don’t forget to modify them to import
``config/latiss/bias.py`` – don’t forget to modify them to import
``fooCam.py``!
- Add ``FooCam.yaml`` to ``policy/.gitignore``
- Add test data and associated unit tests following the instructions in
Expand Down
File renamed without changes.
7 changes: 4 additions & 3 deletions auxTel/SConscript → latiss/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ for name in ("PYTHONPATH", "LD_LIBRARY_PATH",
# we may need an explicit library load path specified in the command
libpathstr = lsst.sconsUtils.utils.libraryLoaderEnvironment()

# We always run these commands with an explicit python rather than relying on the shebang
# We always run these commands with an explicit python rather than relying on
# the shebang
python = "{} python".format(libpathstr)

pipe_tasks_dir = lsst.sconsUtils.env.ProductDir('pipe_tasks')
data_dir = lsst.sconsUtils.env.ProductDir('obs_lsst_data')
command = (f"{python} {pipe_tasks_dir}/bin/ingestDefects.py auxTel/CALIB/ {data_dir}/auxTel/defects "+
"--calib auxTel/CALIB --config clobber=True")
command = (f"{python} {pipe_tasks_dir}/bin/ingestDefects.py latiss/CALIB/ {data_dir}/latiss/defects "
"--calib latiss/CALIB --config clobber=True")
commandInst = env.Command('CALIB/calibRegistry.sqlite3', [], command)
env.Depends(commandInst, lsst.sconsUtils.targets["python"])
2 changes: 1 addition & 1 deletion policy/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
auxTel.yaml
latiss.yaml
imsim.yaml
lsstCam.yaml
phosim.yaml
Expand Down
5 changes: 3 additions & 2 deletions policy/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ for name in ("PYTHONPATH", "LD_LIBRARY_PATH",
# we may need an explicit library load path specified in the command
libpathstr = lsst.sconsUtils.utils.libraryLoaderEnvironment()

# We always run these commands with an explicit python rather than relying on the shebang
# We always run these commands with an explicit python rather than relying on
# the shebang
python = "{} python".format(libpathstr)

for camera in ["auxTel", "lsstCam", "imsim", "phosim", "ts8", "ucd", "ts3", "comCam"]:
for camera in ["latiss", "lsstCam", "imsim", "phosim", "ts8", "ucd", "ts3", "comCam"]:
# Invoke the bin.src variant so that we do not depend on the shebang
# target having been run
commandInst = env.Command(f"{camera}.yaml", "",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
106 changes: 5 additions & 101 deletions python/lsst/obs/lsst/auxTel.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,107 +20,11 @@
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
#
import os.path
import re
import lsst.log
from . import LsstCamMapper, LsstCamMakeRawVisitInfo
from .ingest import LsstCamParseTask
from .translators import LsstAuxTelTranslator

__all__ = ["AuxTelMapper", "AuxTelParseTask"]
"""Backwards compatibility shim to allow gen2 repos to continue to
work with the legacy AuxTelMapper name.
"""

from .latiss import LatissMapper as AuxTelMapper

class AuxTelMakeRawVisitInfo(LsstCamMakeRawVisitInfo):
"""Make a VisitInfo from the FITS header of a raw image."""
metadataTranslator = LsstAuxTelTranslator


class AuxTelMapper(LsstCamMapper):
"""The Mapper for the auxTel camera."""

MakeRawVisitInfoClass = AuxTelMakeRawVisitInfo

_cameraName = "auxTel"
yamlFileList = ["auxTel/auxTelMapper.yaml"] + list(LsstCamMapper.yamlFileList)

def _extractDetectorName(self, dataId):
return f"{LsstAuxTelTranslator.DETECTOR_GROUP_NAME}_{LsstAuxTelTranslator.DETECTOR_NAME}"

def _computeCcdExposureId(self, dataId):
"""Compute the 64-bit (long) identifier for a CCD exposure.
Parameters
----------
dataId : `dict`
Data identifier including dayObs and seqNum.
Returns
-------
id : `int`
Integer identifier for a CCD exposure.
"""
if len(dataId) == 0:
return 0 # give up. Useful if reading files without a butler

if 'visit' in dataId:
visit = dataId['visit']
else:
visit = LsstAuxTelTranslator.compute_exposure_id(dataId['dayObs'], dataId["seqNum"])

if "detector" in dataId:
detector = dataId["detector"]
if detector != 0:
lsst.log.Log.getLogger("AuxTelMapper").warn("Got detector %d for AuxTel when it should"
" always be 0", detector)
else:
detector = 0

return LsstAuxTelTranslator.compute_detector_exposure_id(visit, detector)


class AuxTelParseTask(LsstCamParseTask):
"""Parser suitable for auxTel data.
"""

_mapperClass = AuxTelMapper
_translatorClass = LsstAuxTelTranslator

def translate_seqNum(self, md):
"""Return the sequence number.
Parameters
----------
md : `~lsst.daf.base.PropertyList` or `~lsst.daf.base.PropertySet`
Image metadata.
Returns
-------
seqnum : `int`
The sequence number identifier valid within a day.
"""

if "SEQNUM" in md:
return md.getScalar("SEQNUM")
#
# Oh dear. Extract it from the filename
#
seqNum = 0
for k in ("IMGNAME", "FILENAME"):
if k not in md:
continue
name = md.getScalar(k) # e.g. AT-O-20180816-00008
# Trim trailing extensions
name = os.path.splitext(name)[0]

# Want final digits
mat = re.search(r"(\d+)$", name)
if mat:
seqNum = int(mat.group(1)) # 00008
break

if seqNum == 0:
logger = lsst.log.Log.getLogger('obs.lsst.AuxTelParseTask')
logger.warn(
'Could not determine sequence number. Assuming %d ', seqNum)

return seqNum
__all__ = ["AuxTelMapper"]
4 changes: 2 additions & 2 deletions python/lsst/obs/lsst/comCam.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# see <http://www.lsstcorp.org/LegalNotices/>.
#
from . import LsstCamMapper, LsstCamMakeRawVisitInfo
from .auxTel import AuxTelMapper
from .latiss import LatissMapper
from .ingest import LsstCamParseTask
from .translators import LsstComCamTranslator

Expand All @@ -39,7 +39,7 @@ class LsstComCamMapper(LsstCamMapper):
MakeRawVisitInfoClass = LsstComCamMakeRawVisitInfo
_cameraName = "comCam"
yamlFileList = ["comCam/comCamMapper.yaml"] + \
list(AuxTelMapper.yamlFileList) + list(LsstCamMapper.yamlFileList)
list(LatissMapper.yamlFileList) + list(LsstCamMapper.yamlFileList)


class LsstComCamParseTask(LsstCamParseTask):
Expand Down

0 comments on commit bed7963

Please sign in to comment.