Skip to content
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

Add new option to hyperbolic graphics to select the model #22081

Closed
sagetrac-jhonrubia6 mannequin opened this issue Dec 20, 2016 · 76 comments
Closed

Add new option to hyperbolic graphics to select the model #22081

sagetrac-jhonrubia6 mannequin opened this issue Dec 20, 2016 · 76 comments

Comments

@sagetrac-jhonrubia6
Copy link
Mannequin

sagetrac-jhonrubia6 mannequin commented Dec 20, 2016

As a first approach add the poincare disc model, and an option to select the model to use the drawing hyperbolic arcs and polygons

CC: @tscrim

Component: graphics

Keywords: hyperbolic geometry plot

Author: Javier Honrubia González

Branch/Commit: 29f335c

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/22081

@sagetrac-jhonrubia6 sagetrac-jhonrubia6 mannequin added this to the sage-7.5 milestone Dec 20, 2016
@sagetrac-jhonrubia6
Copy link
Mannequin Author

sagetrac-jhonrubia6 mannequin commented Feb 16, 2017

Changed keywords from none to hyperbolic geometry plot

@sagetrac-jhonrubia6 sagetrac-jhonrubia6 mannequin modified the milestones: sage-7.5, sage-7.6 Feb 16, 2017
@sagetrac-jhonrubia6
Copy link
Mannequin Author

sagetrac-jhonrubia6 mannequin commented Feb 16, 2017

@sagetrac-jhonrubia6
Copy link
Mannequin Author

sagetrac-jhonrubia6 mannequin commented Apr 25, 2017

New commits:

82a041aAdded the disc model to hyperbolic_arc and polygons

@sagetrac-jhonrubia6
Copy link
Mannequin Author

sagetrac-jhonrubia6 mannequin commented Apr 25, 2017

Commit: 82a041a

@sagetrac-jhonrubia6 sagetrac-jhonrubia6 mannequin modified the milestones: sage-7.6, sage-8.0 Apr 25, 2017
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 27, 2017

Branch pushed to git repo; I updated commit sha1. New commits:

ea92d27Merge branch 'develop' into t/22081/add_new_option_to_hyperbolic_graphics_to_select_the_model

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 27, 2017

Changed commit from 82a041a to ea92d27

@sagetrac-msaaltink
Copy link
Mannequin

sagetrac-msaaltink mannequin commented May 8, 2017

comment:6

I like this new functionality. It would be great if regular polygons could also be drawn in the Poincare disc model.

Here are a few issues with the coding style:

In hyperbolic_arc.py, HyperbolicArc.init, the code

        else:
            if model == "PD":

would better be

        elif model == "PD":

which then requires less indenting for the following block.

HyperbolicArc.init should also report an error if model is neither 'UHP' or 'PD' rather than raising some other error. For example, hyperbolic_arc(0, 1, model='foo') raises an index error rather than reporting the actual user error.

The same two remarks apply to HyperbolicPolygon.init.

The style guide in PEP 8 says "Method definitions inside a class are surrounded by a single blank line.". Please do that here.

The coding guideline for docstrings says

It describes the function or method’s effect as a command (“Do this”, “Return that”), not as a description like “Returns the pathname ...”.

So for example, the documentation for _PD_hyperbolic_arc, "Function to construct an hyperbolic arc ...", should start "Construct an hyperbolic arc ...". The docstring for _bezier_path, "Returns the corresponding bezier path", should not start with "Returns the" and in any case should be more informative about the function. As this function does not in fact return anything, the docstring is quite misleading.

The docstrings should be more complete as well, for all method definitions, describing the inputs and output and containing at least one example or test. See http://doc.sagemath.org/html/en/developer/coding_basics.html#section-documentation-strings

There are several identical methods in hyperbolic_arc.py and hyperbolic_polygon.py. This code duplication is never a good idea if the functions are truly the same. Perhaps the two classes could inherit from some new class that contains a singly copy of these definitions---this will make repair easier if an error is discovered in future or some new functionality is to be added.

It would be useful somewhere to describe the different coordinate systems used for the two models, as it is not immediately obvious what are legitimate PD coordinates.

It is too bad that there is no model-independent way to specify the points (which would make it easy to plot the same diagram in the two different models). However, adding this probably goes beyond the scope of what you are trying to do here.

Finally, file /src/bin/sage-env-config should not be tracked.

@sagetrac-jhonrubia6
Copy link
Mannequin Author

sagetrac-jhonrubia6 mannequin commented May 8, 2017

comment:7

thank you for your time reviewing the ticket. I'll work on this issues (one at a time)

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 19, 2017

Branch pushed to git repo; I updated commit sha1. New commits:

4851eedHyperbolicArcCore object contains common methods to HyperbolicaArc and HyperbolicPolygon. Minor formatting done

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 19, 2017

Changed commit from ea92d27 to 4851eed

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 19, 2017

Changed commit from 4851eed to bc476cd

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 19, 2017

Branch pushed to git repo; I updated commit sha1. New commits:

bc476cdThe patch now includes the aforementioned changes

@sagetrac-jhonrubia6
Copy link
Mannequin Author

sagetrac-jhonrubia6 mannequin commented Jun 19, 2017

comment:10

This is a partial commit, it lacks your suggestion about a description of the different hyperbolic plane models yet.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 4, 2017

Branch pushed to git repo; I updated commit sha1. New commits:

9d94d5cA simple explanation of both models (UHP and PD) included. Some references added

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 4, 2017

Changed commit from bc476cd to 9d94d5c

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 4, 2017

Branch pushed to git repo; I updated commit sha1. New commits:

aee6930Merge branch 'develop' into t/22081/add_new_option_to_hyperbolic_graphics_to_select_the_model

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 4, 2017

Changed commit from 9d94d5c to aee6930

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 25, 2017

Changed commit from aee6930 to 787cf58

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 20, 2022

Changed commit from 09a5c9b to 900c36c

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 20, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

767722eMerge branch 'public/graphics/hyperbolic_graphics-22081' of git://trac.sagemath.org/sage into public/graphics/hyperbolic_graphics-22081
900c36cReviewer changes simplifying plot implementation, more robust inputs, and misc doc changes.

@tscrim
Copy link
Collaborator

tscrim commented Feb 20, 2022

comment:42

Thank you for the additional changes. There were still a few bugs dealing with the different input types of CC versus vectors. I have tried to make the code more robust, but there are likely to be some other subtle bugs involved with an assumption of one type of input over the other. However, that can wait until another ticket.

I managed to streamline the arc construction with a little bit of refactoring and a well-placed getattr.

I made some other documentation tweaks and fixes.

If the bot comes back green (in particular, I think we should look at the doc output with the new tag above), then we can set a positive review if my changes are good.

Also, sometimes it can be good to ignore what the any linter/codestyle tool says in favor of readability and consistency with other code. :)

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 22, 2022

Changed commit from 900c36c to 25c0d32

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 22, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

25c0d32Some last little doc tweaks and fixes.

@tscrim
Copy link
Collaborator

tscrim commented Feb 22, 2022

comment:44

Doc looked good modulo a few more tweaks I did. I also fixed up some pyflakes, which modulo that the patchbot was green.

@tscrim
Copy link
Collaborator

tscrim commented Feb 22, 2022

comment:45

From the log, the one patchbot docbuild seems like it has an unrelated error. Everything else is green.

@sagetrac-jhonrubia6
Copy link
Mannequin Author

sagetrac-jhonrubia6 mannequin commented Feb 22, 2022

comment:46

looks good to me. Thanks for your contribution. I learn new python tricks everyday :-)

@tscrim
Copy link
Collaborator

tscrim commented Feb 23, 2022

comment:47

Then positive review?

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 23, 2022

Changed commit from 25c0d32 to 3f367ec

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 23, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

3f367ecFixing one last typo hiper -> hyper.

@tscrim
Copy link
Collaborator

tscrim commented Feb 23, 2022

comment:49

Documentation did build prior to my trivial typo change.

@sagetrac-jhonrubia6
Copy link
Mannequin Author

sagetrac-jhonrubia6 mannequin commented Feb 23, 2022

comment:50

Replying to @tscrim:

Then positive review?

I do not understand. Are you asking me to change the status? :-)I don't mind changing it, if you prefer so

@tscrim
Copy link
Collaborator

tscrim commented Feb 23, 2022

comment:51

I have changed it, but since you were the one reviewing my changes (as I pushed them last), you are well within your rights to do so. :) Thank you.

@sagetrac-jhonrubia6
Copy link
Mannequin Author

sagetrac-jhonrubia6 mannequin commented Feb 24, 2022

comment:52

Ok. I were not sure of how the 'etiquette' worked out in this case :-)

@vbraun
Copy link
Member

vbraun commented Feb 26, 2022

comment:53
**********************************************************************
File "src/sage/geometry/hyperbolic_space/hyperbolic_geodesic.py", line 2380, in sage.geometry.hyperbolic_space.hyperbolic_geodesic.HyperbolicGeodesicHM._plot_vertices
Failed example:
    g._plot_vertices(5)
Expected:
    [(4.0, -4.0, 5.744562646538029),
     (1.3632131724692114, -1.6370738298435326, 2.353372235315133),
     (0.13856858387448234, -0.9699800871213693, 1.4000223647674197),
     (-0.9425338542843988, -1.3076813974501533, 1.8969450977056184),
     (-3.0, -3.0, 4.358898943540652)]
Got:
    [(4.0, -4.0, 5.744562646538029),
     (1.3632131724692114, -1.6370738298435326, 2.353372235315132),
     (0.13856858387448057, -0.9699800871213675, 1.4000223647674161),
     (-0.9425338542843988, -1.3076813974501533, 1.8969450977056184),
     (-3.0, -3.0, 4.358898943540652)]
**********************************************************************
1 item had failures:
   1 of   6 in sage.geometry.hyperbolic_space.hyperbolic_geodesic.HyperbolicGeodesicHM._plot_vertices
    [447 tests, 1 failure, 7.70 s]
----------------------------------------------------------------------
sage -t --long --random-seed=0 src/sage/geometry/hyperbolic_space/hyperbolic_geodesic.py  # 1 doctest failed
----------------------------------------------------------------------

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 27, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

29f335cTruncated doctest for numerical noise.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 27, 2022

Changed commit from 3f367ec to 29f335c

@tscrim
Copy link
Collaborator

tscrim commented Feb 27, 2022

comment:55

This should take care of any numerical noise.

@vbraun
Copy link
Member

vbraun commented Feb 27, 2022

Changed branch from public/graphics/hyperbolic_graphics-22081 to 29f335c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants