Skip to content

Commit 559991b

Browse files
committed
address review comments
1 parent 3de0ebd commit 559991b

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

astroquery/alma/core.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,7 @@ def _get_dataarchive_url(self):
770770
return self.dataarchive_url
771771

772772
def get_data_info(self, uids, *, expand_tarfiles=False,
773+
cutouts=True,
773774
with_auxiliary=True, with_rawdata=True):
774775
"""
775776
Return information about the data associated with ALMA uid(s)
@@ -848,8 +849,9 @@ def get_data_info(self, uids, *, expand_tarfiles=False,
848849
recursive_access_url = self.get_adhoc_service_access_url(adhoc_service)
849850
file_id = recursive_access_url.split('ID=')[1]
850851
expanded_tar = self.get_data_info(file_id)
851-
expanded_tar = expanded_tar[
852-
expanded_tar['semantics'] != '#cutout']
852+
if not cutouts:
853+
expanded_tar = expanded_tar[
854+
expanded_tar['semantics'] != '#cutout']
853855
if not expanded_result:
854856
expanded_result = expanded_tar
855857
else:

astroquery/linelists/cdms/core.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,6 @@ def _parse_result(self, response, *, verbose=False):
315315
result['ELO'].unit = u.cm**(-1)
316316
except ValueError as ex:
317317
# Give users a more helpful exception when parsing fails
318-
original_message = str(ex)
319318
new_message = ("Failed to parse CDMS response. This may be caused by a malformed search return. "
320319
"You can check this by running `CDMS.get_molecule('<id>')` instead; if it works, the "
321320
"problem is caused by the CDMS search interface and cannot be worked around.")
@@ -421,14 +420,33 @@ def tryfloat(x):
421420
def get_molecule(self, molecule_id, *, cache=True, return_response=False):
422421
"""
423422
Retrieve the whole molecule table for a given molecule id
423+
424+
Parameters
425+
----------
426+
molecule_id : str
427+
The 6-digit molecule identifier as a string
428+
cache : bool
429+
Defaults to True. If set overrides global caching behavior.
430+
See :ref:`caching documentation <astroquery_cache>`.
431+
return_response : bool, optional
432+
If True, return the raw `requests.Response` object instead of parsing
433+
the response. If this is set, the response will be returned whether
434+
or not it was successful. Default is False.
424435
"""
425436
if not isinstance(molecule_id, str) or len(molecule_id) != 6:
426437
raise ValueError("molecule_id should be a length-6 string of numbers")
427438
url = f'{self.CLASSIC_URL}/entries/c{molecule_id}.cat'
428439
response = self._request(method='GET', url=url,
429440
timeout=self.TIMEOUT, cache=cache)
441+
430442
if return_response:
431443
return response
444+
445+
response.raise_for_status()
446+
447+
if 'Zero lines were found' in response.text:
448+
raise EmptyResponseError(f"Response was empty; message was '{text}'.")
449+
432450
result = self._parse_cat(response.text)
433451

434452
species_table = self.get_species_table()
@@ -443,11 +461,6 @@ def _parse_cat(self, text, *, verbose=False):
443461
See details in _parse_response; this is a very similar function,
444462
but the catalog responses have a slightly different format.
445463
"""
446-
447-
if 'Zero lines were found' in text:
448-
raise EmptyResponseError(f"Response was empty; message was '{text}'.")
449-
450-
451464
# notes about the format
452465
# [F13.4, 2F8.4, I2, F10.4, I3, I7, I4, 12I2]: FREQ, ERR, LGINT, DR, ELO, GUP, TAG, QNFMT, QN noqa
453466
# 13 21 29 31 41 44 51 55 57 59 61 63 65 67 69 71 73 75 77 79 noqa
@@ -516,7 +529,9 @@ def _parse_cat(self, text, *, verbose=False):
516529

517530
def parse_letternumber(st):
518531
"""
519-
Parse CDMS's two-letter QNs
532+
Parse CDMS's two-letter QNs into integers.
533+
534+
Masked values are converted to -999999.
520535
521536
From the CDMS docs:
522537
"Exactly two characters are available for each quantum number. Therefore, half

0 commit comments

Comments
 (0)