Skip to content

DM-50420: Inject variable sources into the template and science images#275

Merged
BrunoSanchez merged 2 commits into
mainfrom
tickets/DM-50420
Jun 11, 2026
Merged

DM-50420: Inject variable sources into the template and science images#275
BrunoSanchez merged 2 commits into
mainfrom
tickets/DM-50420

Conversation

@BrunoSanchez

Copy link
Copy Markdown
Member

Create the fake injection pipeline tools for injection on template images.

@BrunoSanchez BrunoSanchez changed the title tickets/DM-50420 DM-50420 May 28, 2026
@BrunoSanchez BrunoSanchez changed the title DM-50420 DM-50420: Inject variable sources into the template and science images Jun 1, 2026

@isullivan isullivan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! A few comments for readability, and potential bugs.

Comment thread python/lsst/ap/pipe/createApFakes.py Outdated
Comment on lines +474 to +475
seed = int(str(visitId)+str(detId))
rng = np.random.default_rng(seed)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
seed = int(str(visitId)+str(detId))
rng = np.random.default_rng(seed)
rng = np.random.default_rng([visitId, detId])

I am very wary of relying on string concatenation for creating the seed.


def __init__(self, **kwargs):
super().__init__(**kwargs)
self.log = logging.getLogger(__name__)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed, this over-writes the inherited logger.

Comment thread python/lsst/ap/pipe/createApFakes.py Outdated
catalog = vstack([catalog, variable_fakes])

if len(catalog) > len(np.unique(catalog["injection_id"])):
self.log.warning("Duplicate injection IDs detected after catalog assembly; reassigning them.")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be worth raising an error if there are duplicates, instead of warning and reassigning.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree, we are creating the injection ids here, so we just need to fix this. NO need to raise an error I think.

Comment thread python/lsst/ap/pipe/createApFakes.py Outdated
Comment thread python/lsst/ap/pipe/createApFakes.py Outdated
Comment thread python/lsst/ap/pipe/createApFakes.py Outdated
Comment thread python/lsst/ap/pipe/createApFakes.py Outdated
Comment thread python/lsst/ap/pipe/createApFakes.py
Comment thread python/lsst/ap/pipe/createApFakes.py Outdated
@BrunoSanchez BrunoSanchez force-pushed the tickets/DM-50420 branch 2 times, most recently from 4efc359 to 3c640e3 Compare June 8, 2026 18:23
@BrunoSanchez BrunoSanchez merged commit 483cf74 into main Jun 11, 2026
4 checks passed
@BrunoSanchez BrunoSanchez deleted the tickets/DM-50420 branch June 11, 2026 22:48
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.

2 participants