def calculateZeropoint(self, rc):
        """ calculateZeropoint primitive
        """
        adOuts = []
        try:
            log.info(" primitive calculateZeropoint")
            for ad in rc.get_inputs(style='AD'):
                 czp  = CalculateZeropoint(ad, logfile='', 
                                           zplogfile=rc['zplogfile'],
                                           extinction=rc['extinction'])
                 adout = czp.runZP()
                 adOuts.append(adout)
            rc.report_output(adOuts)
        except:
            raise FluxCalException("Problems with calculateZeropoint")

        yield rc
    def fluxcal(self, rc):
        """
          Fluxcal drives:
            - DetectSources
            - AddReferenceCatalogs
            - CorrelateWithReferenceCatalogs
            - CalculateZeropoint
        """

        logfile = 'fluxcal.log'
        adOuts = []

        try:
            log.status('*STARTING*  Running fluxcal functions')
            for ad in rc.get_inputs(style='AD'):

                ds   = DetectSources   (ad, logfile=logfile, sigma=rc['sigma'], 
                                        threshold=rc['threshold'], fwhm=rc['fwhm'])
                adout = ds.runDS()

                cc   = AddReferenceCatalogs(adout, logfile=logfile, 
                                            catalogName=rc['catalogName'])
                adout = cc.getRefs()

                corr = CorrelateWithReferenceCatalogs (adout, logfile=logfile,
                                                       delta=rc['delta'])
                adout = corr.runCorr()

                czp  = CalculateZeropoint(adout, logfile=logfile, 
                                           zplogfile=rc['zplogfile'],
                                           extinction=rc['extinction'])
                adout = czp.runZP()

                adOuts.append(adout)

            rc.report_output(adOuts)

            log.status('Fluxcal completed successfully')
        except:
            raise FluxCalException("Problems with fluxcal")

        yield rc
Exemple #3
0
    def runFC(self):
        log = self.log
        adout = self.adout
        logfile = self.logfile

        adout = self._detsources()

        cc   = AddReferenceCatalogs(adout, logfile=logfile)
        adout = cc.getRefs()

        corr = CorrelateWithReferenceCatalogs (adout, logfile=logfile)
        adout = corr.runCorr()

        czp  = CalculateZeropoint(adout, logfile=logfile)
        adout = czp.runZP()
       
        self.adout = adout

        ofile = 'zp_'+adout.filename
        log.info("writing output fits file: "+ofile)
        if adout: adout.write(ofile, clobber=True)