IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35204


Ignore:
Timestamp:
Feb 26, 2013, 8:50:05 AM (13 years ago)
Author:
eugene
Message:

box sizes are linear dimensions; actual areas are now scaled by cos(DEC)

Location:
trunk/ippToPsps
Files:
1 added
3 edited

Legend:

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

    r35203 r35204  
    10371037    def getBoxId(self, ra, dec):
    10381038
     1039        # for the float comparison, need to use a small window
     1040        minRA = ra - 0.01
     1041        maxRA = ra + 0.01
     1042        minDEC = dec - 0.01
     1043        maxDEC = dec + 0.01
     1044
    10391045        sql = "SELECT id FROM box \
    10401046               WHERE skychunk  = '" + self.skychunk.name + "' \
    1041                AND ra_center = " + str(ra) + " \
    1042                AND dec_center = " + str(dec)
     1047               AND ra_center BETWEEN " + str(minRA) + " AND " + str(maxRA) + " \
     1048               AND dec_center BETWEEN " + str(minDEC) + " AND " + str(maxDEC)
    10431049
    10441050               # AND box_side = " + str(self.skychunk.boxSize)
    10451051
     1052        # print "sql for boxid: ", sql
     1053       
    10461054        id = -1
    10471055        try:
     
    11401148    def insertPending(self, box_id, batchType, ids):
    11411149
     1150        # print "starting insert pending"
     1151
    11421152        # first delete old pending items
    11431153        self.execute("DELETE FROM pending \
    11441154                WHERE box_id = " + str(box_id) + " \
    11451155                AND batch_type = '" + batchType + "'")
     1156
     1157        # print "deleted old items"
    11461158
    11471159        for id in ids:
     
    11511163               (" + str(box_id) + ", '" + batchType + "', " + str(id) + ")"
    11521164
     1165            # print "sql: ", sql
    11531166            self.execute(sql)
    11541167
     
    14551468    Gets all items in the all_pending temporary table within the bounds of this box
    14561469    '''
    1457     def getItemsInThisThisBox(self, ra, dec):
    1458 
    1459         halfSide = self.skychunk.boxSize/2.0
    1460         minRa =  ra-halfSide
    1461         maxRa = ra+halfSide
    1462         minDec = dec-halfSide
    1463         maxDec = dec+halfSide
     1470    def getItemsInThisBox(self, minRA, maxRA, minDEC, maxDEC):
     1471
     1472        # the old linear size is ill-conceived
     1473        ## XX halfSide = self.skychunk.boxSize/2.0
     1474        ## XX minRa =  ra-halfSide
     1475        ## XX maxRa = ra+halfSide
     1476        ## XX minDec = dec-halfSide
     1477        ## XX maxDec = dec+halfSide
    14641478
    14651479        ids = []
     
    14671481        sql = "SELECT DISTINCT stage_id \
    14681482               FROM all_pending \
    1469                WHERE ra_bore BETWEEN " + str(minRa) + " AND " + str(maxRa) + " \
    1470                AND dec_bore BETWEEN " + str(minDec) + " AND " + str(maxDec)
     1483               WHERE ra_bore BETWEEN " + str(minRA) + " AND " + str(maxRA) + " \
     1484               AND dec_bore BETWEEN " + str(minDEC) + " AND " + str(maxDEC)
    14711485
    14721486        try:
  • trunk/ippToPsps/jython/queue.py

    r35203 r35204  
    88import sys
    99import os
     10import math
    1011import logging.config
    1112
     
    117118                    # starting positions
    118119
    119                     dD = 0.5*skychunk.boxSize
     120                    dD = 0.5*self.skychunk.boxSize
    120121                    dec = self.skychunk.minDec + dD
     122                    if (dec > 85): raise
     123
     124                    # print "dec, dD: ", dec, dD
    121125
    122126                    # a given box centered at RA,DEC with (linear) size of SIDE has the following bounds
    123                     dR = 0.5*skychunk.boxSize / math.cos(math.radians(dec))
     127                    dR = 0.5*self.skychunk.boxSize / math.cos(math.radians(dec))
    124128                    ra = self.skychunk.minRa + dR
    125129                   
     130                    # print "ra, dR: ", ra, dR
     131
     132                    # XXX not sure why this is not done with a for-loop...
    126133                    while dec <= self.skychunk.maxDec:
    127                        
    128                         # XXX EAM : need to do something special at the poles...
    129                         if (dec > 85): raise
    130 
    131134                        while ra <= self.skychunk.maxRa:
    132135           
     
    137140                           maxDEC = dec + dD
    138141
    139                            XXX EAM:
     142                           # this function inserts the box with given center and (linear) skychunk.boxSize
    140143                           box_id = self.ippToPspsDb.insertBox(ra, dec)
    141144           
    142                            XXX EAM:
    143                            ids = self.ippToPspsDb.getItemsInThisThisBox(ra, dec)
     145                           ids = self.ippToPspsDb.getItemsInThisBox(minRA, maxRA, minDEC, maxDEC)
    144146   
    145147                           self.logger.info("|    %5.1f    |    %5.1f    |  %9d  |  %9d  |" % (
     
    149151                                       len(ids)))
    150152               
     153                           # print "box_id: ", box_id
     154
    151155                           if len(ids) > 0: self.ippToPspsDb.insertPending(box_id, batchType, ids)
     156                           # print "inserted pending"
    152157                           ra = ra + 2*dR
    153 
    154                          dec = dec + 2*dD
    155 
    156                          dR = 0.5*skychunk.boxSize / math.cos(math.radians(dec))
    157                          ra = self.skychunk.minRa + dR
     158                           # print "new ra: ", ra
     159
     160                        dec = dec + 2*dD
     161                        if (dec > 85): raise
     162
     163                        dR = 0.5*self.skychunk.boxSize / math.cos(math.radians(dec))
     164                        ra = self.skychunk.minRa + dR
    158165
    159166                self.logger.info("+-------------+-------------+-------------+-------------+")
  • trunk/ippToPsps/test/fulltest.sh

    r35188 r35204  
    2626
    2727set mkgpc1       = 0
    28 set initdb       = 1
    29 set initscratch  = 1
     28set initdb       = 0
     29set initscratch  = 0
    3030set camqueue     = 1
    31 set initbatch    = 1
    32 set cambatch     = 1
     31set initbatch    = 0
     32set cambatch     = 0
    3333set stackqueue   = 0
    3434set stackbatch   = 0
Note: See TracChangeset for help on using the changeset viewer.