odisseo.initial_condition module#
- odisseo.initial_condition.Plummer_sphere(key: Key[Array, ''] | UInt32[Array, '2'], config: SimulationConfig, params: SimulationParams) tuple[source]#
Create initial conditions for a Plummer sphere. The sampling of velocities is done by inverse fitting the cumulative distribution function of the Plummer sphere.
- Parameters:
key (jax.random.PRNGKey) – Random key.
config (NamedTuple) – Configuration NamedTuple containing the number of particles (N_particles).
params (NamedTuple) – Parameters NamedTuple containing:
- Returns:
tuple –
- A tuple containing:
positions (jnp.array): Array of shape (N_particles, 3) representing the positions of the particles. velocities (jnp.array): Array of shape (N_particles, 3) representing the velocities of the particles. masses (jnp.array): Array of shape (N_particles,) representing the masses of the particles.
- odisseo.initial_condition.Plummer_sphere_reparam(noise: Array, config: SimulationConfig, params: SimulationParams) tuple[source]#
Reparameterized Plummer sphere generation.
- Parameters:
noise (jnp.ndarray) – Pre-sampled uniform random numbers of shape (N_particles, 6) where each column corresponds to: [0]: radial sampling [1]: position azimuthal angle [2]: position polar angle [3]: velocity magnitude sampling [4]: velocity azimuthal angle [5]: velocity polar angle
config (SimulationConfig) – Configuration containing N_particles
params (SimulationParams) – Parameters containing Plummer_params, G
- Returns:
tuple – Same as original Plummer_sphere function
- odisseo.initial_condition.ic_two_body(mass1: float | Array, mass2: float | Array, rp: float | Array, e: float | Array, params: SimulationParams) tuple[source]#
Create initial conditions for a two-body system.
By default, the two bodies will be placed along the x-axis at the closest distance rp. Depending on the input eccentricity, the two bodies can be in a circular (e < 1), parabolic (e = 1), or hyperbolic orbit (e > 1).
- Parameters:
mass1 (float) – Mass of the first body [nbody units].
mass2 (float) – Mass of the second body [nbody units].
rp (float) – Closest orbital distance [nbody units].
e (float) – Eccentricity.
config (NamedTuple) – Configuration NamedTuple.
params (NamedTuple) – Parameters NamedTuple.
- Returns:
tuple –
- A tuple containing:
pos (jnp.ndarray): Positions of the particles.
vel (jnp.ndarray): Velocities of the particles.
mass (jnp.ndarray): Masses of the particles.
- odisseo.initial_condition.inclined_circular_velocity(position: Array, v_c: Array, inclination: Array)[source]#
Convert circular velocity module on the xy plane to an inclined orbit Cartesian components.
- Parameters:
position (jnp.ndarray) – (x, y, z) position of the Plummer sphere.
v_c (float) – Circular velocity (km/s).
inclination (float) – Inclination angle in radians.
- Returns:
jnp.ndarray – (v_x, v_y, v_z) velocity components.
- odisseo.initial_condition.inclined_position(position: Array, inclination: Array)[source]#
Convert position on the xy-plane to an inclined orbit.
- Parameters:
position (jnp.ndarray) – (x, y, z) position of the Plummer sphere.
inclination – Inclination angle in radians.
- odisseo.initial_condition.sample_position_on_circle(key: Key[Array, ''] | UInt32[Array, '2'], r_p: float, num_samples: int = 1)[source]#
Sample uniform positions on a sphere of radius r_p.
- Parameters:
key (jax.random.PRNGKey) – JAX random key for sampling.
r_p (float) – Radius of the sphere.
num_samples (int) – Number of samples to generate.
- Returns:
jnp.ndarray – Sampled positions (num_samples, 3).
- odisseo.initial_condition.sample_position_on_sphere(key: Key[Array, ''] | UInt32[Array, '2'], r_p: float, num_samples: int = 1)[source]#
Sample uniform positions on a sphere of radius r_p.
- Parameters:
key (jax.random.PRNGKey) – JAX random key for sampling.
r_p (float) – Radius of the sphere.
num_samples (int) – Number of samples to generate. Deafult is 1.
- Returns:
jnp.ndarray – Sampled positions (num_samples, 3).