IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 21, 2016, 1:09:00 PM (10 years ago)
Author:
heather
Message:

minor typos and fixes -- can now make GO batches! :)

File:
1 edited

Legend:

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

    r39785 r39786  
    1414from ipptopspsdb import IppToPspsDb
    1515from scratchdb import ScratchDb
    16 from dvoobjects import DvoObjects
     16from dvogaiaobjects import DvoGaiaObjects
    1717from sqlUtility import sqlUtility
    1818
     
    4949               dvoID,
    5050               batchID,
    51                "OB",
     51               "GO",
    5252               None)
    5353
     
    8484    '''
    8585    def alterPspsTables(self):
     86       
     87        self.scratchDb.execute("ALTER TABLE GaiaFrameCoordinate CHANGE dec_ `dec` double")
    8688
    8789        return True
     
    119121        cpsTableName = self.scratchDb.getDbFriendlyTableName(self.region + ".cps")
    120122
    121         if False:
     123        #if False:
     124        #    self.
    122125            # XXX EAM 20140724 : this is probably wrong : flux measurements can be 0.0 or negative: please review
    123126        self.logger.info("Populating GaiaFrameCoordinate")
     
    134137        sqlLine.group("batchID",         "'" + str(self.batchID) + "'")
    135138        sqlLine.group("ra",          "RA_MEAN")
    136         sqlLine.group("dec",         "DEC_MEAN")
     139        sqlLine.group("`dec`",         "DEC_MEAN")
    137140        sqlLine.group("raErr",       "RA_ERR")
    138141        sqlLine.group("decErr",      "DEC_ERR")
    139 
     142        sqlLine.group("gaiaFlag",     "FLAGS")
    140143        sql = sqlLine.makeRaw(") SELECT ", " FROM " + cptTableName)
    141144
     
    179182            #count out of range
    180183   
    181             sql = "SELECT count(*) FROM gaiaFrameCoordinate where \
    182                   gaiaFrameCoordinate.dec > " + str(decMax) + " \
    183                   or gaiaFrameCoordinate.dec < " + str(decMin) + " \
    184                   or gaiaFrameCoordinate.ra > " + str(raMax) + " \
    185                   or gaiaFrameCoordinate.ra < " + str(raMin)       
     184            sql = "SELECT count(*) FROM GaiaFrameCoordinate where \
     185                  GaiaFrameCoordinate.`dec` > " + str(decMax) + " \
     186                  or GaiaFrameCoordinate.`dec` < " + str(decMin) + " \
     187                  or GaiaFrameCoordinate.ra > " + str(raMax) + " \
     188                  or GaiaFrameCoordinate.ra < " + str(raMin)       
    186189       
    187190            rs = self.scratchDb.executeQuery(sql)
     
    193196           
    194197     
    195             sql = "DELETE FROM gaiaFrameCoordinate where \
    196                   gaiaFrameCoordinate.dec > (" + str(decMax) + " + .0033) or \
    197                   gaiaFrameCoordinate.dec < (" + str(decMin) + " - .0033) or \
    198                   gaiaFrameCoordinate.ra > (" + str(raMax) + " + .0033) or \
    199                   gaiaFrameCoordinate.ra < (" + str(raMin) + " - .0033)"
     198            sql = "DELETE FROM GaiaFrameCoordinate where \
     199                  GaiaFrameCoordinate.`dec` > (" + str(decMax) + " + .0033) or \
     200                  GaiaFrameCoordinate.`dec` < (" + str(decMin) + " - .0033) or \
     201                  GaiaFrameCoordinate.ra > (" + str(raMax) + " + .0033) or \
     202                  GaiaFrameCoordinate.ra < (" + str(raMin) + " - .0033)"
    200203            self.logger.infoPair("Deleting", str(nToDelete) + " objects outside of ra/dec range")
    201204   
     
    203206                self.scratchDb.execute(sql)
    204207            except:
    205                 self.logger.errorPair("Couldn't cull outsiders from gaiaFrameCoordinate table", sql)
     208                self.logger.errorPair("Couldn't cull outsiders from GaiaFrameCoordinate table", sql)
    206209                raise
    207210
     
    210213        self.logger.infoPair("updatePspsUniqueIDs","end")
    211214
    212         self.logger.infoPair("Dropping row column from", "gaiaFrameCoordinate table")
    213         self.scratchDb.dropColumn("gaiaFrameCoordinate", "row")
    214         self.logger.infoPair("Dropped row column", "gaiaFrameCoordinate")
    215 
    216         self.setMinMaxObjID(["gaiaFrameCoordinate"])
     215        self.logger.infoPair("Dropping row column from", "GaiaFrameCoordinate table")
     216        self.scratchDb.dropColumn("GaiaFrameCoordinate", "row")
     217        self.logger.infoPair("Dropped row column", "GaiaFrameCoordinate")
     218
     219        self.setMinMaxObjID(["GaiaFrameCoordinate"])
    217220
    218221        return True
     
    234237
    235238        ### force objID uniqueness on *** ObjectThin ***
    236         self.logger.infoPair("Forcing uniqueness on", "objID in gaiaFrameCoordinate table")
    237         rowCountBefore = self.scratchDb.getRowCount("gaiaFrameCoordinate")
     239        self.logger.infoPair("Forcing uniqueness on", "objID in GaiaFrameCoordinate table")
     240        rowCountBefore = self.scratchDb.getRowCount("GaiaFrameCoordinate")
    238241
    239242        # XXX EAM : note that in mysql versions later than 5.1, this fails
     
    246249            self.scratchDb.execute("set session old_alter_table=1")
    247250           
    248         self.scratchDb.execute("ALTER IGNORE TABLE gaiaFrameCoordinate ADD UNIQUE INDEX(objID)")
     251        self.scratchDb.execute("ALTER IGNORE TABLE GaiaFrameCoordinate ADD UNIQUE INDEX(objID)")
    249252        if self.scratchDb.version > 5.1:
    250253            self.scratchDb.execute("set session old_alter_table=0")
    251254
    252         rowCountAfter = self.scratchDb.getRowCount("gaiaFrameCoordinate")
     255        rowCountAfter = self.scratchDb.getRowCount("GaiaFrameCoordinate")
    253256        self.logger.infoPair("Number of duplicated objIDs removed", "%d out of %d" % ((rowCountBefore - rowCountAfter), rowCountBefore))
    254257
Note: See TracChangeset for help on using the changeset viewer.