Skip to content

Commit 0555f9b

Browse files
committed
Swapping out more pyvo with astroquery
1 parent 5cd7931 commit 0555f9b

File tree

3 files changed

+22
-42
lines changed

3 files changed

+22
-42
lines changed

tutorials/euclid_access/2_Euclid_intro_MER_catalog.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ If you have questions about this notebook, please contact the [IRSA helpdesk](ht
5050

5151
```{code-cell} ipython3
5252
# Uncomment the next line to install dependencies if needed
53-
# !pip install numpy matplotlib astroquery>=0.4.10
53+
# !pip install numpy matplotlib 'astroquery>=0.4.10'
5454
```
5555

5656
```{code-cell} ipython3
@@ -67,8 +67,7 @@ from astroquery.ipac.irsa import Irsa
6767
First, have a look at what Euclid catalogs are available. With the ``list_catalogs`` functionality, we'll receive a list of the name of the catalogs as well as their brief desciption.
6868

6969
```{code-cell} ipython3
70-
tables = Irsa.list_catalogs(filter='euclid')
71-
tables
70+
Irsa.list_catalogs(filter='euclid')
7271
```
7372

7473
### Choose the Euclid MER table
@@ -77,7 +76,7 @@ tables
7776
table_mer = 'euclid_q1_mer_catalogue'
7877
```
7978

80-
### Learn some information about the table:
79+
### Learn some information about the MER catalog:
8180
- How many columns are there?
8281
- List the column names
8382

tutorials/euclid_access/4_Euclid_intro_PHZ_catalog.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ AND phz.phz_median BETWEEN 1.4 AND 1.6 \
221221
adql
222222
223223
224-
## Use TAP with this ADQL string using pyvo
225-
result = service.search(adql)
224+
## Use TAP with this ADQL string
225+
result = Irsa.query_tap(adql)
226226
227227
228228
## Convert table to pandas dataframe
@@ -319,7 +319,7 @@ FROM {table_1dspectra} \
319319
WHERE objectid = {obj_id}"
320320
321321
## Pull the data on this particular galaxy
322-
result2 = service.search(adql_object)
322+
result2 = Irsa.query_tap(adql_object)
323323
df2=result2.to_table().to_pandas()
324324
df2
325325
```

tutorials/euclid_access/5_Euclid_intro_SPE_catalog.md

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ If you have questions about this notebook, please contact the [IRSA helpdesk](ht
5050

5151
```{code-cell} ipython3
5252
# Uncomment the next line to install dependencies if needed
53-
# !pip install matplotlib pandas astropy pyvo
53+
# !pip install matplotlib pandas astropy 'astroquery>=0.4.10'
5454
```
5555

5656
```{code-cell} ipython3
@@ -69,7 +69,7 @@ from astropy import units as u
6969
from astropy.utils.data import download_file
7070
from astropy.visualization import ImageNormalize, PercentileInterval, AsinhStretch
7171
72-
import pyvo as vo
72+
from astroquery.ipac.irsa import Irsa
7373
```
7474

7575
## 1. Find the MER Tile ID that corresponds to a given RA and Dec
@@ -86,12 +86,10 @@ coord = SkyCoord.from_name('HD 168151')
8686
This searches specifically in the euclid_DpdMerBksMosaic "collection" which is the MER images and catalogs.
8787

8888
```{code-cell} ipython3
89-
irsa_service= vo.dal.sia2.SIA2Service('https://irsa.ipac.caltech.edu/SIA')
90-
91-
im_table = irsa_service.search(pos=(coord, search_radius), collection='euclid_DpdMerBksMosaic')
89+
im_table = Irsa.query_sia(pos=(coord, search_radius), collection='euclid_DpdMerBksMosaic')
9290
9391
## Convert the table to pandas dataframe
94-
df_im_irsa=im_table.to_table().to_pandas()
92+
df_im_irsa=im_table.to_pandas()
9593
```
9694

9795
```{code-cell} ipython3
@@ -125,45 +123,28 @@ print('The MER tile ID for this object is :',tileID)
125123
Search for all tables in IRSA labeled as euclid
126124

127125
```{code-cell} ipython3
128-
service = vo.dal.TAPService("https://irsa.ipac.caltech.edu/TAP")
129-
130-
tables = service.tables
131-
for tablename in tables.keys():
132-
if "tap_schema" not in tablename and "euclid" in tablename:
133-
tables[tablename].describe()
126+
Irsa.list_catalogs(filter='euclid')
134127
```
135128

136129
```{code-cell} ipython3
137-
table_mer= 'euclid_q1_mer_catalogue'
138-
table_galaxy_candidates= 'euclid_q1_spectro_zcatalog_spe_galaxy_candidates'
139-
table_1dspectra= 'euclid.objectid_spectrafile_association_q1'
140-
table_lines= 'euclid_q1_spe_lines_line_features'
130+
table_mer = 'euclid_q1_mer_catalogue'
131+
table_galaxy_candidates = 'euclid_q1_spectro_zcatalog_spe_galaxy_candidates'
132+
table_1dspectra = 'euclid.objectid_spectrafile_association_q1'
133+
table_lines = 'euclid_q1_spe_lines_line_features'
141134
```
142135

143136
### Learn some information about the table:
144137
- How many columns are there?
145138
- List the column names
146139

147140
```{code-cell} ipython3
148-
columns = tables[table_lines].columns
149-
print(len(columns))
150-
```
151-
152-
```{code-cell} ipython3
153-
for col in columns:
154-
print(f'{f"{col.name}":30s} {col.unit} {col.description}') ## Currently no descriptions
141+
columns_info = Irsa.list_columns(catalog=table_lines)
142+
print(len(columns_info))
155143
```
156144

157145
```{code-cell} ipython3
158-
## Change the settings so we can see all the columns in the dataframe and the full column width
159-
## (to see the full long URL)
160-
pd.set_option('display.max_columns', None)
161-
pd.set_option('display.max_colwidth', None)
162-
163-
164-
## Can use the following lines to reset the max columns and column width of pandas
165-
# pd.reset_option('display.max_columns')
166-
# pd.reset_option('display.max_colwidth')
146+
# Full list of columns and their description
147+
columns_info
167148
```
168149

169150
## Find some objects with spectra in our tileID
@@ -196,8 +177,8 @@ AND lines.spe_line_flux_gf > 2E-16 \
196177
ORDER BY lines.spe_line_snr_gf DESC \
197178
"
198179
199-
# Use TAP with this ADQL string using pyvo
200-
result = service.search(adql)
180+
# Use TAP with this ADQL string
181+
result = Irsa.query_tap(adql)
201182
202183
# Convert table to pandas dataframe and drop duplicates
203184
result_table = result.to_qtable()
@@ -222,7 +203,7 @@ obj_tab
222203
```{code-cell} ipython3
223204
adql_object = f"SELECT * FROM {table_1dspectra} WHERE objectid = {obj_id}"
224205
225-
result2 = service.search(adql_object)
206+
result2 = Irsa.query_tap(adql_object)
226207
df2 = result2.to_table().to_pandas()
227208
df2
228209
```

0 commit comments

Comments
 (0)