Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-48896 : Add yaml for DRP processing with sysnthetic source injection for diffim #212

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

BrunoSanchez
Copy link
Member

Add a pipeline yaml that takes DRP Diffim stage and adds injected synthetic sources, for transient discovery testing.

@BrunoSanchez BrunoSanchez changed the title DM_48896: Add yaml for DRP processing with sysnthetic source injection for diffim DM-48896: Add yaml for DRP processing with sysnthetic source injection for diffim Feb 18, 2025
@BrunoSanchez BrunoSanchez changed the title DM-48896: Add yaml for DRP processing with sysnthetic source injection for diffim DM-48896 : Add yaml for DRP processing with sysnthetic source injection for diffim Feb 18, 2025
Comment on lines 9 to 10
injection_prefix: 'injection_'
injected_prefix: 'injected_'
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these actually used in this YAML?

Copy link
Member Author

@BrunoSanchez BrunoSanchez Feb 18, 2025

Choose a reason for hiding this comment

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

I am thinking now that maybe they are not being used. I left them so they are clear, and explicit for the user to see.
Do you think it might be better without these?

Copy link
Contributor

Choose a reason for hiding this comment

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

Clear for what purpose though? If we change the task default from injected_ to post_injection_ for example, the injected_prefix here would still read injected_. Someone might look at this thinking your injected outputs will still be injected_.

Copy link
Contributor

Choose a reason for hiding this comment

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

If these aren't being used, my recommendation would be to remove them. While we do have examples of code used for demonstration purposes in the stack(!), I've never been a fan of it myself, and I think it ultimately leads to more confusion and more unnecessary maintenance downstream.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's fine then. Since this yaml defines inputs and outputs explicitly and no dataset type templates are actually in use, I will remove these.

Copy link
Contributor

Choose a reason for hiding this comment

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

The alternative is that you do use these parameters in your config over-rides below.

Comment on lines +13 to +22
inject_visit:
class: lsst.source.injection.inject_visit.VisitInjectTask
config:
external_psf: false
external_photo_calib: false
external_wcs: false
connections.input_exposure: pvi
connections.output_exposure: injected_pvi
connections.output_catalog: injected_pvi_catalog
selection: "np.isin(injection_catalog['visit'], {visit})"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can I ask why you've decided to hard-code the VisitInjectTask here, rather than dynamically create it as we do with other injection pipelines? Putting this in would be the second instance in the stack (after pipelines/_ingredients/ApPipeWithFakes.yaml).

Copy link
Member Author

Choose a reason for hiding this comment

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

Because dynamically creating this has a key shortcomings for our case, as it doesn't include the matching tasks, with the associated metrics tasks to verify that we have found our injections

Copy link
Contributor

Choose a reason for hiding this comment

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

From make_injection_pipeline --help:

  -a, --additional-pipelines FILE [FILE ...]
      Location(s) of additional input pipeline definition YAML file(s).Tasks
      from these additional pipelines will be added to the output injection
      pipeline.

This allows you to define the additional task stubs you need in their own stand-along YAML, and then build a complete SI YAML when drp_pipe gets constructed.

Copy link
Contributor

Choose a reason for hiding this comment

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

We faced the same issue 5 years ago in our DRP fakes pipelines. Setting them up as static and stand-alone is easier out of the gate, but the problem of having to maintain them as other aspects of the pipeline change quickly becomes onerous. It's almost certainly better for you to set up the AP synthetic pipelines as dynamic now to guard against future maintenance overhead.

connections.output_catalog: injected_pvi_catalog
selection: "np.isin(injection_catalog['visit'], {visit})"
injectedMatch:
class: lsst.ap.pipe.matchSourceInjected.MatchPVIInjectedTask
Copy link
Contributor

Choose a reason for hiding this comment

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

Trying to build this pipeline for me fails with:

ImportError: Could not get attribute 'MatchPVIInjectedTask' from 'lsst.ap.pipe.matchSourceInjected' when importing 'lsst.ap.pipe.matchSourceInjected.MatchPVIInjectedTask
' (No module named 'lsst.ap.pipe.matchSourceInjected.MatchPVIInjectedTask'; 'lsst.ap.pipe.matchSourceInjected' is not a package)

Should this be MatchInitialPVIInjectedTask instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps not, as making that switch returns:

AttributeError: lsst.pipe.base.config.MatchInitialPVIInjectedConfigConnections has no attribute injectedPVICat

I'm on main in drp_pipe and ap_pipe - do I need to set up something else?

Copy link
Member Author

Choose a reason for hiding this comment

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

I made a mistake, and I was using a branch class from ap_pipe. I think I can update this to use the current main function, as a replacement matching task is still in flux.

Copy link
Member Author

Choose a reason for hiding this comment

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

It should be fixed on new version.

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