Changeset 37129 for branches/eam_branches/ipp-20140717/ippToPsps
- Timestamp:
- Jul 28, 2014, 6:20:27 AM (12 years ago)
- Location:
- branches/eam_branches/ipp-20140717/ippToPsps
- Files:
-
- 2 added
- 17 edited
-
. (modified) (1 prop)
-
jython/Makefile.am (modified) (2 diffs)
-
jython/batch.py (modified) (5 diffs)
-
jython/detectionbatch.py (modified) (16 diffs)
-
jython/dvo.py (modified) (4 diffs)
-
jython/dvoobjects.py (modified) (1 diff)
-
jython/ippjython (modified) (2 diffs)
-
jython/ipptopsps.py (modified) (2 diffs)
-
jython/ipptopspsdb.py (modified) (9 diffs)
-
jython/loader.py (modified) (9 diffs)
-
jython/mysql.py (modified) (1 diff)
-
jython/objectbatch.py (modified) (14 diffs)
-
jython/queue.py (modified) (1 diff)
-
jython/scratchdb.py (modified) (8 diffs)
-
jython/sqlUtility.py (added)
-
jython/stackbatch.py (modified) (8 diffs)
-
jython/testCode.py (added)
-
test/fulltest.sh (modified) (5 diffs)
-
test/mkgpc1data.dvo (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140717/ippToPsps
- Property svn:mergeinfo set to
-
branches/eam_branches/ipp-20140717/ippToPsps/jython/Makefile.am
r36815 r37129 22 22 gpc1db.py \ 23 23 initbatch.py \ 24 insert.dvodb.info.py \ 24 insert.dvodb.info.py \ 25 25 ipptopspsdb.py \ 26 26 ipptopsps.py \ … … 35 35 pslogger.py \ 36 36 queue.py \ 37 removepending.py \ 37 removepending.py \ 38 38 scratchdb.py \ 39 39 setupScratchDb.py \ 40 40 skychunk.py \ 41 sqlUtility.py \ 41 42 stackbatch.py 42 43 -
branches/eam_branches/ipp-20140717/ippToPsps/jython/batch.py
r36726 r37129 37 37 batchID, 38 38 batchType, 39 fits, 40 useFullTables): 39 fits): 41 40 42 41 # print "starting the batch" … … 49 48 self.skychunk = skychunk 50 49 self.fits = fits 51 self.useFullTables = useFullTables52 50 53 51 # set up logging … … 79 77 raise 80 78 81 self.scratchDb.setUseFullTables(self.useFullTables) 79 # define the dvo table names 80 self.scratchDb.setDvoTableNames() 82 81 83 82 # TODO … … 113 112 self.dateStr = now.strftime("%Y-%m-%d") 114 113 115 # create DVO tables if accessing DVO directly116 if not self.useFullTables:self.scratchDb.createDvoTables()114 # create DVO tables (scratch database) 115 self.scratchDb.createDvoTables() 117 116 118 117 # dump stuff to the log … … 120 119 self.logger.infoPair("Batch name", self.batchName) 121 120 self.logger.infoPair("Survey ID", "%d" % self.surveyID) 122 self.logger.infoBool("Use full DVO tables?", self.useFullTables)123 121 124 122 if self.fits: -
branches/eam_branches/ipp-20140717/ippToPsps/jython/detectionbatch.py
r36744 r37129 19 19 from ipptopspsdb import IppToPspsDb 20 20 from scratchdb import ScratchDb 21 from sqlUtility import sqlUtility 21 22 22 23 import logging.config … … 41 42 scratchDb, 42 43 camID, 43 batchID, 44 useFullTables): 44 batchID): 45 45 46 46 super(DetectionBatch, self).__init__( … … 54 54 batchID, 55 55 "P2", 56 gpc1Db.getCameraStageSmf(camID,skychunk.P2_smf_version), 57 useFullTables) 56 gpc1Db.getCameraStageSmf(camID,skychunk.P2_smf_version)) 58 57 59 58 # get camera meta data … … 124 123 self.logger.infoPair("Proccesing table", "FrameMeta") 125 124 126 sql = "INSERT INTO FrameMeta (\ 127 frameID \ 128 ,frameName \ 129 ,cameraID \ 130 ,cameraConfigID \ 131 ,telescopeID \ 132 ,analysisVer \ 133 ,p1Recip \ 134 ,p2Recip \ 135 ,p3Recip \ 136 ,photoScat \ 137 ,expStart \ 138 ,expTime \ 139 ,airmass \ 140 ,raBore \ 141 ,decBore \ 142 ,ctype1 \ 143 ,ctype2 \ 144 ,crval1 \ 145 ,crval2 \ 146 ,crpix1 \ 147 ,crpix2 \ 148 ,cdelt1 \ 149 ,cdelt2 \ 150 ,pc001001 \ 151 ,pc001002 \ 152 ,pc002001 \ 153 ,pc002002 \ 154 ,polyOrder \ 155 ,pca1x3y0 \ 156 ,pca1x2y1 \ 157 ,pca1x1y2 \ 158 ,pca1x0y3 \ 159 ,pca1x2y0 \ 160 ,pca1x1y1 \ 161 ,pca1x0y2 \ 162 ,pca2x3y0 \ 163 ,pca2x2y1 \ 164 ,pca2x1y2 \ 165 ,pca2x0y3 \ 166 ,pca2x2y0 \ 167 ,pca2x1y1 \ 168 ,pca2x0y2 \ 169 ) VALUES ( \ 170 " + str(self.expID) + " \ 171 ,'" + self.expName + "' \ 172 ,1 \ 173 ,1 \ 174 ,1 \ 175 ,'" + str(self.analysisVer) + "' \ 176 ,' ' \ 177 ,' ' \ 178 ,' ' \ 179 ," + self.safeDictionaryAccess(self.header, 'ZPT_ERR') + " \ 180 ," + self.safeDictionaryAccess(self.header, 'MJD-OBS') + " \ 181 ," + self.safeDictionaryAccess(self.header, 'EXPREQ') + " \ 182 ," + self.safeDictionaryAccess(self.header, 'AIRMASS') + " \ 183 ," + self.safeDictionaryAccess(self.header, 'RA') + " \ 184 ," + self.safeDictionaryAccess(self.header, 'DEC') + " \ 185 ,'" + self.safeDictionaryAccess(self.header, 'CTYPE1') + "' \ 186 ,'" + self.safeDictionaryAccess(self.header, 'CTYPE2') + "' \ 187 ," + self.safeDictionaryAccess(self.header, 'CRVAL1') + " \ 188 ," + self.safeDictionaryAccess(self.header, 'CRVAL2') + " \ 189 ," + self.safeDictionaryAccess(self.header, 'CRPIX1') + " \ 190 ," + self.safeDictionaryAccess(self.header, 'CRPIX2') + " \ 191 ," + self.safeDictionaryAccess(self.header, 'CDELT1') + " \ 192 ," + self.safeDictionaryAccess(self.header, 'CDELT2') + " \ 193 ," + self.safeDictionaryAccess(self.header, 'PC001001') + " \ 194 ," + self.safeDictionaryAccess(self.header, 'PC001002') + " \ 195 ," + self.safeDictionaryAccess(self.header, 'PC002001') + " \ 196 ," + self.safeDictionaryAccess(self.header, 'PC002002') + " \ 197 ," + self.safeDictionaryAccess(self.header, 'NPLYTERM') + " \ 198 ," + self.safeDictionaryAccess(self.header, 'PCA1X3Y0') + " \ 199 ," + self.safeDictionaryAccess(self.header, 'PCA1X2Y1') + " \ 200 ," + self.safeDictionaryAccess(self.header, 'PCA1X1Y2') + " \ 201 ," + self.safeDictionaryAccess(self.header, 'PCA1X0Y3') + " \ 202 ," + self.safeDictionaryAccess(self.header, 'PCA1X2Y0') + " \ 203 ," + self.safeDictionaryAccess(self.header, 'PCA1X1Y1') + " \ 204 ," + self.safeDictionaryAccess(self.header, 'PCA1X0Y2') + " \ 205 ," + self.safeDictionaryAccess(self.header, 'PCA2X3Y0') + " \ 206 ," + self.safeDictionaryAccess(self.header, 'PCA2X2Y1') + " \ 207 ," + self.safeDictionaryAccess(self.header, 'PCA2X1Y2') + " \ 208 ," + self.safeDictionaryAccess(self.header, 'PCA2X0Y3') + " \ 209 ," + self.safeDictionaryAccess(self.header, 'PCA2X2Y0') + " \ 210 ," + self.safeDictionaryAccess(self.header, 'PCA2X1Y1') + " \ 211 ," + self.safeDictionaryAccess(self.header, 'PCA2X0Y2') + " \ 212 )" 213 214 # print "frame meta sql: ", sql 125 sqlLine = sqlUtility("INSERT INTO FrameMeta (") 126 127 sqlLine.group("frameID", str(self.expID)); 128 sqlLine.group("frameName", self.expName); 129 sqlLine.group("cameraID", "1"); 130 sqlLine.group("cameraConfigID", "1"); 131 sqlLine.group("telescopeID", "1"); 132 sqlLine.group("analysisVer", str(self.analysisVer)); 133 sqlLine.group("p1Recip", " "); 134 sqlLine.group("p2Recip", " "); 135 sqlLine.group("p3Recip", " "); 136 sqlLine.group("photoScat", "self.safeDictionaryAccess(self.header, 'ZPT_ERR')"); 137 sqlLine.group("expStart", "self.safeDictionaryAccess(self.header, 'MJD-OBS')"); 138 sqlLine.group("expTime", "self.safeDictionaryAccess(self.header, 'EXPREQ')"); 139 sqlLine.group("airmass", "self.safeDictionaryAccess(self.header, 'AIRMASS')"); 140 sqlLine.group("raBore", "self.safeDictionaryAccess(self.header, 'RA')"); 141 sqlLine.group("decBore", "self.safeDictionaryAccess(self.header, 'DEC')"); 142 sqlLine.group("ctype1", self.safeDictionaryAccess(self.header, 'CTYPE1')); 143 sqlLine.group("ctype2", self.safeDictionaryAccess(self.header, 'CTYPE2')); 144 sqlLine.group("crval1", "self.safeDictionaryAccess(self.header, 'CRVAL1')"); 145 sqlLine.group("crval2", "self.safeDictionaryAccess(self.header, 'CRVAL2')"); 146 sqlLine.group("crpix1", "self.safeDictionaryAccess(self.header, 'CRPIX1')"); 147 sqlLine.group("crpix2", "self.safeDictionaryAccess(self.header, 'CRPIX2')"); 148 sqlLine.group("cdelt1", "self.safeDictionaryAccess(self.header, 'CDELT1')"); 149 sqlLine.group("cdelt2", "self.safeDictionaryAccess(self.header, 'CDELT2')"); 150 sqlLine.group("pc001001", "self.safeDictionaryAccess(self.header, 'PC001001')"); 151 sqlLine.group("pc001002", "self.safeDictionaryAccess(self.header, 'PC001002')"); 152 sqlLine.group("pc002001", "self.safeDictionaryAccess(self.header, 'PC002001')"); 153 sqlLine.group("pc002002", "self.safeDictionaryAccess(self.header, 'PC002002')"); 154 sqlLine.group("polyOrder", "self.safeDictionaryAccess(self.header, 'NPLYTERM')"); 155 sqlLine.group("pca1x3y0", "self.safeDictionaryAccess(self.header, 'PCA1X3Y0')"); 156 sqlLine.group("pca1x2y1", "self.safeDictionaryAccess(self.header, 'PCA1X2Y1')"); 157 sqlLine.group("pca1x1y2", "self.safeDictionaryAccess(self.header, 'PCA1X1Y2')"); 158 sqlLine.group("pca1x0y3", "self.safeDictionaryAccess(self.header, 'PCA1X0Y3')"); 159 sqlLine.group("pca1x2y0", "self.safeDictionaryAccess(self.header, 'PCA1X2Y0')"); 160 sqlLine.group("pca1x1y1", "self.safeDictionaryAccess(self.header, 'PCA1X1Y1')"); 161 sqlLine.group("pca1x0y2", "self.safeDictionaryAccess(self.header, 'PCA1X0Y2')"); 162 sqlLine.group("pca2x3y0", "self.safeDictionaryAccess(self.header, 'PCA2X3Y0')"); 163 sqlLine.group("pca2x2y1", "self.safeDictionaryAccess(self.header, 'PCA2X2Y1')"); 164 sqlLine.group("pca2x1y2", "self.safeDictionaryAccess(self.header, 'PCA2X1Y2')"); 165 sqlLine.group("pca2x0y3", "self.safeDictionaryAccess(self.header, 'PCA2X0Y3')"); 166 sqlLine.group("pca2x2y0", "self.safeDictionaryAccess(self.header, 'PCA2X2Y0')"); 167 sqlLine.group("pca2x1y1", "self.safeDictionaryAccess(self.header, 'PCA2X1Y1')"); 168 sqlLine.group("pca2x0y2", "self.safeDictionaryAccess(self.header, 'PCA2X0Y2')"); 169 170 sql = sqlLine.make(") VALUES ( ", ")") 171 print "frame meta sql: ", sql 215 172 216 173 self.scratchDb.execute(sql) … … 228 185 tableName = "ImageMeta_" + ota 229 186 230 # XXX we drop the table above so it is not left behind on failure 231 # drop then re-create table 232 # self.scratchDb.dropTable(tableName) 187 # we drop the table before calling this functoin so it is not left behind on failure 233 188 sql = "CREATE TABLE " + tableName + " LIKE ImageMeta" 234 189 try: self.scratchDb.execute(sql) 235 190 except: pass 191 236 192 if (ota[0:2] == "XY"): ccdID = ota[2:4] 237 193 else: ccdID = 0 238 194 195 psfFwhm = 0.5*(self.safeDictionaryAccess(header, 'FWHM_MAJ') + self.safeDictionaryAccess(header, 'FWHM_MIN')) 196 239 197 # insert image metadata into table 240 sql = "INSERT INTO " + tableName + " ( \ 241 frameID \ 242 ,ccdID \ 243 ,bias \ 244 ,biasScat \ 245 ,sky \ 246 ,skyScat \ 247 ,magSat \ 248 ,completMag \ 249 ,astroScat \ 250 ,photoScat \ 251 ,numAstroRef \ 252 ,numPhotoRef \ 253 ,nx \ 254 ,ny \ 255 ,psfFwhm \ 256 ,psfWidMajor \ 257 ,psfWidMinor \ 258 ,psfTheta \ 259 ,momentXX \ 260 ,momentXY \ 261 ,momentYY \ 262 ,momentM3C \ 263 ,momentM3S \ 264 ,momentM4C \ 265 ,momentM4S \ 266 ,momentR1 \ 267 ,momentRH \ 268 ,apResid \ 269 ,dapResid \ 270 ,detectorID \ 271 ,qaFlags \ 272 ,detrend1 \ 273 ,detrend2 \ 274 ,detrend3 \ 275 ,detrend4 \ 276 ,detrend5 \ 277 ,detrend6 \ 278 ,detrend7 \ 279 ,detrend8 \ 280 ,photoZero \ 281 ,ctype1 \ 282 ,ctype2 \ 283 ,crval1 \ 284 ,crval2 \ 285 ,crpix1 \ 286 ,crpix2 \ 287 ,cdelt1 \ 288 ,cdelt2 \ 289 ,pc001001 \ 290 ,pc001002 \ 291 ,pc002001 \ 292 ,pc002002 \ 293 ,polyOrder \ 294 ,pca1x3y0 \ 295 ,pca1x2y1 \ 296 ,pca1x1y2 \ 297 ,pca1x0y3 \ 298 ,pca1x2y0 \ 299 ,pca1x1y1 \ 300 ,pca1x0y2 \ 301 ,pca2x3y0 \ 302 ,pca2x2y1 \ 303 ,pca2x1y2 \ 304 ,pca2x0y3 \ 305 ,pca2x2y0 \ 306 ,pca2x1y1 \ 307 ,pca2x0y2 \ 308 ) VALUES ( \ 309 " + str(self.expID) + " \ 310 ," + str(ccdID) + " \ 311 ," + str(self.bias) + " \ 312 ," + str(self.biasScat) + " \ 313 ," + self.safeDictionaryAccess(header, 'MSKY_MN') + " \ 314 ," + self.safeDictionaryAccess(header, 'MSKY_SIG') + " \ 315 ," + self.safeDictionaryAccess(header, 'FSATUR') + " \ 316 ," + self.safeDictionaryAccess(header, 'FLIMIT') + " \ 317 ," + self.safeDictionaryAccess(header, 'CERROR') + " \ 318 ," + self.safeDictionaryAccess(self.header, 'ZPT_OBS') + " \ 319 ," + self.safeDictionaryAccess(header, 'NASTRO') + " \ 320 ," + self.safeDictionaryAccess(header, 'NASTRO') + " \ 321 ," + self.safeDictionaryAccess(header, 'CNAXIS1') + " \ 322 ," + self.safeDictionaryAccess(header, 'CNAXIS2') + " \ 323 , ( " + self.safeDictionaryAccess(header, 'FWHM_MAJ') + " + " + self.safeDictionaryAccess(header, 'FWHM_MIN') + " ) / 2.0 \ 324 ," + self.safeDictionaryAccess(header, 'FWHM_MAJ') + " \ 325 ," + self.safeDictionaryAccess(header, 'FWHM_MIN') + " \ 326 ," + self.safeDictionaryAccess(header, 'ANGLE') + " \ 327 ,-999 \ 328 ,-999 \ 329 ,-999 \ 330 ,-999 \ 331 ,-999 \ 332 ,-999 \ 333 ,-999 \ 334 ,-999 \ 335 ,-999 \ 336 ," + self.safeDictionaryAccess(header, 'APMIFIT') + " \ 337 ," + self.safeDictionaryAccess(header, 'DAPMIFIT') + " \ 338 ,'" + self.safeDictionaryAccess(header, 'DETECTOR') + "' \ 339 ," + str(self.scratchDb.getDvoImageFlags(header['IMAGEID'])) + " \ 340 ,'" + self.safeDictionaryAccess(header, 'DETREND.MASK') + "' \ 341 ,'" + self.safeDictionaryAccess(header, 'DETREND.DARK') + "' \ 342 ,'" + self.safeDictionaryAccess(header, 'DETREND.FLAT') + "' \ 343 ,' ' \ 344 ,' ' \ 345 ,' ' \ 346 ,' ' \ 347 ,' ' \ 348 ," + self.safeDictionaryAccess(self.header, 'ZPT_OBS') + " \ 349 ,'" + self.safeDictionaryAccess(header, 'CTYPE1') + "' \ 350 ,'" + self.safeDictionaryAccess(header, 'CTYPE2') + "' \ 351 ," + self.safeDictionaryAccess(header, 'CRVAL1') + " \ 352 ," + self.safeDictionaryAccess(header, 'CRVAL2') + " \ 353 ," + self.safeDictionaryAccess(header, 'CRPIX1') + " \ 354 ," + self.safeDictionaryAccess(header, 'CRPIX2') + " \ 355 ," + self.safeDictionaryAccess(header, 'CDELT1') + " \ 356 ," + self.safeDictionaryAccess(header, 'CDELT2') + " \ 357 ," + self.safeDictionaryAccess(header, 'PC001001') + " \ 358 ," + self.safeDictionaryAccess(header, 'PC001002') + " \ 359 ," + self.safeDictionaryAccess(header, 'PC002001') + " \ 360 ," + self.safeDictionaryAccess(header, 'PC002002') + " \ 361 ," + self.safeDictionaryAccess(header, 'NPLYTERM') + " \ 362 ," + self.safeDictionaryAccess(header, 'PCA1X3Y0') + " \ 363 ," + self.safeDictionaryAccess(header, 'PCA1X2Y1') + " \ 364 ," + self.safeDictionaryAccess(header, 'PCA1X1Y2') + " \ 365 ," + self.safeDictionaryAccess(header, 'PCA1X0Y3') + " \ 366 ," + self.safeDictionaryAccess(header, 'PCA1X2Y0') + " \ 367 ," + self.safeDictionaryAccess(header, 'PCA1X1Y1') + " \ 368 ," + self.safeDictionaryAccess(header, 'PCA1X0Y2') + " \ 369 ," + self.safeDictionaryAccess(header, 'PCA2X3Y0') + " \ 370 ," + self.safeDictionaryAccess(header, 'PCA2X2Y1') + " \ 371 ," + self.safeDictionaryAccess(header, 'PCA2X1Y2') + " \ 372 ," + self.safeDictionaryAccess(header, 'PCA2X0Y3') + " \ 373 ," + self.safeDictionaryAccess(header, 'PCA2X2Y0') + " \ 374 ," + self.safeDictionaryAccess(header, 'PCA2X1Y1') + " \ 375 ," + self.safeDictionaryAccess(header, 'PCA2X0Y2') + " \ 376 )" 198 sqlLine = sqlUtility("INSERT INTO " + tableName + "(") 199 200 sqlLine.group("frameID", str(self.expID)) 201 sqlLine.group("ccdID", str(ccdID)) 202 sqlLine.group("bias", str(self.bias)) 203 sqlLine.group("biasScat", str(self.biasScat)) 204 sqlLine.group("sky", "self.safeDictionaryAccess(header, 'MSKY_MN')") 205 sqlLine.group("skyScat", "self.safeDictionaryAccess(header, 'MSKY_SIG')") 206 sqlLine.group("magSat", "self.safeDictionaryAccess(header, 'FSATUR')") 207 sqlLine.group("completMag", "self.safeDictionaryAccess(header, 'FLIMIT')") 208 sqlLine.group("astroScat", "self.safeDictionaryAccess(header, 'CERROR')") 209 sqlLine.group("photoScat", "self.safeDictionaryAccess(self.header, 'ZPT_OBS')") 210 sqlLine.group("numAstroRef", "self.safeDictionaryAccess(header, 'NASTRO')") 211 sqlLine.group("numPhotoRef", "self.safeDictionaryAccess(header, 'NASTRO')") 212 sqlLine.group("nx", "self.safeDictionaryAccess(header, 'CNAXIS1')") 213 sqlLine.group("ny", "self.safeDictionaryAccess(header, 'CNAXIS2')") 214 sqlLine.group("psfFwhm", str(psfFwhm)) 215 sqlLine.group("psfWidMajor", "self.safeDictionaryAccess(header, 'FWHM_MAJ')") 216 sqlLine.group("psfWidMinor", "self.safeDictionaryAccess(header, 'FWHM_MIN')") 217 sqlLine.group("psfTheta", "self.safeDictionaryAccess(header, 'ANGLE')") 218 sqlLine.group("momentXX", "-999") 219 sqlLine.group("momentXY", "-999") 220 sqlLine.group("momentYY", "-999") 221 sqlLine.group("momentM3C", "-999") 222 sqlLine.group("momentM3S", "-999") 223 sqlLine.group("momentM4C", "-999") 224 sqlLine.group("momentM4S", "-999") 225 sqlLine.group("momentR1", "-999") 226 sqlLine.group("momentRH", "-999") 227 sqlLine.group("apResid", "self.safeDictionaryAccess(header, 'APMIFIT')") 228 sqlLine.group("dapResid", "self.safeDictionaryAccess(header, 'DAPMIFIT')") 229 sqlLine.group("detectorID", self.safeDictionaryAccess(header, 'DETECTOR')) 230 sqlLine.group("qaFlags", str(self.scratchDb.getDvoImageFlags(header['IMAGEID']))) 231 sqlLine.group("detrend1", self.safeDictionaryAccess(header, 'DETREND.MASK')) 232 sqlLine.group("detrend2", self.safeDictionaryAccess(header, 'DETREND.DARK')) 233 sqlLine.group("detrend3", self.safeDictionaryAccess(header, 'DETREND.FLAT')) 234 sqlLine.group("detrend4", " ") 235 sqlLine.group("detrend5", " ") 236 sqlLine.group("detrend6", " ") 237 sqlLine.group("detrend7", " ") 238 sqlLine.group("detrend8", " ") 239 sqlLine.group("photoZero", "self.safeDictionaryAccess(self.header, 'ZPT_OBS')") 240 sqlLine.group("ctype1", "self.safeDictionaryAccess(header, 'CTYPE1')") 241 sqlLine.group("ctype2", "self.safeDictionaryAccess(header, 'CTYPE2')") 242 sqlLine.group("crval1", "self.safeDictionaryAccess(header, 'CRVAL1')") 243 sqlLine.group("crval2", "self.safeDictionaryAccess(header, 'CRVAL2')") 244 sqlLine.group("crpix1", "self.safeDictionaryAccess(header, 'CRPIX1')") 245 sqlLine.group("crpix2", "self.safeDictionaryAccess(header, 'CRPIX2')") 246 sqlLine.group("cdelt1", "self.safeDictionaryAccess(header, 'CDELT1')") 247 sqlLine.group("cdelt2", "self.safeDictionaryAccess(header, 'CDELT2')") 248 sqlLine.group("pc001001", "self.safeDictionaryAccess(header, 'PC001001')") 249 sqlLine.group("pc001002", "self.safeDictionaryAccess(header, 'PC001002')") 250 sqlLine.group("pc002001", "self.safeDictionaryAccess(header, 'PC002001')") 251 sqlLine.group("pc002002", "self.safeDictionaryAccess(header, 'PC002002')") 252 sqlLine.group("polyOrder", "self.safeDictionaryAccess(header, 'NPLYTERM')") 253 sqlLine.group("pca1x3y0", "self.safeDictionaryAccess(header, 'PCA1X3Y0')") 254 sqlLine.group("pca1x2y1", "self.safeDictionaryAccess(header, 'PCA1X2Y1')") 255 sqlLine.group("pca1x1y2", "self.safeDictionaryAccess(header, 'PCA1X1Y2')") 256 sqlLine.group("pca1x0y3", "self.safeDictionaryAccess(header, 'PCA1X0Y3')") 257 sqlLine.group("pca1x2y0", "self.safeDictionaryAccess(header, 'PCA1X2Y0')") 258 sqlLine.group("pca1x1y1", "self.safeDictionaryAccess(header, 'PCA1X1Y1')") 259 sqlLine.group("pca1x0y2", "self.safeDictionaryAccess(header, 'PCA1X0Y2')") 260 sqlLine.group("pca2x3y0", "self.safeDictionaryAccess(header, 'PCA2X3Y0')") 261 sqlLine.group("pca2x2y1", "self.safeDictionaryAccess(header, 'PCA2X2Y1')") 262 sqlLine.group("pca2x1y2", "self.safeDictionaryAccess(header, 'PCA2X1Y2')") 263 sqlLine.group("pca2x0y3", "self.safeDictionaryAccess(header, 'PCA2X0Y3')") 264 sqlLine.group("pca2x2y0", "self.safeDictionaryAccess(header, 'PCA2X2Y0')") 265 sqlLine.group("pca2x1y1", "self.safeDictionaryAccess(header, 'PCA2X1Y1')") 266 sqlLine.group("pca2x0y2", "self.safeDictionaryAccess(header, 'PCA2X0Y2')") 267 268 sql = sqlLine.make(") VALUES ( ", ")") 377 269 378 270 try: self.scratchDb.execute(sql) … … 407 299 results['SATDET'] = 0 408 300 409 # insert all detections into table 410 sql = "INSERT IGNORE INTO " + pspsTableName + " ( \ 411 ippDetectID \ 412 ,randomDetID \ 413 ,filterID \ 414 ,surveyID \ 415 ,obsTime \ 416 ,xPos \ 417 ,yPos \ 418 ,xPosErr \ 419 ,yPosErr \ 420 ,psfFlux \ 421 ,psfFluxErr \ 422 ,psfMajorFWHM \ 423 ,psfMinorFWHM \ 424 ,psfTheta \ 425 ,psfCore \ 426 ,psfLikelihood \ 427 ,psfQf \ 428 ,momentXX \ 429 ,momentXY \ 430 ,momentYY \ 431 ,momentR1 \ 432 ,momentRH \ 433 ,momentM3C \ 434 ,momentM3S \ 435 ,momentM4C \ 436 ,momentM4S \ 437 ,apFlux \ 438 ,kronFlux \ 439 ,kronFluxErr \ 440 ,psfQfPerfect \ 441 ,psfChiSq \ 442 ,infoFlag \ 443 ,sky \ 444 ,skyErr \ 445 ,pltScale \ 446 ,posAngle \ 447 ,dataRelease \ 448 ) \ 449 SELECT \ 450 IPP_IDET \ 451 , FLOOR(RAND()*9223372036854775807) \ 452 , " + str(self.filterID) + "\ 453 , " + str(self.surveyID) + " \ 454 ," + str(self.obsTime) + " \ 455 ,X_PSF \ 456 ,Y_PSF \ 457 ,X_PSF_SIG \ 458 ,Y_PSF_SIG \ 459 ,PSF_INST_FLUX / " + self.header['EXPTIME'] + " \ 460 ,PSF_INST_FLUX_SIG / " + self.header['EXPTIME'] + " \ 461 ,PSF_MAJOR \ 462 ,PSF_MINOR \ 463 ,PSF_THETA \ 464 ,-999 \ 465 ,psfLikelihood(EXT_NSIGMA) \ 466 ,PSF_QF \ 467 ,MOMENTS_XX \ 468 ,MOMENTS_XY \ 469 ,MOMENTS_YY \ 470 ,MOMENTS_R1 \ 471 ,MOMENTS_RH \ 472 ,MOMENTS_M3C \ 473 ,MOMENTS_M3S \ 474 ,MOMENTS_M4C \ 475 ,MOMENTS_M4S \ 476 ,POW(10.0, -0.4 *AP_MAG) / " + self.header['EXPTIME'] + " \ 477 ,KRON_FLUX / " + self.header['EXPTIME'] + " \ 478 ,KRON_FLUX_ERR / " + self.header['EXPTIME'] + " \ 479 ,PSF_QF_PERFECT \ 480 ,PSF_CHISQ \ 481 ,FLAGS2 << 32 | FLAGS \ 482 ,SKY / " + self.header['EXPTIME'] + " \ 483 ,SKY_SIGMA / " + self.header['EXPTIME'] + " \ 484 ,PLTSCALE \ 485 ,POSANGLE \ 486 , " + str(self.skychunk.dataRelease) + "\ 487 FROM " + ippTableName 488 # self.logger.info(sql) 489 490 # these were used above (left over from before PSF_INST_FLUX, PSF_INST_FLUX_SIG were available? 491 # ,POW(10.0, (-0.4*PSF_INST_MAG)) / " + self.header['EXPTIME'] + " 492 # ,ABS((PSF_INST_MAG_SIG*(POW(10.0, (-0.4*PSF_INST_MAG)) / " + self.header['EXPTIME'] + ")) / 1.085736) 493 494 # I need a way to choose the sql above based on the cmf version: V3 (LAP.PV1) does not have AP_FLUX 495 # AP_FLUX is no ,AP_FLUX / " + self.header['EXPTIME'] + " 496 497 self.scratchDb.execute(sql) 498 499 # XXX EAM : I removed this old fix for invalid fluxes 500 # add a instFlux = 0.0 -> 0.000001 501 # XXX EAM : why is this done? 502 # sql="UPDATE " + pspsTableName + " SET psfFlux = 0.0000001 WHERE psfFlux = 0" 503 # self.scratchDb.execute(sql) 504 301 extTimeString = str(self.header['EXPTIME']) 302 303 # insert all detections into table : do NOT include the IGNORE unless we have to 304 # sqlLine = sqlUtility("INSERT IGNORE INTO " + pspsTableName + " (") 305 sqlLine = sqlUtility("INSERT INTO " + pspsTableName + " (") 306 307 # XXX WARNING: need to apply platescale to convert sizes to arcsec 308 # XXX apFluxF or apFluxNpix + apFluxRadius? 309 310 sqlLine.group("ippDetectID", "IPP_IDET") 311 sqlLine.group("randomDetID", "FLOOR(RAND()*9223372036854775807)") 312 sqlLine.group("filterID", str(self.filterID)) 313 sqlLine.group("surveyID", str(self.surveyID)) 314 sqlLine.group("obsTime", str(self.obsTime)) 315 sqlLine.group("xPos", "X_PSF") 316 sqlLine.group("yPos", "Y_PSF") 317 sqlLine.group("xPosErr", "X_PSF_SIG") 318 sqlLine.group("yPosErr", "Y_PSF_SIG") 319 sqlLine.group("pltScale", "PLTSCALE") 320 sqlLine.group("posAngle", "POSANGLE") 321 sqlLine.group("psfFlux", "PSF_INST_FLUX / " + extTimeString) 322 sqlLine.group("psfFluxErr", "PSF_INST_FLUX_SIG / " + extTimeString) 323 sqlLine.group("psfMajorFWHM", "PSF_FWHM_MAJ") 324 sqlLine.group("psfMinorFWHM", "PSF_FWHM_MIN") 325 sqlLine.group("psfTheta", "PSF_THETA") 326 sqlLine.group("psfCore", "PSF_CORE") 327 sqlLine.group("psfQf", "PSF_QF") 328 sqlLine.group("psfQfPerfect", "PSF_QF_PERFECT") 329 sqlLine.group("psfChiSq", "PSF_CHISQ") 330 sqlLine.group("psfLikelihood", "psfLikelihood(EXT_NSIGMA)") 331 sqlLine.group("momentXX", "MOMENTS_XX") 332 sqlLine.group("momentXY", "MOMENTS_XY") 333 sqlLine.group("momentYY", "MOMENTS_YY") 334 sqlLine.group("momentR1", "MOMENTS_R1") 335 sqlLine.group("momentRH", "MOMENTS_RH") 336 sqlLine.group("momentM3C", "MOMENTS_M3C") 337 sqlLine.group("momentM3S", "MOMENTS_M3S") 338 sqlLine.group("momentM4C", "MOMENTS_M4C") 339 sqlLine.group("momentM4S", "MOMENTS_M4S") 340 sqlLine.group("apFlux", "AP_FLUX / " + extTimeString) 341 sqlLine.group("apFluxErr", "AP_FLUX_SIG / " + extTimeString) 342 sqlLine.group("apFluxNpix", "AP_NPIX") 343 sqlLine.group("kronFlux", "KRON_FLUX / " + extTimeString) 344 sqlLine.group("kronFluxErr", "KRON_FLUX_ERR / " + extTimeString) 345 sqlLine.group("kronRad", "MOMENTS_R1 * 2.5") 346 sqlLine.group("sky", "SKY / " + extTimeString) 347 sqlLine.group("skyErr", "SKY_SIGMA / " + extTimeString) 348 sqlLine.group("infoFlag", "FLAGS") 349 sqlLine.group("infoFlag2", "FLAGS2") 350 sqlLine.group("dataRelease", str(self.skychunk.dataRelease)) 351 352 sqlLine.make(") SELECT ", " FROM " + ippTableName) 353 354 print "sql: " + sql 355 356 self.scratchDb.execute(sql) 357 505 358 # NOTE : Flux limits : in the current PSPS schema, negative fluxes 506 359 # cause problems for sql queries which work in mags as SQL cannot do 507 360 # something like (f < 0.0) ? -999 : -2.5*log10(f) 508 361 # as a result, the negative fluxes here result in floating point errors 362 # XXX EAM 2014072 : Is this still a problem? 509 363 sql = "UPDATE " + pspsTableName + " SET psfFlux = 1e20 WHERE psfFlux <= 0.0" 510 364 self.scratchDb.execute(sql) … … 518 372 # we don't delete these anymore 519 373 results['NULLINSTFLUX'] = 0; 520 521 374 522 375 ''' … … 547 400 548 401 self.scratchDb.updateAllRows(tableName, "dataRelease", str(self.skychunk.dataRelease)) 549 550 '''551 Populates the DetectionCalib table for this OTA552 '''553 def populateDetectionCalibTableUpdateInsert(self, ota): 554 555 tableName = "Detection_" + ota402 ''' 403 Populates the SkinnyObject table for this OTA 404 ''' 405 def populateSkinnyObjectTable(self, ota): 406 407 tableName = "SkinnyObject_" + ota 408 556 409 # drop then re-create table 557 #self.scratchDb.dropTable(tableName)558 #sql = "CREATE TABLE " + tableName + " LIKE DetectionCalib"559 #try: self.scratchDb.execute(sql)560 #except: pass410 self.scratchDb.dropTable(tableName) 411 sql = "CREATE TABLE " + tableName + " LIKE SkinnyObject" 412 try: self.scratchDb.execute(sql) 413 except: pass 561 414 562 415 # insert all detections into table 563 416 sql = "INSERT INTO " + tableName + " ( \ 564 417 objID \ 565 ,detectID \566 418 ,ippObjID \ 567 ,ippDetectID \568 ,filterID \569 419 ,surveyID \ 570 420 ) \ 571 421 SELECT \ 572 422 objID \ 573 ,detectID \574 423 ,ippObjID \ 575 ,ippDetectID \576 ,filterID \577 424 ,surveyID \ 578 425 FROM Detection_" + ota 579 # self.scratchDb.execute(sql) 580 581 # insert calibration information from dvoDetections into the Table 582 sql = "UPDATE " + tableName + " AS a, " + self.scratchDb.dvoDetectionTable + " AS b \ 583 SET a.ra = b.ra, \ 584 a.dec = b.dec_, \ 585 a.raErr = b.raErr, \ 586 a.decErr = b.decErr, \ 587 a.zp = b.zp, \ 588 a.expTime = b.expTime, \ 589 a.airMass = b.airMass \ 590 WHERE a.objID = b.objID AND a.detectID = b.detectID" 591 self.scratchDb.execute(sql) 592 self.scratchDb.updateAllRows(tableName, "dataRelease", str(self.skychunk.dataRelease)) 593 594 ''' 595 Populates the DetectionCalib table for this OTA 596 ''' 597 def populateDetectionCalibTable(self, ota): 598 599 # target table name: 600 tableName = "Detection_" + ota 601 # drop then re-create table 602 #self.scratchDb.dropTable(tableName) 603 #sql = "CREATE TABLE " + tableName + " LIKE Detection" 604 #try: self.scratchDb.execute(sql) 605 #except: pass 606 607 externID = self.imageIDs[ota] 608 609 imageID = self.scratchDb.getImageIDFromExternID(externID) 610 self.logger.infoPair("obtained imageID",imageID) 611 self.logger.infoPair("obtained externID",externID) 612 613 # insert all detections into table 614 sql = "Update Detection_" + ota + " AS a, "+ self.scratchDb.dvoDetectionTable + " as b \ 615 set a.ra=b.ra, \ 616 a.dec = b.dec_, \ 617 a.raErr = b.raErr, \ 618 a.decErr = b.decErr, \ 619 a.zp = b.zp, \ 620 a.expTime = b.expTime, \ 621 a.airMass = b.airMass \ 622 WHERE (a.objID = b.objID AND a.detectID = b.detectID) \ 623 AND b.imageID = " + str(imageID) \ 624 625 626 try: self.scratchDb.execute(sql) 627 except: 628 self.logger.info("failed to update data for detectionCalib") 629 self.logger.infoPair("sql: ", sql) 630 raise 631 632 ''' 633 Populates the Detection table for this OTA 634 ''' 635 def populateObjectCalColorTable(self, ota): 636 637 tableName = "ObjectCalColor_" + ota 638 639 # drop then re-create table 640 self.scratchDb.dropTable(tableName) 641 sql = "CREATE TABLE " + tableName + " LIKE ObjectCalColor" 642 try: self.scratchDb.execute(sql) 643 except: pass 644 645 # insert all detections into table 646 sql = "INSERT INTO " + tableName + " ( \ 647 objID \ 648 ,ippObjID \ 649 ,filterID \ 650 ) \ 651 SELECT \ 652 objID \ 653 ,ippObjID \ 654 ,filterID \ 655 FROM Detection_" + ota 656 self.scratchDb.execute(sql) 657 658 self.scratchDb.updateAllRows(tableName, "calibModNum", str(self.calibModNum)) 426 self.scratchDb.execute(sql) 427 659 428 self.scratchDb.updateAllRows(tableName, "dataRelease", str(self.skychunk.dataRelease)) 660 429 … … 685 454 686 455 # store sourceID/imageID combo in Db so DVO can look up later 687 if not self.useFullTables: 688 self.scratchDb.insertNewDvoExternID(header['SOURCEID'], header['IMAGEID']) 456 self.scratchDb.insertNewDvoExternID(header['SOURCEID'], header['IMAGEID']) 689 457 690 458 # store these for later … … 734 502 735 503 # now run DVO code to get all IDs 736 if not self.useFullTables: 737 if not self.getIDsFromDVO(): return False 504 if not self.getIDsFromDVO(): return False 738 505 739 506 # dec is reserved in MySQL, so STILTS replaces if with dec_, which is not the name of … … 774 541 imageID = self.scratchDb.getImageIDFromExternID(externID) 775 542 self.logger.debug("Updating table '" + table + "' with DVO IDs using imageID = %d" % imageID) 543 776 544 sql = "UPDATE IGNORE " + table + " AS a, " + self.scratchDb.dvoDetectionTable + " AS b SET \ 777 a.ippObjID = b.ippObjID, \ 778 a.detectID = b.detectID, \ 779 a.objID = b.objID, \ 780 a.infoFlag = b.flags << 45 | a.infoFlag \ 545 a.objID = b.objID, \ 546 a.detectID = b.detectID, \ 547 a.ippObjID = b.ippObjID, \ 548 a.ra = b.ra, \ 549 a.dec_ = b.dec_, \ 550 a.raErr = b.raErr, \ 551 a.decErr = b.decErr, \ 552 a.zp = b.zp, \ 553 a.telluricExt = b.telluricExt, \ 554 a.airmass = b.airmass, \ 555 a.expTime = b.expTime, \ 556 a.infoFlag2 = (b.flags << 13) | a.infoFlag2 \ 781 557 WHERE a.ippDetectID = b.ippDetectID \ 782 558 AND b.imageID = " + str(imageID) 783 559 560 # XXX need to add dvoRegion 561 784 562 self.scratchDb.execute(sql) 785 563 … … 788 566 ''' 789 567 def populatePspsTablesChip(self, chipname, x, y, results, tables): 790 # XXX EAM NOTE: drop tables (Detection_, SkinnyObject_, DetectionCalib_, Detection_)here so568 # XXX EAM NOTE: drop tables Detection_* here so 791 569 # they do not polute the db? 792 570 # XXX or put an explicit drop at the end of the loop? 793 571 794 # self.logger.infoTitle("Processing " + chipname)572 # self.logger.infoTitle("Processing " + chipname) 795 573 # this is a bit crude: if the chip is not present, this test will fail and the chip 796 574 # will be (correctly) skipped. would be better to carry that information explicitly ("chip is missing") … … 853 631 self.scratchDb.execute(sql) 854 632 855 #self.logger.info("updated imagedata")856 857 self.populateDetectionCalibTable(chipname)858 #self.logger.info("updated detectioncalibtable")859 860 633 # add these to list of tables to export later 861 634 self.tablesToExport.append("ImageMeta_" + chipname) … … 865 638 self.logger.info("export Detection") 866 639 867 868 640 tables.append("Detection_" + chipname) 869 self.logger.info("updated detection calibtable")641 self.logger.info("updated detection") 870 642 871 643 self.validChips.append(chipname) … … 1024 796 return super(DetectionBatch, self).importIppTables(columns, regex) 1025 797 1026 1027 798 ''' 1028 799 Overriding this method. Use regex to trim off, eg _XY33 extension … … 1030 801 def exportPspsTablesToFits(self, regex="(.*)"): 1031 802 return super(DetectionBatch, self).exportPspsTablesToFits("([a-zA-Z]+)") 1032 -
branches/eam_branches/ipp-20140717/ippToPsps/jython/dvo.py
r36447 r37129 50 50 self.regionsIngestedButOutOfDate = [] 51 51 52 # we have (still)3 modes of ingest from dvo cpt/cps/cpm files53 # 1) dvograbber (use FullTables == FALSE),52 # we USED TO have 3 modes of ingest from dvo cpt/cps/cpm files 53 # 1) dvograbber (useStilts == TRUE, useFullTables == FALSE), 54 54 # 2) jython/stilts (useStilts == TRUE, useFullTables == TRUE) 55 # 3) dvopsps (useStilts == FALSE, useFullTables == TRUE)55 # 3) dvopsps (useStilts == FALSE, useFullTables == FALSE) 56 56 # my goal (EAM, 2013/01/31) is to migrate to only dvopsps 57 57 58 self.useStilts = 0 59 self.scratchDb.setUseFullTables(True) 58 self.scratchDb.setDvoTableNames() 60 59 61 60 # decide if we are using the right DVO for this scratchDb … … 105 104 if not self.correctDvo: return 106 105 106 if (self.skychunk.dvoLocation == 'none'): 107 print "do not load Photcodes for place-holder DVO " + self.skychunk.dvoLocation 108 return False 109 107 110 # check if we have up-to-date version 108 111 path = self.skychunk.dvoLocation + "/Photcodes.dat" … … 156 159 if not self.correctDvo: return False 157 160 161 if (self.skychunk.dvoLocation == 'none'): 162 print "do not load SkyTable for place-holder DVO " + self.skychunk.dvoLocation 163 return False 164 158 165 path = self.skychunk.dvoLocation + "/SkyTable.fits" 159 166 if self.scratchDb.alreadyImportedThisDvoTable(path): … … 164 171 self.logger.infoPair("DVO SkyTable.fits file", "NOT up-to-date") 165 172 166 if self.useStilts: 167 self.importFits( 168 path, 169 "R_MIN R_MAX D_MIN D_MAX INDEX NAME", 170 self.scratchDb.dvoSkyTable) 171 else: 172 173 # create dvoSkyTable 174 sql = "drop TABLE dvoSkyTable" 175 try: 176 self.scratchDb.execute(sql) 177 except: pass 178 179 # create dvoSkyTable 180 sql = "CREATE TABLE dvoSkyTable (R_MIN REAL, R_MAX REAL, D_MIN REAL, D_MAX REAL, INDEX_ INT, NAME CHAR(18))" 181 self.scratchDb.execute(sql) 182 183 # TODO path to DVO prog hardcoded temporarily 184 cmd = "dvopsps skytable" 185 cmd += " -dbhost " + self.scratchDb.dbHost 186 cmd += " -dbname " + self.scratchDb.dbName 187 cmd += " -dbuser " + self.scratchDb.dbUser 188 cmd += " -dbpass " + self.scratchDb.dbPass 189 cmd += " -D CATDIR " + self.skychunk.dvoLocation 190 191 self.logger.infoPair("Running dvopsps", cmd) 192 p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE) 193 p.wait() 194 if p.returncode != 0: 195 self.logger.errorPair("dvopsps failed on SkyTable.fits for ", self.skychunk.dvoLocation) 196 raise 173 # drop dvoSkyTable (if it exists) 174 sql = "drop TABLE dvoSkyTable" 175 try: self.scratchDb.execute(sql) 176 except: pass 177 178 # create dvoSkyTable 179 sql = "CREATE TABLE dvoSkyTable (R_MIN REAL, R_MAX REAL, D_MIN REAL, D_MAX REAL, INDEX_ INT, NAME CHAR(18))" 180 self.scratchDb.execute(sql) 181 182 # TODO path to DVO prog hardcoded temporarily 183 cmd = "dvopsps skytable" 184 cmd += " -dbhost " + self.scratchDb.dbHost 185 cmd += " -dbname " + self.scratchDb.dbName 186 cmd += " -dbuser " + self.scratchDb.dbUser 187 cmd += " -dbpass " + self.scratchDb.dbPass 188 cmd += " -D CATDIR " + self.skychunk.dvoLocation 189 190 self.logger.infoPair("Running dvopsps", cmd) 191 p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE) 192 p.wait() 193 if p.returncode != 0: 194 self.logger.errorPair("dvopsps failed on SkyTable.fits for ", self.skychunk.dvoLocation) 195 raise 197 196 198 197 self.logger.infoPair("Adding index to", self.scratchDb.dvoSkyTable) -
branches/eam_branches/ipp-20140717/ippToPsps/jython/dvoobjects.py
r35417 r37129 27 27 self.ingestFileTypes = ['cpt', 'cps'] 28 28 self.loadPhotcodes() 29 30 '''31 Ingests object files for this region32 '''33 def ingestRegion(self, region):34 35 self.logger.infoPair("Ingesting objects for", region)36 37 for fileType in self.ingestFileTypes:38 39 path = self.skychunk.dvoLocation + "/" + region + "." + fileType40 tableName = self.scratchDb.getDbFriendlyTableName(region + "." + fileType)41 42 self.importFits(path, "*", tableName)43 44 self.scratchDb.setImportedThisDvoTable(path, region)45 46 return True47 48 29 49 30 ''' -
branches/eam_branches/ipp-20140717/ippToPsps/jython/ippjython
r35605 r37129 13 13 14 14 set JARDIR = $datadir/jar 15 16 # XXX if you want to run a local test, use . for JYDIR 17 # set JYDIR = . 15 18 set JYDIR = $datadir/jython 19 16 20 setenv IPPTOPSPS_DATA $datadir/ipptopsps 17 21 … … 45 49 shift 46 50 47 # XXX if you want to run a test on a local file, use this line:48 # $JAVA -Xbootclasspath/a:$CLASSPATH -jar $JYTHON $classfile $*49 50 51 $JAVA -Xbootclasspath/a:$CLASSPATH -jar $JYTHON $JYDIR/$classfile $* -
branches/eam_branches/ipp-20140717/ippToPsps/jython/ipptopsps.py
r35417 r37129 143 143 def checkClientStatus(self): 144 144 145 print "update client"145 print "updateClient (add this process to client table)" 146 146 self.ippToPspsDb.updateClient(self.config.programName, self.HOST, self.PID) 147 147 148 print "check killed"148 print "check if isKilled (has someone killed me?)" 149 149 if self.ippToPspsDb.isKilled(self.HOST, self.PID): 150 150 self.exitProgram("killed via Db") … … 152 152 # this loop pauses the process if we have no skychunk or we have set it to pause 153 153 firstTimeIn = True 154 print "refresh skychunk"154 print "refreshSkychunk" 155 155 while not self.refreshSkychunk() or self.ippToPspsDb.isPaused(self.HOST, self.PID): 156 156 -
branches/eam_branches/ipp-20140717/ippToPsps/jython/ipptopspsdb.py
r36815 r37129 786 786 and not self.consistentlyFailed(batchType, stageID)): 787 787 788 self.logger.infoPair("heather:","passed logic")788 # self.logger.infoPair("heather:","passed logic") 789 789 790 790 sql = "INSERT INTO batch ( \ … … 803 803 '" + self.skychunk.name + "' \ 804 804 )" 805 self.logger.infoPair("heather:","sql") 805 806 # self.logger.infoPair("heather:",sql) 806 807 807 808 self.execute(sql) … … 816 817 except: 817 818 self.logger.exception("Unable to get batch ID") 819 self.logger.infoPair("sql:",sql) 820 818 821 batchID = -1 819 822 … … 1017 1020 response = raw_input(" * Name for new skychunk, or existing skychunk to edit? ") 1018 1021 if response == "": return 1022 response = response.strip() 1019 1023 self.skychunk.name = response 1020 1024 … … 1056 1060 question = question + "? " 1057 1061 response = raw_input(question) 1062 response = response.strip() 1063 print "response: '" + response + "'" 1058 1064 if response != "": 1059 1065 if type.find("varchar") != -1 or type.find("timestamp") != -1: quotes = "'" 1060 1066 else: quotes = "" 1067 # print "UPDATE skychunk SET " + field + " = " + quotes + response + quotes + " WHERE name = '" + self.skychunk.name + "'" 1061 1068 self.execute("UPDATE skychunk SET " + field + " = " + quotes + response + quotes + " WHERE name = '" + self.skychunk.name + "'") 1062 1069 … … 1130 1137 self.skychunk.batchTypes = [] 1131 1138 try: 1139 # print "sql: " + sql 1132 1140 rs = self.executeQuery(sql) 1133 1141 … … 1176 1184 if rs.getInt(26) == 1: self.skychunk.parallel = True 1177 1185 self.skychunk.P2_smf_version = rs.getString(27) 1186 # options: "use_new", "not_reproc", "use_original" 1187 1178 1188 self.skychunk.ST_cmf_version = rs.getString(28) 1189 # options: not used? 1190 1191 # NOTE : the rs (ResultSet) class is somewhat annoying and finicky esp about timestamp values 1192 # for example, rs.getTimestamp(N) fails silently if the value is not a valid time. this is 1193 # also true to getString() on the same column. Docs for the ResultSet class can be found here: 1194 # http://docs.oracle.com/javase/1.5.0/docs/api/java/sql/ResultSet.html?is-external=true 1195 1196 # rsmd = rs.getMetaData() 1197 # print "got metadata" 1198 # print "number of columns: " + str(rsmd.getColumnCount()) 1199 # print "label: " + rsmd.getColumnLabel(25) 1200 # print "label: " + rsmd.getColumnLabel(29) 1201 # print "name: " + rsmd.getColumnName(25) 1202 # print "name: " + rsmd.getColumnName(29) 1203 # print "typename: " + rsmd.getColumnTypeName(25) 1204 # print "typename: " + rsmd.getColumnTypeName(29) 1205 1206 # epochStamp = rs.getTimestamp(16) 1207 # print "epoch: " + epochStamp.toString() 1208 1209 # print "label: " + rsmd.getColumnLabel(16) 1210 # print "name: " + rsmd.getColumnName(16) 1211 # print "typename: " + rsmd.getColumnTypeName(16) 1212 1179 1213 self.skychunk.trange_start = rs.getString(29) 1214 # options: "YYYY-MM-DD,HH:MM:SS" or "0000-00-00 00:00:00" 1215 1180 1216 self.skychunk.trange_end = rs.getString(30) 1217 # options: "YYYY-MM-DD,HH:MM:SS" or "0000-00-00 00:00:00" 1181 1218 1182 1219 if self.skychunk.parallel: print "USING parallel" … … 1621 1658 pass 1622 1659 1623 self.execute("CREATE TEMPORARY TABLE all_pending (stage_id bigint(20), ra_bore float, dec_bore float)") 1660 # XXX EAM : 20140727: for now this is not temporary (for debugging) 1661 # self.execute("CREATE TEMPORARY TABLE all_pending (stage_id bigint(20), ra_bore float, dec_bore float)") 1662 self.execute("CREATE TABLE all_pending (stage_id bigint(20), ra_bore float, dec_bore float)") 1624 1663 for row in rows: 1625 1664 … … 1702 1741 try: 1703 1742 rs = self.executeQuery(sql) 1704 while (rs.next()): ids.append(rs.getInt(1)) 1743 while (rs.next()): 1744 ids.append(rs.getInt(1)) 1745 print "stage_id: " + str(rs.getInt(1)) 1705 1746 except: 1706 1747 self.logger.errorPair("Can't get items in this box", sql) -
branches/eam_branches/ipp-20140717/ippToPsps/jython/loader.py
r36709 r37129 160 160 self.logger.infoPair(batchType + " items found in this box", "%d" % len(ids)) 161 161 162 useFullTables = 0163 162 if batchType != "OB": 164 165 if (self.dvoDetections.useStilts): 166 # look in DVO for this box (with extra border) 167 self.logger.infoPair("Querying DVO for this sky area", "") 168 169 # XXXX EAM : This code should not be used anymore 170 boxSize = 0.0 171 self.dvoDetections.setSkyAreaAsBox(boxDim['RA'], boxDim['DEC'], boxSize) 172 #self.dvoDetections.setSkyArea() 173 sizeToBeIngested = self.dvoDetections.getDiskSizeOfRegionsToBeIngested() 174 if sizeToBeIngested == 0.0: smfsPerGB = 999999999 175 else: smfsPerGB = len(ids)/sizeToBeIngested 176 self.logger.infoPair("DVO to be ingested", "%7.1e GB" % sizeToBeIngested) 177 self.logger.infoPair("smfs-per-GB", "%.1f" % smfsPerGB) 178 179 # should do we pre-ingest stuff from DVO? 180 # NOTE EAM : this skychunk loads the dvo detections into the mysql db 181 # XXXX EAM : this should happen for both P2 and Stack detection 182 # XXXX EAM : in parallel model, this should happen for all P2 & Stack batches 183 # 184 if (batchType == 'P2' or batchType == 'ST' or batchType == 'DF' or batchType == 'FW') and smfsPerGB > 30: 185 if not self.dvoDetections.sync(): 186 self.logger.errorPair("Could not sync DVO with MySQL", "skipping") 187 continue 188 189 useFullTables = 1 190 else: 191 # XXX EAM : this is not currently optional 192 # (it is the only path). either remove the 193 # non-native ingest code or make it an 194 # option if we are using the native 195 # loader, always use it need to work out a 196 # good boundary / region strategy in 197 # coordination with impact of mysql 198 # insertion 199 if not self.ippToPspsDb.isBoxIngested(boxId, self.scratchDb.dbHost): 200 if not self.dvoDetections.nativeIngestDetections(boxId, boxDim): 201 self.logger.error("Unable to ingest detections with nativeIngest") 202 return False 203 204 useFullTables = 1 205 206 ## else: 207 ## # if we are using the native loader, always use it 208 ## # need to work out a good boundary / region strategy in coordination with 209 ## # impact of mysql insertion 210 ## self.dvoObjects.nativeIngestObjects(boxDim['RA'], boxDim['DEC'], boxSizeSansBorder) 211 ## useFullTables = 1 163 if not self.ippToPspsDb.isBoxIngested(boxId, self.scratchDb.dbHost): 164 if not self.dvoDetections.nativeIngestDetections(boxId, boxDim): 165 self.logger.error("Unable to ingest detections with nativeIngest") 166 return False 212 167 213 168 ''' 214 169 NOTE EAM : "TheseItems" refers to each of the stack CMFs, camera SMFs, or object batches 215 170 ''' 216 self.logger.infoBool("Using pre-ingested DVO data?", useFullTables) 217 if not self.processTheseItems(batchType, ids, useFullTables): 171 if not self.processTheseItems(batchType, ids): 218 172 abort = True 219 173 break … … 228 182 Actually loops through items and processes them 229 183 ''' 230 def processTheseItems(self, batchType, ids , useFullTables):184 def processTheseItems(self, batchType, ids): 231 185 232 186 self.logger.infoPair("%s items queued" % batchType, "%d" % len(ids)) … … 262 216 self.scratchDb, 263 217 id, 264 batchID, 265 useFullTables) 218 batchID) 266 219 elif batchType == "ST": 267 220 self.logger.infoPair("defining ST batch for sky_id:",id) … … 273 226 self.scratchDb, 274 227 id, 275 batchID, 276 useFullTables) 228 batchID) 277 229 278 230 elif batchType == "OB": … … 284 236 self.scratchDb, 285 237 id, 286 batchID, 287 useFullTables) 238 batchID) 288 239 289 240 elif batchType == "DF": … … 295 246 self.scratchDb, 296 247 id, 297 batchID, 298 useFullTables) 248 batchID) 299 249 300 250 elif batchType == "DO": … … 306 256 self.scratchDb, 307 257 id, 308 batchID, 309 useFullTables) 258 batchID) 310 259 311 260 elif batchType == "FW": … … 317 266 self.scratchDb, 318 267 id, 319 batchID, 320 useFullTables) 268 batchID) 321 269 322 270 elif batchType == "FO": … … 328 276 self.scratchDb, 329 277 id, 330 batchID, 331 useFullTables) 278 batchID) 332 279 333 280 batch.run() -
branches/eam_branches/ipp-20140717/ippToPsps/jython/mysql.py
r35417 r37129 108 108 except: 109 109 print "failed to kill connection: ", connectionID 110 111 def listTables(self): 112 113 sql = "show tables" 114 rs = self.executeQuery(sql) 115 while (rs.next()): 116 tableName = rs.getString(1) 117 print "table: " + tableName 118 rs.close() 110 119 111 120 ''' -
branches/eam_branches/ipp-20140717/ippToPsps/jython/objectbatch.py
r36744 r37129 15 15 from scratchdb import ScratchDb 16 16 from dvoobjects import DvoObjects 17 from sqlUtility import sqlUtility 17 18 18 19 import logging.config … … 37 38 scratchDb, 38 39 dvoID, 39 batchID, 40 useFullTables): 40 batchID): 41 41 42 42 super(ObjectBatch, self).__init__( … … 50 50 batchID, 51 51 "OB", 52 None, 53 1) 52 None) 54 53 55 54 try: 56 ## XX pass in the existing connection to scratchDb57 55 self.dvoObjects = DvoObjects(self.logger, self.config, self.skychunk, self.ippToPspsDb, self.scratchDb) 58 56 except: … … 74 72 self.region = self.scratchDb.getRegionNameFromThisDvoIndex(self.id) 75 73 self.ippToPspsDb.insertObjectMeta(self.batchID, self.region) 76 if True: 77 self.dvoObjects.nativeIngestRegion(self.region) 78 else: 79 self.dvoObjects.ingestRegion(self.region) 74 self.dvoObjects.nativeIngestRegion(self.region) 80 75 81 76 cptTableName = self.scratchDb.getDbFriendlyTableName(self.region + ".cpt") … … 90 85 def alterPspsTables(self): 91 86 87 # XXX EAM 2014.07.24 : why is this no longer needed? 92 88 # dec is reserved in MySQL, so STILTS replaces if with dec_, which PSPS doesn't like. so, force it back again using `` 93 #self.scratchDb.execute("ALTER TABLE MeanObject CHANGE dec_ `dec` double")94 #self.scratchDb.execute("ALTER TABLE ObjectThin CHANGE dec_ `dec` double")89 # self.scratchDb.execute("ALTER TABLE MeanObject CHANGE dec_ `dec` double") 90 # self.scratchDb.execute("ALTER TABLE ObjectThin CHANGE dec_ `dec` double") 95 91 96 92 return True … … 101 97 def indexIppTables(self): 102 98 103 self.logger.infoPair("Creating indexes on", "IPP tables") 99 # since dvopsps is now used, no action is needed here 100 # self.logger.infoPair("Creating indexes on", "IPP tables") 104 101 105 102 return True … … 109 106 ''' 110 107 def updateMeanObjectFromCps(self, cpsTable): 108 109 # list of all filters PSPS is interested in 110 # XXX EAM : 2014.07.24 : this list should probably be in a config file somewhere 111 interestedFilters = ['g', 'r', 'i', 'z', 'y'] 112 113 filters = self.scratchDb.getOrderedListOfFiltersFromPhotcodesTable(interestedFilters) 114 115 # get a count of the available filters 116 filterCount = self.scratchDb.getCountOfFiltersFromPhotcodesTable() 117 118 self.logger.infoPair("Available filters in Photcodes", filters) 119 120 # the 'code' now defines the order in the cps file that the mags are listed for a given filter 121 self.logger.infoPair("Adding magnitudes from", "cps table") 122 for filter in filters: 123 124 filterID = self.scratchDb.getFilterID(filter[1]) 125 126 # NOTE: Manipulation of FLAGS from cpsTable is to move ID_SECF_OBJ_EXT flag (0x01000000) 127 # from bit 24 to bit 13 so that it fits into the SMALLINT Object.Flags 128 # XXX EAM : 20140724 this manipulation is no longer needed : [grizy]Flags is now 4 byte (was 8 byte!) 129 130 # set the MeanObject fields based largely on dvopsps cps fields: 131 132 # XXX EAM 20140724 : filterCount is meant to match 133 # Nsecfilt, but is potentially not determined correctly. 134 # use a call to a dvo-native command which knows how to 135 # find Nsecfilt (or save in the db with dvopsps) 136 137 # the math below depends on filterCount = Nsecfilt and MeanObject.row being 1 counting but cps being 0 counting? 138 # cps.row has a count of MeanObject.row * Nsecfilt + Nfilter 139 # " + cpsTable + " AS cps ON (cps.row = (MeanObject.row* " + str(filterCount) + ")-(" + str(filterCount) + " - " + str(filter[0]) + ")) \ 140 141 sql = "UPDATE MeanObject JOIN \ 142 " + cpsTable + " AS cps ON (cps.row = (MeanObject.row* " + str(filterCount) + ")-(" + str(filterCount) + " - " + str(filter[0]) + ")) \ 143 SET \ 144 MeanObject." + filter[1] + "QfPerfect = -999 \ 145 ,MeanObject." + filter[1] + "MeanPSFMag = MAG \ 146 ,MeanObject." + filter[1] + "MeanPSFMagErr = MAG_ERR \ 147 ,MeanObject." + filter[1] + "MeanPSFMagStd = MAG_STDEV \ 148 ,MeanObject." + filter[1] + "MeanPSFMagMin = MAG_MIN \ 149 ,MeanObject." + filter[1] + "MeanPSFMagMax = MAG_MAX \ 150 ,MeanObject." + filter[1] + "MeanPSFMagNpt = NUSED \ 151 ,MeanObject." + filter[1] + "MeanKronMag = MAG_KRON \ 152 ,MeanObject." + filter[1] + "MeanKronMagErr = MAG_KRON_ERR \ 153 ,MeanObject." + filter[1] + "MeanKronMagStd = MAG_KRON_STDEV \ 154 ,MeanObject." + filter[1] + "MeanKronMagNpt = NUSED_KRON \ 155 ,MeanObject." + filter[1] + "MeanApMag = MAG_AP \ 156 ,MeanObject." + filter[1] + "MeanApMagErr = MAG_AP_ERR \ 157 ,MeanObject." + filter[1] + "MeanApMagStd = MAG_AP_STDEV \ 158 ,MeanObject." + filter[1] + "MeanApMagNpt = NUSED_AP \ 159 ,MeanObject." + filter[1] + "Flags = (0x7fff & FLAGS) | ((FLAGS >> 11) & 0x2000) " 160 161 162 self.logger.info(sql) 163 self.scratchDb.execute(sql) 164 165 # now set to null all MeanMagErr values > 0.5 (cut set by Gene, 2012-04-12) 166 # XXX EAM 20140724 : keep this cut? 167 cut = 0.5 168 self.logger.infoPair("Setting to NULL all MeanMagErr value >", "%f" % cut) 169 for filter in filters: 170 171 sql = "UPDATE MeanObject \ 172 SET " + filter[1] + "MeanPSFMagErr = null \ 173 WHERE " + filter[1] + "MeanPSFMagErr > " + str(cut) 174 self.scratchDb.execute(sql) 175 176 ''' 177 Inserts stuff for all mags 178 ''' 179 def updateObjectThinFromCps(self, cpsTable): 111 180 112 181 # list of all filters PSPS is interested in … … 127 196 filterID = self.scratchDb.getFilterID(filter[1]) 128 197 129 # NOTE: Manipulation of FLAGS from cpsTable is to move ID_SECF_OBJ_EXT flag (0x01000000) 130 # from bit 24 to bit 13 so that it fits into the SMALLINT Object.Flags 131 132 sql = "UPDATE MeanObject JOIN \ 133 " + cpsTable + " AS cps ON (cps.row = (MeanObject.row* " + str(filterCount) + ")-(" + str(filterCount) + " - " + str(filter[0]) + ")) \ 134 SET \ 135 MeanObject." + filter[1] + "QfPerfect = -999 \ 136 ,MeanObject." + filter[1] + "MeanPSFMag = MAG \ 137 ,MeanObject." + filter[1] + "MeanPSFMagErr = MAG_ERR \ 138 ,MeanObject." + filter[1] + "MeanKronMag = MAG_KRON \ 139 ,MeanObject." + filter[1] + "MeanKronMagErr = MAG_KRON_ERR \ 140 ,MeanObject." + filter[1] + "nIncPSFMag = -999 \ 141 ,MeanObject." + filter[1] + "MeanPSFMagStd = -999 \ 142 ,MeanObject." + filter[1] + "MinPSFMag = -999 \ 143 ,MeanObject." + filter[1] + "MaxPSFMag = -999 \ 144 ,MeanObject." + filter[1] + "nIncKronMag = -999 \ 145 ,MeanObject." + filter[1] + "MeanKronMag = -999 \ 146 ,MeanObject." + filter[1] + "MeanKronMagStd = -999 \ 147 ,MeanObject." + filter[1] + "MeanApMag = MAG_AP \ 148 ,MeanObject." + filter[1] + "MeanApMagErr = MAG_ERR \ 149 ,MeanObject." + filter[1] + "MeanApMagStd = MAG_STDEV \ 150 ,MeanObject." + filter[1] + "nIncApMag = -999 \ 151 ,MeanObject." + filter[1] + "Flags = (0x7fff & FLAGS) | ((FLAGS >> 11) & 0x2000) " 152 153 154 self.logger.info(sql) 155 self.scratchDb.execute(sql) 156 157 # now set to null all MeanMagErr values > 0.5 (cut set by Gene, 2012-04-12) 158 cut = 0.5 159 self.logger.infoPair("Setting to NULL all MeanMagErr value >", "%f" % cut) 160 for filter in filters: 161 162 sql = "UPDATE MeanObject \ 163 SET " + filter[1] + "MeanPSFMagErr = null \ 164 WHERE " + filter[1] + "MeanPSFMagErr > " + str(cut) 165 self.scratchDb.execute(sql) 166 ''' 167 Inserts stuff for all mags 168 ''' 169 def updateObjectThinFromCps(self, cpsTable): 170 171 # list of all filters PSPS is interested in 172 interestedFilters = ['g', 'r', 'i', 'z', 'y'] 173 174 filters = self.scratchDb.getOrderedListOfFiltersFromPhotcodesTable(interestedFilters) 175 176 # get a count of the available filters 177 filterCount = self.scratchDb.getCountOfFiltersFromPhotcodesTable() 178 # filterCount = len(filters) 179 180 self.logger.infoPair("Available filters in Photcodes", filters) 181 182 # the 'code' now defines the order in the cps file that the mags are listed for a given filter 183 self.logger.infoPair("Adding magnitudes from", "cps table") 184 for filter in filters: 185 186 filterID = self.scratchDb.getFilterID(filter[1]) 187 188 # NOTE: Manipulation of FLAGS from cpsTable is to move ID_SECF_OBJ_EXT flag (0x01000000) 189 # from bit 24 to bit 13 so that it fits into the SMALLINT Object.Flags 190 198 # XXX EAM 20140724 : this is quite awkward, add a objRow and ncode value to mysql db table? 191 199 sql = "UPDATE ObjectThin JOIN \ 192 200 " + cpsTable + " AS cps ON (cps.row = (ObjectThin.row* " + str(filterCount) + ")-(" + str(filterCount) + " - " + str(filter[0]) + ")) \ … … 196 204 self.scratchDb.execute(sql) 197 205 206 # XXX this does not seem like a good thing to leave in SQL 198 207 self.logger.infoPair("Calculating nDetections from", "n[filters]") 199 208 for filter in filters: … … 203 212 WHERE n" + filter[1] + " != -999" 204 213 self.scratchDb.execute(sql) 205 206 207 214 208 215 ''' 209 216 give objectName to objectThin 217 XXX EAM 20140714 : This seems quite inefficient in SQL, move to dvopsps? 210 218 ''' 211 219 def updateObjName(self): … … 281 289 return False 282 290 283 284 285 286 287 288 289 291 ''' 290 292 Populates the Object table … … 296 298 297 299 if False: 300 # XXX EAM 20140724 : this is probably wrong : flux measurements can be 0.0 or negative: please review 298 301 self.logger.infoPair("setting to null > 1e-38 and < 1e-38 in", "cps FLUX_KRON_ERR") 299 302 sql = "UPDATE " + cpsTableName + " set FLUX_KRON_ERR = NULL where FLUX_KRON_ERR < 1e-37 AND FLUX_KRON_ERR > -1e-37 " 303 self.exitProgram("review this code" + sql) 300 304 301 305 try: … … 315 319 316 320 317 self.logger.infoPair("Populating", "ThinObject") 318 self.logger.infoPair("Inserting objects from", "cpt file") 319 320 # note `` around dec here, as this is a reserved word in MySQL 321 sql = "INSERT IGNORE INTO ObjectThin (\ 322 objID \ 323 ,gcobjID \ 324 ,ippObjID \ 325 ,surveyID \ 326 ,skyCellID \ 327 ,randomID \ 328 ,batchID \ 329 ,dvoRegionID \ 330 ,dataRelease \ 331 ,objInfoFlag \ 332 ,qualityFlag \ 333 ,consistencyFlag \ 334 ,raStack \ 335 ,decStack \ 336 ,raStackErr \ 337 ,decStackErr \ 338 ,raMean \ 339 ,decMean \ 340 ,raMeanErr \ 341 ,decMeanErr \ 342 ,raMeanStd \ 343 ,decMeanStd \ 344 ,nStackObjectRows \ 345 ,nStackDetections \ 346 ,nDetections \ 347 ) \ 348 SELECT \ 349 EXT_ID \ 350 , -999 \ 351 ,CAT_ID*1000000000 + OBJ_ID \ 352 ," + str(self.surveyID) + " \ 353 , -999 \ 354 , FLOOR(RAND()*9223372036854775807) \ 355 , " + str(self.batchID) + "\ 356 , -999 \ 357 , " + str(self.skychunk.dataRelease) + "\ 358 ,FLAGS \ 359 ,FLAGS >> 24 & 0xFF \ 360 , 0 \ 361 , -999 \ 362 , -999 \ 363 , -999 \ 364 , -999 \ 365 ,RA \ 366 ,DEC_ \ 367 ,RA_ERR \ 368 ,DEC_ERR \ 369 , -999 \ 370 , -999 \ 371 ,0 \ 372 ,0 \ 373 ,0 \ 374 FROM " + cptTableName 321 self.logger.info("Populating ThinObject") 322 self.logger.info("Inserting objects from cpt file") 323 324 # note "dec" is a reserved word in MySQL 325 # XXX EAM 20140724 : do not use INGORE unless we discover unavoidable problems... 326 # INSERT IGNORE INTO ObjectThin 327 328 sqlLine = sqlUtility("INSERT INTO ObjectThin (") 329 330 sqlLine.group("objID", "EXT_ID") 331 # sqlLine.group("gcobjID", "EXT_ID_GC") # drop this one? 332 sqlLine.group("ippObjID", "OBJ_ID + (CAT_ID << 32)") # NOTE: shift by 32 bits exactly 333 sqlLine.group("surveyID", str(self.surveyID)) 334 sqlLine.group("skyCellID", "-999") # XXX This does not make sense 335 sqlLine.group("randomID", "FLOOR(RAND()*9223372036854775807)") # XXX where does this number come from?? 336 sqlLine.group("batchID", str(self.batchID)) 337 sqlLine.group("dvoRegionID", "DVO_REGION") # XXX add to dvopsps output for cpt 338 sqlLine.group("dataRelease", str(self.skychunk.dataRelease)) 339 sqlLine.group("objInfoFlag", "FLAGS") 340 sqlLine.group("qualityFlag", "FLAGS >> 24 & 0xFF") 341 sqlLine.group("consistencyFlag", "0") 342 sqlLine.group("raStack", "RA_STK") 343 sqlLine.group("decStack", "DEC_STK") 344 sqlLine.group("raStackErr", "RA_STK_ERR") 345 sqlLine.group("decStackErr", "DEC_STK_ERR") 346 sqlLine.group("raMean", "RA_MEAN") 347 sqlLine.group("decMean", "DEC_MEAN") 348 sqlLine.group("raMeanErr", "RA_ERR") 349 sqlLine.group("decMeanErr", "DEC_ERR") 350 sqlLine.group("raMeanStd", "-999") # XXX I do not calculate this, use chisq? 351 sqlLine.group("decMeanStd", "-999") 352 sqlLine.group("nStackObjectRows", "0") # XXX I need to add / define this in dvopsps 353 sqlLine.group("nStackDetections", "0") 354 sqlLine.group("nDetections", "0") 355 sql = sqlLine.make(") SELECT ", " FROM " + cptTableName) 375 356 376 357 try: … … 390 371 self.updateObjName() 391 372 392 393 373 self.logger.infoPair("update ObjectThin from ","cps table") 394 374 395 375 self.updateObjectThinFromCps(cpsTableName) 396 376 377 # XXX EAM 20140724 : is this necessary?? 397 378 #objects can have out of range ra dec in dvo - need to find and kill them at the end 398 379 -
branches/eam_branches/ipp-20140717/ippToPsps/jython/queue.py
r36697 r37129 45 45 46 46 try: 47 print " why doesn't this work"47 print "does this work?" 48 48 self.dvoObjects = DvoObjects(self.logger, self.config, self.skychunk, self.ippToPspsDb, self.scratchDb) 49 49 except: -
branches/eam_branches/ipp-20140717/ippToPsps/jython/scratchdb.py
r35417 r37129 51 51 Sets whether we are using normal or pre-ingested DVO tables 52 52 ''' 53 def setUseFullTables(self, useFull): 54 55 if useFull: 56 self.dvoImagesTable = "dvoImagesFull" 57 self.dvoDetectionTable = "dvoDetectionFull" 58 else: 59 self.dvoImagesTable = "dvoImages" 60 self.dvoDetectionTable = "dvoDetection" 53 def setDvoTableNames(self): 54 55 self.dvoImagesTable = "dvoImagesFull" 56 self.dvoDetectionTable = "dvoDetectionFull" 61 57 62 58 self.logger.debugPair("Using DVO images table", self.dvoImagesTable) … … 233 229 def alreadyImportedThisDvoTable(self, path): 234 230 231 print "***** alreadyImportedThisDvoTable *****" 232 print "path: " + path 233 235 234 fileStat = os.stat(path) 235 print "path: " + path 236 236 237 237 sql = "SELECT COUNT(*) FROM " + self.dvoDoneTable + " WHERE path = '" + path + "' AND modifiedDate = " + str(fileStat.st_mtime) 238 239 try: 240 rs = self.executeQuery(sql) 238 print "sql: " + sql 239 240 try: 241 rs = self.executeQuery(sql) 242 print "ran sql: " + sql 241 243 rs.first() 242 244 if rs.getInt(1) > 0: 245 print "***** DID import previously *****" 243 246 self.logger.debugPair("Already imported up-to-date version of", path) 244 247 return True 245 248 else: 249 print "***** did NOT import previously *****" 246 250 return False 247 251 except: 252 print "***** exception in alreadyImportedThisDvoTable *****" 248 253 self.logger.exception("Unable to check whether this DVO table has been imported") 254 255 print "***** done with alreadyImportedThisDvoTable *****" 249 256 250 257 … … 322 329 ''' 323 330 def isCorrectDvo(self, path): 331 332 sql = "show tables" 333 try: 334 rs = self.executeQuery(sql) 335 haveDone = False 336 while (rs.next()): 337 tableName = rs.getString(1) 338 # print "table: " + tableName 339 if tableName == self.dvoDoneTable: 340 haveDone = True 341 342 rs.close() 343 if not haveDone: 344 print "dvoDone not yet build" 345 return False 346 except: 347 print "failed to run query: " + sql 324 348 325 349 sql = "SELECT path FROM " + self.dvoDoneTable + " WHERE path LIKE '%SkyTable.fits'" … … 415 439 416 440 dvoImagesTable = "dvoImages" 417 dvoDetectionTable = "dvoDetection s"441 dvoDetectionTable = "dvoDetection" 418 442 419 443 # drop and create Images table 420 self.logger. debugPair("Creating DVO table", dvoImagesTable)444 self.logger.infoPair("Creating DVO table", dvoImagesTable) 421 445 sql = "DROP TABLE " + dvoImagesTable 422 446 … … 438 462 439 463 # now detection table 440 self.logger. debugPair("Creating DVO table", dvoDetectionTable)464 self.logger.infoPair("Dropping DVO table", dvoDetectionTable) 441 465 sql = "DROP TABLE " + dvoDetectionTable 442 466 try: self.execute(sql) 443 except: pass 444 445 self.logger.debugPair("Creating DVO table", "dvoDetection") 467 except: 468 print "problem dropping DVO " + dvoDetectionTable 469 pass 470 471 self.logger.infoPair("Creating DVO table", "dvoDetection") 446 472 sql = "CREATE TABLE dvoDetection ( \ 447 imageID INT, \ 448 ippDetectID BIGINT, \ 473 objID BIGINT, \ 449 474 detectID BIGINT, \ 450 475 ippObjID BIGINT, \ 451 objID BIGINT, \ 452 flags INT, \ 453 zp FLOAT, \ 454 zpErr FLOAT, \ 455 airMass FLOAT, \ 456 expTime FLOAT, \ 476 ippDetectID BIGINT, \ 477 imageID INT, \ 457 478 ra DOUBLE, \ 458 479 dec_ DOUBLE, \ 459 480 raErr FLOAT, \ 460 481 decErr FLOAT, \ 482 zp FLOAT, \ 483 telluricExt FLOAT, \ 484 airmass FLOAT, \ 485 expTime FLOAT, \ 486 flags INT, \ 461 487 PRIMARY KEY (imageID, ippDetectID), \ 462 488 KEY (objID, detectID) \ … … 466 492 except: 467 493 self.logger.error("Unable to create DVO detection database table") 494 self.sys.exit(1) 468 495 469 496 # XXX EAM : for the parallel mode, dvoDetection requires duplicate objID values! … … 550 577 self.logger.infoPair("Dropping table", self.dvoSkyTable) 551 578 self.dropTable(self.dvoSkyTable) 552 self.logger.infoPair("Dropping table", self.dvoDetectionTable)553 self.dropTable(self.dvoDetectionTable)554 579 self.logger.infoPair("Dropping table", self.dvoDoneTable) 555 580 self.dropTable(self.dvoDoneTable) 581 582 # blow away existing dvoDetection table & re-crate 583 if not self.resetDvoDetectionTable(): 584 self.logger.errorPair("Unable to reset scratch table", "DvoDetectionFull") 585 return False 556 586 557 587 # create dvoDone table … … 564 594 565 595 self.changeEngineToInnoDB(self.dvoDoneTable) 566 567 # blow away existing dvoDetection table & re-crate568 if not self.resetDvoDetectionTable():569 self.logger.errorPair("Unable to reset scratch table", "DvoDetectionFull")570 return False571 596 572 597 return True -
branches/eam_branches/ipp-20140717/ippToPsps/jython/stackbatch.py
r36744 r37129 39 39 scratchDb, 40 40 skyID, 41 batchID, 42 useFullTables): 41 batchID): 43 42 44 43 super(StackBatch, self).__init__( … … 52 51 batchID, 53 52 "ST", 54 "", 55 #gpc1Db.getStackStageCmf(skychunk.dvoLabel, stackID), 56 useFullTables) 57 58 # self.printline = 0 59 # # self.testprint() 60 # self.logger.infoPair("did I get", "here"); 53 None) 54 61 55 self.stackType = "DEEP_STACK" # TODO 62 56 ## = stuff I commented out for pv2 stacks … … 215 209 self.scratchDb.dropTable("StackObject") 216 210 self.logger.infoPair("dropping table:","StackModelFit") 217 211 self.scratchDb.dropTable("SkinnyObject") 218 212 self.scratchDb.dropTable("StackModelFit") 219 213 self.logger.infoPair("dropping table:","StackApFlx") … … 262 256 # insert what we know about this stack batch into the stack table 263 257 self.ippToPspsDb.insertStackMeta(self.batchID, "x" , self.stackType) 264 265 # insert sourceID/imageID combo so DVO can look it up266 ##if not self.useFullTables:267 ## self.scratchDb.insertNewDvoExternID(self.header['SOURCEID'], self.header['IMAGEID'])268 269 # self.testprint()270 258 271 259 # dump stuff to log … … 785 773 self.logger.infoPair("Deleting", "entries with StackObject.objID = 0") 786 774 # response = raw_input("deleted objID is 0 ") 787 775 ''' 776 Populates the SkinnyObject table 777 ''' 778 def populateSkinnyObject(self): 779 780 self.logger.infoPair("Procesing table", "SkinnyObject") 781 782 sql = "INSERT INTO SkinnyObject (\ 783 objID \ 784 ,ippObjID \ 785 ,projectionCellID \ 786 ) \ 787 SELECT \ 788 DISTINCT objID \ 789 ,ippObjID \ 790 ,projectionCellID \ 791 FROM StackDetection" 792 self.scratchDb.execute(sql) 793 794 self.scratchDb.updateAllRows("SkinnyObject", "surveyID", str(self.surveyID)) 795 self.scratchDb.updateAllRows("SkinnyObject", "dataRelease", str(self.skychunk.dataRelease)) 796 788 797 789 798 ''' … … 1189 1198 self.logger.infoPair("starting","populatePspsTables"); 1190 1199 self.skipBatch = False 1191 if not self.useFullTables: 1192 if not self.getIDsFromDVO(): 1193 return False 1194 #do some basics first 1200 1201 # get the IDs from the DVO tables 1202 if not self.getIDsFromDVO(): 1203 return False 1204 1205 # do some basics first: 1195 1206 # populate stack meta per filter 1196 1207 # insert objid/stackdetectid per filter to each table … … 1307 1318 1308 1319 ##if self.totalDetections < 1: 1320 #self.logger.infoPair("populating","SkinnyObject") 1321 self.populateSkinnyObject() 1309 1322 1310 1323 ##self.logger.error("No detections to publish") … … 1314 1327 self.tablesToExport.append("StackModelFit") 1315 1328 self.tablesToExport.append("StackApFlx") 1316 1329 self.tablesToExport.append("SkinnyObject") 1317 1330 self.logger.infoPair("finishing","populatePspsTables"); 1318 1331 return True -
branches/eam_branches/ipp-20140717/ippToPsps/test/fulltest.sh
r35456 r37129 171 171 endif 172 172 173 # `name`174 # `datastore_product`175 # `datastore_type`176 # `datastore_publish`177 # `dvo_label`178 # `dvo_location`179 # `min_ra`180 # `max_ra`181 # `min_dec`182 # `max_dec`183 # `box_size`184 # `base_path`185 # `data_release`186 # `delete_local`187 # `delete_datastore`188 # `delete_dxlayer`189 # `epoch`190 # `survey`191 # `psps_survey`192 # `queue_P2`193 # `queue_ST`194 # `queue_OB`195 # `active`196 # `parallel`197 198 173 # this is poor : we need to queue something in order to generate an init batch 199 174 # this is because a skychunk carries the info about the datastore used to publish … … 203 178 echo " ---- make skychunk for IN batches ----" 204 179 205 ippjython queue.py -test edit <<EOF 206 initbatch 207 test_ds 208 IPP_PSPS 209 0 210 none 211 none 212 0 213 0 214 0 215 0 216 2 217 none 218 0 219 0 220 1 221 1 222 2012-12-10 00:00:00.0 223 3PI 224 3PI 225 0 226 0 227 0 228 1 229 0 230 y 231 y 232 EOF 180 echo "initbatch " > initbatch.dat # skychunk name 181 echo "test_ds " >> initbatch.dat # datastore_product 182 echo "IPP_PSPS " >> initbatch.dat # datastore_type 183 echo "0 " >> initbatch.dat # datastore_publish 184 echo "none " >> initbatch.dat # dvo_label 185 echo "none " >> initbatch.dat # dvo_location 186 echo "0 " >> initbatch.dat # min_ra 187 echo "0 " >> initbatch.dat # max_ra 188 echo "0 " >> initbatch.dat # min_dec 189 echo "0 " >> initbatch.dat # max_dec 190 echo "2 " >> initbatch.dat # box_size 191 echo "none " >> initbatch.dat # base_path 192 echo "0 " >> initbatch.dat # data_release 193 echo "0 " >> initbatch.dat # delete_local 194 echo "1 " >> initbatch.dat # delete_datastore 195 echo "1 " >> initbatch.dat # delete_dxlayer 196 echo "2012-12-10 00:00:00.0 " >> initbatch.dat # epoch 197 echo "3PI " >> initbatch.dat # survey 198 echo "3PI " >> initbatch.dat # psps_survey 199 echo "0 " >> initbatch.dat # queue_P2 200 echo "0 " >> initbatch.dat # queue_ST 201 echo "0 " >> initbatch.dat # queue_OB 202 echo "0 " >> initbatch.dat # queue_DF 203 echo "0 " >> initbatch.dat # queue_DO 204 echo "0 " >> initbatch.dat # queue_FW 205 echo "0 " >> initbatch.dat # queue_FO 206 echo "1 " >> initbatch.dat # active 207 echo "0 " >> initbatch.dat # parallel 208 echo "use_new " >> initbatch.dat # P2_smf_version 209 echo "any " >> initbatch.dat # ST_cmf_version 210 echo "2000-01-01 00:00:00.0 " >> initbatch.dat # trange_start 211 echo "2020-01-01 00:00:00.0 " >> initbatch.dat # trange_end 212 cat initbatch.dat | ippjython queue.py -test edit 233 213 234 214 echo "" … … 244 224 echo " ---- queue P2 batches ----" 245 225 246 ippjython queue.py -test edit <<EOF 247 $queuename 248 test_ds 249 IPP_PSPS 250 0 251 catdir.cam 252 $OUTDIR/catdir.cam 253 9 254 11 255 19 256 21 257 2 258 $OUTDIR 259 0 260 0 261 1 262 1 263 2012-12-10 00:00:00.0 264 3PI 265 3PI 266 1 267 0 268 0 269 1 270 0 271 y 272 y 273 EOF 226 echo "$queuename " > cambatch.dat # skychunk name 227 echo "test_ds " >> cambatch.dat # datastore_product 228 echo "IPP_PSPS " >> cambatch.dat # datastore_type 229 echo "0 " >> cambatch.dat # datastore_publish 230 echo "catdir.cam " >> cambatch.dat # dvo_label 231 echo "$OUTDIR/catdir.cam " >> cambatch.dat # dvo_location 232 echo "9 " >> cambatch.dat # min_ra 233 echo "11 " >> cambatch.dat # max_ra 234 echo "19 " >> cambatch.dat # min_dec 235 echo "21 " >> cambatch.dat # max_dec 236 echo "2 " >> cambatch.dat # box_size 237 echo "$OUTDIR " >> cambatch.dat # base_path 238 echo "0 " >> cambatch.dat # data_release 239 echo "0 " >> cambatch.dat # delete_local 240 echo "1 " >> cambatch.dat # delete_datastore 241 echo "1 " >> cambatch.dat # delete_dxlayer 242 echo "2012-12-10 00:00:00.0 " >> cambatch.dat # epoch 243 echo "3PI " >> cambatch.dat # survey 244 echo "3PI " >> cambatch.dat # psps_survey 245 echo "1 " >> cambatch.dat # queue_P2 246 echo "0 " >> cambatch.dat # queue_ST 247 echo "0 " >> cambatch.dat # queue_OB 248 echo "0 " >> cambatch.dat # queue_DF 249 echo "0 " >> cambatch.dat # queue_DO 250 echo "0 " >> cambatch.dat # queue_FW 251 echo "0 " >> cambatch.dat # queue_FO 252 echo "1 " >> cambatch.dat # active 253 echo "0 " >> cambatch.dat # parallel 254 echo "use_new " >> cambatch.dat # P2_smf_version 255 echo "any " >> cambatch.dat # ST_cmf_version 256 echo "2000-01-01 00:00:00.0 " >> cambatch.dat # trange_start 257 echo "2020-01-01 00:00:00.0 " >> cambatch.dat # trange_end 258 cat cambatch.dat | ippjython queue.py -test edit 274 259 endif 275 260 … … 290 275 set stackqueuename = $queuename\_stk 291 276 endif 292 ippjython queue.py -test edit <<EOF 293 $stackqueuename 294 test_ds 295 IPP_PSPS 296 0 297 catdir.stk 298 $OUTDIR/catdir.stk 299 9 300 11 301 19 302 21 303 2 304 $OUTDIR 305 0 306 0 307 1 308 1 309 2012-12-10 00:00:00.0 310 3PI 311 3PI 312 0 313 1 314 0 315 1 316 0 317 y 318 y 319 EOF 277 echo "$stackqueuename " > stackbatch.dat # skychunk name 278 echo "test_ds " >> stackbatch.dat # datastore_product 279 echo "IPP_PSPS " >> stackbatch.dat # datastore_type 280 echo "0 " >> stackbatch.dat # datastore_publish 281 echo "catdir.stk " >> stackbatch.dat # dvo_label 282 echo "$OUTDIR/catdir.stk " >> stackbatch.dat # dvo_location 283 echo "9 " >> stackbatch.dat # min_ra 284 echo "11 " >> stackbatch.dat # max_ra 285 echo "19 " >> stackbatch.dat # min_dec 286 echo "21 " >> stackbatch.dat # max_dec 287 echo "2 " >> stackbatch.dat # box_size 288 echo "$OUTDIR " >> stackbatch.dat # base_path 289 echo "0 " >> stackbatch.dat # data_release 290 echo "0 " >> stackbatch.dat # delete_local 291 echo "1 " >> stackbatch.dat # delete_datastore 292 echo "1 " >> stackbatch.dat # delete_dxlayer 293 echo "2012-12-10 00:00:00.0 " >> stackbatch.dat # epoch 294 echo "3PI " >> stackbatch.dat # survey 295 echo "3PI " >> stackbatch.dat # psps_survey 296 echo "0 " >> stackbatch.dat # queue_P2 297 echo "1 " >> stackbatch.dat # queue_ST 298 echo "0 " >> stackbatch.dat # queue_OB 299 echo "0 " >> stackbatch.dat # queue_DF 300 echo "0 " >> stackbatch.dat # queue_DO 301 echo "0 " >> stackbatch.dat # queue_FW 302 echo "0 " >> stackbatch.dat # queue_FO 303 echo "1 " >> stackbatch.dat # active 304 echo "0 " >> stackbatch.dat # parallel 305 echo "use_new " >> stackbatch.dat # P2_smf_version 306 echo "any " >> stackbatch.dat # ST_cmf_version 307 echo "2000-01-01 00:00:00.0 " >> stackbatch.dat # trange_start 308 echo "2020-01-01 00:00:00.0 " >> stackbatch.dat # trange_end 309 cat stackbatch.dat | ippjython queue.py -test edit 320 310 endif 321 311 … … 339 329 set objectqueuename = $queuename\_obj 340 330 endif 341 ippjython queue.py -test edit <<EOF 342 $objectqueuename 343 test_ds 344 IPP_PSPS 345 0 346 catdir.stk 347 $OUTDIR/catdir.stk 348 9 349 11 350 19 351 21 352 2 353 $OUTDIR 354 0 355 0 356 1 357 1 358 2012-12-10 00:00:00.0 359 3PI 360 3PI 361 0 362 0 363 1 364 1 365 0 366 y 367 y 368 EOF 331 echo "$objectqueuename " > objectbatch.dat # skychunk name 332 echo "test_ds " >> objectbatch.dat # datastore_product 333 echo "IPP_PSPS " >> objectbatch.dat # datastore_type 334 echo "0 " >> objectbatch.dat # datastore_publish 335 echo "catdir.cam " >> objectbatch.dat # dvo_label 336 echo "$OUTDIR/catdir.cam " >> objectbatch.dat # dvo_location 337 echo "9 " >> objectbatch.dat # min_ra 338 echo "11 " >> objectbatch.dat # max_ra 339 echo "19 " >> objectbatch.dat # min_dec 340 echo "21 " >> objectbatch.dat # max_dec 341 echo "2 " >> objectbatch.dat # box_size 342 echo "$OUTDIR " >> objectbatch.dat # base_path 343 echo "0 " >> objectbatch.dat # data_release 344 echo "0 " >> objectbatch.dat # delete_local 345 echo "1 " >> objectbatch.dat # delete_datastore 346 echo "1 " >> objectbatch.dat # delete_dxlayer 347 echo "2012-12-10 00:00:00.0 " >> objectbatch.dat # epoch 348 echo "3PI " >> objectbatch.dat # survey 349 echo "3PI " >> objectbatch.dat # psps_survey 350 echo "0 " >> objectbatch.dat # queue_P2 351 echo "0 " >> objectbatch.dat # queue_ST 352 echo "1 " >> objectbatch.dat # queue_OB 353 echo "0 " >> objectbatch.dat # queue_DF 354 echo "0 " >> objectbatch.dat # queue_DO 355 echo "0 " >> objectbatch.dat # queue_FW 356 echo "0 " >> objectbatch.dat # queue_FO 357 echo "1 " >> objectbatch.dat # active 358 echo "0 " >> objectbatch.dat # parallel 359 echo "use_new " >> objectbatch.dat # P2_smf_version 360 echo "any " >> objectbatch.dat # ST_cmf_version 361 echo "2000-01-01 00:00:00.0 " >> objectbatch.dat # trange_start 362 echo "2020-01-01 00:00:00.0 " >> objectbatch.dat # trange_end 363 cat objectbatch.dat | ippjython queue.py -test edit once 369 364 endif 370 365 -
branches/eam_branches/ipp-20140717/ippToPsps/test/mkgpc1data.dvo
r35753 r37129 39 39 # mkcatdir.cam PS1_V3 PS1_V4 40 40 # mkcatdir.stk PS1_V3 PS1_V4 41 mkcatdir.cam PS1_V4 PS1_V4 42 mkcatdir.stk PS1_V4 PS1_V4 41 # mkcatdir.cam PS1_V4 PS1_V4 42 # mkcatdir.stk PS1_V4 PS1_V4 43 mkcatdir.cam PS1_V5 PS1_V5 44 mkcatdir.stk PS1_V5 PS1_V5 43 45 insert.stack.set 44 46 end … … 203 205 end 204 206 205 if ( $i == 5)207 if (0 && ($i == 5)) 206 208 echo "NOTE: adding image $i 2x to DVO, but without detections : this simulates a failure in LAP dvo" 207 209 208 echo addstar -D CATDIR $catdir -D CAMERA simtest $cmffile -D CATFORMAT $2 -quick-airmass -image -dup-images209 exec addstar -D CATDIR $catdir -D CAMERA simtest $cmffile -D CATFORMAT $2 -quick-airmass -image -dup-images210 echo addstar -D SKY_DEPTH 4 -D CATDIR $catdir -D CAMERA simtest $cmffile -D CATFORMAT $2 -quick-airmass -image -dup-images 211 exec addstar -D SKY_DEPTH 4 -D CATDIR $catdir -D CAMERA simtest $cmffile -D CATFORMAT $2 -quick-airmass -image -dup-images 210 212 end 211 213 212 if ( $i == 7)214 if (0 && ($i == 7)) 213 215 echo "NOTE: adding detections from image $i 2x to DVO, but with wrong photcode and duplicate image ID : this simulates a failure in LAP dvo" 214 echo addstar -D CATDIR $catdir -D CAMERA simtest $cmffile -D CATFORMAT $2 -quick-airmass -dup-images -image-id-override 7 -photcode 2MASS_J215 exec addstar -D CATDIR $catdir -D CAMERA simtest $cmffile -D CATFORMAT $2 -quick-airmass -dup-images -image-id-override 7 -photcode 2MASS_J216 echo addstar -D SKY_DEPTH 4 -D CATDIR $catdir -D CAMERA simtest $cmffile -D CATFORMAT $2 -quick-airmass -dup-images -image-id-override 7 -photcode 2MASS_J 217 exec addstar -D SKY_DEPTH 4 -D CATDIR $catdir -D CAMERA simtest $cmffile -D CATFORMAT $2 -quick-airmass -dup-images -image-id-override 7 -photcode 2MASS_J 216 218 end 217 219 218 echo addstar -D CATDIR $catdir -D CAMERA simtest $cmffile -D CATFORMAT $2 -quick-airmass 219 exec addstar -D CATDIR $catdir -D CAMERA simtest $cmffile -D CATFORMAT $2 -quick-airmass 220 end 220 echo addstar -D SKY_DEPTH 4 -D CATDIR $catdir -D CAMERA simtest $cmffile -D CATFORMAT $2 -quick-airmass 221 exec addstar -D SKY_DEPTH 4 -D CATDIR $catdir -D CAMERA simtest $cmffile -D CATFORMAT $2 -quick-airmass 222 end 223 224 echo relphot -D CATDIR $catdir -region 8 12 18 22 -images g,r,i,z,y -update 225 exec relphot -D CATDIR $catdir -region 8 12 18 22 -images g,r,i,z,y -update 221 226 222 227 if ($PARALLEL) … … 264 269 $offset = $word:2 265 270 271 ## this is not generating photcodes recognized as stack by relphot 272 266 273 mkinput $offset $rawfile 267 274 exec mkcmf $rawfile $cmffile -extname SkyChip -date 2008/1/1 -time $i\:00:00 -radec $RA $DEC -type $1 -imageID $ID -sourceID 1 … … 271 278 exec fits_insert $cmffile tmp.hdr 272 279 273 exec addstar -D CATDIR $catdir -D CAMERA simtest $cmffile -D CATFORMAT $2 -quick-airmass 274 end 280 echo addstar -D SKY_DEPTH 4 -D CATDIR $catdir -D CAMERA simtest $cmffile -D CATFORMAT $2 -quick-airmass 281 exec addstar -D SKY_DEPTH 4 -D CATDIR $catdir -D CAMERA simtest $cmffile -D CATFORMAT $2 -quick-airmass 282 end 283 284 echo relphot -D CATDIR $catdir.stk -region 8 12 18 22 -images g,r,i,z,y -update 285 exec relphot -D CATDIR $catdir.stk -region 8 12 18 22 -images g,r,i,z,y -update 275 286 276 287 if ($PARALLEL)
Note:
See TracChangeset
for help on using the changeset viewer.
