IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 3, 2013, 1:44:20 PM (13 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20130509/ippToPsps
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130509/ippToPsps

  • branches/eam_branches/ipp-20130509/ippToPsps/config/settings.xml

    r35503 r35748  
    66  <!-- path for storing logs -->
    77  <!-- XXX Need to make this different for tests and real, also for different installations -->
    8   <logPath>logs</logPath>
    9 
     8  <logPath>SAS15</logPath>
    109  <!-- local scratch Db section (REAL version) -->
    1110  <localdatabase>
  • branches/eam_branches/ipp-20130509/ippToPsps/jython/detectionbatch.py

    r35456 r35748  
    450450               ,MOMENTS_XY \
    451451               ,MOMENTS_YY \
    452                ,AP_FLUX / " + self.header['EXPTIME'] + " \
     452               ,POW(10.0, -0.4 *AP_MAG) / " + self.header['EXPTIME'] + " \
    453453               ,KRON_FLUX / " + self.header['EXPTIME'] + " \
    454454               ,KRON_FLUX_ERR / " + self.header['EXPTIME'] + " \
     
    469469#               ,POW(10.0, (-0.4*PSF_INST_MAG)) / " + self.header['EXPTIME'] + "
    470470#               ,ABS((PSF_INST_MAG_SIG*(POW(10.0, (-0.4*PSF_INST_MAG)) / " + self.header['EXPTIME'] + ")) / 1.085736)
    471 #               ,POW(10.0, -0.4 *AP_MAG) / " + self.header['EXPTIME'] + "
     471
     472# I need a way to choose the sql above based on the cmf version: V3 (LAP.PV1) does not have AP_FLUX
     473# AP_FLUX is no              ,AP_FLUX / " + self.header['EXPTIME'] + "
    472474
    473475        self.scratchDb.execute(sql)
     
    10351037 
    10361038       # XXX EAM NOTE : this is fragile : requires PS1_V4
    1037        columns = "IPP_IDET X_PSF Y_PSF X_PSF_SIG Y_PSF_SIG PSF_INST_MAG PSF_INST_MAG_SIG PSF_INST_FLUX PSF_INST_FLUX_SIG PEAK_FLUX_AS_MAG PSF_MAJOR PSF_MINOR PSF_THETA EXT_NSIGMA PSF_QF MOMENTS_XX MOMENTS_XY MOMENTS_YY AP_MAG AP_FLUX KRON_FLUX KRON_FLUX_ERR FLAGS FLAGS2 SKY SKY_SIGMA EXT_NSIGMA PSF_QF_PERFECT PSF_CHISQ"
     1039       # columns = "IPP_IDET X_PSF Y_PSF X_PSF_SIG Y_PSF_SIG PSF_INST_MAG PSF_INST_MAG_SIG PSF_INST_FLUX PSF_INST_FLUX_SIG PEAK_FLUX_AS_MAG PSF_MAJOR PSF_MINOR PSF_THETA EXT_NSIGMA PSF_QF MOMENTS_XX MOMENTS_XY MOMENTS_YY AP_MAG AP_FLUX KRON_FLUX KRON_FLUX_ERR FLAGS FLAGS2 SKY SKY_SIGMA EXT_NSIGMA PSF_QF_PERFECT PSF_CHISQ"
     1040
     1041       # XXX EAM NOTE : this is fragile : requires PS1_V4
     1042       columns = "IPP_IDET X_PSF Y_PSF X_PSF_SIG Y_PSF_SIG PSF_INST_MAG PSF_INST_MAG_SIG PSF_INST_FLUX PSF_INST_FLUX_SIG PEAK_FLUX_AS_MAG PSF_MAJOR PSF_MINOR PSF_THETA EXT_NSIGMA PSF_QF MOMENTS_XX MOMENTS_XY MOMENTS_YY AP_MAG KRON_FLUX KRON_FLUX_ERR FLAGS FLAGS2 SKY SKY_SIGMA EXT_NSIGMA PSF_QF_PERFECT PSF_CHISQ"
    10381043
    10391044       return super(DetectionBatch, self).importIppTables(columns, regex)
  • branches/eam_branches/ipp-20130509/ippToPsps/jython/dvo.py

    r35417 r35748  
    6565        if not self.correctDvo:
    6666            print "*******************************************************************************"
    67             self.logger.warning("Wrong or no DVO in use. Do you want to reset and use '" + self.skychunk.dvoLocation + "'?")
    68             response = raw_input("(y/n) ")
    69             if response == "y":
    70                 self.logger.warning("Are you ABSOLUTELY sure you want to do this?")
    71                 response = raw_input("(y/n) ")
    72                 if response == "y":
    73                     self.resetAllTables()
    74 
     67            self.logger.warning("switching to a new dvo: " + self.skychunk.dvoLocation)
     68            # response = raw_input("(y/n) ")
     69            # if response == "y":
     70            #     self.logger.warning("Are you ABSOLUTELY sure you want to do this?")
     71            #     response = raw_input("(y/n) ")
     72            #     if response == "y":
     73            self.resetAllTables()
    7574
    7675    '''
     
    597596        self.ippToPspsDb.clearIngestedBoxes(self.scratchDb.dbHost)
    598597       
    599         ## print "*******************************************************************************"
    600         ## self.logger.warning("about to delete detection table and re-ingest; is this correct?")
    601         ## response = raw_input("(y/n) ")
    602         ## if response != "y":
    603         ##     raise
    604         ## self.logger.warning("Are you ABSOLUTELY sure you want to do this?")
    605         ## response = raw_input("(y/n) ")
    606         ## if response != "y":
    607         ##     raise
     598        if True:
     599            print "*******************************************************************************"
     600            self.logger.warning("about to delete detection table and re-ingest; is this correct?")
     601            #response = raw_input("(y/n) ")
     602            #if response != "y":
     603            #    raise
     604            #self.logger.warning("Are you ABSOLUTELY sure you want to do this?")
     605            #response = raw_input("(y/n) ")
     606            #if response != "y":
     607            #    raise
    608608
    609609        # blow away existing dvoDetection table & re-crate
  • branches/eam_branches/ipp-20130509/ippToPsps/jython/ippjython

    r35097 r35748  
    1919set JYTHON = $JARDIR/jython2.5.3b1/jython.jar
    2020# set JYTHON = ~/jython2.5.3b1/jython.jar
     21#set JYTHON = $JARDIR/jython.jar
    2122
    2223if (! -r $JYTHON) then
  • branches/eam_branches/ipp-20130509/ippToPsps/jython/ipptopspsdb.py

    r35311 r35748  
    785785                   survey, \
    786786                   dvo_db, \
    787                    datastore_product \
     787                   datastore_product, \
     788                   comment \
    788789                   ) VALUES ( \
    789790                       '" + batchType + "', \
     
    791792                       '" + self.skychunk.survey + "', \
    792793                       '" + self.skychunk.dvoLabel + "', \
    793                        '" + self.skychunk.datastoreProduct + "' \
     794                       '" + self.skychunk.datastoreProduct + "', \
     795                       '" + self.skychunk.name + "' \
    794796                       )"
    795797            self.logger.infoPair("heather:","sql")
     
    12151217                   ('" + self.skychunk.name + "', " + str(ra) + ", " + str(dec) + ", " + str(self.skychunk.boxSize) + ")"
    12161218
     1219            # print "insertBox: ", sql
     1220
    12171221            self.execute(sql)
    12181222            id = self.getBoxId(ra, dec)
     
    15561560
    15571561        sql = "SELECT id, ra_center, dec_center \
    1558                FROM box \
    1559                WHERE skychunk = '" + self.skychunk.name + "' \
     1562               FROM box join skychunk on box.skychunk = skychunk.name \
     1563               WHERE dvo_label = '" + self.skychunk.dvoLabel + "' \
    15601564               ORDER BY ra_center, dec_center"
    15611565
     
    15991603                sql = "INSERT INTO all_pending (stage_id, ra_bore, dec_bore) \
    16001604                       VALUES (%d, %f, %f)" % (row[0], row[1], row[2])
     1605                # print "sql 1: ", sql
    16011606                self.execute(sql)
    16021607            except: continue
     
    16041609        count = self.getRowCount("all_pending")
    16051610        self.logger.infoPair("Items written to Db", "%d" % count)
     1611
     1612        # try:
     1613        #     self.execute("DROP TABLE all_pending_alt")
     1614        # except:
     1615        #     pass
     1616        #
     1617        # self.execute("CREATE TABLE all_pending_alt (stage_id bigint(20), ra_bore float, dec_bore float)")
     1618        # for row in rows:
     1619        #     try:
     1620        #         sql = "INSERT INTO all_pending_alt (stage_id, ra_bore, dec_bore) \
     1621        #                VALUES (%d, %f, %f)" % (row[0], row[1], row[2])
     1622        #         print "sql 2: ", sql
     1623        #         self.execute(sql)
     1624        #     except: continue
     1625        #
     1626        # count = self.getRowCount("all_pending_alt")
     1627        # self.logger.infoPair("Items written to alt Db", "%d" % count)
    16061628
    16071629    '''
     
    16241646               AND dec_bore BETWEEN " + str(minDEC) + " AND " + str(maxDEC)
    16251647
     1648        print "items: ", sql
     1649
    16261650        try:
    16271651            rs = self.executeQuery(sql)
  • branches/eam_branches/ipp-20130509/ippToPsps/jython/queue.py

    r35417 r35748  
    3737        self.datastore = Datastore(self.logger, self.skychunk, self.ippToPspsDb)
    3838
    39         # print "made datastore"
     39        print "made datastore"
    4040
    4141        # connect to scratch database
    4242        self.scratchDb = ScratchDb(self.logger, self.config)
    4343
    44         # print "connect to scratchdb"
     44        print "connect to scratchdb"
    4545
    4646        try:
     
    5050            raise
    5151
    52         # print "got objects"
     52        print "got objects"
    5353
    5454        self.skychunk.printAll()
     
    6262    '''
    6363    def run(self):
    64 
     64        print "here"
    6565        # this outer while loop simply waits a few minutes then starts queuing again (as more stuff may appear in DVO over time)
    6666        while True:
    6767
    6868            self.ippToPspsDb.removeAllBoxes()
    69        
     69            print "remove boxes"
    7070            # queue up batches that are processed but not loaded to datastore
    7171            for batchType in self.skychunk.batchTypes:
    72 
     72                self.logger.infoPair("BatchType",batchType)
    7373                # self.logger.infoTitle("Previous failed datastore loads")
    7474                # self.publishAnyUnpublishedBatches(batchType)
     
    7676                # get totals for whole area to check if there is anything to do
    7777                processedIDs = self.ippToPspsDb.getProcessedIDs(batchType)
     78                print "got processed ids"
    7879                consistantlyFailedIDs = self.ippToPspsDb.getConsistentlyFailedIDs(batchType)
    79 
     80                print "got here"
    8081                # for object batches, get full list of stuff from Dvo
    8182                # XXX : need to fix 'dvo.setSkyArea' or this may not return the full list for a parallel dvo
     
    133134
    134135                    dD = 0.5*self.skychunk.boxSize
     136                   
    135137                    dec = self.skychunk.minDec + dD
     138                    #dec = self.skychunk.minDec
     139
    136140                    if (dec > 85): raise
    137141
    138                     # print "dec, dD: ", dec, dD
     142                    print "dec, dD: ", dec, dD ,self.skychunk.maxDec
    139143
    140144                    # a given box centered at RA,DEC with (linear) size of SIDE has the following bounds
    141                     dR = 0.5*self.skychunk.boxSize / math.cos(math.radians(dec))
     145                    #dR = 0.5*self.skychunk.boxSize / math.cos(math.radians(dec))
     146                    dR = 0.5*self.skychunk.boxSize
     147                                       
    142148                    ra = self.skychunk.minRa + dR
    143149                   
    144                     # print "ra, dR: ", ra, dR
     150                    print "ra, dR, maxRa", ra, dR, self.skychunk.maxRa
    145151
    146152                    # XXX not sure why this is not done with a for-loop...
    147153                    while dec <= self.skychunk.maxDec:
    148154                        while ra <= self.skychunk.maxRa:
    149            
     155                           print "here"
    150156                           # a given box centered at RA,DEC with (linear) size of SIDE has the following bounds
    151157                           minRA  = ra  - dR
     
    165171                                       len(ids)))
    166172               
    167                            # print "box_id: ", box_id
     173                           print "box_id: ", box_id
    168174
    169175                           if len(ids) > 0: self.ippToPspsDb.insertPending(box_id, batchType, ids)
     
    175181                        if (dec > 85): raise
    176182
    177                         dR = 0.5*self.skychunk.boxSize / math.cos(math.radians(dec))
     183                        #dR = 0.5*self.skychunk.boxSize / math.cos(math.radians(dec))
     184                        dR = 0.5*self.skychunk.boxSize
    178185                        ra = self.skychunk.minRa + dR
    179186
  • branches/eam_branches/ipp-20130509/ippToPsps/jython/stackbatch.py

    r35496 r35748  
    455455               ,psfQf \
    456456               ,psfQfPerfect \
     457               ,psfChiSq \
    457458               ,momentXX \
    458459               ,momentXY \
     
    469470               ,kronFluxErr \
    470471               ,kronRad \
    471                ,psfChiSq \
    472472               ,nFrames \
    473473               ,assocDate \
     
    495495               ,PSF_QF \
    496496               ,PSF_QF_PERFECT \
     497               ,PSF_CHISQ / PSF_NDOF \
    497498               ,MOMENTS_XX \
    498499               ,MOMENTS_XY \
     
    504505               ,MOMENTS_R1 \
    505506               ,MOMENTS_RH \
    506                ,AP_FLUX / " + str(self.expTime) + " \
     507               ,POW(10.0, -0.4*AP_MAG) / " + str(self.expTime) + " \
    507508               ,NULL \
    508509               ,KRON_FLUX / " + str(self.expTime) + " \
    509510               ,KRON_FLUX_ERR / " + str(self.expTime) + " \
    510511               ,MOMENTS_R1 * 2.5 \
    511                ,PSF_CHISQ / PSF_NDOF \
    512512               ,N_FRAMES \
    513513               , '" + self.dateStr + "' \
     
    520520#               ,POW(10.0, -0.4*AP_MAG) / " + str(self.expTime) + "
    521521
     522# I need a way to choose the sql above based on the cmf version: V3 (LAP.PV1) does not have AP_FLUX
     523#               ,AP_FLUX / " + str(self.expTime) + "
     524
    522525        # print "sql: ", sql
    523526        # response = raw_input("ready to insert stack det ")
     
    540543       
    541544        self.scratchDb.updateAllRows("StackDetection", "dataRelease", str(self.skychunk.dataRelease))
    542        
     545        #set primary F to 0
    543546        self.scratchDb.updateAllRows("StackDetection", "primaryF", "0")
    544547       
     
    550553       
    551554        self.updateDvoIDsAndFlags("StackDetection")
     555        #this now updates primary F as well
    552556        # response = raw_input("updated dvo ")
    553557       
     
    725729
    726730        # now update StackMeta with correct number of inputs
    727         sql = "UPDATE StackMeta SET nP2Images = (SELECT COUNT(*) FROM StackToImage)"
     731        sql = "UPDATE StackMeta SET nP2Images = (SELECT COUNT(distinct(floor(imageID/100))) FROM StackToImage)"
    728732        self.scratchDb.execute(sql)
    729733
     
    940944               a.objID = b.objID, \
    941945               a.infoFlag = b.flags << 45 | a.infoFlag \
     946               a.primaryF = ((b.flags & 0x10000) >> 16 ) \
    942947               WHERE a.ippDetectID = b.ippDetectID \
    943948               AND b.imageID = " + str(imageID)
Note: See TracChangeset for help on using the changeset viewer.