lfkit.utils.evaluators module#

Callable evaluation utilities.

lfkit.utils.evaluators.evaluate_lf_on_grid(lf, *, m_grid, z_grid)[source]#

Return LF values evaluated on a magnitude-redshift grid.

Parameters:
  • lf (Callable[[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]], ndarray[tuple[Any, ...], dtype[float64]]])

  • m_grid (ndarray[tuple[Any, ...], dtype[float64]])

  • z_grid (ndarray[tuple[Any, ...], dtype[float64]])

Return type:

ndarray[tuple[Any, …], dtype[float64]]

lfkit.utils.evaluators.evaluate_non_negative_redshift_callable(fn, z, *, name)[source]#

Evaluate a redshift-dependent callable that must be non-negative.

Parameters:
  • fn (Callable[[ndarray[tuple[Any, ...], dtype[float64]]], ndarray[tuple[Any, ...], dtype[float64]]]) – Callable to evaluate.

  • z (ndarray[tuple[Any, ...], dtype[float64]]) – Redshift array passed to the callable.

  • name (str) – Name used in error messages.

Returns:

Non-negative callable values with the same shape as z.

Return type:

ndarray[tuple[Any, …], dtype[float64]]

lfkit.utils.evaluators.evaluate_optional_redshift_callable(fn, z, *, name)[source]#

Evaluate an optional redshift-dependent callable.

Parameters:
  • fn (Callable[[ndarray[tuple[Any, ...], dtype[float64]]], ndarray[tuple[Any, ...], dtype[float64]]] | None) – Callable to evaluate. If None, None is returned.

  • z (ndarray[tuple[Any, ...], dtype[float64]]) – Redshift array passed to the callable.

  • name (str) – Name used in error messages.

Returns:

Callable values with the same shape as z, or None.

Return type:

ndarray[tuple[Any, …], dtype[float64]] | None

lfkit.utils.evaluators.evaluate_positive_redshift_callable(fn, z, *, name)[source]#

Evaluate a redshift-dependent callable that must be positive.

Parameters:
  • fn (Callable[[ndarray[tuple[Any, ...], dtype[float64]]], ndarray[tuple[Any, ...], dtype[float64]]]) – Callable to evaluate.

  • z (ndarray[tuple[Any, ...], dtype[float64]]) – Redshift array passed to the callable.

  • name (str) – Name used in error messages.

Returns:

Positive callable values with the same shape as z.

Return type:

ndarray[tuple[Any, …], dtype[float64]]

lfkit.utils.evaluators.evaluate_weight_on_grid(weight_fn, *, m_grid, z_grid)[source]#

Return finite non-negative weight values on a magnitude-redshift grid.

Parameters:
  • weight_fn (Callable[[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]], ndarray[tuple[Any, ...], dtype[float64]]])

  • m_grid (ndarray[tuple[Any, ...], dtype[float64]])

  • z_grid (ndarray[tuple[Any, ...], dtype[float64]])

Return type:

ndarray[tuple[Any, …], dtype[float64]]