Transforms
transforms
¶
Transform functions for graph-based simulators.
Functions¶
beta_spin_magnitude
¶
beta_spin_magnitude(*, alpha: float, beta: float, key: Array, reference: Array | None = None, n_samples: int | None = None, minimum: float = 0.0, maximum: float = 1.0) -> Array
Draw spin magnitudes from a rescaled Beta distribution.
constant_like
¶
constant_like(reference: Array, value: float) -> Array
Return a constant array with the same shape as reference.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference
|
Array
|
Array providing the target shape. |
required |
value
|
float
|
Scalar value to broadcast across the output. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
An array with the same shape as |
gaussian_chi_eff
¶
gaussian_chi_eff(*, key: Array | None = None, reference: Array | None = None, n_samples: int | None = None, mean: float = 0.0, sigma: float = 0.1, minimum: float = -1.0, maximum: float = 1.0, chi_eff: Array | None = None, component: str | None = None, mass_1: Array | None = None, mass_2: Array | None = None, spin_magnitude_1: Array | None = None, spin_magnitude_2: Array | None = None) -> Array
Draw or project an effective aligned-spin distribution.
When component is omitted, this returns chi_eff samples drawn from a
clipped Gaussian. When component is "primary" or "secondary",
the function projects the supplied or sampled chi_eff values onto the
requested spin-z component while respecting the available spin magnitudes.
identity
¶
identity(*, value: Array) -> Array
Return value unchanged.
Useful for aliasing one parameter to another in a graph config (e.g. setting
theta_jn equal to inclination for aligned-spin populations).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Array
|
Array-like value to pass through. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
|
isotropic_declination
¶
isotropic_declination(*, key: Array, reference: Array | None = None, n_samples: int | None = None) -> Array
Draw declinations with sin(declination) uniform on [-1, 1].
Produces an isotropic sky distribution in declination, i.e. angles in
[-pi/2, pi/2] with arcsin of a uniform variate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
Array
|
JAX PRNG key. |
required |
reference
|
Array | None
|
Optional array providing the output shape. |
None
|
n_samples
|
int | None
|
Number of samples, used when |
None
|
Returns:
| Type | Description |
|---|---|
Array
|
Declination angles in radians on |
isotropic_spin_orientation
¶
isotropic_spin_orientation(*, key: Array, reference: Array | None = None, n_samples: int | None = None) -> Array
Draw polar angles with cos(tilt) uniform on [-1, 1].
luminosity_distance_to_redshift
¶
luminosity_distance_to_redshift(luminosity_distance: Array, *, hubble_constant: float = PLANCK18_H0_KM_S_MPC, omega_m: float = PLANCK18_OMEGA_M, max_redshift: float = DEFAULT_MAX_REDSHIFT, n_grid: int = DEFAULT_LOOKUP_GRID_SIZE) -> Array
Convert luminosity distance to redshift with a flat-ΛCDM lookup.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
luminosity_distance
|
Array
|
Luminosity distance in Mpc. |
required |
hubble_constant
|
float
|
Hubble constant in km / s / Mpc. |
PLANCK18_H0_KM_S_MPC
|
omega_m
|
float
|
Matter density. |
PLANCK18_OMEGA_M
|
max_redshift
|
float
|
Largest redshift supported by the lookup table. |
DEFAULT_MAX_REDSHIFT
|
n_grid
|
int
|
Number of tabulation points. |
DEFAULT_LOOKUP_GRID_SIZE
|
Returns:
| Type | Description |
|---|---|
Array
|
Redshift inferred from |
maximum
¶
maximum(left: Array, right: Array) -> Array
Return the elementwise maximum of two array-like inputs.
minimum
¶
minimum(left: Array, right: Array) -> Array
Return the elementwise minimum of two array-like inputs.
multiply
¶
multiply(left: Array, right: Array) -> Array
Multiply two array-like inputs elementwise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
left
|
Array
|
Left multiplicand. |
required |
right
|
Array
|
Right multiplicand. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Elementwise product of |
spherical_to_cartesian_x
¶
spherical_to_cartesian_x(*, magnitude: Array, tilt: Array, azimuth: Array) -> Array
Project spherical coordinates onto the Cartesian x component.
spherical_to_cartesian_y
¶
spherical_to_cartesian_y(*, magnitude: Array, tilt: Array, azimuth: Array) -> Array
Project spherical coordinates onto the Cartesian y component.
spherical_to_cartesian_z
¶
spherical_to_cartesian_z(*, magnitude: Array, tilt: Array) -> Array
Project spherical coordinates onto the Cartesian z component.
take_row
¶
take_row(*, matrix: Array, index: int) -> Array
Select one row from a 2-D array.
Used to split a jointly sampled (k, n_samples) array (e.g. a component
mass pair) into individual 1-D parameter columns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
Array
|
Array whose leading axis is indexed. |
required |
index
|
int
|
Row index to select. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
The selected row as a 1-D array. |