utilities module¶
A collection of useful functions that don’t fit into any of the other classes.
-
galaxy.utilities.wolf_mass(sigma, Re)[source]¶ Wolf mass estimator from Wolf+ 2010
- Args:
- sigma :
- 1D line of sight velocity dispersion in km/s
- Re :
- 2D radius enclosing half the stellar mass in pc
Returns: estimate of the dynamical mass within the half light radius in Msun
-
galaxy.utilities.sersic(R, Re, n, Mtot)[source]¶ Function that returns Sersic Profile for an Elliptical System (See in-class lab 6)
- Input
- R:
- radius (kpc)
- Re:
- half mass radius (kpc)
- n:
- sersic index
- Mtot:
- total stellar mass
- Returns
- Surface Brightness profile in Lsun/kpc^2
-
galaxy.utilities.HernquistM(r, a=<Quantity 60. kpc>, M_halo=<Quantity 1.97e+12 solMass>)[source]¶ - Args:
- r (Quantity, units of kpc): distance from center a (Quantity, units of kpc): scale radius M_halo (Quantity, units of M_sun): total DM mass
- Returns:
- Total DM mass enclosed within r (M_sun)
-
galaxy.utilities.jacobi_radius(r, M_host, M_sat)[source]¶ The Jacobi Radius for a satellite on a circular orbit about an extended host, where the host is assumed to be well modeled as an isothermal sphere halo:
R_j = r * (M_sat / 2 M_host(<r))}^(1/3)
For MW/LMC, the Isothermal Sphere approximation is not a bad one within 50 kpc.
In other contexts, can be called the Roche radius, Roche limit or Hill radius.
- Args:
- r:
- distance between stellite and host (kpc)
- M_host:
- host mass enclosed within r (M_sun)
- M_sat:
- satellite mass (M_sun)
- returns:
- Jacobi radius (kpc)
-
galaxy.utilities.jacobi_mass(Rj, r, Mhost)[source]¶ Function that returns min mass of a satellite given its observed size + distance from a massive host: Msat = (Rj/r)**3 * 2 * Mhost
- Args:
- Rj:
- Jacobi radius (approx as observed size) (kpc)
- r:
- distance between stellite and host (kpc)
- Mhost:
- mass enclosed within r (M_sun)
- returns:
- Minimum mass Msat of a satellite given its current size (M_sun)
-
galaxy.utilities.rotation_matrix_to_vector(old_axis, to_axis=None)[source]¶ - Args:
- old_axis (3-vector)
- Vector to be brought into alignment with to_axis by rotation about the origin
- to_axis (3-vector)
- Angular momentum vector will be aligned to this (default z_hat)
- Returns:
- 3x3 rotation matrix
Based on Rodrigues’ rotation formula Ref: https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula
Note that orientation in the plane perpendicular to ‘to_axis’ is arbitrary
-
galaxy.utilities.z_rotation_matrix(pt1, pt2)[source]¶ Rotates about z-axis to line up two given points along the x-axis
- Args:
- pt1, pt2 (2-component iterables)
- define points to be placed on the x-axis
- Returns:
- 3x3 rotation matrix
-
galaxy.utilities.find_nearest(array, value)[source]¶ Find the entry in array which is closest to value Modified from https://stackoverflow.com/questions/2566412/find-nearest-value-in-numpy-array
Returns: index and corresponding value