Add background subpackage: CMD histogram resources and injection pipe…#55
Open
MatthieuPE wants to merge 6 commits into
Open
Add background subpackage: CMD histogram resources and injection pipe…#55MatthieuPE wants to merge 6 commits into
MatthieuPE wants to merge 6 commits into
Conversation
…line - Add gal_misclassification field and method to Survey - Extend set_completeness() with selection='missclassified' - Thread source_type kwarg through StreamInjector.inject() and detect_flag() - New streamobs/background/ subpackage: BackgroundCatalogInjector, BackgroundResourceBuilder, BackgroundStorage, LightBackgroundGenerator, Background wrapper - Add load_catalog() utility to utils.py - Add tests/test_background.py (31 stubs, @pytest.mark.background) - Add user and developer documentation for background generation - Gitignore data/background/ and .claude/ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Collaborator
Author
|
So far coded:
Now we should be able to get background realization from any truth catalogs. Next:
WARNING |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces the
streamobs.backgroundsubpackage, providing two pipelines forgenerating star and galaxy backgrounds alongside stream injections.
Survey / injector changes
gal_misclassificationfield andget_gal_misclassification()toSurvey(detection × misclassification probability for galaxies, without the bright-end
1-padding applied to stars).
SurveyFactory.set_gal_misclassification()and auto-loading from thegal_misclassificationconfig key.source_type='stars'|'galaxies'parameter toStreamInjector.inject()anddetect_flag().load_catalog()utility toutils.py(accepts a DataFrame or a parquet/CSV path).New
streamobs/background/subpackage (scaffold — all methods stubbed)BackgroundCatalogInjector: thin wrapper aroundStreamInjectorwithinject_stars()/inject_galaxies()and a unified_prepare_survey()(uniform maglim, no-dust options).
BackgroundResourceBuilder: builds 2-D color–magnitude histogram grids byinjecting true catalogs into uniform surveys at a grid of
(maglim_ref, Δmaglim)pairs.
BackgroundStorage: saves/loads CMD grids as long-format zstd-compressedparquet files under
data/background/(gitignored). Exposesget_path(),save_data(),load_data(),exists().LightBackgroundGenerator: per-pixel fast generation — nearest-neighbour CMDlookup, Poisson count scaling, position sampling.
Background: top-level wrapper dispatching to the full injection or lightmethod; defaults to bundled package resources when no storage is provided.
Tests / docs
tests/test_background.py: 31 test stubs marked@pytest.mark.background,using
tmp_pathfor all disk I/O.docs/source/background.md(user guide) anddocs/source/build_background_resources.md(developer guide).backgroundmarker registered inpytest.ini;data/background/added to.gitignore.