IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35203


Ignore:
Timestamp:
Feb 26, 2013, 6:47:49 AM (13 years ago)
Author:
eugene
Message:

trying to fix the definition of a box (roughly constant linear width)

Location:
trunk/ippToPsps
Files:
2 added
4 edited

Legend:

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

    r35190 r35203  
    211211    def setSkyAreaAsStripe(self, ra=0., width=4.):
    212212
     213        print "this function should not reached now, error"
     214        raise
     215
    213216        self.setSkyArea(ra, ra+width, -91., 91.)
    214217
     
    217220    '''
    218221    def setSkyAreaAsBox(self, ra=180., dec=0., side=181.0):
     222
     223        print "this function should not reached now, error"
     224        raise
    219225
    220226        halfSide = side/2.0
     
    223229    '''
    224230    Determines what DVO files need to be ingested to the defines region
     231    XXX EAM : this function has been substantially reduced / stripped down to work with the parallel dvo
     232    XXX EAM : some additional review of the goals would be useful
    225233    '''
    226234    def setSkyArea(self, minRa=-1., maxRa=361., minDec=-91., maxDec=91):
     
    584592    includes purging detections outside sky area
    585593    '''
    586     def nativeIngestDetections(self, boxId, raCenter, decCenter, boxSize):
     594    def nativeIngestDetections(self, boxId, boxDim):
    587595
    588596        # XXX put the chunk below in a separate method
     
    628636        self.loadImages()
    629637
    630         # dvopsps -D catdir CATDIR -region .... -dbhost xx -dbname xx -dbuser xx -dbpass xx
    631         halfSize = boxSize / 2.0
    632         # -region raCenter-halfSize raCenter+halfSize decCenter-halfSize decCenter+halfSize
     638        # the box dimensions are the area used to select the items of
     639        # interest from the gpc1 database (camera smfs / skycal cmfs).
     640        # for dvopsps, we need to include a border region large enough
     641        # to grab all detections / objects which are contributed by an
     642        # item with the center in the given box
     643        dR_border = self.skychunk.BORDER / math.cos(math.radians(boxDim['DEC']))
     644        dD_border = self.skychunk.BORDER
     645
     646        minRA  = boxDim['minRA']  - dR_border
     647        maxRA  = boxDim['maxRA']  + dR_border
     648        minDEC = boxDim['minDEC'] - dD_border
     649        maxDEC = boxDim['maxDEC'] + dD_border
    633650
    634651        # TODO path to DVO prog hardcoded temporarily
     
    640657        cmd += " -D CATDIR " + self.skychunk.dvoLocation
    641658        cmd += " -region "
    642         cmd += " " + str(raCenter-halfSize)
    643         cmd += " " + str(raCenter+halfSize)
    644         cmd += " " + str(decCenter-halfSize)
    645         cmd += " " + str(decCenter+halfSize)
     659        cmd += " " + str(minRA)
     660        cmd += " " + str(maxRA)
     661        cmd += " " + str(minDEC)
     662        cmd += " " + str(maxDEC)
    646663
    647664        if self.skychunk.parallel:
  • trunk/ippToPsps/jython/ipptopspsdb.py

    r35185 r35203  
    44import sys
    55import os
     6import math
    67import logging
    78
     
    997998
    998999            self.skychunk.boxSize = rs.getDouble(10)
    999             self.skychunk.halfBox = self.skychunk.boxSize/2.0
    1000             self.skychunk.boxSizeWithBorder = self.skychunk.boxSize + (self.skychunk.BORDER * 2)
     1000            # self.skychunk.halfBox = self.skychunk.boxSize/2.0
     1001            # self.skychunk.boxSizeWithBorder = self.skychunk.boxSize + (self.skychunk.BORDER * 2)
    10011002
    10021003            self.skychunk.basePath = rs.getString(11)
     
    10311032    '''
    10321033    Gets id of box with these coords
     1034    XXX EAM : this code implies we can have multiple boxes at the same location for the same
     1035    XXX EAM : skychunk distinguished by having different sizes.  that seems quite bad
    10331036    '''
    10341037    def getBoxId(self, ra, dec):
     
    10371040               WHERE skychunk  = '" + self.skychunk.name + "' \
    10381041               AND ra_center = " + str(ra) + " \
    1039                AND dec_center = " + str(dec) + " \
    1040                AND box_side = " + str(self.skychunk.boxSize)
     1042               AND dec_center = " + str(dec)
     1043
     1044               # AND box_side = " + str(self.skychunk.boxSize)
    10411045
    10421046        id = -1
     
    13251329        boxDim['SIDE'] = rs.getFloat(3)
    13261330
     1331        # SIDE is the linear full-width of the box
     1332
     1333        # XXX EAM : need to do something special at the poles...
     1334        if (boxDim['DEC'] > 85): raise
     1335
     1336        # a given box centered at RA,DEC with (linear) size of SIDE has the following bounds
     1337        dR = 0.5*boxDim['SIDE'] / math.cos(math.radians(boxDim['DEC']))
     1338        dD = 0.5*boxDim['SIDE']
     1339
     1340        boxDim['minRA']  = boxDim['RA']  - dR
     1341        boxDim['maxRA']  = boxDim['RA']  + dR
     1342        boxDim['minDEC'] = boxDim['DEC'] - dD
     1343        boxDim['maxDEC'] = boxDim['DEC'] + dD
     1344
    13271345        return boxDim
    13281346
  • trunk/ippToPsps/jython/loader.py

    r35185 r35203  
    157157                    self.logger.infoSeparator()
    158158                    self.logger.infoTitle("New box")
    159                     self.logger.infoPair("Box dimensions", "%.1f / %.1f / %.1f" % (boxDim['RA'], boxDim['DEC'], boxDim['SIDE']))
     159                    self.logger.infoPair("Box dimensions: ", "ra / dec / size : %.1f / %.1f / %.1f   --   sky bounds : (%.2f - %2.f, %2.f - %2.f)" % (boxDim['RA'], boxDim['DEC'], boxDim['SIDE'], boxDim['minRA'], boxDim['maxRA'], boxDim['minDEC'], boxDim['maxDEC']))
    160160                    self.logger.infoPair(batchType + " items found in this box", "%d" % len(ids))
    161                     boxSizeWithBorder = boxDim['SIDE'] + (self.skychunk.BORDER * 2 / math.cos(math.radians(boxDim['DEC'])))
    162                     boxSizeSansBorder = boxDim['SIDE']
    163                     boxSize = boxSizeWithBorder
    164                     self.logger.infoPair("using box of size", str(boxSize))
     161
    165162                    useFullTables = 0
    166163                    if batchType != "OB":
     
    169166                            # look in DVO for this box (with extra border)
    170167                            self.logger.infoPair("Querying DVO for this sky area", "")
     168
     169                            # XXXX EAM : This code should not be used anymore
     170                            boxSize = 0.0
    171171                            self.dvoDetections.setSkyAreaAsBox(boxDim['RA'], boxDim['DEC'], boxSize)
    172172                            #self.dvoDetections.setSkyArea()
     
    189189                                useFullTables = 1
    190190                        else:
    191                             # XXX EAM : this is not currently an
    192                             # option. either remove the non-native
    193                             # ingest code or make it an option
    194                             # if we are using the native loader, always use it
    195                             # need to work out a good boundary / region strategy in coordination with
    196                             # impact of mysql insertion
     191                            # XXX EAM : this is not currently optional
     192                            # (it is the only path). either remove the
     193                            # non-native ingest code or make it an
     194                            # option if we are using the native
     195                            # loader, always use it need to work out a
     196                            # good boundary / region strategy in
     197                            # coordination with impact of mysql
     198                            # insertion
    197199                            if not self.ippToPspsDb.isBoxIngested(boxId, self.scratchDb.dbHost):
    198                                 self.dvoDetections.nativeIngestDetections(boxId, boxDim['RA'], boxDim['DEC'], boxSize)
     200                                self.dvoDetections.nativeIngestDetections(boxId, boxDim)
    199201
    200202                            useFullTables = 1
  • trunk/ippToPsps/jython/queue.py

    r35097 r35203  
    116116   
    117117                    # 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:
     118
     119                    dD = 0.5*skychunk.boxSize
     120                    dec = self.skychunk.minDec + dD
     121
     122                    # 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))
     124                    ra = self.skychunk.minRa + dR
     125                   
     126                    while dec <= self.skychunk.maxDec:
     127                       
     128                        # XXX EAM : need to do something special at the poles...
     129                        if (dec > 85): raise
     130
     131                        while ra <= self.skychunk.maxRa:
    123132           
     133                           # a given box centered at RA,DEC with (linear) size of SIDE has the following bounds
     134                           minRA  = ra  - dR
     135                           maxRA  = ra  + dR
     136                           minDEC = dec - dD
     137                           maxDEC = dec + dD
     138
     139                           XXX EAM:
    124140                           box_id = self.ippToPspsDb.insertBox(ra, dec)
    125141           
     142                           XXX EAM:
    126143                           ids = self.ippToPspsDb.getItemsInThisThisBox(ra, dec)
    127144   
     
    133150               
    134151                           if len(ids) > 0: self.ippToPspsDb.insertPending(box_id, batchType, ids)
     152                           ra = ra + 2*dR
    135153
    136                            dec = dec + self.skychunk.boxSize
    137                        dec = self.skychunk.minDec + self.skychunk.halfBox
    138                        ra = ra + self.skychunk.boxSize
    139            
     154                         dec = dec + 2*dD
     155
     156                         dR = 0.5*skychunk.boxSize / math.cos(math.radians(dec))
     157                         ra = self.skychunk.minRa + dR
     158
    140159                self.logger.info("+-------------+-------------+-------------+-------------+")
    141160
Note: See TracChangeset for help on using the changeset viewer.