Changeset 33769
- Timestamp:
- Apr 12, 2012, 11:11:29 AM (14 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/objectbatch.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/objectbatch.py
r33763 r33769 78 78 def alterPspsTables(self): 79 79 80 # index objID column81 self.scratchDb.makeColumnUnique("Object", "objID")82 83 80 # dec is reserved in MySQL, so STILTS replaces if with dec_, which PSPS doesn't like. so, force it back again using `` 84 81 self.scratchDb.execute("ALTER TABLE Object CHANGE dec_ `dec` double") … … 100 97 def insertMags(self, cpsTable): 101 98 102 # list of all filters we areinterested in103 allFilters = ['g', 'r', 'i', 'z', 'y',]99 # list of all filters PSPS is interested in 100 interestedFilters = ['g', 'r', 'i', 'z', 'y'] 104 101 105 # this loop looks into the DVO Photcodes tables and gets the 'CODE' for each the filters above that are listed 106 filters = [] 107 for filter in allFilters: 108 code = self.scratchDb.getCodeForThisFilter(filter) 109 if code < 0: continue 110 filters.append([code, filter]) 102 filters = self.scratchDb.getOrderedListOfFiltersFromPhotcodesTable(interestedFilters) 111 103 112 104 # get a count of the available filters … … 119 111 120 112 sql = "UPDATE Object \ 121 JOIN " + cpsTable + " AS cps ON (cps.row = (Object.row*" + str(filterCount) + ")- " + str(filter[0]) + ") \113 JOIN " + cpsTable + " AS cps ON (cps.row = (Object.row*" + str(filterCount) + ")-(" + str(filterCount) + " - " + str(filter[0]) + ")) \ 122 114 SET \ 123 115 n" + filter[1] + " = NCODE \ … … 128 120 ," + filter[1] + "Max = MAG_80 \ 129 121 " 130 122 131 123 self.scratchDb.execute(sql) 132 124 … … 251 243 #if not self.populateObjectCalColorTable(): return False 252 244 253 return True 254 245 # now remove the objID duplicates. We could not do this before as cpt/cps tables relate by row number 246 self.logger.infoPair("Forcing uniqueness on", "objID in Object table") 247 rowCountBefore = self.scratchDb.getRowCount("Object") 248 self.scratchDb.execute("ALTER IGNORE TABLE Object ADD UNIQUE INDEX(objID)") 249 rowCountAfter = self.scratchDb.getRowCount("Object") 250 self.logger.infoPair("Number of duplicated objIDs removed", "%d" % (rowCountBefore - rowCountAfter)) 251 252 return True 253
Note:
See TracChangeset
for help on using the changeset viewer.
