Ejemplo n.º 1
0
def test_query_region_box_async(coordinates, patch_get):
    response = Irsa.query_region_async(
        coordinates, catalog='fp_psc', spatial='Box',
        width=2 * u.arcmin, get_query_payload=True)
    assert response['size'] == 120
    response = Irsa.query_region_async(
        coordinates, catalog='fp_psc', spatial='Box', width=2 * u.arcmin)
    assert response is not None
Ejemplo n.º 2
0
def test_query_region_cone_async(coordinates, patch_get):
    response = Irsa.query_region_async(
        coordinates, catalog='fp_psc', spatial='Cone',
        radius=2 * u.arcmin, get_query_payload=True)
    assert response['radius'] == 2
    assert response['radunits'] == 'arcmin'
    response = Irsa.query_region_async(
        coordinates, catalog='fp_psc', spatial='Cone', radius=2 * u.arcmin)
    assert response is not None
Ejemplo n.º 3
0
def test_query_region_async_polygon(polygon, patch_get):
    response = Irsa.query_region_async(
        "m31", catalog="fp_psc", spatial="Polygon",
        polygon=polygon, get_query_payload=True)

    for a, b in zip(re.split("[ ,]", response["polygon"]),
                    re.split("[ ,]", "10.1 +10.1,10.0 +10.1,10.0 +10.0")):
        for a1, b1 in zip(a.split(), b.split()):
            a1 = float(a1)
            b1 = float(b1)
            np.testing.assert_almost_equal(a1, b1)

    response = Irsa.query_region_async(
        "m31", catalog="fp_psc", spatial="Polygon", polygon=polygon)

    assert response is not None
Ejemplo n.º 4
0
def test_query_region_polygon(polygon, patch_get):
    result = Irsa.query_region("m31",
                               catalog="fp_psc",
                               spatial="Polygon",
                               polygon=polygon)

    assert isinstance(result, Table)
Ejemplo n.º 5
0
def test_spatial_valdi(spatial, result):
    out = Irsa._parse_spatial(spatial,
                              coordinates='m31',
                              radius=5 * u.deg,
                              width=5 * u.deg,
                              polygon=[(5 * u.hour, 5 * u.deg)] * 3)
    assert out['spatial'] == result
Ejemplo n.º 6
0
def test_query_region_cone(coordinates, patch_get):
    result = Irsa.query_region(coordinates,
                               catalog='fp_psc',
                               spatial='Cone',
                               radius=2 * u.arcmin)

    assert isinstance(result, Table)
Ejemplo n.º 7
0
def test_query_region_box(coordinates, patch_get):
    result = Irsa.query_region(coordinates,
                               catalog='fp_psc',
                               spatial='Box',
                               width=2 * u.arcmin)

    assert isinstance(result, Table)
Ejemplo n.º 8
0
 def test_query_region_box(self):
     result = Irsa.query_region("00h42m44.330s +41d16m07.50s",
                                catalog='fp_psc',
                                spatial='Box',
                                width=2 * u.arcmin,
                                cache=False)
     assert isinstance(result, Table)
Ejemplo n.º 9
0
 def test_query_region_box_async(self):
     response = Irsa.query_region_async("00h42m44.330s +41d16m07.50s",
                                        catalog='fp_psc',
                                        spatial='Box',
                                        width=2 * u.arcmin,
                                        cache=False)
     assert response is not None
Ejemplo n.º 10
0
 def test_query_region_cone(self):
     result = Irsa.query_region('m31',
                                catalog='fp_psc',
                                spatial='Cone',
                                radius=2 * u.arcmin,
                                cache=False)
     assert isinstance(result, Table)
Ejemplo n.º 11
0
 def test_query_region_cone_async(self):
     response = Irsa.query_region_async('m31',
                                        catalog='fp_psc',
                                        spatial='Cone',
                                        radius=2 * u.arcmin,
                                        cache=False)
     assert response is not None
Ejemplo n.º 12
0
    def test_query_region_polygon(self):
        polygon = [(10.1, 10.1), (10.0, 10.1), (10.0, 10.0)]
        result = Irsa.query_region("m31",
                                   catalog="fp_psc",
                                   spatial="Polygon",
                                   polygon=polygon,
                                   cache=False)

        assert isinstance(result, Table)
Ejemplo n.º 13
0
    def test_query_region_async_polygon(self):
        polygon = [
            SkyCoord(ra=10.1, dec=10.1, unit=(u.deg, u.deg)),
            SkyCoord(ra=10.0, dec=10.1, unit=(u.deg, u.deg)),
            SkyCoord(ra=10.0, dec=10.0, unit=(u.deg, u.deg))
        ]
        response = Irsa.query_region_async("m31",
                                           catalog="fp_psc",
                                           spatial="Polygon",
                                           polygon=polygon,
                                           cache=False)

        assert response is not None
Ejemplo n.º 14
0
def test_args_to_payload():
    out = Irsa._args_to_payload("fp_psc")
    assert out == dict(catalog='fp_psc', outfmt=3, outrows=conf.row_limit,
                       selcols='')
Ejemplo n.º 15
0
def test_spatial_invalid(spatial):
    with pytest.raises(ValueError):
        Irsa._parse_spatial(spatial, coordinates='m31')
Ejemplo n.º 16
0
 def test_list_catalogs(self):
     catalogs = Irsa.list_catalogs(cache=False)
     # Number of available catalogs may change over time, test only for significant drop.
     # (at the time of writing there are 587 catalogs in the list).
     assert len(catalogs) > 500