External Group Functions

group_funcs.get_full_mass_radius(radii, ptype, binary)[source]

Get full mass radius for a set of particles.

Parameters
  • radii (np.ndarray[::-1]) – Radii of particles

  • ptype (np.ndarray[::-1]) – Array of integers containing the particle types.

  • binary (int) – Integer used to select particle types. For example, if you are interested in particle types 0 and 3 this value would be 2^0+2^3=9.

Notes

This function iterates forward through the array, so it is advisable to reverse the radii & ptype arrays before passing them via np.ndarray[::-1].

group_funcs.get_half_mass_radius(mass, radii, ptype, half_mass, binary)[source]

Get half mass radius for a set of particles.

Parameters
  • mass (np.ndarray) – Masses of particles.

  • radii (np.ndarray) – Radii of particles.

  • ptype (np.ndarray) – Array of integers containing the particle types.

  • half_mass (double) – Half mass value to accumulate to.

  • binary (int) – Integer used to select particle types. For example, if you are interested in particle types 0 and 3 this value would be 2^0+2^3=9.

group_funcs.get_periodic_r(boxsize, center, pos, r)[source]

Get periodic radii.

Parameters
  • boxsize (double) – The size of your domain.

  • center (np.ndarray([x,y,z])) – Position in which to calculate the radius from.

  • pos (np.ndarray) – Nx3 numpy array containing the positions of particles.

  • r (np.array) – Empty array to fill with radius values.

group_funcs.get_virial_mr(Density, r, mass, collectRadii)[source]

Get virial mass and radius.

Parameters
  • Density (array) – Different densities you are interested in: e.g rho200, rhovirial, … They have to be in ascending order.

  • r (array) – Particle radii inward

  • mass (array) – Cumulative Particle masses inward

  • collectRadii (array) – Empty array to contain the radii Should be the same size as the Densities

group_funcs.rotator(vals, Rx, Ry, ALPHA, BETA)[source]

Rotate a number of vectors around ALPHA, BETA

Parameters
  • vals (np.ndarray) – Nx3 np.ndarray of values you want to rotate.

  • Rx (np.ndarray) – 3x3 array used for the first rotation about ALPHA. The dot product is taken against each value: vals[i] = np.dot(Rx, vals[i])

  • Ry (np.ndarray) – 3x3 array used for the second rotation about BETA The dot product is taken against each value: vals[i] = np.dot(Ry, vals[i])

  • ALPHA (double) – Angle to rotate around first.

  • BETA (double) – Angle to rotate around second.

Notes

This is typically called from utils.rotator().