IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 13, 2012, 10:46:58 AM (14 years ago)
Author:
rhenders
Message:

now getting RA and Dec as well as stage_ids when getting stuff in DVO

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/jython/gpc1db.py

    r33259 r33499  
    3232
    3333    '''
    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 length
    35     '''
    36     def getIDsInThisDVODbForThisStageInThisBox(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.):
    3737
    3838        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):
    4645
    4746        self.logger.debugPair("GPC1 RA range", "%.2f -> %.2f" % (minRA, maxRA))
    4847        self.logger.debugPair("GPC1 Dec range", "%.2f -> %.2f" % (minDec, maxDec))
    4948
    50         ids = []
    51 
    52         if batchType == "P2": # TODO define these someplace
     49        rows = [[],[],[]]
     50
     51        if batchType == "P2": # TODO define these some place
    5352
    5453            stage = "cam"
    55             sql = "SELECT DISTINCT stage_id \
     54            sql = "SELECT DISTINCT stage_id, DEGREES(ra), DEGREES(decl) \
    5655                   FROM addRun \
    5756                   JOIN minidvodbRun USING(minidvodb_name) \
     
    7372
    7473            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 \
    7676                   JOIN addRun ON(staticskyInput.sky_id = addRun.stage_id) \
    7777                   JOIN minidvodbRun USING(minidvodb_name) \
     
    8585        try:
    8686            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)])
    8889            rs.close()
    8990        except:
    9091            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
    9797
    9898    '''
Note: See TracChangeset for help on using the changeset viewer.