Skip to content

Commit dc331ce

Browse files
committed
Guide to generate image cutouts with DRP outputs
1 parent 6ae4ba4 commit dc331ce

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.. _generating-image-cutouts-with-drp-outputs:
2+
3+
#########################################
4+
Generating image cutouts with DRP outputs
5+
#########################################
6+
7+
To generate image cutouts using the `plotImageSubtractionCutouts` task from `analysis_ap` you need to use the
8+
code listed below.
9+
10+
Note, the code differs from its general implementation when using DRP outputs, since you
11+
are required to iterate through each of the references individually, retrieve the diaSources (using the
12+
`goodSeeingDiff_diaSrcTable` not `goodSeeingDiff_diaSrc` to have data in the correct format for this task).
13+
14+
.. code-block:: text
15+
16+
repo = /repo/main
17+
collections = /path/to/your/DRP/collection
18+
butler = dafButler.Butler(repo, collections=collections)
19+
20+
cutoutConfigDrp = PlotImageSubtractionCutoutsConfig()
21+
cutoutTaskDrp = PlotImageSubtractionCutoutsTask(
22+
config=cutoutConfigDrp, output_path=output
23+
)
24+
25+
data_refs = butler.query_datasets(
26+
"goodSeeingDiff_diaSrcTable", where=where, limit=limit
27+
)
28+
29+
for ref in data_refs:
30+
try:
31+
dv_diaSourceTable = butler.get(ref)
32+
except:
33+
print(f"Could not load diaSource table for {ref.dataId}")
34+
continue
35+
else:
36+
dv_diaSourceTable["instrument"] = "LSSTComCam"
37+
cutoutTaskDrp.run(dv_diaSourceTable, butler)

0 commit comments

Comments
 (0)