IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39007


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

Location:
trunk/ippToPsps/jython
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/jython/Makefile.am

    r38969 r39007  
    1717  dvoforceddetections.py \
    1818  dvoforcedobjects.py \
     19  dvoforcedgalaxy.py \
    1920  dvoobjects.py \
    2021  dvo.py \
  • trunk/ippToPsps/jython/dvodetections.py

    r38883 r39007  
    1414'''
    1515A class for ingesting DVO detections into MySQL
     16XXX EAM 20151029 : I do not believe this class is used at all.  I am poisoning it with an exit
    1617'''
    1718class DvoDetections(Dvo):
     
    2122    '''
    2223    def __init__(self, logger, config, skychunk, ippToPspsDb, scratchDb, gpc1Db):
    23 #   def __init__(self, logger, config, skychunk, ippToPspsDb, scratchDb):
    24 
     24       
    2525        super(DvoDetections, self).__init__(logger, config, skychunk, ippToPspsDb, scratchDb, gpc1Db)
    26 #       super(DvoDetections, self).__init__(logger, config, skychunk, ippToPspsDb, scratchDb)
     26        print "----- DvoDetections is not used, is it?? -----"
     27        os._exit(1)
    2728
    2829        # declare DVO file types of interest
  • trunk/ippToPsps/jython/dvoforceddetections.py

    r38883 r39007  
    1414'''
    1515A class for ingesting DVO detections into MySQL
     16XXX EAM 20151029 : I do not believe this class is used at all.  I am poisoning it with an exit
    1617'''
    1718class DvoForcedDetections(Dvo):
     
    2122    '''
    2223    def __init__(self, logger, config, skychunk, ippToPspsDb, scratchDb, gpc1Db):
    23 #   def __init__(self, logger, config, skychunk, ippToPspsDb, scratchDb):
    2424
    2525        super(DvoForcedDetections, self).__init__(logger, config, skychunk, ippToPspsDb, scratchDb, gpc1Db)
    26 #       super(DvoForcedDetections, self).__init__(logger, config, skychunk, ippToPspsDb, scratchDb)
     26        print "----- DvoDetections is not used, is it?? -----"
     27        os._exit(1)
    2728
    2829        # declare DVO file types of interest
  • trunk/ippToPsps/jython/dvoforcedobjects.py

    r38883 r39007  
    2121    '''
    2222    def __init__(self, logger, config, skychunk, ippToPspsDb, scratchDb, gpc1Db):
    23 #   def __init__(self, logger, config, skychunk, ippToPspsDb, scratchDb):
    2423
    2524        super(DvoForcedObjects, self).__init__(logger, config, skychunk, ippToPspsDb, scratchDb, gpc1Db)
    26 #       super(DvoForcedObjects, self).__init__(logger, config, skychunk, ippToPspsDb, scratchDb)
    2725
    2826        # declare DVO file types of interest
    29         self.ingestFileTypes = ['cpt', 'cps', 'cpy']
    3027        self.loadPhotcodes()
    3128
  • 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 
  • trunk/ippToPsps/jython/forcedobjectbatch.py

    r38884 r39007  
    114114        return True
    115115
    116 
    117116    '''
    118117    Updates table and generates pspsuniqueids
     
    125124            self.logger.errorPair('failed sql',sql)
    126125            raise
    127 
    128 
    129 
    130126
    131127    '''
     
    195191                   SET " + filter[1] + "PSFMagErr = null \
    196192                   WHERE " + filter[1] + "PSFMagErr > " + str(cut)
    197 # taking out the cut since this is for mag, not flux
    198 
    199     #       try: self.scratchDb.execute(sql)
    200      #       except:
    201      #           self.logger.errorPair("failed setting null meanmagerr","ForcedMeanObject")
    202      #           raise
     193
     194            # NOTE: taking out the cut since this is for mag, not flux
     195            # try: self.scratchDb.execute(sql)
     196            # except:
     197            # self.logger.errorPair("failed setting null meanmagerr","ForcedMeanObject")
     198            # raise
     199
    203200        self.logger.infoPair("Calculating nDetections from", "n[filters]")
    204201        for filter in filters:
     
    275272                   " + cpyTable + " AS cpy ON (cpy.row = (ForcedMeanLensing.row* " + str(filterCount) + ")-(" + str(filterCount) + " - " + str(filter[0]) + ")) \
    276273                   SET \
    277                    ForcedMeanLensing." + filter[1] + "LensObjSmearX11 =  X11_SM_OBJ \
     274                   ForcedMeanLensing."  + filter[1] + "LensObjSmearX11 =  X11_SM_OBJ \
    278275                   ,ForcedMeanLensing." + filter[1] + "LensObjSmearX12 =  X12_SM_OBJ \
    279276                   ,ForcedMeanLensing." + filter[1] + "LensObjSmearX22 =  X22_SM_OBJ \
     
    321318        sqlLine = sqlUtility("INSERT INTO ForcedMeanObject (")
    322319
    323         sqlLine.group("objID",           "EXT_ID")
    324         sqlLine.group("ippObjID",        "OBJ_ID + (CAT_ID << 32)") # NOTE: shift by 32 bits exactly
    325         sqlLine.group("batchID",         "'" + str(self.batchID) + "'")
    326         sqlLine.group("randomForcedObjID",        "RAND("+str(self.batchID)+")")
    327         sqlLine.group("nDetections",      "'0'")
    328         sqlLine.group("processingVersion",   str(self.skychunk.processingVersion))
     320        sqlLine.group("objID",             "EXT_ID")
     321        sqlLine.group("ippObjID",          "OBJ_ID + (CAT_ID << 32)") # NOTE: shift by 32 bits exactly
     322        sqlLine.group("batchID",           "'" + str(self.batchID) + "'")
     323        sqlLine.group("randomForcedObjID", "RAND("+str(self.batchID)+")")
     324        sqlLine.group("nDetections",       "'0'")
     325        sqlLine.group("processingVersion", str(self.skychunk.processingVersion))
     326
    329327        sql = sqlLine.makeRaw(") SELECT ", " FROM " + cptTableName)
    330328
     
    344342        self.updatePspsUniqueIDs()
    345343
    346 
    347344        self.logger.infoPair("update ForcedMeanObject from ","cps table")
    348345        self.updateForcedMeanObjectFromCps(cpsTableName)
     
    350347        sqlLine = sqlUtility("INSERT INTO ForcedMeanLensing (")
    351348
    352         sqlLine.group("objID",           "objID")
    353         sqlLine.group("uniquePspsFOid","uniquePspsFOid")
     349        sqlLine.group("objID",            "objID")
     350        sqlLine.group("uniquePspsFOid",   "uniquePspsFOid")
    354351        sqlLine.group("randomForcedObjID","randomForcedObjID")
    355         sqlLine.group("ippObjID",        "ippObjID")
    356         sqlLine.group("batchID",         "batchID")
     352        sqlLine.group("ippObjID",         "ippObjID")
     353        sqlLine.group("batchID",          "batchID")
    357354        sqlLine.group("nDetections",      "nDetections")
    358         sqlLine.group("processingVersion",   str(self.skychunk.processingVersion))
     355        sqlLine.group("processingVersion", str(self.skychunk.processingVersion))
    359356
    360357        sql = sqlLine.makeRaw(") SELECT ", " FROM ForcedMeanObject")
     
    375372        self.logger.infoPair("Dropping row column from", "ForcedMeanObject table")
    376373        self.scratchDb.dropColumn("ForcedMeanObject", "row")
     374
    377375        self.logger.infoPair("Dropping row column from", "ForcedMeanLensing table")
    378376        self.scratchDb.dropColumn("ForcedMeanLensing", "row")
     377
     378        ##Don't do this till after MeanObject
    379379        ##self.logger.infoPair("Purging from scratch Db", self.region + " region")
    380 
    381         ##Don't do this till after MeanObject
    382380        ##self.dvoForcedObjects.purgeRegion(self.region)
     381
    383382        self.logger.infoPair("setting minmaxobjid for ", "ForcedMeanObject table")
    384383        self.setMinMaxObjID(["ForcedMeanObject"])
     
    421420
    422421        self.dvoForcedObjects.purgeRegion(self.region)
    423 
    424         #this is abuse of something but this is how I get the object batches to crash to further investigate them
    425        
    426 #        rowCountAfter = self.scratchDb.getRowCount("Object")
    427422        return True
    428 #        return False
Note: See TracChangeset for help on using the changeset viewer.