Hello All,
I have a question about the Projection plot function in yt. I have a script that plots the smallest mass darkmatter particles of a simulation in all 3 of the 2-d coordinate projections, and overplots the halos found by a halo finder. This script works, and currently plots the colorbar based on the mass in a given 2-d bin as done in some of the basic yt plots included in the website. I am wondering if it is possible to have the color scheme of the particles be based on the squared mass or squared density of the particles in any given 2-d bin, so that the higher density regions are highlighted compared to the background lower density regions. I have included the plotting part of my script below, in case it is helpful.
I hope everyone is having a great New Year!
ds = yt.load(VELA_snaps[position[0]])
domain_width = float(ds.domain_width.in_units('Mpc/h')[0])
ad = ds.all_data()
masses = yt.np.unique(ad[('darkmatter', 'particle_mass')])
#filter out the darkmatter0 particles
def mass_filter(pfilter, data):
filter = data[(pfilter.filtered_type, 'particle_mass')] == masses[0]
return filter
yt.add_particle_filter('darkmatter0', function=mass_filter, filtered_type='darkmatter', requires=['particle_mass'])
ds.add_particle_filter('darkmatter0')
scale = float(ds.scale_factor)
fig = plt.figure()
grid = AxesGrid(fig, (0.075,0.075,10,5),
nrows_ncols = (3, 1),
axes_pad = 1.0,
label_mode = "L",
share_all = False,
cbar_location="right",
cbar_mode="each",
cbar_size="3%",
cbar_pad="0%")
zoom = 10
x0 = float(consistent.halo_data_sorted[index][0][17]) * scale / domain_width
y0 = float(consistent.halo_data_sorted[index][0][18]) * scale / domain_width
z0 = float(consistent.halo_data_sorted[index][0][19]) * scale / domain_width
center = [x0, y0, z0]
a = yt.ParticlePlot(ds, ('darkmatter0', 'particle_position_x'), ('darkmatter0', 'particle_position_y'),\
('darkmatter0', 'particle_mass'), center=center)
a.set_unit(('darkmatter0','particle_mass'), 'Msun')
a.zoom(zoom)
b = yt.ParticlePlot(ds, ('darkmatter0', 'particle_position_y'), ('darkmatter0', 'particle_position_z'),\
('darkmatter0', 'particle_mass'), center=center)
b.set_unit(('darkmatter0','particle_mass'), 'Msun')
b.zoom(zoom)
c = yt.ParticlePlot(ds, ('darkmatter0', 'particle_position_z'), ('darkmatter0', 'particle_position_x'),\
('darkmatter0', 'particle_mass'), center=center)
c.set_unit(('darkmatter0','particle_mass'), 'Msun')
c.zoom(zoom)
for halos in consistent.halo_data_sorted[index]:
x = float(halos[17]) * scale / domain_width
y = float(halos[18]) * scale / domain_width
z = float(halos[19]) * scale / domain_width
r = float(halos[11]) * scale / .7
center = [x, y, z]
a.annotate_sphere(center, radius=(r, 'kpc'), circle_args={'color':'red'})
b.annotate_sphere(center, radius=(r, 'kpc'), circle_args={'color':'red'})
c.annotate_sphere(center, radius=(r, 'kpc'), circle_args={'color':'red'})
index = 0
for letter in [a,b,c]:
plot = letter.plots[('darkmatter0', 'particle_mass')]
plot.figure = fig
plot.axes = grid[index].axes
plot.cax = grid.cbar_axes[index]
letter._setup_plots()
index = index + 1
plt.savefig('{}/CatalogProjectionYT_VELA{}_Scale{}.png'.format(out_dir, VELA_number, str(scale)[2:5]), bbox_inches='tight')
plt.close()
Hello all,
I'm just getting into running halo finders (namely rockstar) using yt's
astro analysis package and cannot figure out how to have it such that each
successive run on of rockstar does not overwrite previous runs.
I've been following the "Running Rockstar to Find Halos on
Multi-Resolution-Particle Datasets" and both the HaloCatalog.create() and
the RockstarHaloFinder.run() methods seem to overwrite everything in the
output directory. One obvious fix here is to just have a different output
directory for each dataset, but I had thought the indexes in the rockstar
output files (e.g. "halos_0.0.ascii") and the list in "datasets.txt" were
there to have the results from multiple datasets housed in the same
directory.
And I didn't see any obvious parameters I could pass either of the above
functions to specify a desired output index.
Is this possible? Or should I just write to separate folders for each
dataset?
Best,
Andrew
---
Pasadena Fellow in Theoretical Astrophysics
Carnegie Observatories
California Institute of Technology
Hello,
I am making profile plots as a function of height from the galactic disk with several variables for a FLASH simulation of a galaxy. For the low values of the height, the profile plot gives me nonsense for several variables. After loading in the data and setting some units, these are the few lines I am using:
dd = ds.all_data()
d = yt.ProfilePlot(dd, "z", ["magnetic_field_magnitude"], weight_field='ones')
d.set_log("magnetic_field_magnitude", False)
I then change some labels and save the plot, but these two lines are what's most important. For the first ~1 kpc on the height scale, the plot just has a "zig-zag" pattern for the y-axis, magnetic field magnitude from this code, running from the lower to upper bounds, which is complete nonsense for my data. It then follows a nice curve for the remainder of the plot.
Does anyone have any suggestions on how to fix the "zig-zag" at the lower height values?
Thanks,
Jordan Gardipee