[yt-users] How ot overplot star particles on density projections

Matthew Turk matthewturk at gmail.com
Fri Jul 19 06:53:39 PDT 2013


Hi Latif,

On Fri, Jul 19, 2013 at 9:48 AM, Latif <latifne at gmail.com> wrote:
> Hi all,
> Is there any way to annotate particles to the multi-plot porjections/slices?
> I am using the following recipe from the webpage.
>
> http://yt-project.org/doc/cookbook/multi_plot_slice_and_proj.py
>
> thanks in advance,
>
> Cheers
> Latif

Unfortunately this is a lot harder, as the FRBs used there do not
expose the same annotate_* methods that the sliceplot, projectionplot,
etc do.

However, you *may* be able to do something similar, although I have
not tested it, by creating a ProjectionPlot or SlicePlot, then
swapping out the .axes and .figure objects that resides on the plot
object itself.  Then you can call ._setup_plots() on the
ProjectionPlot or SlicePlot, and it should re-create all the necessary
info.

So it would look something like this, once you have the axes objects
you're interested in from the recipe you linked to:

p = ProjectionPlot( ... )
p.plots["Density"].figure = fig
p.plots["Density"].axes = dens_axes[0]
p.annotate_whatever()
p._setup_plots()

Then you can call:

fig.savefig("%s_3x2" % pf)

This is all very rough, but I think it should get you there.

-Matt

>
>
> On Thu, Jul 4, 2013 at 9:43 PM, Latif <latifne at gmail.com> wrote:
>>
>> HI Matt,
>> Thank you for a prompt and precise response.
>> Cheers
>> Latif
>>
>>
>>
>> On Thu, Jul 4, 2013 at 7:04 PM, Matthew Turk <matthewturk at gmail.com>
>> wrote:
>>>
>>> Hi Latif,
>>>
>>> The callback you're looking for is "particles" and you can specify a
>>> "ptype" argument for specifying the type of particles.  (If you're
>>> using Enzo, this should be the number in the "particle_type" field you
>>> are selecting.)  Note also that annotate_particles accepts a width
>>> argument, in code units, which says how wide the selected region will
>>> be around the center of the slice or the center of the box for
>>> projections.  So if you are using a projection and you want the whole
>>> box, you can do 1.0/pf['unitary'] to get the full domain.
>>>
>>> Here is an example:
>>>
>>> s = SlicePlot(pf, "x", "Density")
>>> s.annotate_particles(1.0/pf['kpc'], p_size = 1.0, ptype = 1)
>>>
>>> which will choose particle_type = =1.
>>>
>>> -Matt
>>>
>>> On Thu, Jul 4, 2013 at 10:20 AM, Latif <latifne at gmail.com> wrote:
>>> > Hi all,
>>> > I want to overplot star particles on density projections/slices. It is
>>> > probably a very simple question but could not figure out how to do it.
>>> > Can
>>> > I also get information about their position and velocities as well?
>>> > thanks in advance,
>>> > Cheers
>>> > Latif
>>> >
>>> > _______________________________________________
>>> > 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