-
Notifications
You must be signed in to change notification settings - Fork 21
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
adjusted docstrings as per #348, reduced execution time #377
base: master
Are you sure you want to change the base?
Conversation
|
||
# %% | ||
prob_list[selection].plot_objective_value() | ||
#_ = prob_list[selection].plot_objective_value() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't comment out lines in examples, best to remove them vs. commenting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't comment out lines in examples, best to remove them vs. commenting.
I thought like this a potential user could easily return to running both. I put in the Notes why I did it.
Still better to delete
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is a bit bad form. If you want to tell them some kind of option that will not actually be run in our example do this in a comment block as rst:
# %%
# If you want to check ... then use code like::
#
# prob_list[selection].plot_objective_value()
This will show up as a monospaced text they can easily copy and paste into their script but will not be run in the example.
does this look better? |
This simulation seems to be free of the |
# | ||
# fig, ax = plt.subplots(figsize=(8, 8)) | ||
# | ||
# anim, _ = drucken(selection, fig, ax) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this will render as you expect. To do code blocks in RST format it looks like:
Type this code::
a, b = 1, 2
print(a + b)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I played around with it for a long time. Then, finally, on the make html
rendering it looked o.k.
I ran out of ideas.
I start like this:
# %%
and the added the text.
I don't think this will render as you expect. To do code blocks in RST format it looks like:
Type this code:: a, b = 1, 2 print(a + b)
Does this mean I have to typle like
three back slashes
text
three backslashes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the code lines should be indented relative to the text line above it that ends in a ::
.
https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#literal-blocks
@@ -105,7 +124,13 @@ def strasse(x, a, b): | |||
|
|||
# %% | |||
# Set up the optimization problems and solve them. | |||
for selection in (0, 1): | |||
# if you want to run both optimizations, replace the two lines below with this | |||
# line: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# line: | |
# line:: |
# if you want to run both optimizations, replace the two lines below with this | ||
# line: | ||
# | ||
# for selection in [0, 1]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# for selection in [0, 1]: | |
# for selection in [0, 1]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are the two fixes for this to render correct (I think).
fig, ax = plt.subplots(figsize=(8, 8)) | ||
anim, _ = drucken(selection, fig, ax) | ||
# If you want to run the solution with a fixed time interval, you should add the | ||
# following code to the code here: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# following code to the code here: | |
# following code to the code here:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!!
I will be out of station for two days, will try on Tuesday.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no rush on anything.
Objective | ||
--------- | ||
|
||
- a simplex example to show how to use ``opty's`` capability of variabel node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- a simplex example to show how to use ``opty's`` capability of variabel node | |
- a simple example to show how to use opty's capability of variable node |
using |
Error said unexpected indentation in line 309, but there was on indentation that I could see. |
@moorepants I am at a loss with the error message: I see no indentation. |
There is an error |
I am at a loss with this error of |
It is a RestructuredText formatting error. |
So, not my error? |
Yes, it is your formatting error. Anything in a |
It isn't line 309 in the py file it is line 309 in the generated rst file: |
Thanks! At least now I got in the area of the problem. |
Reduced running time from 17 sec to 8 sec, by reducing frames in the animation. It deteriorates the animation a bit. |
The formatting rules for RestructuredText literal blocks is here: https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#literal-blocks |
While the program was designerd to run both versions, fixed time interval and variable interval, only the animation for variable interval was shown. I commented out the fixed time interval portions. Reduced execution time on my PC from around 53 sec to around 23 sec.