IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 6, 2013, 3:16:35 PM (13 years ago)
Author:
eugene
Message:

upgrade to ippToPsps (see doc/upgrade.txt): adds native dvo to mysql ingest operations, adds autogen configuration & installation, splits out global config information from new "skychunk" information (current region on the sky being processed), adds test suites

Location:
trunk/ippToPsps
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps

  • trunk/ippToPsps/jython

    • Property svn:ignore
      •  

        old new  
        11*.class
         2Makefile
         3Makefile.in
  • trunk/ippToPsps/jython/dvodetections.py

    r34630 r35097  
    2020    Constructor
    2121    '''
    22     def __init__(self, logger, config, scratchDbName):
     22    def __init__(self, logger, config, skychunk, ippToPspsDb, scratchDbName):
    2323
    24         super(DvoDetections, self).__init__(logger, config, scratchDbName)
     24        super(DvoDetections, self).__init__(logger, config, skychunk, ippToPspsDb, scratchDbName)
    2525
    2626        # declare DVO file types of interest
     
    3232    def ingestRegion(self, region):
    3333
    34        cpmPath = self.config.dvoLocation + "/" + region + ".cpm"
    35        cptPath = self.config.dvoLocation + "/" + region + ".cpt"
     34       cpmPath = self.skychunk.dvoLocation + "/" + region + ".cpm"
     35       cptPath = self.skychunk.dvoLocation + "/" + region + ".cpt"
    3636
    3737       cpmTableName = self.scratchDb.getDbFriendlyTableName(region + ".cpm")
     
    8383       # first try to add the new columns. catch failure and continue
    8484       try:
    85            sql = "ALTER TABLE " + cpmTableName + " ADD COLUMN (PSPS_OBJ_ID BIGINT), (ZP REAL), (RA FLOAT), (DEC FLOAT)"
     85           sql = "ALTER TABLE " + cpmTableName + " ADD COLUMN (PSPS_OBJ_ID BIGINT), ADD COLUMN (ZP REAL), ADD COLUMN (RA FLOAT), ADD COLUMN (DEC_ FLOAT)"
    8686           self.scratchDb.execute(sql)
    8787       except:
    88            self.logger.infoPair("Already added PSPS_OBJ_ID column to", cpmTableName)
     88           # failed, but may be due to mysql error
     89           self.logger.infoPair("mysql error or already added PSPS_OBJ_ID column to", cpmTableName)
     90           # self.logger.infoPair("sql command", sql)
    8991               
    9092       # shove PSPS objIDs from cpt table and the calibrated zero point and coordinates which are formed
    9193       # by combining values from multiple tables into cpt table
    92        sql = "UPDATE " + cpmTableName + " AS a, " + cptTableName + " AS b, " \
    93               + self.scratchDb.dvoPhotcodesTable + " AS c \
    94               SET a.PSPS_OBJ_ID = b.EXT_ID, \
    95               b.ZP  = c.C_LAM * 0.001 + c.K * (b.AIRMASS - 1) - b.M_CAL, \
    96               b.RA  = a.RA  - (b.D_RA  / 3600.0), \
    97               b.DEC = a.DEC - (b.D_DEC / 3600.0) \
    98               WHERE a.CAT_ID = b.CAT_ID \
    99               AND a.OBJ_ID = b.OBJ_ID   \
    100               AND b.PHOTCODE = c.CODE"
     94       sql = "UPDATE " \
     95              + cpmTableName + " AS meas, " \
     96              + cptTableName + " AS ave, " \
     97              + self.scratchDb.dvoPhotcodesTable + " AS phot \
     98              SET \
     99              meas.PSPS_OBJ_ID = ave.EXT_ID, \
     100              meas.ZP  = phot.C_LAM * 0.001 + phot.K * (meas.AIRMASS - 1) - meas.M_CAL, \
     101              meas.RA  = ave.RA  - (meas.D_RA  / 3600.0), \
     102              meas.DEC_ = ave.DEC_ - (meas.D_DEC / 3600.0) \
     103              WHERE meas.CAT_ID = ave.CAT_ID \
     104              AND meas.OBJ_ID = ave.OBJ_ID   \
     105              AND meas.PHOTCODE = phot.CODE"
    101106
     107       # EAM : add some debug I/O
     108       # self.logger.infoPair("sql command", sql)
    102109       self.scratchDb.execute(sql)
    103110
     
    136143              ,POW(10.0, 0.4 * M_TIME)  \
    137144              ,RA   \
    138               ,DEC  \
     145              ,DEC_  \
    139146              ,X_CCD_ERR*PLTSCALE   \
    140147              ,Y_CCD_ERR*PLTSCALE   \
    141148              , " + str(fileId) + " \
    142149              FROM " + cpmTableName
     150
     151       # print "sql :", sql
     152       # response = raw_input("prepare to insert dvoDetectionTable ")
    143153
    144154       try:
     
    148158           return False
    149159       finally:
     160           # response = raw_input("insert dvoDetectionTable ")
    150161           self.logger.infoPair("Dropping tables", "%s and %s" % (cpmTableName, cptTableName))
    151162           self.scratchDb.dropTable(cpmTableName)
     
    155166
    156167       return True
    157 
    158 
Note: See TracChangeset for help on using the changeset viewer.