def __init__(self, **kwargs): # Inject new mappings from importExtData's policy file. # This is a bit of a hack; we're pretending these policy entries # come from the configuration inside the repository itself, since # those always override and extend those from the camera's definitions. # Luckily, no one actually uses those per-repository policy entries # for anything else, so this should be safe. kwargs["repositoryCfg"] = self.makeNewConfig(kwargs["repositoryCfg"]) HscMapper.__init__(self, **kwargs) # add filters afwImage.utils.defineFilter(name='MegaCam-uS', lambdaEff=375, alias=[ 'u1', 'u', ]) afwImage.utils.defineFilter(name='MegaCam-u', lambdaEff=375, alias=[ 'u2', ]) afwImage.utils.defineFilter(name='VIRCAM-Y', lambdaEff=1021, alias=[ 'Y', 'y', ]) afwImage.utils.defineFilter(name='VIRCAM-J', lambdaEff=1254, alias=[ 'J', 'j', ]) afwImage.utils.defineFilter(name='VIRCAM-H', lambdaEff=1646, alias=[ 'H', 'h', ]) afwImage.utils.defineFilter(name='VIRCAM-Ks', lambdaEff=2149, alias=[ 'Ks', 'k', ]) for f in [ 'MegaCam-uS', 'MegaCam-u', 'VIRCAM-Y', 'VIRCAM-J', 'VIRCAM-H', 'VIRCAM-Ks' ]: self.filters[f] = afwImage.Filter( afwImage.Filter(f).getId()).getName()
def makeDistortionData(self): """Make distortion data The data format is a dict of detector name: ccdData, where ccdData is a Struct containing these fields: - serial: detector.getSerial - cornerDict: a dict of pixPosKey, cornerData, where: - pixPosKey: self.asKey(pixPos) where pixPos is pixel position - cornerData is Struct contains these fields (all of type lsst.geom.Point2D): - pixPos: pixel position - focalPlane: focal plane position computed from pixPos - fieldAngle: fieldAngle position computed from focalPlane - focalPlaneRoundTrip: focal plane position computed from fieldAngle - pixPosRoundTrip: pixel position computed from focalPlane """ camera = HscMapper(root=".", calibRoot=".").camera focalPlaneToFieldAngle = camera.getTransformMap().getTransform(FOCAL_PLANE, FIELD_ANGLE) data = {} # dict of detector name: CcdData for detector in camera: # for each corner of each CCD: # - get pixel position # - convert to focal plane coordinates using the detector and # record it # - convert to field angle (this is the conversion that uses # HscDistortion) and record it # - convert back to focal plane (testing inverse direction of # HscDistortion) and record it # - convert back to pixel position and record it; pixel <-> focal # plane is affine so there is no reason to doubt the inverse # transform, but there is no harm pixelsToFocalPlane = detector.getTransform(PIXELS, FOCAL_PLANE) cornerDict = {} for pixPos in detector.getCorners(PIXELS): pixPos = pixPos focalPlane = pixelsToFocalPlane.applyForward(pixPos) fieldAngle = focalPlaneToFieldAngle.applyForward(focalPlane) focalPlaneRoundTrip = focalPlaneToFieldAngle.applyInverse(fieldAngle) pixPosRoundTrip = pixelsToFocalPlane.applyInverse(focalPlane) cornerDict[self.toKey(pixPos)] = Struct( pixPos = pixPos, focalPlane = focalPlane, fieldAngle = fieldAngle, focalPlaneRoundTrip = focalPlaneRoundTrip, pixPosRoundTrip = pixPosRoundTrip, ) data[detector.getName()] = Struct(serial=detector.getSerial(), cornerDict=cornerDict) return data
def __init__(self, **kwargs): # Inject new mappings from importExtData's policy file. # This is a bit of a hack; we're pretending these policy entries # come from the configuration inside the repository itself, since # those always override and extend those from the camera's definitions. # Luckily, no one actually uses those per-repository policy entries # for anything else, so this should be safe. kwargs["repositoryCfg"] = self.makeNewConfig(kwargs["repositoryCfg"]) HscMapper.__init__(self, **kwargs) # add filters afwImage.utils.defineFilter(name='MegaCam-uS', lambdaEff=375, alias=['u1', 'u',]) afwImage.utils.defineFilter(name='MegaCam-u', lambdaEff=375, alias=['u2',]) afwImage.utils.defineFilter(name='VIRCAM-Y', lambdaEff=1021, alias=['Y','y',]) afwImage.utils.defineFilter(name='VIRCAM-J', lambdaEff=1254, alias=['J','j',]) afwImage.utils.defineFilter(name='VIRCAM-H', lambdaEff=1646, alias=['H','h',]) afwImage.utils.defineFilter(name='VIRCAM-Ks', lambdaEff=2149, alias=['Ks','k',]) for f in ['MegaCam-uS', 'MegaCam-u', 'VIRCAM-Y', 'VIRCAM-J', 'VIRCAM-H', 'VIRCAM-Ks']: self.filters[f] = afwImage.Filter(afwImage.Filter(f).getId()).getName()
def what_exists(self, all=False): """ Check for the existence of various useful things. Parameters ========== all: boolean If true, the method will check all possible dataset types Returns ======= exists: dict Checklist of what exists (True) and what does not (False) """ # Get mappers for all tested repos from lsst.obs.hsc import HscMapper from lsst.obs.comCam import ComCamMapper #from lsst.obs.lsst import LsstCamMapper from lsst.obs.ctio0m9 import Ctio0m9Mapper #select proper mapper if self.repo.find('hsc') != -1: mapper = HscMapper(root=self.repo) elif self.repo.find('comCam') != -1: mapper = ComCamMapper(root=self.repo) #elif self.repo.find('DC2') != -1: mapper = LsstCamMapper(root=self.repo) elif self.repo.find('ctio0m9') != -1: mapper = Ctio0m9Mapper(root=self.repo) else: print("Unable to locate Mapper file in specified repo. Check that you selected a valid repo.") if all: #collect a list of all possible dataset types mapper = HscMapper(root=self.repo) all_dataset_types = mapper.getDatasetTypes() remove = ['_config', '_filename', '_md', '_sub', '_len', '_schema', '_metadata'] interesting = [] for dataset_type in all_dataset_types: keep = True for word in remove: if word in dataset_type: keep = False if keep: interesting.append(dataset_type) else: interesting = ['raw', 'calexp', 'src', 'deepCoadd_calexp', 'deepCoadd_meas'] self.look_for_datasets_of_type(interesting) self.look_for_skymap() self.existence = True return
def setUp(self): HscMapper.clearCache() lsst.utils.tests.MemoryTestCase.setUp(self)
def setUp(self): self.mapper = HscMapper(root=".", calibRoot=".") self.camera = self.mapper.camera