From 55077161d44f977d4ce69c52f5035225854c2f05 Mon Sep 17 00:00:00 2001 From: Zhenwen Dai Date: Tue, 14 Oct 2014 10:12:46 +0100 Subject: [PATCH] fix the exception about _update_label_buf when copying and pickling --- GPy/core/parameterization/parameterized.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/GPy/core/parameterization/parameterized.py b/GPy/core/parameterization/parameterized.py index 10956dc7..94aa6573 100644 --- a/GPy/core/parameterization/parameterized.py +++ b/GPy/core/parameterization/parameterized.py @@ -172,7 +172,8 @@ class Parameterized(Parameterizable): if not isinstance(param,Tie): self._highest_parent_.ties.mergeTies(param) else: - self._highest_parent_.ties._update_label_buf() + if hasattr(self._highest_parent_,'ties'): + self._highest_parent_.ties._update_label_buf() else: raise HierarchyError, """Parameter exists already, try making a copy""" @@ -220,7 +221,8 @@ class Parameterized(Parameterizable): if not isinstance(param,Tie): self._highest_parent_.ties.splitTies(param) else: - self._highest_parent_.ties._update_label_buf() + if hasattr(self._highest_parent_,'ties'): + self._highest_parent_.ties._update_label_buf() def add_parameter(self, *args, **kwargs): raise DeprecationWarning, "add_parameter was renamed to link_parameter to avoid confusion of setting variables"