binny.surveys.survey_presets module#

Helpers for working with built-in Binny survey configurations.

This module provides a small public interface for discovering, loading, and displaying the survey YAML files distributed with Binny. These helpers let users access survey presets such as LSST, DESI, or Roman by name, without needing to know where the YAML files live inside the installed package.

The returned configurations use the same dictionary structure as the YAML files and can be used with build_survey_tomography.

binny.surveys.survey_presets.build_survey_tomography(survey: str | None = None, *, config_file: str | Path | None = None, cfg: Mapping[Any, Any] | None = None, z: Any | None = None, role: str | None = None, year: Any | None = None, scenario: Any | None = None, sample: Any | None = None, overrides: Mapping[str, Any] | None = None, include_survey_metadata: bool = False, include_tomo_metadata: bool = False, include_photoz_diagnostics: bool = False) → Tomography#

Build tomography from a survey preset or configuration.

Parameters:
  • survey – Built-in survey name, such as "lsst" or "desi".

  • config_file – Path to a custom YAML file or shipped configuration.

  • cfg – Optional in-memory survey configuration.

  • z – Optional redshift grid overriding the configured grid.

  • role – Optional tomography role selector.

  • year – Optional survey year selector.

  • scenario – Optional scenario selector.

  • sample – Optional sample selector.

  • overrides – Optional tomography specification overrides. Nested mappings are merged one level deep.

  • include_survey_metadata – Whether to attach survey metadata.

  • include_tomo_metadata – Whether to include tomography metadata.

  • include_photoz_diagnostics – Whether to include photo-z diagnostics.

Returns:

Tomography containing the parent redshift distribution, bins, resolved specification, and requested metadata.

Raises:
  • ValueError – If configuration sources or tomography selection are invalid.

  • FileNotFoundError – If the requested configuration cannot be found.

binny.surveys.survey_presets.list_survey_configs() → list[str]#

List built-in survey configuration names.

binny.surveys.survey_presets.load_survey_config(survey: str) → dict[str, Any]#

Load a built-in survey configuration by survey name.

Parameters:

survey – Survey preset name, such as "lsst", "desi", or "roman".

Returns:

Parsed survey configuration dictionary.

binny.surveys.survey_presets.show_survey_config(survey: str, *, print_output: bool = True) → str#

Show a built-in survey configuration as YAML text.

Parameters:
  • survey – Survey preset name, such as "lsst", "desi", or "roman".

  • print_output – Whether to print the YAML text before returning it.

Returns:

The selected survey configuration formatted as YAML.