GithubHelp home page GithubHelp logo

Comments (12)

murrayrm avatar murrayrm commented on July 19, 2024

*Commented by anonymous on 2014-04-01 16:09 UTC
Is there anything I can do to help get these patches accepted? I would like to be able to share my work with others without directing them to download my private git repo. Here is my current notebook, it goes from first principles to a full LQR based lateral/longitudinal controller in one IPython notebook using control/scipy/numpy/sympy.

from python-control.

murrayrm avatar murrayrm commented on July 19, 2024

*Commented by anonymous on 2014-04-01 16:12 UTC
Note that the current aerodynamic model is a bit off, I haven't put reasonable coefficients in yet. I just wanted to get something working. At the angle of attack it is at, it should be stalling but I didn't model stall. I have done a CFD analysis of a UAV in XFLR5 and will put those coefficients in today.

from python-control.

murrayrm avatar murrayrm commented on July 19, 2024

Commented by scottlivingston on 2014-04-01 16:44 UTC
You are abusing __repr__ by setting it to __str__. This patch qualifies as an unnecessary hack for use in IPython. Cf.
https://docs.python.org/2.7/reference/datamodel.html#object.__repr__

from python-control.

murrayrm avatar murrayrm commented on July 19, 2024

*Commented by anonymous on 2014-04-01 16:59 UTC
I think setting repr to something would be useful. You could make it a call to the ctor string. The current address of the object that is default is useless. Also, can you take a look at the other patches. There are required changes there for my code to work. Like state-space array access.

from python-control.

murrayrm avatar murrayrm commented on July 19, 2024

Commented by scottlivingston on 2014-04-01 17:15 UTC
Anonymous: Are you James Goppert? Please log-in so that your username is archived in these comments.

from python-control.

murrayrm avatar murrayrm commented on July 19, 2024

Commented by jgoppert on 2014-04-01 17:36 UTC
Yes, sorry about that, was using my cell.

from python-control.

murrayrm avatar murrayrm commented on July 19, 2024

Commented by murrayrm on 2014-04-02 20:37 UTC
I'll try to take a look at the various patches and incorporate them this coming weekend. For this particular patch, my plan is to follow the python guidelines.

from python-control.

murrayrm avatar murrayrm commented on July 19, 2024

*Commented by anonymous on 2014-04-02 21:45 UTC
Thanks!

from python-control.

murrayrm avatar murrayrm commented on July 19, 2024

Commented by jgoppert on 2014-04-02 21:48 UTC
I'm currently working on packaging slycot for pypi. Kind of a headache, but I'm getting there.

from python-control.

cwrowley avatar cwrowley commented on July 19, 2024

Included in 71cfb32. But we should probably redefine __repr__ to give an expression that will recreate the object, rather than duplicating __str__, as mentioned above.

from python-control.

slivingston avatar slivingston commented on July 19, 2024

I traced the integration of commit 71cfb32 through pull request #28 . Neither here (#16) nor there was the concern about abuse of __repr__ addressed. Or rather, it was decided as something that can be changed later. For comparison and a suggestion as to why this may matter,

from __future__ import print_function
import numpy as np

x = np.random.rand(3)
print(A.__str__())
print(A.__repr__())

whereas

from __future__ import print_function
import control

S = control.StateSpace([[-1.]], [[1.]], [[1.]], [[0.]])
print(S.__str__())
print(S.__repr__())

As an example of how we may create a __repr__ method that is consistent with the Python data model, consider the following (continuing the previous code snippet):

def example_repr(S):
    return "StateSpace("+repr(S.A)+", "+repr(S.B)+", "+repr(S.C)+", "+repr(S.D)+")"

print(example_repr(S))

This representation string is easily used in eval(), after ensuring the appropriate names are available.

from control import StateSpace
from numpy import matrix

S2 = eval(example_repr(S))

where S2 is an instance of StateSpace.

from python-control.

murrayrm avatar murrayrm commented on July 19, 2024

Changed milestone on this closed release to improve tracking.

from python-control.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.