Skip to content

Commit 3599dc2

Browse files
committed
Merge pull request #280 from Caltech-IPAC/raen/issues/252/euclid-timeout
Increase astropy timeout limit to 120s a3bfa71
1 parent 3112a35 commit 3599dc2

140 files changed

Lines changed: 1816 additions & 1532 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
27.1 KB
Loading
-1.94 MB
Binary file not shown.
27.9 KB
Loading

build/1-euclid-q1-hats-int-0368d4d2dbe3ac6ac056ce032683e549.md renamed to build/1-euclid-q1-hats-int-274427edf64505ec5d449c10bf57b553.md

File renamed without changes.
-258 KB
Binary file not shown.

build/1_Euclid_intro_MER_i-1cf82c253cc59196ac65c5eae6d04020.md renamed to build/1_Euclid_intro_MER_i-9075940a09fa31bf1eba6f546177f5eb.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -237,58 +237,58 @@ science_images['filters'][science_images['filters']== 'VIS_VIS'] = "VIS"
237237
science_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
245245
im_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
250250
ra = 273.8667
251251
dec = 64.525
252252
253-
## Bright star position
253+
# Bright star position
254254
# ra = 273.474451
255255
# dec = 64.397273
256256
257257
coords_cutout = SkyCoord(ra, dec, unit='deg', frame='icrs')
258258
259259
##########################################################################
260260
261-
## Iterate through each filter
261+
# Iterate through each filter
262262
263263
cutout_list = []
264264
265265
for 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
287287
final_hdulist = fits.HDUList(cutout_list)
288288
final_hdulist.info()
289289
```
290290

291-
## 3. Visualize multiwavelength Euclid Q1 MER cutouts
291+
## 5. Visualize multiwavelength Euclid Q1 MER cutouts
292292

293293
We 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
312312
for ax in axes[num_images:]:
313313
fig.delaxes(ax)
314314
315315
plt.tight_layout()
316316
plt.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

321321
First 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
369369
threshold= 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.
372372
minarea_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.
375375
deblend_cont_0= 0.005
376376
377377
flux_threshold= 0.01
@@ -383,7 +383,7 @@ sources_thr = sources[sources['flux'] > flux_threshold]
383383
print("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

389389
We plot the VIS cutout with the sources detected overplotted with a red ellipse
@@ -393,7 +393,7 @@ fig, ax = plt.subplots()
393393
m, s = np.mean(data_sub), np.std(data_sub)
394394
im = 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
398398
for i in range(len(sources_thr)):
399399
e = Ellipse(xy=(sources_thr['x'][i], sources_thr['y'][i]),

build/2_Euclid_intro_MER_c-8689ae642d9d1c1727e50cf26850bd2d.md renamed to build/2_Euclid_intro_MER_c-418a2a5aa83c05fb03f2b71105d5d8e5.md

File renamed without changes.
489 KB
Loading

build/3_Euclid_intro_1D_sp-40864218623132c325b81753b8b475d3.md renamed to build/3_Euclid_intro_1D_sp-8585bae077b506d531aac5dd3de46c8a.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ from astropy.io import fits
7474
from astropy.table import QTable
7575
from astropy import units as u
7676
from astropy.coordinates import SkyCoord
77+
from astropy.utils.data import conf
7778
from astropy.visualization import quantity_support
7879
7980
from astroquery.ipac.irsa import Irsa
@@ -91,6 +92,10 @@ warnings.filterwarnings(
9192
message="The unit 'erg' has been deprecated",
9293
category=u.UnitsWarning,
9394
)
95+
96+
# The Euclid spectrum files are large and the time it takes to read
97+
# them can exceed astropy's default timeout limit. Increase it.
98+
conf.remote_timeout = 120
9499
```
95100

96101
## 1. Search for the spectrum of a specific galaxy
2.32 MB
Loading

0 commit comments

Comments
 (0)