- Timestamp:
- Aug 12, 2014, 2:04:38 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140717/ippToPsps/jython/detectionbatch.py
r37219 r37232 171 171 172 172 sql = sqlLine.make(") VALUES ( ", ")") 173 print "frame meta sql: ", sql 174 175 self.scratchDb.execute(sql) 173 174 try: self.scratchDb.execute(sql) 175 except: 176 self.logger.errorPair('failed sql: ', sql) 177 raise 178 176 179 self.scratchDb.updateAllRows("FrameMeta", "batchID", str(self.batchID)) 177 180 self.scratchDb.updateAllRows("FrameMeta", "surveyID", str(self.surveyID)) … … 195 198 else: ccdID = 0 196 199 197 psfFwhmMajor = self.getKeyValue(header, 'FWHM_MAJ') 198 psfFwhmMinor = self.getKeyValue(header, 'FWHM_MIN') 199 if ((psfFwhmMajor == "NULL") or (psfFwhmMajor == "NULL")): 200 psfFwhm = "NULL" 201 else: 202 psfFwhm = 0.5*(float(psfFwhmMajor) + float(psfFwhmMinor)) 200 psfFwhmMajor = self.getKeyFloat(header, "%.8f", 'FWHM_MAJ') 201 psfFwhmMinor = self.getKeyFloat(header, "%.8f", 'FWHM_MIN') 202 psfFwhm = 0.5*(float(psfFwhmMajor) + float(psfFwhmMinor)) 203 203 204 204 # insert image metadata into table … … 217 217 sqlLine.group("numAstroRef", self.getKeyValue(header, 'NASTRO')) 218 218 sqlLine.group("numPhotoRef", self.getKeyValue(header, 'NASTRO')) 219 sqlLine.group("nx", self.getKey Value(header, 'CNAXIS1'))220 sqlLine.group("ny", self.getKey Value(header, 'CNAXIS2'))219 sqlLine.group("nx", self.getKeyInt(header, 0, 'CNAXIS1')) 220 sqlLine.group("ny", self.getKeyInt(header, 0, 'CNAXIS2')) 221 221 sqlLine.group("psfFwhm", str(psfFwhm)) 222 sqlLine.group("psfWidMajor", str(psfFwhmMajor))223 sqlLine.group("psfWidMinor", str(psfFwhmMinor))222 sqlLine.group("psfWidMajor", psfFwhmMajor) 223 sqlLine.group("psfWidMinor", psfFwhmMinor) 224 224 sqlLine.group("psfTheta", self.getKeyFloat(header, "%.8f", 'ANGLE')) 225 sqlLine.group("moment sMajor",self.getKeyFloat(header, "%.8f", 'IQ_FW1'))226 sqlLine.group("moment sMinor",self.getKeyFloat(header, "%.8f", 'IQ_FW2'))225 sqlLine.group("momentMajor", self.getKeyFloat(header, "%.8f", 'IQ_FW1')) 226 sqlLine.group("momentMinor", self.getKeyFloat(header, "%.8f", 'IQ_FW2')) 227 227 sqlLine.group("momentM2C", self.getKeyFloat(header, "%.8f", 'IQ_M2C')) 228 228 sqlLine.group("momentM2S", self.getKeyFloat(header, "%.8f", 'IQ_M2S')) … … 254 254 sqlLine.group("pc002001", self.getKeyFloat(header, "%.8e", 'PC002001')) 255 255 sqlLine.group("pc002002", self.getKeyFloat(header, "%.8e", 'PC002002')) 256 sqlLine.group("polyOrder", self.getKey Value(header, 'NPLYTERM'))256 sqlLine.group("polyOrder", self.getKeyInt(header, 0, 'NPLYTERM')) 257 257 258 258 nPolyterm = int(self.getKeyValue(header, 'NPLYTERM')) … … 294 294 295 295 try: self.scratchDb.execute(sql) 296 except: print sql 296 except: 297 self.logger.errorPair('failed sql: ', sql) 298 raise 297 299 298 300 self.scratchDb.updateFilterID(tableName, self.filter) … … 818 820 ''' 819 821 def importIppTables(self, filter=""): 820 821 if self.config.test: 822 regex = "XY01.psf" 823 else: 824 regex = ".*.psf" 825 826 # XXX EAM NOTE : this is fragile : requires PS1_V4 827 # columns = "IPP_IDET X_PSF Y_PSF X_PSF_SIG Y_PSF_SIG PSF_INST_MAG PSF_INST_MAG_SIG PSF_INST_FLUX PSF_INST_FLUX_SIG PEAK_FLUX_AS_MAG PSF_MAJOR PSF_MINOR PSF_THETA EXT_NSIGMA PSF_QF MOMENTS_XX MOMENTS_XY MOMENTS_YY AP_MAG AP_FLUX KRON_FLUX KRON_FLUX_ERR FLAGS FLAGS2 SKY SKY_SIGMA EXT_NSIGMA PSF_QF_PERFECT PSF_CHISQ" 828 829 # XXX EAM NOTE : this is fragile : requires PS1_V5 830 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" 831 832 return super(DetectionBatch, self).importIppTables(columns, regex) 822 823 regex = ".*.psf" 824 if self.config.test and self.config.camera == "gpc1": 825 regex = "XY01.psf" 826 827 # XXX EAM NOTE : this is fragile : requires PS1_V4 828 # columns = "IPP_IDET X_PSF Y_PSF X_PSF_SIG Y_PSF_SIG PSF_INST_MAG PSF_INST_MAG_SIG PSF_INST_FLUX PSF_INST_FLUX_SIG PEAK_FLUX_AS_MAG PSF_MAJOR PSF_MINOR PSF_THETA EXT_NSIGMA PSF_QF MOMENTS_XX MOMENTS_XY MOMENTS_YY AP_MAG AP_FLUX KRON_FLUX KRON_FLUX_ERR FLAGS FLAGS2 SKY SKY_SIGMA EXT_NSIGMA PSF_QF_PERFECT PSF_CHISQ" 829 830 # XXX EAM NOTE : this is fragile : requires PS1_V5 831 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" 832 833 return super(DetectionBatch, self).importIppTables(columns, regex) 833 834 834 835 '''
Note:
See TracChangeset
for help on using the changeset viewer.
