Changeset 2390 for trunk/python
- Timestamp:
- 12/28/11 16:51:43 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asapgrid.py
r2387 r2390 9 9 class asapgrid: 10 10 def __init__( self, infile ): 11 self.infile = infile12 11 self.outfile = None 13 self.gridder = stgrid( self.infile )14 12 self.ifno = None 13 self.gridder = stgrid() 14 self.setData( infile ) 15 15 16 16 def setData( self, infile ): 17 self.gridder._setin( infile ) 17 if isinstance( infile, str ): 18 self.gridder._setin( infile ) 19 else: 20 self.gridder._setfiles( infile ) 21 self.infile = infile 18 22 19 23 def setIF( self, ifno ): … … 58 62 class _SDGridPlotter: 59 63 def __init__( self, infile, outfile=None, ifno=-1 ): 60 self.infile = infile 64 if isinstance( infile, str ): 65 self.infile = [infile] 66 else: 67 self.infile = infile 61 68 self.outfile = outfile 62 69 if self.outfile is None: 63 self.outfile = self.infile .rstrip('/')+'.grid'70 self.outfile = self.infile[0].rstrip('/')+'.grid' 64 71 self.nx = -1 65 72 self.ny = -1 … … 138 145 # plot observed position 139 146 if plotobs: 140 self.createTableIn() 141 irow = 0 142 while ( irow < self.nrow ): 143 chunk = self.getPointingChunk( irow ) 144 #print chunk 145 pl.plot(chunk[0],chunk[1],',',color='green') 146 irow += chunk.shape[1] 147 #print irow 147 for i in xrange(len(self.infile)): 148 self.createTableIn( self.infile[i] ) 149 irow = 0 150 while ( irow < self.nrow ): 151 chunk = self.getPointingChunk( irow ) 152 #print chunk 153 pl.plot(chunk[0],chunk[1],',',color='green') 154 irow += chunk.shape[1] 155 #print irow 148 156 # show image 149 157 extent=[self.blc[0]-0.5*self.cellx, … … 157 165 pl.title( title ) 158 166 159 def createTableIn( self ): 160 self.tablein = scantable( self.infile, average=False ) 167 def createTableIn( self, tab ): 168 del self.tablein 169 self.tablein = scantable( tab, average=False ) 161 170 if self.ifno < 0: 162 171 ifno = self.tablein.getif(0) … … 166 175 sel = selector() 167 176 sel.set_ifs( ifno ) 168 self.tablein.set_selection( sel ) 177 self.tablein.set_selection( sel ) 169 178 self.nchan = len(self.tablein._getspectrum(0)) 170 self.nrow = self.tablein.nrow() 179 self.nrow = self.tablein.nrow() 171 180 del sel 172 181 … … 195 204 else: 196 205 retval = data[pol] 197 #retval[0][self.nx-1] = -1.0198 206 return retval 199 207
Note:
See TracChangeset
for help on using the changeset viewer.