IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33186 for trunk/ippToPsps


Ignore:
Timestamp:
Jan 31, 2012, 4:28:37 PM (14 years ago)
Author:
rhenders
Message:

added convenience method to define search box by center and side length

File:
1 edited

Legend:

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

    r33145 r33186  
    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.):
     37
     38        halfSide = side/2.0
     39        return self.getIDsInThisDVODbForThisStage(dvoDb, batchType, ra-halfSide, ra+halfSide, dec-halfSide, dec+halfSide)
     40
     41
     42    '''
    3443    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
    3544    '''
    3645    def getIDsInThisDVODbForThisStage(self, dvoDb, batchType, minRA=-999, maxRA=999, minDec=-999, maxDec=999):
     46
     47        self.logger.debugPair("GPC1 RA range", "%.2f -> %.2f" % (minRA, maxRA))
     48        self.logger.debugPair("GPC1 Dec range", "%.2f -> %.2f" % (minDec, maxDec))
     49
     50        ids = []
    3751
    3852        if batchType == "P2": # TODO define these someplace
     
    7185        try:
    7286            rs = self.executeQuery(sql)
     87            while (rs.next()): ids.append(rs.getInt(1))
     88            rs.close()
    7389        except:
    7490            self.logger.exception("Can't query for ids in DVO")
    75 
    76         ids = []
    77         while (rs.next()):
    78             ids.append(rs.getInt(1))
    79 
    80         rs.close()
     91            return ids
     92
    8193
    8294        self.logger.debug("Found %d items in DVO database '%s' for stage='%s'" % (len(ids), dvoDb, stage))
Note: See TracChangeset for help on using the changeset viewer.