@@ -45,7 +45,7 @@ The photometry of every source is processed through a photometric redshift fitti
4545
4646``` {code-cell} ipython3
4747# Uncomment the next line to install dependencies if needed.
48- # !pip install requests matplotlib pandas astropy pyvo fsspec firefly_client
48+ # !pip install requests matplotlib pandas astropy>5.2 pyvo fsspec firefly_client
4949```
5050
5151``` {code-cell} ipython3
@@ -69,8 +69,6 @@ from firefly_client import FireflyClient
6969import pyvo as vo
7070```
7171
72- +++
73-
7472## 1. Find the MER Tile ID that corresponds to a given RA and Dec
7573
7674In this case, choose random coordinates to show a different MER mosaic image. Search a radius around these coordinates.
@@ -215,10 +213,7 @@ df_g_irsa.head()
215213
216214## 3. Read in the MER image from IRSA directly
217215
218-
219- ``` {code-cell} ipython3
220- print(filename)
221- ```
216+ +++
222217
223218Download the MER image -- note this file is about 1.46 GB
224219
@@ -230,6 +225,12 @@ head_mer_irsa = hdu_mer_irsa[0].header
230225print(hdu_mer_irsa.info())
231226```
232227
228+ Extract just the primary image
229+
230+ ``` {code-cell} ipython3
231+ im_mer_irsa=hdu_mer_irsa[0].data
232+ ```
233+
233234``` {tip}
234235Now you've downloaded this large file, if you would like to save it to disk, uncomment the following cell
235236```
@@ -241,10 +242,6 @@ Now you've downloaded this large file, if you would like to save it to disk, unc
241242
242243## 4. Overplot the catalog on the MER mosaic image
243244
244- ``` {code-cell} ipython3
245- df_g_irsa.head()
246- ```
247-
248245``` {code-cell} ipython3
249246## Use the WCS package to extract the coordinates from the header of the image
250247wcs_irsa=WCS(head_mer_irsa) # VIS
@@ -260,14 +257,39 @@ df_g_irsa['x_pix']=xy_irsa[0]
260257df_g_irsa['y_pix']=xy_irsa[1]
261258```
262259
260+ Due to the large field of view of the MER mosaic, let's cut out a smaller section (30'x30')of the MER mosaic to inspect the image
261+
263262``` {code-cell} ipython3
264- df_g_irsa
263+ cutout_x0=7200
264+ cutout_x1=9000
265+ cutout_y0=7200
266+ cutout_y1=9000
267+
268+ im_cutout=im_mer_irsa[cutout_x0:cutout_x1, cutout_y0:cutout_y1]
269+
270+ # Filter galaxy positions within the cutout region
271+ cutout_mask = (df_g_irsa['x_pix'] >= cutout_x0) & (df_g_irsa['x_pix'] < cutout_x1) & \
272+ (df_g_irsa['y_pix'] >= cutout_y0) & (df_g_irsa['y_pix'] < cutout_y1)
273+
274+ x_cutout = df_g_irsa['x_pix'][cutout_mask] - cutout_x0 # Shift to cutout frame
275+ y_cutout = df_g_irsa['y_pix'][cutout_mask] - cutout_y0
276+ ```
277+
278+ Plot MER catalog sources on the Euclid VIS image 30'x30' cutout
279+
280+ ``` {code-cell} ipython3
281+ plt.imshow(im_cutout, cmap='gray', origin='lower', norm=ImageNormalize(im_cutout, interval=PercentileInterval(99.9), stretch=LogStretch()))
282+ colorbar = plt.colorbar()
283+ plt.scatter(x_cutout, y_cutout, s=36, facecolors='none', edgecolors='red')
284+
285+ plt.title('Galaxies between z = 1.4 and 1.6')
286+ plt.show()
265287```
266288
267289Pull the spectra on the top brightest source based on object ID
268290
269291``` {code-cell} ipython3
270- df_g_irsa_sort=df_g_irsa.sort_values(by='flux_vis_unif ',ascending=False)
292+ df_g_irsa_sort=df_g_irsa[cutout_mask] .sort_values(by='flux_h_unif ',ascending=False)
271293```
272294
273295``` {code-cell} ipython3
@@ -276,12 +298,12 @@ df_g_irsa_sort[0:3]
276298
277299``` {code-cell} ipython3
278300obj_id=df_g_irsa_sort['object_id'].iloc[1]
301+ redshift = df_g_irsa_sort['phz_median'].iloc[1]
279302
280303## Pull the data on these objects
281304adql_object = f"SELECT * \
282305FROM {table_1dspectra} \
283- WHERE objectid = {obj_id} \
284- AND uri IS NOT NULL "
306+ WHERE objectid = {obj_id}"
285307
286308## Pull the data on this particular galaxy
287309result2 = service.search(adql_object)
@@ -308,16 +330,18 @@ with fits.open(BytesIO(response.content), memmap=True) as hdul:
308330 df_obj_irsa = dat.to_pandas()
309331```
310332
311- ``` {code-cell} ipython3
333+ ### Now the data are read in, plot the spectrum
312334
313- ## Now the data are read in, show an image
335+ Divide by 10000 to convert from Angstrom to micron
314336
315- plt.plot(df_obj_irsa['WAVELENGTH'], df_obj_irsa['SIGNAL'])
337+ ``` {code-cell} ipython3
338+ plt.plot(df_obj_irsa['WAVELENGTH']/10000., df_obj_irsa['SIGNAL'])
316339
317- plt.xlabel('Wavelength ($\AA$)')
318- plt.ylabel('Flux (erg / (Angstrom s cm2))')
319- # plt.ylim(10,50)
320- plt.title('Object ID is '+str(obj_id))
340+ plt.xlabel('Wavelength (microns)')
341+ plt.ylabel('Flux (erg / (s cm2))')
342+ plt.xlim(1.25, 1.85)
343+ plt.ylim(-0.5,0.5)
344+ plt.title('Object ID is '+str(obj_id)+'with phz_median='+str(redshift))
321345```
322346
323347Let's cut out a very small patch of the MER image to see what this galaxy looks like
@@ -406,8 +430,8 @@ fc.show_table(uploaded_table)
406430
407431## About this Notebook
408432
409- ** Author** : Tiffany Meshkat (IPAC Scientist)
433+ ** Author** : Tiffany Meshkat, Anahita Alavi, Anastasia Laity, Andreas Faisst, Brigitta Sipőcz, Dan Masters, Harry Teplitz, Jaladh Singhal, Shoubaneh Hemmati.
410434
411- ** Updated** : 2025-03-19
435+ ** Updated** : 2025-03-26
412436
413437** Contact:** [ the IRSA Helpdesk] ( https://irsa.ipac.caltech.edu/docs/help_desk.html ) with questions or reporting problems.
0 commit comments