Changeset 38965 for trunk/ippToPsps/jython/forcedgalaxybatch.py
- Timestamp:
- Oct 26, 2015, 5:25:43 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/forcedgalaxybatch.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/forcedgalaxybatch.py
r38964 r38965 142 142 for filter in filters: 143 143 filterID = self.scratchDb.getFilterId(filter[1]) 144 144 photcode = self.scratchDb.getPhotoCalID("GPC1." + filter[1] + ".ForcedWarp") 145 145 146 146 # This is going to need to join elsewhere to get all the fields? … … 148 148 # Ra, Dec, RaErr, DecErr 149 149 150 # Should GalChiSq fold in Npix somehow? 151 sql = "UPDATE ForcedGalaxyShape JOIN " \ 152 + cpqTable + " AS cpq ON (cpq.row = (ForcedGalaxyShape.row* " + str(filterCount) + ")-(" + str(filterCount) + " - " + str(filter[0]) + ")) " \ 153 + " SET " + \ 154 + " ForcedGalaxyShape." + filter[1] + "ippDetectID = DET_ID," \ 155 + " ForcedGalaxyShape." + filter[1] + "forcedSummaryID = IMAGE_ID," \ 156 + " ForcedGalaxyShape." + filter[1] + "GalModelType = MODEL_TYPE," \ 157 + " ForcedGalaxyShape." + filter[1] + "GalMajor = MAJOR_AXIS," \ 158 + " ForcedGalaxyShape." + filter[1] + "GalMajorErr = MAJOR_AXIS_ERR," \ 159 + " ForcedGalaxyShape." + filter[1] + "GalMinor = MINOR_AXIS," \ 160 + " ForcedGalaxyShape." + filter[1] + "GalMinorErr = MINOR_AXIS_ERR," \ 161 + " ForcedGalaxyShape." + filter[1] + "GalMag = MAG," \ 162 + " ForcedGalaxyShape." + filter[1] + "GalMagErr = MAG_ERR," \ 163 + " ForcedGalaxyShape." + filter[1] + "GalRa = RA," \ 164 + " ForcedGalaxyShape." + filter[1] + "GalDec = DEC," \ 165 + " ForcedGalaxyShape." + filter[1] + "GalRaErr = RA_ERR," \ 166 + " ForcedGalaxyShape." + filter[1] + "GalDecErr = DEC_ERR," \ 167 + " ForcedGalaxyShape." + filter[1] + "GalChisq = CHISQ " 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 154 # 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 172 sqlLine = sqlUtility("UPDATE ForcedGalaxyShape AS a, " + cpqTable + " AS b SET") 173 sqlLine.group("a." + filter[1] + "ippDetectID", "b.DET_ID") 174 sqlLine.group("a." + filter[1] + "forcedSummaryID", "b.IMAGE_ID") 175 sqlLine.group("a." + filter[1] + "GalMajor", "b.MAJOR_AXIS") 176 sqlLine.group("a." + filter[1] + "GalMajorErr", "b.MAJOR_AXIS_ERR") 177 sqlLine.group("a." + filter[1] + "GalMinor", "b.MINOR_AXIS") 178 sqlLine.group("a." + filter[1] + "GalMinorErr", "b.MINOR_AXIS_ERR") 179 sqlLine.group("a." + filter[1] + "GalMag", "b.MAG") 180 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 sqlLine.group("a." + filter[1] + "GalChisq", "b.CHISQ") 187 sql = sqlLine.makeEquals("WHERE a.objID = b.OBJ_ID AND a.galModelType = b.MODEL_TYPE AND b.Photcode = " + photcode) 188 168 189 169 190 try: self.scratchDb.execute(sql) … … 215 236 216 237 217 238 self.logger.infoPair("Dropping row column from ", "ForcedGalaxyShape table") 239 self.scratchDb.dropColumn("ForcedGalaxyShape", "row") 240 241 self.logger.infoPair("setting minmaxobjid for ", "ForcedGalaxyShape table") 242 self.setMinMaxObjID(["ForcedGalaxyShape"]) 243 self.logger.infoPair("checking if we have detections", "ForcedGalaxyShape table") 244 rowcount = self.scratchDb.getRowCount("ForcedGalaxyShape") 245 if rowcount == 0: 246 self.logger.infoPair("skipping this one", "ForcedGalaxyShape") 247 self.skipBatch = False 248 return True 249 else: 250 return True 251 252 ''' 253 Populate psps tables 254 ''' 255 def populatePspsTables(self): 256 257 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.
