Skip to content

Commit d8b80f8

Browse files
committed
Some code cleanup for notebook 5
1 parent 88f4d9f commit d8b80f8

File tree

1 file changed

+12
-26
lines changed

1 file changed

+12
-26
lines changed

tutorials/euclid_access/5_Euclid_intro_SPE_catalog.md

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,8 @@ import pyvo as vo
6969
In this case, choose the coordinates from the first notebook to save time downloading the MER mosaic. Search a radius of 1.5 arcminutes around these coordinates.
7070

7171
```{code-cell} ipython3
72-
ra = 273.474451
73-
dec = 64.397273
74-
75-
search_radius = 1.5 * u.arcmin
76-
pos = SkyCoord(ra=ra, dec=dec, unit='deg')
77-
78-
coord = SkyCoord(ra, dec, unit=(u.deg, u.deg), frame='icrs')
72+
search_radius = 10 * u.arcsec
73+
coord = SkyCoord.from_name('HD 168151')
7974
```
8075

8176
### Use IRSA to search for all Euclid data on this target
@@ -85,8 +80,7 @@ This searches specifically in the euclid_DpdMerBksMosaic "collection" which is t
8580
```{code-cell} ipython3
8681
irsa_service= vo.dal.sia2.SIA2Service('https://irsadev.ipac.caltech.edu/SIA')
8782
88-
im_table = irsa_service.search(pos=(pos.ra.deg, pos.dec.deg, 10*u.arcsec),
89-
collection='euclid_DpdMerBksMosaic')
83+
im_table = irsa_service.search(pos=(coord, search_radius), collection='euclid_DpdMerBksMosaic')
9084
9185
## Convert the table to pandas dataframe
9286
df_im_irsa=im_table.to_table().to_pandas()
@@ -235,39 +229,31 @@ AND galaxy.spe_z_prob > 0.999 \
235229
AND galaxy.spe_z BETWEEN 1.4 AND 1.6 \
236230
ORDER BY spe.spe_line_snr_gf DESC \
237231
"
238-
adql
239232
240-
241-
## Use TAP with this ADQL string using pyvo
233+
# Use TAP with this ADQL string using pyvo
242234
result = service.search(adql)
243235
244-
## Convert table to pandas dataframe and drop duplicates
245-
df_spe = result.to_table().to_pandas()
246-
247-
# Display first few rows
248-
df_spe[0:15]
236+
# Convert table to pandas dataframe and drop duplicates
237+
result_table = result.to_qtable()
249238
```
250239

251240
### Choose an object of interest, lets look at an object with a strong Halpha line detected with high SNR.
252241

253242
```{code-cell} ipython3
254243
obj_id = 2739401293646823742
255244
256-
df_obj=df_spe[(df_spe['object_id']==obj_id)]
245+
obj_2739401293646823742 = result_table[(result_table['object_id'] == obj_id)]
257246
258-
df_obj
247+
obj_2739401293646823742
259248
```
260249

261250
### Pull the spectrum of this object
262251

263252
```{code-cell} ipython3
264-
adql_object = f"SELECT * \
265-
FROM {table_1dspectra} \
266-
WHERE objectid = {obj_id} \
267-
AND uri IS NOT NULL "
253+
adql_object = f"SELECT * FROM {table_1dspectra} WHERE objectid = {obj_id} AND uri IS NOT NULL "
268254
269255
result2 = service.search(adql_object)
270-
df2=result2.to_table().to_pandas()
256+
df2 = result2.to_table().to_pandas()
271257
df2
272258
```
273259

@@ -276,9 +262,9 @@ df2
276262
This involves reading in the spectrum without readin in the full FITS file, just pulling the extension we want.
277263

278264
```{code-cell} ipython3
279-
irsa_url='https://irsadev.ipac.caltech.edu/'
265+
irsa_url = 'https://irsadev.ipac.caltech.edu/'
280266
281-
file_url=irsa_url+df2['uri'].iloc[0]
267+
file_url = irsa_url + df2['uri'].iloc[0]
282268
file_url
283269
284270
response = requests.get(file_url)

0 commit comments

Comments
 (0)