[yt-users] Projection Question

david collins dcollins4096 at gmail.com
Mon Apr 8 19:28:22 PDT 2013


> It looks like the plot is crashing because of some issue with the color
> bar - something like all the values in the plot being zero, causing the
> logarithmic color bar to crash.  I'd need to know more about the dataset
> you're trying to plot to be able to figure out the exact issue.
>
>
Yeah, it looks like what happens when I have a bad dataset, like Density =
0 everywhere.  However, I've plotted (and published) this dataset many
times, so unless it's been corrupted on disk the set itself is ok.  To
check that I did
for grid in pf.h.grids:
 print grid['Density'].min(), grid['Density'].max()

and it didn't barf-- I'll double check those values, though.

I think a more modern script would look like this:
>
>
Thanks a ton for the update.  I'll try this, and ensure the data isn't
borked.

Thanks a ton!
d.


> pf = load(thing)
> reg = pf.h.region(center,left,right)
> proj =  pf.h.proj(0,'Density',center=Center, source=reg)
> prooj = proj.to_pw()
> prooj.save()
>
> This leverages the to_pw() function, which is defined for projection,
> slice, and off-axis slice data objects.  The function returns a plot window
> plot that uses the user-defined data object to select data.  By default
> plot window plots use a region that covers the whole dataset to select data.
>
> -Nathan
>
> On Apr 8, 2013, at 4:07 PM, david collins <dcollins4096 at gmail.com> wrote:
>
> > Hi, Everybody!
> >
> > I have a probably dumb question.  I keep getting the following error
> when projecting.  I get this from a variety of methods, but what I'm trying
> to do is project a region.  What I used to do was something like this, but
> it's no longer working (with or without the source.)
> >
> > reg = pf.h.region(center,left,right)
> > pf = load(thing)
> > pc = PlotCollection(pf)
> > proj =  pf.h.proj(0,'Density',center=Center) #,source=reg)
> > prooj = pc.add_projection('Density','x') #,data_source=reg)
> >
> > So my question is: with the recent developments to yt, what's the best
> mechanism to do this?
> > I'm on a self install that was done fresh pretty recently, the hash is
> 34b95297062b
> >
> > Thanks,
> > d.
> >
> >
> >     prooj = pc.add_projection('Density','x',data_source=reg)
> >   File
> "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/visualization/plot_collection.py",
> line 786, in add_projection
> >     size=fig_size, periodic=periodic))
> >   File
> "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/visualization/plot_types.py",
> line 326, in __init__
> >     self.__init_temp_image(use_colorbar)
> >   File
> "/nics/b/home/collins/local_2013_03_12/src/yt-hg/yt/visualization/plot_types.py",
> line 358, in __init_temp_image
> >     shrink=0.95)
> >   File
> "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/figure.py",
> line 1387, in colorbar
> >     cb = cbar.colorbar_factory(cax, mappable, **kw)
> >   File
> "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py",
> line 1173, in colorbar_factory
> >     cb = Colorbar(cax, mappable, **kwargs)
> >   File
> "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py",
> line 854, in __init__
> >     ColorbarBase.__init__(self, ax, **kw)
> >   File
> "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py",
> line 298, in __init__
> >     self.draw_all()
> >   File
> "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py",
> line 323, in draw_all
> >     self._config_axes(X, Y)
> >   File
> "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py",
> line 409, in _config_axes
> >     self.update_ticks()
> >   File
> "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py",
> line 345, in update_ticks
> >     ticks, ticklabels, offset_string = self._ticker()
> >   File
> "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py",
> line 560, in _ticker
> >     ticks = self._locate(b)
> >   File
> "/nics/b/home/collins/local_2013_03_12/lib/python2.7/site-packages/matplotlib/colorbar.py",
> line 808, in _locate
> >     z = np.take(y, i0) + (xn-np.take(b,i0))*dy/db
> >
> > _______________________________________________
> > yt-users mailing list
> > yt-users at lists.spacepope.org
> > http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20130408/a94ccf7a/attachment.html>


More information about the yt-users mailing list