Skip to content

Improve docs#41

Merged
murrayrm merged 21 commits into
masterfrom
improve-docs
Mar 29, 2015
Merged

Improve docs#41
murrayrm merged 21 commits into
masterfrom
improve-docs

Conversation

@cwrowley

@cwrowley cwrowley commented Dec 1, 2014

Copy link
Copy Markdown
Contributor

There were some problems with the way the sphinx documentation was configured, in particular the path setting in doc/conf.py. The changes in this pull request fix this, and create "mocks" for numpy and scipy routines so that these packages do not need to be installed for the documentation to build (necessary on readthedocs.org, and a good thing in general).

This branch is based on the 0.6d release, and builds successfully on readthedocs.org (but not on travis.ci, because this release predates that setup). My plan is to merge this in to master, and then improve the documentation further.

There was an error in the way the sphinx documentation was
configured that prevented it from building correctly, now that
absolute imports (e.g., "from control import lti") have been changed
to relative imports (e.g., "from . import lti").

In particular, the directory "root/control" should not be added
to sys.path.  Because this directory contains an __init__.py file,
it is a Python package, and packages should never be added to the
path, or lots of strange things happen, particularly with relative
imports.  Instead, the directory "root" should be added to the
path.  This change was made in the conf.py file.

Also, the mocks for modules were fixed so that the documentation
builds even if numpy, scipy, etc are not installed.

Conflicts:
	doc/conf.py
Conflicts:
	control/ctrlutil.py
Comparisons like
    if A == None:
give a FutureWarning: comparison to `None` will result in an
elementwise object comparison in the future.

This resuits in a bunch of warnings when running nosetests, so
this commit changes these to
    if A is None:
Note that if you don't escape func(x, t, *parms) as
`func(x, t, *parms)`, then Sphinx interprets the * as *emphasis*.
Previously, at least on my machine (Mac with Anaconda),
running runtests.py gave a build error when setup.py tried to
build a local copy of the package.

It turns out this was because we were importing setuptools,
which caused problems, because the rest of the setup.py script
(which was taken from numpy) assumes we are using the numpy
version of setup(), in numpy.distutils.core

This commit removes the import of setuptools and makes setup.py
almost identical to that used in numpy.
Use setuptools instead of numpy.distutils for "setup.py test"
Note: this is apparently a bug in the version of setup.py included
with numpy ("setup.py test" doesn't work for numpy).
The travis build hangs when installing matplotlib for python 3.2
(but not 2.7 and 3.3).  This is apparently a documented issue with
matplotlib: see
    matplotlib/matplotlib#3443
    matplotlib/matplotlib#3741
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.39%) when pulling 731f9bb on improve-docs into 90133e8 on master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.39%) when pulling d091aa5 on improve-docs into 90133e8 on master.

@murrayrm

murrayrm commented Dec 7, 2014

Copy link
Copy Markdown
Member

@cwrowley - there is a build error in version 2.7 after this change. Can you have a look and see if there is an easy fix?

@cwrowley

Copy link
Copy Markdown
Contributor Author

Finally getting back to this. I suggest we no longer support Python 3.2, and instead support 3.3 and 3.4 (and 2.7, and possibly 2.6). That's what Anaconda supports now, and that is probably the main distribution people will be using. (It's certainly what I suggest to people.) This has the added benefit of being able to use the conda installer for Travis builds, which is much faster and cleaner than installing everything from source like we do now.

This dramatically speeds up the installation of numpy, scipy, and
matplotlib in the Travis build.  Note that python 3.2 is not available
in Anaconda, however.
Conflicts:
	control/mateqn.py
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-6.34%) to 72.82% when pulling 32668d3 on improve-docs into 770c4d7 on master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-6.34%) to 72.82% when pulling 5ac5100 on improve-docs into 770c4d7 on master.

@slivingston

Copy link
Copy Markdown
Member

I support the recommendation to not support Python 3.2. Trying to support v3.2 in addition to the other versions of Python listed in the comment above causes complications with respect to denoting Unicode strings (cf. PEP 414).

@cwrowley, I can review and merge this pull request when you are ready. I understand this to be a pull request that addresses issue #33.

@cwrowley

Copy link
Copy Markdown
Contributor Author

@slivingston, thanks--this is ready to go as far as I am concerned. Yes, this addresses issue #33 and #29.

@slivingston slivingston self-assigned this Mar 20, 2015
cwrowley and others added 3 commits March 22, 2015 20:33
Fixes #48

The old algorithm called a general-purpose ODE integrator at each
timestep, and this could be extremely slow (hundreds of times slower
than scipy.signal.lsim).  This new algorithm evaluates the matrix
exponential once, and uses it to advance the simulation at each step.

Importantly, the old algorithm would work for variable timesteps, but
the new version assumes a fixed timestep (as does Matlab's lsim).  This
is the usual case, and it is the price one pays for increased speed.

Note that this algorithm is the same idea as the algorithm used in
scipy.signal.lsim, but the scipy version requires inverting the `A`
matrix, and thus does not work if the system has a pole at the origin.
The algorithm used here works even if there is a pole at the origin.
This commit also adds a test for this case (the double integrator).
Speed up forced_response/lsim
@murrayrm

Copy link
Copy Markdown
Member

I merged the lsim improvements from crowley/lsim. This pull request should be ready for merging into master. Just waiting on Travis CI to build and complete its checks.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-6.51%) to 72.64% when pulling 4f6165a on improve-docs into 770c4d7 on master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-6.26%) to 72.89% when pulling 4f6165a on improve-docs into 770c4d7 on master.

@murrayrm

Copy link
Copy Markdown
Member

Errors from Travis CI. @cwrowley, can you take a look?

@slivingston

Copy link
Copy Markdown
Member

Note that the build failure may be spurious. GitHub has been under a big DDoS attack. https://status.github.com

@slivingston

Copy link
Copy Markdown
Member

I restarted the build, and it succeeded.

murrayrm added a commit that referenced this pull request Mar 29, 2015
@murrayrm murrayrm merged commit 86ebb1c into master Mar 29, 2015
@murrayrm murrayrm deleted the improve-docs branch March 29, 2015 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants