@@ -65,7 +65,6 @@ Each MER image is approximately 1.47 GB. Downloading can take some time.
6565import re
6666
6767import numpy as np
68- import pandas as pd
6968
7069import matplotlib.pyplot as plt
7170from matplotlib.patches import Ellipse
@@ -80,9 +79,6 @@ from astropy import units as u
8079
8180from astroquery.ipac.irsa import Irsa
8281import sep
83-
84- # Copy-on-write is more performant and avoids unexpected modifications of the original DataFrame.
85- pd.options.mode.copy_on_write = True
8682```
8783
8884## 1. Search for multiwavelength Euclid Q1 MER mosaics that cover the star HD 168151
@@ -123,20 +119,23 @@ science_images
123119Note that 'access_estsize' is in units of kb
124120
125121``` {code-cell} ipython3
126- filename = science_images[science_images['energy_bandpassname']=='VIS']['access_url'][0]
127- filesize = science_images[science_images['energy_bandpassname']=='VIS']['access_estsize'][0]/1000000
128-
122+ filename = science_images[science_images['energy_bandpassname'] == 'VIS']['access_url'][0]
123+ filesize = science_images[science_images['energy_bandpassname'] == 'VIS']['access_estsize'][0] / 1000000
129124print(filename)
130125
131126print(f'Please note this image is {filesize} GB. With 230 Mbps internet download speed, it takes about 1 minute to download.')
132127```
133128
129+ ``` {code-cell} ipython3
130+ science_images
131+ ```
132+
134133### Extract the tileID of this image from the filename
135134
136135``` {code-cell} ipython3
137- tileID=re.search(r'TILE\s*(\d{9})', filename).group(1)
136+ tileID = science_images[science_images['energy_bandpassname'] == 'VIS']['obs_id'][0][:9]
138137
139- print('The MER tile ID for this object is :', tileID)
138+ print(f 'The MER tile ID for this object is : { tileID}' )
140139```
141140
142141Retrieve the MER image -- note this file is about 1.46 GB
@@ -146,7 +145,7 @@ fname = download_file(filename, cache=True)
146145hdu_mer_irsa = fits.open(fname)
147146print(hdu_mer_irsa.info())
148147
149- head_mer_irsa = hdu_mer_irsa[0].header
148+ header_mer_irsa = hdu_mer_irsa[0].header
150149```
151150
152151If you would like to save the MER mosaic to disk, uncomment the following cell.
@@ -160,21 +159,22 @@ Please also define a suitable download directory; by default it will be `data` a
160159Have a look at the header information for this image.
161160
162161``` {code-cell} ipython3
163- head_mer_irsa
162+ header_mer_irsa
164163```
165164
166165Lets extract just the primary image.
167166
168167``` {code-cell} ipython3
169- im_mer_irsa= hdu_mer_irsa[0].data
168+ im_mer_irsa = hdu_mer_irsa[0].data
170169
171170print(im_mer_irsa.shape)
172171```
173172
174173Due to the large field of view of the MER mosaic, let's cut out a smaller section (2"x2")of the MER mosaic to inspect the image
175174
176175``` {code-cell} ipython3
177- plt.imshow(im_mer_irsa[0:1200,0:1200], cmap='gray', origin='lower', norm=ImageNormalize(im_mer_irsa[0:1200,0:1200], interval=PercentileInterval(99.9), stretch=AsinhStretch()))
176+ plt.imshow(im_mer_irsa[0:1200,0:1200], cmap='gray', origin='lower',
177+ norm=ImageNormalize(im_mer_irsa[0:1200,0:1200], interval=PercentileInterval(99.9), stretch=AsinhStretch()))
178178colorbar = plt.colorbar()
179179```
180180
@@ -203,21 +203,20 @@ urls
203203Create an array with the instrument and filter name so we can add this to the plots.
204204
205205``` {code-cell} ipython3
206- df_im_euclid.loc[:, " filters" ] = df_im_euclid[" instrument_name" ] + "_" + df_im_euclid[" energy_bandpassname" ]
206+ science_images[' filters' ] = science_images[' instrument_name' ] + "_" + science_images[' energy_bandpassname' ]
207207
208- ## Note that VIS_VIS appears in the filters, so update that filter to just say VIS
209- df_im_euclid.loc[df_im_euclid[" filters"] == " VIS_VIS", "filters" ] = "VIS"
208+ # VIS_VIS appears in the filters, so update that filter to just say VIS
209+ science_images['filters'][science_images[' filters'] == ' VIS_VIS' ] = "VIS"
210210
211- filters = df_im_euclid['filters'].to_numpy()
212- filters
211+ science_images['filters']
213212```
214213
215214## The image above is very large, so let's cut out a smaller image to inspect these data.
216215
217216``` {code-cell} ipython3
218217######################## User defined section ############################
219218## How large do you want the image cutout to be?
220- im_cutout= 1.0 * u.arcmin
219+ im_cutout = 1.0 * u.arcmin
221220
222221## What is the center of the cutout?
223222## For now choosing a random location on the image
@@ -229,7 +228,7 @@ dec = 64.525
229228# ra = 273.474451
230229# dec = 64.397273
231230
232- coords_cutout = SkyCoord(ra, dec, unit=(u. deg, u.deg) , frame='icrs')
231+ coords_cutout = SkyCoord(ra, dec, unit=' deg' , frame='icrs')
233232
234233##########################################################################
235234
@@ -275,7 +274,7 @@ rows = -(-num_images // columns)
275274fig, axes = plt.subplots(rows, columns, figsize=(4 * columns, 4 * rows), subplot_kw={'projection': WCS(final_hdulist[0].header)})
276275axes = axes.flatten()
277276
278- for idx, (ax, filt) in enumerate(zip(axes, filters)):
277+ for idx, (ax, filt) in enumerate(zip(axes, science_images[' filters'] )):
279278 image_data = final_hdulist[idx].data
280279 norm = ImageNormalize(image_data, interval=PercentileInterval(99.9), stretch=AsinhStretch())
281280 ax.imshow(image_data, cmap='gray', origin='lower', norm=norm)
@@ -296,13 +295,9 @@ plt.show()
296295First we list all the filters so you can choose which cutout you want to extract sources on. We will choose VIS.
297296
298297``` {code-cell} ipython3
299- filters
300- ```
301-
302- ``` {code-cell} ipython3
303- filt_index = np.where(filters == 'VIS')[0][0]
298+ filt_index = np.where(science_images['filters'] == 'VIS')[0][0]
304299
305- img1= final_hdulist[filt_index].data
300+ img1 = final_hdulist[filt_index].data
306301```
307302
308303### Extract some sources from the cutout using sep (python package based on source extractor)
@@ -386,8 +381,8 @@ for i in range(len(sources_thr)):
386381
387382## About this Notebook
388383
389- ** Author** : Tiffany Meshkat (IPAC Scientist)
384+ ** Author** : Tiffany Meshkat, Anahita Alavi, Anastasia Laity, Andreas Faisst, Brigitta Sipőcz, Dan Masters, Harry Teplitz, Jaladh Singhal, Shoubaneh Hemmati, Vandana Desai
390385
391- ** Updated** : 2025-03-19
386+ ** Updated** : 2025-03-31
392387
393388** Contact:** [ the IRSA Helpdesk] ( https://irsa.ipac.caltech.edu/docs/help_desk.html ) with questions or reporting problems.
0 commit comments