Skip to content

Commit 88bd7da

Browse files
committed
MAINT: swapping out pyvo obscore query with more convenient astroquery call
1 parent bfa2673 commit 88bd7da

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

tutorials/spherex/spherex_intro.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ from astropy.table import Table
5858
from astropy import units as u
5959
from astropy.coordinates import SkyCoord
6060
61-
import pyvo
61+
from astroquery.ipac.irsa import Irsa
6262
from pyvo.dal.adhoc import DatalinkResults
6363
6464
from firefly_client import FireflyClient
@@ -73,31 +73,31 @@ Define some coordinates of interest.
7373
```{code-cell} ipython3
7474
ra_deg = 304.693508808
7575
dec_deg = 42.4436872991
76+
77+
coord = SkyCoord(ra_deg, dec_deg, unit='deg')
78+
search_radius = 1 * u.arcsec
7679
```
7780

78-
Query IRSA for a list of Spectral Image MEFs that overlap this position.
81+
Query IRSA for a list of Spectral Image MEFs that overlap this position. We use the [IRSA module in astroquery](https://astroquery.readthedocs.io/en/latest/ipac/irsa/irsa.html) and the Simple Image Access API.
7982

80-
```{code-cell} ipython3
81-
# Define the TAP service URL for IRSA
82-
tap_url = "https://irsa.ipac.caltech.edu/TAP"
83+
+++
8384

84-
# Connect to the TAP service
85-
service = pyvo.dal.TAPService(tap_url)
85+
```{tip}
86+
The IRSA SIA collections can be listed using using the ``list_collections`` method, we can filter on the ones containing "spherex" in the collection name:
8687
87-
# Define your ADQL query
88-
query = "SELECT * FROM spherex.obscore WHERE CONTAINS(POINT('ICRS',"+str(ra_deg)+","+str(dec_deg)+"), s_region)=1"
88+
Irsa.list_collections(filter='spherex')
89+
```
8990

90-
# Submit the asynchronous query
91-
job = service.submit_job(query)
91+
+++
9292

93-
# Run the job (starts the query execution on the server)
94-
job.run()
93+
There are currently three collections available:
9594

96-
# Wait for the job to complete (polling)
97-
job.wait(phases=["COMPLETED", "ERROR", "ABORTED"], timeout=300)
95+
* `'spherex_qr'` -- the Quick Release Observations, for more information see [SPHEREx archive documentation at IRSA]().
96+
* `'spherex_qr_cal'` -- the Quick Release Calibration products.
97+
* `'spherex_qr_deep'` --
9898

99-
# Capture the results
100-
results = job.fetch_result()
99+
```{code-cell} ipython3
100+
results = Irsa.query_sia(pos=(coord, search_radius), collection='spherex_qr')
101101
```
102102

103103
Each row of the results of your query represents a different spectral image.
@@ -112,10 +112,10 @@ len(results)
112112
The query results provide a lot of metadata about each spectral image. These columns have standard names as defined by the IVOA. Let's list them:
113113

114114
```{code-cell} ipython3
115-
list(results.fieldnames)
115+
results.colnames
116116
```
117117

118-
The 'access_url' column is particularly important because it tells you how to access the data. Let's look at the 'access_url' value for the first row:
118+
The `'access_url'` column is particularly important because it tells you how to access the data. Let's look at the `'access_url'` value for the first row:
119119

120120
```{code-cell} ipython3
121121
results['access_url'][0]

0 commit comments

Comments
 (0)