-
-
Notifications
You must be signed in to change notification settings - Fork 567
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
sage.plot
: Add/update # needs
#36038
Conversation
1eb4390
to
6ff7f14
Compare
....: region=lambda x,y,z: x<=t or y>=t or z<=t) | ||
sage: a = animate([frame(t) | ||
....: for t in srange(.01,1.5,.2)]) | ||
sage: a[0] # long time |
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.
L90 looks bad after splitting. Please insert spaces after commas.
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 guess I made these changes before deciding to use a file-level tag for sage.symbolic
. Undone now in 0754253
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.
Some questions, and some required changes.
....: region=lambda x,y,z: x<=t or y>=t or z<=t) | ||
sage: a = animate([frame(t) | ||
....: for t in srange(.01,1.5,.2)]) | ||
sage: a[0] # long time | ||
Graphics3d Object | ||
sage: a.show() # long time # optional -- ImageMagick |
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.
Just to be sure, are both forms accepted ? # optional -- ImageMagick
and # optional - ImageMagick
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 of these forms accepted; sage -fixdoctests
normalizes to the # optional - imagemagick
form.
src/sage/plot/animate.py
Outdated
sage: a = animate(v, xmin=0, ymin=0, axes=False) | ||
sage: print(a) | ||
Animation with 3 frames | ||
sage: a.show() # optional -- ImageMagick | ||
sage: a.show() # optional - imagemagick |
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.
ImageMagick
?
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.
OK, I am normalizing in this file to # optional -- ImageMagick
because that seemed to be the preference of the author
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 we use uncapitalized names for all optional doctest tags, except this one? If we allow an exception, then the result would just be an inconsistency. I mean that some will use # optional - imagemagick
anyway.
Is the author strong about this?
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.
Changing it to the fixdoctests normal form is also fine with me.
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 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.
We have other exceptions. For instance we use both gurobi
and Gurobi
:
xyz:sage dcoudert$ git grep "# optional - [gG]urobi" src/sage/
src/sage/combinat/matrices/dancing_links.pyx: sage: d.to_milp('gurobi') # optional - gurobi sage_numerical_backends_gurobi
src/sage/combinat/matrices/dancing_links.pyx: sage: s = d.one_solution_using_milp_solver('gurobi') # optional - gurobi sage_numerical_backends_gurobi
src/sage/combinat/matrices/dancing_links.pyx: sage: s in solutions # optional - gurobi sage_numerical_backends_gurobi
src/sage/features/mip_backends.py: sage: Gurobi()._is_present() # optional - gurobi
src/sage/knots/link.py: sage: L.plot(solver='Gurobi') # optional - Gurobi
src/sage/numerical/backends/cvxpy_backend.pyx: sage: p = MixedIntegerLinearProgram(solver="CVXPY/Gurobi"); p.solve() # optional - gurobi
src/sage/numerical/mip.pyx: sage: p = MixedIntegerLinearProgram(solver="gurobi") # optional - Gurobi
src/sage/numerical/mip.pyx: sage: p.add_constraint(p[0] - p[2], min=1, max=4) # optional - Gurobi
src/sage/numerical/mip.pyx: sage: p.number_of_variables() # optional - Gurobi
When running git grep "# optional - [[:upper:]]" src/sage/
, we see occurrences of: # optional - SAGE_ROOT
, # optional - CPLEX
, # optional - Gurobi
, # optional - Nonexistent_LP_solver
, # optional - CHomP
, # optional - FES
, # optional - RSat
.
I don't think we want to force the use of the uncapitalized form for SAGE_ROOT
. At least we should be consistent inside a file.
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 right then. I won't insist.
src/sage/plot/complex_plot.pyx
Outdated
sage: import numpy as np | ||
sage: from sage.plot.complex_plot import add_lightness_smoothing_to_rgb | ||
sage: add_lightness_smoothing_to_rgb(np.array([[[0, 0.25, 0.5]]]), np.array([[0.75]])) # abs tol 1e-4 | ||
sage: import numpy as np # needs numpy |
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.
block scope 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.
Done
src/sage/plot/graphics.py
Outdated
sage: p = plot(y, -4.1, 1.1) | ||
sage: xlines = lambda a,b: [z for z,m in y.roots()] | ||
sage: p.show(gridlines=[xlines, [0]], frame=True, axes=False) | ||
sage: y = x^5 + 4*x^4 - 10*x^3 - 40*x^2 + 9*x + 36 # needs sage.symbolic |
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.
block scope
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.
Done in 63dcc78
|
||
- ``phirange`` - A 2-tuple of the form `(\phi_{\min},\phi_{\max})`, (default `(0,\pi)`) that specifies the angle in which the curve is to be revolved. | ||
- ``phirange`` -- A 2-tuple of the form `(\phi_{\min},\phi_{\max})`, (default `(0,\pi)`) that specifies the angle in which the curve is to be revolved. |
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.
Could do the alignment on 80 columns
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.
Too much for this ticket
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.
True, it's already a giant one ;)
src/sage/plot/plot3d/shapes.pyx
Outdated
sage: G += G.translate(2.3, 0, -.5) | ||
sage: G += G.translate(3.5, 2, -1) | ||
sage: G.show(aspect_ratio=1, frame=False) | ||
sage: G += sum(Cylinder(.2, 1).translate(cos(2*pi*n/9), sin(2*pi*n/9), 0) # needs sage.symbolic |
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.
block scope ?
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.
Done in 73a5b51
src/sage/plot/animate.py
Outdated
....: G.save_image(filename, **kwds) | ||
|
||
sage: B = MyAnimation([graphs.CompleteGraph(n) for n in range(7,11)], figsize=5) | ||
sage: B = MyAnimation([graphs.CompleteGraph(n) | ||
....: for n in range(7,11)], figsize=5) | ||
sage: d = B.png() |
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 am not sure if we should count leading spaces to check 80 characters limit. 80 characters without counting leading spaces look fine in the rendered doc.
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.
OK, I've joined these lines in b5c1e8a
src/sage/plot/plot.py
Outdated
@@ -419,7 +420,8 @@ def y(x): return x*sin(x**2) | |||
|
|||
sage: g1 = plot(sin(x), 0, 2*pi) | |||
sage: g2 = plot(cos(x), 0, 2*pi, linestyle="--") | |||
sage: (g1+g2).show(ticks=pi/6, tick_formatter=pi) # long time # show their sum, nicely formatted | |||
sage: (g1 + g2).show(ticks=pi/6, # show their sum, nicely formatted # long time | |||
....: tick_formatter=pi) |
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.
The bot reports this alignement error. 4 spaces missing before ....:
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, fixed in e5b62ef
Documentation preview for this PR (built with commit e18852a; changes) is ready! 🎉 |
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.
LGTM.
Thanks! |
sagemathgh-36038: `sage.plot`: Add/update `# needs` <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes sagemath#1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes sagemath#12345". --> - Part of: sagemath#29705 - Cherry-picked from: sagemath#35095 <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [ ] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - sagemath#12345: short description why this is a dependency - sagemath#34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: sagemath#36038 Reported by: Matthias Köppe Reviewer(s): David Coudert, Kwankyu Lee, Matthias Köppe
📝 Checklist
⌛ Dependencies