add untie

This commit is contained in:
Zhenwen Dai 2014-09-04 14:18:23 +01:00
parent 11bb1e4c4c
commit cf638a9e34
3 changed files with 9 additions and 6 deletions

View file

@ -554,6 +554,11 @@ class Indexable(Nameable, Observable):
plist = list(plist)
plist.append(self)
self._highest_parent_.ties.tie_together(plist)
def untie(self, *plist):
plist = list(plist)
plist.append(self)
self._highest_parent_.ties.untie(plist)
#===========================================================================
# Constrain operations -> done

View file

@ -161,12 +161,11 @@ class Parameterized(Parameterizable):
parent.size += param.size
parent = parent._parent_
self._notify_parent_change()
self._highest_parent_._notify_parent_change()
if not self._in_init_:
self._connect_parameters()
self._notify_parent_change()
self._highest_parent_._connect_parameters(ignore_added_names=_ignore_added_names)
self._highest_parent_._notify_parent_change()
self._highest_parent_._connect_fixes()
if isinstance(param,Parameterized):

View file

@ -56,7 +56,7 @@ class Tie(Parameterized):
1. Add the support for multiple parameter tie_together and tie_vector
2. Properly handling parameters with constraints
3. Properly handling the merging of two models [DONE]
4. Properly handling initialization
4. Properly handling initialization [DONE]
"""
def __init__(self, name='Ties'):
@ -102,7 +102,7 @@ class Tie(Parameterized):
self._remove_unnecessary_ties()
self._update_label_buf()
self.updates = True
def _sync_val_group(self, plist):
val = np.asarray([p.param_array for p in plist]).mean()
def _set_val(p):
@ -238,7 +238,6 @@ class Tie(Parameterized):
self._update_label_buf()
self.updates = True
def _check_change(self):
changed = False
if self.tied_param is not None: