- Timestamp:
- Mar 13, 2012, 10:46:58 AM (14 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/gpc1db.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/gpc1db.py
r33259 r33499 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.getIDsInThisDVODbForThisStage(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 coordinates 44 ''' 45 def getIDsInThisDVODbForThisStage(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 ''' 44 def getItemsInThisDVODbForThisStage(self, dvoDb, batchType, minRA=-999, maxRA=999, minDec=-999, maxDec=999): 46 45 47 46 self.logger.debugPair("GPC1 RA range", "%.2f -> %.2f" % (minRA, maxRA)) 48 47 self.logger.debugPair("GPC1 Dec range", "%.2f -> %.2f" % (minDec, maxDec)) 49 48 50 ids = []51 52 if batchType == "P2": # TODO define these some place49 rows = [[],[],[]] 50 51 if batchType == "P2": # TODO define these some place 53 52 54 53 stage = "cam" 55 sql = "SELECT DISTINCT stage_id \54 sql = "SELECT DISTINCT stage_id, DEGREES(ra), DEGREES(decl) \ 56 55 FROM addRun \ 57 56 JOIN minidvodbRun USING(minidvodb_name) \ … … 73 72 74 73 stage = "staticsky_multi" 75 sql = "SELECT DISTINCT stack_id FROM staticskyInput \ 74 # no way to get RA/Decl for stacks, so default to provided min RA/Dec 75 sql = "SELECT DISTINCT stack_id, " + str(minRA) + ", " + str(minDec) + " FROM staticskyInput \ 76 76 JOIN addRun ON(staticskyInput.sky_id = addRun.stage_id) \ 77 77 JOIN minidvodbRun USING(minidvodb_name) \ … … 85 85 try: 86 86 rs = self.executeQuery(sql) 87 while (rs.next()): ids.append(rs.getInt(1)) 87 while (rs.next()): 88 rows.append([rs.getInt(1), rs.getFloat(2), rs.getFloat(3)]) 88 89 rs.close() 89 90 except: 90 91 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 92 return rows 93 94 self.logger.debug("Found %d items in DVO database '%s' for stage='%s'" % (len(rows), dvoDb, stage)) 95 96 return rows 97 97 98 98 '''
Note:
See TracChangeset
for help on using the changeset viewer.
