IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35605 for trunk/ippToPsps


Ignore:
Timestamp:
May 29, 2013, 2:30:34 PM (13 years ago)
Author:
heather
Message:

this is whatever is current (or was currently used) for sas14. I assume its ok

Location:
trunk/ippToPsps/jython
Files:
6 edited

Legend:

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

    r35456 r35605  
    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)
  • trunk/ippToPsps/jython/dvo.py

    r35417 r35605  
    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
  • trunk/ippToPsps/jython/ippjython

    r35097 r35605  
    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
  • trunk/ippToPsps/jython/ipptopspsdb.py

    r35311 r35605  
    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)
  • trunk/ippToPsps/jython/queue.py

    r35417 r35605  
    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
     
    136137                    if (dec > 85): raise
    137138
    138                     # print "dec, dD: ", dec, dD
     139                    print "dec, dD: ", dec, dD ,self.skychunk.maxDec
    139140
    140141                    # 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))
     142                    #dR = 0.5*self.skychunk.boxSize / math.cos(math.radians(dec))
     143                    dR = 0.5*self.skychunk.boxSize
    142144                    ra = self.skychunk.minRa + dR
    143145                   
    144                     # print "ra, dR: ", ra, dR
     146                    print "ra, dR, maxRa", ra, dR, self.skychunk.maxRa
    145147
    146148                    # XXX not sure why this is not done with a for-loop...
    147149                    while dec <= self.skychunk.maxDec:
    148150                        while ra <= self.skychunk.maxRa:
    149            
     151                           
    150152                           # a given box centered at RA,DEC with (linear) size of SIDE has the following bounds
    151153                           minRA  = ra  - dR
     
    175177                        if (dec > 85): raise
    176178
    177                         dR = 0.5*self.skychunk.boxSize / math.cos(math.radians(dec))
     179                        #dR = 0.5*self.skychunk.boxSize / math.cos(math.radians(dec))
     180                        dR = 0.5*self.skychunk.boxSize
    178181                        ra = self.skychunk.minRa + dR
    179182
  • trunk/ippToPsps/jython/stackbatch.py

    r35496 r35605  
    504504               ,MOMENTS_R1 \
    505505               ,MOMENTS_RH \
    506                ,AP_FLUX / " + str(self.expTime) + " \
     506               ,POW(10.0, -0.4*AP_MAG) / " + str(self.expTime) + " \
    507507               ,NULL \
    508508               ,KRON_FLUX / " + str(self.expTime) + " \
     
    519519#               ,ABS((PSF_INST_MAG_SIG*(POW(10.0, (-0.4*PSF_INST_MAG)) / " + str(self.expTime) + ")) / 1.085736)
    520520#               ,POW(10.0, -0.4*AP_MAG) / " + str(self.expTime) + "
     521
     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) + "
    521524
    522525        # print "sql: ", sql
Note: See TracChangeset for help on using the changeset viewer.