Changeset 35203
- Timestamp:
- Feb 26, 2013, 6:47:49 AM (13 years ago)
- Location:
- trunk/ippToPsps
- Files:
-
- 2 added
- 4 edited
-
doc/boxes.txt (added)
-
doc/dvopsps.txt (added)
-
jython/dvo.py (modified) (6 diffs)
-
jython/ipptopspsdb.py (modified) (5 diffs)
-
jython/loader.py (modified) (3 diffs)
-
jython/queue.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/dvo.py
r35190 r35203 211 211 def setSkyAreaAsStripe(self, ra=0., width=4.): 212 212 213 print "this function should not reached now, error" 214 raise 215 213 216 self.setSkyArea(ra, ra+width, -91., 91.) 214 217 … … 217 220 ''' 218 221 def setSkyAreaAsBox(self, ra=180., dec=0., side=181.0): 222 223 print "this function should not reached now, error" 224 raise 219 225 220 226 halfSide = side/2.0 … … 223 229 ''' 224 230 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 225 233 ''' 226 234 def setSkyArea(self, minRa=-1., maxRa=361., minDec=-91., maxDec=91): … … 584 592 includes purging detections outside sky area 585 593 ''' 586 def nativeIngestDetections(self, boxId, raCenter, decCenter, boxSize):594 def nativeIngestDetections(self, boxId, boxDim): 587 595 588 596 # XXX put the chunk below in a separate method … … 628 636 self.loadImages() 629 637 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 633 650 634 651 # TODO path to DVO prog hardcoded temporarily … … 640 657 cmd += " -D CATDIR " + self.skychunk.dvoLocation 641 658 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) 646 663 647 664 if self.skychunk.parallel: -
trunk/ippToPsps/jython/ipptopspsdb.py
r35185 r35203 4 4 import sys 5 5 import os 6 import math 6 7 import logging 7 8 … … 997 998 998 999 self.skychunk.boxSize = rs.getDouble(10) 999 self.skychunk.halfBox = self.skychunk.boxSize/2.01000 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) 1001 1002 1002 1003 self.skychunk.basePath = rs.getString(11) … … 1031 1032 ''' 1032 1033 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 1033 1036 ''' 1034 1037 def getBoxId(self, ra, dec): … … 1037 1040 WHERE skychunk = '" + self.skychunk.name + "' \ 1038 1041 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) 1041 1045 1042 1046 id = -1 … … 1325 1329 boxDim['SIDE'] = rs.getFloat(3) 1326 1330 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 1327 1345 return boxDim 1328 1346 -
trunk/ippToPsps/jython/loader.py
r35185 r35203 157 157 self.logger.infoSeparator() 158 158 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'])) 160 160 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 165 162 useFullTables = 0 166 163 if batchType != "OB": … … 169 166 # look in DVO for this box (with extra border) 170 167 self.logger.infoPair("Querying DVO for this sky area", "") 168 169 # XXXX EAM : This code should not be used anymore 170 boxSize = 0.0 171 171 self.dvoDetections.setSkyAreaAsBox(boxDim['RA'], boxDim['DEC'], boxSize) 172 172 #self.dvoDetections.setSkyArea() … … 189 189 useFullTables = 1 190 190 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 197 199 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) 199 201 200 202 useFullTables = 1 -
trunk/ippToPsps/jython/queue.py
r35097 r35203 116 116 117 117 # 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: 123 132 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: 124 140 box_id = self.ippToPspsDb.insertBox(ra, dec) 125 141 142 XXX EAM: 126 143 ids = self.ippToPspsDb.getItemsInThisThisBox(ra, dec) 127 144 … … 133 150 134 151 if len(ids) > 0: self.ippToPspsDb.insertPending(box_id, batchType, ids) 152 ra = ra + 2*dR 135 153 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 140 159 self.logger.info("+-------------+-------------+-------------+-------------+") 141 160
Note:
See TracChangeset
for help on using the changeset viewer.
