binny.binning.photoz module#

Photometric-redshift tomographic assignment probabilities.

binny.binning.photoz.photoz_assignment(z: NDArray[float64], edges: NDArray[float64], *, scatter_scale: Sequence[float] | float = 0.0, mean_offset: Sequence[float] | float = 0.0, mean_scale: Sequence[float] | float = 1.0, outlier_frac: Sequence[float] | float = 0.0, outlier_scatter_scale: Sequence[float] | float | None = None, outlier_mean_offset: Sequence[float] | float = 0.0, outlier_mean_scale: Sequence[float] | float = 1.0) → NDArray[float64]#

Return photo-z bin-assignment probabilities.

Model parameters may be specified globally or independently for each tomographic bin.

Parameters:
  • z – True-redshift grid.

  • edges – Bin edges in observed photo-z space.

  • scatter_scale – Core Gaussian scatter scale.

  • mean_offset – Core Gaussian mean offset.

  • mean_scale – Core Gaussian mean scale.

  • outlier_frac – Outlier mixture fraction.

  • outlier_scatter_scale – Outlier Gaussian scatter scale.

  • outlier_mean_offset – Outlier Gaussian mean offset.

  • outlier_mean_scale – Outlier Gaussian mean scale.

Returns:

Selection probabilities with shape (n_bins, n_z).

binny.binning.photoz.photoz_assignment_probability(z: NDArray[float64], bin_min: float, bin_max: float, scatter_scale: float, mean_offset: float, *, mean_scale: float = 1.0, outlier_frac: float = 0.0, outlier_scatter_scale: float | None = None, outlier_mean_offset: float = 0.0, outlier_mean_scale: float = 1.0) → NDArray[float64]#

Compute the probability of assignment to one photo-z bin.

Parameters:
  • z – True-redshift grid.

  • bin_min – Lower observed photo-z edge.

  • bin_max – Upper observed photo-z edge.

  • scatter_scale – Core Gaussian scatter scale.

  • mean_offset – Core Gaussian mean offset.

  • mean_scale – Core Gaussian mean scale.

  • outlier_frac – Outlier mixture fraction.

  • outlier_scatter_scale – Outlier Gaussian scatter scale.

  • outlier_mean_offset – Outlier Gaussian mean offset.

  • outlier_mean_scale – Outlier Gaussian mean scale.

Returns:

Bin-assignment probabilities evaluated on the true-z grid.

Raises:

ValueError – If the photo-z parameters are invalid.

binny.binning.photoz.true_redshift_distribution(z: NDArray[float64], nz: NDArray[float64], bin_min: float, bin_max: float, scatter_scale: float, mean_offset: float, *, mean_scale: float = 1.0, outlier_frac: float = 0.0, outlier_scatter_scale: float | None = None, outlier_mean_offset: float = 0.0, outlier_mean_scale: float = 1.0) → NDArray[float64]#

Computes the true-redshift distribution for a single photo-z bin.

The photo-z-selected true-redshift distribution is n_bin(z) = n(z) * P(bin | z), where n(z) is the parent distribution and P(bin | z)` is the probability that an object at true redshift ``z falls into the photo-z bin. The probability is modeled with a Gaussian core photo-z relation, with an optional Gaussian outlier component controlled by outlier_frac and the corresponding outlier parameters.

Parameters:
  • z – True-redshift grid.

  • nz – Parent distribution evaluated on z.

  • bin_min – Lower photo-z edge for the bin.

  • bin_max – Upper photo-z edge for the bin.

  • scatter_scale – Core photo-z scatter scale.

  • mean_offset – Core photo-z mean offset.

  • mean_scale – Core photo-z mean scale.

  • outlier_frac – Outlier mixture fraction.

  • outlier_scatter_scale – Outlier scatter scale.

  • outlier_mean_offset – Outlier mean offset.

  • outlier_mean_scale – Outlier mean scale.

Returns:

Photo-z-selected true-redshift distribution evaluated on z.

Raises:

ValueError – If outlier_frac is outside [0, 1], if required outlier parameters are missing, or if any active scale parameter is invalid.