<div dir="ltr"><div><div><div>Hi Matt, <br><br></div>I think I rooted out the issue. It seems the "RadialVelocity" field is set to be a log field (or rather not set to be not log). This caused it to fall over. I updated the field in universal_fields.py and it all seems to work now. <br>
<br></div>Thanks for pointing me in the right direction with the grid updates. Without setting the center for each grid, what does it default to? Center of the box?<br><br></div>Cheers,<br>John<br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, Dec 17, 2013 at 2:25 PM, John Regan <span dir="ltr"><<a href="mailto:johnanthonyregan@gmail.com" target="_blank">johnanthonyregan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div>Hi Matt, <br><br></div>Thanks for having a look.  It seemed to sample the field OK but then fell over. <br><br>Traceback (most recent call last):<br>  File "OffAxisProjection_RadialVelocity_TimeSeries.py", line 46, in <module><br>

    depth=depth, weight_field="Density")<br>  File "/homeappl/home/regan/appl_taito/YT/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py", line 1149, in __init__<br>    self.set_axes_unit(axes_unit)<br>

  File "/homeappl/home/regan/appl_taito/YT/yt-x86_64/src/yt-hg/yt/visualization/plot_container.py", line 56, in newfunc<br>    args[0]._setup_plots()<br>  File "/homeappl/home/regan/appl_taito/YT/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py", line 665, in _setup_plots<br>

    cax)<br>  File "/homeappl/home/regan/appl_taito/YT/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py", line 1416, in __init__<br>    self._init_image(data, cbname, cmap, extent, aspect)<br>  File "/homeappl/home/regan/appl_taito/YT/yt-x86_64/src/yt-hg/yt/visualization/base_plot_types.py", line 109, in _init_image<br>

    self.cb = self.figure.colorbar(self.image, self.cax)<br>  File "/homeappl/home/regan/appl_taito/YT/yt-x86_64/lib/python2.7/site-packages/matplotlib-1.3.0-py2.7-linux-x86_64.egg/matplotlib/figure.py", line 1451, in colorbar<br>

    cb = cbar.colorbar_factory(cax, mappable, **kw)<br>  File "/homeappl/home/regan/appl_taito/YT/yt-x86_64/lib/python2.7/site-packages/matplotlib-1.3.0-py2.7-linux-x86_64.egg/matplotlib/colorbar.py", line 1274, in colorbar_factory<br>

    cb = Colorbar(cax, mappable, **kwargs)<br>  File "/homeappl/home/regan/appl_taito/YT/yt-x86_64/lib/python2.7/site-packages/matplotlib-1.3.0-py2.7-linux-x86_64.egg/matplotlib/colorbar.py", line 877, in __init__<br>

    ColorbarBase.__init__(self, ax, **kw)<br>  File "/homeappl/home/regan/appl_taito/YT/yt-x86_64/lib/python2.7/site-packages/matplotlib-1.3.0-py2.7-linux-x86_64.egg/matplotlib/colorbar.py", line 317, in __init__<br>

    self.draw_all()<br>  File "/homeappl/home/regan/appl_taito/YT/yt-x86_64/lib/python2.7/site-packages/matplotlib-1.3.0-py2.7-linux-x86_64.egg/matplotlib/colorbar.py", line 338, in draw_all<br>    self._process_values()<br>

  File "/homeappl/home/regan/appl_taito/YT/yt-x86_64/lib/python2.7/site-packages/matplotlib-1.3.0-py2.7-linux-x86_64.egg/matplotlib/colorbar.py", line 652, in _process_values<br>    b = self.norm.inverse(self._uniform_y(self.cmap.N + 1))<br>

  File "/homeappl/home/regan/appl_taito/YT/yt-x86_64/lib/python2.7/site-packages/matplotlib-1.3.0-py2.7-linux-x86_64.egg/matplotlib/colors.py", line 1003, in inverse<br>    return vmin * ma.power((vmax / vmin), val)<br>

  File "/homeappl/home/regan/appl_taito/YT/yt-x86_64/lib/python2.7/site-packages/numpy/ma/core.py", line 3648, in __mul__<br>    return multiply(self, other)<br>  File "/homeappl/home/regan/appl_taito/YT/yt-x86_64/lib/python2.7/site-packages/numpy/ma/core.py", line 941, in __call__<br>

    if m:<br>ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()<br><br><br></div><div>The snippet of code that I run is <br><div class="im"><br> for grid in pf.h.grids:<br>
            grid.set_field_parameter("center", c)<br></div>
            grid.set_field_parameter("normal", L)<br>        proj = OffAxisProjectionPlot(pf, L, "RadialVelocity", center='max', width=(width, 'pc'), <br>                                     depth=depth, weight_field="Density")<br>

<br></div><div>Cheers,<br>John<br></div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Dec 16, 2013 at 5:30 PM, Matthew Turk <span dir="ltr"><<a href="mailto:matthewturk@gmail.com" target="_blank">matthewturk@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi John,<br>
<br>
Yup, you can.  I'm looking at the code right now and I think the issue<br>
is going to be tricky to maneuver through the code base in a reliable<br>
way the field parameters.  Here's what I'd suggest doing --<br>
<br>
for grid in pf.h.grids:<br>
    grid.set_field_parameter("center", c)<br>
<br>
just before you call OffAxisProjection.  This is something that the<br>
grid machinery is a bit annoying about the way that things work in<br>
2.x, but we're fixing in 3.0.  You'll also have to set the "normal"<br>
field parameter.<br>
<br>
Let me know if that works,<br>
<br>
-Matt<br>
<div><div><br>
<br>
On Mon, Dec 16, 2013 at 9:55 AM, John Regan <<a href="mailto:johnanthonyregan@gmail.com" target="_blank">johnanthonyregan@gmail.com</a>> wrote:<br>
> Hi Matt,<br>
><br>
> Yes it is the OAP I am interested in. I had originally weighted the<br>
> projection using the density field.<br>
><br>
> The projected velocity may look funny and it would be interesting to try to<br>
> compare that to the planar. Could I also pass cyl_RadialVelocity to the OAP<br>
> API?<br>
><br>
> Cheers,<br>
> John<br>
><br>
> On 16 Dec 2013 16:09, "Matthew Turk" <<a href="mailto:matthewturk@gmail.com" target="_blank">matthewturk@gmail.com</a>> wrote:<br>
>><br>
>> Hi John,<br>
>><br>
>> Sorry for the delay in replying.<br>
>><br>
>> On Fri, Dec 13, 2013 at 8:59 AM, John Regan <<a href="mailto:johnanthonyregan@gmail.com" target="_blank">johnanthonyregan@gmail.com</a>><br>
>> wrote:<br>
>> > Hi All,<br>
>> ><br>
>> > I was trying to make an OffAxis radial projection. Naively using<br>
>> ><br>
>> >  proj = OffAxisProjectionPlot(pf, L, "RadialVelocityKMS", center='max',<br>
>> > width=(width, 'pc'),<br>
>> >                                      depth=depth)<br>
>> ><br>
>> > fails with a message of type<br>
>> ><br>
>> > yt.data_objects.field_info_container.NeedsParameter: (['center'])<br>
>> ><br>
>> ><br>
>> > The RadialVelocity probably isn't the field to use here and requires<br>
>> > some<br>
>> > manipulation to be a quantity suitable for plotting.<br>
>> ><br>
>> > Any suggestions on the best way forward would be much appreciated.<br>
>> ><br>
>><br>
>> So, a few questions.  Do you want to show the way that the radial<br>
>> velocity is distributed, with respect to an image plane that isn't<br>
>> axis aligned?  If you so, you might have more luck using the<br>
>> OffAxisSlicePlot, which will take a slice through the domain.  The OAP<br>
>> plot will integrate along the line of sight; you will probably want to<br>
>> take an average if this is what you want, by supplying the weight<br>
>> parameter here, as otherwise it'll just sum up the RV values at all<br>
>> points.  I think the issue with it not having the parameter center is<br>
>> fixable, but we should probably make sure that's what you're looking<br>
>> for first.  It's also going to be doing the full 3D radial velocity,<br>
>> not the planar velocity, so if your velocity is roughly spherical it<br>
>> might have odd morphology in the resultant plot.<br>
>><br>
>> If a slice will do what you're looking for, I'd recommend the<br>
>> OffAxisSlicePlot -- if you indeed do want a radial average, then I'll<br>
>> take a look at passing the parameter in.  (This will also help by<br>
>> enabling you to pass in the bulk velocity.)  And if you want to find<br>
>> the planar RV, you'll have to use a field like cyl_RadialVelocity.<br>
>><br>
>> -Matt<br>
>><br>
>> > Cheers,<br>
>> > John<br>
>> ><br>
>> > _______________________________________________<br>
>> > yt-users mailing list<br>
>> > <a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
>> > <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
>> ><br>
>> _______________________________________________<br>
>> yt-users mailing list<br>
>> <a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
>> <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
><br>
><br>
> _______________________________________________<br>
> yt-users mailing list<br>
> <a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
> <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
><br>
_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>