def run(args): # # Create the Config and use sum of gaussian basis # config = ModelPsfMatchTask.ConfigClass() config.kernel.active.scaleByFwhm = False # Run the requested method of the Task if args.template is not None and args.science is not None: if not os.path.isfile(args.template): raise FileNotFoundError("Template image %s does not exist" % (args.template)) if not os.path.isfile(args.science): raise FileNotFoundError("Science image %s does not exist" % (args.science)) try: templateExp = afwImage.ExposureF(args.template) except Exception: raise RuntimeError("Cannot read template image %s" % (args.template)) try: scienceExp = afwImage.ExposureF(args.science) except Exception: raise RuntimeError("Cannot read science image %s" % (args.science)) else: templateExp, scienceExp = generateFakeData() config.kernel.active.sizeCellX = 128 config.kernel.active.sizeCellY = 128 if args.debug: afwDisplay.Display(frame=1).mtv(templateExp, title="Example script: Input Template") afwDisplay.Display(frame=2).mtv( scienceExp, title="Example script: Input Science Image") # Create the Task psfMatchTask = MyModelPsfMatchTask(config=config) # Run the Task result = psfMatchTask.run(templateExp, scienceExp) if args.debug: # See if the LSST debug has incremented the frame number; if not start with frame 3 try: frame = debug.lsstDebug.frame + 1 except Exception: frame = 3 afwDisplay.Display(frame=frame).mtv( result.psfMatchedExposure, title="Example script: Matched Science Image")
def run(args): # # Create the Config and use sum of gaussian basis # config = ModelPsfMatchTask.ConfigClass() config.kernel.active.scaleByFwhm = False # Run the requested method of the Task if args.template is not None and args.science is not None: if not os.path.isfile(args.template): raise Exception, "Template image %s does not exist" % ( args.template) if not os.path.isfile(args.science): raise Exception, "Science image %s does not exist" % (args.science) try: templateExp = afwImage.ExposureF(args.template) except pexExcept.LsstCppException, e: raise Exception, "Cannot read template image %s" % (args.template) try: scienceExp = afwImage.ExposureF(args.science) except pexExcept.LsstCppException, e: raise Exception, "Cannot read science image %s" % (args.science)
def run(self, templateExp, scienceExp): return ModelPsfMatchTask.run(self, scienceExp, templateExp.getPsf())
def __init__(self, *args, **kwargs): ModelPsfMatchTask.__init__(self, *args, **kwargs)