Skip to content

Commit bf797f1

Browse files
made minor changes
1 parent ba8461a commit bf797f1

1 file changed

Lines changed: 40 additions & 34 deletions

File tree

DP1/200_Data_Products/206_Deblender_Products/206_2_Deblender_footprints.ipynb

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,14 @@
9898
"from lsst.daf.butler import Butler\n",
9999
"from lsst.rsp import get_tap_service\n",
100100
"import lsst.geom as geom\n",
101+
"\n",
101102
"import lsst.afw.display as afwDisplay\n",
102103
"from lsst.afw.image import MultibandExposure\n",
104+
"import lsst.meas.extensions.scarlet as mes\n",
103105
"\n",
106+
"import lsst.scarlet as scarlet\n",
104107
"import lsst.scarlet.lite as sl\n",
105-
"import lsst.meas.extensions.scarlet as mes"
108+
"from lsst.scarlet.lite import Box, Blend, Observation"
106109
]
107110
},
108111
{
@@ -113,6 +116,40 @@
113116
"### 1.2. Define parameters and functions\n"
114117
]
115118
},
119+
{
120+
"cell_type": "code",
121+
"execution_count": null,
122+
"id": "dbda1096-cf1c-433f-ae5c-1ad761683f09",
123+
"metadata": {},
124+
"outputs": [],
125+
"source": [
126+
"def minimal_data_to_blend(cls, model_psf: np.ndarray, dtype: np.typing.DTypeLike) -> Blend:\n",
127+
"\n",
128+
" \"\"\"Convert the storage data model into a scarlet lite blend\n",
129+
"\n",
130+
" Parameters\n",
131+
" ----------\n",
132+
" model_psf:\n",
133+
" PSF in model space (usually a nyquist sampled circular Gaussian).\n",
134+
" dtype:\n",
135+
" The data type of the model that is generated.\n",
136+
"\n",
137+
" Returns\n",
138+
" -------\n",
139+
" blend:\n",
140+
" A scarlet blend model extracted from persisted data.\n",
141+
" \"\"\"\n",
142+
" model_box = Box(cls.shape, origin=cls.origin)\n",
143+
" observation = Observation.empty(\n",
144+
" bands=cls.bands,\n",
145+
" psfs=cls.psf,\n",
146+
" model_psf=model_psf,\n",
147+
" bbox=model_box,\n",
148+
" dtype=dtype,\n",
149+
" )\n",
150+
" return cls.to_blend(observation)"
151+
]
152+
},
116153
{
117154
"cell_type": "markdown",
118155
"id": "a527bd20-372c-478a-98c4-9c0b0b9f876e",
@@ -509,7 +546,7 @@
509546
"source": [
510547
"### 3.2 Convert to a usable blend instance\n",
511548
"\n",
512-
"First, define a monkey patch that temporarily updates the `minimal_data_to_blend` LSST pipeline class in order to fix an issue with DP1 (temporarily while running this notebook). Once the fix enters the pipeline version in use, the following cell defining the monkey patch can simply be deleted without additional alteration to the notebook. The following cells will use this monkey patch version to load the blend.\n"
549+
"Section 1.2 defined a function with a temporary fix that updates the `minimal_data_to_blend` LSST pipeline class in order to fix an issue with DP1 (temporarily while running this notebook). Once the fix enters the pipeline version in use, the following cell defining the temporary fix (and the function from Section 1.2) can simply be deleted without additional alteration to the notebook. The following cells will use this temporary fixed version to load the blend."
513550
]
514551
},
515552
{
@@ -519,37 +556,6 @@
519556
"metadata": {},
520557
"outputs": [],
521558
"source": [
522-
"from numpy.typing import DTypeLike\n",
523-
"from lsst.scarlet.lite import Box, Blend, Observation\n",
524-
"\n",
525-
"def minimal_data_to_blend(cls, model_psf: np.ndarray, dtype: DTypeLike) -> Blend:\n",
526-
"\n",
527-
" \"\"\"Convert the storage data model into a scarlet lite blend\n",
528-
"\n",
529-
" Parameters\n",
530-
" ----------\n",
531-
" model_psf:\n",
532-
" PSF in model space (usually a nyquist sampled circular Gaussian).\n",
533-
" dtype:\n",
534-
" The data type of the model that is generated.\n",
535-
"\n",
536-
" Returns\n",
537-
" -------\n",
538-
" blend:\n",
539-
" A scarlet blend model extracted from persisted data.\n",
540-
" \"\"\"\n",
541-
" model_box = Box(cls.shape, origin=cls.origin)\n",
542-
" observation = Observation.empty(\n",
543-
" bands=cls.bands,\n",
544-
" psfs=cls.psf,\n",
545-
" model_psf=model_psf,\n",
546-
" bbox=model_box,\n",
547-
" dtype=dtype,\n",
548-
" )\n",
549-
" return cls.to_blend(observation)\n",
550-
"\n",
551-
"\n",
552-
"import lsst.scarlet as scarlet\n",
553559
"scarlet.lite.io.ScarletBlendData.minimal_data_to_blend = minimal_data_to_blend"
554560
]
555561
},
@@ -558,7 +564,7 @@
558564
"id": "0a8baf45-b282-467c-ae7e-62cfb2241c4b",
559565
"metadata": {},
560566
"source": [
561-
"Now recreate the blend model using the monkey patch."
567+
"Now recreate the blend model using the temporary fix function."
562568
]
563569
},
564570
{

0 commit comments

Comments
 (0)