Changeset 39007
- Timestamp:
- Oct 29, 2015, 4:10:00 PM (11 years ago)
- Location:
- trunk/ippToPsps/jython
- Files:
-
- 1 added
- 6 edited
-
Makefile.am (modified) (1 diff)
-
dvodetections.py (modified) (2 diffs)
-
dvoforceddetections.py (modified) (2 diffs)
-
dvoforcedgalaxy.py (added)
-
dvoforcedobjects.py (modified) (1 diff)
-
forcedgalaxybatch.py (modified) (10 diffs)
-
forcedobjectbatch.py (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/Makefile.am
r38969 r39007 17 17 dvoforceddetections.py \ 18 18 dvoforcedobjects.py \ 19 dvoforcedgalaxy.py \ 19 20 dvoobjects.py \ 20 21 dvo.py \ -
trunk/ippToPsps/jython/dvodetections.py
r38883 r39007 14 14 ''' 15 15 A class for ingesting DVO detections into MySQL 16 XXX EAM 20151029 : I do not believe this class is used at all. I am poisoning it with an exit 16 17 ''' 17 18 class DvoDetections(Dvo): … … 21 22 ''' 22 23 def __init__(self, logger, config, skychunk, ippToPspsDb, scratchDb, gpc1Db): 23 # def __init__(self, logger, config, skychunk, ippToPspsDb, scratchDb): 24 24 25 25 super(DvoDetections, self).__init__(logger, config, skychunk, ippToPspsDb, scratchDb, gpc1Db) 26 # super(DvoDetections, self).__init__(logger, config, skychunk, ippToPspsDb, scratchDb) 26 print "----- DvoDetections is not used, is it?? -----" 27 os._exit(1) 27 28 28 29 # declare DVO file types of interest -
trunk/ippToPsps/jython/dvoforceddetections.py
r38883 r39007 14 14 ''' 15 15 A class for ingesting DVO detections into MySQL 16 XXX EAM 20151029 : I do not believe this class is used at all. I am poisoning it with an exit 16 17 ''' 17 18 class DvoForcedDetections(Dvo): … … 21 22 ''' 22 23 def __init__(self, logger, config, skychunk, ippToPspsDb, scratchDb, gpc1Db): 23 # def __init__(self, logger, config, skychunk, ippToPspsDb, scratchDb):24 24 25 25 super(DvoForcedDetections, self).__init__(logger, config, skychunk, ippToPspsDb, scratchDb, gpc1Db) 26 # super(DvoForcedDetections, self).__init__(logger, config, skychunk, ippToPspsDb, scratchDb) 26 print "----- DvoDetections is not used, is it?? -----" 27 os._exit(1) 27 28 28 29 # declare DVO file types of interest -
trunk/ippToPsps/jython/dvoforcedobjects.py
r38883 r39007 21 21 ''' 22 22 def __init__(self, logger, config, skychunk, ippToPspsDb, scratchDb, gpc1Db): 23 # def __init__(self, logger, config, skychunk, ippToPspsDb, scratchDb):24 23 25 24 super(DvoForcedObjects, self).__init__(logger, config, skychunk, ippToPspsDb, scratchDb, gpc1Db) 26 # super(DvoForcedObjects, self).__init__(logger, config, skychunk, ippToPspsDb, scratchDb)27 25 28 26 # declare DVO file types of interest 29 self.ingestFileTypes = ['cpt', 'cps', 'cpy']30 27 self.loadPhotcodes() 31 28 -
trunk/ippToPsps/jython/forcedgalaxybatch.py
r38965 r39007 70 70 self.logger.infoPair("DVO INDEX", "%d" % self.id) 71 71 72 73 72 ''' 74 73 Overriden from batch base class to import directly from DVO for forced galaxy shape parameters … … 109 108 return True 110 109 111 112 110 ''' 113 111 Applies indexes to the IPP Tables … … 120 118 ''' 121 119 def updatePspsUniqueIDs(self): 122 sql = "UPDATE ForcedGalaxyShape set uniquePspspFGid = (("+str(self.batchID)+"*1000000000 ) + row)" 123 try: self.scratchDb.execute(sql) 124 except: 125 self.logger.errorPair('failed sql', sql) 126 raise 120 sql = "UPDATE ForcedGalaxyShape set uniquePspsFGid = (("+str(self.batchID)+"*1000000000 ) + row)" 121 self.scratchDb.execute(sql) 127 122 128 123 ''' … … 145 140 146 141 # This is going to need to join elsewhere to get all the fields? 147 # XippDetectID, XforcedSummaryID 148 # Ra, Dec, RaErr, DecErr 149 150 # This won't work, as we need to join on modeltype/obj_id/filter 151 # + cpqTable + " AS cpq ON (cpq.row = (ForcedGalaxyShape.row* " + str(filterCount) + ")-(" + str(filterCount) + " - " + str(filter[0]) + ")) " \ 152 # + " ForcedGalaxyShape." + filter[1] + "GalModelType = MODEL_TYPE," \ 153 142 # XforcedSummaryID, Ra, Dec, RaErr, DecErr 154 143 # Should GalChiSq fold in Npix somehow? 155 # sql = "UPDATE ForcedGalaxyShape JOIN " \156 # + cpqTable + " AS cpq ON (cpq.row = (ForcedGalaxyShape.row* " + str(filterCount) + ")-(" + str(filterCount) + " - " + str(filter[0]) + ")) " \157 # + " SET " + \158 # + " ForcedGalaxyShape." + filter[1] + "ippDetectID = DET_ID," \159 # + " ForcedGalaxyShape." + filter[1] + "forcedSummaryID = IMAGE_ID," \160 # + " ForcedGalaxyShape." + filter[1] + "GalMajor = MAJOR_AXIS," \161 # + " ForcedGalaxyShape." + filter[1] + "GalMajorErr = MAJOR_AXIS_ERR," \162 # + " ForcedGalaxyShape." + filter[1] + "GalMinor = MINOR_AXIS," \163 # + " ForcedGalaxyShape." + filter[1] + "GalMinorErr = MINOR_AXIS_ERR," \164 # + " ForcedGalaxyShape." + filter[1] + "GalMag = MAG," \165 # + " ForcedGalaxyShape." + filter[1] + "GalMagErr = MAG_ERR," \166 # + " ForcedGalaxyShape." + filter[1] + "GalRa = RA," \167 # + " ForcedGalaxyShape." + filter[1] + "GalDec = DEC," \168 # + " ForcedGalaxyShape." + filter[1] + "GalRaErr = RA_ERR," \169 # + " ForcedGalaxyShape." + filter[1] + "GalDecErr = DEC_ERR," \170 # + " ForcedGalaxyShape." + filter[1] + "GalChisq = CHISQ "171 144 172 145 sqlLine = sqlUtility("UPDATE ForcedGalaxyShape AS a, " + cpqTable + " AS b SET") … … 179 152 sqlLine.group("a." + filter[1] + "GalMag", "b.MAG") 180 153 sqlLine.group("a." + filter[1] + "GalMagErr", "b.MAG_ERR") 181 # These fields don't exist.182 # sqlLine.group("a." + filter[1] + "GalRa", "b.RA")183 # sqlLine.group("a." + filter[1] + "GalDec", "b.DEC")184 # sqlLine.group("a." + filter[1] + "GalRaErr", "b.RA_ERR")185 # sqlLine.group("a." + filter[1] + "GalDecErr", "b.DEC_ERR")186 154 sqlLine.group("a." + filter[1] + "GalChisq", "b.CHISQ") 155 156 # These fields don't exist. 157 # sqlLine.group("a." + filter[1] + "GalRa", "b.RA") 158 # sqlLine.group("a." + filter[1] + "GalDec", "b.DEC") 159 # sqlLine.group("a." + filter[1] + "GalRaErr", "b.RA_ERR") 160 # sqlLine.group("a." + filter[1] + "GalDecErr", "b.DEC_ERR") 161 187 162 sql = sqlLine.makeEquals("WHERE a.objID = b.OBJ_ID AND a.galModelType = b.MODEL_TYPE AND b.Photcode = " + photcode) 188 189 190 try: self.scratchDb.execute(sql) 191 except: 192 self.logger.errorPair("failed update ForcedGalaxyShape", sql) 193 raise 194 195 196 197 198 ''' 199 Populate ForcedGalaxyShape table 163 164 self.scratchDb.execute(sql) 165 166 ''' 167 Populate ForcedGalaxyShape table with basic IDs 200 168 ''' 201 169 def populateForcedGalaxyShapeTable(self): … … 212 180 # uniquePspsFGid is set elsewhere 213 181 sqlLine.group("ippObjID", "OBJ_ID + (CAT_ID << 32)") 214 # batchID isn't in the schema .215 #sqlLine.group("batchID", "'" + str(self.batchID) + "'")182 # batchID isn't in the schema, should it be? 183 # sqlLine.group("batchID", "'" + str(self.batchID) + "'") 216 184 # surveyID is set where? 217 185 sqlLine.group("randomForcedGalID", "RAND("+str(self.batchID)+")") … … 219 187 sql = sqlLine.makeRaw(") SELECT ", " FROM " + cptTableName) 220 188 221 try: 222 self.scratchDb.execute(sql) 223 except: 224 self.logger.errorPair("Couldn't populate Forced Galaxy table from cpt", sql) 225 raise 189 self.scratchDb.execute(sql) 226 190 227 191 self.logger.infoPair("Adding 'row' columns to", "Forced Galaxy, cpt tables") … … 234 198 self.logger.infoPair("update ForcedGalaxyShape from ","cpq table") 235 199 self.updateForcedGalaxyShapeFromCpq(cpqTableName) 236 237 200 238 201 self.logger.infoPair("Dropping row column from ", "ForcedGalaxyShape table") … … 242 205 self.setMinMaxObjID(["ForcedGalaxyShape"]) 243 206 self.logger.infoPair("checking if we have detections", "ForcedGalaxyShape table") 207 244 208 rowcount = self.scratchDb.getRowCount("ForcedGalaxyShape") 209 245 210 if rowcount == 0: 246 211 self.logger.infoPair("skipping this one", "ForcedGalaxyShape") … … 256 221 257 222 if not self.populateForcedGalaxyShapeTable(): return False 258 259 # My example is removing objID duplicates. Since ForcedGalaxyShape can have multiple models for a given object, I'm not doing that.260 -
trunk/ippToPsps/jython/forcedobjectbatch.py
r38884 r39007 114 114 return True 115 115 116 117 116 ''' 118 117 Updates table and generates pspsuniqueids … … 125 124 self.logger.errorPair('failed sql',sql) 126 125 raise 127 128 129 130 126 131 127 ''' … … 195 191 SET " + filter[1] + "PSFMagErr = null \ 196 192 WHERE " + filter[1] + "PSFMagErr > " + str(cut) 197 # taking out the cut since this is for mag, not flux 198 199 # try: self.scratchDb.execute(sql) 200 # except: 201 # self.logger.errorPair("failed setting null meanmagerr","ForcedMeanObject") 202 # raise 193 194 # NOTE: taking out the cut since this is for mag, not flux 195 # try: self.scratchDb.execute(sql) 196 # except: 197 # self.logger.errorPair("failed setting null meanmagerr","ForcedMeanObject") 198 # raise 199 203 200 self.logger.infoPair("Calculating nDetections from", "n[filters]") 204 201 for filter in filters: … … 275 272 " + cpyTable + " AS cpy ON (cpy.row = (ForcedMeanLensing.row* " + str(filterCount) + ")-(" + str(filterCount) + " - " + str(filter[0]) + ")) \ 276 273 SET \ 277 ForcedMeanLensing." + filter[1] + "LensObjSmearX11 = X11_SM_OBJ \274 ForcedMeanLensing." + filter[1] + "LensObjSmearX11 = X11_SM_OBJ \ 278 275 ,ForcedMeanLensing." + filter[1] + "LensObjSmearX12 = X12_SM_OBJ \ 279 276 ,ForcedMeanLensing." + filter[1] + "LensObjSmearX22 = X22_SM_OBJ \ … … 321 318 sqlLine = sqlUtility("INSERT INTO ForcedMeanObject (") 322 319 323 sqlLine.group("objID", "EXT_ID") 324 sqlLine.group("ippObjID", "OBJ_ID + (CAT_ID << 32)") # NOTE: shift by 32 bits exactly 325 sqlLine.group("batchID", "'" + str(self.batchID) + "'") 326 sqlLine.group("randomForcedObjID", "RAND("+str(self.batchID)+")") 327 sqlLine.group("nDetections", "'0'") 328 sqlLine.group("processingVersion", str(self.skychunk.processingVersion)) 320 sqlLine.group("objID", "EXT_ID") 321 sqlLine.group("ippObjID", "OBJ_ID + (CAT_ID << 32)") # NOTE: shift by 32 bits exactly 322 sqlLine.group("batchID", "'" + str(self.batchID) + "'") 323 sqlLine.group("randomForcedObjID", "RAND("+str(self.batchID)+")") 324 sqlLine.group("nDetections", "'0'") 325 sqlLine.group("processingVersion", str(self.skychunk.processingVersion)) 326 329 327 sql = sqlLine.makeRaw(") SELECT ", " FROM " + cptTableName) 330 328 … … 344 342 self.updatePspsUniqueIDs() 345 343 346 347 344 self.logger.infoPair("update ForcedMeanObject from ","cps table") 348 345 self.updateForcedMeanObjectFromCps(cpsTableName) … … 350 347 sqlLine = sqlUtility("INSERT INTO ForcedMeanLensing (") 351 348 352 sqlLine.group("objID", "objID")353 sqlLine.group("uniquePspsFOid", "uniquePspsFOid")349 sqlLine.group("objID", "objID") 350 sqlLine.group("uniquePspsFOid", "uniquePspsFOid") 354 351 sqlLine.group("randomForcedObjID","randomForcedObjID") 355 sqlLine.group("ippObjID", "ippObjID")356 sqlLine.group("batchID", "batchID")352 sqlLine.group("ippObjID", "ippObjID") 353 sqlLine.group("batchID", "batchID") 357 354 sqlLine.group("nDetections", "nDetections") 358 sqlLine.group("processingVersion", str(self.skychunk.processingVersion))355 sqlLine.group("processingVersion", str(self.skychunk.processingVersion)) 359 356 360 357 sql = sqlLine.makeRaw(") SELECT ", " FROM ForcedMeanObject") … … 375 372 self.logger.infoPair("Dropping row column from", "ForcedMeanObject table") 376 373 self.scratchDb.dropColumn("ForcedMeanObject", "row") 374 377 375 self.logger.infoPair("Dropping row column from", "ForcedMeanLensing table") 378 376 self.scratchDb.dropColumn("ForcedMeanLensing", "row") 377 378 ##Don't do this till after MeanObject 379 379 ##self.logger.infoPair("Purging from scratch Db", self.region + " region") 380 381 ##Don't do this till after MeanObject382 380 ##self.dvoForcedObjects.purgeRegion(self.region) 381 383 382 self.logger.infoPair("setting minmaxobjid for ", "ForcedMeanObject table") 384 383 self.setMinMaxObjID(["ForcedMeanObject"]) … … 421 420 422 421 self.dvoForcedObjects.purgeRegion(self.region) 423 424 #this is abuse of something but this is how I get the object batches to crash to further investigate them425 426 # rowCountAfter = self.scratchDb.getRowCount("Object")427 422 return True 428 # return False
Note:
See TracChangeset
for help on using the changeset viewer.
