Fixed a couple of small params bugs

This commit is contained in:
Alan Saul 2014-02-10 15:49:50 +00:00
parent b72d319909
commit a2b986dc5c
2 changed files with 4 additions and 7 deletions

View file

@ -4,7 +4,7 @@
import itertools import itertools
import numpy import numpy
from parameter_core import Constrainable, adjust_name_for_printing from parameter_core import Constrainable, adjust_name_for_printing
from array_core import ObservableArray from array_core import ObservableArray, ParamList
###### printing ###### printing
__constraints_name__ = "Constraint" __constraints_name__ = "Constraint"

View file

@ -49,20 +49,19 @@ class Pickleable(object):
class Parentable(object): class Parentable(object):
def __init__(self, direct_parent=None, parent_index=None): def __init__(self, direct_parent=None, parent_index=None):
super(Parentable,self).__init__() super(Parentable,self).__init__()
self._direct_parent_ = direct_parent self._direct_parent_ = direct_parent
self._parent_index_ = parent_index self._parent_index_ = parent_index
self._highest_parent_ = highest_parent
def has_parent(self): def has_parent(self):
return self._direct_parent_ is not None return self._direct_parent_ is not None
@property @property
def _highest_parent_(self): def _highest_parent_(self):
if self._direct_parent_ is None: if self._direct_parent_ is None:
return self return self
return self._direct_parent_._highest_parent_ return self._direct_parent_._highest_parent_
class Nameable(Parentable): class Nameable(Parentable):
_name = None _name = None
def __init__(self, name, direct_parent=None, parent_index=None): def __init__(self, name, direct_parent=None, parent_index=None):
@ -101,8 +100,6 @@ class Constrainable(Nameable):
""" """
self._highest_parent_._unfix(self) self._highest_parent_._unfix(self)
unfix = unconstrain_fixed unfix = unconstrain_fixed
#=========================================================================== #===========================================================================
# Constrain operations -> done # Constrain operations -> done
#=========================================================================== #===========================================================================