- Timestamp:
- Jun 19, 2012, 5:24:19 PM (14 years ago)
- Location:
- branches/meh_branches/ppstack_test
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippToPsps/jython/gpc1db.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/meh_branches/ppstack_test
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/ippToPsps/jython/gpc1db.py
r33415 r34041 32 32 33 33 ''' 34 Gets a list of ids in this DVO database for this stage, could be cam or staticsky, for a box with defined center and side length35 ''' 36 def getI DsInThisDVODbForThisStageInThisBox(self, dvoDb, batchType, ra=180., dec=0., side=181.):34 Gets a list of ids, ra and dec in this DVO database for this stage, could be cam or staticsky, for a box with defined center and side length 35 ''' 36 def getItemsInThisDVODbForThisStageInThisBox(self, dvoDb, batchType, ra=180., dec=0., side=181.): 37 37 38 38 halfSide = side/2.0 39 return self.getI DsInThisDVODbForThisStage(dvoDb, batchType, ra-halfSide, ra+halfSide, dec-halfSide, dec+halfSide)40 41 42 '''43 Gets a list of ids in this DVO database for this stage, could be cam or staticsky, and a box can be defined with equatorial coordinates44 ''' 45 def getI DsInThisDVODbForThisStage(self, dvoDb, batchType, minRA=-999, maxRA=999, minDec=-999, maxDec=999):39 return self.getItemsInThisDVODbForThisStage(dvoDb, batchType, ra-halfSide, ra+halfSide, dec-halfSide, dec+halfSide) 40 41 ''' 42 Gets a list of ids, ra and dec in this DVO database for this stage, could be cam or staticsky, and a box can be defined with equatorial coordinates 43 NB this uses Bill's potentially temporary 'skycells' database when finding RA/Dec for stacks. 44 ''' 45 def getItemsInThisDVODbForThisStage(self, dvoDb, batchType, minRA=-999, maxRA=999, minDec=-999, maxDec=999): 46 46 47 47 self.logger.debugPair("GPC1 RA range", "%.2f -> %.2f" % (minRA, maxRA)) 48 48 self.logger.debugPair("GPC1 Dec range", "%.2f -> %.2f" % (minDec, maxDec)) 49 49 50 ids = []51 52 if batchType == "P2": # TODO define these some place50 rows = [] 51 52 if batchType == "P2": # TODO define these some place 53 53 54 54 stage = "cam" 55 sql = "SELECT DISTINCT stage_id \55 sql = "SELECT DISTINCT stage_id, DEGREES(ra), DEGREES(decl) \ 56 56 FROM addRun \ 57 57 JOIN minidvodbRun USING(minidvodb_name) \ … … 72 72 elif batchType == "ST": 73 73 74 stage = "staticsky _multi"75 sql = "SELECT DISTINCT stack_id FROM staticskyInput \74 stage = "staticsky" 75 sql = "SELECT DISTINCT stack_id, radeg, decdeg FROM staticskyInput \ 76 76 JOIN addRun ON(staticskyInput.sky_id = addRun.stage_id) \ 77 77 JOIN minidvodbRun USING(minidvodb_name) \ 78 78 JOIN minidvodbProcessed USING(minidvodb_id) \ 79 JOIN stackRun USING(stack_id) JOIN skycell USING(skycell_id) \ 79 80 WHERE minidvodbRun.minidvodb_group = '" + dvoDb + "' \ 80 81 AND minidvodbRun.state = 'merged' \ 81 82 AND minidvodbProcessed.fault = 0 \ 82 83 AND addRun.stage = '" + stage + "' \ 83 AND addRun.state = 'full'" 84 85 try: 86 rs = self.executeQuery(sql) 87 while (rs.next()): ids.append(rs.getInt(1)) 84 AND addRun.state = 'full' \ 85 AND decdeg BETWEEN " + str(minDec) + " AND " + str(maxDec) + " \ 86 AND radeg BETWEEN " + str(minRA) + " AND " + str(maxRA) 87 88 try: 89 rs = self.executeQuery(sql) 90 while (rs.next()): 91 rows.append([rs.getInt(1), rs.getFloat(2), rs.getFloat(3)]) 88 92 rs.close() 89 93 except: 90 94 self.logger.exception("Can't query for ids in DVO") 91 return ids 92 93 94 self.logger.debug("Found %d items in DVO database '%s' for stage='%s'" % (len(ids), dvoDb, stage)) 95 96 return ids 95 return rows 96 97 self.logger.debug("Found %d items in DVO database '%s' for stage='%s'" % (len(rows), dvoDb, stage)) 98 99 return rows 97 100 98 101 ''' … … 263 266 AND minidvodbRun.minidvodb_group = '" + dvoDb + "' \ 264 267 AND minidvodbRun.state = 'merged' \ 265 AND stage = 'staticsky _multi'"268 AND stage = 'staticsky'" 266 269 ''' 267 270 … … 279 282 AND mergedvodbRun.state = 'full' \ 280 283 AND mergedvodbRun.mergedvodb = '" + dvoDb + "' \ 281 AND stage = 'staticsky _multi'"284 AND stage = 'staticsky'" 282 285 283 286
Note:
See TracChangeset
for help on using the changeset viewer.
