I'll have a bugfix done in a few minutes.


On Sun, Aug 31, 2014 at 8:07 PM, Brian O'Shea <bwoshea@gmail.com> wrote:
Ah, ok - would you like me to file a bug report?


On Sun, Aug 31, 2014 at 10:33 PM, Matthew Turk <matthewturk@gmail.com> wrote:

It's a bug. It is assuming that weight field is a string, but it's a tuple. The behavior I think it should do is check if it's a tuple, and if it is, either join with spaces or use element 1.

On Aug 31, 2014 9:29 PM, "Brian O'Shea" <bwoshea@gmail.com> wrote:
Hi folks,

I am having a problem making weighted projections in yt-3.  Using the current tip, when I type this:

plot = yt.ProjectionPlot(ds,'x',fields=('gas', 'density'), weight_field=None, width=(1.0,'unitary'), center=[0.5,0.5,0.5]).save()

everything works fine, and I get a projection.  However, when I try this:

plot = yt.ProjectionPlot(ds,'x',fields=('gas', 'density'), weight_field=('gas', 'density'), width=(1.0,'unitary'), center=[0.5,0.5,0.5]).save()

I get the error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-7a90d3d7dae2> in <module>()
----> 1 plot = yt.ProjectionPlot(ds,'x',fields=('gas', 'density'), weight_field=('gas', 'density'), width=(1.0,'unitary'), center=[0.5,0.5,0.5]).save()

/Users/bwoshea/Desktop/yt-3.0/src/yt-hg/yt/visualization/plot_container.pyc in save(self, name, mpl_kwargs)
    464             weight = self.data_source.weight_field
    465             if weight is not None:
--> 466                 weight = weight.replace(' ', '_')
    467         if 'Cutting' in self.data_source.__class__.__name__:
    468             type = 'OffAxisSlice'

AttributeError: 'tuple' object has no attribute 'replace'

I would note that if I use 'density' instead of ('gas','density') for the weight_field, everything works fine.  Is this the expected behavior, or is this a bug?  

Thanks!

--Brian


_______________________________________________
yt-dev mailing list
yt-dev@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org


_______________________________________________
yt-dev mailing list
yt-dev@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org



_______________________________________________
yt-dev mailing list
yt-dev@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org