deleted listarray

This commit is contained in:
Max Zwiessele 2014-02-12 11:31:12 +00:00
parent f2e04f138d
commit a29cf87e53
2 changed files with 2 additions and 17 deletions

View file

@ -6,19 +6,6 @@ __updated__ = '2013-12-16'
import numpy as np import numpy as np
from parameter_core import Observable from parameter_core import Observable
class ListArray(np.ndarray):
"""
ndarray which can be stored in lists and checked if it is in.
WARNING: This overrides the functionality of x==y!!!
Use numpy.equal(x,y) for element-wise equality testing.
"""
def __new__(cls, input_array):
obj = np.asanyarray(input_array).view(cls)
return obj
#def __eq__(self, other):
# return other is self
class ParamList(list): class ParamList(list):
def __contains__(self, other): def __contains__(self, other):
@ -29,7 +16,7 @@ class ParamList(list):
pass pass
class ObservableArray(ListArray, Observable): class ObservableArray(np.ndarray, Observable):
""" """
An ndarray which reports changes to its observers. An ndarray which reports changes to its observers.
The observers can add themselves with a callable, which The observers can add themselves with a callable, which

View file

@ -46,6 +46,7 @@ class Param(ObservableArray, Constrainable, Gradcheckable):
""" """
__array_priority__ = -1 # Never give back Param __array_priority__ = -1 # Never give back Param
_fixes_ = None _fixes_ = None
_parameters_ = []
def __new__(cls, name, input_array, default_constraint=None): def __new__(cls, name, input_array, default_constraint=None):
obj = numpy.atleast_1d(super(Param, cls).__new__(cls, input_array=input_array)) obj = numpy.atleast_1d(super(Param, cls).__new__(cls, input_array=input_array))
obj._current_slice_ = (slice(obj.shape[0]),) obj._current_slice_ = (slice(obj.shape[0]),)
@ -144,9 +145,6 @@ class Param(ObservableArray, Constrainable, Gradcheckable):
# from_name = self.name # from_name = self.name
# self.name = new_name # self.name = new_name
# self._direct_parent_._name_changed(self, from_name) # self._direct_parent_._name_changed(self, from_name)
@property
def _parameters_(self):
return []
def _collect_gradient(self, target): def _collect_gradient(self, target):
target[:] = self.gradient.flat target[:] = self.gradient.flat
#=========================================================================== #===========================================================================