IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 19, 2013, 4:35:54 PM (13 years ago)
Author:
eugene
Message:

use MEMORY engine for dvoDetectionFull; add error handline for dvopsps; check mysql version; remove some test verbosity; check for image existence in dvoImages; skip bad batches but do not exit; fix precision issues; add -realgpc option (part of -test mode); log times in milliseconds

Location:
trunk/ippToPsps
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps

  • trunk/ippToPsps/jython/detectionbatch.py

    r35171 r35417  
    212212        )"
    213213
    214         print "frame meta sql: ", sql
     214        # print "frame meta sql: ", sql
    215215
    216216        self.scratchDb.execute(sql)
     
    607607         WHERE b.imageID = " + str(imageID) + \
    608608         " INTO OUTFILE '" + dumpFile + "'"
    609         print "sql: ", sql
    610         self.scratchDb.execute(sql)
     609
     610        try: self.scratchDb.execute(sql)
     611        except:
     612            self.logger.info("failed to select data for detectionCalib")
     613            self.logger.infoPair("sql: ", sql)
     614            raise
    611615
    612616        sql = "LOAD DATA INFILE '" + dumpFile + "' INTO TABLE " + tableName
    613         print "sql: ", sql
    614         self.scratchDb.execute(sql)
     617        try: self.scratchDb.execute(sql)
     618        except:
     619            self.logger.info("failed to load data from infile for detectionCalib")
     620            self.logger.infoPair("sql: ", sql)
     621            raise
    615622       
    616623    '''
     
    655662
    656663        # load corresponding header into memory
    657         header = self.fits.findAndReadHeader(extname)
     664        header = self.fits.findAndReadHeader(extname, self.config.test)
    658665        if not header:
    659             self.logger.errorPair("No header found for chip", chipname)
     666            # XXX There is no way to check if we SHOULD find a given
     667            # chip.  We have to accept the absence of the header as
     668            # information that the chip is not available.  This
     669            # message is too verbose, only print in test mode
     670            if self.config.test: self.logger.errorPair("No header found for chip", chipname)
    660671            return False
    661672       
     
    670681        # store these for later
    671682        self.imageIDs[chipname] = header['IMAGEID']
     683        self.sourceIDs[chipname] = header['SOURCEID']
    672684           
    673685        # populate ImageMeta
     
    691703        # dictionary objects to hold imageIDs for later
    692704        self.imageIDs = {}
     705        self.sourceIDs = {}
    693706
    694707        # loop through all OTAs and populate ImageMeta extensions
     
    773786        # this is a bit crude: if the chip is not present, this test will fail and the chip
    774787        # will be (correctly) skipped.  would be better to carry that information explicitly ("chip is missing")
    775         if not self.scratchDb.astrometricSolutionOK(chipname):
    776             self.logger.info("| %5s |            ------------- Bad astrometric solution : rejecting ------------                    |" % chipname)
     788
     789        # XXX keep this in or not?
     790        # if not self.scratchDb.astrometricSolutionOK(chipname):
     791        #     self.logger.info("| %5s |            ------------- Bad astrometric solution : rejecting ------------                    |" % chipname)
     792        #     return False
     793
     794        # does this chip exist in the DVO image table (if NOT, then skip it)
     795        if not self.scratchDb.haveThisChip(self.imageIDs[chipname], self.sourceIDs[chipname]):
     796            self.logger.info("| %5s |            ------------- Chip not in DVO : rejecting ------------                    |" % chipname)
    777797            return False
     798
    778799        self.logger.info("populate stuff ");
    779800        # populate remainder of tables
     
    803824        self.totalNullObjID    = self.totalNullObjID + results['NULLOBJID']
    804825        self.totalDetections   = self.totalDetections + rowCount
     826
     827        fractionKept = float(rowCount) / float(results['ORIGINALTOTAL'])
     828        # print "kept ", str(fractionKept), " detections from ", chipname
     829
     830        if fractionKept < 0.8:
     831            # print "Too many rejected detections (", str(fractionKept), ", fail on exposure for", chipname
     832            self.logger.infoPair("Too many rejected detections, fail on exposure for", chipname)
     833            self.skipBatch = True
     834            return False;
     835
    805836        #self.logger.info("updated totals")
    806837        # check we have something in this Detection table TODO add this to table above
    807838        if rowCount < 1:
    808             self.logger.infoPair("Skipping empty table for chipname", chipname)
     839            self.logger.infoPair("Empty table for chip, fail on exposure", chipname)
     840            self.skipBatch = True
    809841            return False;
    810842
     
    849881
    850882        # loop through all OTAs again to update with DVO IDs
     883        self.skipBatch = False
    851884        self.validChips = []   
    852885        self.tablesToExport = []   
     
    872905
    873906                if self.populatePspsTablesChip(ota, x, y, results, tables): otaCount = otaCount + 1
    874 
    875         if self.populatePspsTablesChip("Chip", 0, 0, results, tables): otaCount = otaCount + 1
     907                if self.skipBatch:
     908                    self.logger.error("fatal problem for exposure, skipping")
     909                    return False
     910
     911        if "Chip" in self.imageIDs:
     912            if self.populatePspsTablesChip("Chip", 0, 0, results, tables): otaCount = otaCount + 1
     913            if self.skipBatch:
     914                self.logger.error("fatal problem for exposure, skipping")
     915                return False
    876916
    877917        # print totals
     
    886926        self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+---------------+")
    887927
    888         # if we only have one table export, i.e. FrameMeta, then get out of here
     928        # if we only have one table export, i.e. FrameMeta, then get out of here (skip batch, but do not abort)
    889929        if len(self.tablesToExport) == 1:
    890            
     930            self.skipBatch = True
    891931            self.logger.error("No tables to export")
    892932            return False
Note: See TracChangeset for help on using the changeset viewer.