streamobs.background.catalog_injector module#

Full-injection background pipeline using known catalogs.

class streamobs.background.catalog_injector.BackgroundCatalogInjector(survey, **kwargs)[source]#

Bases: object

Thin wrapper around StreamInjector for background catalog injection.

Exposes inject_stars() and inject_galaxies() so the caller does not need to pass source_type explicitly. All injection logic lives in StreamInjector.

Parameters:
  • survey (Survey or list of Survey) – Survey (or surveys, for multi-survey injection) to inject into. Passed through to StreamInjector, which handles both forms; with multiple surveys the output carries each survey’s namespaced columns.

  • **kwargs – Forwarded to StreamInjector.

Examples

>>> injector = BackgroundCatalogInjector(survey)
>>> injector = BackgroundCatalogInjector([survey_lsst, survey_roman])
>>> obs_stars = injector.inject_stars(catalog_df, bands=['g', 'r'])
>>> obs_gals  = injector.inject_galaxies(catalog_df, bands=['g', 'r'])
inject_galaxies(catalog, bands=None, **kwargs) → pd.DataFrame[source]#

Inject a catalog of galaxies through the full survey pipeline.

Uses get_gal_misclassification() for the detection flag (probability a galaxy passes stellar selection). Requires gal_misclassification to be loaded on the survey.

Parameters:
  • catalog (pd.DataFrame or str) – True galaxy catalog. Accepts a DataFrame or a path to parquet/CSV.

  • bands (list of str, optional) – Photometric bands to inject. Defaults to ['r', 'g'].

  • **kwargs – Forwarded to inject().

Returns:

Observed catalog with survey-namespaced magnitude and flag columns.

Return type:

pd.DataFrame

inject_stars(catalog, bands=None, **kwargs) → pd.DataFrame[source]#

Inject a catalog of stars through the full survey pipeline.

Parameters:
  • catalog (pd.DataFrame or str) – True stellar catalog. Accepts a DataFrame or a path to parquet/CSV.

  • bands (list of str, optional) – Photometric bands to inject. Defaults to ['r', 'g'].

  • **kwargs – Forwarded to inject().

Returns:

Observed catalog with survey-namespaced magnitude and flag columns.

Return type:

pd.DataFrame