[yt-users] Radial velocity Projections

Matthew Turk matthewturk at gmail.com
Thu Dec 19 04:08:12 PST 2013


Hi John,

On Thu, Dec 19, 2013 at 3:07 AM, John Regan <johnanthonyregan at gmail.com> wrote:
> Hi Matt,
>
> 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.
>
> 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?

Data objects will typically set it themselves, but I think by default
for *grid* objects it's unset.

Happy to hear you got things working!

-Matt

>
> Cheers,
> John
>
>
> On Tue, Dec 17, 2013 at 2:25 PM, John Regan <johnanthonyregan at gmail.com>
> wrote:
>>
>> Hi Matt,
>>
>> Thanks for having a look.  It seemed to sample the field OK but then fell
>> over.
>>
>> Traceback (most recent call last):
>>   File "OffAxisProjection_RadialVelocity_TimeSeries.py", line 46, in
>> <module>
>>     depth=depth, weight_field="Density")
>>   File
>> "/homeappl/home/regan/appl_taito/YT/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py",
>> line 1149, in __init__
>>     self.set_axes_unit(axes_unit)
>>   File
>> "/homeappl/home/regan/appl_taito/YT/yt-x86_64/src/yt-hg/yt/visualization/plot_container.py",
>> line 56, in newfunc
>>     args[0]._setup_plots()
>>   File
>> "/homeappl/home/regan/appl_taito/YT/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py",
>> line 665, in _setup_plots
>>     cax)
>>   File
>> "/homeappl/home/regan/appl_taito/YT/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py",
>> line 1416, in __init__
>>     self._init_image(data, cbname, cmap, extent, aspect)
>>   File
>> "/homeappl/home/regan/appl_taito/YT/yt-x86_64/src/yt-hg/yt/visualization/base_plot_types.py",
>> line 109, in _init_image
>>     self.cb = self.figure.colorbar(self.image, self.cax)
>>   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
>>     cb = cbar.colorbar_factory(cax, mappable, **kw)
>>   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
>>     cb = Colorbar(cax, mappable, **kwargs)
>>   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__
>>     ColorbarBase.__init__(self, ax, **kw)
>>   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__
>>     self.draw_all()
>>   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
>>     self._process_values()
>>   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
>>     b = self.norm.inverse(self._uniform_y(self.cmap.N + 1))
>>   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
>>     return vmin * ma.power((vmax / vmin), val)
>>   File
>> "/homeappl/home/regan/appl_taito/YT/yt-x86_64/lib/python2.7/site-packages/numpy/ma/core.py",
>> line 3648, in __mul__
>>     return multiply(self, other)
>>   File
>> "/homeappl/home/regan/appl_taito/YT/yt-x86_64/lib/python2.7/site-packages/numpy/ma/core.py",
>> line 941, in __call__
>>     if m:
>> ValueError: The truth value of an array with more than one element is
>> ambiguous. Use a.any() or a.all()
>>
>>
>> The snippet of code that I run is
>>
>>  for grid in pf.h.grids:
>>             grid.set_field_parameter("center", c)
>>             grid.set_field_parameter("normal", L)
>>         proj = OffAxisProjectionPlot(pf, L, "RadialVelocity",
>> center='max', width=(width, 'pc'),
>>                                      depth=depth, weight_field="Density")
>>
>> Cheers,
>> John
>>
>>
>>
>> On Mon, Dec 16, 2013 at 5:30 PM, Matthew Turk <matthewturk at gmail.com>
>> wrote:
>>>
>>> Hi John,
>>>
>>> Yup, you can.  I'm looking at the code right now and I think the issue
>>> is going to be tricky to maneuver through the code base in a reliable
>>> way the field parameters.  Here's what I'd suggest doing --
>>>
>>> for grid in pf.h.grids:
>>>     grid.set_field_parameter("center", c)
>>>
>>> just before you call OffAxisProjection.  This is something that the
>>> grid machinery is a bit annoying about the way that things work in
>>> 2.x, but we're fixing in 3.0.  You'll also have to set the "normal"
>>> field parameter.
>>>
>>> Let me know if that works,
>>>
>>> -Matt
>>>
>>>
>>> On Mon, Dec 16, 2013 at 9:55 AM, John Regan <johnanthonyregan at gmail.com>
>>> wrote:
>>> > Hi Matt,
>>> >
>>> > Yes it is the OAP I am interested in. I had originally weighted the
>>> > projection using the density field.
>>> >
>>> > The projected velocity may look funny and it would be interesting to
>>> > try to
>>> > compare that to the planar. Could I also pass cyl_RadialVelocity to the
>>> > OAP
>>> > API?
>>> >
>>> > Cheers,
>>> > John
>>> >
>>> > On 16 Dec 2013 16:09, "Matthew Turk" <matthewturk at gmail.com> wrote:
>>> >>
>>> >> Hi John,
>>> >>
>>> >> Sorry for the delay in replying.
>>> >>
>>> >> On Fri, Dec 13, 2013 at 8:59 AM, John Regan
>>> >> <johnanthonyregan at gmail.com>
>>> >> wrote:
>>> >> > Hi All,
>>> >> >
>>> >> > I was trying to make an OffAxis radial projection. Naively using
>>> >> >
>>> >> >  proj = OffAxisProjectionPlot(pf, L, "RadialVelocityKMS",
>>> >> > center='max',
>>> >> > width=(width, 'pc'),
>>> >> >                                      depth=depth)
>>> >> >
>>> >> > fails with a message of type
>>> >> >
>>> >> > yt.data_objects.field_info_container.NeedsParameter: (['center'])
>>> >> >
>>> >> >
>>> >> > The RadialVelocity probably isn't the field to use here and requires
>>> >> > some
>>> >> > manipulation to be a quantity suitable for plotting.
>>> >> >
>>> >> > Any suggestions on the best way forward would be much appreciated.
>>> >> >
>>> >>
>>> >> So, a few questions.  Do you want to show the way that the radial
>>> >> velocity is distributed, with respect to an image plane that isn't
>>> >> axis aligned?  If you so, you might have more luck using the
>>> >> OffAxisSlicePlot, which will take a slice through the domain.  The OAP
>>> >> plot will integrate along the line of sight; you will probably want to
>>> >> take an average if this is what you want, by supplying the weight
>>> >> parameter here, as otherwise it'll just sum up the RV values at all
>>> >> points.  I think the issue with it not having the parameter center is
>>> >> fixable, but we should probably make sure that's what you're looking
>>> >> for first.  It's also going to be doing the full 3D radial velocity,
>>> >> not the planar velocity, so if your velocity is roughly spherical it
>>> >> might have odd morphology in the resultant plot.
>>> >>
>>> >> If a slice will do what you're looking for, I'd recommend the
>>> >> OffAxisSlicePlot -- if you indeed do want a radial average, then I'll
>>> >> take a look at passing the parameter in.  (This will also help by
>>> >> enabling you to pass in the bulk velocity.)  And if you want to find
>>> >> the planar RV, you'll have to use a field like cyl_RadialVelocity.
>>> >>
>>> >> -Matt
>>> >>
>>> >> > Cheers,
>>> >> > John
>>> >> >
>>> >> > _______________________________________________
>>> >> > 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
>>> >
>>> >
>>> > _______________________________________________
>>> > 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
>>
>>
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>



More information about the yt-users mailing list