pynbody.analysis.halo.shrink_sphere_center#
- pynbody.analysis.halo.shrink_sphere_center(sim, r=None, shrink_factor=0.7, min_particles=100, num_threads=None, particles_for_velocity=0, families_for_velocity=['dm', 'star'])[source]#
Return the center according to the shrinking-sphere method of Power et al (2003)
Most users will want to use the higher-level
center()
function, which actually performs the centering operation. This function is a lower-level interface that calculates the center but does not move the particles.- Parameters:
sim (SimSnap) – The simulation snapshot to center
r (float | str, optional) – Initial search radius. If None, a rough estimate is used.
shrink_factor (float, optional) – The amount to shrink the search radius by on each iteration
min_particles (int, optional) – Minimum number of particles within the search radius. When this number is reached, the search is complete.
num_threads (int, optional) – Number of threads to use for the calculation. If None, the number of threads is taken from the configuration.
particles_for_velocity (int, optional) – If > min_particles, a velocity centre is calculated when the number of particles falls below this threshold, and returned.
families_for_velocity (list, optional) – The families to use for the velocity centering. Default is [‘dm’, ‘star’], because gas particles may be involved in violent outflows making them a risky choice for velocity centering.
- Returns:
com (SimArray) – The center of mass of the final sphere
vel (SimArray) – The center of mass velocity of the final sphere. Only returned if particles_for_velocity > min_particles.