Changeset 39094 for trunk/ippToPsps/jython/diffbatch.py
- Timestamp:
- Nov 9, 2015, 5:55:53 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/diffbatch.py (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/diffbatch.py
r39084 r39094 5 5 import glob 6 6 import time 7 import math 7 8 import stilts 8 9 import re … … 154 155 self.logger.infoPair("TessName ",tessName) 155 156 156 # XXX EAM 20140812 : I am hardwiring the parsing logic for RINGS vs LOCAL157 157 if self.tessName[num] == 'RINGS.V3': 158 # skycell is, eg "skycell.1133.081"159 # 0123456789012345158 # skycell is, eg "skycell.1133.081" 159 # 0123456789012345 160 160 self.projectionID[num] = self.skycellName[num][8:12] 161 self.skycellID[num] = self.skycellName[num][13:] 162 self.skycellID[num] = self.skycellName[num][8:] 161 self.skycellID[num] = self.skycellName[num][13:] 163 162 else: 164 # skycell is, eg "skycell.081"165 # 01234567890163 # skycell is, eg "skycell.081" 164 # 01234567890 166 165 self.projectionID[num] = 0 167 self.skycellID[num] = self.skycellName[num][8:11] 168 self.skycellID[num]=self.skycellName[num][8:] 169 if self.skycellID[num] == "": 166 self.skycellID[num] = self.skycellName[num][8:] 167 168 if self.projectionID[num] == "": 169 self.projectionID[num] = -1 170 if self.skycellID[num] == "": 170 171 self.skycellID[num] = -1 171 172 … … 183 184 self.psfModelID[num] = self.scratchDb.getFitModelID(self.psfModelName[num]) 184 185 185 186 186 # drop the existing tables 187 187 … … 191 191 self.dropTableVerbose("DiffDetEffMeta_"+str(num)) 192 192 193 if not self.analysisVer[num]: self.analysisVer[num] = -999193 # if not self.analysisVer[num]: self.analysisVer[num] = -999 194 194 195 195 self.logger.infoPair("getPhotoCalID",diffSkyFileID) … … 222 222 self.logger.infoPair("Proccesing table", "DiffMeta_"+str(num)) 223 223 224 header = self.header[num] 225 226 # Convert detectionThreshold to appropriate magnitudes 227 detectionThreshold = self.getKeyFloat(header, "%.8f", 'DETEFF.MAGREF') 228 zpImage = self.getKeyFloat(header, "%.8f", 'FPA.ZP') 229 230 detectionThreshold = detectionThreshold + zpImage + 2.5 * math.log10(float(self.expTime[num])) 231 224 232 sql = "CREATE TABLE DiffMeta_"+str(num)+" like DiffMeta" 225 233 try: self.scratchDb.execute(sql) … … 234 242 sqlLine.group("negImageID", self.negImageID[num]); 235 243 sqlLine.group("ippDiffID", self.ippDiffID[num]); 244 sqlLine.group("tessID", str(self.tessID[num])) 236 245 sqlLine.group("projectionID", str(self.projectionID[num])) 237 246 sqlLine.group("skycellID", str(self.skycellID[num])) … … 239 248 sqlLine.group("analysisVer", str(self.analysisVer[num])); 240 249 sqlLine.group("md5sum", str(self.md5sum[num])) 250 sqlLine.group("detectionThreshold", detectionThreshold) 241 251 sqlLine.group("expTime", self.expTime[num]); 242 252 sqlLine.group("psfModelID", self.psfModelID[num]) … … 244 254 sqlLine.group("psfWidMajor", self.psfFwhmMajor[num]) 245 255 sqlLine.group("psfWidMinor", self.psfFwhmMinor[num]) 246 sqlLine.group("kernel", self.getKeyValue(self.header[num], 'SUBTRACTION.KERNEL')) 247 sqlLine.group("mode", self.getKeyValue(self.header[num], 'SUBTRACTION.MODE')) 248 sqlLine.group("psfTheta", self.getKeyFloat(self.header[num], "%.8f", 'ANGLE')) 249 sqlLine.group("numStamps", self.getKeyValue(self.header[num], 'SUBTRACTION.STAMPS')) 250 sqlLine.group("stampDevMean", self.getKeyFloat(self.header[num], "%.8e", 'SUBTRACTION.DEV.MEAN')) 251 sqlLine.group("stampDevRMS", self.getKeyFloat(self.header[num], "%.8e", 'SUBTRACTION.DEV.RMS')) 252 sqlLine.group("normalization", self.getKeyFloat(self.header[num], "%.8e", 'SUBTRACTION.NORM')) 253 sqlLine.group("convolveMax", self.getKeyFloat(self.header[num], "%.8e", 'SUBTRACTION.CONV.MAX')) 254 sqlLine.group("deconvolveMax", self.getKeyFloat(self.header[num], "%.8e", 'SUBTRACTION.DECONV.MAX')) 255 sqlLine.group("ctype1", self.getKeyValue(self.header[num], 'CTYPE1')); 256 sqlLine.group("ctype2", self.getKeyValue(self.header[num], 'CTYPE2')); 257 sqlLine.group("crval1", self.getKeyFloat(self.header[num], "%.8f", 'CRVAL1')); 258 sqlLine.group("crval2", self.getKeyFloat(self.header[num], "%.8f", 'CRVAL2')); 259 sqlLine.group("crpix1", self.getKeyFloat(self.header[num], "%.8f", 'CRPIX1')); 260 sqlLine.group("crpix2", self.getKeyFloat(self.header[num], "%.8f", 'CRPIX2')); 261 sqlLine.group("cdelt1", self.getKeyFloat(self.header[num], "%.8e", 'CDELT1')); 262 sqlLine.group("cdelt2", self.getKeyFloat(self.header[num], "%.8e", 'CDELT2')); 263 sqlLine.group("pc001001", self.getKeyFloat(self.header[num], "%.8e", 'PC001001')); 264 sqlLine.group("pc001002", self.getKeyFloat(self.header[num], "%.8e", 'PC001002')); 265 sqlLine.group("pc002001", self.getKeyFloat(self.header[num], "%.8e", 'PC002001')); 266 sqlLine.group("pc002002", self.getKeyFloat(self.header[num], "%.8e", 'PC002002')); 256 257 sqlLine.group("kernel", self.getKeyValue(header, 'SUBTRACTION.KERNEL')) 258 sqlLine.group("mode", self.getKeyValue(header, 'SUBTRACTION.MODE')) 259 sqlLine.group("psfTheta", self.getKeyFloat(header, "%.8f", 'ANGLE')) 260 sqlLine.group("numStamps", self.getKeyValue(header, 'SUBTRACTION.STAMPS')) 261 sqlLine.group("stampDevMean", self.getKeyFloat(header, "%.8e", 'SUBTRACTION.DEV.MEAN')) 262 sqlLine.group("stampDevRMS", self.getKeyFloat(header, "%.8e", 'SUBTRACTION.DEV.RMS')) 263 sqlLine.group("normalization", self.getKeyFloat(header, "%.8e", 'SUBTRACTION.NORM')) 264 sqlLine.group("convolveMax", self.getKeyFloat(header, "%.8e", 'SUBTRACTION.CONV.MAX')) 265 sqlLine.group("deconvolveMax", self.getKeyFloat(header, "%.8e", 'SUBTRACTION.DECONV.MAX')) 266 sqlLine.group("ctype1", self.getKeyValue(header, 'CTYPE1')); 267 sqlLine.group("ctype2", self.getKeyValue(header, 'CTYPE2')); 268 sqlLine.group("crval1", self.getKeyFloat(header, "%.8f", 'CRVAL1')); 269 sqlLine.group("crval2", self.getKeyFloat(header, "%.8f", 'CRVAL2')); 270 sqlLine.group("crpix1", self.getKeyFloat(header, "%.8f", 'CRPIX1')); 271 sqlLine.group("crpix2", self.getKeyFloat(header, "%.8f", 'CRPIX2')); 272 sqlLine.group("cdelt1", self.getKeyFloat(header, "%.8e", 'CDELT1')); 273 sqlLine.group("cdelt2", self.getKeyFloat(header, "%.8e", 'CDELT2')); 274 sqlLine.group("pc001001", self.getKeyFloat(header, "%.8e", 'PC001001')); 275 sqlLine.group("pc001002", self.getKeyFloat(header, "%.8e", 'PC001002')); 276 sqlLine.group("pc002001", self.getKeyFloat(header, "%.8e", 'PC002001')); 277 sqlLine.group("pc002002", self.getKeyFloat(header, "%.8e", 'PC002002')); 267 278 268 279 sql = sqlLine.make(") VALUES ( ", ")") … … 323 334 sqlLine.group("filterID", str(self.filterID[num])) 324 335 sqlLine.group("surveyID", str(self.surveyID)) 336 sqlLine.group("tessID", str(self.tessID[num])) 337 sqlLine.group("projectionID", str(self.projectionID[num])) 325 338 sqlLine.group("skycellID", str(self.skycellID[num])) 326 339 sqlLine.group("expTime", str(self.expTime[num])) … … 336 349 sqlLine.group("decErr", "Y_PSF_SIG * abs(PLTSCALE)") 337 350 else: 338 sqlLine.group("pltScale", "0.25 7")339 sqlLine.group("posAngle", "-999")351 sqlLine.group("pltScale", "0.25") 352 # sqlLine.group("posAngle", "-999") 340 353 sqlLine.group("raErr", "X_PSF_SIG * 0.25") 341 354 sqlLine.group("decErr", "Y_PSF_SIG * 0.25") … … 433 446 self.logger.infoPair("Dropping row column from", "DiffDetection table") 434 447 self.scratchDb.dropColumn("DiffDetection_"+str(num), "row") 435 436 448 437 449 ''' … … 494 506 495 507 header = self.header[num] 496 # CZW: this is broken, and can't get the zeropoint 497 # zpImage = self.scratchDb.getImageZeroPoint(diffSkyFileID) 498 zpImage = 0.0 499 500 if zpImage < 0.0: 501 zpImage = 0.0 508 zpImage = self.getKeyFloat(header,"%.8f","FPA.ZP") 509 502 510 if zpImage == 0.0: 503 511 self.logger.infoPair("CZW If this value for the zeropoint is zero, the getImageZeroPoint call is likely still broken", str(zpImage)) 504 512 505 506 513 magref = self.getKeyFloat(header,"%.8f","DETEFF.MAGREF") + zpImage 507 514 self.logger.infoPair("Found zeropoint and set magref", str(magref)) 508 self.logger.infoPair("CZW If that magref is -5.804804, then it's reading from the PHU, not the Deteff extension.","In a test, I mean.") 515 509 516 sqlLine = sqlUtility("INSERT INTO " + ippTableName + "(") 510 517 sqlLine.group("diffImageID", str(diffSkyFileID)) 511 518 sqlLine.group("magref", magref) 512 519 sql = sqlLine.make(") VALUES ( ", ")") 513 514 520 515 521 try: self.scratchDb.execute(sql)
Note:
See TracChangeset
for help on using the changeset viewer.
