Skip to content

Commit

Permalink
Add docstring to curated calibrations routine
Browse files Browse the repository at this point in the history
This is in preparation for moving it to obs_base so it can be
reused by other obs packages.
  • Loading branch information
timj committed Mar 20, 2020
1 parent ff16497 commit 29a1d70
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions python/lsst/obs/lsst/gen3/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class LsstCamInstrument(Instrument):
_camera = None
_cameraCachedClass = None
translatorClass = LsstCamTranslator
obsDataPackageDir = getPackageDir("obs_lsst_data")

@property
def configPaths(self):
Expand Down Expand Up @@ -181,10 +182,30 @@ def writeCuratedCalibrations(self, butler):
definition["storageClass"],
universe=butler.registry.dimensions)
butler.registry.registerDatasetType(datasetType)
self._write_obs_lsst_data(butler, datasetType)

def _write_obs_lsst_data(self, butler, datasetType):
calibPath = os.path.join(getPackageDir("obs_lsst_data"), self.policyName,
self._writeCuratedCalibrationDataset(butler, datasetType)

def _writeCuratedCalibrationDataset(self, butler, datasetType):
"""Write a standardized curated calibration dataset from an obs data
package.
Parameters
----------
butler : `lsst.daf.butler.Butler`
Gen3 butler in which to put the calibrations.
datasetType : `lsst.daf.butler.DatasetType`
Dataset type to be put.
Notes
-----
This method scans the location defined in the ``obsDataPackageDir``
class attribute for curated calibrations corresponding to the
supplied dataset type. The directory name in the data package much
match the name of the dataset type. They are assumed to use the
standard layout and can be read by
`~lsst.pipe.tasks.read_curated_calibs.read_all` and provide standard
metadata.
"""
calibPath = os.path.join(self.obsDataPackageDir, self.policyName,
datasetType.name)

if not os.path.exists(calibPath):
Expand Down

0 comments on commit 29a1d70

Please sign in to comment.