Skip to content

Remove deprecated source simulation helpers and migrate tests to generator/injector fixtures#158

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/remove-deprecated-source-generation
Draft

Remove deprecated source simulation helpers and migrate tests to generator/injector fixtures#158
Copilot wants to merge 3 commits into
mainfrom
copilot/remove-deprecated-source-generation

Conversation

Copilot AI commented May 22, 2026

Copy link
Copy Markdown
Contributor

The deprecated source-generation helpers in sotrplib/sims/sources/core.py were still coupling source creation and injection by returning both injected maps and generated sources together. This change removes that legacy path and updates the tests to use the current split model: generate sources first, then inject them.

  • Remove deprecated simulation API

    • Delete the legacy source simulation classes from sotrplib/sims/sources/core.py
    • Keep ProcessableMapWithSimulatedSources, which is still used by the injector path
  • Migrate tests to the current simulation flow

    • Replace test usage of RandomSourceSimulation* helpers with shared fixtures built from:
      • FixedSourceGenerator
      • PhotutilsSourceInjector
    • Move the shared setup into tests/conftest.py to avoid duplicating the same generator/injector wiring across suites
  • Stabilize injected-map fixtures

    • Build test sources inside a buffered bounding box rather than directly on the map edges
    • Preserve existing forced-photometry and pointing expectations that assume thumbnails remain fully in-bounds
  • Affected test suites

    • tests/test_simulation_pipeline
    • tests/test_forced_photometry
    • tests/test_pointing

Example of the new test setup pattern:

generator = FixedSourceGenerator(
    min_flux=min_flux,
    max_flux=max_flux,
    number=n_sources,
    catalog_fraction=1.0,
)
simulated_sources, catalog = generator.generate(box=buffered_box)

injector = PhotutilsSourceInjector(
    fwhm_uncertainty_fraction=fwhm_uncertainty_fraction
)
_, new_map = injector.inject(
    input_map=input_map,
    simulated_sources=simulated_sources,
)

Copilot AI linked an issue May 22, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits May 22, 2026 14:24
Copilot AI changed the title [WIP] Remove deprecated source generation functions from core.py Remove deprecated source simulation helpers and migrate tests to generator/injector fixtures May 22, 2026
Copilot AI requested a review from JBorrow May 22, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove deprecated source generation

2 participants