Skip to content

Fix pzmap grid (matplotlib angle_helper) #456

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

Merged
merged 5 commits into from
Aug 21, 2020

Conversation

bnavigator
Copy link
Contributor

CI runs started to fail today with:

Traceback (most recent call last):
959  File "pvtol-nested.py", line 169, in <module>
960    P, Z = pzmap(T, plot=True, grid=True)
961  File "/home/travis/build/python-control/python-control/control/pzmap.py", line 106, in pzmap
962    ax, fig = sgrid()
963  File "/home/travis/build/python-control/python-control/control/grid.py", line 82, in sgrid
964    ax.axis["wnxneg"] = axis = ax.new_floating_axis(0, 180)
965  File "/home/travis/miniconda/envs/test-environment/lib/python3.6/site-packages/mpl_toolkits/axisartist/axislines.py", line 575, in new_floating_axis
966    axes=self)
967  File "/home/travis/miniconda/envs/test-environment/lib/python3.6/site-packages/mpl_toolkits/axisartist/grid_helper_curvelinear.py", line 350, in new_floating_axis
968    axisline = AxisArtist(axes, _helper)
969  File "/home/travis/miniconda/envs/test-environment/lib/python3.6/site-packages/mpl_toolkits/axisartist/axis_artist.py", line 746, in __init__
970    self._init_line()
971  File "/home/travis/miniconda/envs/test-environment/lib/python3.6/site-packages/mpl_toolkits/axisartist/axis_artist.py", line 887, in _init_line
972    self._axis_artist_helper.get_line(self.axes),
973  File "/home/travis/miniconda/envs/test-environment/lib/python3.6/site-packages/mpl_toolkits/axisartist/grid_helper_curvelinear.py", line 270, in get_line
974    self.update_lim(axes)
975  File "/home/travis/miniconda/envs/test-environment/lib/python3.6/site-packages/mpl_toolkits/axisartist/grid_helper_curvelinear.py", line 101, in update_lim
976    self.grid_helper.update_lim(axes)
977  File "/home/travis/miniconda/envs/test-environment/lib/python3.6/site-packages/mpl_toolkits/axisartist/axislines.py", line 327, in update_lim
978    self._update(x1, x2, y1, y2)
979  File "/home/travis/miniconda/envs/test-environment/lib/python3.6/site-packages/mpl_toolkits/axisartist/grid_helper_curvelinear.py", line 319, in _update
980    self._update_grid(x1, y1, x2, y2)
981  File "/home/travis/miniconda/envs/test-environment/lib/python3.6/site-packages/mpl_toolkits/axisartist/grid_helper_curvelinear.py", line 367, in _update_grid
982    self.grid_info = self.grid_finder.get_grid_info(x1, y1, x2, y2)
983  File "/home/travis/miniconda/envs/test-environment/lib/python3.6/site-packages/mpl_toolkits/axisartist/grid_finder.py", line 104, in get_grid_info
984    extremes = self.extreme_finder(self.inv_transform_xy, x1, y1, x2, y2)
985  File "/home/travis/build/python-control/python-control/control/grid.py", line 44, in __call__
986    self._adjust_extremes(lon_min, lon_max, lat_min, lat_max)
987AttributeError: 'ModifiedExtremeFinderCycle' object has no attribute '_adjust_extremes'

Apparently Matplotlib removed the private function _adjust_extremes between 3.2 and 3.3 (I could not find the commit yet. Clicking blame on github doesn't work. Their git history is weird).

The specific branch of pzmap and this portion of grid.py are not covered by the unit tests. Hence it was not discovered until now, when conda updated matplotlib and it fails in the pvtol-nested.pyexample.

@bnavigator bnavigator added this to the 0.8.4 milestone Aug 20, 2020
@bnavigator bnavigator added the bug label Aug 20, 2020
@bnavigator bnavigator self-assigned this Aug 20, 2020
@coveralls
Copy link

coveralls commented Aug 20, 2020

Coverage Status

Coverage increased (+2.0%) to 86.168% when pulling 5632796 on bnavigator:fix-mpl-grid into 08d5e6c on python-control:master.

@bnavigator
Copy link
Contributor Author

bnavigator commented Aug 20, 2020

Added unit tests so we don't rely on the examples and coda. Two fixtures editsdefaults and mplcleanup written for #438 are perfect for the use case here, so I pulled them from there. That should be relative benign when merging.

Found a copy and paste error in the pzmap defaults handling

@bnavigator bnavigator marked this pull request as ready for review August 20, 2020 21:30
@bnavigator bnavigator force-pushed the fix-mpl-grid branch 2 times, most recently from e646370 to 6445a6a Compare August 20, 2020 21:42
@bnavigator
Copy link
Contributor Author

Look at that increased coverage :)

Found another config/"defaults" handling bug in pzmap through the tests.

@roryyorke
Copy link
Contributor

Looks good to me.

@bnavigator
Copy link
Contributor Author

With @roryyorke's approved review and the fact that without this fix current CI runs fail, I fell confident on merging this now.

@bnavigator bnavigator merged commit 6ede92e into python-control:master Aug 21, 2020
@bnavigator bnavigator deleted the fix-mpl-grid branch January 5, 2021 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pzmap(sys, grid=True) fails pzmap(sys, grid=True) fails
3 participants