rubix.galaxy package#
Subpackages#
Submodules#
rubix.galaxy.alignment module#
- rubix.galaxy.alignment.apply_init_rotation(positions: Float[Array, '...'], rotation_matrix: Float[Array, '...']) Float[Array, '...'] [source]#
Apply a rotation matrix to a set of positions.
- Parameters:
positions (jnp.ndarray) – The positions of the particles.
rotation_matrix (jnp.ndarray) – The rotation matrix.
- Returns:
The rotated positions as a jnp.ndarray.
- rubix.galaxy.alignment.apply_rotation(positions: Float[Array, '* 3'], alpha: float, beta: float, gamma: float) Float[Array, '* 3'] [source]#
Apply a rotation to a set of positions given Euler angles.
- Parameters:
positions (jnp.ndarray) – The positions of the particles.
alpha (float) – Rotation around the x-axis in degrees
beta (float) – Rotation around the y-axis in degrees
gamma (float) – Rotation around the z-axis in degrees
- Returns:
The rotated positions as a jnp.ndarray.
- rubix.galaxy.alignment.center_particles(rubixdata: object, key: str) object [source]#
Center the stellar particles around the galaxy center.
- Parameters:
rubixdata (object) – The RubixData object.
key (str) – The key to the particle data.
stellar_coordinates (jnp.ndarray) – The coordinates of the particles.
stellar_velocities (jnp.ndarray) – The velocities of the particles.
galaxy_center (jnp.ndarray) – The center of the galaxy.
- Returns:
The RubixData object with the centered particles, which contain of a new set of coordinates and velocities as jnp.ndarray.
Example
>>> from rubix.galaxy.alignment import center_particles >>> rubixdata = center_particles(rubixdata, "stars")
- rubix.galaxy.alignment.euler_rotation_matrix(alpha: float, beta: float, gamma: float) Float[Array, '3 3'] [source]#
Create a 3x3 rotation matrix given Euler angles (in degrees)
- Parameters:
alpha (float) – Rotation around the x-axis in degrees
beta (float) – Rotation around the y-axis in degrees
gamma (float) – Rotation around the z-axis in degrees
- Returns:
The rotation matrix as a jnp.ndarray.
- rubix.galaxy.alignment.moment_of_inertia_tensor(positions: Float[Array, '...'], masses: Float[Array, '...'], halfmass_radius: Float[Array, '...'] | float) Float[Array, '...'] [source]#
Calculate the moment of inertia tensor for a given set of positions and masses within the half-light radius. Assumes the galaxy is already centered.
- Parameters:
positions (jnp.ndarray) – The positions of the particles.
masses (jnp.ndarray) – The masses of the particles.
half_light_radius (float) – The half-light radius of the galaxy.
- Returns:
The moment of inertia tensor as a jnp.ndarray.
Example
>>> from rubix.galaxy.alignment import moment_of_inertia_tensor >>> I = moment_of_inertia_tensor(rubixdata.stars.coords, rubixdata.stars.mass, rubixdata.galaxy.half_light_radius)
- rubix.galaxy.alignment.rotate_galaxy(positions: Float[Array, '* 3'], velocities: Float[Array, '* 3'], masses: Float[Array, '...'], halfmass_radius: Float[Array, '...'], alpha: float, beta: float, gamma: float) Tuple[Float[Array, '* 3'], Float[Array, '* 3']] [source]#
Orientate the galaxy by applying a rotation matrix to the positions of the particles.
- Parameters:
positions (jnp.ndarray) – The positions of the particles.
velocities (jnp.ndarray) – The velocities of the particles.
masses (jnp.ndarray) – The masses of the particles.
halfmass_radius (float) – The half-mass radius of the galaxy.
alpha (float) – Rotation around the x-axis in degrees
beta (float) – Rotation around the y-axis in degrees
gamma (float) – Rotation around the z-axis in degrees
- Returns:
The rotated positions and velocities as a jnp.ndarray.
- rubix.galaxy.alignment.rotation_matrix_from_inertia_tensor(I: Float[Array, '...']) Float[Array, '...'] [source]#
Calculate 3x3 rotation matrix by diagonalization of the moment of inertia tensor.
- Parameters:
I (jnp.ndarray) – The moment of inertia tensor.
- Returns:
The rotation matrix as a jnp.ndarray.