Skip to content

Commit 17223b2

Browse files
committed
Refine Euclid heading cleanup and revert SIA tutorial edits
1 parent 4c28be5 commit 17223b2

10 files changed

Lines changed: 77 additions & 77 deletions

tutorials/euclid/1_Euclid_intro_MER_images.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -226,58 +226,58 @@ science_images['filters'][science_images['filters']== 'VIS_VIS'] = "VIS"
226226
science_images['filters']
227227
```
228228

229-
## The image above is very large, so let's cut out a smaller image to inspect these data.
229+
## 4. Define cutout parameters for a smaller region of interest
230230

231231
```{code-cell} ipython3
232232
######################## User defined section ############################
233-
## How large do you want the image cutout to be?
233+
# Set the image cutout size
234234
im_cutout = 1.0 * u.arcmin
235235
236-
## What is the center of the cutout?
237-
## For now choosing a random location on the image
238-
## because the star itself is saturated
236+
# Set the cutout center coordinates
237+
# For now choose a random location on the image
238+
# because the star itself is saturated
239239
ra = 273.8667
240240
dec = 64.525
241241
242-
## Bright star position
242+
# Bright star position
243243
# ra = 273.474451
244244
# dec = 64.397273
245245
246246
coords_cutout = SkyCoord(ra, dec, unit='deg', frame='icrs')
247247
248248
##########################################################################
249249
250-
## Iterate through each filter
250+
# Iterate through each filter
251251
252252
cutout_list = []
253253
254254
for url in urls:
255-
## Use fsspec to interact with the fits file without downloading the full file
255+
# Use fsspec to interact with the fits file without downloading the full file
256256
hdu = fits.open(url, use_fsspec=True)
257257
print(f"Opened {url}")
258258
259-
## Store the header
259+
# Store the header
260260
header = hdu[0].header
261261
262-
## Read in the cutout of the image that you want
262+
# Read in the cutout of the image that you want
263263
cutout_data = Cutout2D(hdu[0].section, position=coords_cutout, size=im_cutout, wcs=WCS(hdu[0].header))
264264
265-
## Close the file
265+
# Close the file
266266
# hdu.close()
267267
268-
## Define a new fits file based on this smaller cutout, with accurate WCS based on the cutout size
268+
# Define a new fits file based on this smaller cutout, with accurate WCS based on the cutout size
269269
new_hdu = fits.PrimaryHDU(data=cutout_data.data, header=header)
270270
new_hdu.header.update(cutout_data.wcs.to_header())
271271
272-
## Append the cutout to the list
272+
# Append the cutout to the list
273273
cutout_list.append(new_hdu)
274274
275-
## Combine all cutouts into a single HDUList and display information
275+
# Combine all cutouts into a single HDUList and display information
276276
final_hdulist = fits.HDUList(cutout_list)
277277
final_hdulist.info()
278278
```
279279

280-
## 3. Visualize multiwavelength Euclid Q1 MER cutouts
280+
## 5. Visualize multiwavelength Euclid Q1 MER cutouts
281281

282282
We need to determine the number of images for the grid layout, and then plot each cutout.
283283

@@ -297,15 +297,15 @@ for idx, (ax, filt) in enumerate(zip(axes, science_images['filters'])):
297297
ax.set_ylabel('Dec')
298298
ax.text(0.05, 0.05, filt, color='white', fontsize=14, transform=ax.transAxes, va='bottom', ha='left')
299299
300-
## Remove empty subplots if any
300+
# Remove empty subplots if any
301301
for ax in axes[num_images:]:
302302
fig.delaxes(ax)
303303
304304
plt.tight_layout()
305305
plt.show()
306306
```
307307

308-
## 4. Use the Python package sep to identify and measure sources in the Euclid Q1 MER cutouts
308+
## 6. Identify and measure sources in Euclid Q1 MER cutouts with sep
309309

310310
First we list all the filters so you can choose which cutout you want to extract sources on. We will choose VIS.
311311

@@ -354,13 +354,13 @@ data_sub = img2 - bkg
354354
```{code-cell} ipython3
355355
######################## User defined section ############################
356356
357-
## Sigma threshold to consider this a detection above the global RMS
357+
# Sigma threshold to consider this a detection above the global RMS
358358
threshold= 3
359359
360-
## Minimum number of pixels required for an object. Default is 5.
360+
# Minimum number of pixels required for an object. Default is 5.
361361
minarea_0=2
362362
363-
## Minimum contrast ratio used for object deblending. Default is 0.005. To entirely disable deblending, set to 1.0.
363+
# Minimum contrast ratio used for object deblending. Default is 0.005. To entirely disable deblending, set to 1.0.
364364
deblend_cont_0= 0.005
365365
366366
flux_threshold= 0.01
@@ -372,7 +372,7 @@ sources_thr = sources[sources['flux'] > flux_threshold]
372372
print("Found", len(sources_thr), "objects above flux threshold")
373373
```
374374

375-
## Lets have a look at the objects that were detected with sep in the cutout
375+
## 7. Review detected sources on the VIS cutout
376376

377377

378378
We plot the VIS cutout with the sources detected overplotted with a red ellipse
@@ -382,7 +382,7 @@ fig, ax = plt.subplots()
382382
m, s = np.mean(data_sub), np.std(data_sub)
383383
im = ax.imshow(data_sub, cmap='gray', origin='lower', norm=ImageNormalize(img2, interval=ZScaleInterval(), stretch=SquaredStretch()))
384384
385-
## Plot an ellipse for each object detected with sep
385+
# Plot an ellipse for each object detected with sep
386386
387387
for i in range(len(sources_thr)):
388388
e = Ellipse(xy=(sources_thr['x'][i], sources_thr['y'][i]),

tutorials/euclid/4_Euclid_intro_PHZ_catalog.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ Search based on ``tileID``:
186186

187187
```{code-cell} ipython3
188188
######################## User defined section ############################
189-
## How large do you want the image cutout to be?
189+
# Set the image cutout size
190190
im_cutout= 5 * u.arcmin
191191
192-
## What is the center of the cutout?
192+
# Set the center of the cutout
193193
ra_cutout = 267.8
194194
dec_cutout = 66
195195
@@ -215,7 +215,7 @@ adql = ("SELECT DISTINCT mer.object_id, mer.ra, mer.dec, "
215215
"AND phz.phz_median BETWEEN 1.4 AND 1.6")
216216
217217
218-
## Use TAP with this ADQL string
218+
# Use TAP with this ADQL string
219219
result_galaxies = Irsa.query_tap(adql).to_table()
220220
result_galaxies[:5]
221221
```
@@ -235,13 +235,13 @@ Once the bug is fixed, we plan to update the code in this notebook and simplify
235235
Due to the large field of view of the MER mosaic, let's cut out a smaller section (5'x5') of the MER mosaic to inspect the image.
236236

237237
```{code-cell} ipython3
238-
## Use fsspec to interact with the fits file without downloading the full file
238+
# Use fsspec to interact with the fits file without downloading the full file
239239
hdu = fits.open(filename, use_fsspec=True)
240240
241-
## Store the header
241+
# Store the header
242242
header = hdu[0].header
243243
244-
## Read in the cutout of the image that you want
244+
# Read in the cutout of the image that you want
245245
cutout_image = Cutout2D(hdu[0].section, position=coords_cutout, size=im_cutout, wcs=WCS(header))
246246
```
247247

@@ -275,7 +275,7 @@ plt.scatter(result_galaxies['ra'], result_galaxies['dec'], s=36, facecolors='non
275275
_ = plt.title('Galaxies between z = 1.4 and 1.6')
276276
```
277277

278-
## 5. Pull the spectra on the top brightest source based on object ID
278+
## 5. Pull spectra for one of the brightest sources by object ID
279279

280280
```{code-cell} ipython3
281281
result_galaxies.sort(keys='flux_h_unif', reverse=True)
@@ -299,7 +299,7 @@ We will use TAP and an ASQL query to find the spectral data for this particular
299299
```{code-cell} ipython3
300300
adql_object = f"SELECT * FROM {table_1dspectra} WHERE objectid = {obj_id}"
301301
302-
## Pull the data on this particular galaxy
302+
# Pull the data on this particular galaxy
303303
result_spectra = Irsa.query_tap(adql_object).to_table()
304304
result_spectra
305305
```
@@ -340,7 +340,7 @@ result_galaxies[index]
340340
```
341341

342342
```{code-cell} ipython3
343-
## How large do you want the image cutout to be?
343+
# Set the image cutout size for the selected galaxy
344344
size_galaxy_cutout = 2.0 * u.arcsec
345345
```
346346

@@ -369,7 +369,7 @@ ax.imshow(cutout_galaxy.data, cmap='gray', origin='lower',
369369
norm=ImageNormalize(cutout_galaxy.data, interval=PercentileInterval(99.9), stretch=AsinhStretch()))
370370
```
371371

372-
## 6. Load the image on Firefly to be able to interact with the data directly
372+
## 6. Load the image in Firefly for interactive exploration
373373

374374
+++
375375

tutorials/euclid/5_Euclid_intro_SPE_catalog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ Irsa.list_columns(catalog=table_1dspectra, full=True)
172172
columns_info
173173
```
174174

175-
## Find some objects with spectra in our tileID
175+
## 3. Find some objects with spectra in our tileID
176176

177177
We specify the following conditions on our search:
178178
- Signal to noise ratio column (_gf = gaussian fit) should be greater than 5

tutorials/euclid/Euclid_ERO.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ import matplotlib as mpl
9797
Next, we define some parameters for `Matplotlib` plotting.
9898

9999
```{code-cell} ipython3
100-
## Plotting stuff
100+
## 1. Plotting stuff
101101
mpl.rcParams['font.size'] = 14
102102
mpl.rcParams['axes.labelpad'] = 7
103103
mpl.rcParams['xtick.major.pad'] = 7
@@ -123,7 +123,7 @@ mpl.rcParams['hatch.linewidth'] = 1
123123
def_cols = plt.rcParams['axes.prop_cycle'].by_key()['color']
124124
```
125125

126-
## Setting up the Environment
126+
## 2. Setting up the Environment
127127

128128
Next, we set up the environment. This includes
129129
* setting up an output data directory (will be created if it does not exist)
@@ -148,7 +148,7 @@ cutout_size = 1.5 * u.arcmin # cutout size
148148
coord = SkyCoord.from_name('NGC 6397')
149149
```
150150

151-
## Search Euclid ERO Images
151+
## 3. Search Euclid ERO Images
152152

153153
Now, we search for the Euclid ERO images using the `astroquery` package.
154154
Note that the Euclid ERO images are no in the cloud currently, but we access them directly from IRSA using IRSA's *Simple Image Access* (SIA) methods.
@@ -227,7 +227,7 @@ Let's check out the summary table that we have created. We see that we have all
227227
summary_table
228228
```
229229

230-
## Create Cutout Images
230+
## 4. Create Cutout Images
231231

232232
Now that we have a list of data products, we can create the cutouts. This is important as the full Euclid ERO images would be too large to run extraction and photometry software on them (they would simply fail due to memory issues).
233233

@@ -265,7 +265,7 @@ for ii,filt in tqdm(enumerate(filters)):
265265
hdu.header["FILTER"] = filt.upper()
266266
hdulcutout.append(hdu)
267267
268-
## Save the HDUL cube:
268+
## 5. Save the HDUL cube:
269269
hdulcutout.writeto("./data/euclid_images_test.fits", overwrite=True)
270270
```
271271

@@ -294,7 +294,7 @@ for ii,filt in enumerate(filters):
294294
plt.show()
295295
```
296296

297-
## Extract Sources and Measure their Photometry on the VIS Image
297+
## 6. Extract Sources and Measure their Photometry on the VIS Image
298298

299299
Now that we have the images in memory (and on disk - but we do not need them, yet), we can measure the fluxes of the individual stars.
300300
Our simple photometry pipeline has different parts:
@@ -308,7 +308,7 @@ Our simple photometry pipeline has different parts:
308308
We start by extracting the sources using `sep`. We first isolate the data that we want to look at (the VIS image only).
309309

310310
```{code-cell} ipython3
311-
## Get Data (this will be replaced later)
311+
## 7. Get Data (this will be replaced later)
312312
img = hdulcutout["VIS_SCIENCE"].data
313313
hdr = hdulcutout["VIS_SCIENCE"].header
314314
img[img == 0] = np.nan
@@ -378,7 +378,7 @@ resimage = psfphot.make_residual_image(data = img-median, psf_shape = (9, 9))
378378
We now want to add the best-fit coordinates (R.A. and Decl.) to the VIS photometry catalog. For this, we have to convert the image coordinates into sky coordinates using the WCS information. We will need these coordinates because we want to use them as positional priors for the photometry measurement on the NISP images.
379379

380380
```{code-cell} ipython3
381-
## Add coordinates to catalog
381+
## 8. Add coordinates to catalog
382382
wcs1 = WCS(hdr) # VIS
383383
radec = wcs1.all_pix2world(phot["x_fit"],phot["y_fit"],0)
384384
phot["ra_fit"] = radec[0]
@@ -424,7 +424,7 @@ ax1.set_yscale('log')
424424
plt.show()
425425
```
426426

427-
## Measure the Photometry on the NISP Images
427+
## 9. Measure the Photometry on the NISP Images
428428

429429
We now have the photometry and the position of sources on the VIS image. We can now proceed with similar steps on the NISP images. Because the NISP PSF and pixel scale are larger that those of the VIS images, we utilize the advantage of position prior-based forced photometry.
430430
For this, we use the positions of the VIS measurements and perform PSF fitting on the NISP image using these priors.
@@ -508,7 +508,7 @@ ax2.plot(phot2["x_fit"], phot2["y_fit"] , "o", markersize=8 , markeredgecolor="r
508508
plt.show()
509509
```
510510

511-
## Load Gaia Catalog
511+
## 10. Load Gaia Catalog
512512

513513
We now load the Gaia sources at the location of the globular clusters. The goal is to compare the photometry of Gaia to the one derived above for the Euclid VIS and NISP images. This is scientifically useful, for example we can compute the colors of the stars in the Gaia optical bands and the Euclid near-IR bands.
514514
To search for Gaia sources, we use `astroquery` again.
@@ -563,7 +563,7 @@ ax2.set_title("NISP")
563563
plt.show()
564564
```
565565

566-
## Match the Gaia Catalog to the VIS and NISP Catalogs
566+
## 11. Match the Gaia Catalog to the VIS and NISP Catalogs
567567

568568
Now, we match the Gaia source positions to the extracted sources in the VIS and NISP images.
569569

@@ -628,7 +628,7 @@ ax1.set_ylabel("I$_E$ [mag]")
628628
plt.show()
629629
```
630630

631-
## Visualization with Firefly
631+
## 12. Visualization with Firefly
632632

633633
At the end of this Notebook, we demonstrate how we can visualize the images and catalogs created above in `Firefly`.
634634

tutorials/simulated-data/OpenUniverse2024Preview_Firefly.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ from reproject import reproject_interp
8686
from io import BytesIO
8787
```
8888

89-
## Learn where the OpenUniverse2024 data are hosted in the cloud.
89+
## 1. Learn where the OpenUniverse2024 data are hosted in the cloud.
9090

9191
The OpenUniverse2024 data preview is hosted in the cloud via Amazon Web Services (AWS). To access these data, you need to create a client to read data from Amazon's Simple Storage Service (s3) buckets, and you need to know some information about those buckets. The OpenUniverse2024 data preview contains simulations of the Roman Wide-Area Survey (WAS) and the Roman Time Domain Survey (TDS). In this tutorial, we will focus on the WAS.
9292

@@ -100,7 +100,7 @@ RUBIN_PREFIX = "openuniverse2024/rubin/preview"
100100
RUBIN_COADD_PATH = f"{RUBIN_PREFIX}/u/descdm/preview_data_step3_2877_19_w_2024_12/20240403T150003Z/deepCoadd_calexp/2877/19"
101101
```
102102

103-
## Roman Coadds
103+
## 2. Roman Coadds
104104

105105
The Nancy Grace Roman Space Telescope will carry out a wide-area survey (WAS) in the near infrared. The OpenUniverse2024 data preview includes coadded mosaics of simulated WAS data, created with the IMCOM algorithm (Rowe et al. 2011). Bands include F184, H158, J129, K213, Y106. In this section, we define some functions that make it convenient to retrieve a given cloud-hosted simulated Roman coadd based on position and filter.
106106

@@ -237,7 +237,7 @@ plt.imshow(coadd_roman['data'], origin='lower',
237237
plt.plot(*coord_arr_idx, 'r+', markersize=15)
238238
```
239239

240-
## Rubin Coadds
240+
## 3. Rubin Coadds
241241

242242
The OpenUniverse2024 data preview includes coadded mosaics in the following filters: u, g, r, i, z, y. In this section, we define some functions that make it convenient to retrieve a given cloud-hosted simulated Roman coadd based on position and filter.
243243

@@ -327,7 +327,7 @@ coadd_s3_fpath_rubin = get_rubin_coadd_fpath(filter_rubin)
327327
https_url(coadd_s3_fpath_rubin)
328328
```
329329

330-
## Compare simulated Roman and Rubin cutouts for a selected position
330+
## 4. Compare simulated Roman and Rubin cutouts for a selected position
331331

332332
+++
333333

@@ -366,7 +366,7 @@ fig.suptitle(f"Cutouts at ({coord.ra}, {coord.dec}) with {cutout_size} size", fo
366366
plt.tight_layout(rect=[0, 0, 1, 0.97])
367367
```
368368

369-
## Use Firefly to interactively identify a blended source
369+
## 5. Use Firefly to interactively identify a blended source
370370

371371
Clearly, the simulated Roman coadd has higher spatial resolution than the Rubin simulated coadd. Let's try to locate blended objects to compare in the simulated Rubin and Roman images. We will use Firefly's interactive visualization to make this task easier.
372372

@@ -452,7 +452,7 @@ point_region = f'icrs;point {coords_of_interest.ra.value}d {coords_of_interest.d
452452
fc.add_region_data(region_data=point_region, region_layer_id=roman_regions_id)
453453
```
454454

455-
## Plot cutouts of the identified blended source
455+
## 6. Plot cutouts of the identified blended source
456456

457457
```{code-cell} ipython3
458458
coadd_roman = get_roman_coadd(coords_of_interest, filter_roman)
@@ -501,7 +501,7 @@ plt.tight_layout(rect=[0, 0, 1, 0.97])
501501
# plt.savefig("plot.pdf", bbox_inches='tight', pad_inches=0.2)
502502
```
503503

504-
## Use Firefly to visualize the OpenUniverse2024 data preview catalogs
504+
## 7. Use Firefly to visualize the OpenUniverse2024 data preview catalogs
505505
Let's inspect the properties of sources in the Rubin coadd image. For this we will use the input truth files present in S3 bucket.
506506

507507
The OpenUniverse2024 data preview includes the input truth files that were used to create the simulated images. These files are in Parquet and HDF5 format, and include information about the properties of galaxies, stars, and transients.
@@ -614,7 +614,7 @@ point_region = f'icrs;point {high_z_gal_coords.ra.value}d {high_z_gal_coords.dec
614614
fc.add_region_data(region_data=point_region, region_layer_id=roman_regions_id)
615615
```
616616

617-
## Plot 3-color Roman coadd containing your region of interest
617+
## 8. Plot 3-color Roman coadd containing your region of interest
618618
Let's inspect WCS of Roman coadd first
619619

620620
```{code-cell} ipython3

0 commit comments

Comments
 (0)