Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhanced 'Mean' attribute on vcs plots #1028

Merged
merged 2 commits into from
Feb 11, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Packages/vcs/Lib/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from Pdata import *
from types import *
import inspect
import cdutil

## Following for class properties
def _getgen(self,name):
Expand Down Expand Up @@ -1239,9 +1240,15 @@ def plot(self,x,slab,gm,bg=0,min=None,max=None,X=None,Y=None,**kargs):
tt.string='Max %g' % smx
elif s=='mean':
if not inspect.ismethod(getattr(slab,'mean')):
tt.string='Mean '+str(getattr(slab,s))
meanstring='Mean '+str(getattr(slab,s))
else:
tt.string='Mean %f'%slab.mean()
try:
#slices = [slice(0,1),] * (slab.ndim -2 )
meanstring='Mean %.4g'% float(cdutil.averager(slab,
axis = " ".join(["(%s)" % S for S in slab.getAxisIds()])))
except Exception,err:
meanstring='Mean %.4g'%slab.mean()
tt.string=meanstring
else :
tt.string=str(getattr(slab,s))
tt.x=[sub.x]
Expand Down