Skip to content

Commit

Permalink
Defined __repr__ for tf/ss
Browse files Browse the repository at this point in the history
Makes display work for IPython.
  • Loading branch information
jgoppert committed Mar 25, 2014
1 parent c6f610c commit 71adf2a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/statesp.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
StateSpace._remove_useless_states
StateSpace.copy
StateSpace.__str__
StateSpace.__repr__
StateSpace.__neg__
StateSpace.__add__
StateSpace.__radd__
Expand Down Expand Up @@ -225,6 +226,9 @@ def __str__(self):
str += "\ndt = " + self.dt.__str__() + "\n"
return str

# represent as string, makes display work for IPython
__repr__ = __str__

# Negation of a system
def __neg__(self):
"""Negate a state space system."""
Expand Down
4 changes: 4 additions & 0 deletions src/xferfcn.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
TransferFunction._truncatecoeff
TransferFunction.copy
TransferFunction.__str__
TransferFunction.__repr__
TransferFunction.__neg__
TransferFunction.__add__
TransferFunction.__radd__
Expand Down Expand Up @@ -316,6 +317,9 @@ def __str__(self, var=None):
outstr += "\ndt = " + self.dt.__str__() + "\n"

return outstr

# represent as string, makes display work for IPython
__repr__ = __str__

def __neg__(self):
"""Negate a transfer function."""
Expand Down

0 comments on commit 71adf2a

Please sign in to comment.