- Timestamp:
- Aug 9, 2014, 2:32:00 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140717/ippToPsps/jython/detectionbatch.py
r37204 r37208 98 98 raise 99 99 100 # MJD-OBS is the exposure start, EXTIME / 172800 = (EXPTIME sec / 84600 sec/day) / 2 100 101 self.obsTime = float(self.header['MJD-OBS']) + (float(self.header['EXPTIME']) / 172800.0) 101 102 … … 135 136 sqlLine.group("telescopeID", "1"); 136 137 sqlLine.group("analysisVer", self.analysisVer); 137 sqlLine.group("photoScat", self.getKey Value(self.header, 'ZPT_ERR'));138 sqlLine.group("expStart", self.getKey Value(self.header, 'MJD-OBS'));139 sqlLine.group("expTime", self.getKey Value(self.header, 'EXPREQ'));140 sqlLine.group("airmass", self.getKey Value(self.header, 'AIRMASS'));141 sqlLine.group("raBore", self.getKey Value(self.header, 'RA'));142 sqlLine.group("decBore", self.getKey Value(self.header, 'DEC'));138 sqlLine.group("photoScat", self.getKeyFloat(self.header, "%.8f", 'ZPT_ERR')); 139 sqlLine.group("expStart", self.getKeyFloat(self.header, "%.10f", 'MJD-OBS')); 140 sqlLine.group("expTime", self.getKeyFloat(self.header, "%.8f", 'EXPREQ')); 141 sqlLine.group("airmass", self.getKeyFloat(self.header, "%.8f", 'AIRMASS')); 142 sqlLine.group("raBore", self.getKeyFloat(self.header, "%.10f", 'RA')); 143 sqlLine.group("decBore", self.getKeyFloat(self.header, "%.10f", 'DEC')); 143 144 sqlLine.group("ctype1", self.getKeyValue(self.header, 'CTYPE1')); 144 145 sqlLine.group("ctype2", self.getKeyValue(self.header, 'CTYPE2')); 145 sqlLine.group("crval1", self.getKey Value(self.header, 'CRVAL1'));146 sqlLine.group("crval2", self.getKey Value(self.header, 'CRVAL2'));147 sqlLine.group("crpix1", self.getKey Value(self.header, 'CRPIX1'));148 sqlLine.group("crpix2", self.getKey Value(self.header, 'CRPIX2'));149 sqlLine.group("cdelt1", self.getKey Value(self.header, 'CDELT1'));150 sqlLine.group("cdelt2", self.getKey Value(self.header, 'CDELT2'));151 sqlLine.group("pc001001", self.getKey Value(self.header, 'PC001001'));152 sqlLine.group("pc001002", self.getKey Value(self.header, 'PC001002'));153 sqlLine.group("pc002001", self.getKey Value(self.header, 'PC002001'));154 sqlLine.group("pc002002", self.getKey Value(self.header, 'PC002002'));146 sqlLine.group("crval1", self.getKeyFloat(self.header, "%.8f", 'CRVAL1')); 147 sqlLine.group("crval2", self.getKeyFloat(self.header, "%.8f", 'CRVAL2')); 148 sqlLine.group("crpix1", self.getKeyFloat(self.header, "%.8f", 'CRPIX1')); 149 sqlLine.group("crpix2", self.getKeyFloat(self.header, "%.8f", 'CRPIX2')); 150 sqlLine.group("cdelt1", self.getKeyFloat(self.header, "%.8e", 'CDELT1')); 151 sqlLine.group("cdelt2", self.getKeyFloat(self.header, "%.8e", 'CDELT2')); 152 sqlLine.group("pc001001", self.getKeyFloat(self.header, "%.8e", 'PC001001')); 153 sqlLine.group("pc001002", self.getKeyFloat(self.header, "%.8e", 'PC001002')); 154 sqlLine.group("pc002001", self.getKeyFloat(self.header, "%.8e", 'PC002001')); 155 sqlLine.group("pc002002", self.getKeyFloat(self.header, "%.8e", 'PC002002')); 155 156 sqlLine.group("polyOrder", self.getKeyValue(self.header, 'NPLYTERM')); 156 sqlLine.group("pca1x3y0", self.getKey Value(self.header, 'PCA1X3Y0'));157 sqlLine.group("pca1x2y1", self.getKey Value(self.header, 'PCA1X2Y1'));158 sqlLine.group("pca1x1y2", self.getKey Value(self.header, 'PCA1X1Y2'));159 sqlLine.group("pca1x0y3", self.getKey Value(self.header, 'PCA1X0Y3'));160 sqlLine.group("pca1x2y0", self.getKey Value(self.header, 'PCA1X2Y0'));161 sqlLine.group("pca1x1y1", self.getKey Value(self.header, 'PCA1X1Y1'));162 sqlLine.group("pca1x0y2", self.getKey Value(self.header, 'PCA1X0Y2'));163 sqlLine.group("pca2x3y0", self.getKey Value(self.header, 'PCA2X3Y0'));164 sqlLine.group("pca2x2y1", self.getKey Value(self.header, 'PCA2X2Y1'));165 sqlLine.group("pca2x1y2", self.getKey Value(self.header, 'PCA2X1Y2'));166 sqlLine.group("pca2x0y3", self.getKey Value(self.header, 'PCA2X0Y3'));167 sqlLine.group("pca2x2y0", self.getKey Value(self.header, 'PCA2X2Y0'));168 sqlLine.group("pca2x1y1", self.getKey Value(self.header, 'PCA2X1Y1'));169 sqlLine.group("pca2x0y2", self.getKey Value(self.header, 'PCA2X0Y2'));157 sqlLine.group("pca1x3y0", self.getKeyFloat(self.header, "%.8e", 'PCA1X3Y0')); 158 sqlLine.group("pca1x2y1", self.getKeyFloat(self.header, "%.8e", 'PCA1X2Y1')); 159 sqlLine.group("pca1x1y2", self.getKeyFloat(self.header, "%.8e", 'PCA1X1Y2')); 160 sqlLine.group("pca1x0y3", self.getKeyFloat(self.header, "%.8e", 'PCA1X0Y3')); 161 sqlLine.group("pca1x2y0", self.getKeyFloat(self.header, "%.8e", 'PCA1X2Y0')); 162 sqlLine.group("pca1x1y1", self.getKeyFloat(self.header, "%.8e", 'PCA1X1Y1')); 163 sqlLine.group("pca1x0y2", self.getKeyFloat(self.header, "%.8e", 'PCA1X0Y2')); 164 sqlLine.group("pca2x3y0", self.getKeyFloat(self.header, "%.8e", 'PCA2X3Y0')); 165 sqlLine.group("pca2x2y1", self.getKeyFloat(self.header, "%.8e", 'PCA2X2Y1')); 166 sqlLine.group("pca2x1y2", self.getKeyFloat(self.header, "%.8e", 'PCA2X1Y2')); 167 sqlLine.group("pca2x0y3", self.getKeyFloat(self.header, "%.8e", 'PCA2X0Y3')); 168 sqlLine.group("pca2x2y0", self.getKeyFloat(self.header, "%.8e", 'PCA2X2Y0')); 169 sqlLine.group("pca2x1y1", self.getKeyFloat(self.header, "%.8e", 'PCA2X1Y1')); 170 sqlLine.group("pca2x0y2", self.getKeyFloat(self.header, "%.8e", 'PCA2X0Y2')); 170 171 171 172 sql = sqlLine.make(") VALUES ( ", ")") … … 199 200 psfFwhm = "NULL" 200 201 else: 201 psfFwhm = 0.5*( psfFwhmMajor + psfFwhmMinor)202 psfFwhm = 0.5*(float(psfFwhmMajor) + float(psfFwhmMinor)) 202 203 203 204 # insert image metadata into table … … 208 209 sqlLine.group("bias", str(self.bias)) 209 210 sqlLine.group("biasScat", str(self.biasScat)) 210 sqlLine.group("sky", self.getKey Value(header, 'MSKY_MN'))211 sqlLine.group("skyScat", self.getKey Value(header, 'MSKY_SIG'))212 sqlLine.group("magSat", self.getKey Value(header, 'FSATUR'))213 sqlLine.group("completMag", self.getKey Value(header, 'FLIMIT'))214 sqlLine.group("astroScat", self.getKey Value(header, 'CERROR'))215 sqlLine.group("photoScat", self.getKey Value(self.header, 'ZPT_OBS'))211 sqlLine.group("sky", self.getKeyFloat(header, "%.8f", 'MSKY_MN')) 212 sqlLine.group("skyScat", self.getKeyFloat(header, "%.8f", 'MSKY_SIG')) 213 sqlLine.group("magSat", self.getKeyFloat(header, "%.8f", 'FSATUR')) 214 sqlLine.group("completMag", self.getKeyFloat(header, "%.8f", 'FLIMIT')) 215 sqlLine.group("astroScat", self.getKeyFloat(header, "%.8f", 'CERROR')) 216 sqlLine.group("photoScat", self.getKeyFloat(self.header, "%.8f", 'ZPT_OBS')) 216 217 sqlLine.group("numAstroRef", self.getKeyValue(header, 'NASTRO')) 217 218 sqlLine.group("numPhotoRef", self.getKeyValue(header, 'NASTRO')) … … 221 222 sqlLine.group("psfWidMajor", str(psfFwhmMajor)) 222 223 sqlLine.group("psfWidMinor", str(psfFwhmMinor)) 223 sqlLine.group("psfTheta", self.getKeyValue(header, 'ANGLE')) 224 sqlLine.group("momentXX", "-999") 225 sqlLine.group("momentXY", "-999") 226 sqlLine.group("momentYY", "-999") 227 sqlLine.group("momentM3C", "-999") 228 sqlLine.group("momentM3S", "-999") 229 sqlLine.group("momentM4C", "-999") 230 sqlLine.group("momentM4S", "-999") 231 sqlLine.group("momentR1", "-999") 232 sqlLine.group("momentRH", "-999") 233 sqlLine.group("apResid", self.getKeyValue(header, 'APMIFIT')) 234 sqlLine.group("dapResid", self.getKeyValue(header, 'DAPMIFIT')) 224 sqlLine.group("psfTheta", self.getKeyFloat(header, "%.8f", 'ANGLE')) 225 sqlLine.group("momentsMajor", self.getKeyFloat(header, "%.8f", 'IQ_FW1')) 226 sqlLine.group("momentsMinor", self.getKeyFloat(header, "%.8f", 'IQ_FW2')) 227 sqlLine.group("momentM2C", self.getKeyFloat(header, "%.8f", 'IQ_M2C')) 228 sqlLine.group("momentM2S", self.getKeyFloat(header, "%.8f", 'IQ_M2S')) 229 sqlLine.group("momentM3", self.getKeyFloat(header, "%.8f", 'IQ_M3')) 230 sqlLine.group("momentM4", self.getKeyFloat(header, "%.8f", 'IQ_M4')) 231 sqlLine.group("apResid", self.getKeyFloat(header, "%.8f", 'APMIFIT')) 232 sqlLine.group("dapResid", self.getKeyFloat(header, "%.8f", 'DAPMIFIT')) 235 233 sqlLine.group("detectorID", self.getKeyValue(header, 'DETECTOR')) 236 234 sqlLine.group("qaFlags", str(self.scratchDb.getDvoImageFlags(header['IMAGEID']))) … … 243 241 # sqlLine.group("detrend7", " ") 244 242 # sqlLine.group("detrend8", " ") 245 sqlLine.group("photoZero", self.getKey Value(self.header, 'ZPT_OBS'))243 sqlLine.group("photoZero", self.getKeyFloat(self.header, "%.8f", 'ZPT_OBS')) 246 244 sqlLine.group("ctype1", self.getKeyValue(header, 'CTYPE1')) 247 245 sqlLine.group("ctype2", self.getKeyValue(header, 'CTYPE2')) 248 sqlLine.group("crval1", self.getKey Value(header, 'CRVAL1'))249 sqlLine.group("crval2", self.getKey Value(header, 'CRVAL2'))250 sqlLine.group("crpix1", self.getKey Value(header, 'CRPIX1'))251 sqlLine.group("crpix2", self.getKey Value(header, 'CRPIX2'))252 sqlLine.group("cdelt1", self.getKey Value(header, 'CDELT1'))253 sqlLine.group("cdelt2", self.getKey Value(header, 'CDELT2'))254 sqlLine.group("pc001001", self.getKey Value(header, 'PC001001'))255 sqlLine.group("pc001002", self.getKey Value(header, 'PC001002'))256 sqlLine.group("pc002001", self.getKey Value(header, 'PC002001'))257 sqlLine.group("pc002002", self.getKey Value(header, 'PC002002'))246 sqlLine.group("crval1", self.getKeyFloat(header, "%.8f", 'CRVAL1')) 247 sqlLine.group("crval2", self.getKeyFloat(header, "%.8f", 'CRVAL2')) 248 sqlLine.group("crpix1", self.getKeyFloat(header, "%.8f", 'CRPIX1')) 249 sqlLine.group("crpix2", self.getKeyFloat(header, "%.8f", 'CRPIX2')) 250 sqlLine.group("cdelt1", self.getKeyFloat(header, "%.8e", 'CDELT1')) 251 sqlLine.group("cdelt2", self.getKeyFloat(header, "%.8e", 'CDELT2')) 252 sqlLine.group("pc001001", self.getKeyFloat(header, "%.8e", 'PC001001')) 253 sqlLine.group("pc001002", self.getKeyFloat(header, "%.8e", 'PC001002')) 254 sqlLine.group("pc002001", self.getKeyFloat(header, "%.8e", 'PC002001')) 255 sqlLine.group("pc002002", self.getKeyFloat(header, "%.8e", 'PC002002')) 258 256 sqlLine.group("polyOrder", self.getKeyValue(header, 'NPLYTERM')) 259 257 260 258 nPolyterm = int(self.getKeyValue(header, 'NPLYTERM')) 261 259 if nPolyterm > 1: 262 sqlLine.group("pca1x2y0", self.getKey Value(header, 'PCA1X2Y0'))263 sqlLine.group("pca1x1y1", self.getKey Value(header, 'PCA1X1Y1'))264 sqlLine.group("pca1x0y2", self.getKey Value(header, 'PCA1X0Y2'))265 sqlLine.group("pca2x2y0", self.getKey Value(header, 'PCA2X2Y0'))266 sqlLine.group("pca2x1y1", self.getKey Value(header, 'PCA2X1Y1'))267 sqlLine.group("pca2x0y2", self.getKey Value(header, 'PCA2X0Y2'))260 sqlLine.group("pca1x2y0", self.getKeyFloat(header, "%.8e", 'PCA1X2Y0')) 261 sqlLine.group("pca1x1y1", self.getKeyFloat(header, "%.8e", 'PCA1X1Y1')) 262 sqlLine.group("pca1x0y2", self.getKeyFloat(header, "%.8e", 'PCA1X0Y2')) 263 sqlLine.group("pca2x2y0", self.getKeyFloat(header, "%.8e", 'PCA2X2Y0')) 264 sqlLine.group("pca2x1y1", self.getKeyFloat(header, "%.8e", 'PCA2X1Y1')) 265 sqlLine.group("pca2x0y2", self.getKeyFloat(header, "%.8e", 'PCA2X0Y2')) 268 266 else: 269 267 sqlLine.group("pca1x2y0", "-999") … … 275 273 276 274 if nPolyterm > 2: 277 sqlLine.group("pca1x3y0", self.getKey Value(header, 'PCA1X3Y0'))278 sqlLine.group("pca1x2y1", self.getKey Value(header, 'PCA1X2Y1'))279 sqlLine.group("pca1x1y2", self.getKey Value(header, 'PCA1X1Y2'))280 sqlLine.group("pca1x0y3", self.getKey Value(header, 'PCA1X0Y3'))281 sqlLine.group("pca2x3y0", self.getKey Value(header, 'PCA2X3Y0'))282 sqlLine.group("pca2x2y1", self.getKey Value(header, 'PCA2X2Y1'))283 sqlLine.group("pca2x1y2", self.getKey Value(header, 'PCA2X1Y2'))284 sqlLine.group("pca2x0y3", self.getKey Value(header, 'PCA2X0Y3'))275 sqlLine.group("pca1x3y0", self.getKeyFloat(header, "%.8e", 'PCA1X3Y0')) 276 sqlLine.group("pca1x2y1", self.getKeyFloat(header, "%.8e", 'PCA1X2Y1')) 277 sqlLine.group("pca1x1y2", self.getKeyFloat(header, "%.8e", 'PCA1X1Y2')) 278 sqlLine.group("pca1x0y3", self.getKeyFloat(header, "%.8e", 'PCA1X0Y3')) 279 sqlLine.group("pca2x3y0", self.getKeyFloat(header, "%.8e", 'PCA2X3Y0')) 280 sqlLine.group("pca2x2y1", self.getKeyFloat(header, "%.8e", 'PCA2X2Y1')) 281 sqlLine.group("pca2x1y2", self.getKeyFloat(header, "%.8e", 'PCA2X1Y2')) 282 sqlLine.group("pca2x0y3", self.getKeyFloat(header, "%.8e", 'PCA2X0Y3')) 285 283 else: 286 284 sqlLine.group("pca1x3y0", "-999") … … 346 344 sqlLine.group("pltScale", "PLTSCALE") 347 345 sqlLine.group("posAngle", "POSANGLE") 346 sqlLine.group("raErr", "X_PSF_SIG * abs(PLTSCALE)") 347 sqlLine.group("decErr", "Y_PSF_SIG * abs(PLTSCALE)") 348 348 sqlLine.group("psfFlux", "PSF_INST_FLUX / " + extTimeString) 349 349 sqlLine.group("psfFluxErr", "PSF_INST_FLUX_SIG / " + extTimeString) … … 367 367 sqlLine.group("apFlux", "AP_FLUX / " + extTimeString) 368 368 sqlLine.group("apFluxErr", "AP_FLUX_SIG / " + extTimeString) 369 sqlLine.group("apFillF", "AP_NPIX / (3.141 6 * AP_MAG_RADIUS * AP_MAG_RADIUS)")369 sqlLine.group("apFillF", "AP_NPIX / (3.14159265359 * POW(AP_MAG_RADIUS - 0.5, 2))") 370 370 sqlLine.group("apRadius", "AP_MAG_RADIUS") 371 371 sqlLine.group("kronFlux", "KRON_FLUX / " + extTimeString) … … 525 525 ota = "XY%d%d" % (x, y) 526 526 527 if self.config.test and not ((x == 0) and (y == 1)): 528 print "skipping ota: " + ota 529 continue 530 527 531 self.alterPspsTablesChip(ota, ota + ".hdr", x, y) 528 532 … … 576 580 a.detectID = b.detectID, \ 577 581 a.ippObjID = b.ippObjID, \ 582 a.dvoRegionID = b.catID \ 578 583 a.ra = b.ra, \ 579 584 a.dec = b.dec_, \ 580 a.raErr = b.raErr, \581 a.decErr = b.decErr, \582 585 a.zp = b.zp, \ 583 586 a.telluricExt = b.telluricExt, \ … … 587 590 WHERE a.ippDetectID = b.ippDetectID \ 588 591 AND b.imageID = " + str(imageID) 589 590 # XXX need to add dvoRegion591 592 592 593 self.scratchDb.execute(sql) … … 704 705 if ota not in self.imageIDs: continue 705 706 707 if self.config.test and not ((x == 0) and (y == 1)): 708 print "skipping ota " + ota 709 continue 710 706 711 if self.populatePspsTablesChip(ota, x, y, results, tables): otaCount = otaCount + 1 707 712 if self.skipBatch: … … 814 819 def importIppTables(self, filter=""): 815 820 816 ## if self.config.test: regex = "XY33.psf" 817 ## else : regex = ".*.psf" 818 regex = ".*.psf" 821 if self.config.test: 822 regex = "XY01.psf" 823 else: 824 regex = ".*.psf" 819 825 820 826 # XXX EAM NOTE : this is fragile : requires PS1_V4
Note:
See TracChangeset
for help on using the changeset viewer.
