Changeset 34949
- Timestamp:
- Jan 17, 2013, 6:11:44 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20121219/ippToPsps/jython/dvodetections.py
r34630 r34949 83 83 # first try to add the new columns. catch failure and continue 84 84 try: 85 sql = "ALTER TABLE " + cpmTableName + " ADD COLUMN (PSPS_OBJ_ID BIGINT), (ZP REAL), (RA FLOAT), (DECFLOAT)"85 sql = "ALTER TABLE " + cpmTableName + " ADD COLUMN (PSPS_OBJ_ID BIGINT), ADD COLUMN (ZP REAL), ADD COLUMN (RA FLOAT), ADD COLUMN (DEC_ FLOAT)" 86 86 self.scratchDb.execute(sql) 87 87 except: 88 self.logger.infoPair("Already added PSPS_OBJ_ID column to", cpmTableName) 88 # failed, but may be due to mysql error 89 self.logger.infoPair("mysql error or already added PSPS_OBJ_ID column to", cpmTableName) 90 # self.logger.infoPair("sql command", sql) 89 91 90 92 # shove PSPS objIDs from cpt table and the calibrated zero point and coordinates which are formed 91 93 # by combining values from multiple tables into cpt table 92 sql = "UPDATE " + cpmTableName + " AS a, " + cptTableName + " AS b, " \ 93 + self.scratchDb.dvoPhotcodesTable + " AS c \ 94 SET a.PSPS_OBJ_ID = b.EXT_ID, \ 95 b.ZP = c.C_LAM * 0.001 + c.K * (b.AIRMASS - 1) - b.M_CAL, \ 96 b.RA = a.RA - (b.D_RA / 3600.0), \ 97 b.DEC = a.DEC - (b.D_DEC / 3600.0) \ 98 WHERE a.CAT_ID = b.CAT_ID \ 99 AND a.OBJ_ID = b.OBJ_ID \ 100 AND b.PHOTCODE = c.CODE" 94 sql = "UPDATE " \ 95 + cpmTableName + " AS meas, " \ 96 + cptTableName + " AS ave, " \ 97 + self.scratchDb.dvoPhotcodesTable + " AS phot \ 98 SET \ 99 meas.PSPS_OBJ_ID = ave.EXT_ID, \ 100 meas.ZP = phot.C_LAM * 0.001 + phot.K * (meas.AIRMASS - 1) - meas.M_CAL, \ 101 meas.RA = ave.RA - (meas.D_RA / 3600.0), \ 102 meas.DEC_ = ave.DEC_ - (meas.D_DEC / 3600.0) \ 103 WHERE meas.CAT_ID = ave.CAT_ID \ 104 AND meas.OBJ_ID = ave.OBJ_ID \ 105 AND meas.PHOTCODE = phot.CODE" 101 106 107 self.logger.infoPair("sql command", sql) 102 108 self.scratchDb.execute(sql) 103 109 … … 136 142 ,POW(10.0, 0.4 * M_TIME) \ 137 143 ,RA \ 138 ,DEC \144 ,DEC_ \ 139 145 ,X_CCD_ERR*PLTSCALE \ 140 146 ,Y_CCD_ERR*PLTSCALE \
Note:
See TracChangeset
for help on using the changeset viewer.
