- Timestamp:
- 03/31/09 12:13:51 (16 years ago)
- Location:
- trunk/python
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/__init__.py
r1558 r1560 107 107 'plotter.histogram' : [False, _validate_bool], 108 108 'plotter.papertype' : ['A4', str], 109 'plotter. xaxisformatting' : ['asap', str],109 'plotter.axesformatting' : ['mpl', str], 110 110 111 111 # scantable … … 144 144 plotter.panelling : scan 145 145 146 # push panels together, to share axis labels146 # push panels together, to share axis labels 147 147 plotter.ganged : True 148 148 … … 162 162 163 163 # The formatting style of the xaxis 164 plotter. xaxisformatting : 'asap' or 'mpl'164 plotter.axesformatting : 'mpl' (default) or 'asap' (for old versions of matplotlib) 165 165 166 166 # scantable … … 188 188 # This is has to be a regular expression 189 189 scantable.reference : .*(e|w|_R)$ 190 190 191 # Fitter 191 192 """ … … 389 390 390 391 __date__ = '$Date$'.split()[1] 391 __version__ = '$Revision :$'392 __version__ = '$Revision$' 392 393 393 394 def is_ipython(): … … 396 397 def version(): print "ASAP %s(%s)"% (__version__, __date__) 397 398 398 def list_scans(t = scantable): 399 import types 400 globs = sys.modules['__main__'].__dict__.iteritems() 401 print "The user created scantables are:" 402 sts = map(lambda x: x[0], filter(lambda x: isinstance(x[1], t), globs)) 403 print filter(lambda x: not x.startswith('_'), sts) 404 return 399 def list_scans(t = scantable): 400 import inspect 401 print "The user created scantables are: ", 402 globs=inspect.currentframe().f_back.f_locals.copy() 403 out = [ k for k,v in globs.iteritems() \ 404 if isinstance(v, scantable) and not k.startswith("_") ] 405 print out 406 return out 405 407 406 408 def commands(): … … 472 474 mx_quotient - Form a quotient using MX data (off beams) 473 475 scale, *, / - return a scan scaled by a given factor 474 add, +, - - return a scan with given value added 476 add, + - return a scan with given value added 477 sub, - - return a scan with given value subtracted 475 478 bin - return a scan with binned channels 476 479 resample - return a scan with resampled channels … … 579 582 axhline,axvline - draw horizontal/vertical lines 580 583 axhspan,axvspan - draw horizontal/vertical regions 584 annotate - draw an arrow with label 585 create_mask - create a scnatble mask interactively 581 586 582 587 xyplotter - matplotlib/pylab plotting functions … … 592 597 commands - this command 593 598 print - print details about a variable 594 list_scans - list all scantables created b tthe user599 list_scans - list all scantables created by the user 595 600 list_files - list all files readable by asap (default rpf) 596 601 del - delete the given variable from memory -
trunk/python/asaplotbase.py
r1553 r1560 14 14 from asap import rcParams as asaprcParams 15 15 from matplotlib.ticker import OldScalarFormatter 16 from matplotlib.ticker import NullLocator17 16 18 17 # API change in mpl >= 0.98 … … 20 19 from matplotlib.transforms import blended_transform_factory 21 20 except ImportError: 22 from matplotlib.transforms import blend_xy_sep_transform 21 from matplotlib.transforms import blend_xy_sep_transform as blended_transform_factory 23 22 24 23 if int(matplotlib.__version__.split(".")[1]) < 87: 25 24 print "Warning: matplotlib version < 0.87. This might cause errors. Please upgrade." 26 27 #class MyFormatter(OldScalarFormatter):28 # def __call__(self, x, pos=None):29 # last = len(self.locs)-230 # if pos==0:31 # return ''32 # else: return OldScalarFormatter.__call__(self, x, pos)33 25 34 26 class asaplotbase: … … 645 637 self.subplots[i]['axes'] = self.figure.add_subplot(rows, 646 638 cols, i+1) 647 if asaprcParams['plotter. xaxisformatting'] == 'mpl':639 if asaprcParams['plotter.axesformatting'] != 'mpl': 648 640 self.subplots[i]['axes'].xaxis.set_major_formatter(OldScalarFormatter()) 649 641 else: … … 651 643 self.subplots[i]['axes'] = self.figure.add_subplot(rows, 652 644 cols, i+1) 653 if asaprcParams['plotter. xaxisformatting'] != 'mpl':645 if asaprcParams['plotter.axesformatting'] != 'mpl': 654 646 655 647 self.subplots[i]['axes'].xaxis.set_major_formatter(OldScalarFormatter()) … … 733 725 sp['axes'].legend((' ')) 734 726 727 735 728 from matplotlib.artist import setp 736 fp = FP(size=rcParams['xtick.labelsize']) 737 xts = fp.get_size_in_points()- (self.cols)/2 738 fp = FP(size=rcParams['ytick.labelsize']) 739 yts = fp.get_size_in_points() - (self.rows)/2 729 fpx = FP(size=rcParams['xtick.labelsize']) 730 xts = fpx.get_size_in_points()- (self.cols)/2 731 fpy = FP(size=rcParams['ytick.labelsize']) 732 yts = fpy.get_size_in_points() - (self.rows)/2 733 fpa = FP(size=rcParams['axes.labelsize']) 734 fpat = FP(size=rcParams['axes.titlesize']) 735 axsize = fpa.get_size_in_points() 736 tsize = fpat.get_size_in_points() 740 737 for sp in self.subplots: 741 738 ax = sp['axes'] 742 s = ax.title.get_size()743 tsize = s-(self.cols+self.rows)744 ax.title.set_size(tsize)745 fp = FP(size=rcParams['axes.labelsize'])739 off = 0 740 if len(self.subplots) > 1: 741 off = self.cols+self.rows 742 ax.title.set_size(tsize-off) 746 743 setp(ax.get_xticklabels(), fontsize=xts) 747 744 setp(ax.get_yticklabels(), fontsize=yts) 748 origx = fp.get_size_in_points()749 origy = origx750 745 off = 0 751 if self.cols > 1: off = self.cols 752 xfsize = origx-off 753 ax.xaxis.label.set_size(xfsize) 754 off = 0 755 if self.rows > 1: off = self.rows 756 yfsize = origy-off 757 ax.yaxis.label.set_size(yfsize) 746 if self.cols > 1: 747 off = self.cols 748 ax.xaxis.label.set_size(axsize-off) 749 if self.rows > 1: 750 off = self.rows 751 ax.yaxis.label.set_size(axsize-off) 758 752 759 753 def subplot(self, i=None, inc=None):
Note:
See TracChangeset
for help on using the changeset viewer.