Changeset 226 for trunk/python/asapplotter.py
- Timestamp:
- 01/19/05 18:24:16 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asapplotter.py
r203 r226 1 1 from asap.asaplot import ASAPlot 2 from asap import rcParams 2 3 3 4 class asapplotter: 5 """ 6 The ASAP plotter. 7 By default the plotter is set up to plot polarisations 8 'colour stacked' and scantables across panels. 9 The defaul plotter is called 'plotter'. 10 Note: 11 Currenly it only plots 'spectra' not Tsys or 12 other variables. 13 """ 4 14 def __init__(self): 5 """6 The ASAP plotter.7 By default the plotter is set up to plot polarisations8 'colour stacked' and scantables across panels.9 The defaul plotter is called 'plotter'.10 Note:11 Currenly it only plots 'spectra' not Tsys or12 other variables.13 14 """15 15 self._plotter = ASAPlot() 16 16 … … 33 33 self._sdict] 34 34 self._panels = 's' 35 self._stacking = 'p'35 self._stacking = rcParams['plotter.stacking'] 36 36 self._autoplot = False 37 37 self._minmax = None 38 38 self._data = None 39 39 self._lmap = [] 40 self._title = None 40 41 41 42 def _translate(self, name): … … 97 98 y = None 98 99 m = None 99 tlab = scan._getsourcename(i) 100 if not self._title: 101 tlab = scan._getsourcename(i) 102 else: 103 if len(self._title) == n: 104 tlab = self._title[i] 105 else: 106 tlab = scan._getsourcename(i) 100 107 x,xlab = scan.get_abcissa(i) 101 108 y = scan.getspectrum(i) 102 109 ylab = 'Flux ('+scan.get_fluxunit()+')' 103 110 m = scan.getmask(i) 104 if len(self._lmap) > 0:111 if self._lmap and len(self._lmap) > 0: 105 112 llab = self._lmap[j] 106 113 else: … … 138 145 y = None 139 146 m = None 140 tlab = scan._getsourcename() 147 tlab = self._title 148 if not self._title: 149 tlab = scan._getsourcename() 141 150 x,xlab = scan.get_abcissa() 142 151 y = scan.getspectrum() … … 194 203 m = scan.getmask(k) 195 204 if colmode == 's' or colmode == 't': 196 tlab = self._ldict.get(self._panels)+' '+str(i) 205 if not self._title: 206 tlab = self._ldict.get(self._panels)+' '+str(i) 207 else: 208 if len(self.title) == n: 209 tlab = self._title[i] 210 else: 211 tlab = self._ldict.get(self._panels)+' '+str(i) 197 212 llab = scan._getsourcename(k) 198 213 else: 199 tlab = scan._getsourcename(k) 200 if len(self._lmap) > 0: 214 if self._title and len(self._title) > 0: 215 tlab = self._title[k] 216 else: 217 tlab = scan._getsourcename(k) 218 if self._lmap and len(self._lmap) > 0: 201 219 llab = self._lmap[j] 202 220 else: … … 214 232 215 233 216 def set_mode(self, stacking= 'pol', panelling='scan'):234 def set_mode(self, stacking=None, panelling=None): 217 235 """ 218 236 Parameters: … … 231 249 if not self.set_panels(panelling): 232 250 print "Invalid mode" 251 return 233 252 if not self.set_stacking(stacking): 234 253 print "Invalid mode" 235 return 236 237 def set_panels(self, what='scan'): 254 return 255 if self._data: self.plot() 256 return 257 258 def set_panels(self, what=None): 259 if not what: 260 what = rcParams['plotter.panelling'] 238 261 md = self._translate(what) 239 262 if md: 240 self._panels = md 263 self._panels = md 264 self._title = None 241 265 return True 242 266 return False 243 267 244 def set_stacking(self, what='pol'): 268 def set_stacking(self, what=None): 269 if not what: 270 what = rcParams['plotter.stacking'] 245 271 md = self._translate(what) 246 272 if md: 247 273 self._stacking = md 274 self._lmap = None 248 275 return True 249 276 return False … … 261 288 if start is None and end is None: 262 289 self._minmax = None 263 if self._data is not None: 264 self.plot() 290 if self._data: self.plot() 265 291 else: 266 292 self._minmax = [start,end] 267 if self._data is not None: 268 self.plot() 293 if self._data: self.plot() 269 294 return 270 295 271 def set_legend_map(self, mp=[]):296 def set_legend_map(self, mp=[]): 272 297 """ 273 298 Specify a mapping for the legend instead of using the default … … 286 311 """ 287 312 self._lmap = mp 288 313 if self._data: self.plot() 314 return 315 316 def set_title(self, title=None): 317 self._title = title 318 if self._data: self.plot() 319 return 320 289 321 if __name__ == '__main__': 290 322 plotter = asapplotter()
Note: See TracChangeset
for help on using the changeset viewer.