Skip to content

Commit

Permalink
Merge pull request #637 from keflavich/issue637
Browse files Browse the repository at this point in the history
Toward 0.3.1 release: remote-data failures
  • Loading branch information
keflavich committed Jan 19, 2016
2 parents cca8321 + 4e91895 commit 08f6d70
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 13 deletions.
4 changes: 2 additions & 2 deletions CHANGES
@@ -1,5 +1,5 @@
0.3.1.dev
---------
0.3.1 (2016-01-11)
------------------

- Fix bug in xmatch service that required astropy tables to have exactly 2
columns on input (#641)
Expand Down
1 change: 1 addition & 0 deletions astroquery/alma/__init__.py
Expand Up @@ -23,6 +23,7 @@ class Conf(_config.ConfigNamespace):
conf = Conf()

from .core import Alma, AlmaClass
from .utils import make_finder_chart

__all__ = ['Alma', 'AlmaClass',
'Conf', 'conf',
Expand Down
9 changes: 6 additions & 3 deletions astroquery/alma/tests/test_alma_remote.py
Expand Up @@ -33,7 +33,10 @@
class TestAlma:

def setup_class(cls):
Alma.archive_url = 'http://beta.cadc-ccda.hia-iha.nrc-cnrc.gc.ca'
pass
# starting somewhere between Nov 2015 and Jan 2016, the beta server
# stopped serving the actual data, making all staging attempts break
#Alma.archive_url = 'http://beta.cadc-ccda.hia-iha.nrc-cnrc.gc.ca'

@pytest.fixture()
def temp_dir(self, request):
Expand Down Expand Up @@ -66,9 +69,9 @@ def test_m83(self, temp_dir):
alma = Alma()
alma.cache_location = temp_dir

result_s = alma.query_object('M83')
m83_data = alma.query_object('M83')
uids = np.unique(m83_data['Member ous id'])
link_list = Alma.stage_data(uids)
link_list = alma.stage_data(uids)

def test_stage_data(self, temp_dir):
alma = Alma()
Expand Down
3 changes: 2 additions & 1 deletion astroquery/alma/tests/test_alma_utils.py
Expand Up @@ -67,4 +67,5 @@ def test_make_finder_chart():

assert len(catalog) >= 7
assert len(images) >= 1
assert hit_mask_public[3].mean() >= 49
assert 3 in hit_mask_public
assert hit_mask_public[3][256,256] >= 60
5 changes: 4 additions & 1 deletion astroquery/alma/utils.py
Expand Up @@ -89,7 +89,10 @@ def parse_frequency_support(frequency_support_str):
Quantities representing the frequency range. It will ignore the resolution
and polarizations.
"""
supports = str(frequency_support_str).split('U')
if not isinstance(frequency_support_str, str):
supports = frequency_support_str.tostring().decode('ascii').split('U')
else:
supports = frequency_support_str.split('U')

freq_ranges = [(float(sup[0]),
float(sup[1].split(',')[0].strip(string.ascii_letters))) *
Expand Down
2 changes: 1 addition & 1 deletion astroquery/lamda/tests/test_lamda_remote.py
Expand Up @@ -11,5 +11,5 @@ def test_query():
result = lamda.Lamda.query(mol='co')
assert [len(r) for r in result] == [2, 40, 41]
collider_dict = result[0]
assert collider_dict.keys() == ['PH2', 'OH2']
assert set(collider_dict.keys()) == set(['PH2', 'OH2'])
assert [len(collider_dict[r]) for r in collider_dict] == [820, 820]
2 changes: 2 additions & 0 deletions astroquery/nasa_ads/core.py
Expand Up @@ -48,6 +48,8 @@ def query_simple(self, query_string, get_query_payload=False,
data=request_payload, timeout=self.TIMEOUT,
cache=cache)

response.raise_for_status()

# primarily for debug purposes, but also useful if you want to send
# someone a URL linking directly to the data
if get_query_payload:
Expand Down
4 changes: 2 additions & 2 deletions astroquery/simbad/tests/test_simbad_remote.py
Expand Up @@ -129,14 +129,14 @@ def test_query_objects_null(self):
# Special case of null test: zero-sized region
def test_query_region_null(self):
result = simbad.core.Simbad.query_region(
coord.SkyCoord("00h00m0.0s 00h00m0.0s"), radius="0d",
coord.SkyCoord("00h01m0.0s 00h00m0.0s"), radius="0d",
equinox=2000.0, epoch='J2000')
assert result is None

# Special case of null test: very small region
def test_query_small_region_null(self):
result = simbad.core.Simbad.query_region(
coord.SkyCoord("00h00m0.0s 00h00m0.0s"), radius=1.0 * u.marcsec,
coord.SkyCoord("00h01m0.0s 00h00m0.0s"), radius=1.0 * u.marcsec,
equinox=2000.0, epoch='J2000')
assert result is None

Expand Down
4 changes: 3 additions & 1 deletion astroquery/splatalogue/tests/test_splatalogue.py
Expand Up @@ -104,10 +104,12 @@ def test_band_crashorno():


# regression test : version selection should work
# Unfortunately, it looks like version1 = version2 on the web page now, so this
# may no longer be a valid test
@remote_data
def test_version_selection():
results = splatalogue.Splatalogue.query_lines(
min_frequency=703 * u.GHz, max_frequency=706 * u.GHz,
chemical_name='Acetaldehyde', version='v1.0')

assert len(results) == 1
assert len(results) == 133
4 changes: 2 additions & 2 deletions astroquery/utils/commons.py
Expand Up @@ -103,8 +103,8 @@ def send_request(url, data, timeout, request_type='POST', headers={},
except requests.exceptions.Timeout:
raise TimeoutError("Query timed out, time elapsed {time}s".
format(time=timeout))
except requests.exceptions.RequestException:
raise Exception("Query failed\n")
except requests.exceptions.RequestException as ex:
raise Exception("Query failed: {0}\n".format(ex))


def parse_radius(radius):
Expand Down

0 comments on commit 08f6d70

Please sign in to comment.