merged in kern chancges

This commit is contained in:
James Hensman 2014-02-20 14:07:54 +00:00
commit 847fdef9c8
54 changed files with 914 additions and 1280 deletions

View file

@ -23,7 +23,7 @@ class Param(ObservableArray, Constrainable, Gradcheckable, Indexable, Parentable
:param input_array: array which this parameter handles
:type input_array: numpy.ndarray
:param default_constraint: The default constraint for this parameter
:type default_constraint:
:type default_constraint:
You can add/remove constraints by calling constrain on the parameter itself, e.g:
@ -59,7 +59,7 @@ class Param(ObservableArray, Constrainable, Gradcheckable, Indexable, Parentable
def __init__(self, name, input_array, default_constraint=None):
super(Param, self).__init__(name=name, default_constraint=default_constraint)
def __array_finalize__(self, obj):
# see InfoArray.__array_finalize__ for comments
if obj is None: return
@ -206,7 +206,7 @@ class Param(ObservableArray, Constrainable, Gradcheckable, Indexable, Parentable
return numpy.r_[a]
return numpy.r_[:b]
return itertools.imap(f, itertools.izip_longest(slice_index[:self._realndim_], self._realshape_, fillvalue=slice(self.size)))
#===========================================================================
# Convenience
#===========================================================================
@ -271,7 +271,7 @@ class Param(ObservableArray, Constrainable, Gradcheckable, Indexable, Parentable
clean_curr_slice = [s for s in slice_index if numpy.any(s != Ellipsis)]
for i in range(self._realndim_-len(clean_curr_slice)):
i+=len(clean_curr_slice)
clean_curr_slice += range(self._realshape_[i])
clean_curr_slice += range(self._realshape_[i])
if (all(isinstance(n, (numpy.ndarray, list, tuple)) for n in clean_curr_slice)
and len(set(map(len, clean_curr_slice))) <= 1):
return numpy.fromiter(itertools.izip(*clean_curr_slice),
@ -437,4 +437,4 @@ class ParamConcatenation(object):
start = False
return "\n".join(strings)
def __repr__(self):
return "\n".join(map(repr,self.params))
return "\n".join(map(repr,self.params))