pynbody.analysis.angmom.align

Contents

pynbody.analysis.angmom.align#

pynbody.analysis.angmom.align(h, vec_to_xform, disk_size='5 kpc', move_all=True, already_centered=False, center_kwargs=None)[source]#

Reposition and rotate the ancestor of h to place the angular momentum into a specified orientation.

The routine first calls the center routine to reposition the halo (unless already_centered is True). If there are a sufficient number of gas particles (more than 100), only the gas particles are used for centering, since these will also be used for angular momentum calculations; if there is an offset between e.g. dark matter and baryons, it is better to centre on the baryons.

Then, it determines the disk orientation using the angular momentum vector of the gas particles within a specified radius of the halo center. If there is no gas within this radius, the routine falls back first to stellar particles, and then to all particles.

Finally, the angular momentum vector is converted into a rotation matrix using the vec_to_xform function, and the rotation is applied.

Parameters:
  • h (SimSnap) – The portion of the simulation from which to extract a centre and orientation. Typically this is a galaxy halo.

  • vec_to_xform (function) – The function to use to calculate the rotation matrix from the measured angular momentum vector.

  • disk_size (str | float, optional) – The size of the disk to use for calculating the angular momentum vector. Default is “5 kpc”.

  • move_all (bool, optional) – If True, the ancestor simulation of h is transformed. If False, only h is moved. Default is True.

  • already_centered (bool, optional) – If True, the simulation is assumed to be already centered. Default is False.

  • center_kwargs (dict, optional) – Dictionary of additional keyword arguments to pass to the centering routine.