From 01d4e094b9431e928cc4df2c91261bdb0284cbea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Wed, 12 Mar 2025 09:38:19 -0700 Subject: [PATCH 1/4] ENH: returning QTable for query_sia and query_ssa --- astroquery/ipac/irsa/core.py | 16 +++++++++------- astroquery/ipac/irsa/tests/test_irsa_remote.py | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/astroquery/ipac/irsa/core.py b/astroquery/ipac/irsa/core.py index 39943d6be1..075a37566a 100644 --- a/astroquery/ipac/irsa/core.py +++ b/astroquery/ipac/irsa/core.py @@ -102,10 +102,10 @@ def query_sia(self, *, pos=None, band=None, time=None, pol=None, Returns ------- - Results in `pyvo.dal.SIAResults` format. - result.to_table() in Astropy table format + Results in `~astropy.table.QTable` format. + """ - return self.sia.search( + results = self.sia.search( pos=pos, band=band, time=time, @@ -126,6 +126,8 @@ def query_sia(self, *, pos=None, band=None, time=None, pol=None, maxrec=maxrec, **kwargs) + return results.to_qtable() + query_sia.__doc__ = query_sia.__doc__.replace('_SIA2_PARAMETERS', SIA2_PARAMETERS_DESC) def query_ssa(self, *, pos=None, radius=None, band=None, time=None, collection=None): @@ -151,8 +153,7 @@ def query_ssa(self, *, pos=None, radius=None, band=None, time=None, collection=N Returns ------- - Results in `pyvo.dal.SSAResults` format. - result.to_table() in Astropy table format + Results in `~astropy.table.QTable` format. """ if radius is None: @@ -160,8 +161,9 @@ def query_ssa(self, *, pos=None, radius=None, band=None, time=None, collection=N else: diameter = 2 * radius - return self.ssa.search(pos=pos, diameter=diameter, band=band, time=time, - format='all', collection=collection) + results = self.ssa.search(pos=pos, diameter=diameter, band=band, time=time, + format='all', collection=collection) + return results.to_qtable() def list_collections(self, servicetype=None): """ diff --git a/astroquery/ipac/irsa/tests/test_irsa_remote.py b/astroquery/ipac/irsa/tests/test_irsa_remote.py index 5ec693cb62..97b2ff980f 100644 --- a/astroquery/ipac/irsa/tests/test_irsa_remote.py +++ b/astroquery/ipac/irsa/tests/test_irsa_remote.py @@ -92,5 +92,5 @@ def test_ssa(self): coord = SkyCoord.from_name("Eta Carina") result = Irsa.query_ssa(pos=coord) assert len(result) > 260 - collections = set(result.to_table()['dataid_collection']) + collections = set(result['dataid_collection']) assert {'champ', 'iso_sws', 'sofia_forcast', 'sofia_great', 'spitzer_sha'}.issubset(collections) From 897906efd56beb3e73c0195b2ec97ae0568160f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Thu, 13 Mar 2025 09:41:49 -0700 Subject: [PATCH 2/4] DOC: adding changelog --- CHANGES.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index c1d92f1267..faea2172e9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,7 +8,6 @@ New Tools and Services API changes ----------- - esa.euclid ^^^^^^^^^^^^ @@ -16,6 +15,11 @@ esa.euclid - Tests remove temp directories. [#3226] +ipac.irsa +^^^^^^^^^ + +- ``query_sia`` now returns the results as an astropy QTable. [#3252] + mast ^^^^ From f858f36614aec189ddba3fd765872120fa670e33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Thu, 13 Mar 2025 09:42:17 -0700 Subject: [PATCH 3/4] DOC: updating docs to remove extra to_table() calls --- docs/ipac/irsa/irsa.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/ipac/irsa/irsa.rst b/docs/ipac/irsa/irsa.rst index 04ebc65191..403f0c16af 100644 --- a/docs/ipac/irsa/irsa.rst +++ b/docs/ipac/irsa/irsa.rst @@ -271,7 +271,7 @@ Simple image access queries `~astroquery.ipac.irsa.IrsaClass.query_sia` provides a way to access IRSA's Simple Image Access VO service. In the following example we are looking for Spitzer -Enhanced Imaging products in the centre of the COSMOS field as an `~astropy.table.Table`. +Enhanced Imaging products in the centre of the COSMOS field as a `~astropy.table.QTable`. .. doctest-remote-data:: @@ -280,7 +280,7 @@ Enhanced Imaging products in the centre of the COSMOS field as an `~astropy.tabl >>> from astropy import units as u >>> >>> coord = SkyCoord('150.01d 2.2d', frame='icrs') - >>> spitzer_images = Irsa.query_sia(pos=(coord, 1 * u.arcmin), collection='spitzer_seip').to_table() + >>> spitzer_images = Irsa.query_sia(pos=(coord, 1 * u.arcmin), collection='spitzer_seip') To list available collections for SIA queries, the `~astroquery.ipac.irsa.IrsaClass.list_collections` method is provided, and @@ -342,7 +342,7 @@ Now plot the cutout. from astropy.wcs import WCS import matplotlib.pyplot as plt coord = SkyCoord('150.01d 2.2d', frame='icrs') - spitzer_images = Irsa.query_sia(pos=(coord, 1 * u.arcmin), collection='spitzer_seip').to_table() + spitzer_images = Irsa.query_sia(pos=(coord, 1 * u.arcmin), collection='spitzer_seip') science_image = spitzer_images[spitzer_images['dataproduct_subtype'] == 'science'][0] with fits.open(science_image['access_url'], use_fsspec=True) as hdul: cutout = Cutout2D(hdul[0].section, position=coord, size=2 * @@ -356,7 +356,7 @@ Simple spectral access queries `~astroquery.ipac.irsa.IrsaClass.query_ssa` provides a way to access IRSA's Simple Spectral Access VO service. In the following example we are looking for Spitzer -Enhanced Imaging products in the centre of the COSMOS field as an `~astropy.table.Table`. +Enhanced Imaging products in the centre of the COSMOS field as a `~astropy.table.QTable`. .. doctest-remote-data:: @@ -365,7 +365,7 @@ Enhanced Imaging products in the centre of the COSMOS field as an `~astropy.tabl >>> from astropy import units as u >>> >>> coord = pos = SkyCoord.from_name('Arp 220') - >>> arp220_spectra = Irsa.query_ssa(pos=coord).to_table() + >>> arp220_spectra = Irsa.query_ssa(pos=coord) Without specifying the collection, the query returns results from multiple collections. For example this target has spectra from SOFIA as well as from From fe2614f7cb814fb92680e7ba6ad1321c420982b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Thu, 13 Mar 2025 21:57:33 -0700 Subject: [PATCH 4/4] ENH: list_catalog to return a Table --- astroquery/ipac/irsa/core.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/astroquery/ipac/irsa/core.py b/astroquery/ipac/irsa/core.py index 075a37566a..e619f32876 100644 --- a/astroquery/ipac/irsa/core.py +++ b/astroquery/ipac/irsa/core.py @@ -304,10 +304,10 @@ def list_catalogs(self, full=False, cache=False): Parameters ---------- full : bool - If True returns the full schema VOTable. If False returns a dictionary of the table names and - their description. + If True returns the full schema as a `~astropy.table.Table`. + If False returns a dictionary of the table names and their description. """ - tap_tables = Irsa.query_tap("SELECT * FROM TAP_SCHEMA.tables") + tap_tables = Irsa.query_tap("SELECT * FROM TAP_SCHEMA.tables").to_table() if full: return tap_tables