[#133] fix: chainging constraint in __init__

This commit is contained in:
Max Zwiessele 2014-09-22 13:57:27 +01:00
parent bccd8e094a
commit ac4dbb851d
3 changed files with 28 additions and 3 deletions

View file

@ -636,10 +636,18 @@ class Indexable(Nameable, Observable):
"""
From Parentable:
Called when the parent changed
update the constraints and priors view, so that
constraining is automized for the parent.
"""
from index_operations import ParameterIndexOperationsView
self.constraints = ParameterIndexOperationsView(parent.constraints, parent._offset_for(self), self.size)
self.priors = ParameterIndexOperationsView(parent.priors, parent._offset_for(self), self.size)
#if getattr(self, "_in_init_"):
#import ipdb;ipdb.set_trace()
#self.constraints.update(param.constraints, start)
#self.priors.update(param.priors, start)
offset = parent._offset_for(self)
self.constraints = ParameterIndexOperationsView(parent.constraints, offset, self.size)
self.priors = ParameterIndexOperationsView(parent.priors, offset, self.size)
self._fixes_ = None
for p in self.parameters:
p._parent_changed(parent)

View file

@ -149,6 +149,7 @@ class Parameterized(Parameterizable):
self.priors.update(param.priors, start)
self.parameters.insert(index, param)
self._notify_parent_change()
param.add_observer(self, self._pass_through_notify_observers, -np.inf)
parent = self