Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ linelists
- General tools for both CDMS/JPL moved to linelists.core [#3456]
- Added jplspec, moved from its previous location (astroquery.jplspec to astroquery.linelists.jplspec) [#3455]

simbad
~~~~~~

- Add the possibility to declare more user agents to ``SimbadClass`` [#3529]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Add the possibility to declare more user agents to ``SimbadClass`` [#3529]
- Add the possibility to declare more information in the HTTP User-Agent header in ``SimbadClass`` [#3529]


xmatch
^^^^^^

Expand Down
27 changes: 13 additions & 14 deletions astroquery/simbad/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ class SimbadClass(BaseVOQuery):
"""
SIMBAD_URL = 'https://' + conf.server + '/simbad/sim-script'

def __init__(self, ROW_LIMIT=None, *, timeout=None):
super().__init__()
def __init__(self, ROW_LIMIT=None, *, timeout=None, extra_user_agents=None):
super().__init__(extra_user_agents=extra_user_agents)
# to create the TAPService
self._server = conf.server
self._tap = None
Expand Down Expand Up @@ -792,15 +792,13 @@ def query_region(self, coordinates, radius=2*u.arcmin, *,
... criteria="otype = 'Galaxy..' AND galdim_majaxis>8.5") # doctest: +REMOTE_DATA
>>> result.sort("galdim_majaxis", reverse=True) # doctest: +REMOTE_DATA
>>> result["main_id", "otype", "galdim_majaxis"] # doctest: +REMOTE_DATA
<Table length=5>
<Table length=3>
main_id otype galdim_majaxis
arcmin
object object float32
------------ ------ --------------
LEDA 41362 GiC 11.0
M 86 GiG 10.47
LEDA 40917 AG? 10.3
M 87 AGN 9.12
M 86 GiG 9.33669
NGC 4438 LIN 8.91

Notes
Expand Down Expand Up @@ -899,17 +897,18 @@ def query_catalog(self, catalog, *, criteria=None, get_query_payload=False,
>>> from astroquery.simbad import Simbad
>>> simbad = Simbad()
>>> simbad.ROW_LIMIT = 5
>>> simbad.query_catalog("GSC", criteria="pmra > 50 and pmra < 100") # doctest: +REMOTE_DATA
>>> result = simbad.query_catalog("GSC", criteria="pmra > 50 and pmra < 100") # doctest: +REMOTE_DATA
>>> result # doctest: +REMOTE_DATA
<Table length=5>
main_id ra ... coo_bibcode catalog_id
deg ...
object float64 ... object object
--------------- --------------- ... ------------------- ---------------
HD 26053 61.84326890626 ... 2020yCat.1350....0G GSC 04725-00973
TYC 8454-1081-1 345.11163189562 ... 2020yCat.1350....0G GSC 08454-01081
HD 26053 61.84326890626 ... 2020yCat.1350....0G GSC 04725-00973
HD 10158 24.86286094434 ... 2020yCat.1350....0G GSC 00624-00340
CD-22 1862 73.17988827324 ... 2020yCat.1350....0G GSC 05911-00222
BD+02 4434 327.90220788982 ... 2020yCat.1350....0G GSC 00548-00194
CD-22 1862 73.17988827324 ... 2020yCat.1350....0G GSC 05911-00222

Notes
-----
Expand Down Expand Up @@ -978,11 +977,11 @@ def query_hierarchy(self, name, hierarchy, *,
... hierarchy="parents") # doctest: +REMOTE_DATA
>>> parent[["main_id", "ra", "dec"]] # doctest: +REMOTE_DATA
<Table length=1>
main_id ra dec
deg deg
object float64 float64
--------- ------- -------
NGC 6705 282.766 -6.272
main_id ra dec
deg deg
object float64 float64
--------- ----------------- ------------------
NGC 6705 282.7654166666666 -6.271666666666667
"""
top, columns, joins, instance_criteria = self._get_query_parameters()

Expand Down
2 changes: 1 addition & 1 deletion astroquery/simbad/tests/test_simbad_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def test_add_votable_fields(self):
simbad_instance.columns_in_output = []
# mixed columns bundles and tables
simbad_instance.add_votable_fields("flux", "velocity", "update_date")
assert len(simbad_instance.columns_in_output) == 19
assert len(simbad_instance.columns_in_output) == 20

# add fluxes by their filter names
simbad_instance = Simbad()
Expand Down
12 changes: 12 additions & 0 deletions docs/simbad/simbad.rst
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,18 @@ your cache:
If this function is unavailable, upgrade your version of astroquery.
The ``clear_cache`` function was introduced in version 0.4.7.dev8479.

Make your requests identifiable
===============================

To declare who you are to the SIMBAD's servers, add an extra **user agent** to your
SIMBAD instance:
Comment on lines +870 to +871
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add one more sentence why anyone want to do this?


.. code-block:: python

>>> from astroquery.simbad import Simbad
>>> simbad = Simbad(extra_user_agents="you")


Citation
========

Expand Down
Loading