fix issue #310#313
Conversation
Codecov Report
@@ Coverage Diff @@
## devel #313 +/- ##
==========================================
+ Coverage 41.02% 41.35% +0.32%
==========================================
Files 79 79
Lines 23478 23480 +2
==========================================
+ Hits 9633 9711 +78
+ Misses 13845 13769 -76
Continue to review full report at Codecov.
|
|
What would you recommend for tests to make sure this doesn't break again? Which test file should it go in? |
|
For the test, it should be in tofu/tests/tests01_geom/tests03_core.py |
| ax.set_xlabel(r"X (m)") | ||
| ax.set_ylabel(r"Y (m)") | ||
| ax.set_zlabel(r"Z (m)") | ||
| ax.set_aspect(aspect="equal", adjustable='datalim') |
There was a problem hiding this comment.
Good idea,
However, I would recommend keeping the try / except, because 3d plotting in matplotlib is not very stable,
This plot, for instance, used to work fine until a matploltib update.
Given that 3d plotting is not very stable, I would recommend both solution:
- Try to make it work with your fix
- Keep the try / except as back-up safety in case it stops working for any reason at some point
Can you update your PR by adding the try / except with warning as in PR #311 ?
There was a problem hiding this comment.
I understand that aspect="equal" causes the error, but does the second parameter should also be removed?
There was a problem hiding this comment.
Good point, I'm going to try.
There was a problem hiding this comment.
No, it doesn't work.
ax.set_aspect(adjustable='datalim')
TypeError: set_aspect() missing 1 required positional argument: 'aspect'
There was a problem hiding this comment.
Ok, it bothers me though to just take out this line. @Didou09 : i'm under the impression that it worked in some cases, no? I have already used this feature of tofu to debug a camera. We could try to replace it with a hack like: https://stackoverflow.com/questions/13685386/matplotlib-equal-unit-length-with-equal-aspect-ratio-z-axis-is-not-equal-to
There was a problem hiding this comment.
It may have been a backwards incompatible change in matplotlib no?
|
Sure, will do this as a next step!
Le mar. 3 déc. 2019 à 17:49, Didier <notifications@github.com> a écrit :
… ***@***.**** requested changes on this pull request.
See comment below
------------------------------
In tofu/geom/_def.py
<#313 (comment)>:
> @@ -164,7 +164,6 @@ def Plot_3D_plt_Tor_DefAxes(fs=None, wintit='tofu'):
ax.set_xlabel(r"X (m)")
ax.set_ylabel(r"Y (m)")
ax.set_zlabel(r"Z (m)")
- ax.set_aspect(aspect="equal", adjustable='datalim')
Good idea,
However, I would recommend keeping the try / except, because 3d plotting
in matplotlib is not very stable,
This plot, for instance, used to work fine until a matploltib update.
Given that 3d plotting is not very stable, I would recommend both solution:
- Try to make it work with your fix
- Keep the try / except as back-up safety in case it stops working for
any reason at some point
Can you update your PR by adding the try / except with warning as in PR
#311 <#311> ?
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#313?email_source=notifications&email_token=AASAKXJRZYR22WQCNXQ6F6LQW2EYXA5CNFSM4JU2MRD2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCNZNCRI#pullrequestreview-326291781>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AASAKXP72QKG6TL4HCIHOC3QW2EYXANCNFSM4JU2MRDQ>
.
|
|
Hello @flothesof! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2019-12-04 09:27:11 UTC |
| def compute_dgeom(self, extra=True, plotdebug=True): | ||
| def compute_dgeom(self, extra=True, show_debug_plot=True): | ||
| """ | ||
| Computes the dgeom attribute (what does dgeom mean? I'm guessing it stands for shortened dict_geometry?). |
There was a problem hiding this comment.
I would say so too. I would let @Didou09 confirm :)
It looks like Florian wrote in the doc some questions, would you mind checking them out (also for next parameter)
There was a problem hiding this comment.
Do you have any idea what sort of information dgeom contains?
| ax.set_xlabel(r"X (m)") | ||
| ax.set_ylabel(r"Y (m)") | ||
| ax.set_zlabel(r"Z (m)") | ||
| ax.set_aspect(aspect="equal", adjustable='datalim') |
There was a problem hiding this comment.
I understand that aspect="equal" causes the error, but does the second parameter should also be removed?
|
After further thinking about the issue I've arrived at the conclusion that it's better to not add the try except block. Supporting a debug plot is a feature that is very useful. It should always work from now on. The two proposed ways to act are:
The worst-case scenario is that the debug plot breaks somehow in the future.
Implementing change 1 and 2 is not useful because change 2 alone will make sure the debug plot works. Hence my conclusion: change 2 is the way to go. |
|
Agreed, but:
=> if we go without the try / except, it means we may have to write tests on the current version of matplotlib to make sure the plot works fine for all versions (i.e.: extra workload). |
As far as I can tell, it is.
I don't think it will work for some/not for others. What I am saying is: this is a matplotlib issue, for which we should only write "correct matplotlib code" and not care about the rest. If matplotlib works as expected this will work for everyone. |
Matplotlib will work as expected, except the API may change from one version to another. It is not necessarily a matplotlib bug, more a change of API.
|
|
I would say that if we notice a problem, which I think is not super likely, we adjust the required version of matplotlib in the setup. |
|
This issue was finally adressed in a separate PR #343 . |
Proposed changes instead of thos from #311.
This fixes the matplotlib plot error.
Also, I'd like to add a test that triggers the debug plot, but I'm unsure where to put it.
I've just browsed the test files in tofu/tests/tests01_geom but they look really messy... (sorry)
Where should I put my test for this?