IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36711


Ignore:
Timestamp:
Apr 30, 2014, 9:40:55 PM (12 years ago)
Author:
heather
Message:

work on stackbatch - all filters at once

Location:
trunk/ippToPsps/jython
Files:
2 edited

Legend:

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

    r36709 r36711  
    504504    joined to the dvodb
    505505    '''
    506     def getStackIDsFromSkyID(self,dvoDb,skyID,filter):
     506    def getStackIDFromSkyIDAndFilter(self,dvoDb,skyID,filter):
    507507
    508508        self.logger.infoPair("finding stack_ids from gpc1 for sky_id ", skyID)
     
    533533            self.logger.exception("can't query for stackid in DVO")
    534534            self.logger.infoPair("failed sql:", sql)
    535             return rows
     535            return -999
    536536
    537537        self.logger.infoPair("number of stackIDs found ", len(rows))
  • trunk/ippToPsps/jython/stackbatch.py

    r36709 r36711  
    5959       self.logger.infoPair("did I get", "here");
    6060       self.stackType = "DEEP_STACK" # TODO
     61       ## = stuff I commented out for pv2 stacks
     62       
     63       #heather tasks
     64
     65       # get a list of stackIDs
     66       self.logger.infoPair ("getting stackID for: ","g.00000")
     67       self.gstackID = getStackIDFromSkyIDAndFilter( skychunk.dvoLabel, skyID, "g.00000")
     68       self.logger.infoPair ("getting stackID for: ","r.00000")
     69       self.rstackID = getStackIDFromSkyIDAndFilter( skychunk.dvoLabel, skyID, "r.00000")
     70       self.logger.infoPair ("getting stackID for: ","i.00000")
     71       self.istackID = getStackIDFromSkyIDAndFilter( skychunk.dvoLabel, skyID, "i.00000")
     72       self.logger.infoPair ("getting stackID for: ","z.00000")
     73       self.zstackID = getStackIDFromSkyIDAndFilter( skychunk.dvoLabel, skyID, "z.00000")
     74       self.logger.infoPair ("getting stackID for: ","y.00000")
     75       self.ystackID = getStackIDFromSkyIDAndFilter( skychunk.dvoLabel, skyID, "y.00000")
     76 
     77       # from each stackget fits name from getStackStageCmf
     78       self.logger.infoPair ("finding fits file for: ","g.00000")
     79       self.gfits = getStackStageCmf(skychunk.dvoLabel, gstackID)
     80       self.logger.infoPair ("finding fits file for: ","r.00000")
     81       self.rfits = getStackStageCmf(skychunk.dvoLabel, rstackID)
     82       self.logger.infoPair ("finding fits file for: ","i.00000")
     83       self.ifits = getStackStageCmf(skychunk.dvoLabel, istackID)
     84       self.logger.infoPair ("finding fits file for: ","z.00000")
     85       self.zfits = getStackStageCmf(skychunk.dvoLabel, zstackID)
     86       self.logger.infoPair ("finding fits file for: ","y.00000")
     87       self.yfits = getStackStageCmf(skychunk.dvoLabel, ystackID)
     88
     89       #from each of those get self.gheader, self.rheader, etc.
     90
     91       if self.gfits:
     92           self.gheader = self.gfits.getPrimaryHeader()
     93       if not self.gheader:
     94           self.logger.errorPair("could not read FITS PHU for ",gstackID)
     95           raise
     96
     97       if self.rfits:
     98           self.rheader = self.rfits.getPrimaryHeader()
     99       if not self.rheader:
     100           self.logger.errorPair("could not read FITS PHU for ",rstackID)
     101           raise
     102
     103       if self.ifits:
     104           self.iheader = self.ifits.getPrimaryHeader()
     105       if not self.iheader:
     106           self.logger.errorPair("could not read FITS PHU for ",istackID)
     107           raise
     108
     109       if self.zfits:
     110           self.zheader = self.zfits.getPrimaryHeader()
     111       if not self.zheader:
     112           self.logger.errorPair("could not read FITS PHU for ",zstackID)
     113           raise
     114
     115       if self.yfits:
     116           self.yheader = self.yfits.getPrimaryHeader()
     117       if not self.yheader:
     118           self.logger.errorPair("could not read FITS PHU for ",ystackID)
     119           raise
    61120
    62121       # get stack meta data
    63        meta = self.gpc1Db.getStackStageMeta(self.id)
     122       meta = self.gpc1Db.getStackStageMeta(self.gstackID) 
     123       ## this should be ok - it takes a stack_id and returns filter/skycell etc.
     124
     125
    64126       if not meta:
    65127           self.logger.errorPair("Could not get stack", "metadata")
    66128           raise
    67129
    68        self.filter = meta[0];
    69        self.filter = self.filter[0:1]
    70        self.filterID = self.scratchDb.getFilterID(self.filter)
     130       ##self.filter = meta[0];
     131       ##self.filter = self.filter[0:1]
     132       ##self.filterID = self.scratchDb.getFilterID(self.filter)
    71133       self.skycell = meta[1];
    72134
     
    92154       # self.skycell = str( (tessID * (10000 * 1000)) + (int(self.projectioncell) * 1000) + cellID )
    93155
    94        self.analysisVer = meta[2];
     156       ##self.analysisVer = meta[2];
    95157
    96158       #self.expTime = gpc1Db.getStackExpTime(self.id)
    97        self.expTime = self.header['EXPTIME']
     159       ##self.expTime = self.header['EXPTIME']
    98160
    99161       # delete PSPS tables
    100        self.scratchDb.dropTable("StackMeta")
     162       self.scratchDb.dropTable("gStackMeta")
     163       self.scratchDb.dropTable("rStackMeta")
     164       self.scratchDb.dropTable("iStackMeta")
     165       self.scratchDb.dropTable("zStackMeta")
     166       self.scratchDb.dropTable("yStackMeta")
     167
    101168       self.scratchDb.dropTable("StackObject")
    102169       self.scratchDb.dropTable("StackModelFit")
     
    105172             # self.testprint()
    106173
     174       # for PV2 we will have (grizy) of stack meta and skychip     
     175
     176
    107177       # delete IPP tables
    108        self.scratchDb.dropTable("SkyChip_psf")
    109        self.scratchDb.dropTable("SkyChip_xrad")
    110        self.scratchDb.dropTable("SkyChip_xfit")
    111        self.scratchDb.dropTable("SkyChip_xsrc")
     178       self.scratchDb.dropTable("gSkyChip_psf")
     179       self.scratchDb.dropTable("gSkyChip_xrad")
     180       self.scratchDb.dropTable("gSkyChip_xfit")
     181       self.scratchDb.dropTable("gSkyChip_xsrc")
     182       self.scratchDb.dropTable("rSkyChip_psf")
     183       self.scratchDb.dropTable("rSkyChip_xrad")
     184       self.scratchDb.dropTable("rSkyChip_xfit")
     185       self.scratchDb.dropTable("rSkyChip_xsrc")
     186       self.scratchDb.dropTable("iSkyChip_psf")
     187       self.scratchDb.dropTable("iSkyChip_xrad")
     188       self.scratchDb.dropTable("iSkyChip_xfit")
     189       self.scratchDb.dropTable("iSkyChip_xsrc")
     190       self.scratchDb.dropTable("zSkyChip_psf")
     191       self.scratchDb.dropTable("zSkyChip_xrad")
     192       self.scratchDb.dropTable("zSkyChip_xfit")
     193       self.scratchDb.dropTable("zSkyChip_xsrc")
     194       self.scratchDb.dropTable("ySkyChip_psf")
     195       self.scratchDb.dropTable("ySkyChip_xrad")
     196       self.scratchDb.dropTable("ySkyChip_xfit")
     197       self.scratchDb.dropTable("ySkyChip_xsrc")
    112198
    113199       # create an output filename, which is {stackID}.FITS
     
    119205
    120206       # insert what we know about this stack batch into the stack table
    121        self.ippToPspsDb.insertStackMeta(self.batchID, self.filter, self.stackType)
     207       self.ippToPspsDb.insertStackMeta(self.batchID, "grizy" , self.stackType)
    122208
    123209       # insert sourceID/imageID combo so DVO can look it up
    124        if not self.useFullTables:
    125            self.scratchDb.insertNewDvoExternID(self.header['SOURCEID'], self.header['IMAGEID'])
     210       ##if not self.useFullTables:
     211       ##    self.scratchDb.insertNewDvoExternID(self.header['SOURCEID'], self.header['IMAGEID'])
    126212
    127213       # self.testprint()
     
    132218       self.logger.infoPair("Skycell", "%s" % self.skycell)
    133219       self.logger.infoPair("Projectioncell", "%s" % self.projectioncell)
    134        self.logger.infoPair("Filter", "%s" % self.filter)
     220       ##self.logger.infoPair("Filter", "%s" % self.filter)
    135221
    136222    '''
     
    9221008     
    9231009        # HAF everything is commented out for now with ##
    924         ##if not self.useFullTables:
    925         ##     if not self.getIDsFromDVO():
    926         ##        return False
    927         ##self.logger.infoPair("populating","StackMeta")   
    928         ##self.populateStackMeta()
     1010        if not self.useFullTables:
     1011             if not self.getIDsFromDVO():
     1012                return False
     1013        self.logger.infoPair("populating","gStackMeta")   
     1014        self.populateStackMeta("g.00000")
     1015        self.logger.infoPair("populating","rStackMeta")   
     1016        self.populateStackMeta("r.00000")
     1017        self.logger.infoPair("populating","iStackMeta")   
     1018        self.populateStackMeta("i.00000")
     1019        self.logger.infoPair("populating","zStackMeta")   
     1020        self.populateStackMeta("z.00000")
     1021        self.logger.infoPair("populating","yStackMeta")   
     1022        self.populateStackMeta("y.00000")
     1023
    9291024        ##self.logger.infoPair("populating","StackObject")
    9301025        ##self.populateStackObject()
Note: See TracChangeset for help on using the changeset viewer.