IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 5, 2013, 2:23:09 PM (13 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20130207/ippToPsps
Files:
2 edited

Legend:

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

  • branches/eam_branches/ipp-20130207/ippToPsps/jython/queue.py

    r35097 r35235  
    88import sys
    99import os
     10import math
    1011import logging.config
    1112
     
    1516from dvoobjects import DvoObjects
    1617from batch import Batch
     18from scratchdb import ScratchDb
    1719
    1820'''
     
    2729        super(Queue, self).__init__(argv)
    2830
     31        print "inited ipptopsps"
     32
    2933        # create various objects
    3034        self.gpc1Db = Gpc1Db(self.logger, self.config)
     35        print "connect to gpc1"
     36
    3137        self.datastore = Datastore(self.logger, self.skychunk, self.ippToPspsDb)
    3238
     39        print "made datastore"
     40
     41        # connect to scratch database
     42        self.scratchDb = ScratchDb(self.logger, self.config)
     43
     44        print "connect to scratchdb"
     45
    3346        try:
    34             self.dvoObjects = DvoObjects(self.logger, self.config, self.skychunk, self.ippToPspsDb)
     47            self.dvoObjects = DvoObjects(self.logger, self.config, self.skychunk, self.ippToPspsDb, self.scratchDb)
    3548        except:
    3649            self.exitProgram("Unable to create instance of DvoObject")
    3750            raise
     51
     52        print "got objects"
    3853
    3954        self.skychunk.printAll()
     
    5671            for batchType in self.skychunk.batchTypes:
    5772
    58                 self.logger.infoTitle("Previous failed datastore loads")
    59                 self.publishAnyUnpublishedBatches(batchType)
     73                # self.logger.infoTitle("Previous failed datastore loads")
     74                # self.publishAnyUnpublishedBatches(batchType)
    6075
    6176                # get totals for whole area to check if there is anything to do
     
    116131   
    117132                    # starting positions
    118                     ra = self.skychunk.minRa + self.skychunk.halfBox
    119                     dec = self.skychunk.minDec + self.skychunk.halfBox
    120    
    121                     while ra <= self.skychunk.maxRa:
    122                        while dec <= self.skychunk.maxDec:
     133
     134                    dD = 0.5*self.skychunk.boxSize
     135                    dec = self.skychunk.minDec + dD
     136                    if (dec > 85): raise
     137
     138                    # print "dec, dD: ", dec, dD
     139
     140                    # 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                    ra = self.skychunk.minRa + dR
     143                   
     144                    # print "ra, dR: ", ra, dR
     145
     146                    # XXX not sure why this is not done with a for-loop...
     147                    while dec <= self.skychunk.maxDec:
     148                        while ra <= self.skychunk.maxRa:
    123149           
     150                           # a given box centered at RA,DEC with (linear) size of SIDE has the following bounds
     151                           minRA  = ra  - dR
     152                           maxRA  = ra  + dR
     153                           minDEC = dec - dD
     154                           maxDEC = dec + dD
     155
     156                           # this function inserts the box with given center and (linear) skychunk.boxSize
    124157                           box_id = self.ippToPspsDb.insertBox(ra, dec)
    125158           
    126                            ids = self.ippToPspsDb.getItemsInThisThisBox(ra, dec)
     159                           ids = self.ippToPspsDb.getItemsInThisBox(minRA, maxRA, minDEC, maxDEC)
    127160   
    128161                           self.logger.info("|    %5.1f    |    %5.1f    |  %9d  |  %9d  |" % (
     
    132165                                       len(ids)))
    133166               
     167                           # print "box_id: ", box_id
     168
    134169                           if len(ids) > 0: self.ippToPspsDb.insertPending(box_id, batchType, ids)
    135 
    136                            dec = dec + self.skychunk.boxSize
    137                        dec = self.skychunk.minDec + self.skychunk.halfBox
    138                        ra = ra + self.skychunk.boxSize
    139            
     170                           # print "inserted pending"
     171                           ra = ra + 2*dR
     172                           # print "new ra: ", ra
     173
     174                        dec = dec + 2*dD
     175                        if (dec > 85): raise
     176
     177                        dR = 0.5*self.skychunk.boxSize / math.cos(math.radians(dec))
     178                        ra = self.skychunk.minRa + dR
     179
    140180                self.logger.info("+-------------+-------------+-------------+-------------+")
    141181
Note: See TracChangeset for help on using the changeset viewer.