Skip to content

Commit f778d44

Browse files
committed
Update deprecation version, note about installing older version
1 parent 4948df3 commit f778d44

2 files changed

Lines changed: 49 additions & 46 deletions

File tree

astroquery/mast/collections.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -200,25 +200,25 @@ def supports_spatial_queries(self, collection=None, catalog=None):
200200
@deprecated_renamed_argument(
201201
"version",
202202
None,
203-
since="0.4.12",
203+
since="0.4.13",
204204
message="The `version` argument is deprecated and "
205205
"will be removed in a future release. Please use `collection` and `catalog` instead.",
206206
)
207207
@deprecated_renamed_argument(
208208
"pagesize",
209209
None,
210-
since="0.4.12",
210+
since="0.4.13",
211211
message="The `pagesize` argument is deprecated "
212212
"and will be removed in a future release. Please use `limit` instead.",
213213
)
214214
@deprecated_renamed_argument(
215215
"page",
216216
None,
217-
since="0.4.12",
217+
since="0.4.13",
218218
message="The `page` argument is deprecated "
219219
"and will be removed in a future release. Please use `offset` instead.",
220220
)
221-
@deprecated_renamed_argument("objectname", "object_name", since="0.4.12")
221+
@deprecated_renamed_argument("objectname", "object_name", since="0.4.13")
222222
def query_criteria(
223223
self,
224224
collection=None,
@@ -454,21 +454,21 @@ def query_criteria(
454454
@deprecated_renamed_argument(
455455
"version",
456456
None,
457-
since="0.4.12",
457+
since="0.4.13",
458458
message="The `version` argument is deprecated and "
459459
"will be removed in a future release. Please use `collection` and `catalog` instead.",
460460
)
461461
@deprecated_renamed_argument(
462462
"pagesize",
463463
None,
464-
since="0.4.12",
464+
since="0.4.13",
465465
message="The `pagesize` argument is deprecated "
466466
"and will be removed in a future release. Please use `limit` instead.",
467467
)
468468
@deprecated_renamed_argument(
469469
"page",
470470
None,
471-
since="0.4.12",
471+
since="0.4.13",
472472
message="The `page` argument is deprecated "
473473
"and will be removed in a future release. Please use `offset` instead.",
474474
)
@@ -601,25 +601,25 @@ def query_region(
601601
@deprecated_renamed_argument(
602602
"version",
603603
None,
604-
since="0.4.12",
604+
since="0.4.13",
605605
message="The `version` argument is deprecated and "
606606
"will be removed in a future release. Please use `collection` and `catalog` instead.",
607607
)
608608
@deprecated_renamed_argument(
609609
"pagesize",
610610
None,
611-
since="0.4.12",
611+
since="0.4.13",
612612
message="The `pagesize` argument is deprecated "
613613
"and will be removed in a future release. Please use `limit` instead.",
614614
)
615615
@deprecated_renamed_argument(
616616
"page",
617617
None,
618-
since="0.4.12",
618+
since="0.4.13",
619619
message="The `page` argument is deprecated "
620620
"and will be removed in a future release. Please use `offset` instead.",
621621
)
622-
@deprecated_renamed_argument("objectname", "object_name", since="0.4.12")
622+
@deprecated_renamed_argument("objectname", "object_name", since="0.4.13")
623623
def query_object(
624624
self,
625625
object_name,
@@ -736,7 +736,7 @@ def query_object(
736736
)
737737

738738
@class_or_instance
739-
@deprecated(since="v0.4.12", message=("This function is deprecated and will be removed in a future release."))
739+
@deprecated(since="v0.4.13", message=("This function is deprecated and will be removed in a future release."))
740740
def query_hsc_matchid_async(self, match, *, version=3, pagesize=None, page=None):
741741
"""
742742
Returns all the matches for a given Hubble Source Catalog MatchID.
@@ -776,7 +776,7 @@ def query_hsc_matchid_async(self, match, *, version=3, pagesize=None, page=None)
776776
return self._current_connection.service_request_async(service, params, pagesize, page)
777777

778778
@class_or_instance
779-
@deprecated(since="v0.4.12", message=("This function is deprecated and will be removed in a future release."))
779+
@deprecated(since="v0.4.13", message=("This function is deprecated and will be removed in a future release."))
780780
def get_hsc_spectra_async(self, *, pagesize=None, page=None):
781781
"""
782782
Returns all Hubble Source Catalog spectra.
@@ -797,7 +797,7 @@ def get_hsc_spectra_async(self, *, pagesize=None, page=None):
797797
self._current_connection = self._portal_api_connection
798798
return self._current_connection.service_request_async("Mast.HscSpectra.Db.All", {}, pagesize, page)
799799

800-
@deprecated(since="v0.4.12", message=("This function is deprecated and will be removed in a future release."))
800+
@deprecated(since="v0.4.13", message=("This function is deprecated and will be removed in a future release."))
801801
def download_hsc_spectra(self, spectra, *, download_dir=None, cache=True, curl_flag=False):
802802
"""
803803
Download one or more Hubble Source Catalog spectra.
@@ -928,7 +928,8 @@ def _verify_collection(self, collection):
928928
if collection in self._no_longer_supported_collections:
929929
error_msg = (
930930
f"Collection '{collection}' is no longer supported. To query from this catalog, "
931-
f"please use a version of Astroquery older than 0.4.12."
931+
f"please use a version of Astroquery older than 0.4.13. You can install version 0.4.12 using "
932+
f"`pip install astroquery==0.4.12`"
932933
)
933934
else:
934935
closest = difflib.get_close_matches(collection, self.available_collections, n=1)

docs/mast/mast_catalog.rst

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ Catalog Queries
44
***************
55

66
`~astroquery.mast.CatalogsClass` is a versatile tool for discovering and querying the wide range of astronomical catalogs hosted by the
7-
[Mikulski Archive for Space Telescopes (MAST)](https://archive.stsci.edu/). `~astroquery.mast.CatalogsClass` is a Python wrapper
8-
for our [MAST Table Access Protocol (TAP) Service](https://mast.stsci.edu/vo-tap/), which allows you to query for catalog
7+
`Mikulski Archive for Space Telescopes (MAST) <https://archive.stsci.edu/>`_. `~astroquery.mast.CatalogsClass` is a Python wrapper
8+
for our `MAST Table Access Protocol (TAP) Service <https://mast.stsci.edu/vo-tap/>`_, which allows you to query for catalog
99
metadata and data. If you were querying the MAST TAP service directly, you would need to write your queries in
10-
[Astronomical Data Query Language (ADQL)](https://www.ivoa.net/documents/latest/ADQL.html). With `~astroquery.mast.CatalogsClass`,
10+
`Astronomical Data Query Language (ADQL) <https://www.ivoa.net/documents/latest/ADQL.html>`_. With `~astroquery.mast.CatalogsClass`,
1111
you can construct and execute these queries using a more intuitive Python interface, without needing to learn ADQL syntax.
1212

1313
The catalogs available through MAST are diverse, covering a wide range of astronomical objects and phenomena.
@@ -17,6 +17,7 @@ The `~astroquery.mast.CatalogsClass` interface is designed for flexible querying
1717
as well as the ability to filter results based on specific criteria.
1818

1919
At a high level, querying MAST catalogs with `~astroquery.mast.CatalogsClass` involves the following steps:
20+
2021
1. **Discover** available collections and catalogs.
2122
2. **Inspect** catalog metadata to understand available columns and data types, as well as the capabilities of each catalog.
2223
3. **Query** the catalog using spatial and/or non-spatial criteria to retrieve relevant data.
@@ -33,7 +34,7 @@ is specified in a query, these attributes will be used as defaults. The ``collec
3334
representing the current collection, and the ``catalog`` attribute is a string representing the name of the current
3435
catalog within that collection.
3536

36-
The default value for the ``collection`` attribute is "hsc", referring to the [Hubble Source Catalog version 3](https://archive.stsci.edu/hst/hsc/).
37+
The default value for the ``collection`` attribute is "hsc", referring to the `Hubble Source Catalog version 3 <https://archive.stsci.edu/hst/hsc/>`_.
3738
The default value for ``catalog`` is "dbo.SumMagAper2CatView". This is a summary source catalog with data describing sources detected in Hubble images,
3839
including their positions, magnitudes, and other properties.
3940

@@ -55,7 +56,7 @@ at any time after instantiation to set new defaults for subsequent queries. Both
5556
collection, the catalog will be reset to the default catalog for the new collection.
5657

5758
Here, we'll change the value of ``collection`` to "ullyses", referring to the
58-
[Hubble Ultraviolet Legacy Library of Young Stars as Essential Standards (ULLYSES)](https://ullyses.stsci.edu/) program. The default catalog
59+
`Hubble Ultraviolet Legacy Library of Young Stars as Essential Standards (ULLYSES) <https://ullyses.stsci.edu/>`_ program. The default catalog
5960
for this collection is "sciencemetadata", which contains metadata about the scientific exposures taken as part of the ULLYSES program,
6061
including their coordinates, observation dates, instruments used, and other properties.
6162

@@ -93,9 +94,6 @@ Discovering Available Collections
9394
To list all of the catalog collections that are accessible via the MAST TAP Service, use the `~astroquery.mast.CatalogsClass.get_collections` method.
9495
This returns an `~astropy.table.Table` containing the names of all available collections.
9596

96-
Some historical collections are no longer supported for querying, and will not appear in this list. If a collection
97-
has been renamed or deprecated, Astroquery will issue a warning and suggest the appropriate replacement where possible.
98-
9997
.. doctest-remote-data::
10098

10199
>>> collections = Catalogs.get_collections()
@@ -121,6 +119,12 @@ has been renamed or deprecated, Astroquery will issue a warning and suggest the
121119
tic_v82
122120
ullyses
123121

122+
.. attention::
123+
Some historical collections are no longer supported for querying and will not appear in this list. If a collection
124+
has been renamed or deprecated, Astroquery will issue a warning and suggest the appropriate replacement where possible.
125+
To query a catalog that is no longer supported, you can install an older version of Astroquery that still supports it.
126+
To install the latest version that supports legacy collections, use the following command: ``pip install astroquery==0.4.12``
127+
124128
Discovering Catalogs Within a Collection
125129
-----------------------------------------
126130

@@ -207,21 +211,21 @@ Shared Query Parameters
207211

208212
The following parameters are shared across all three query methods:
209213

210-
- ``collection`` : The name of the catalog collection to query. If not specified, the ``collection`` class attribute will be used as the default.
211-
- ``collection``: The name of the catalog collection to query. If not specified, the ``collection`` class attribute will be used as the default.
212-
- ``catalog``: The name of the catalog to query within the specified collection. If not specified, the ``catalog`` class attribute will be used as the default.
213-
- ``limit``: An integer specifying the maximum number of results to return. The default is 5,000.
214-
- ``offset``: An integer specifying the number of results to skip before starting to return results. This is useful for paginating through large result sets. Default is 0.
215-
- ``count_only``: A boolean indicating whether to return only the count of matching results instead of the results themselves. Default is False.
216-
- ``select_cols``: A list of column names to include in the results. If not specified, all columns will be returned.
217-
- ``sort_by``: A string or list of strings specifying the column(s) to sort the results by. Default is None (no sorting).
218-
- ``sort_desc``: A boolean or list of booleans specifying whether to sort in descending order for each column specified in ``sort_by``.
219-
Default is False (ascending order).
220-
- ``filters``: Another parameter used to specify criteria filters as a dictionary. Use this option when the name of a column conflicts
221-
with a named parameter of this method.
222-
- ``run_async``: If True, run the query in asynchronous mode. This mode is more robust and preferable for long-running queries.
223-
- ``return_adql``: If True, return the ADQL query string instead of executing the query. This is useful for debugging or for users who want
224-
to run the query directly against the TAP service. When False, the ADQL query string is also returned in the metadata of the result table.
214+
- ``collection`` : The name of the catalog collection to query. If not specified, the ``collection`` class attribute will be used as the default.
215+
- ``collection``: The name of the catalog collection to query. If not specified, the ``collection`` class attribute will be used as the default.
216+
- ``catalog``: The name of the catalog to query within the specified collection. If not specified, the ``catalog`` class attribute will be used as the default.
217+
- ``limit``: An integer specifying the maximum number of results to return. The default is 5,000.
218+
- ``offset``: An integer specifying the number of results to skip before starting to return results. This is useful for paginating through large result sets. Default is 0.
219+
- ``count_only``: A boolean indicating whether to return only the count of matching results instead of the results themselves. Default is False.
220+
- ``select_cols``: A list of column names to include in the results. If not specified, all columns will be returned.
221+
- ``sort_by``: A string or list of strings specifying the column(s) to sort the results by. Default is None (no sorting).
222+
- ``sort_desc``: A boolean or list of booleans specifying whether to sort in descending order for each column specified in ``sort_by``.
223+
Default is False (ascending order).
224+
- ``filters``: Another parameter used to specify criteria filters as a dictionary. Use this option when the name of a column conflicts
225+
with a named parameter of this method.
226+
- ``run_async``: If True, run the query in asynchronous mode. This mode is more robust and preferable for long-running queries.
227+
- ``return_adql``: If True, return the ADQL query string instead of executing the query. This is useful for debugging or for users who want
228+
to run the query directly against the TAP service. When False, the ADQL query string is also returned in the metadata of the result table.
225229

226230
These parameters allow users to control the scope and format of their queries consistently across all three methods.
227231

@@ -294,7 +298,7 @@ If a catalog supports spatial queries, the following parameters can be used to s
294298
- ``radius``: The radius of a cone search around ``coordinates`` or ``object_name``. Can be defined as a string with units (e.g., "10 arcsec"),
295299
a `~astropy.units.Quantity`, or a float in degrees. Default is 0.2 degrees.
296300
- ``region``: Specifies the spatial region of interest for more complex spatial queries, such as polygon searches.
297-
Please see the [Specifying Spatial Regions](#specifying-spatial-regions) section below for details on how to use this parameter.
301+
Please see the `Specifying Spatial Regions`_ section below for details on how to use this parameter.
298302

299303
If no spatial parameters are provided, the query is purely column-based and will not filter results based on position. If they are supplied, the
300304
spatial parameters are combined with any column-based criteria using a logical **AND**, meaning that only results that satisfy both the spatial and
@@ -338,7 +342,7 @@ The `~astroquery.mast.CatalogsClass.query_region` and `~astroquery.mast.Catalogs
338342
Both methods also support column-based criteria, sorting, and limiting of results, just like `~astroquery.mast.CatalogsClass.query_criteria`.
339343

340344
For these queries, we will use the ``tic_v82`` collection, which refers to the
341-
[TESS Input Catalog version 8.2](https://ui.adsabs.harvard.edu/abs/2022yCat.4039....0P/abstract). We'll use the `~astroquery.mast.CatalogsClass.query_region`
345+
`TESS Input Catalog version 8.2 <https://ui.adsabs.harvard.edu/abs/2022yCat.4039....0P/abstract>`_. We'll use the `~astroquery.mast.CatalogsClass.query_region`
342346
method to perform a simple cone search for sources within 1 arcminute of the coordinates (158.47924, -7.30962).
343347

344348
.. doctest-remote-data::
@@ -359,7 +363,7 @@ method to perform a simple cone search for sources within 1 arcminute of the coo
359363
841736289 158.475246467012 -7.29984176473098
360364

361365
For this next query, we'll use the `~astroquery.mast.CatalogsClass.query_object` method to search for sources within 0.1 degrees of the object
362-
["M11"](https://science.nasa.gov/mission/hubble/science/explore-the-night-sky/hubble-messier-catalog/messier-11/), which is an open star cluster
366+
`M11 <https://science.nasa.gov/mission/hubble/science/explore-the-night-sky/hubble-messier-catalog/messier-11/>`_, which is an open star cluster
363367
also known as the Wild Duck Cluster. We'll also filter for sources that are stars, sort results by the effective temperature of the source, and
364368
limit the number of results to 10.
365369

@@ -409,7 +413,7 @@ Cone searches are the most common type of spatial query, defined by a center pos
409413
- A Space-Time Coordinate (STC) string in the format ``CIRCLE [frame] <ra> <dec> <radius>``, where ra, dec, and radius are in degrees.
410414

411415
Let's demonstrate this on the ``skymapperdr4`` collection, which contains catalogs from the
412-
[SkyMapper Southern Survey: Data Release 4](https://skymapper.anu.edu.au/data-release/). The catalog we query will be "dr4.master", which is
416+
`SkyMapper Southern Survey: Data Release 4 <https://skymapper.anu.edu.au/data-release/>`_. The catalog we query will be "dr4.master", which is
413417
a master catalog of sources detected in the SkyMapper DR4 survey, containing their positions, magnitudes, and other properties. Our cone
414418
search will be centered on the coordinate (18.855, -6.945) with a radius of 0.01 degrees.
415419

@@ -487,16 +491,14 @@ previous cone search, so the results may look similar!
487491
Counting Results
488492
-----------------
489493

490-
All query methods support a ``count_only=True`` option, which returns only the number of matching records:
491-
492494
Each of the three query methods supports a ``count_only`` parameter. When set to ``True``, it returns only the number of matching results.
493495
This can be useful for quickly assessing the size of a result set without having to retrieve all the data.
494496

495497
Let's demonstrate this on the ``caom`` collection, which refers to the
496-
[Common Archive Observation Model](https://www.ivoa.net/documents/CAOM/20240927/WD-CAOM-2.5-20240927.pdf), a data model used to
498+
`Common Archive Observation Model <https://www.ivoa.net/documents/CAOM/20240927/WD-CAOM-2.5-20240927.pdf>`_, a data model used to
497499
describe astronomical observations. We'll query the ``obspointing`` catalog, which contains metadata about scientific observations at MAST.
498500
We'll perform a query to count the number of observations that are within 0.2 degrees of the exoplanet
499-
[WASP-12b](https://science.nasa.gov/exoplanet-catalog/wasp-12-b/). You'll notice that this query takes several seconds to complete.
501+
`WASP-12b <https://science.nasa.gov/exoplanet-catalog/wasp-12-b/>`_. You'll notice that this query takes several seconds to complete.
500502
The ``obspointing`` catalog is huge, and if you were to run the same query without the ``count_only`` parameter, it would typically take
501503
longer to return the full results, especially if there are many matching sources.
502504

0 commit comments

Comments
 (0)