IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39027 for trunk


Ignore:
Timestamp:
Nov 2, 2015, 2:42:04 PM (11 years ago)
Author:
eugene
Message:

clean up some test vebosity

Location:
trunk/ippToPsps
Files:
5 edited

Legend:

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

    r39008 r39027  
    534534
    535535            # example of listing all columns in a table:
    536             print "-----table: " + table.name
    537             myColumns = table.columns()
    538             for column in myColumns:
    539                 print column
    540             print "-----"
     536            ## print "-----table: " + table.name
     537            ## myColumns = table.columns()
     538            ## for column in myColumns:
     539            ##     print column
     540            ## print "-----"
    541541
    542542            print "import smf table ", table.name
     
    558558            self.logger.debug("Removing Infinity values from all columns")
    559559            table = stilts.tpipe(table, cmd='keepcols "' + columns + '"')
    560             print "-----"
    561560            table = stilts.tpipe(table, cmd='replaceval -Infinity null *')
    562             print "-----"
    563561            table = stilts.tpipe(table, cmd='replaceval Infinity null *')
    564             print "cleaned up values ", table.name
    565562
    566563            try:
  • trunk/ippToPsps/jython/forcedgalaxybatch.py

    r39008 r39027  
    137137
    138138        for filter in filters:
    139             filterID = self.scratchDb.getFilterId(filter[1])
    140             photcode = self.scratchDb.getPhotoCalID("GPC1." + filter[1] + ".ForcedWarp")
     139            filterID = self.scratchDb.getFilterID(filter[1])
     140
     141            photcodeName = "NONE"
     142            if self.config.camera == "gpc1":
     143                photcodeName = "GPC1." + filter[1] + ".ForcedWarp"
     144            if self.config.camera == "simtest":
     145                photcodeName = "SIMTEST." + filter[1] + ".ForcedWarp"
     146
     147            photcode = self.scratchDb.getPhotcodeByName(photcodeName)
    141148
    142149            # This is going to need to join elsewhere to get all the fields?
     
    161168            # sqlLine.group("a." + filter[1] + "GalDecErr",       "b.DEC_ERR")
    162169
    163             sql = sqlLine.makeEquals("WHERE a.objID = b.OBJ_ID AND a.galModelType = b.MODEL_TYPE AND b.Photcode = " + photcode)
     170            sql = sqlLine.makeEquals("WHERE a.objID = b.OBJ_ID AND a.galModelType = b.MODEL_TYPE AND b.Photcode = " + str(photcode))
    164171
    165172            self.scratchDb.execute(sql)
     
    192199        self.logger.infoPair("Adding 'row' columns to", "Forced Galaxy, cpt tables")
    193200        self.scratchDb.addRowCountColumn("ForcedGalaxyShape", "row")
    194         self.scratchDb.addRowCountColumn(cpsTableName, "row")
     201        self.scratchDb.addRowCountColumn(cpqTableName, "row")
    195202
    196203        self.logger.infoPair("generating unique ids for ","ForcedGalaxyShape")
     
    221228    def populatePspsTables(self):
    222229       
    223         if not self.populateForcedGalaxyShapeTable(): return False
     230        if not self.populateForcedGalaxyShapeTable():
     231            return False
     232           
     233        return True
  • trunk/ippToPsps/jython/mysql.py

    r38951 r39027  
    470470
    471471        sql = "SELECT COUNT(*) FROM " + table
    472         try:
    473             rs = self.executeQuery(sql) 
    474             rs.first()
    475             return rs.getInt(1)
    476         except:
     472        rs = self.executeQuery(sql) 
     473
     474        if not rs.first():
    477475            self.logger.exception("Could not count rows for table: '" + table + "'")
    478476            return -1
     477
     478        return rs.getInt(1)
    479479
    480480    '''
  • trunk/ippToPsps/jython/scratchdb.py

    r38995 r39027  
    190190
    191191        sql = "SELECT FLAGS FROM " + self.dvoImagesTable + " WHERE EXTERN_ID = %s" % (externID)
    192         try:
    193             rs = self.executeQuery(sql) 
    194             rs.first()
     192        rs = self.executeQuery(sql) 
     193
     194        if not rs.first():
     195            self.logger.errorPair("Unable to get flags from dvo using", sql)
     196        else:
    195197            flags = rs.getInt(1)
    196         except:
    197             self.logger.errorPair("Unable to get flags from dvo using", sql)
     198
    198199        return flags
    199200
     
    206207
    207208        sql = "SELECT PHOTCODE FROM " + self.dvoImagesTable + " WHERE EXTERN_ID = %s" % (externID)
    208         try:
    209             rs = self.executeQuery(sql) 
    210             rs.first()
     209        rs = self.executeQuery(sql) 
     210
     211        if not rs.first():
     212            self.logger.errorPair("Unable to get photcode from dvo with", sql)
     213        else:
    211214            photcode = rs.getInt(1)
    212         except:
    213             self.logger.errorPair("Unable to get photcode from dvo with", sql)
    214 
     215
     216        return photcode
     217
     218    '''
     219    Gets photcode (aka photoCalID from dvo table)
     220    '''
     221    def getPhotcodeByName(self, photcodeName):
     222
     223        photcode = -1
     224
     225        sql = "SELECT CODE FROM %s WHERE NAME = '%s'" % (self.dvoPhotcodesTable, photcodeName)
     226        rs = self.executeQuery(sql) 
     227
     228        if not rs.first():
     229            self.logger.errorPair("No photcode found for ", photcodeName)
     230            print "--- sql: " + sql
     231            os._exit(2)
     232
     233        photcode = rs.getInt(1)
    215234        return photcode
    216235
  • trunk/ippToPsps/test/mkgpc1data.dvo

    r39021 r39027  
    5151
    5252list stackdata
    53 # stk_id sky_id filename         M_off filter
    54   1      1      $OUTDIR/stack.01 0.010 g
    55   2      2      $OUTDIR/stack.02 0.020 g
    56   3      3      $OUTDIR/stack.03 0.030 g
    57   4      1      $OUTDIR/stack.04 0.025 r
    58   5      2      $OUTDIR/stack.05 0.035 r
    59   6      3      $OUTDIR/stack.06 0.045 r
     53# stk_id sky_id filename         M_off filter  forcedgalaxy         
     54  1      1      $OUTDIR/stack.01 0.010 g       $OUTDIR/fgal.01
     55  2      2      $OUTDIR/stack.02 0.020 g       $OUTDIR/fgal.02
     56  3      3      $OUTDIR/stack.03 0.030 g       $OUTDIR/fgal.03
     57  4      1      $OUTDIR/stack.04 0.025 r       $OUTDIR/fgal.04
     58  5      2      $OUTDIR/stack.05 0.035 r       $OUTDIR/fgal.05
     59  6      3      $OUTDIR/stack.06 0.045 r       $OUTDIR/fgal.06
    6060end
    6161 
     
    339339    $stkID = $word:0
    340340    $rawfile = $word:2\.txt
    341     $cmffile = $word:2\.cmf
     341    $cmffile = $word:5\.cmf
    342342    $offset = $word:3
    343343    $filter = $word:4
     
    349349    exec mkcmf -forcedgalaxy -photcode SIMTEST.$filter.ForcedWarp $rawfile $cmffile -extroot SkyChip -date 2008/1/1 -time $i\:00:00 -mjd 54466.0 -radec $RA $DEC -type $1 -imageID $stkID -sourceID 1 -tess_id $TESS_ID -skycell $SKYCELL
    350350
    351     echo loadgalphot -D CATDIR $catdir $cmffile
    352     exec loadgalphot -D CATDIR $catdir $cmffile
     351    echo loadgalphot -D CATDIR $catdir -photcode SIMTEST.$filter.ForcedWarp -image-id $stkID $cmffile
     352    exec loadgalphot -D CATDIR $catdir -photcode SIMTEST.$filter.ForcedWarp -image-id $stkID $cmffile
    353353  end
    354354
Note: See TracChangeset for help on using the changeset viewer.