OmkarPathak / pygorithm

A Python module for learning all major algorithms
MIT License
4.4k stars 509 forks source link

Better way to do images? #69

Closed Tjstretchalot closed 7 years ago

Tjstretchalot commented 7 years ago

I am hoping for comment on my latest commit to the dev branch (https://github.com/OmkarPathak/pygorithm/commit/f044a65804362d2cd25f432b06a033e73d46c50a) specifically regarding this folder: https://github.com/OmkarPathak/pygorithm/tree/dev/imgs/test_geometry/test_extrapolated_intersection/out

It contains a lot of images that help me visualize what the tests are doing. They look like:

ah04_test_line_line_intr_later

They are referenced as explained here: https://github.com/OmkarPathak/pygorithm/blob/dev/tests/test_geometry.py#L1455 Do you think that it's fine that there are a lot of these files? I can't think of any good alternatives.

OmkarPathak commented 7 years ago

I think it's good. Let's go with this idea for now. :+1:

IanDoarn commented 7 years ago

How are you making them? It should be fine since they aren't packaged with the module, unless they are supposed to be

Tjstretchalot commented 7 years ago

I'm using this program called "graph". It probably doesn't need to be packaged on pypy but I wonder if I should add a link to the github repo in the tests in case they come across the comments referencing it?

IanDoarn commented 7 years ago

@Tjstretchalot Maybe we could implement matplotlib?

Tjstretchalot commented 7 years ago

Ok so spent last couple hours working on what that would look like with matplotlib. The files generated would look something like:

aa01_test_point_line_no_intr_2

Generated from this file: https://github.com/OmkarPathak/pygorithm/blob/608999b4b847088d84c089bb356e287c8863ee87/imgs/test_geometry/test_extrapolated_intersection/aa01_test_point_line_no_intr.py

as opposed to:

aa01_test_point_line_no_intr

(after lots of configuration). No huge difference (though matplotlib has slightly better antialiasing whereas Graph has prettier arrows).

Using that method I believe I could reduce the number of generating files by about a factor of 4 with the same number of images. That is to say, I could reduce it to one file per "type" of image. It wouldn't save any time, but is perhaps more portable?

Thoughts on that now that we can see them both? @OmkarPathak @IanDoarn

Tjstretchalot commented 7 years ago

I'm going to go with matplotlib from now on, I think with a larger initial investment it will make future ones easier