IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38228


Ignore:
Timestamp:
May 5, 2015, 3:11:55 PM (11 years ago)
Author:
heather
Message:

added imagedeteffmeta table

File:
1 edited

Legend:

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

    r37935 r38228  
    304304        self.scratchDb.replaceNullsInThisColumn(tableName, "polyOrder", "0")
    305305
     306    '''
     307    Populates the ImageDetEffMeta table for this OTA
     308    '''
     309    def populateImageDetEffMetaTable(self, ota, header):
     310        ippTableName = ota + "_deteff"
     311        tableName = "ImageDetEffMeta_" + ota
     312
     313        # we drop the table before calling this functoin so it is not left behind on failure
     314        sql = "CREATE TABLE " + tableName + " LIKE ImageDetEffMeta"
     315        try: self.scratchDb.execute(sql)
     316        except: pass
     317
     318        if (ota[0:2] == "XY"): ccdID = ota[2:4]
     319        else: ccdID = 0
     320
     321        # insert image metadata into table
     322        sqlLine = sqlUtility("INSERT INTO " + tableName + "(")
     323
     324        sqlLine.group("frameID",          str(self.expID))
     325        sqlLine.group("magref",           self.getKeyFloat(header,"%.8f","MAGREF")
     326        sql = sqlLine.make(") VALUES ( ", ")")
     327        try: self.scratchDb.execute(sql)
     328        except:
     329            self.logger.errorPair('failed sql: ', sql)
     330            raise
     331
     332        # ok, this is a bit tricky - Ideally I just want this all in one table, however, the way the table is layed out is 90 degrees from how I want it.
     333        # the steps out of this mess are as follows:
     334        # give an index to XYxy_deteff (already done, called table_index)
     335        # do a loop to grab the 5 colums and fill them
     336
     337        # for loop
     338        for i in xrange(1, 14):
     339                      stringint = str(i)
     340                      stringint.rjust(2, '0')
     341                      sqlLine = sqlUtility("INSERT INTO " + tableName + "(")
     342                      sqlLine.group("offset"+stringint", "OFFSET")
     343                      sqlLine.group("counts"+stringint", "COUNTS")
     344                      sqlLine.group("diffMean"+stringint", "DIFF.MEAN")
     345                      sqlLine.group("diffStdev01"+stringint", "DIFF.STDEV")
     346                      sqlLine.group("errMean01"+stringing", "ERR.MEAN")
     347                      sql = sqlLine.makeRaw(") SELECT ", "FROM " + ippTableName + " WHERE table_index = " + str(i)")
     348                      try: self.scratchDb.execute(sql)
     349                      except:
     350                          self.logger.errorPair('failed sql: ', sql)
     351                      raise
     352       
     353       
     354                     
     355
     356       
    306357    '''
    307358    Populates the Detection table for this OTA
     
    508559        self.populateImageMetaTable(chipname, header)
    509560        self.updateImageID("ImageMeta_" + chipname, x, y)
    510            
     561
     562        self.populateImageDetEffTable(chipname, header)
     563        self.updateImageID("ImageDetEffMeta_" + chipname, x, y)
     564       
    511565        return True
    512566
     
    713767        self.logger.info("export ImageMeta")
    714768
     769        self.tablesToExport.append("ImageDetEffMeta_" + chipname)
     770        self.logger.info("export ImageDetEffMeta")
     771       
    715772        self.tablesToExport.append("Detection_" + chipname)
    716773        self.logger.info("export Detection")
Note: See TracChangeset for help on using the changeset viewer.