Skip to content

Commit f7df2bb

Browse files
author
Tiffany Meshkat
committed
Removed the MER download and plot, and renamed the spe lines table from table_spe to table_lines for clarity, as there are multiple spe tables
1 parent 0fabef8 commit f7df2bb

File tree

1 file changed

+28
-27
lines changed

1 file changed

+28
-27
lines changed

tutorials/euclid_access/5_Euclid_intro_SPE_catalog.md

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Other Euclid notebooks show how to use other data products released as part of E
4848

4949
```{code-cell} ipython3
5050
# Uncomment the next line to install dependencies if needed
51-
# !pip install matplotlib pandas astropy pyvo
51+
# !pip install matplotlib pandas astropy>=6.0 pyvo
5252
```
5353

5454
```{code-cell} ipython3
@@ -124,25 +124,25 @@ print('The MER tile ID for this object is :',tileID)
124124
Note this file is about 1.46 GB
125125

126126
```{code-cell} ipython3
127-
fname = download_file(filename, cache=True)
128-
hdu_mer_irsa = fits.open(fname)
129-
head_mer_irsa = hdu_mer_irsa[0].header
127+
# fname = download_file(filename, cache=True)
128+
# hdu_mer_irsa = fits.open(fname)
129+
# head_mer_irsa = hdu_mer_irsa[0].header
130130
131-
print(hdu_mer_irsa.info())
131+
# print(hdu_mer_irsa.info())
132132
```
133133

134134
#### Extract just the primary image
135135

136136
```{code-cell} ipython3
137-
im_mer_irsa=hdu_mer_irsa[0].data
137+
# im_mer_irsa=hdu_mer_irsa[0].data
138138
```
139139

140140
#### Make a quick and simple plot to show the full MER image, with its large FOV
141141

142142
```{code-cell} ipython3
143-
plt.imshow(im_mer_irsa, cmap='gray', origin='lower',
144-
norm=ImageNormalize(im_mer_irsa, interval=PercentileInterval(99.9), stretch=AsinhStretch()))
145-
colorbar = plt.colorbar()
143+
# plt.imshow(im_mer_irsa, cmap='gray', origin='lower',
144+
# norm=ImageNormalize(im_mer_irsa, interval=PercentileInterval(99.9), stretch=AsinhStretch()))
145+
# colorbar = plt.colorbar()
146146
```
147147

148148
## 3. Download SPE catalog from IRSA directly to this notebook
@@ -162,15 +162,15 @@ for tablename in tables.keys():
162162
table_mer= 'euclid_q1_mer_catalogue'
163163
table_galaxy_candidates= 'euclid_q1_spectro_zcatalog_spe_galaxy_candidates'
164164
table_1dspectra= 'euclid.objectid_spectrafile_association_q1'
165-
table_spe= 'euclid_q1_spe_lines_line_features'
165+
table_lines= 'euclid_q1_spe_lines_line_features'
166166
```
167167

168168
### Learn some information about the table:
169169
- How many columns are there?
170170
- List the column names
171171

172172
```{code-cell} ipython3
173-
columns = tables[table_spe].columns
173+
columns = tables[table_lines].columns
174174
print(len(columns))
175175
```
176176

@@ -205,20 +205,20 @@ Finally we sort the data by descending spe_line_snr_gf to have the largest SNR H
205205

206206
```{code-cell} ipython3
207207
adql = f"SELECT DISTINCT mer.object_id,mer.ra, mer.dec, mer.tileid, mer.flux_y_templfit, \
208-
spe.spe_line_snr_gf,spe.spe_line_snr_di, spe.spe_line_name, spe.spe_line_central_wl_gf,\
209-
spe.spe_line_ew_gf, galaxy.spe_z_err, galaxy.spe_z,galaxy.spe_z_prob, spe.spe_line_flux_gf, spe.spe_line_flux_err_gf \
208+
lines.spe_line_snr_gf,lines.spe_line_snr_di, lines.spe_line_name, lines.spe_line_central_wl_gf,\
209+
lines.spe_line_ew_gf, galaxy.spe_z_err, galaxy.spe_z,galaxy.spe_z_prob, lines.spe_line_flux_gf, lines.spe_line_flux_err_gf \
210210
FROM {table_mer} AS mer \
211-
JOIN {table_spe} AS spe \
212-
ON mer.object_id = spe.object_id \
211+
JOIN {table_lines} AS lines \
212+
ON mer.object_id = lines.object_id \
213213
JOIN {table_galaxy_candidates} AS galaxy \
214-
ON spe.object_id = galaxy.object_id AND spe.spe_rank = galaxy.spe_rank \
215-
WHERE spe.spe_line_snr_gf >5 \
216-
AND spe.spe_line_name = 'Halpha' \
214+
ON lines.object_id = galaxy.object_id AND lines.spe_rank = galaxy.spe_rank \
215+
WHERE lines.spe_line_snr_gf >5 \
216+
AND lines.spe_line_name = 'Halpha' \
217217
AND mer.tileid = {tileID} \
218218
AND galaxy.spe_z_prob > 0.99 \
219219
AND galaxy.spe_z BETWEEN 1.4 AND 1.6 \
220-
AND spe.spe_line_flux_gf > 2E-16 \
221-
ORDER BY spe.spe_line_snr_gf DESC \
220+
AND lines.spe_line_flux_gf > 2E-16 \
221+
ORDER BY lines.spe_line_snr_gf DESC \
222222
"
223223
224224
# Use TAP with this ADQL string using pyvo
@@ -245,7 +245,7 @@ obj_tab
245245
### Pull the spectrum of this object
246246

247247
```{code-cell} ipython3
248-
adql_object = f"SELECT * FROM {table_1dspectra} WHERE objectid = {obj_id} AND uri IS NOT NULL "
248+
adql_object = f"SELECT * FROM {table_1dspectra} WHERE objectid = {obj_id}"
249249
250250
result2 = service.search(adql_object)
251251
df2 = result2.to_table().to_pandas()
@@ -275,19 +275,20 @@ with fits.open(BytesIO(response.content), memmap=True) as hdul:
275275
Divide by 10000 to convert from Angstrom to micron
276276

277277
```{code-cell} ipython3
278-
wavelengths = obj_2739401293646823742['spe_line_central_wl_gf']/10000.
279-
line_names = obj_2739401293646823742['spe_line_name']
280-
snr_gf = obj_2739401293646823742['spe_line_snr_gf']
278+
wavelengths = obj_tab['spe_line_central_wl_gf']/10000.
279+
line_names = obj_tab['spe_line_name']
280+
snr_gf = obj_tab['spe_line_snr_gf']
281281
282282
plt.plot(df_obj_irsa['WAVELENGTH']/10000., df_obj_irsa['SIGNAL'])
283283
284284
for wl, name, snr in zip(np.atleast_1d(wavelengths), np.atleast_1d(line_names), np.atleast_1d(snr_gf)):
285285
plt.axvline(wl, color='b', linestyle='--', alpha=0.3)
286-
plt.text(wl+0.02, .1, name+' SNR='+str(round(snr)), rotation=90, ha='center', va='bottom', fontsize=10)
286+
plt.text(wl+0.02, .2, name+' SNR='+str(round(snr)), rotation=90, ha='center', va='bottom', fontsize=10)
287287
288288
plt.xlabel('Wavelength (microns)')
289-
plt.ylabel('Flux (erg / (Angstrom s cm2))')
290-
plt.title(obj_id)
289+
plt.ylabel('Flux (erg / (s cm2))')
290+
plt.xlim(1.25, 1.85)
291+
plt.title('Object ID is '+str(obj_id))
291292
```
292293

293294
## About this Notebook

0 commit comments

Comments
 (0)