def makeCameraFromPath(cameraConfig, ampInfoPath, shortNameFunc, pupilFactoryClass=PupilFactory): """Make a Camera instance from a directory of ampInfo files The directory must contain one ampInfo fits file for each detector in cameraConfig.detectorList. The name of each ampInfo file must be shortNameFunc(fullDetectorName) + ".fits". Parameters ---------- cameraConfig : `CameraConfig` Config describing camera and its detectors. ampInfoPath : `str` Path to ampInfo data files. shortNameFunc : callable A function that converts a long detector name to a short one. pupilFactoryClass : `type`, optional Class to attach to camera; default is `lsst.afw.cameraGeom.PupilFactory`. Returns ------- camera : `lsst.afw.cameraGeom.Camera` New Camera instance. """ ampInfoCatDict = dict() for detectorConfig in cameraConfig.detectorList.values(): shortName = shortNameFunc(detectorConfig.name) ampCatPath = os.path.join(ampInfoPath, shortName + ".fits") ampInfoCatalog = AmpInfoCatalog.readFits(ampCatPath) ampInfoCatDict[detectorConfig.name] = ampInfoCatalog return makeCameraFromCatalogs(cameraConfig, ampInfoCatDict, pupilFactoryClass)
def makeCameraFromPath(cameraConfig, ampInfoPath, shortNameFunc): """!Make a Camera instance from a directory of ampInfo files The directory must contain one ampInfo fits file for each detector in cameraConfig.detectorList. The name of each ampInfo file must be shortNameFunc(fullDetectorName) + ".fits". @param[in] cameraConfig an instance of CameraConfig @param[in] ampInfoPath path to ampInfo data files @param[in] shortNameFunc a function that converts a long detector name to a short one @return camera (an lsst.afw.cameraGeom.Camera) """ ampInfoCatDict = dict() for detectorConfig in cameraConfig.detectorList.itervalues(): shortName = shortNameFunc(detectorConfig.name) ampCatPath = os.path.join(ampInfoPath, shortName + ".fits") ampInfoCatalog = AmpInfoCatalog.readFits(ampCatPath) ampInfoCatDict[detectorConfig.name] = ampInfoCatalog return makeCameraFromCatalogs(cameraConfig, ampInfoCatDict)
def makeCameraFromPath(cameraConfig, ampInfoPath, shortNameFunc): """!Make a Camera instance from a directory of ampInfo files The directory must contain one ampInfo fits file for each detector in cameraConfig.detectorList. The name of each ampInfo file must be shortNameFunc(fullDetectorName) + ".fits". @param[in] cameraConfig an instance of CameraConfig @param[in] ampInfoPath path to ampInfo data files @param[in] shortNameFunc a function that converts a long detector name to a short one @return camera (an lsst.afw.cameraGeom.Camera) """ ampInfoCatDict = dict() for detectorConfig in cameraConfig.detectorList.itervalues(): shortName = shortNameFunc(detectorConfig.name) ampCatPath = os.path.join(ampInfoPath, shortName + ".fits") ampInfoCatalog = AmpInfoCatalog.readFits(ampCatPath) ampInfoCatDict[detectorConfig.name] = ampInfoCatalog return makeCameraFromCatalogs(cameraConfig, ampInfoCatDict)