Profiles, Contours and Halo Finding

Profiling

Profiling in yt is a means of generating arbitrary histograms – for instance, phase diagrams, radial profiles, and even more complicated 3D examinations.

class yt.lagos.BinnedProfile1D(data_source, n_bins, bin_field, lower_bound, upper_bound, log_space=True, lazy_reader=False)

Bases: yt.lagos.Profiles.BinnedProfile

A ‘Profile’ produces either a weighted (or unweighted) average or a straight sum of a field in a bin defined by another field. In the case of a weighted average, we have: p_i = sum( w_i * v_i ) / sum(w_i)

We accept a data_source, which will be binned into n_bins by the field bin_field between the lower_bound and the upper_bound. These bins may or may not be equally divided in log_space, and the lazy_reader flag controls whether we use a memory conservative approach.

add_fields(fields, weight='CellMassMsun', accumulation=False)
We accept a list of fields which will be binned if weight is not None and otherwise summed. accumulation determines whether or not they will be accumulated from low to high along the appropriate axes.
class yt.lagos.BinnedProfile2D(data_source, x_n_bins, x_bin_field, x_lower_bound, x_upper_bound, x_log, y_n_bins, y_bin_field, y_lower_bound, y_upper_bound, y_log, lazy_reader=False)

Bases: yt.lagos.Profiles.BinnedProfile

A ‘Profile’ produces either a weighted (or unweighted) average or a straight sum of a field in a bin defined by two other fields. In the case of a weighted average, we have: p_i = sum( w_i * v_i ) / sum(w_i)

We accept a data_source, which will be binned into x_n_bins by the field x_bin_field between the x_lower_bound and the x_upper_bound and then again binned into y_n_bins by the field y_bin_field between the y_lower_bound and the y_upper_bound. These bins may or may not be equally divided in log-space as specified by x_log and y_log, and the lazy_reader flag controls whether we use a memory conservative approach.

add_fields(fields, weight='CellMassMsun', accumulation=False)
We accept a list of fields which will be binned if weight is not None and otherwise summed. accumulation determines whether or not they will be accumulated from low to high along the appropriate axes.
write_out(filename, format='%0.16e')
Write out the values of x,y,v in ascii to filename for every field in the profile. Optionally a format can be specified.
class yt.lagos.BinnedProfile3D(data_source, x_n_bins, x_bin_field, x_lower_bound, x_upper_bound, x_log, y_n_bins, y_bin_field, y_lower_bound, y_upper_bound, y_log, z_n_bins, z_bin_field, z_lower_bound, z_upper_bound, z_log, lazy_reader=False)

Bases: yt.lagos.Profiles.BinnedProfile

add_fields(fields, weight='CellMassMsun', accumulation=False)
We accept a list of fields which will be binned if weight is not None and otherwise summed. accumulation determines whether or not they will be accumulated from low to high along the appropriate axes.
store_profile(name, force=False)
By identifying the profile with a fixed, user-input name we can store it in the serialized data section of the hierarchy file. force governs whether or not an existing profile with that name will be overwritten.
class yt.lagos.StoredBinnedProfile3D(pf, name)

Bases: yt.lagos.Profiles.BinnedProfile3D

Given a pf parameterfile and the name of a stored profile, retrieve it into a read-only data structure.

Contour Finding

Typically this is done via the extract_connected_sets() on a data object. However, you can call it manually, as is done in the clump finding scripts.

yt.lagos.identify_contours(data_source, field, min_val, max_val)
Given a data_source, we will search for topologically connected sets in field between min_val and max_val.
class yt.lagos.GridConsiderationQueue(white_list=None, priority_func=None)
This class exists to serve the contour finder. It ensures that we can create a cascading set of queue dependencies, and if a grid is touched again ahead of time we can bump it to the top of the queue again. It like has few uses.

Halo Finding

yt now includes the HOP algorithm and implementation from the Enzo source distribution, with some modifications by both Stephen Skory and myself.

class yt.lagos.hop.HopList(data_source, threshold=160.0, dm_only=True)

Run hop on data_source with a given density threshold. If dm_only is set, only run it on the dark matter particles, otherwise on all particles. Returns an iterable collection of HopGroup items.

write_out(filename='HopAnalysis.out')
Write out standard HOP information to filename.
class yt.lagos.hop.HopGroup(hop_output, id, indices)

A data source that returns particle information about the members of a HOP-identified halo.

bulk_velocity()
Returns the mass-weighted average velocity.
center_of_mass()
Calculate and return the center of mass.
get_sphere(center_of_mass=True)
Returns an EnzoSphere centered on either the point of maximum density or the center_of_mass, with the maximum radius of the halo.
maximum_density()
Return the HOP-identified maximum density.
maximum_density_location()
Return the location HOP identified as maximally dense.
maximum_radius(center_of_mass=True)
Returns the maximum radius in the halo for all particles, either from the point of maximum density or from the (default) center_of_mass.
total_mass()
Returns the total mass in solar masses of the halo.