<div dir="ltr"><div><div><div>Hi, all--<br><br></div>I'm running into problems making phase objects. It looks like the error is in the color bar, and is similar to other errors I get when trying to use PlotCollections. The hash I'm on is 34b95297062b. I'm trying:<br>
<br>pf = load(fname)<br>
pc = PlotCollection(pf,'c')<br>phase=pc.add_phase_object(pf.h.all_data(),['CellMass',<br> 'x-velocity','CellVolume'],weight=None)<br><br></div>min/max are as follows:<br>CellMass: [4.1e-12,1.5e-03] (30631133,) <br>
</div>x-velocity: [-7.2e+01,5.5e+01]<br><div><div><div>CellVolume: [1.45e-11,6.0e-08]<br><br></div><div>Is there a more up-to-date manner to do this that doesn't use PlotCollection? Or is there something obvious that I'm missing?<br>
<br></div><div>It seems to be choking in <a href="http://plot_types.py/__init_colorbar" target="_blank">plot_types.py/__init_colorbar</a><br>
<br> def __init_colorbar(self):<br> temparray = np.ones((self.x_bins.size, self.y_bins.size))<br> self.norm = matplotlib.colors.Normalize()<br> self.image = self._axes.pcolormesh(self.x_bins, self.y_bins,<br>
temparray, shading='flat',<br> norm=self.norm, cmap=self.cmap,<br> rasterized=True)<br> self.colorbar = self._figure.colorbar(self.image,<br>
extend='neither', shrink=0.95,<br> format="%0.2e" )<br></div><div><br>It looks like what's happening is figure.colorbar chokes on the fact that temparray is "ones", so the spacing between elements is zero. This is outside of my yt knowledge, though.<br>
<br>Traceback (most recent call last):<br> File "<stdin>", line 1, in <module><br> File "p14_phase_test.py", line 4, in <module><br> phase=pc.add_phase_object(pf.h.all_data(),['CellMass','x-velocity','CellVolume'])<br>
File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/visualization/plot_collection.py", line 1184, in add_phase_object<br> figure=figure, axes=axes))<br> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/visualization/plot_types.py", line 815, in __init__<br>
self.__init_colorbar()<br> File "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/visualization/plot_types.py", line 834, in __init_colorbar<br> format="%0.2e" )<br> File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/figure.py", line 1387, in colorbar<br>
cb = cbar.colorbar_factory(cax, mappable, **kw)<br> File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py", line 1173, in colorbar_factory<br> cb = Colorbar(cax, mappable, **kwargs)<br>
File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py", line 854, in __init__<br> ColorbarBase.__init__(self, ax, **kw)<br> File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py", line 298, in __init__<br>
self.draw_all()<br> File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py", line 323, in draw_all<br> self._config_axes(X, Y)<br> File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py", line 409, in _config_axes<br>
self.update_ticks()<br> File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py", line 345, in update_ticks<br> ticks, ticklabels, offset_string = self._ticker()<br>
File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py", line 560, in _ticker<br> ticks = self._locate(b)<br> File "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py", line 808, in _locate<br>
z = np.take(y, i0) + (xn-np.take(b,i0))*dy/db<br>FloatingPointError: invalid value encountered in divide<br><br></div></div></div></div>