def loadData(pixelScale=1.0): """Prepare the data we need to run the example""" # Load sample input from disk mypath = lsst.utils.getPackageDir('afwdata') print( " mypath = ", mypath) # mssg -- error happens before i can even possibly print this # sys.exit() imFile = os.path.join(mypath, "CFHT", "D4", "cal-53535-i-797722_small_1.fits") exposure = afwImage.ExposureF(imFile) # set the exposure time calib = afwImage.Calib() calib.setExptime(1.0) exposure.setCalib(calib) # add a filter afwImage.Filter.define(afwImage.FilterProperty(FilterName, 600, True)) exposure.setFilter(afwImage.Filter(FilterName)) # and a trivial WCS (needed by MyAstrometryTask) pixelScale /= 3600.0 # degrees per pixel wcs = afwImage.makeWcs(Coord(PointD(15, 1)), PointD(0, 0), pixelScale, 0.0, 0.0, pixelScale) exposure.setWcs(wcs) return exposure
def setUp(self): maskedImage = afwImage.MaskedImageF(inFilePathSmall) maskedImageMD = afwImage.readMetadata(inFilePathSmall) self.smallExposure = afwImage.ExposureF(inFilePathSmall) self.width = maskedImage.getWidth() self.height = maskedImage.getHeight() self.wcs = afwImage.makeWcs(maskedImageMD) self.psf = DummyPsf(2.0) self.detector = DetectorWrapper().detector self.exposureBlank = afwImage.ExposureF() self.exposureMiOnly = afwImage.makeExposure(maskedImage) self.exposureMiWcs = afwImage.makeExposure(maskedImage, self.wcs) self.exposureCrWcs = afwImage.ExposureF( 100, 100, self.wcs) # n.b. the (100, 100, ...) form self.exposureCrOnly = afwImage.ExposureF(afwGeom.ExtentI( 100, 100)) # test with ExtentI(100, 100) too afwImage.Filter.reset() afwImage.FilterProperty.reset() filterPolicy = pexPolicy.Policy() filterPolicy.add("lambdaEff", 470.0) afwImage.Filter.define(afwImage.FilterProperty("g", filterPolicy))
def loadData(psfSigma=1.5): """Prepare the data we need to run the example""" # Load sample input from disk mypath = lsst.utils.getPackageDir('afwdata') imFile = os.path.join(mypath, "CFHT", "D4", "cal-53535-i-797722_small_1.fits") exposure = afwImage.ExposureF(imFile) # add a filter afwImage.Filter.define(afwImage.FilterProperty(FilterName, 600, True)) exposure.setFilter(afwImage.Filter(FilterName)) # add a simple Gaussian PSF model psfModel = GaussianPsf(11, 11, psfSigma) exposure.setPsf(psfModel) return exposure
def defineFilterProperty(self, name, lambdaEff, force=False): return afwImage.FilterProperty(name, lambdaEff, force)