IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 19, 2011, 10:58:16 AM (15 years ago)
Author:
rhenders
Message:

method to get imageIDs for a given stack; method to get sky_ids for a given dvo db

File:
1 edited

Legend:

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

    r31225 r31323  
    5151
    5252    '''
     53    Gets a list of sky_ids in this DVO database
     54    '''
     55    def getSkyIDsInThisDVODb(self, dvoDb):
     56
     57        self.logger.debug("Querying GPC1 for sky_ids in this DVO database: " + dvoDb)
     58
     59        sql = "SELECT DISTINCT stage_id \
     60               FROM addRun \
     61               WHERE stage = 'staticsky' \
     62               AND dvodb = '" + dvoDb + "'"
     63
     64        print sql
     65
     66        try:
     67            rs = self.stmt.executeQuery(sql)
     68        except:
     69            self.logger.exception("Can't query for sky_ids")
     70
     71        skyIDs = []
     72        while (rs.next()):
     73            skyIDs.append(rs.getInt(1))
     74
     75        rs.close()
     76
     77        return skyIDs
     78
     79    '''
     80    Gets a list of PSPS image IDs for this stack ID
     81    '''
     82    def getImageIDsForThisStackID(self, stackID):
     83
     84        self.logger.debug("Querying GPC1 for image IDs for stack ID: " + stackID)
     85
     86        sql = "SELECT DISTINCT CONCAT(exp_id, SUBSTR(class_id, 3, 4)) FROM ( \
     87               SELECT DISTINCT exp_id,class_id \
     88               FROM warpSkyCellMap \
     89               JOIN warpRun USING(warp_id) \
     90               JOIN stackInputSkyfile USING(warp_id) \
     91               JOIN stackRun USING(stack_id,skycell_id) \
     92               JOIN fakeRun USING(fake_id) \
     93               JOIN camRun USING(cam_id)  \
     94               JOIN chipRun USING(chip_id) \
     95               WHERE stackRun.stack_id = " + stackID + ") AS a"
     96
     97        try:
     98            rs = self.stmt.executeQuery(sql)
     99        except:
     100            self.logger.exception("Can't query for imageIDs")
     101
     102        imageIDs = []
     103        while (rs.next()):
     104            imageIDs.append(rs.getString(1))
     105        rs.close()
     106
     107        return imageIDs
     108
     109
     110    '''
    53111    Gets all cmf files for this sky_id. handles both absolute paths and neb paths
    54112    '''
    55113    def getStackStageCmfs(self, skyID):
    56114
    57         self.logger.debug("Querying for stack cmf files")
     115        self.logger.debug("Querying GPC1 for stack cmf files")
    58116
    59117        sql = "SELECT path_base, num_inputs \
Note: See TracChangeset for help on using the changeset viewer.