def makeCamera(name="SDSS", outputDir=None): """Make a camera @param name: name of the camera @param outputDir: If not None, write the objects used to make the camera to this location @return a camera object """ camConfig = CameraConfig() camConfig.name = name camConfig.detectorList = {} camConfig.plateScale = 16.5 # arcsec/mm pScaleRad = geom.arcsecToRad(camConfig.plateScale) radialDistortCoeffs = [0.0, 1.0 / pScaleRad] tConfig = afwGeom.TransformConfig() tConfig.transform.name = 'inverted' radialClass = afwGeom.transformRegistry['radial'] tConfig.transform.active.transform.retarget(radialClass) tConfig.transform.active.transform.coeffs = radialDistortCoeffs tmc = TransformMapConfig() tmc.nativeSys = FOCAL_PLANE.getSysName() tmc.transforms = {FIELD_ANGLE.getSysName(): tConfig} camConfig.transformDict = tmc ccdId = 0 ampInfoCatDict = {} for i in range(6): dewarName = str(i + 1) filters = "riuzg" for j, c in enumerate(reversed(filters)): ccdName = "%s%s" % (c, dewarName) offsetPoint = geom.Point2D(25.4 * 2.5 * (2.5 - i), 25.4 * 2.1 * (2.0 - j)) ccdInfo = makeCcd(ccdName, ccdId, offsetPoint) ampInfoCatDict[ccdName] = ccdInfo['ampInfo'] camConfig.detectorList[ccdId] = ccdInfo['ccdConfig'] ccdId += 1 if outputDir is not None: camConfig.save(os.path.join(outputDir, 'camera.py')) for k in ampInfoCatDict: ampInfoCatDict[k].writeFits( os.path.join(outputDir, "%s.fits" % (k))) return makeCameraFromAmpLists(camConfig, ampInfoCatDict)
def makeCamera(name="SDSS", outputDir=None): """Make a camera @param name: name of the camera @param outputDir: If not None, write the objects used to make the camera to this location @return a camera object """ camConfig = CameraConfig() camConfig.name = name camConfig.detectorList = {} camConfig.plateScale = 16.5 # arcsec/mm pScaleRad = afwGeom.arcsecToRad(camConfig.plateScale) radialDistortCoeffs = [0.0, 1.0/pScaleRad] tConfig = afwGeom.TransformConfig() tConfig.transform.name = 'inverted' radialClass = afwGeom.transformRegistry['radial'] tConfig.transform.active.transform.retarget(radialClass) tConfig.transform.active.transform.coeffs = radialDistortCoeffs tmc = TransformMapConfig() tmc.nativeSys = FOCAL_PLANE.getSysName() tmc.transforms = {FIELD_ANGLE.getSysName(): tConfig} camConfig.transformDict = tmc ccdId = 0 ampInfoCatDict = {} for i in range(6): dewarName = str(i+1) filters = "riuzg" for j, c in enumerate(reversed(filters)): ccdName = "%s%s" % (c, dewarName) offsetPoint = afwGeom.Point2D(25.4*2.5*(2.5-i), 25.4*2.1*(2.0 - j)) ccdInfo = makeCcd(ccdName, ccdId, offsetPoint) ampInfoCatDict[ccdName] = ccdInfo['ampInfo'] camConfig.detectorList[ccdId] = ccdInfo['ccdConfig'] ccdId += 1 if outputDir is not None: camConfig.save(os.path.join(outputDir, 'camera.py')) for k in ampInfoCatDict: ampInfoCatDict[k].writeFits(os.path.join(outputDir, "%s.fits"%(k))) return makeCameraFromCatalogs(camConfig, ampInfoCatDict)
pincushion = 0.925 # Don't have this yet ticket/3155 # camConfig.boresiteOffset_x = 0. # camConfig.boresiteOffset_y = 0. tConfig = afwGeom.TransformConfig() tConfig.transform.name = 'inverted' radialClass = afwGeom.transformRegistry['radial'] tConfig.transform.active.transform.retarget(radialClass) # According to Dave M. the simulated LSST transform is well approximated (1/3 pix) # by a scale and a pincusion. tConfig.transform.active.transform.coeffs = [ 0., 1. / pScaleRad, 0., pincushion / pScaleRad ] # tConfig.transform.active.boresiteOffset_x = camConfig.boresiteOffset_x # tConfig.transform.active.boresiteOffset_y = camConfig.boresiteOffset_y tmc = TransformMapConfig() tmc.nativeSys = FOCAL_PLANE.getSysName() tmc.transforms = {FIELD_ANGLE.getSysName(): tConfig} camConfig.transformDict = tmc def makeDir(dirPath, doClobber=False): """Make a directory; if it exists then clobber or fail, depending on doClobber @param[in] dirPath: path of directory to create @param[in] doClobber: what to do if dirPath already exists: if True and dirPath is a dir, then delete it and recreate it, else raise an exception @throw RuntimeError if dirPath exists and doClobber False """ if os.path.exists(dirPath): if doClobber and os.path.isdir(dirPath): print("Clobbering directory %r" % (dirPath, ))
camConfig.plateScale = 20.0 pScaleRad = afwGeom.arcsecToRad(camConfig.plateScale) pincushion = 0.925 # Don't have this yet ticket/3155 # camConfig.boresiteOffset_x = 0. # camConfig.boresiteOffset_y = 0. tConfig = afwGeom.TransformConfig() tConfig.transform.name = 'inverted' radialClass = afwGeom.transformRegistry['radial'] tConfig.transform.active.transform.retarget(radialClass) # According to Dave M. the simulated LSST transform is well approximated (1/3 pix) # by a scale and a pincusion. tConfig.transform.active.transform.coeffs = [0., 1./pScaleRad, 0., pincushion/pScaleRad] # tConfig.transform.active.boresiteOffset_x = camConfig.boresiteOffset_x # tConfig.transform.active.boresiteOffset_y = camConfig.boresiteOffset_y tmc = TransformMapConfig() tmc.nativeSys = FOCAL_PLANE.getSysName() tmc.transforms = {FIELD_ANGLE.getSysName(): tConfig} camConfig.transformDict = tmc def makeDir(dirPath, doClobber=False): """Make a directory; if it exists then clobber or fail, depending on doClobber @param[in] dirPath: path of directory to create @param[in] doClobber: what to do if dirPath already exists: if True and dirPath is a dir, then delete it and recreate it, else raise an exception @throw RuntimeError if dirPath exists and doClobber False """ if os.path.exists(dirPath): if doClobber and os.path.isdir(dirPath): print("Clobbering directory %r" % (dirPath,))