diff --git a/astropy_helpers b/astropy_helpers index 9431edf2a6..d2a6304a3e 160000 --- a/astropy_helpers +++ b/astropy_helpers @@ -1 +1 @@ -Subproject commit 9431edf2a6e4692bfbd9e6326f01288d61d414e9 +Subproject commit d2a6304a3e801bc2cb053ccf1cf09a9f1e62036c diff --git a/astroquery/heasarc/core.py b/astroquery/heasarc/core.py index 5a6b60b0d1..c9d65b0ac1 100644 --- a/astroquery/heasarc/core.py +++ b/astroquery/heasarc/core.py @@ -121,12 +121,12 @@ def query_object_async(self, object_name, mission, *, cache=True, get_query_payload=False, **kwargs): """ - Query around a specific object within a given mission catalog + Query around a specific objects within a given mission catalog Parameters ---------- - object_name : str - Object to query around. To set search radius use the 'radius' + object_name : str or iterable + Objects to query around. To set search radius use the 'radius' parameter. mission : str Mission table to search from @@ -139,7 +139,7 @@ def query_object_async(self, object_name, mission, *, """ request_payload = self._args_to_payload( mission=mission, - entry=object_name, + entry=object_name if isinstance(object_name, str) else "; ".join(object_name), **kwargs ) diff --git a/astroquery/heasarc/tests/test_heasarc_remote.py b/astroquery/heasarc/tests/test_heasarc_remote.py index 2558683c15..dd5c4e828e 100644 --- a/astroquery/heasarc/tests/test_heasarc_remote.py +++ b/astroquery/heasarc/tests/test_heasarc_remote.py @@ -11,6 +11,7 @@ from astropy.coordinates import SkyCoord from astropy import units as u +from astropy.table import unique @parametrization_local_save_remote @@ -83,13 +84,25 @@ def test_mission_cols(self): def test_query_object_async(self): mission = 'rosmaster' - object_name = '3c273' + object_names = ['3c273', 'PSR B0531+21'] heasarc = Heasarc() - response = heasarc.query_object_async(object_name, mission=mission) + response = heasarc.query_object_async(object_names, mission=mission) assert response is not None assert isinstance(response, (requests.models.Response, MockResponse)) + def test_query_object(self): + mission = "nicermastr" + object_names = ("Swift_J1818.0-1607", "SAX_J1808.4-3658") + + heasarc = Heasarc() + response = heasarc.query_object(object_name=object_names, + mission=mission) + uresponse = unique(response, keys="NAME") + returned_names = [str(i).replace(" ", "") for i in uresponse["NAME"]] + assert "Swift_J1818.0-1607" in returned_names + assert "SAX_J1808.4-3658" in returned_names + def test_query_region_async(self): heasarc = Heasarc() mission = 'rosmaster' diff --git a/astroquery/heasarc/tests/test_heasarc_remote_isdc.py b/astroquery/heasarc/tests/test_heasarc_remote_isdc.py index 0904c43974..3dfaa609f6 100644 --- a/astroquery/heasarc/tests/test_heasarc_remote_isdc.py +++ b/astroquery/heasarc/tests/test_heasarc_remote_isdc.py @@ -184,10 +184,10 @@ def test_mission_cols(self): def test_query_object_async(self): mission = 'integral_rev3_scw' - object_name = '3c273' + object_names = ['3c273', "Crab"] heasarc = Heasarc() - response = heasarc.query_object_async(object_name, mission=mission) + response = heasarc.query_object_async(object_names, mission=mission) assert response is not None assert isinstance(response, (requests.models.Response, MockResponse))