binny.tomography.builders module#

Construction of tomography from declarative specifications.

binny.tomography.builders.build_tomography_from_spec(z: Any | None = None, nz: Any | None = None, *, tomo_spec: Mapping[str, Any], predefined_bins: Mapping[int, Any] | None = None, include_tomo_metadata: bool = False, include_photoz_diagnostics: bool = False) → Tomography#

Build tomography from a survey-style specification.

Parameters:
  • z – True-redshift grid. Required for photo-z and spec-z tomography, and when predefined bins are supplied directly.

  • nz – Parent redshift distribution. Optional for predefined bins.

  • tomo_spec – Tomography specification defining the binning model, bin edges, and uncertainties.

  • predefined_bins – Optional mapping of externally supplied bin distributions for predefined tomography.

  • include_tomo_metadata – Whether to include numerical binning metadata.

  • include_photoz_diagnostics – Whether to include photo-z assignment diagnostics in the metadata.

Returns:

Tomography containing the constructed bins, optional numerical metadata, and the resolved tomography specification.

Raises:

ValueError – If required arrays are missing or the specification is invalid.