Skip to content

Commit

Permalink
Add support for scipy 0.16.x, fix #60
Browse files Browse the repository at this point in the history
  • Loading branch information
ggventurini committed Aug 5, 2015
1 parent 701c94b commit 17268d3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
3 changes: 3 additions & 0 deletions deltasigma/_calculateTF.py
Expand Up @@ -48,6 +48,9 @@ def calculateTF(ABCD, k=1.):
**Returns:**
(NTF, STF) : a tuple of two LTI objects (or of two lists of LTI objects).
If a version of the ``scipy`` library equal to 0.16.x or
greater is in use, the objects will be ``ZeroPolesGain``
objects, a subclass of ``scipy.signal.lti``.
If the system has multiple quantizers, multiple STFs and NTFs will be
returned.
Expand Down
4 changes: 2 additions & 2 deletions deltasigma/_mapCtoD.py
Expand Up @@ -52,8 +52,8 @@ def mapCtoD(sys_c, t=(0, 1), f0=0.):
* the ABCD matrix,
* a list-like containing the A, B, C, D matrices,
* a list of zpk tuples (internally converted to SS representation).
* a list of LTI objects
* a list of zpk tuples (internally converted to SS representation),
* a list of LTI objects.
t : array_like
The edge times of the DAC pulse used to make CT waveforms
Expand Down
9 changes: 8 additions & 1 deletion deltasigma/_mod1.py
Expand Up @@ -27,7 +27,14 @@ def mod1():
**Returns:**
ABCD, NTF, STF : a tuple of (ndarray, lti, lti)
The elements are the ABCD matrix (ndarray), the NTF (lti object), the STF (lti object).
The elements are the ABCD matrix (ndarray), the NTF (LTI object), the
STF (LTI object).
.. note::
If a version of the ``scipy`` library equal to 0.16.x or greater is in
use, the NTF and STF objects will be ``ZeroPolesGain`` objects, a
subclass of the scipy LTI object (``scipy.signal.lti``).
"""
A = np.array([[1.]])
Expand Down
8 changes: 7 additions & 1 deletion deltasigma/_mod2.py
Expand Up @@ -28,7 +28,13 @@ def mod2():
ABCD, NTF, STF : a tuple of (ndarray, lti, lti)
The elements are the ABCD matrix (ndarray),
the NTF (lti object), the STF (lti object).
the NTF (LTI object), the STF (LTI object).
.. note::
If a version of the ``scipy`` library equal to 0.16.x or greater is in
use, the NTF and STF objects will be ``ZeroPolesGain`` objects, a
subclass of the scipy LTI object (``scipy.signal.lti``).
"""
A = np.array([[1., 0.], [1., 1.]])
Expand Down
6 changes: 3 additions & 3 deletions deltasigma/_utils.py
Expand Up @@ -433,7 +433,7 @@ def _get_zpk(arg, input=0):
# ABCD matrix
A, B, C, D = partitionABCD(arg)
z, p, k = ss2zpk(A, B, C, D, input=input)
elif hasattr(arg, '__class__') and arg.__class__.__name__ == 'lti':
elif isinstance(arg, lti):
z, p, k = arg.zeros, arg.poles, arg.gain
elif _is_zpk(arg):
z, p, k = np.atleast_1d(arg[0]), np.atleast_1d(arg[1]), arg[2]
Expand Down Expand Up @@ -513,7 +513,7 @@ def _get_num_den(arg, input=0):
# ABCD matrix
A, B, C, D = partitionABCD(arg)
num, den = ss2tf(A, B, C, D, input=input)
elif hasattr(arg, '__class__') and arg.__class__.__name__ == 'lti':
elif isinstance(arg, lti):
num, den = arg.num, arg.den
elif _is_num_den(arg):
num, den = carray(arg[0]).squeeze(), carray(arg[1]).squeeze()
Expand Down Expand Up @@ -597,7 +597,7 @@ def _getABCD(arg):
if isinstance(arg, np.ndarray):
# ABCD matrix
A, B, C, D = partitionABCD(arg)
elif hasattr(arg, '__class__') and arg.__class__.__name__ == 'lti':
elif isinstance(arg, lti):
A, B, C, D = arg.A, arg.B, arg.C, np.atleast_2d(arg.D)
elif _is_zpk(arg) or _is_num_den(arg) or _is_A_B_C_D(arg):
sys = lti(*arg)
Expand Down

0 comments on commit 17268d3

Please sign in to comment.