odisseo.utils module#

odisseo.utils.Angular_momentum(state: Array, mass: Array) Array[source]#

Return the angular momentum of the system.

Parameters:
  • state (jnp.ndarray) – Array of shape (N_particles, 6) representing the positions and velocities of the particles.

  • mass (jnp.ndarray) – Array of shape (N_particles,) representing the masses of the particles.

Returns:

jnp.ndarray – The angular momentum of each particle in the system

odisseo.utils.E_kin(state: Array, mass: Array) Array[source]#

Return the kinetic energy of the system.

Parameters:
  • state (jnp.ndarray) – Array of shape (N_particles, 6) representing the positions and velocities of the particles.

  • mass – Array of masses for each particle.

odisseo.utils.E_pot(state: Array, mass: Array, config: SimulationConfig, params: SimulationParams) Array[source]#

Return the potential energy of the system.

Parameters:
  • state (jnp.ndarray) – Array of shape (N_particles, 6) representing the positions and velocities of the particles.

  • mass (jnp.ndarray) – Array of shape (N_particles,) representing the masses of the particles.

  • config (SimulationConfig) – Configuration object containing simulation parameters.

  • params (SimulationParams) – Parameters object containing physical parameters for the simulation.

Returns:

E_tot – The potential energy of each particle in the system.

odisseo.utils.E_tot(state: Array, mass: Array, config: SimulationConfig, params: SimulationParams) Array[source]#

Return the total energy of the system.

Parameters:
  • state (jnp.ndarray) – Array of shape (N_particles,2, 3) representing the positions and velocities of the particles.

  • mass (jnp.ndarray) – Array of shape (N_particles,) representing the masses of the particles.

  • config (SimulationConfig) – Configuration object containing simulation parameters.

  • params (SimulationParams) – Parameters object containing physical parameters for the simulation.

Returns:

float – The total energy of each particle in the system

odisseo.utils.center_of_mass(state: Array, mass: Array) Array[source]#

Return the center of mass of the system.

Parameters:
  • state (jnp.ndarray) – Array of shape (N_particles, 6) representing the positions and velocities of the particles.

  • mass (jnp.ndarray) – Array of masses for each particle.

Returns:

jnp.ndarray – The center of mass position

odisseo.utils.equat_to_gd1(Xequat: Array) Array[source]#

Composed conversion from equatorial frame co-ordinates to angular GD1 co-ordinates :param Xhalo: 3d position (x [kpc], y [kpc], z [kpc]) in simulation frame

Returns:

3d position (r [kpc], phi1 [rad], phi2 [rad]) in angular GD1 frame

Examples

>>> equat_to_gd1(jnp.array([1.0, 2.0, 3.0]))
odisseo.utils.equat_to_gd1_velocity(Xequat: Array, Vequat: Array) Array[source]#

Velocity conversion from equatorial frame co-ordinates to angular GD1 co-ordinates :param Xequat: 3d position (r [kpc], alpha [rad], delta [rad]) in equatorial frame :param Vequat: 3d velocity (v_r [kpc/Myr], v_alpha [rad/Myr], v_delta [rad/Myr]) in equatorial frame

Returns:

3d velocity (v_r [kpc/Myr], v_phi1 [rad/Myr], v_phi2 [rad/Myr]) in angular GD1 frame

Examples

>>> equat_to_gd1_velocity(jnp.array([1.0, 2.0, 3.0]), jnp.array([1.0, 2.0, 3.0]))
odisseo.utils.equat_to_gd1cart(Xequat: Array) Array[source]#

Conversion from equatorial co-ordinates to cartesian GD1 co-ordinates :param Xequat: 3d position (r [kpc], alpha [rad], delta [rad]) in equatorial frame

Returns:

3d position (x_gd1 [kpc], y_gd1 [kpc], z_gd1 [kpc]) in cartesian GD1 frame

Examples

>>> equat_to_gd1cart(jnp.array([1.0, 2.0, 3.0]))
odisseo.utils.gal_to_equat(Xgal: Array) Array[source]#

Conversion from galactic co-ordinates to equatorial co-ordinates :param Xgal: 3d position (r [kpc], b [rad], l [rad]) in galactic frame

Returns:

3d position (r [kpc], alpha [rad], delta [rad]) in equatorial frame

Examples

>>> gal_to_equat(jnp.array([1.0, 2.0, 3.0]))
odisseo.utils.gd1_projection_vmap(Xhalo: Array, Vhalo: Array) Array#

Vectorized version of halo_to_gd1_all. Takes similar arguments as halo_to_gd1_all but with additional array axes over which halo_to_gd1_all is mapped.

Original documentation:

Position and Velocity conversion from equatorial frame co-ordinates to angular GD1 co-ordinates Args:

Xhalo: 3d position (x [kpc], y [kpc], z [kpc]) in simulation frame Vhalo: 3d velocity (v_x [kpc/Myr], v_y [kpc/Myr], v_z [kpc/Myr]) in simulation frame

Returns:

6d phase space (x [kpc], y [kpc], z[kpv], v_r [kpc/Myr], v_phi1 [rad/Myr], v_phi2 [rad/Myr]) in angular GD1 frame

>>> halo_to_gd1_all(jnp.array([1.0, 2.0, 3.0]), jnp.array([1.0, 2.0, 3.0]))
odisseo.utils.gd1cart_to_gd1(Xgd1cart: Array) Array[source]#

Conversion from cartesian GD1 co-ordinates to angular GD1 co-ordinates :param Xgd1cart: 3d position (x_gd1 [kpc], y_gd1 [kpc], z_gd1 [kpc]) in cartesian GD1 frame

Returns:

3d position (r [kpc], phi1 [rad], phi2 [rad]) in angular GD1 frame

Examples

>>> gd1cart_to_gd1(jnp.array([1.0, 2.0, 3.0]))
odisseo.utils.halo_to_gd1(Xhalo: Array) Array[source]#

Composed conversion from simulation frame co-ordinates to angular GD1 co-ordinates :param Xhalo: 3d position (x [kpc], y [kpc], z [kpc]) in simulation frame

Returns:

3d position (r [kpc], phi1 [rad], phi2 [rad]) in angular GD1 frame

Examples

>>> halo_to_gd1(jnp.array([1.0, 2.0, 3.0]))
odisseo.utils.halo_to_gd1_all(Xhalo: Array, Vhalo: Array) Array[source]#

Position and Velocity conversion from equatorial frame co-ordinates to angular GD1 co-ordinates :param Xhalo: 3d position (x [kpc], y [kpc], z [kpc]) in simulation frame :param Vhalo: 3d velocity (v_x [kpc/Myr], v_y [kpc/Myr], v_z [kpc/Myr]) in simulation frame

Returns:

6d phase space (x [kpc], y [kpc], z[kpv], v_r [kpc/Myr], v_phi1 [rad/Myr], v_phi2 [rad/Myr]) in angular GD1 frame

Examples

>>> halo_to_gd1_all(jnp.array([1.0, 2.0, 3.0]), jnp.array([1.0, 2.0, 3.0]))
odisseo.utils.halo_to_gd1_velocity(Xhalo: Array, Vhalo: Array) Array[source]#

Velocity conversion from equatorial frame co-ordinates to angular GD1 co-ordinates :param Xhalo: 3d position (x [kpc], y [kpc], z [kpc]) in simulation frame :param Vhalo: 3d velocity (v_x [kpc/Myr], v_y [kpc/Myr], v_z [kpc/Myr]) in simulation frame

Returns:

3d velocity (v_r [kpc/Myr], v_phi1 [rad/Myr], v_phi2 [rad/Myr]) in angular GD1 frame

Examples

>>> halo_to_gd1_velocity(jnp.array([1.0, 2.0, 3.0]), jnp.array([1.0, 2.0, 3.0]))
odisseo.utils.halo_to_gd1_velocity_vmap(Xhalo: Array, Vhalo: Array) Array#

Vectorized version of halo_to_gd1_velocity. Takes similar arguments as halo_to_gd1_velocity but with additional array axes over which halo_to_gd1_velocity is mapped.

Original documentation:

Velocity conversion from equatorial frame co-ordinates to angular GD1 co-ordinates Args:

Xhalo: 3d position (x [kpc], y [kpc], z [kpc]) in simulation frame Vhalo: 3d velocity (v_x [kpc/Myr], v_y [kpc/Myr], v_z [kpc/Myr]) in simulation frame

Returns:

3d velocity (v_r [kpc/Myr], v_phi1 [rad/Myr], v_phi2 [rad/Myr]) in angular GD1 frame

>>> halo_to_gd1_velocity(jnp.array([1.0, 2.0, 3.0]), jnp.array([1.0, 2.0, 3.0]))
odisseo.utils.halo_to_gd1_vmap(Xhalo: Array) Array#

Vectorized version of halo_to_gd1. Takes similar arguments as halo_to_gd1 but with additional array axes over which halo_to_gd1 is mapped.

Original documentation:

Composed conversion from simulation frame co-ordinates to angular GD1 co-ordinates Args:

Xhalo: 3d position (x [kpc], y [kpc], z [kpc]) in simulation frame

Returns:

3d position (r [kpc], phi1 [rad], phi2 [rad]) in angular GD1 frame

>>> halo_to_gd1(jnp.array([1.0, 2.0, 3.0]))
odisseo.utils.halo_to_sun(Xhalo: Array) Array[source]#

Conversion from simulation frame to cartesian frame centred at Sun

Parameters:

Xhalo – 3d position (x [kpc], y [kpc], z [kpc]) in simulation frame

Returns:

3d position (x_s [kpc], y_s [kpc], z_s [kpc]) in Sun frame

Examples

>>> halo_to_sun(jnp.array([1.0, 2.0, 3.0]))
odisseo.utils.jacobian_equat_to_gd1(Xequat: Array) Array#

Jacobian of equat_to_gd1 with respect to positional argument(s) 0. Takes the same arguments as equat_to_gd1 but returns the jacobian of the output with respect to the arguments at positions 0.

odisseo.utils.jacobian_halo_to_gd1(Xhalo: Array) Array#

Jacobian of halo_to_gd1 with respect to positional argument(s) 0. Takes the same arguments as halo_to_gd1 but returns the jacobian of the output with respect to the arguments at positions 0.

odisseo.utils.projection_on_GD1(final_state, code_units: CodeUnits) Array[source]#
odisseo.utils.sun_to_gal(Xsun: Array) Array[source]#

Conversion from sun cartesian frame to galactic co-ordinates :param Xsun: 3d position (x_s [kpc], y_s [kpc], z_s [kpc]) in Sun frame

Returns:

3d position (r [kpc], b [rad], l [rad]) in galactic frame

Examples

>>> sun_to_gal(jnp.array([1.0, 2.0, 3.0]))