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-48619: Guide to generate image cutouts with DRP outputs #713

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions stack/plotImageSubtractionCutouts-with-DRP-outputs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#########################################
Generating image cutouts with DRP outputs
#########################################

To generate image cutouts using the `plotImageSubtractionCutouts` task from `analysis_ap` you need to use the
code listed below.

Note, the code differs from its general implementation when using DRP outputs, since you
are required to iterate through each of the references individually, retrieve the diaSources (using the
`goodSeeingDiff_diaSrcTable` not `goodSeeingDiff_diaSrc` to have data in the correct format for this task).

.. code-block:: text

repo = /repo/main
collections = /path/to/your/DRP/collection
butler = dafButler.Butler(repo, collections=collections)

cutoutConfigDrp = PlotImageSubtractionCutoutsConfig()
cutoutTaskDrp = PlotImageSubtractionCutoutsTask(
config=cutoutConfigDrp, output_path=output
)

data_refs = butler.query_datasets(
"goodSeeingDiff_diaSrcTable", where=where, limit=limit
)

for ref in data_refs:
try:
dv_diaSourceTable = butler.get(ref)
except:
print(f"Could not load diaSource table for {ref.dataId}")
continue
else:
dv_diaSourceTable["instrument"] = "LSSTComCam"
cutoutTaskDrp.run(dv_diaSourceTable, butler)
Loading