@@ -237,58 +237,58 @@ science_images['filters'][science_images['filters']== 'VIS_VIS'] = "VIS"
237237science_images['filters']
238238```
239239
240- ## The image above is very large, so let's cut out a smaller image to inspect these data.
240+ ## 4. Define cutout parameters for a smaller region of interest
241241
242242``` {code-cell} ipython3
243243######################## User defined section ############################
244- ## How large do you want the image cutout to be?
244+ # Set the image cutout size
245245im_cutout = 1.0 * u.arcmin
246246
247- ## What is the center of the cutout?
248- ## For now choosing a random location on the image
249- ## because the star itself is saturated
247+ # Set the cutout center coordinates
248+ # For now choose a random location on the image
249+ # because the star itself is saturated
250250ra = 273.8667
251251dec = 64.525
252252
253- ## Bright star position
253+ # Bright star position
254254# ra = 273.474451
255255# dec = 64.397273
256256
257257coords_cutout = SkyCoord(ra, dec, unit='deg', frame='icrs')
258258
259259##########################################################################
260260
261- ## Iterate through each filter
261+ # Iterate through each filter
262262
263263cutout_list = []
264264
265265for url in urls:
266- ## Use fsspec to interact with the fits file without downloading the full file
266+ # Use fsspec to interact with the fits file without downloading the full file
267267 hdu = fits.open(url, use_fsspec=True)
268268 print(f"Opened {url}")
269269
270- ## Store the header
270+ # Store the header
271271 header = hdu[0].header
272272
273- ## Read in the cutout of the image that you want
273+ # Read in the cutout of the image that you want
274274 cutout_data = Cutout2D(hdu[0].section, position=coords_cutout, size=im_cutout, wcs=WCS(hdu[0].header))
275275
276- ## Close the file
276+ # Close the file
277277 # hdu.close()
278278
279- ## Define a new fits file based on this smaller cutout, with accurate WCS based on the cutout size
279+ # Define a new fits file based on this smaller cutout, with accurate WCS based on the cutout size
280280 new_hdu = fits.PrimaryHDU(data=cutout_data.data, header=header)
281281 new_hdu.header.update(cutout_data.wcs.to_header())
282282
283- ## Append the cutout to the list
283+ # Append the cutout to the list
284284 cutout_list.append(new_hdu)
285285
286- ## Combine all cutouts into a single HDUList and display information
286+ # Combine all cutouts into a single HDUList and display information
287287final_hdulist = fits.HDUList(cutout_list)
288288final_hdulist.info()
289289```
290290
291- ## 3 . Visualize multiwavelength Euclid Q1 MER cutouts
291+ ## 5 . Visualize multiwavelength Euclid Q1 MER cutouts
292292
293293We need to determine the number of images for the grid layout, and then plot each cutout.
294294
@@ -308,15 +308,15 @@ for idx, (ax, filt) in enumerate(zip(axes, science_images['filters'])):
308308 ax.set_ylabel('Dec')
309309 ax.text(0.05, 0.05, filt, color='white', fontsize=14, transform=ax.transAxes, va='bottom', ha='left')
310310
311- ## Remove empty subplots if any
311+ # Remove empty subplots if any
312312for ax in axes[num_images:]:
313313 fig.delaxes(ax)
314314
315315plt.tight_layout()
316316plt.show()
317317```
318318
319- ## 4. Use the Python package sep to identify and measure sources in the Euclid Q1 MER cutouts
319+ ## 6. Identify and measure sources in Euclid Q1 MER cutouts with sep
320320
321321First we list all the filters so you can choose which cutout you want to extract sources on. We will choose VIS.
322322
@@ -365,13 +365,13 @@ data_sub = img2 - bkg
365365``` {code-cell} ipython3
366366######################## User defined section ############################
367367
368- ## Sigma threshold to consider this a detection above the global RMS
368+ # Sigma threshold to consider this a detection above the global RMS
369369threshold= 3
370370
371- ## Minimum number of pixels required for an object. Default is 5.
371+ # Minimum number of pixels required for an object. Default is 5.
372372minarea_0=2
373373
374- ## Minimum contrast ratio used for object deblending. Default is 0.005. To entirely disable deblending, set to 1.0.
374+ # Minimum contrast ratio used for object deblending. Default is 0.005. To entirely disable deblending, set to 1.0.
375375deblend_cont_0= 0.005
376376
377377flux_threshold= 0.01
@@ -383,7 +383,7 @@ sources_thr = sources[sources['flux'] > flux_threshold]
383383print("Found", len(sources_thr), "objects above flux threshold")
384384```
385385
386- ## Lets have a look at the objects that were detected with sep in the cutout
386+ ## 7. Review detected sources on the VIS cutout
387387
388388
389389We plot the VIS cutout with the sources detected overplotted with a red ellipse
@@ -393,7 +393,7 @@ fig, ax = plt.subplots()
393393m, s = np.mean(data_sub), np.std(data_sub)
394394im = ax.imshow(data_sub, cmap='gray', origin='lower', norm=ImageNormalize(img2, interval=ZScaleInterval(), stretch=SquaredStretch()))
395395
396- ## Plot an ellipse for each object detected with sep
396+ # Plot an ellipse for each object detected with sep
397397
398398for i in range(len(sources_thr)):
399399 e = Ellipse(xy=(sources_thr['x'][i], sources_thr['y'][i]),
0 commit comments