[yt-users] Particle only plots

Andrew Myers atmyers2 at gmail.com
Wed May 7 19:11:50 PDT 2014


Hi Jeremy,

I happened have a script that does this. Something like this should work
(in 2.6):

    from yt.mods import *
    import pylab as plt

    fn =
'Chombo/releasedExamples/AMRParticleMesh/exec/output/plt256.2d.hdf5'
    pf = load(fn)

    data = pf.h.all_data()

    x = data['particle_position_x']
    y = data['particle_position_y']

    plt.plot(x, y, '.')
    plt.savefig('scatter')

-Andrew


On Wed, May 7, 2014 at 5:12 PM, Nathan Goldbaum <nathan12343 at gmail.com>wrote:

> Hi Jeremy,
>
> Right now there isn't a way to do that in yt.  That's something that would
> be very nice to add and would probably be a good introductory yt project
> for someone who wanted to get more familiar with the codebase.
>
> What you *can* do is take the particle data and plot the positions in a
> scatter plot using matplotlib.
>
> Unfortunately I don't have a good example of that right now, but it should
> be pretty straightforward.  You just need to read in the x and y particle
> position fields and then make a scatter plot using e.g. pyplot.plot().
>
> -Nathan
>
>
> On Wed, May 7, 2014 at 4:32 PM, Jeremy Ritter <jritter at astro.as.utexas.edu
> > wrote:
>
>> Hello yt,
>>
>> Is there an easy way to plot only particles? What I would like to do is
>> plot a z-axis projection of particle x/y positions, with no background data
>> loaded from the grid. I only see examples for annotate_particles() on top
>> of another plot, but I don't want to unnecessarily load grid data.
>>
>> Thanks!
>> -Jeremy
>> _______________________________________________
>> 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/20140507/05ac9b2b/attachment.htm>


More information about the yt-users mailing list