IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31285 for trunk/ippToPsps


Ignore:
Timestamp:
Apr 14, 2011, 3:16:26 PM (15 years ago)
Author:
rhenders
Message:

Changes to make it work with changes in superclass

File:
1 edited

Legend:

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

    r31116 r31285  
    66from batch import Batch
    77
     8import logging.config
     9
     10'''
     11DetectionBatch class
     12'''
    813class DetectionBatch(Batch):
    914
     
    1116    Constructor
    1217    '''
    13     def __init__(self):
     18    def __init__(self, logger, expID, inputFile):
    1419       super(DetectionBatch, self).__init__(
     20               logger,
    1521               "detection",
    16                "detdemo.fits",
    17                "detection.fits",
    18                "localhost",
    19                "ipptopsps_scratch",
    20                "ipp",
    21                "ipp",
    22                "3PI") # TODO
     22               inputFile,
     23               "ThreePi") # TODO
    2324
     25       self.logger.info("DetectionBatch constructor. Creating batch from: '" + inputFile + "'")
    2426
     27       # create an output filename, which is {expID}.FITS
     28       self.outputFitsFile = "%08d.FITS" % expID
     29       self.outputFitsPath = "%s/%s" % (self.localOutPath, self.outputFitsFile)
    2530
    26     '''
    27     Updates a table with stackMetaID
    28     '''
    29     def updateStackMetaID(self, table):
    30 
    31         sql = "UPDATE " + table + "  SET stackMetaID=" + self.header['STK_ID']
    32         self.stmt.execute(sql)
    33 
    34     '''
    35     Updates a table with stackTypeID grabbed from FitModel init table
    36     '''
    37     def updateStackTypeID(self, table):
    38 
    39         sql = "UPDATE "+table+" AS a, StackType AS b SET a.stackTypeID=b.stackTypeID WHERE b.name = '"+self.header['STK_TYPE']+"'"
    40         self.stmt.execute(sql)
    4131
    4232    '''
     
    8171        ," + self.header['PC002002'] + " \
    8272        )"
    83         self.stmt.execute(sql)
     73        self.localStmt.execute(sql)
    8474
    8575        self.updateSurveyID("ImageMeta")
     
    10696                      FROM XY%d%d_psf" % (x, y)
    10797
    108                self.stmt.execute(sql)
     98               self.localStmt.execute(sql)
    10999
    110100
     
    133123
    134124    '''
     125    Updates provided table with DVO IDs from DVO table
     126    '''
     127    def updateDvoIDs(self, table):
     128
     129        self.logger.info("Updating table '" + table + "' with DVO IDs...")
     130        sql = "UPDATE " + table + " AS a, dvo AS b SET \
     131               a.ippObjID = b.ippObjID, \
     132               a.detectID = b.detectID, \
     133               a.objID = b.objID \
     134               WHERE a.ippDetectID = b.ippDetectID"
     135        self.localStmt.execute(sql)
     136        self.logger.info("...done")
     137
     138
     139    '''
    135140    Does the processing, i.e. pulling stuff from IPP tables into PSPS tables
    136141    '''
     
    140145        self.filter = self.header['FILTERID']
    141146        self.filter = self.filter[0:1]
    142         print "filter = ", self.filter
    143147
    144148        #self.populateStackMeta()
     
    147151        #self.populateStackApFlx()
    148152
    149    
    150 detectionBatch = DetectionBatch()
     153        self.getIDsFromDVO("33", "8345290") # TODO need to get sourceID and imageID from chip header
     154        self.updateDvoIDs("Detection")
     155        self.setMinMaxObjID("Detection")
     156
     157
     158
     159logging.config.fileConfig("logging.conf")
     160logger = logging.getLogger("detectionbatch")
     161logger.info("Starting")
     162
     163expID = 230033;
     164inputFile = "detdemo.fits"
     165detectionBatch = DetectionBatch(logger, expID, inputFile)
    151166detectionBatch.createEmptyPspsTables()
    152167detectionBatch.importIppTables("XY33\.psf")
    153168detectionBatch.populatePspsTables()
    154169detectionBatch.exportPspsTablesToFits()
     170detectionBatch.exportPspsTablesToFits()
     171detectionBatch.writeBatchManifest()
     172detectionBatch.reportNullsInAllPspsTables(False)
     173
     174
Note: See TracChangeset for help on using the changeset viewer.