Skip to content

Commit 0603e36

Browse files
committed
Find bcg tract and patch automatically
1 parent b0befe8 commit 0603e36

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

DP1/100_How_to_Use_RSP_Tools/103_Image_access_and_display/103_6_Color_Composite_Image.ipynb

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"Data Release: <a href=\"https://dp1.lsst.io\">Data Preview 1</a> <br>\n",
2323
"Container Size: large <br>\n",
2424
"LSST Science Pipelines version: r29.2.0 <br>\n",
25-
"Last verified to run: 2025-09-19 <br>\n",
25+
"Last verified to run: 2025-10-15 <br>\n",
2626
"Repository: <a href=\"https://github.com/lsst/tutorial-notebooks\">github.com/lsst/tutorial-notebooks</a> <br>"
2727
]
2828
},
@@ -816,42 +816,47 @@
816816
"metadata": {},
817817
"source": [
818818
"Use the BCG location to obtain the pixel scale.\n",
819-
"Get the WCS of the patch and tract where the BCG is located.\n",
820-
"From the 300 DP1 tutorials, the patch and tract numbers are 10463 and 62, respectively,"
819+
"First, get the WCS of the patch and tract where the BCG is located."
821820
]
822821
},
823822
{
824823
"cell_type": "code",
825824
"execution_count": null,
826-
"id": "8ccd5259-ffb1-45a9-bfc8-79c110301c48",
825+
"id": "d92642e2-e943-4fb5-a9bb-a8eb138862e6",
827826
"metadata": {},
828827
"outputs": [],
829828
"source": [
830-
"bcg_data_ref = next(\n",
831-
" ref for ref in tract_container\n",
832-
" if ref.dataId[\"tract\"] == 10463 and ref.dataId[\"patch\"] == 62\n",
833-
")"
829+
"bcg_point = SpherePoint(ra_bcg * degrees,\n",
830+
" dec_bcg * degrees)\n",
831+
"bcg_tract = skymap.findTract(bcg_point)\n",
832+
"bcg_patch = bcg_tract.findPatch(bcg_point)\n",
833+
"\n",
834+
"bcg_tract_number = bcg_tract.tract_id\n",
835+
"bcg_patch_number = bcg_patch.getSequentialIndex()\n",
836+
"print(bcg_tract_number, bcg_patch_number)"
834837
]
835838
},
836839
{
837840
"cell_type": "code",
838841
"execution_count": null,
839-
"id": "85859dbc-faf0-4fa4-a5f6-7a6974fd2b46",
842+
"id": "8ccd5259-ffb1-45a9-bfc8-79c110301c48",
840843
"metadata": {},
841844
"outputs": [],
842845
"source": [
843-
"wcs_bcg = butler.get(bcg_data_ref.makeComponentRef('wcs'))"
846+
"bcg_data_ref = next(\n",
847+
" ref for ref in tract_container\n",
848+
" if ref.dataId[\"tract\"] == bcg_tract_number and ref.dataId[\"patch\"] == bcg_patch_number\n",
849+
")"
844850
]
845851
},
846852
{
847853
"cell_type": "code",
848854
"execution_count": null,
849-
"id": "133c1d9d-073b-42e3-8a2f-b782f8a9e691",
855+
"id": "85859dbc-faf0-4fa4-a5f6-7a6974fd2b46",
850856
"metadata": {},
851857
"outputs": [],
852858
"source": [
853-
"bcg_point = SpherePoint(ra_bcg * degrees,\n",
854-
" dec_bcg * degrees)"
859+
"wcs_bcg = butler.get(bcg_data_ref.makeComponentRef('wcs'))"
855860
]
856861
},
857862
{
@@ -897,7 +902,7 @@
897902
"id": "27dbdb21-0f1a-4c32-94d7-c79f174e7ad5",
898903
"metadata": {},
899904
"source": [
900-
"Set the WCS projection. The WCS of deep_coadd images are TAN projections ([see the DP1 documentation](https://dp1.lsst.io/products/images/deep_coadd.html#wcs))."
905+
"Set the WCS projection. The WCS of `deep_coadd` images are TAN projections ([see the DP1 documentation](https://dp1.lsst.io/products/images/deep_coadd.html#wcs))."
901906
]
902907
},
903908
{

0 commit comments

Comments
 (0)