IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 29, 2015, 4:10:00 PM (11 years ago)
Author:
eugene
Message:

poisoned jython/dvodetections.py and jython/dvoforceddetections.py which are not used any more; added jython/dvoforcedgalaxy.py; cleaned up jython/dvoforcedobjects.py, jython/forcedgalaxybatch.py, jython/forcedobjectbatch.py

File:
1 edited

Legend:

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

    r38965 r39007  
    7070        self.logger.infoPair("DVO INDEX", "%d" % self.id)
    7171
    72 
    7372    '''
    7473    Overriden from batch base class to import directly from DVO for forced galaxy shape parameters
     
    109108        return True
    110109
    111 
    112110    '''
    113111    Applies indexes to the IPP Tables
     
    120118    '''
    121119    def updatePspsUniqueIDs(self):
    122         sql = "UPDATE ForcedGalaxyShape set uniquePspspFGid = (("+str(self.batchID)+"*1000000000 ) + row)"
    123         try: self.scratchDb.execute(sql)
    124         except:
    125             self.logger.errorPair('failed sql', sql)
    126             raise
     120        sql = "UPDATE ForcedGalaxyShape set uniquePspsFGid = (("+str(self.batchID)+"*1000000000 ) + row)"
     121        self.scratchDb.execute(sql)
    127122
    128123    '''
     
    145140
    146141            # This is going to need to join elsewhere to get all the fields?
    147             # XippDetectID, XforcedSummaryID
    148             # Ra, Dec, RaErr, DecErr
    149            
    150             # This won't work, as we need to join on modeltype/obj_id/filter
    151 #                + cpqTable + " AS cpq ON (cpq.row = (ForcedGalaxyShape.row* " + str(filterCount) + ")-(" + str(filterCount) + " - " + str(filter[0]) + ")) " \
    152 #                + " ForcedGalaxyShape." + filter[1] + "GalModelType               = MODEL_TYPE," \
    153 
     142            # XforcedSummaryID, Ra, Dec, RaErr, DecErr
    154143            # Should GalChiSq fold in Npix somehow?
    155 #             sql = "UPDATE ForcedGalaxyShape JOIN " \
    156 #                + cpqTable + " AS cpq ON (cpq.row = (ForcedGalaxyShape.row* " + str(filterCount) + ")-(" + str(filterCount) + " - " + str(filter[0]) + ")) " \
    157 #                 + " SET " + \
    158 #                 + " ForcedGalaxyShape." + filter[1] + "ippDetectID                = DET_ID," \
    159 #                 + " ForcedGalaxyShape." + filter[1] + "forcedSummaryID            = IMAGE_ID," \
    160 #                 + " ForcedGalaxyShape." + filter[1] + "GalMajor                   = MAJOR_AXIS," \
    161 #                 + " ForcedGalaxyShape." + filter[1] + "GalMajorErr                = MAJOR_AXIS_ERR," \
    162 #                 + " ForcedGalaxyShape." + filter[1] + "GalMinor                   = MINOR_AXIS," \
    163 #                 + " ForcedGalaxyShape." + filter[1] + "GalMinorErr                = MINOR_AXIS_ERR," \
    164 #                 + " ForcedGalaxyShape." + filter[1] + "GalMag                     = MAG," \
    165 #                 + " ForcedGalaxyShape." + filter[1] + "GalMagErr                  = MAG_ERR," \
    166 #                 + " ForcedGalaxyShape." + filter[1] + "GalRa                      = RA," \
    167 #                 + " ForcedGalaxyShape." + filter[1] + "GalDec                     = DEC," \
    168 #                 + " ForcedGalaxyShape." + filter[1] + "GalRaErr                   = RA_ERR," \
    169 #                 + " ForcedGalaxyShape." + filter[1] + "GalDecErr                  = DEC_ERR," \
    170 #                 + " ForcedGalaxyShape." + filter[1] + "GalChisq                   = CHISQ "
    171144
    172145            sqlLine = sqlUtility("UPDATE ForcedGalaxyShape AS a, " + cpqTable + " AS b SET")
     
    179152            sqlLine.group("a." + filter[1] + "GalMag",          "b.MAG")
    180153            sqlLine.group("a." + filter[1] + "GalMagErr",       "b.MAG_ERR")
    181 # These fields don't exist.
    182 #            sqlLine.group("a." + filter[1] + "GalRa",           "b.RA")
    183 #            sqlLine.group("a." + filter[1] + "GalDec",          "b.DEC")
    184 #            sqlLine.group("a." + filter[1] + "GalRaErr",        "b.RA_ERR")
    185 #            sqlLine.group("a." + filter[1] + "GalDecErr",       "b.DEC_ERR")
    186154            sqlLine.group("a." + filter[1] + "GalChisq",        "b.CHISQ")
     155
     156            # These fields don't exist.
     157            # sqlLine.group("a." + filter[1] + "GalRa",           "b.RA")
     158            # sqlLine.group("a." + filter[1] + "GalDec",          "b.DEC")
     159            # sqlLine.group("a." + filter[1] + "GalRaErr",        "b.RA_ERR")
     160            # sqlLine.group("a." + filter[1] + "GalDecErr",       "b.DEC_ERR")
     161
    187162            sql = sqlLine.makeEquals("WHERE a.objID = b.OBJ_ID AND a.galModelType = b.MODEL_TYPE AND b.Photcode = " + photcode)
    188            
    189 
    190             try: self.scratchDb.execute(sql)
    191             except:
    192                 self.logger.errorPair("failed update ForcedGalaxyShape", sql)
    193                 raise
    194 
    195        
    196 
    197 
    198     '''
    199     Populate ForcedGalaxyShape table
     163
     164            self.scratchDb.execute(sql)
     165
     166    '''
     167    Populate ForcedGalaxyShape table with basic IDs
    200168    '''
    201169    def populateForcedGalaxyShapeTable(self):
     
    212180        # uniquePspsFGid is set elsewhere
    213181        sqlLine.group("ippObjID",   "OBJ_ID + (CAT_ID << 32)")
    214         # batchID isn't in the schema.
    215 #        sqlLine.group("batchID",    "'" + str(self.batchID) + "'")
     182        # batchID isn't in the schema, should it be?
     183        # sqlLine.group("batchID",    "'" + str(self.batchID) + "'")
    216184        # surveyID is set where?
    217185        sqlLine.group("randomForcedGalID",      "RAND("+str(self.batchID)+")")
     
    219187        sql = sqlLine.makeRaw(") SELECT ", " FROM " + cptTableName)
    220188
    221         try:
    222             self.scratchDb.execute(sql)
    223         except:
    224             self.logger.errorPair("Couldn't populate Forced Galaxy table from cpt", sql)
    225             raise
     189        self.scratchDb.execute(sql)
    226190
    227191        self.logger.infoPair("Adding 'row' columns to", "Forced Galaxy, cpt tables")
     
    234198        self.logger.infoPair("update ForcedGalaxyShape from ","cpq table")
    235199        self.updateForcedGalaxyShapeFromCpq(cpqTableName)
    236 
    237200       
    238201        self.logger.infoPair("Dropping row column from ", "ForcedGalaxyShape table")
     
    242205        self.setMinMaxObjID(["ForcedGalaxyShape"])
    243206        self.logger.infoPair("checking if we have detections", "ForcedGalaxyShape table")
     207
    244208        rowcount = self.scratchDb.getRowCount("ForcedGalaxyShape")
     209
    245210        if rowcount == 0:
    246211            self.logger.infoPair("skipping this one", "ForcedGalaxyShape")
     
    256221       
    257222        if not self.populateForcedGalaxyShapeTable(): return False
    258 
    259         # My example is removing objID duplicates.  Since ForcedGalaxyShape can have multiple models for a given object, I'm not doing that.
    260 
Note: See TracChangeset for help on using the changeset viewer.