IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 2, 2011, 1:52:50 PM (15 years ago)
Author:
rhenders
Message:

added abilty to reset DVO tables; added checks to make absolutely sure the user wishes to do this; added detailed comment regarding DVO detection duplicates

File:
1 edited

Legend:

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

    r31965 r31972  
    2727
    2828    '''
    29     def __init__(self, logger):
     29    def __init__(self, logger, RESETTABLES):
    3030
    3131        # set up logging
     
    4949
    5050        # create DVO tables
    51         #self.scratchDb.createDvoTables()
     51        if RESETTABLES: self.scratchDb.resetDvoToMysqlTables()
    5252
    5353        # import Images.dat table
     
    102102                        file + ".cpm",
    103103                        "IMAGE_ID DET_ID OBJ_ID CAT_ID EXT_ID DB_FLAGS")
     104                self.scratchDb.createIndex(cpmTableName, "IMAGE_ID")
    104105                self.scratchDb.createIndex(cpmTableName, "CAT_ID")
    105106                self.scratchDb.createIndex(cpmTableName, "OBJ_ID")
     
    110111                        file + ".cpt",
    111112                        "OBJ_ID CAT_ID EXT_ID")
     113                self.scratchDb.createIndex(cptTableName, "IMAGE_ID")
    112114                self.scratchDb.createIndex(cptTableName, "CAT_ID")
    113115                self.scratchDb.createIndex(cptTableName, "OBJ_ID")
     
    132134                self.scratchDb.execute(sql)
    133135
     136                # NB we use an INSERT IGNORE here. This is because of a known issue where multiple DVO cpm
     137                # files can include the same detection, with the same IMAGE_ID/DET_ID pairing, but different
     138                # PSPS object IDs assigned in the corresponding cpt file. This is believed to be a chip-boundary
     139                # issue within DVO. So, for now, we take the first IMAGE_ID/DET_ID detection we find, and ignore the rest
    134140                self.logger.infoPair("Populating", self.dvoDetectionTable)
    135141                sql = "INSERT IGNORE INTO dvoDetectionFull (\
     
    150156                       ,DB_FLAGS \
    151157                       FROM " + cpmTableName
    152                 self.scratchDb.execute(sql)
     158                try:
     159                    self.scratchDb.execute(sql)
     160                except:
     161                    self.logger.error("FAILED: " + sql)
     162                    return
    153163
    154164                # now drop what we don't need
     
    213223logger.setLevel(logging.INFO)
    214224
    215 
    216 dvoToMySql = DvoToMySql(logger)
     225RESETTABLES = 0
     226
     227if len(sys.argv) > 1 and sys.argv[1] == "reset":
     228    response = raw_input("* Are you ABSOLUTELY sure you want to recreate the DVO tables (y/n)? ")
     229    if response == "y": RESETTABLES = 1
     230
     231dvoToMySql = DvoToMySql(logger, RESETTABLES)
    217232
    218233logger.infoPair("Program...", "complete")
Note: See TracChangeset for help on using the changeset viewer.