Coverage for python/lsst/obs/subaru/gen3/hsc/instrument.py : 43%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# This file is part of obs_subaru. # # 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 GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
# Regular expression that matches HSC PhysicalFilter names (the same as Gen2 # filternames), with a group that can be lowercased to yield the # associated AbstractFilter.
"""Gen3 Butler specialization class for Subaru's Hyper Suprime-Cam. """
def getName(self): # Docstring inherited from Instrument.getName
# Docstring inherited from Instrument.register camera = self.getCamera() dataId = {"instrument": self.getName()} registry.addDimensionEntry("Instrument", dataId) for detector in camera: registry.addDimensionEntry( "Detector", dataId, detector=detector.getId(), name=detector.getName(), # getType() returns a pybind11-wrapped enum, which # unfortunately has no way to extract the name of just # the value (it's always prefixed by the enum type name). purpose=str(detector.getType()).split(".")[-1], # HSC doesn't have rafts raft=None ) for physical in HSC_FILTER_NAMES: # We use one of grizy for the abstract filter, when appropriate, # which we identify as when the physical filter starts with # "HSC-[GRIZY]". Note that this means that e.g. "HSC-I" and # "HSC-I2" are both mapped to abstract filter "i". m = FILTER_REGEX.match(physical) registry.addDimensionEntry( "PhysicalFilter", dataId, physical_filter=physical, abstract_filter=m.group(1).lower() if m is not None else None )
# Docstring inherited from Instrument.getRawFormatter if dataId["detector"] in (100, 101, 102, 103): return HyperSuprimeCamCornerRawFormatter() else: return HyperSuprimeCamRawFormatter()
"""Retrieve the cameraGeom representation of HSC.
This is a temporary API that should go away once obs_ packages have a standardized approach to writing versioned cameras to a Gen3 repo. """ path = os.path.join(getPackageDir("obs_subaru"), "hsc", "camera") config = CameraConfig() config.load(os.path.join(path, "camera.py")) return makeCameraFromPath( cameraConfig=config, ampInfoPath=path, shortNameFunc=lambda name: name.replace(" ", "_"), pupilFactoryClass=HscPupilFactory )
"""Write a 'camera' Dataset to the given Butler with an infinite validity range.
This is a temporary API that should go away once obs_ packages have a standardized approach to writing versioned cameras to a Gen3 repo. """ datasetType = DatasetType("camera", ("Instrument", "ExposureRange"), "TablePersistableCamera") butler.registry.registerDatasetType(datasetType) camera = self.getCamera() butler.put(camera, datasetType, instrument=self.getName(), valid_first=datetime.min, valid_last=datetime.max) |