-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from lsst/tickets/DM-22655
DM-22655: Genericize gen2to3.py to be useable with any gen2 repo
- Loading branch information
Showing
9 changed files
with
176 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Config overrides for converting gen2 to gen3 repos. | ||
|
||
from lsst.obs.base.gen2to3 import Translator, AbstractToPhysicalFilterKeyHandler | ||
import lsst.obs.decam | ||
|
||
# Use the specialized Decam ingest task to handle multi-HDU FITS files. | ||
config.raws.retarget(lsst.obs.decam.DecamRawIngestTask) | ||
|
||
# DECam names its detectors differently in the registry | ||
config.ccdKey = "ccdnum" | ||
|
||
# Community Pipeline-produced calibrations are all Images. | ||
config.storageClasses['cpBias'] = "ExposureF" | ||
config.storageClasses['cpFlat'] = "ExposureF" | ||
config.storageClasses['cpIllumcor'] = "ExposureF" | ||
|
||
# DECam calibRegistry entries are abstract_filters, but we need physical_filter | ||
# in the gen3 registry. | ||
Translator.addRule(AbstractToPhysicalFilterKeyHandler(lsst.obs.decam.DarkEnergyCamera.filterDefinitions), | ||
instrument=lsst.obs.decam.DarkEnergyCamera.getName(), | ||
gen2keys=("filter",), | ||
consume=("filter",), | ||
datasetTypeName="cpFlat") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ exclude = | |
__init__.py | ||
config/* | ||
tests/.tests/* | ||
tests/config/* | ||
decam/camGeom/camera.py | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Config overrides for `test_convert2to3.py` | ||
# The decam conversion tests use `ap_verify_ci_hits2015`, which has two refcats. | ||
|
||
config.refCats = ['gaia', 'panstarrs'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# This file is part of obs_decam. | ||
# | ||
# 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/>. | ||
|
||
"""Unit tests for DECam gen2 to gen3 conversion. | ||
""" | ||
|
||
import itertools | ||
import os | ||
import unittest | ||
|
||
import lsst.utils.tests | ||
from lsst.obs.base.gen2to3 import convertTests | ||
import lsst.obs.decam | ||
|
||
# testDataPackage = "testdata_decam" | ||
testDataPackage = "ap_verify_ci_hits2015" | ||
try: | ||
testDataDirectory = lsst.utils.getPackageDir(testDataPackage) | ||
except LookupError: | ||
testDataDirectory = None | ||
|
||
|
||
@unittest.skipIf(testDataDirectory is None, f"{testDataPackage} not setup") | ||
class DecamConvertGen2To3TestCase(convertTests.ConvertGen2To3TestCase, | ||
lsst.utils.tests.TestCase): | ||
def setUp(self): | ||
# self.gen2root = os.path.join(testDataDirectory, 'rawData') | ||
# self.gen2calib = os.path.join(testDataDirectory, 'rawData/cpCalib') | ||
# NOTE: this test will produce a bunch fo "Skipping ingestion for" warnings, | ||
# due to the bias/flat calibRegistry only having the same ccds as the | ||
# raws, even though the files themselves have more. | ||
self.gen2root = os.path.join(testDataDirectory, 'gen2-output/ingested') | ||
self.gen2calib = os.path.join(testDataDirectory, 'gen2-output/calibingested') | ||
self.instrumentName = "DECam" | ||
self.instrumentClass = "lsst.obs.decam.DarkEnergyCamera" | ||
self.config = os.path.join(os.path.abspath(os.path.dirname(__file__)), | ||
"config", "convert2to3Config.py") | ||
self.args = ("--calibFilterType", "abstract_filter") | ||
self.collections = set(['skymaps']) | ||
|
||
detectors = (5, 10, 56, 60) | ||
dates = ('2015-02-18', '2015-03-13') | ||
self.biasName = 'cpBias' | ||
self.biases = [{'detector': detector, 'calibration_label': f"gen2/cpBias_{date}_{detector:03}", | ||
'instrument': 'DECam'} | ||
for detector, date in itertools.product(detectors, dates)] | ||
self.flatName = 'cpFlat' | ||
self.flats = [{'detector': detector, | ||
'calibration_label': f"gen2/cpFlat_{date}_{detector:03}_g", | ||
'instrument': 'DECam', 'physical_filter': 'g DECam SDSS c0001 4720.0 1520.0'} | ||
for detector, date in itertools.product(detectors, dates)] | ||
self.refcats = ['gaia', 'panstarrs'] | ||
super().setUp() | ||
|
||
|
||
def setup_module(module): | ||
lsst.utils.tests.init() | ||
|
||
|
||
if __name__ == "__main__": | ||
lsst.utils.tests.init() | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters