Skip to content

Commit

Permalink
Enforce array structure for setter inputs in lti subclasses
Browse files Browse the repository at this point in the history
  • Loading branch information
befelix committed May 6, 2015
1 parent 60e2ba0 commit 9f3725c
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions scipy/signal/ltisys.py
Expand Up @@ -527,7 +527,7 @@ def num(self):

@num.setter
def num(self, num):
self._num = num
self._num = atleast_1d(num)

# Update dimensions
if len(self.num.shape) > 1:
Expand All @@ -542,7 +542,7 @@ def den(self):

@den.setter
def den(self, den):
self._den = den
self._den = atleast_1d(den)

def copy(self, system, copy=True):
"""Copy the parameters of another tf system
Expand Down Expand Up @@ -646,8 +646,7 @@ def zeros(self):

@zeros.setter
def zeros(self, zeros):
zeros = numpy.asarray(zeros)
self._zeros = zeros
self._zeros = numpy.asarray(zeros)

# Update dimensions
if len(self.zeros.shape) > 1:
Expand All @@ -662,8 +661,7 @@ def poles(self):

@poles.setter
def poles(self, poles):
poles = numpy.asarray(poles)
self._poles = poles
self._poles = numpy.asarray(poles)

@property
def gain(self):
Expand Down Expand Up @@ -778,15 +776,15 @@ def A(self):

@A.setter
def A(self, A):
self._A = A
self._A = _atleast_2d_or_none(A)

@property
def B(self):
return self._B

@B.setter
def B(self, B):
self._B = B
self._B = _atleast_2d_or_none(B)
self.inputs = self.B.shape[-1]

@property
Expand All @@ -795,7 +793,7 @@ def C(self):

@C.setter
def C(self, C):
self._C = C
self._C = _atleast_2d_or_none(C)
self.outputs = self.C.shape[0]

@property
Expand All @@ -804,7 +802,7 @@ def D(self):

@D.setter
def D(self, D):
self._D = D
self._D = _atleast_2d_or_none(D)

def copy(self, system, copy=True):
"""Copy the parameters of another ss system
Expand Down

0 comments on commit 9f3725c

Please sign in to comment.