- Timestamp:
- 03/17/11 17:52:18 (14 years ago)
- Location:
- trunk/python
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asapplotter.py
r2038 r2051 55 55 self._ipanel = -1 56 56 self._panelrows = [] 57 self._headstring = None 58 self._headsize = None 57 59 58 60 def _translate(self, instr): … … 842 844 self._offset = None 843 845 self.set_selection(None, False) 846 self._reset_header() 847 848 def _reset_header(self): 849 self._headsize = None 850 self._headstring = None 844 851 845 852 def _plot(self, scan): … … 1377 1384 # printing header information 1378 1385 @asaplog_post_dec 1379 def print_header(self, plot=True, fontsize= 9, logger=False, selstr='', extrastr=''):1386 def print_header(self, plot=True, fontsize=None, logger=False, selstr='', extrastr=''): 1380 1387 """ 1381 1388 print data (scantable) header on the plot and/or logger. 1382 1389 Parameters: 1383 1390 plot: whether or not print header info on the plot. 1384 fontsize: header font size (valid only plot=True) 1391 fontsize: header font size (valid only plot=True) default: 9 1385 1392 logger: whether or not print header info on the logger. 1386 1393 selstr: additional selection string (not verified) … … 1395 1402 ssum=self._data.__str__() 1396 1403 # Print Observation header to the upper-left corner of plot 1397 if plot: 1404 if self._headstring: 1405 headstr = self._headstring 1406 if extrastr != '': headstr[0]=extrastr+'\n'+headstr[0] 1407 if selstr != '': headstr[2] += selstr 1408 fontsize = fontsize or self._headsize 1409 else: 1398 1410 headstr=[ssum[ssum.find('Observer:'):ssum.find('Flux Unit:')]] 1399 1411 headstr.append(ssum[ssum.find('Beams:'):ssum.find('Observer:')] 1400 +ssum[ssum.find('Rest Freqs:'):ssum.find('Abcissa:')])1412 +ssum[ssum.find('Rest Freqs:'):ssum.find('Abcissa:')]) 1401 1413 if extrastr != '': headstr[0]=extrastr+'\n'+headstr[0] 1402 #headstr[1]='Data File: '+(filestr or 'unknown')+'\n'+headstr[1]1403 1414 ssel='***Selections***\n'+(selstr+self._data.get_selection().__str__() or 'none') 1404 1415 headstr.append(ssel) 1416 del ssel 1417 fontsize = fontsize or 9 1418 self._headsize = fontsize 1419 self._headstring = headstr 1420 1421 if plot: 1422 self._plotter.hold() 1405 1423 nstcol=len(headstr) 1406 1407 self._plotter.hold()1408 1424 for i in range(nstcol): 1409 1425 self._plotter.figure.text(0.03+float(i)/nstcol,0.98, … … 1418 1434 verticalalignment='bottom',fontsize=8) 1419 1435 self._plotter.release() 1420 del headstr, ssel1421 1436 if logger: 1437 sextra = headstr[0][0:headstr[0].find('Observer:')].rstrip('\n') 1438 selstr = "Selections: "+(headstr[2].lstrip('***Selections***\n') or 'none')+"\n \n" 1439 1422 1440 asaplog.push("----------------\n Plot Summary\n----------------") 1423 asaplog.push(extrastr) 1424 asaplog.push(ssum[ssum.find('Beams:'):]) 1425 del ssum 1441 asaplog.push(sextra) 1442 asaplog.push(ssum[ssum.find('Beams:'):ssum.find('Selection:')]\ 1443 + selstr + ssum[ssum.find('Scan Source'):]) 1444 del ssum, headstr 1445 1446 # def clear_header(self): 1447 # if not self._headstring or len(self._plotter.figure.texts) == 0: 1448 # asaplog.push("No header has been plotted. Exit without any operation") 1449 # asaplog.post("WARN") 1450 # else: 1451 # self._plotter.hold() 1452 # for textobj in self._plotter.figure.texts: 1453 # if textobj.get_text() in self._headstring: 1454 # try: 1455 # textobj.remove() 1456 # except NotImplementedError: 1457 # self._plotter.figure.texts.pop(self._plotter.figure.texts.index(textobj)) 1458 # self._plotter.release() 1459 # self._reset_header() -
trunk/python/casatoolbar.py
r1983 r2051 181 181 ### actual plotting of the new page 182 182 def _new_page(self,goback=False): 183 top = None 183 184 if self.plotter._startrow <= 0: 184 185 msg = "The page counter is reset due to chages of plot settings. " … … 187 188 asaplog.post('WARN') 188 189 goback = False 189 190 else: 191 top = self.plotter._plotter.figure.subplotpars.top 192 190 193 self.plotter._plotter.hold() 191 194 if goback: … … 196 199 self.plotter._plotter.release() 197 200 self.plotter._plotter.tidy() 201 if self.plotter._headstring: 202 if top and top != self.plotter._margins[3]: 203 # work around for sdplot in CASA. complete checking in future? 204 self.plotter._plotter.figure.subplots_adjust(top=top) 205 self.plotter.print_header() 198 206 self.plotter._plotter.show(hardrefresh=False) 207 del top 199 208 200 209 ### calculate the panel ID and start row to plot the previous page
Note:
See TracChangeset
for help on using the changeset viewer.