Changeset 39007 for trunk/ippToPsps/jython/forcedgalaxybatch.py
- Timestamp:
- Oct 29, 2015, 4:10:00 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/forcedgalaxybatch.py (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.
