Changeset 35417 for trunk/ippToPsps/jython/detectionbatch.py
- Timestamp:
- Apr 19, 2013, 4:35:54 PM (13 years ago)
- Location:
- trunk/ippToPsps
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
jython/detectionbatch.py (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130307/ippToPsps (added) merged: 35350,35352,35369,35402-35404,35413
- Property svn:mergeinfo changed
-
trunk/ippToPsps/jython/detectionbatch.py
r35171 r35417 212 212 )" 213 213 214 print "frame meta sql: ", sql214 # print "frame meta sql: ", sql 215 215 216 216 self.scratchDb.execute(sql) … … 607 607 WHERE b.imageID = " + str(imageID) + \ 608 608 " 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 611 615 612 616 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 615 622 616 623 ''' … … 655 662 656 663 # load corresponding header into memory 657 header = self.fits.findAndReadHeader(extname )664 header = self.fits.findAndReadHeader(extname, self.config.test) 658 665 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) 660 671 return False 661 672 … … 670 681 # store these for later 671 682 self.imageIDs[chipname] = header['IMAGEID'] 683 self.sourceIDs[chipname] = header['SOURCEID'] 672 684 673 685 # populate ImageMeta … … 691 703 # dictionary objects to hold imageIDs for later 692 704 self.imageIDs = {} 705 self.sourceIDs = {} 693 706 694 707 # loop through all OTAs and populate ImageMeta extensions … … 773 786 # this is a bit crude: if the chip is not present, this test will fail and the chip 774 787 # 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) 777 797 return False 798 778 799 self.logger.info("populate stuff "); 779 800 # populate remainder of tables … … 803 824 self.totalNullObjID = self.totalNullObjID + results['NULLOBJID'] 804 825 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 805 836 #self.logger.info("updated totals") 806 837 # check we have something in this Detection table TODO add this to table above 807 838 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 809 841 return False; 810 842 … … 849 881 850 882 # loop through all OTAs again to update with DVO IDs 883 self.skipBatch = False 851 884 self.validChips = [] 852 885 self.tablesToExport = [] … … 872 905 873 906 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 876 916 877 917 # print totals … … 886 926 self.logger.info("+-------+---------------+---------------+---------------+---------------+---------------+---------------+") 887 927 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) 889 929 if len(self.tablesToExport) == 1: 890 930 self.skipBatch = True 891 931 self.logger.error("No tables to export") 892 932 return False
Note:
See TracChangeset
for help on using the changeset viewer.
