-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Guide to generate image cutouts with DRP outputs
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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) |