Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add smart selection of gains for root locus plot. Calculation of break…#132

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
gonmolina wants to merge6 commits intopython-control:masterfromgonmolina:smart-rlocus

Conversation

gonmolina
Copy link
Contributor

…points in real axis.

@slivingston
Copy link
Member

Is there any way to make your proposed features without breaking the public API?

As a matter of style, I agree with some of the changes, e.g., avoiding camelCase inroot_locus, but I think that they are better done as part of a batch improvement of style that goes into a single version increment.

@slivingston
Copy link
Member

I will wait until you comment before doing a thorough review. However, I skimmed some of your work inee7c35d, and most of the refactoring is good. In terms of the API, tests are failing onroot_locus and a call to_convertToTransferFunction.

Whether_convertToTransferFunction should have the prefix_ might be worth discussing, but that might be outside the scope of this PR.

@slivingstonslivingston self-assigned thisFeb 17, 2017
@slivingston
Copy link
Member

Regarding the comments near the top of rlocus.py where you list changes and the date, it is much better to place those notes about changes in your commit message because:

  1. file history is studied through commit history;
  2. changelogs in the files can become difficult to search compared to root CHANGELOG.

Some of the files have author, date, and change notes, but they are mostly vestigial and not consistently added. They might be deleted soon.

"""Root locus plot

Calculate the root locus by finding the roots of 1+k*TF(s)
where TF is self.num(s)/self.den(s) and each k is an element
ofkvect.
ofgvect.
Copy link
Member

@murrayrmmurrayrmFeb 17, 2017
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This should still bekvect, based on the call signature.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

ok!


Parameters
----------
sys : LTI object
dinsys : LTI object
Copy link
Member

@murrayrmmurrayrmFeb 17, 2017
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Is there a reason to usedinsys? Most (all?) other functions usesys for the system argument. What doesdinsys stand for??

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I had problems while I was testing the code (maybe an import sys in the worng place). I will rename it to sys and test again.


rlocus = root_locus
rlocus = root_locus
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

File should end in a new line, no?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

ok

restore original API (variables Plot, PrintGain), and calling _convertToTransferFunctionfix kvect word commentsys as variable name in input argumentadd the on line in the last line
@gonmolina
Copy link
ContributorAuthor

@slivingston
I have taken into account all comments you post and I have made the corrections. I am not programmer so probably there are several mistakes related to collaborate in a project (like changing the API). This is because it is the first time I try to participate in this kind of work.
There are any guide to collaborate with this particular project ? There are some automatic check that to do before the pull request?
I have plot several root locus and lines look nice using default gains calculation.

@murrayrm I made suggested corrections.

Thanks a lot.

@coveralls
Copy link

coveralls commentedFeb 18, 2017
edited
Loading

Coverage Status

Coverage increased (+0.7%) to 78.001% when pulling32fe9b6 on gonmolina:smart-rlocus into5ab74cf on python-control:master.

@coveralls
Copy link

coveralls commentedFeb 19, 2017
edited
Loading

Coverage Status

Coverage increased (+0.7%) to 78.03% when pulling03df169 on gonmolina:smart-rlocus into5ab74cf on python-control:master.

@slivingston
Copy link
Member

@gonmolina I will review your recent changes tomorrow.

Regarding some guide for collaboration on this project, there is not an explicit one. The general style guides for Python apply:PEP 8 andPEP 257. Many practices used for the NumPy project we also aspire to have here, so consider consultingthe NumPy contributing guide. Some details, e.g., about NumPy project governance, are not relevant here. Another guide that is good to try to follow isthat of TuLiP.

Regarding automatic checks on the pull request (PR), tests are performed using Travis CI. You can find results from jobs for PRs athttps://travis-ci.org/python-control/python-control/pull_requests

@slivingston
Copy link
Member

Several of the changes that I am requesting involve rebasing and modifying commits in this PR. You might already know how, but in case not, two useful beginning references are:

Alternatively, if you add commits such that the total diff of all combined commits in this PR is good, then I can just squash them into a single commit and merge that.

@slivingston
Copy link
Member

Is the code in this PR ported from Octave ?

@slivingston
Copy link
Member

I ask because Octave is under the GPL, and I do not want to GPL-pollute thepython-control sourcetree.

E.g., compare withhttps://sourceforge.net/p/octave/control/ci/tip/tree/inst/rlocus.m

# $Id$

# Packages used by this module
from functools import partial
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why did you move the import ofpartial to here? Similarly, why were the imports ofscipy.signal andpylab moved?

Are you changing the code to follow the style that groups imports according to standard library, other packages, etc.? If so, can you move such style-only changes to a dedicated commit? History is easier to understand that way.

@@ -80,6 +88,7 @@ def root_locus(sys, kvect=None, xlim=None, ylim=None, plotstr='-', Plot=True,
PrintGain: boolean (default = True)
If True, report mouse clicks when close to the root-locus branches,
calculate gain, damping and print
plotstr: string that declare of the rlocus (see matplotlib)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can you add details to this description? E.g.,

format string for rendering the root loci. Interpretation of the string is defined by matplotlib.pyplot.plot.

ax = pylab.axes()

#plot open loop poles
#Plot open loop poles
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I might be missing something, but it is not clear why you changed these "plot" words to uppercase "Plot". Is it merely a style change? If so, can you place it in a separate commit and indicate that it is a trivial change and only affects comments?

@slivingston
Copy link
Member

After you address my question about originality, can you provide a nontrivial demonstration of the changes? I played some with your_default_gains, but I would enjoy your recommendation about an example.

@gonmolina
Copy link
ContributorAuthor

@slivingston
I have ported from Octave a part of this PR. I have also used some part of the code of evans.sci (siclab) in this PR. However, for simplicity, most of the pionts calculated would be the same that calculated in Octave.

I just fix some problems I found in Octave. In Octave rlocus paths doesn't finished in zeros (I add some extra points) and I change the way that sort the roots (I use the same that It was used in rlocus.py). Other differences are axis limits, and asymptotes.

About the license problems. I think right nowit is not original, or it is hard to defend the originality. I didn't try to hide it (if you compare you will see that even the comments in part of the code are the same).

I have some simple ideas to improve the algorithm, adding points in different positions that could result in fewer calculated points. The same for the finishing and adding points criteria. However I don't know when the work begins to be original. I mean, the main idea would be the same: add points to the rlocus up to a criteria is satisfied (evans.sci and rlocus.m use the same finishing criteria, but the way they add points is quite different between one and another). My idea is to use the same way to add points but changing the creterias. Could be that considered original enough?
There is any rule to define when it is original or when is a copy?

@slivingston
Copy link
Member

Thanks for your explanation. It might have been better if I asked you whether it is derivative work, since that is the crucial question for copyright. Surely there is some originality in the process of porting.

The general guide about whether something is a derivative work is whether you depended critically on referring to most or all details of the original. E.g., did you copy-and-paste and then make necessary changes? Or, did you have to repeatedly compare with the original Octave implementation, line-by-line?

The copyright applies to the materials, not the ideas. So, if you provide a new implementation of an existing algorithm, all without detailed copying or porting of another existing implementation, then there should be no doubt about your new implementation being new (not derived).

@gonmolina
Copy link
ContributorAuthor

@slivingston
Ok. Thanks for the comments. In that way, I think this PR have to be rejected! I will rewrite the code taking into consideration all comments you made and I will make a new PR. Thank you very much.

@gonmolinagonmolina deleted the smart-rlocus branchMarch 21, 2017 01:24
@slivingston
Copy link
Member

@gonmolina thanks. I will review your new PR soon.

@slivingston
Copy link
Member

for ease of future reference, note that the replacement PR is#138

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@murrayrmmurrayrmmurrayrm left review comments

@slivingstonslivingstonslivingston requested changes

Assignees

@slivingstonslivingston

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@gonmolina@slivingston@coveralls@murrayrm

[8]ページ先頭

©2009-2025 Movatter.jp