Changeset 38290 for trunk/ippToPsps/jython/detectionbatch.py
- Timestamp:
- May 18, 2015, 9:32:22 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/detectionbatch.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/detectionbatch.py
r38237 r38290 307 307 Populates the ImageDetEffMeta table for this OTA 308 308 ''' 309 def populateImageDetEffMetaTable (self, ota, header):309 def populateImageDetEffMetaTablePart1(self, ota, header): 310 310 ippTableName = ota + "_deteff" 311 311 tableName = "ImageDetEffMeta_" + ota 312 312 self.scratchDb.dropTable(tableName) 313 313 # we drop the table before calling this functoin so it is not left behind on failure 314 314 sql = "CREATE TABLE " + tableName + " LIKE ImageDetEffMeta" … … 323 323 324 324 sqlLine.group("frameID", str(self.expID)) 325 sqlLine.group("magref", self.getKeyFloat(header,"%.8f"," MAGREF"))325 sqlLine.group("magref", self.getKeyFloat(header,"%.8f","DETEFF.MAGREF")) 326 326 sql = sqlLine.make(") VALUES ( ", ")") 327 327 … … 337 337 338 338 # for loop 339 340 ''' 341 Populates the ImageDetEffMeta table for this OTA 342 ''' 343 def populateImageDetEffMetaTablePart2(self, ota): 344 ippTableName = ota + "_deteff" 345 tableName = "ImageDetEffMeta_" + ota 346 347 # ok, this is a bit tricky - Ideally I just want this all in one table, however, the way the table is layed out is 90 degrees from how I want it. 348 # the steps out of this mess are as follows: 349 # give an index to XYxy_deteff (already done, called table_index) 350 # do a loop to grab the 5 colums and fill them 351 352 # for loop 339 353 for i in xrange(1, 14): 340 stringint = str(i) 341 stringint.rjust(2, '0') 342 sqlLine = sqlUtility("INSERT INTO " + tableName + "(") 343 sqlLine.group("offset"+stringint, "OFFSET") 344 sqlLine.group("counts"+stringint, "COUNTS") 345 sqlLine.group("diffMean"+stringint, "DIFF.MEAN") 346 sqlLine.group("diffStdev01"+stringint, "DIFF.STDEV") 347 sqlLine.group("errMean01"+stringing, "ERR.MEAN") 348 sql = sqlLine.makeRaw(") SELECT ", "FROM " + ippTableName + " WHERE table_index = " + str(i)) 349 try: self.scratchDb.execute(sql) 350 except: 354 stringint = str(i) 355 if i < 10: 356 stringint = '0'+str(i) 357 358 # stringint.rjust(2, '0') 359 sql = "UPDATE " +tableName+ " , " + ippTableName + " SET \ 360 offset"+stringint + " = OFFSET \ 361 ,counts" +stringint + " = COUNTS \ 362 ,diffMean" + stringint + " = DIFF_MEAN \ 363 ,diffStdev" + stringint + " = DIFF_STDEV \ 364 ,errMean" + stringint + " = ERR_MEAN \ 365 WHERE table_index = " + str(i) 366 367 # sqlLine = sqlUtility("UPDATE " + tableName + "," + ippTableName " SET ") 368 # sqlLine.group("offset ="+stringint, "OFFSET") 369 # sqlLine.group(",counts ="+stringint, "COUNTS") 370 # sqlLine.group(",diffMean ="+stringint, "DIFF_MEAN") 371 # sqlLine.group(",diffStdev ="+stringint, "DIFF_STDEV") 372 # sqlLine.group(",errMean ="+stringint, "ERR_MEAN") 373 # sql = sqlLine.makeRaw(" SELECT ", "FROM " + ippTableName + " WHERE table_index = " + str(i) + " and frameID = " + str(self.expID)) 374 375 try: self.scratchDb.execute(sql) 376 except: 351 377 self.logger.errorPair('failed sql: ', sql) 352 raise 353 354 355 378 raise 379 356 380 357 381 … … 405 429 sqlLine.group("posAngle", "-999") 406 430 sqlLine.group("raErr", "X_PSF_SIG * 0.257") 407 sqlLine.group("decErr", "Y_PSF_SIG * 0.257") 431 sqlLine.group("decErr", "Y_PSF_SIG * 0.257") 432 sqlLine.group("extNSigma","EXT_NSIGMA") 408 433 sqlLine.group("psfFlux", "PSF_INST_FLUX / " + extTimeString) 409 434 sqlLine.group("psfFluxErr", "PSF_INST_FLUX_SIG / " + extTimeString) … … 561 586 self.updateImageID("ImageMeta_" + chipname, x, y) 562 587 563 self.populateImageDetEff Table(chipname, header)588 self.populateImageDetEffMetaTablePart1(chipname, header) 564 589 self.updateImageID("ImageDetEffMeta_" + chipname, x, y) 565 590 … … 818 843 self.logger.error("fatal problem for exposure, skipping") 819 844 return False 845 846 self.populateImageDetEffMetaTablePart2(ota) 847 820 848 821 849 if "Chip" in self.imageIDs: … … 925 953 926 954 regex = ".*.psf" 955 927 956 if False and self.config.test and self.config.camera == "gpc1": 928 957 regex = "XY01.psf" … … 937 966 columns = "IPP_IDET X_PSF Y_PSF X_PSF_SIG Y_PSF_SIG POSANGLE PLTSCALE PSF_INST_FLUX PSF_INST_FLUX_SIG PSF_FWHM_MAJ PSF_FWHM_MIN PSF_THETA PSF_CORE PSF_QF PSF_QF_PERFECT PSF_CHISQ EXT_NSIGMA MOMENTS_XX MOMENTS_XY MOMENTS_YY MOMENTS_R1 MOMENTS_RH MOMENTS_M3C MOMENTS_M3S MOMENTS_M4C MOMENTS_M4S AP_FLUX AP_FLUX_SIG AP_NPIX AP_MAG_RADIUS KRON_FLUX KRON_FLUX_ERR SKY SKY_SIGMA FLAGS FLAGS2" 938 967 968 #### crap crap crap 969 970 regex = ".*" 971 columns = "*" 972 939 973 return super(DetectionBatch, self).importIppTables(columns, regex) 940 974
Note:
See TracChangeset
for help on using the changeset viewer.
