IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 22, 2011, 1:16:24 PM (15 years ago)
Author:
rhenders
Message:

Now producing detection batches of same sahpe as old code

File:
1 edited

Legend:

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

    r31325 r31346  
    55from java.sql import *
    66from batch import Batch
     7from gpc1db import Gpc1Db
    78
    89import logging.config
     
    1617    Constructor
    1718    '''
    18     def __init__(self, logger, expID, inputFile):
     19    def __init__(self, logger, camID, inputFile, test=False):
    1920       super(DetectionBatch, self).__init__(
    2021               logger,
    2122               "detection",
    2223               inputFile,
    23                "3PI") # TODO
     24               "MD04") # TODO
     25               #"3PI") # TODO
    2426
    2527       self.logger.info("DetectionBatch constructor. Creating batch from: '" + inputFile + "'")
    2628
    27        self.expID = expID
     29       meta = self.gpc1Db.getCameraStageMeta(camID)
     30     
     31       self.expID = meta[0];
     32       self.expName = meta[1];
     33       self.distGroup = meta[2];
     34
     35       self.logger.info("Processing exposure with ID: %d, name: %s and distribution group: %s" % (self.expID, self.expName, self.distGroup))
     36
    2837       # create an output filename, which is {expID}.FITS
    29        self.outputFitsFile = "%08d.FITS" % expID
     38       self.outputFitsFile = "%08d.FITS" % self.expID
    3039       self.outputFitsPath = "%s/%s" % (self.localOutPath, self.outputFitsFile)
    3140
     41       # if test mode
     42       if test:
     43           self.startX = 3
     44           self.endX = 4
     45           self.startY = 3
     46           self.endY = 4
     47       else:
     48           self.startX = 0
     49           self.endX = 8
     50           self.startY = 0
     51           self.endY = 8
     52
     53       self.obsTime = float(self.header['MJD-OBS']) + (float(self.header['EXPTIME']) / 172800.0)
     54     
     55       # set up some defauts
     56       self.calibModNum = 0
     57       self.dataRelease = 0
     58
     59       self.totalNumPhotoRef = 0
    3260
    3361    '''
     
    3563    '''
    3664    def populateFrameMeta(self):
    37         self.log("Procesing FrameMeta table")
     65        self.logger.info("Procesing FrameMeta table")
    3866
    3967        sql = "INSERT INTO FrameMeta (\
    40         frameID \
     68          frameID \
     69         ,frameName \
     70         ,cameraID \
     71         ,cameraConfigID \
     72         ,telescopeID \
     73         ,analysisVer \
     74         ,p1Recip \
     75         ,p2Recip \
     76         ,p3Recip \
    4177         ,photoScat \
    4278         ,expStart \
     
    74110         ) VALUES ( \
    75111        " + str(self.expID) + " \
     112        ,'" + self.expName + "' \
     113        ,1  \
     114        ,1  \
     115        ,1  \
     116        ,' ' \
     117        ,' ' \
     118        ,' ' \
     119        ,' ' \
    76120        ," + self.header['ZPT_ERR'] + " \
    77121        ," + self.header['MJD-OBS'] + " \
     
    108152        ," + self.header['PCA2X0Y2'] + " \
    109153        )"
    110         self.localStmt.execute(sql)
    111 
    112         self.updateSurveyID("FrameMeta")
    113         self.updateFilterID("FrameMeta")
     154        self.scratchDb.stmt.execute(sql)
     155
     156        self.scratchDb.updateAllRows("FrameMeta", "surveyID", str(self.surveyID))
     157        self.scratchDb.updateFilterID("FrameMeta", self.filter)
     158        self.scratchDb.updateAllRows("FrameMeta", "calibModNum", str(self.calibModNum))
     159        self.scratchDb.updateAllRows("FrameMeta", "dataRelease", str(self.dataRelease))
    114160
    115161    '''
     
    119165
    120166        tableName = "ImageMeta_" + ota
    121         self.log("   Dealing with table " + tableName)
     167        self.logger.info("   Dealing with table " + tableName)
    122168       
    123169        # drop then re-create table
    124         self.dropTable(tableName)
     170        self.scratchDb.dropTable(tableName)
    125171        sql = "CREATE TABLE " + tableName + " LIKE ImageMeta"
    126         try: self.localStmt.execute(sql)
     172        try: self.scratchDb.stmt.execute(sql)
    127173        except: pass
    128174
     
    130176        sql = "INSERT INTO " + tableName + " ( \
    131177               frameID \
     178               ,ccdID \
    132179               ,sky \
    133180               ,skyScat \
     
    135182               ,completMag \
    136183               ,astroScat \
     184               ,photoScat \
    137185               ,numAstroRef \
    138186               ,numPhotoRef \
    139187               ,nx \
    140188               ,ny \
     189               ,psfFwhm \
    141190               ,psfWidMajor \
    142191               ,psfWidMinor \
    143192               ,psfTheta \
     193               ,momentFwhm \
    144194               ,momentWidMajor \
    145195               ,momentWidMinor \
     
    147197               ,dapResid \
    148198               ,detectorID \
     199               ,qaFlags \
    149200               ,detrend1 \
    150201               ,detrend2 \
    151202               ,detrend3 \
     203               ,detrend4 \
     204               ,detrend5 \
     205               ,detrend6 \
     206               ,detrend7 \
     207               ,detrend8 \
     208               ,photoZero \
    152209               ,ctype1 \
    153210               ,ctype2 \
     
    179236               ) VALUES ( \
    180237               " + str(self.expID) + " \
    181                ," + header['MSKY_MN'] + " \
    182                ," + header['MSKY_SIG'] + " \
    183                ," + header['FSATUR'] + " \
    184                ," + header['FLIMIT'] + " \
    185                ," + header['CERROR'] + " \
    186                ," + header['NASTRO'] + " \
    187                ," + header['NASTRO'] + " \
    188                ," + header['CNAXIS1'] + " \
    189                ," + header['CNAXIS2'] + " \
    190                ," + header['FWHM_MAJ'] + " \
    191                ," + header['FWHM_MIN'] + " \
    192                ," + header['ANGLE'] + " \
    193                ," + header['IQ_FW1'] + " \
    194                ," + header['IQ_FW2'] + " \
    195                ," + header['APMIFIT'] + " \
    196                ," + header['DAPMIFIT'] + " \
    197                ,'" + header['DETECTOR'] + "' \
    198                ,'" + header['DETREND.MASK'] + "' \
    199                ,'" + header['DETREND.DARK'] + "' \
    200                ,'" + header['DETREND.FLAT'] + "' \
    201                ,'" + header['CTYPE1'] + "' \
    202                ,'" + header['CTYPE2'] + "' \
    203                ," + header['CRVAL1'] + " \
    204                ," + header['CRVAL2'] + " \
    205                ," + header['CRPIX1'] + " \
    206                ," + header['CRPIX2'] + " \
    207                ," + header['CDELT1'] + " \
    208                ," + header['CDELT2'] + " \
    209                ," + header['PC001001'] + " \
    210                ," + header['PC001002'] + " \
    211                ," + header['PC002001'] + " \
    212                ," + header['PC002002'] + " \
    213                ," + header['NPLYTERM'] + " \
    214                ," + header['PCA1X3Y0'] + " \
    215                ," + header['PCA1X2Y1'] + " \
    216                ," + header['PCA1X1Y2'] + " \
    217                ," + header['PCA1X0Y3'] + " \
    218                ," + header['PCA1X2Y0'] + " \
    219                ," + header['PCA1X1Y1'] + " \
    220                ," + header['PCA1X0Y2'] + " \
    221                ," + header['PCA2X3Y0'] + " \
    222                ," + header['PCA2X2Y1'] + " \
    223                ," + header['PCA2X1Y2'] + " \
    224                ," + header['PCA2X0Y3'] + " \
    225                ," + header['PCA2X2Y0'] + " \
    226                ," + header['PCA2X1Y1'] + " \
    227                ," + header['PCA2X0Y2'] + " \
     238               ," + ota[2:4] + " \
     239               ," + self.safeDictionaryAccess(header, 'MSKY_MN') + " \
     240               ," + self.safeDictionaryAccess(header, 'MSKY_SIG') + " \
     241               ," + self.safeDictionaryAccess(header, 'FSATUR') + " \
     242               ," + self.safeDictionaryAccess(header, 'FLIMIT') + " \
     243               ," + self.safeDictionaryAccess(header, 'CERROR') + " \
     244               ," + self.safeDictionaryAccess(self.header, 'ZPT_OBS') + " \
     245               ," + self.safeDictionaryAccess(header, 'NASTRO') + " \
     246               ," + self.safeDictionaryAccess(header, 'NASTRO') + " \
     247               ," + self.safeDictionaryAccess(header, 'CNAXIS1') + " \
     248               ," + self.safeDictionaryAccess(header, 'CNAXIS2') + " \
     249               ," + str((float(self.safeDictionaryAccess(header, 'FWHM_MAJ')) + float(self.safeDictionaryAccess(header, 'FWHM_MIN')))/2.0) + " \
     250               ," + self.safeDictionaryAccess(header, 'FWHM_MAJ') + " \
     251               ," + self.safeDictionaryAccess(header, 'FWHM_MIN') + " \
     252               ," + self.safeDictionaryAccess(header, 'ANGLE') + " \
     253               ," + str((float(self.safeDictionaryAccess(header, 'IQ_FW1')) + float(self.safeDictionaryAccess(header, 'IQ_FW2')))/2.0) + " \
     254               ," + self.safeDictionaryAccess(header, 'IQ_FW1') + " \
     255               ," + self.safeDictionaryAccess(header, 'IQ_FW2') + " \
     256               ," + self.safeDictionaryAccess(header, 'APMIFIT') + " \
     257               ," + self.safeDictionaryAccess(header, 'DAPMIFIT') + " \
     258               ,'" + self.safeDictionaryAccess(header, 'DETECTOR') + "' \
     259               ," + str(self.scratchDb.getDvoImageFlags(header['SOURCEID'], header['IMAGEID'])) + " \
     260               ,'" + self.safeDictionaryAccess(header, 'DETREND.MASK') + "' \
     261               ,'" + self.safeDictionaryAccess(header, 'DETREND.DARK') + "' \
     262               ,'" + self.safeDictionaryAccess(header, 'DETREND.FLAT') + "' \
     263               ,' ' \
     264               ,' ' \
     265               ,' ' \
     266               ,' ' \
     267               ,' ' \
     268               ," + self.safeDictionaryAccess(self.header, 'ZPT_OBS') + " \
     269               ,'" + self.safeDictionaryAccess(header, 'CTYPE1') + "' \
     270               ,'" + self.safeDictionaryAccess(header, 'CTYPE2') + "' \
     271               ," + self.safeDictionaryAccess(header, 'CRVAL1') + " \
     272               ," + self.safeDictionaryAccess(header, 'CRVAL2') + " \
     273               ," + self.safeDictionaryAccess(header, 'CRPIX1') + " \
     274               ," + self.safeDictionaryAccess(header, 'CRPIX2') + " \
     275               ," + self.safeDictionaryAccess(header, 'CDELT1') + " \
     276               ," + self.safeDictionaryAccess(header, 'CDELT2') + " \
     277               ," + self.safeDictionaryAccess(header, 'PC001001') + " \
     278               ," + self.safeDictionaryAccess(header, 'PC001002') + " \
     279               ," + self.safeDictionaryAccess(header, 'PC002001') + " \
     280               ," + self.safeDictionaryAccess(header, 'PC002002') + " \
     281               ," + self.safeDictionaryAccess(header, 'NPLYTERM') + " \
     282               ," + self.safeDictionaryAccess(header, 'PCA1X3Y0') + " \
     283               ," + self.safeDictionaryAccess(header, 'PCA1X2Y1') + " \
     284               ," + self.safeDictionaryAccess(header, 'PCA1X1Y2') + " \
     285               ," + self.safeDictionaryAccess(header, 'PCA1X0Y3') + " \
     286               ," + self.safeDictionaryAccess(header, 'PCA1X2Y0') + " \
     287               ," + self.safeDictionaryAccess(header, 'PCA1X1Y1') + " \
     288               ," + self.safeDictionaryAccess(header, 'PCA1X0Y2') + " \
     289               ," + self.safeDictionaryAccess(header, 'PCA2X3Y0') + " \
     290               ," + self.safeDictionaryAccess(header, 'PCA2X2Y1') + " \
     291               ," + self.safeDictionaryAccess(header, 'PCA2X1Y2') + " \
     292               ," + self.safeDictionaryAccess(header, 'PCA2X0Y3') + " \
     293               ," + self.safeDictionaryAccess(header, 'PCA2X2Y0') + " \
     294               ," + self.safeDictionaryAccess(header, 'PCA2X1Y1') + " \
     295               ," + self.safeDictionaryAccess(header, 'PCA2X0Y2') + " \
    228296               )"
    229         self.localStmt.execute(sql)
    230         self.updateFilterID(tableName)
     297
     298        self.scratchDb.stmt.execute(sql)
     299        self.scratchDb.updateFilterID(tableName, self.filter)
     300        self.scratchDb.updateAllRows(tableName, "calibModNum", str(self.calibModNum))
     301        self.scratchDb.updateAllRows(tableName, "dataRelease", str(self.dataRelease))
     302        self.totalNumPhotoRef = self.totalNumPhotoRef + int(header['NASTRO'])
    231303
    232304    '''
     
    236308
    237309        tableName = "Detection_" + ota
    238         self.log("   Dealing with table " + tableName)
     310        self.logger.info("   Dealing with table " + tableName)
    239311       
    240312        # drop then re-create table
    241         self.dropTable(tableName)
     313        self.scratchDb.dropTable(tableName)
    242314        sql = "CREATE TABLE " + tableName + " LIKE Detection"
    243         try: self.localStmt.execute(sql)
     315        try: self.scratchDb.stmt.execute(sql)
    244316        except: pass
    245317
     
    251323               ,xPosErr \
    252324               ,yPosErr \
     325               ,instFlux \
     326               ,instFluxErr \
     327               ,peakADU \
    253328               ,psfWidMajor \
    254329               ,psfWidMinor \
     
    258333               ,momentXY \
    259334               ,momentYY \
     335               ,apMag \
     336               ,infoFlag \
    260337               ,sky \
    261338               ,skyErr \
     
    268345               ,X_PSF_SIG \
    269346               ,Y_PSF_SIG \
     347               ,POW(10.0, (-0.4*PSF_INST_MAG)) / "+self.header['EXPTIME']+" \
     348               ,ABS((PSF_INST_MAG_SIG*(POW(10.0, (-0.4*PSF_INST_MAG)) / "+self.header['EXPTIME']+")) / 1.085736) \
     349               ,POW(10.0, (-0.4*PEAK_FLUX_AS_MAG)) / "+self.header['EXPTIME']+" \
    270350               ,PSF_MAJOR \
    271351               ,PSF_MINOR \
     
    275355               ,MOMENTS_XY \
    276356               ,MOMENTS_YY \
     357               ,AP_MAG \
     358               ,FLAGS\
    277359               ,SKY \
    278360               ,SKY_SIGMA \
     
    280362               FROM " + ota + "_psf"
    281363
    282         self.localStmt.execute(sql)
    283 
    284         self.updateSurveyID(tableName)
    285         self.updateFilterID(tableName)
    286 
    287         # now add DVO IDs
    288         self.updateDvoIDs(tableName)
     364        self.scratchDb.stmt.execute(sql)
     365
     366        # set obsTime
     367        sql = "UPDATE " + tableName + " SET obsTime = %f, assocDate = '%s', activeFlag = 0" % (self.obsTime, self.dateStr)
     368        self.scratchDb.stmt.execute(sql)
     369        self.scratchDb.updateAllRows(tableName, "dataRelease", str(self.dataRelease))
     370        self.scratchDb.updateAllRows(tableName, "historyModNum", "0")
     371
     372        self.scratchDb.updateAllRows(tableName, "surveyID", str(self.surveyID))
     373        self.scratchDb.updateFilterID(tableName, self.filter)
     374
     375        # now delete bad flux
     376        self.scratchDb.reportAndDeleteRowsWithNULLS(tableName, "instFlux")
     377        self.scratchDb.reportAndDeleteRowsWithNULLS(tableName, "peakADU")
    289378
    290379    '''
     
    294383
    295384        tableName = "SkinnyObject_" + ota
    296         self.log("   Dealing with table " + tableName)
     385        self.logger.info("   Dealing with table " + tableName)
    297386       
    298387        # drop then re-create table
    299         self.dropTable(tableName)
     388        self.scratchDb.dropTable(tableName)
    300389        sql = "CREATE TABLE " + tableName + " LIKE SkinnyObject"
    301         try: self.localStmt.execute(sql)
     390        try: self.scratchDb.stmt.execute(sql)
    302391        except: pass
    303392
     
    313402               ,surveyID \
    314403               FROM Detection_" + ota
    315         self.localStmt.execute(sql)
     404        self.scratchDb.stmt.execute(sql)
     405
     406        self.scratchDb.updateAllRows(tableName, "dataRelease", str(self.dataRelease))
    316407
    317408    '''
     
    321412
    322413        tableName = "ObjectCalColor_" + ota
    323         self.log("   Dealing with table " + tableName)
     414        self.logger.info("   Dealing with table " + tableName)
    324415       
    325416        # drop then re-create table
    326         self.dropTable(tableName)
     417        self.scratchDb.dropTable(tableName)
    327418        sql = "CREATE TABLE " + tableName + " LIKE ObjectCalColor"
    328         try: self.localStmt.execute(sql)
     419        try: self.scratchDb.stmt.execute(sql)
    329420        except: pass
    330421
     
    340431               ,filterID \
    341432               FROM Detection_" + ota
    342         self.localStmt.execute(sql)
    343 
    344 
    345     '''
    346     Applies indexes to the PSPS tables
     433        self.scratchDb.stmt.execute(sql)
     434
     435        self.scratchDb.updateAllRows(tableName, "calibModNum", str(self.calibModNum))
     436        self.scratchDb.updateAllRows(tableName, "dataRelease", str(self.dataRelease))
     437
     438
     439    '''
     440    Applies indexes to the PSPS tables TODO need this?
    347441    '''
    348442    def indexPspsTables(self):
    349443
    350         self.log("Creating indexes on PSPS tables")
     444        self.logger.info("Creating indexes on PSPS tables")
    351445#        self.createIndex("StackDetection", "ippDetectID")
    352446 #       self.createIndex("StackApFlx", "ippDetectID")
     
    358452    def indexIppTables(self):
    359453
    360         self.log("Creating indexes on IPP tables")
    361 
    362         for x in range(0,8):
    363             for y in range(0,8):
     454        self.logger.info("Creating indexes on IPP tables")
     455
     456        for x in range(self.startX, self.endX):
     457            for y in range(self.startY, self.endY):
    364458
    365459                # dodge the corners
     
    370464
    371465                extension = "XY%d%d_psf" % (x, y)
    372                 self.createIndex(extension, "IPP_IDET")
    373 
    374     '''
    375     Overriden from Batch class
     466                self.scratchDb.createIndex(extension, "IPP_IDET")
     467
     468    '''
    376469    Updates provided table with DVO IDs from DVO table
    377470    '''
    378     def updateDvoIDs(self, table):
     471    def updateDvoIDs(self, table, sourceID, imageID):
    379472
    380473        self.logger.info("Updating table '" + table + "' with DVO IDs...")
     
    382475               a.ippObjID = b.ippObjID, \
    383476               a.detectID = b.detectID, \
    384                a.objID = b.objID \
    385                WHERE a.ippDetectID = b.ippDetectID"
    386         self.localStmt.execute(sql)
     477               a.objID = b.objID, \
     478               a.infoFlag = b.flags << 32 | a.infoFlag \
     479               WHERE a.ippDetectID = b.ippDetectID \
     480               AND b.sourceID = " + str(sourceID) + " \
     481               AND b.imageID = " + str(imageID)
     482
     483        self.scratchDb.stmt.execute(sql)
    387484        self.logger.info("...done")
    388485
     
    392489    '''
    393490    def populatePspsTables(self):
    394 
    395491
    396492        # get filterID using init table
     
    398494
    399495        self.populateFrameMeta()
    400 
    401         for x in range(3, 4):
    402             for y in range(3, 4):
     496     
     497        # dictionary objects to hold sourceIDs and imageIDs for later
     498        sourceIDs = {}
     499        imageIDs = {}
     500
     501        file = open(self.inputFitsPath, 'r')
     502
     503        # loop through all OTAs and populate ImageMeta extensions
     504        for x in range(self.startX, self.endX):
     505            for y in range(self.startY, self.endY):
    403506               
    404507                # dodge the corners
     
    411514               
    412515                # load corresponding header into memory
    413                 header = self.findAndReadFITSHeader(ota + ".hdr")
    414                 self.getIDsFromDVO(header['SOURCEID'], header['IMAGEID'])
    415  
     516                header = self.findAndReadFITSHeader(ota + ".hdr", file)
     517
     518                # store sourceID/imageID combo in Db so DVO can look up later
     519                self.scratchDb.insertNewDvoImage(header['SOURCEID'], header['IMAGEID'])
     520
     521                # store these for later
     522                sourceIDs[ota] = header['SOURCEID']
     523                imageIDs[ota] = header['IMAGEID']
     524
     525                # populate ImageMeta
    416526                self.populateImageMetaTable(ota, header)
     527                self.updateImageID("ImageMeta_" + ota, x, y)
     528             
     529        # now run DVO code to get all IDs
     530        self.getIDsFromDVO()
     531
     532        # loop through all OTAs again to update with DVO IDs
     533        self.tablesToExport = []   
     534        self.tablesToExport.append("FrameMeta")
     535        tables = []   
     536        otaCount = 0
     537        for x in range(self.startX, self.endX):
     538            for y in range(self.startY, self.endY):
     539               
     540                # dodge the corners
     541                if x==0 and y==0: continue
     542                if x==0 and y==7: continue
     543                if x==7 and y==0: continue
     544                if x==7 and y==7: continue
     545
     546                ota = "XY%d%d" % (x, y)
     547
     548                # populate remainder of tables
    417549                self.populateDetectionTable(ota)
     550
     551                # now add DVO IDs
     552                self.updateDvoIDs("Detection_" + ota, sourceIDs[ota], imageIDs[ota])
     553
     554                # check we have something in this Detection table
     555                if self.scratchDb.getRowCount("Detection_" + ota) < 1:
     556                    self.logger.info("Empty tables for ota " + ota + ". Skipping.")
     557                    continue;
     558
     559                self.scratchDb.reportAndDeleteRowsWithNULLS("Detection_" + ota, "objID")
     560                self.updateImageID("Detection_" + ota, x, y)
     561               
     562                # update ImageMeta with count of detections for this OTA and photoCodeID
     563                sql = "UPDATE ImageMeta_" + ota + " SET nDetect = %d, photoCalID = %d" % (self.scratchDb.getRowCount("Detection_" + ota), self.scratchDb.getPhotoCalID(header['SOURCEID'], header['IMAGEID']))
     564                self.scratchDb.stmt.execute(sql)
     565
    418566                self.populateSkinnyObjectTable(ota)
    419567                self.populateObjectCalColorTable(ota)
    420568
    421 
    422         #self.setMinMaxObjID(tableName) # TODO set based on all tables
     569                # add these to list of tables to export later
     570                self.tablesToExport.append("ImageMeta_" + ota)
     571                self.tablesToExport.append("Detection_" + ota)
     572                self.tablesToExport.append("SkinnyObject_" + ota)
     573                self.tablesToExport.append("ObjectCalColor_" + ota)
     574                tables.append("Detection_" + ota)
     575           
     576                otaCount = otaCount + 1
     577
     578        self.setMinMaxObjID(tables)
     579
     580        # update FrameMeta with count OTAs in this file and total number of photometric reference sources
     581        sql = "UPDATE FrameMeta SET nOTA = %d, numPhotoRef = %d" % (otaCount, self.totalNumPhotoRef)
     582        self.scratchDb.stmt.execute(sql)
     583       
     584        return True
     585
     586    '''
     587    Updates imageID {EXP_ID}{OTA} in the provided table
     588    '''
     589    def updateImageID(self, tableName, x, y):
     590
     591        sql = "UPDATE " + tableName + " SET imageID = %d%d%d" % (self.expID, x, y)
     592        self.scratchDb.stmt.execute(sql)
     593
    423594
    424595
     
    430601        # loops round all imported tables, but we want to check one OTA's worth
    431602        for table in self.pspsTables:
    432             if table.name == "FrameMeta": self.reportNulls(table.name, showPartials)
    433             else: self.reportNulls(table.name + "_XY33", showPartials)
     603            if table.name == "FrameMeta": self.scratchDb.reportNulls(table.name, showPartials)
     604            else: self.scratchDb.reportNulls(table.name + "_XY33", showPartials)
    434605
    435606
     
    438609logger.info("Starting")
    439610
    440 expID = 230033;
    441 inputFile = "detdemo.fits"
    442 detectionBatch = DetectionBatch(logger, expID, inputFile)
    443 detectionBatch.createEmptyPspsTables()
    444 detectionBatch.importIppTables("XY33\.psf")
    445 detectionBatch.populatePspsTables()
    446 detectionBatch.exportPspsTablesToFits()
    447 detectionBatch.writeBatchManifest()
    448 detectionBatch.reportNullsInAllPspsTables(False)
    449 
    450 
     611gpc1Db = Gpc1Db(logger)
     612camIDs = gpc1Db.getIDsInThisDVODbForThisStage("MD04.V2", "cam")
     613#camIDs = gpc1Db.getIDsInThisDVODbForThisStage("ThreePi.V1", "cam")
     614
     615logger.info("Found %d exposures" % len(camIDs))
     616
     617i = 0
     618for camID in camIDs:
     619
     620    file = gpc1Db.getCameraStageSmf(camID)
     621    #file = "detdemo.fits"
     622    detectionBatch = DetectionBatch(logger, camID, file, True)
     623    detectionBatch.createEmptyPspsTables()
     624    detectionBatch.importIppTables("XY33\.psf")
     625    if detectionBatch.populatePspsTables():
     626        detectionBatch.exportPspsTablesToFits()
     627        detectionBatch.writeBatchManifest()
     628        detectionBatch.reportNullsInAllPspsTables(False)
     629
     630    i = i+1
     631    if i > 0: break
     632
Note: See TracChangeset for help on using the changeset viewer.