Skip to content

Commit b95f1d0

Browse files
authored
Merge pull request #2504 from jaymedina/mast-convert-lists
converting input lists to np arrays
2 parents 0883e92 + dcc62fd commit b95f1d0

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

CHANGES.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ hsa
1616

1717
- New module to access ESA Herschel mission. [#2122]
1818

19+
mast
20+
^^^
21+
22+
- Fixed ``Observations.get_product_list`` to handle input lists of obsids. [#2504]
23+
1924

2025
Service fixes and enhancements
2126
------------------------------

astroquery/mast/observations.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,11 @@ def get_product_list_async(self, observations):
440440
observations = np.array([observations])
441441
if isinstance(observations, Table):
442442
observations = observations['obsid']
443+
if isinstance(observations, list):
444+
observations = np.array(observations)
443445

444446
observations = observations[observations != ""]
445-
if len(observations) == 0:
447+
if observations.size == 0:
446448
raise InvalidQueryError("Observation list is empty, no associated products.")
447449

448450
service = self._caom_products

astroquery/mast/tests/test_mast.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,10 @@ def test_observations_get_product_list(patch_post):
441441
result = mast.Observations.get_product_list(observations[0:4])
442442
assert isinstance(result, Table)
443443

444+
in_obsids = ['83229830', '1829332', '26074149', '24556715']
445+
result = mast.Observations.get_product_list(in_obsids)
446+
assert isinstance(result, Table)
447+
444448

445449
def test_observations_filter_products(patch_post):
446450
products = mast.Observations.get_product_list('2003738726')

0 commit comments

Comments
 (0)