Simplified delete_text_object

master
Per A Brodtkorb 9 years ago
parent 15461795c1
commit 918bf837a8

@ -43,22 +43,17 @@ def delete_text_object(gidtxt, figure=None, axis=None, verbose=False):
def lmatchfun(x): def lmatchfun(x):
return _matchfun(x, gidtxt) return _matchfun(x, gidtxt)
objs = axis.findobj(lmatchfun) for handle in [axis, figure]:
for obj in objs: objs = handle.findobj(lmatchfun)
try: name = handle.__name__
axis.texts.remove(obj) msg = "Tried to delete a non-existing {0} from {1}".format(gidtxt,
except: name)
if verbose: for obj in objs:
warnings.warn( try:
'Tried to delete a non-existing %s from axis' % gidtxt) handle.texts.remove(obj)
objs = figure.findobj(lmatchfun) except:
for obj in objs: if verbose:
try: warnings.warn(msg)
figure.texts.remove(obj)
except:
if verbose:
warnings.warn(
'Tried to delete a non-existing %s from figure' % gidtxt)
def cltext(levels, percent=False, n=4, xs=0.036, ys=0.94, zs=0, figure=None, def cltext(levels, percent=False, n=4, xs=0.036, ys=0.94, zs=0, figure=None,

@ -464,7 +464,8 @@ class _Filter(object):
# Search the smoothing parameter s that minimizes the GCV score # Search the smoothing parameter s that minimizes the GCV score
s = 10.0 ** p s = 10.0 ** p
Gamma = self.gamma(s) Gamma = self.gamma(s)
if aow > 0.9: # aow = 1 means that all of the data are equally weighted if aow > 0.9:
# aow = 1 means that all of the data are equally weighted
# very much faster: does not require any inverse DCT # very much faster: does not require any inverse DCT
residual = DCTy.ravel() * (Gamma.ravel() - 1) residual = DCTy.ravel() * (Gamma.ravel() - 1)
else: else:

Loading…
Cancel
Save