Changeset 35124
- Timestamp:
- Feb 7, 2013, 2:12:41 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/detectionbatch.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/detectionbatch.py
r35097 r35124 389 389 except: pass 390 390 391 # delete all detections with PSF_INST_MAG < -17.5, as decreed by Gene 391 # XXX we no longer delete detections with funny mags (eg PSF_INST_MAG < -17.5) 392 # for examples of code which do this, go to r35097 or earlier 393 392 394 BEFORE = self.scratchDb.getRowCount(ippTableName) 393 #don't do this anymore394 #sql = "DELETE FROM " + ippTableName + " WHERE PSF_INST_MAG < -17.5"395 #self.scratchDb.execute(sql)396 #DELETED = BEFORE - self.scratchDb.getRowCount(ippTableName)397 #results['SATDET'] = BEFORE - self.scratchDb.getRowCount(ippTableName)398 #we aren't deletng these now399 395 results['SATDET'] = 0 400 #self.logger.infoPair("Saturated detections", "%d deleted" % DELETED)401 396 402 397 # insert all detections into table … … 473 468 self.scratchDb.execute(sql) 474 469 475 # now delete bad flux and bad chip positions476 #sql="DELETE FROM " + pspsTableName + " WHERE instFlux < 0.0000001" # TODO clearly a hack = 0 not allowed for instFlux477 #self.scratchDb.execute(sql)478 479 470 # add a instFlux = 0.0 -> 0.000001 471 # XXX EAM : why is this done? 480 472 sql="UPDATE " + pspsTableName + " SET psfFlux = 0.0000001 WHERE psfFlux = 0" 481 473 self.scratchDb.execute(sql) 482 474 483 # update cosmic ray and extended likelihoods 484 #sql="UPDATE " + pspsTableName + " SET extendedLikelihood = 0, crLikelihood = 1.0 - psfLikelihood WHERE sgSep <= 0" 485 #self.scratchDb.execute(sql) 486 #sql="UPDATE " + pspsTableName + " SET crLikelihood = 0, extendedLikelihood = 1.0 - psfLikelihood WHERE sgSep > 0" 487 #self.scratchDb.execute(sql) 488 489 # remove detections will NULL inst flux or NULL peak ADU 490 # leave them in at this stage- don't delete them. 491 #results['NULLINSTFLUX'] = self.scratchDb.reportAndDeleteRowsWithNULLS(pspsTableName, "instFlux") 492 #results['NULLPEAKADU'] = self.scratchDb.reportAndDeleteRowsWithNULLS(pspsTableName, "peakADU") 493 #we don't delete thos anymore 475 # we don't delete these anymore 494 476 results['NULLINSTFLUX'] = 0; 495 477 results['NULLPEAKADU'] = 0; … … 857 839 self.logger.info("updated detectioncalibtable") 858 840 841 self.validChips.append(chipname) 842 859 843 return True 860 844 … … 865 849 866 850 # loop through all OTAs again to update with DVO IDs 851 self.validChips = [] 867 852 self.tablesToExport = [] 868 853 self.tablesToExport.append("FrameMeta") … … 907 892 return False 908 893 894 # XXX EAM : turn this on (and fix up the code) if we need it 895 # self.removeDuplicateObjects() 896 909 897 self.setMinMaxObjID(tables) 910 898 … … 914 902 915 903 return True 904 905 def removeDuplicateObjects(self): 906 907 sql = "DROP TABLE SkinnyObject_All" 908 try: 909 self.scratchDb.execute(sql) 910 except: 911 print "SkinnyObject_All table not yet defined" 912 913 sql = "CREATE TABLE SkinnyObject_All (objID bigint, ippObjID bigint, chipID char(16))" 914 try: 915 self.scratchDb.execute(sql) 916 except: 917 print "failed to create table SkinnyObject_All" 918 raise 919 920 for chipname in self.validChips: 921 922 sql = "INSERT INTO SkinnyObject_All (objID, ippObjID, chipID) \ 923 SELECT objID, ippObjID, '" + chipname + "' from SkinnyObject_" + chipname 924 try: 925 self.scratchDb.execute(sql) 926 except: 927 print "failed to insert entry SkinnyObject_All: ", chipname 928 raise 929 930 931 Nduplicates = 0 932 sql = "SELECT n, objID from (select count(objID) as n, objID from SkinnyObject_All group by objID) as tmp where n > 1" 933 try: 934 rs = self.scratchDb.executeQuery(sql) 935 while (rs.next()): 936 objID = rs.getInt(1) 937 chipID = rs.getString(3) 938 print "delete: ", str(objID), chipID 939 Nduplicates += 1 940 941 rs.close() 942 except: 943 print "failed to get duplicates" 944 raise 945 946 print "duplicates found: ", str(Nduplicates) 916 947 917 948 ''' … … 935 966 936 967 ''' 968 This function reads the cmf/smf file and loads it into the database as its own table 937 969 Overriding this method. Filter to only import *.psf extensions 938 970 '''
Note:
See TracChangeset
for help on using the changeset viewer.
