[yt-users] Annotating particles in Flash with different sizes

Joshua Wall joshua.e.wall at gmail.com
Sat Nov 19 12:33:03 PST 2016


Hello users,

    I've recently been using yt to plot gas and star Flash runs where the
particle size is proportional to the log of the mass. I've noticed that
using the annotate_particles method is occasionally seems to be giving me
the wrong masses.

Here's a plot with the annotate_particles method:

ds = yt.load("./Runs/ProbStars/data/turbsph_hdf5_plt_cnt_0021")

gr = yt.ProjectionPlot(ds, 'x', 'dens')

gr.annotate_particles(ds.domain_width[0],

p_size=np.multiply(20.0,np.log10(dd['particle_mass'].in_units('Msun').v)),
                      col='b')

gr.annotate_timestamp(corner='upper_left')
gr.zoom(5)
gr.save('ann_part_test.png')
gr.show()

Here's the plot:

[image: ann_part_test.png]

And if I manually add the stars (also, I'm not sure why I have to call
proj.show() before the scatter plot to get this to work...):

proj = yt.ProjectionPlot(ds, 'x', 'dens')

proj.show()

dens_plot = proj.plots['dens']


proj_ax = dens_plot.axes
fig = dens_plot.figure

proj_ax.scatter(dd['particle_position_y'].in_units('pc').v,
            dd['particle_position_z'].in_units('pc').v,

s=np.multiply(20.0,np.log10(dd['particle_mass'].in_units('Msun').v)), c='k')


proj_ax.set_xlim(-1.0, 1.0)
proj_ax.set_ylim(-1.0, 1.0)


proj.show()

proj.save('man_ann_part.png')

Here's the plot for this (which has the correct sized particles, note the
one closest to 0,0 is about 1.4 Msun and much smaller in the plot below):

[image: man_ann_part.png]

I am currently re-writing my plotting routines (which I use to make movies)
to account for this, but it is a lot uglier this way, especially since I
run on a cluster without display and don't want to have to call proj.show()
before I call for the scatter plot. I'm guessing I can probably also just
call proj.save() twice with the same effect, but I haven't tested it yet.

Any assistance would be appreciated, and thanks!

Cordially,

Josh Wall

-- 
Joshua Wall
Doctoral Candidate
Department of Physics
Drexel University
3141 Chestnut Street
Philadelphia, PA 19104
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20161119/65330b23/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ann_part_test.png
Type: image/png
Size: 79986 bytes
Desc: not available
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20161119/65330b23/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: man_ann_part.png
Type: image/png
Size: 76744 bytes
Desc: not available
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20161119/65330b23/attachment-0003.png>


More information about the yt-users mailing list