Jae-Joon,
I just saw your curvelinear grid support fall into SVN. Very
impressive! We actually may have a use for it here at Space Telescope
for drawing "World Coordinate System (WCS)" plots.
I am getting an exception with a clean numpy/mpl build from svn HEAD>
This appears platform specific because I am only seeing it on my
solaris box at work, not on a linux box I am also testing on.
johnh@...539...:axes_grid> uname -a
SunOS flag 5.10 Generic_118855-15 i86pc i386 i86pc
Here is the complete traceback:
Traceback (most recent call last):
File "demo_curvelinear_grid.py", line 127, in ?
plt.draw()
File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/pyplot.py",
line 350, in draw
get_current_fig_manager().canvas.draw()
File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/backends/backend_tkagg.py",
line 215, in draw
FigureCanvasAgg.draw(self)
File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py",
line 314, in draw
self.figure.draw(self.renderer)
File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/artist.py",
line 46, in draw_wrapper
draw(artist, renderer, *kl)
File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/figure.py",
line 774, in draw
for a in self.axes: a.draw(renderer)
File "/home/titan/johnh/dev/lib/python2.4/site-packages/mpl_toolkits/axes_grid/axislines.py",
line 1350, in draw
super(Axes, self).draw(renderer, inframe)
File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/artist.py",
line 46, in draw_wrapper
draw(artist, renderer, *kl)
File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/axes.py",
line 1826, in draw
a.draw(renderer)
File "/home/titan/johnh/dev/lib/python2.4/site-packages/mpl_toolkits/axes_grid/axislines.py",
line 874, in draw
self._grid_helper.update_lim(self.axes)
File "/home/titan/johnh/dev/lib/python2.4/site-packages/mpl_toolkits/axes_grid/axislines.py",
line 564, in update_lim
self._update(x1, x2, y1, y2)
File "/home/titan/johnh/dev/lib/python2.4/site-packages/mpl_toolkits/axes_grid/grid_helper_curvelinear.py",
line 114, in _update
self._update_grid(x1, y1, x2, y2)
File "/home/titan/johnh/dev/lib/python2.4/site-packages/mpl_toolkits/axes_grid/grid_helper_curvelinear.py",
line 149, in _update_grid
self.grid_info = self.grid_finder.get_grid_info(x1, y1, x2, y2)
File "/home/titan/johnh/dev/lib/python2.4/site-packages/mpl_toolkits/axes_grid/grid_finder.py",
line 241, in get_grid_info
x1, y1, x2, y2)
File "/home/titan/johnh/dev/lib/python2.4/site-packages/mpl_toolkits/axes_grid/grid_finder.py",
line 118, in get_grid_info
bb)
File "/home/titan/johnh/dev/lib/python2.4/site-packages/mpl_toolkits/axes_grid/grid_finder.py",
line 163, in _clip_grid_lines_and_find_ticks
xy, tcks = clip_line_to_rect(lx, ly, bb)
File "/home/titan/johnh/dev/lib/python2.4/site-packages/mpl_toolkits/axes_grid/clip_path.py",
line 72, in clip_line_to_rect
ly3, lx3, c_top_ = clip(ly2, lx2, y1, clip="right")
File "/home/titan/johnh/dev/lib/python2.4/site-packages/mpl_toolkits/axes_grid/clip_path.py",
line 51, in clip
a = degrees(atan2(dy, dx))
ValueError: math domain error
In the debugger:
In [3]: %debug
/home/titan/johnh/dev/lib/python2.4/site-packages/mpl_toolkits/axes_grid/clip_path.py(51)clip()
50
---> 51 a = degrees(atan2(dy, dx))
52 _pos_angles.append((x0, y0, a))
print dy, dx
-0 0.0
print type(dy), type(dx)
<type 'numpy.float64'> <type 'numpy.float64'>
print atan2(dy, dx)
*** ValueError: math domain error
The root cause seems to be the math.atan2 function on solaris
In [4]: import math
In [5]: math.atan2(0., 0.)
···
On Wed, Jun 3, 2009 at 10:04 AM, Michael Droettboom <mdroe@...31...> wrote:
------------------------------------------------------------
Traceback (most recent call last):
File "<ipython console>", line 1, in ?
ValueError: math domain error
so we may want to special case the code to handle 0.0, 0.0 as inputs.
JDH