Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

signal.cont2discrete not handling lti instances as documented #11312

Open
pgorczak opened this issue Jan 3, 2020 · 0 comments
Open

signal.cont2discrete not handling lti instances as documented #11312

pgorczak opened this issue Jan 3, 2020 · 0 comments

Comments

@pgorczak
Copy link

pgorczak commented Jan 3, 2020

The docs for cont2discrete say that it takes an instance of the lti class as a possible argument. I could not make this work with a system created via TransferFunction.

Example:

import scipy.signal as sig
g = sig.TransferFunction([1], [1, 1])
print(isinstance(g, sig.lti))
gd = sig.cont2discrete(g, dt=0.01)

This snippet prints True and then raises TypeError: object of type 'TransferFunctionContinuous' has no len().

My current workaround is using the to_discrete member function instead:

gd = g.to_discrete(dt=0.01)

The exception occurs at the first line in cont2discrete, which checks for len(system) == 1, seemingly to determine if it's an instance of lti. Maybe this could simply be replaced with an isinstance call? Looks like dt should also be passed on in the line after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants