diff --git a/tutorials/spherex/spherex_intro.md b/tutorials/spherex/spherex_intro.md index ed3caeea..b5d3c676 100644 --- a/tutorials/spherex/spherex_intro.md +++ b/tutorials/spherex/spherex_intro.md @@ -7,9 +7,9 @@ jupytext: format_version: 0.13 jupytext_version: 1.17.2 kernelspec: - name: python3 display_name: Python 3 (ipykernel) language: python + name: python3 --- # Introduction to SPHEREx Spectral Images @@ -58,7 +58,7 @@ from astropy.table import Table from astropy import units as u from astropy.coordinates import SkyCoord -import pyvo +from astroquery.ipac.irsa import Irsa from pyvo.dal.adhoc import DatalinkResults from firefly_client import FireflyClient @@ -73,31 +73,31 @@ Define some coordinates of interest. ```{code-cell} ipython3 ra_deg = 304.693508808 dec_deg = 42.4436872991 + +coord = SkyCoord(ra_deg, dec_deg, unit='deg') +search_radius = 1 * u.arcsec ``` -Query IRSA for a list of Spectral Image MEFs that overlap this position. +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. -```{code-cell} ipython3 -# Define the TAP service URL for IRSA -tap_url = "https://irsa.ipac.caltech.edu/TAP" ++++ -# Connect to the TAP service -service = pyvo.dal.TAPService(tap_url) +```{tip} +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: -# Define your ADQL query -query = "SELECT * FROM spherex.obscore WHERE CONTAINS(POINT('ICRS',"+str(ra_deg)+","+str(dec_deg)+"), s_region)=1" + Irsa.list_collections(filter='spherex') +``` -# Submit the asynchronous query -job = service.submit_job(query) ++++ -# Run the job (starts the query execution on the server) -job.run() +There are currently three collections available: -# Wait for the job to complete (polling) -job.wait(phases=["COMPLETED", "ERROR", "ABORTED"], timeout=300) +* `'spherex_qr'` -- the Quick Release Observations, for more information see [SPHEREx archive documentation at IRSA](). +* `'spherex_qr_cal'` -- the Quick Release Calibration products. +* `'spherex_qr_deep'` -- -# Capture the results -results = job.fetch_result() +```{code-cell} ipython3 +results = Irsa.query_sia(pos=(coord, search_radius), collection='spherex_qr') ``` Each row of the results of your query represents a different spectral image. @@ -112,10 +112,10 @@ len(results) 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: ```{code-cell} ipython3 -list(results.fieldnames) +results.colnames ``` -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: +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: ```{code-cell} ipython3 results['access_url'][0]