From 9a15e0a69f403cc36d794cff61171931a9f3ab28 Mon Sep 17 00:00:00 2001 From: Rick White Date: Wed, 3 Jun 2020 15:24:53 -0400 Subject: [PATCH 1/7] initial commit for FIRST image cutouts --- CHANGES.rst | 5 ++ README.rst | 1 + astroquery/first/__init__.py | 33 +++++++ astroquery/first/core.py | 96 +++++++++++++++++++++ astroquery/first/tests/__init__.py | 0 astroquery/first/tests/data/image.fits | 13 +++ astroquery/first/tests/setup_package.py | 10 +++ astroquery/first/tests/test_first.py | 63 ++++++++++++++ astroquery/first/tests/test_first_remote.py | 25 ++++++ 9 files changed, 246 insertions(+) create mode 100644 astroquery/first/__init__.py create mode 100644 astroquery/first/core.py create mode 100644 astroquery/first/tests/__init__.py create mode 100644 astroquery/first/tests/data/image.fits create mode 100644 astroquery/first/tests/setup_package.py create mode 100644 astroquery/first/tests/test_first.py create mode 100644 astroquery/first/tests/test_first_remote.py diff --git a/CHANGES.rst b/CHANGES.rst index 4f5a4d2363..5e49692631 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -14,6 +14,11 @@ noirlab - Module added to access the NOIRLab (formally NOAO) archive. [#1638] +first +^^^^^ + +- Module added to access FIRST survey radio images. [#1733] + Service fixes and enhancements ------------------------------ diff --git a/README.rst b/README.rst index a162b06449..80dee99f15 100644 --- a/README.rst +++ b/README.rst @@ -107,6 +107,7 @@ The following modules have been completed using a common API: * `CADC `_: Canadian Astronomy Data Centre. * `ESASky `_: ESASky is a science driven discovery portal providing easy visualizations and full access to the entire sky as observed with ESA Space astronomy missions. * `ESO Archive `_ + * `FIRST `_: Faint Images of the Radio Sky at Twenty-cm. 20-cm radio images of the extragalactic sky from the VLA. * `Gaia `_: European Space Agency Gaia Archive. * `GAMA database `_ * `Gemini `_: Gemini Archive. diff --git a/astroquery/first/__init__.py b/astroquery/first/__init__.py new file mode 100644 index 0000000000..a3b6ef906a --- /dev/null +++ b/astroquery/first/__init__.py @@ -0,0 +1,33 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst +""" +FIRST Image Query Tool +---------------------- +.. topic:: Revision History + + :Originally contributed by: + + Rick White (rlw@stsci.edu) + +""" +from astropy import config as _config + + +class Conf(_config.ConfigNamespace): + """ + Configuration parameters for `astroquery.first`. + """ + server = _config.ConfigItem( + ['https://third.ucllnl.org/cgi-bin/firstcutout'], + 'Name of the FIRST server.') + timeout = _config.ConfigItem( + 60, + 'Time limit for connecting to FIRST server.') + + +conf = Conf() + +from .core import First, FirstClass + +__all__ = ['First', 'FirstClass', + 'Conf', 'conf', + ] diff --git a/astroquery/first/core.py b/astroquery/first/core.py new file mode 100644 index 0000000000..ca11e9d6e5 --- /dev/null +++ b/astroquery/first/core.py @@ -0,0 +1,96 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst +from __future__ import print_function +from io import BytesIO +import astropy.units as u +import astropy.coordinates as coord +from astropy.io import fits +from ..query import BaseQuery +from ..utils import commons, prepend_docstr_nosections +from . import conf +from ..exceptions import InvalidQueryError + +__all__ = ['First', 'FirstClass'] + + +class FirstClass(BaseQuery): + URL = conf.server + TIMEOUT = conf.timeout + maximsize = 1024 + + def _args_to_payload(self, coordinates, image_size=1 * u.arcmin, + maximsize=None): + """ + Fetches image cutouts from FIRST survey. + + Parameters + ---------- + coordinates : str or `astropy.coordinates` object + The target around which to search. It may be specified as a + string in which case it is resolved using online services or as + the appropriate `astropy.coordinates` object. ICRS coordinates + may also be entered as strings as specified in the + `astropy.coordinates` module. + image_size : str or `~astropy.units.Quantity` object, optional + The string must be parsable by `astropy.coordinates.Angle`. The + appropriate `~astropy.units.Quantity` object from `astropy.units` + may also be used. Specifies the symmetric size of the + image. Defaults to 1 arcmin. + maximsize : int, optional + Specify the maximum image size (in pixels on each dimension) that + will be returned. Max is 2048. + """ + request_payload = {} + c = commons.parse_coordinates(coordinates).transform_to('icrs') + ra_dec_str = str(c.ra.hour) + ' ' + str(c.dec.degree) + request_payload["RA"] = ra_dec_str + request_payload["Equinox"] = "J2000" + request_payload["ImageSize"] = coord.Angle(image_size).arcmin + request_payload["ImageType"] = "FITS File" + request_payload["MaxImSize"] = self.maximsize if maximsize is None else maximsize + return request_payload + + @prepend_docstr_nosections("\n" + _args_to_payload.__doc__) + def get_images(self, coordinates, image_size=1 * u.arcmin, + get_query_payload=False): + """ + get_query_payload : bool, optional + if set to `True` then returns the dictionary sent as the HTTP + request. Defaults to `False` + + Returns + ------- + A list of `~astropy.io.fits.HDUList` objects + """ + response = self.get_images_async(coordinates, image_size=image_size, + get_query_payload=get_query_payload) + if get_query_payload: + return response + S = BytesIO(response.content) + try: + return fits.open(S, ignore_missing_end=True) + except IOError: + raise InvalidQueryError(response.content) + + @prepend_docstr_nosections("\n" + _args_to_payload.__doc__) + def get_images_async(self, coordinates, image_size=1 * u.arcmin, + get_query_payload=False): + """ + get_query_payload : bool, optional + if set to `True` then returns the dictionary sent as the HTTP + request. Defaults to `False` + + Returns + ------- + response : `requests.Response` + The HTTP response returned from the service + """ + request_payload = self._args_to_payload( + coordinates, image_size=image_size) + if get_query_payload: + return request_payload + response = self._request("POST", url=self.URL, data=request_payload, + timeout=self.TIMEOUT, verify=False) + return response + + +First = FirstClass() diff --git a/astroquery/first/tests/__init__.py b/astroquery/first/tests/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/astroquery/first/tests/data/image.fits b/astroquery/first/tests/data/image.fits new file mode 100644 index 0000000000..a69c6fffea --- /dev/null +++ b/astroquery/first/tests/data/image.fits @@ -0,0 +1,13 @@ +SIMPLE = T / FIRST Cutout Server: Wed Jun 3 12:46:13 2020 BITPIX = -32 / 4-byte Floating Point NAXIS = 2 / Number of data axes NAXIS1 = 33 / NAXIS2 = 33 / DATATYPE= 'REAL*4 ' / Floating Point DATE = '2020-06-03' / Creation UTC (CCCC-MM-DD) date of FITS header COMMENT FITS (Flexible Image Transport System) format is defined in 'Astronomy COMMENT and Astrophysics', volume 376, page 359; bibcode 2001A&A...376..359H FIELDNAM= '10510+30456E' / FIRST coadded image name OBJECT = 'J105007+304037' / Object name (Ehhmmss+ddmmss, E=J or B) OBJCTRA = '10 50 07.200' / Object Right Ascension (J2000) OBJCTDEC= '+30 40 37.20' / Object Declination OBJCTX = 1151.69 / Object X in image (pixels) OBJCTY = 409.162 / Object Y in image XCORN = 1136 / X corner in image (pixels) YCORN = 393 / Y corner in image TELESCOP= 'VLA ' / INSTRUME= 'VLA ' / OBSERVER= 'AB628 ' / DATE-OBS= '19930417' / DATE-MAP= '19990820' / BUNIT = 'JY/BEAM ' / EPOCH = 2000.00 / EQUINOX = 2000.00 / DATAMAX = 0.0390592 / DATAMIN = -0.000806942 / CTYPE1 = 'RA---SIN' / CRVAL1 = 162.750000000 / CDELT1 = -0.000500000 / CRPIX1 = -361.737 / CROTA1 = 0.00000 / CTYPE2 = 'DEC--SIN' / CRVAL2 = 30.7600000000 / CDELT2 = 0.000500000 / CRPIX2 = 182.790 / CROTA2 = 0.00000 / CTYPE3 = 'FREQ ' / CRVAL3 = 1364900000.00 / CDELT3 = 2.18750E+07 / CRPIX3 = 1.00000 / CROTA3 = 0.00000 / CTYPE4 = 'STOKES ' / CRVAL4 = 1.00000000000 / CDELT4 = 1.00000 / CRPIX4 = 1.00000 / CROTA4 = 0.00000 / BMAJ = 1.5000E-03 / Beam major axis (deg) BMIN = 1.5000E-03 / Beam minor axis (deg) BPA = 0.00 / Beam position angle (deg) HISTORY AIPS CLEAN BMAJ= 1.5000E-03 BMIN= 1.5000E-03 BPA= 0.00 HISTORY AIPS CLEAN NITER= 3 PRODUCT=1 / NORMAL HISTORY AIPS IMNAME='10510+30456E' IMCLASS='COADD' IMSEQ= 1 / HISTORY AIPS USERNO= 111 / HISTORY HISTORY The FIRST VLA Survey: Copyright 1997 University of California HISTORY Permission is granted for publication and reproduction of this HISTORY material for scholarly, educational, and private non-commercial HISTORY use. Inquiries for potential commercial uses should be HISTORY addressed to: HISTORY Robert Becker HISTORY Physics Dept HISTORY University of California HISTORY Davis, CA 95616 HISTORY HISTORY ----------------------------------------------------------- HISTORY The VLA FIRST Survey HISTORY HISTORY R.H. Becker R.L. White D.J. Helfand HISTORY UC Davis and IGPP, LLNL STScI Columbia University HISTORY HISTORY The FIRST survey (Faint Images of the Radio Sky at Twenty-cm) is a HISTORY high angular resolution survey of the North Galactic Cap intended to HISTORY match the 10,000 deg**2 survey area of the Sloan Digital Sky Survey HISTORY (Gunn and Knapp 1992 PASP 43, 267). Observations are made in the HISTORY VLA's B configuration operating at frequencies of 1365 and 1435 MHz in HISTORY the bandwidth synthesis mode. The synthesized beam has a FWHM of 5.4". HISTORY Each field is observed for 3 minutes, resulting in a typical image rms HISTORY of <0.15 mJy/beam. The raw UV data from the observations are archived HISTORY at the VLA and are available on the day they are taken without the HISTORY standard proprietary period. The fully self-calibrated UV datasets HISTORY for each pointing are also archived at the NRAO. HISTORY HISTORY Source positions derived from FIRST images have an error of 0.5" rms HISTORY for the weakest discernible point sources (~0.75 mJy) and HISTORY substantially smaller uncertainties for brighter sources. The source HISTORY surface density is ~100 per square degree. The grid of images on the HISTORY sky is sufficiently dense that considerable improvement in sensitivity HISTORY can be obtained by coadding adjacent fields. These coadded images HISTORY are named HHMMM+-DDMMM (with implied decimal points before the final HISTORY M's) corresponding to the J2000 coordinates of the field center to the HISTORY nearest 6"; e.g., the field centered at 07 42 00 +30 45 36 is named HISTORY 07420+30456. The images have 1.8" x 1.8" pixels, and vary in size HISTORY depending on declination. HISTORY HISTORY Details of the survey design, pipeline processing algorithms, and HISTORY catalog generation may be found in Becker et al. 1995 and White et al. HISTORY 1997; these papers, along with further information on FIRST, are HISTORY retrievable via the FIRST WWW home page: http://sundog.stsci.edu/ . HISTORY Users interested in deriving quantitative information from the maps for HISTORY scientific purposes are advised to read the FIRST papers first. HISTORY Questions or comments on the FIRST survey should be addressed to HISTORY Bob Becker at bob@igpp.ucllnl.org or 510-423-0664. END 9:"8ʸx^=*5@NI{L + 7u8_E(a8988R׿4i- L]78zk׸VM*й๞7d87»EX7-7E7lCU7Z-?๨B16o8e7k8E98+8./ѹ+ l9|le44zYz5tSM!}A!8GnƸxkIս7H.7j67˹?-88-8C9&9b,9k?8f{Ѹr9gM8,7Ź@e48\x4й*I@?~ȸҹq޹svLP8k#8d8[G8L8j98#m6>8e(ɸ_?,998@91k998B7I98O|7d7e8Ƕ1#/蹋cSz6iz,w#;QK8y?GไFa8Y8g8l9Vq9T\9:!: 9o9M9c9Z#9HE gc9xj9GD-ԹoN0Z񕊹[ݢ0Ft] \C|UЀu9<9k9{s9::]H:^::Wwn: +s9˛94Y8B8q]99 [\aH繡("@븖 Z(: ߸^=*ԸjT-R899O?9oE::fA:V::\:G:$:H:o.:/''9}7fTJ}9+@8ǦWlK8w^n |18S59y9.p8GT8 |9j9:U:|[:-; Q;,Y;Da;7;RE::D:59 94*8^ LP9> ?868+8 ø~ +8α9TЬ8999 99#WK9~U9[+:OΈ:;*h;yY;+;=$;<;D}:':Sm::: -9¶9*}8)9?ꎶ>ϸ8989Ap9C 8[]7969)799V9"N6,Q8V9:S;- ; ;;ּ;|;0;f];::SZ:65:ˇ9Q퉸:U9 θY +lN9798B9;9\8<799~8Rf>So>r:1:4!;Kg;ڗ;;jU;;';f:V::Fa:'9929C֪a۹?rċ8ʏ9~ 86,+M^7Qx9cE9/9?:`;e;}4;";:& :b:z=::d:<;I;Fl;k ;VIM;:Q91z9g9:8 9: !M7\99;}C789*y8PmD7 :\ ;8;eEw;k<};%t::ٞS;;;";T7;;{ͷ;::;:9P +948-M99!۸D b9"'8Dž8?9}e9Q"9>8\8H:T_:F;8;D&;'&;;`;.Oy;5D;+!;4{;=;$:N:?9L8TK8RC8N^syE|.޸۸ d9K8ԍ9) 99 9:F9:d/:nQ:t;g;@;%;};vV;:1:B:E:K9 5R~b \($ø8pUHA,4C94R9/8|a89[9ӵN9NY9A&9:OL:/:a:Z:::&:y:,:2 +99rO8 H"Yt͸ڳ6u XɳwAH9WY8P88w899nL99nR9$:5:N:%6: }m: 99ح9o9Y9|9/80F9L!8rckpO8a_7#Z,4⹙7`9209`9ES9#8ߠ9J939+r919C9q9Ӎ9}ѐ9o +ϳ?7o鸾\*9djV8M7 aLv@8ж)8S|93^ ۓ9(8Hv7,ܣT_cJz919 or\˸q69mN9/Sr938h7$88^;r@O79 o2IǹlBX#IՄ"׸#60nָ(6l<ܹIع`1t{|߮&X,I89`R9p99*-29 8y9j=9[f9*9W8ΜZ߸Rи-Qa1p[}<(ѹje:M/`( +zkȺX2%zs79F9)9999]g83}9P*9Q9G9ŀ99~L߸^B8B9Kl8ϙ$8޶&7w.ߛCQ3qHAvX n}[|go]ѹR9m998:9Զ9 69g9qN9:JV9Q|919l9D4?9)NY85f@9JX99z9/ +m9d9 9Z$9%@8| 99J197 999he99׍:9d9ع:˼9f9)T9698u&@U7k9]9y9mMmE9 9j垷99w"8H"9f9G9}9 +9%q 9Z89Y99W848Ó9f@9~j8&]"B939wF8V/9999)29̧99808^ \ No newline at end of file diff --git a/astroquery/first/tests/setup_package.py b/astroquery/first/tests/setup_package.py new file mode 100644 index 0000000000..7f7b53d7ef --- /dev/null +++ b/astroquery/first/tests/setup_package.py @@ -0,0 +1,10 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst +from __future__ import absolute_import + +import os + + +def get_package_data(): + paths = [os.path.join('data', '*.fits'), + ] + return {'astroquery.first.tests': paths} diff --git a/astroquery/first/tests/test_first.py b/astroquery/first/tests/test_first.py new file mode 100644 index 0000000000..e04a476a19 --- /dev/null +++ b/astroquery/first/tests/test_first.py @@ -0,0 +1,63 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst +from __future__ import print_function + +import os + +import numpy.testing as npt +import pytest +import astropy.units as u + +from ...utils import commons +from ...utils.testing_tools import MockResponse +from ... import first + +DATA_FILES = {'image': 'image.fits'} + + +def data_path(filename): + data_dir = os.path.join(os.path.dirname(__file__), 'data') + return os.path.join(data_dir, filename) + + +@pytest.fixture +def patch_parse_coordinates(request): + def parse_coordinates_mock_return(c): + return c + try: + mp = request.getfixturevalue("monkeypatch") + except AttributeError: # pytest < 3 + mp = request.getfuncargvalue("monkeypatch") + mp.setattr(commons, 'parse_coordinates', parse_coordinates_mock_return) + return mp + + +@pytest.fixture +def patch_post(request): + try: + mp = request.getfixturevalue("monkeypatch") + except AttributeError: # pytest < 3 + mp = request.getfuncargvalue("monkeypatch") + mp.setattr(first.First, '_request', post_mockreturn) + return mp + + +def post_mockreturn(method, url, data, timeout, **kwargs): + filename = data_path(DATA_FILES['image']) + content = open(filename, 'rb').read() + return MockResponse(content, **kwargs) + + +def test_get_images_async(patch_post, patch_parse_coordinates): + response = first.core.First.get_images_async( + commons.ICRSCoordGenerator(162.530, 30.677, unit=(u.deg, u.deg)), + image_size=0.2 * u.deg, get_query_payload=True) + npt.assert_approx_equal(response['ImageSize'], 12, significant=3) + response = first.core.First.get_images_async( + commons.ICRSCoordGenerator(162.530, 30.677, unit=(u.deg, u.deg))) + assert response is not None + + +def test_get_images(patch_post, patch_parse_coordinates): + image = first.core.First.get_images( + commons.ICRSCoordGenerator(162.530, 30.677, unit=(u.deg, u.deg))) + assert image is not None diff --git a/astroquery/first/tests/test_first_remote.py b/astroquery/first/tests/test_first_remote.py new file mode 100644 index 0000000000..6cacd67889 --- /dev/null +++ b/astroquery/first/tests/test_first_remote.py @@ -0,0 +1,25 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst +from __future__ import print_function + +import pytest +import astropy.units as u +from astropy.coordinates import SkyCoord + +from ... import first + + +@pytest.mark.remote_data +class TestFirst: + + def test_get_images_async(self): + response = first.core.First.get_images_async( + SkyCoord(162.530, 30.677, unit=(u.deg, u.deg), frame='icrs'), + image_size='1 arcmin') + assert response is not None + + def test_get_images(self): + image = first.core.First.get_images( + SkyCoord(162.530, 30.677, unit=(u.deg, u.deg), frame='icrs'), + image_size='1 arcmin') + assert image is not None + assert image[0].data.shape == (33, 33) From 77a27b7cecbcdc16a44c54a3b00e4e033878ba27 Mon Sep 17 00:00:00 2001 From: Rick White Date: Mon, 8 Jun 2020 12:00:33 -0400 Subject: [PATCH 2/7] remove python2 compatibility code (__future__ imports, pytest<3) --- astroquery/first/core.py | 1 - astroquery/first/tests/setup_package.py | 1 - astroquery/first/tests/test_first.py | 12 ++---------- astroquery/first/tests/test_first_remote.py | 1 - 4 files changed, 2 insertions(+), 13 deletions(-) diff --git a/astroquery/first/core.py b/astroquery/first/core.py index ca11e9d6e5..71f9a9089a 100644 --- a/astroquery/first/core.py +++ b/astroquery/first/core.py @@ -1,5 +1,4 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst -from __future__ import print_function from io import BytesIO import astropy.units as u import astropy.coordinates as coord diff --git a/astroquery/first/tests/setup_package.py b/astroquery/first/tests/setup_package.py index 7f7b53d7ef..446cf4480d 100644 --- a/astroquery/first/tests/setup_package.py +++ b/astroquery/first/tests/setup_package.py @@ -1,5 +1,4 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst -from __future__ import absolute_import import os diff --git a/astroquery/first/tests/test_first.py b/astroquery/first/tests/test_first.py index e04a476a19..3a02207a98 100644 --- a/astroquery/first/tests/test_first.py +++ b/astroquery/first/tests/test_first.py @@ -1,6 +1,4 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst -from __future__ import print_function - import os import numpy.testing as npt @@ -23,20 +21,14 @@ def data_path(filename): def patch_parse_coordinates(request): def parse_coordinates_mock_return(c): return c - try: - mp = request.getfixturevalue("monkeypatch") - except AttributeError: # pytest < 3 - mp = request.getfuncargvalue("monkeypatch") + mp = request.getfixturevalue("monkeypatch") mp.setattr(commons, 'parse_coordinates', parse_coordinates_mock_return) return mp @pytest.fixture def patch_post(request): - try: - mp = request.getfixturevalue("monkeypatch") - except AttributeError: # pytest < 3 - mp = request.getfuncargvalue("monkeypatch") + mp = request.getfixturevalue("monkeypatch") mp.setattr(first.First, '_request', post_mockreturn) return mp diff --git a/astroquery/first/tests/test_first_remote.py b/astroquery/first/tests/test_first_remote.py index 6cacd67889..7891f717c4 100644 --- a/astroquery/first/tests/test_first_remote.py +++ b/astroquery/first/tests/test_first_remote.py @@ -1,5 +1,4 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst -from __future__ import print_function import pytest import astropy.units as u From 4377506893b829cc11ac44e52aba037fc46015e7 Mon Sep 17 00:00:00 2001 From: Rick White Date: Tue, 16 Jun 2020 17:31:52 -0400 Subject: [PATCH 3/7] Move first module to image_cutouts/first --- astroquery/{ => image_cutouts}/first/__init__.py | 0 astroquery/{ => image_cutouts}/first/core.py | 6 +++--- astroquery/{ => image_cutouts}/first/tests/__init__.py | 0 astroquery/{ => image_cutouts}/first/tests/data/image.fits | 0 astroquery/{ => image_cutouts}/first/tests/setup_package.py | 2 +- astroquery/{ => image_cutouts}/first/tests/test_first.py | 4 ++-- .../{ => image_cutouts}/first/tests/test_first_remote.py | 0 7 files changed, 6 insertions(+), 6 deletions(-) rename astroquery/{ => image_cutouts}/first/__init__.py (100%) rename astroquery/{ => image_cutouts}/first/core.py (96%) rename astroquery/{ => image_cutouts}/first/tests/__init__.py (100%) rename astroquery/{ => image_cutouts}/first/tests/data/image.fits (100%) rename astroquery/{ => image_cutouts}/first/tests/setup_package.py (73%) rename astroquery/{ => image_cutouts}/first/tests/test_first.py (95%) rename astroquery/{ => image_cutouts}/first/tests/test_first_remote.py (100%) diff --git a/astroquery/first/__init__.py b/astroquery/image_cutouts/first/__init__.py similarity index 100% rename from astroquery/first/__init__.py rename to astroquery/image_cutouts/first/__init__.py diff --git a/astroquery/first/core.py b/astroquery/image_cutouts/first/core.py similarity index 96% rename from astroquery/first/core.py rename to astroquery/image_cutouts/first/core.py index 71f9a9089a..5781e7f238 100644 --- a/astroquery/first/core.py +++ b/astroquery/image_cutouts/first/core.py @@ -3,10 +3,10 @@ import astropy.units as u import astropy.coordinates as coord from astropy.io import fits -from ..query import BaseQuery -from ..utils import commons, prepend_docstr_nosections +from ...query import BaseQuery +from ...utils import commons, prepend_docstr_nosections from . import conf -from ..exceptions import InvalidQueryError +from ...exceptions import InvalidQueryError __all__ = ['First', 'FirstClass'] diff --git a/astroquery/first/tests/__init__.py b/astroquery/image_cutouts/first/tests/__init__.py similarity index 100% rename from astroquery/first/tests/__init__.py rename to astroquery/image_cutouts/first/tests/__init__.py diff --git a/astroquery/first/tests/data/image.fits b/astroquery/image_cutouts/first/tests/data/image.fits similarity index 100% rename from astroquery/first/tests/data/image.fits rename to astroquery/image_cutouts/first/tests/data/image.fits diff --git a/astroquery/first/tests/setup_package.py b/astroquery/image_cutouts/first/tests/setup_package.py similarity index 73% rename from astroquery/first/tests/setup_package.py rename to astroquery/image_cutouts/first/tests/setup_package.py index 446cf4480d..bae5046ebd 100644 --- a/astroquery/first/tests/setup_package.py +++ b/astroquery/image_cutouts/first/tests/setup_package.py @@ -6,4 +6,4 @@ def get_package_data(): paths = [os.path.join('data', '*.fits'), ] - return {'astroquery.first.tests': paths} + return {'astroquery.image_cutouts.first.tests': paths} diff --git a/astroquery/first/tests/test_first.py b/astroquery/image_cutouts/first/tests/test_first.py similarity index 95% rename from astroquery/first/tests/test_first.py rename to astroquery/image_cutouts/first/tests/test_first.py index 3a02207a98..2fcf1ef4f7 100644 --- a/astroquery/first/tests/test_first.py +++ b/astroquery/image_cutouts/first/tests/test_first.py @@ -5,8 +5,8 @@ import pytest import astropy.units as u -from ...utils import commons -from ...utils.testing_tools import MockResponse +from ....utils import commons +from ....utils.testing_tools import MockResponse from ... import first DATA_FILES = {'image': 'image.fits'} diff --git a/astroquery/first/tests/test_first_remote.py b/astroquery/image_cutouts/first/tests/test_first_remote.py similarity index 100% rename from astroquery/first/tests/test_first_remote.py rename to astroquery/image_cutouts/first/tests/test_first_remote.py From 681158fcc7d57925b3e11c9c7b814b8f74aa7d16 Mon Sep 17 00:00:00 2001 From: Rick White Date: Tue, 16 Jun 2020 18:24:59 -0400 Subject: [PATCH 4/7] add blank __init__.py to image_cutouts --- astroquery/image_cutouts/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 astroquery/image_cutouts/__init__.py diff --git a/astroquery/image_cutouts/__init__.py b/astroquery/image_cutouts/__init__.py new file mode 100644 index 0000000000..e69de29bb2 From 6ab75bb5eac66c465574ff66ea0171843be8809a Mon Sep 17 00:00:00 2001 From: Rick White Date: Wed, 17 Jun 2020 11:53:36 -0400 Subject: [PATCH 5/7] add FIRST module documentation --- docs/image_cutouts/first/first.rst | 40 ++++++++++++++++++++++++++++ docs/image_cutouts/image_cutouts.rst | 27 +++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 docs/image_cutouts/first/first.rst create mode 100644 docs/image_cutouts/image_cutouts.rst diff --git a/docs/image_cutouts/first/first.rst b/docs/image_cutouts/first/first.rst new file mode 100644 index 0000000000..afc85830c2 --- /dev/null +++ b/docs/image_cutouts/first/first.rst @@ -0,0 +1,40 @@ +.. doctest-skip-all + +.. _astroquery.image_cutouts.first: + +************************************************ +FIRST Queries (`astroquery.image_cutouts.first`) +************************************************ + +Getting started +=============== + +This module may be used to fetch image cutouts in the FITS format from the +`Faint Images of the Radio Sky at Twenty-cm (FIRST) `_ +VLA radio survey. The only required parameter is the target you wish to search +for. This may be specified as a name - which is resolved online via astropy +functions or as coordinates using any of the coordinate systems available in +`astropy.coordinates`. The FITS image is returned as an +`~astropy.io.fits.HDUList` object. Here is a sample query: + +.. code-block:: python + + >>> from astroquery.image_cutouts.first import First + >>> from astropy import coordinates + >>> from astropy import units as u + >>> image = First.get_images(coordinates.SkyCoord(162.530*u.deg, 30.677*u.deg, + ... frame='icrs')) + >>> image + + [] + +There are some other optional parameters that you may additionally specify. +For instance the image size may be specified by setting the ``image_size`` +parameter. It defaults to 1 arcmin, but may be set to another value using the +appropriate `~astropy.units.Quantity` object. + +Reference/API +============= + +.. automodapi:: astroquery.image_cutouts.first + :no-inheritance-diagram: diff --git a/docs/image_cutouts/image_cutouts.rst b/docs/image_cutouts/image_cutouts.rst new file mode 100644 index 0000000000..1e0e1c5271 --- /dev/null +++ b/docs/image_cutouts/image_cutouts.rst @@ -0,0 +1,27 @@ +.. doctest-skip-all + +.. _astroquery.image_cutouts: + +************************************************ +Image Cutout Services (`astroquery.image_cutouts`) +************************************************ + +This submodule is a collection of image cutout services, +sorted by the projects that provide these services. + +.. + Modules, classes, and functions in this submodule can be imported as part of + this submodule or directly from their top-level modules. + +The currently available service providers and services are: + +.. toctree:: + :maxdepth: 1 + + first/first.rst + +Reference/API +============= + +.. automodapi:: astroquery.image_cutouts + :no-inheritance-diagram: From a619c85d001322690ed1b4b0e52988e26575db81 Mon Sep 17 00:00:00 2001 From: Rick White Date: Wed, 17 Jun 2020 12:09:34 -0400 Subject: [PATCH 6/7] change FIRST link location to be in image_cutouts subdirectory --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 80dee99f15..6cfb46032e 100644 --- a/README.rst +++ b/README.rst @@ -107,7 +107,7 @@ The following modules have been completed using a common API: * `CADC `_: Canadian Astronomy Data Centre. * `ESASky `_: ESASky is a science driven discovery portal providing easy visualizations and full access to the entire sky as observed with ESA Space astronomy missions. * `ESO Archive `_ - * `FIRST `_: Faint Images of the Radio Sky at Twenty-cm. 20-cm radio images of the extragalactic sky from the VLA. + * `FIRST `_: Faint Images of the Radio Sky at Twenty-cm. 20-cm radio images of the extragalactic sky from the VLA. * `Gaia `_: European Space Agency Gaia Archive. * `GAMA database `_ * `Gemini `_: Gemini Archive. From 9e6acedc5604869be7f5db4fedd3682c2f3545c0 Mon Sep 17 00:00:00 2001 From: Rick White Date: Wed, 17 Jun 2020 12:34:15 -0400 Subject: [PATCH 7/7] fix bugs in doc build: overline too short in image_cutouts.rst, add image_cutouts to toctree in index.rst, fix reference to astroquery.first in first/__init__.py --- astroquery/image_cutouts/first/__init__.py | 2 +- docs/image_cutouts/image_cutouts.rst | 4 ++-- docs/index.rst | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/astroquery/image_cutouts/first/__init__.py b/astroquery/image_cutouts/first/__init__.py index a3b6ef906a..ab47590eb4 100644 --- a/astroquery/image_cutouts/first/__init__.py +++ b/astroquery/image_cutouts/first/__init__.py @@ -14,7 +14,7 @@ class Conf(_config.ConfigNamespace): """ - Configuration parameters for `astroquery.first`. + Configuration parameters for `astroquery.image_cutouts.first`. """ server = _config.ConfigItem( ['https://third.ucllnl.org/cgi-bin/firstcutout'], diff --git a/docs/image_cutouts/image_cutouts.rst b/docs/image_cutouts/image_cutouts.rst index 1e0e1c5271..5eb98ee6fa 100644 --- a/docs/image_cutouts/image_cutouts.rst +++ b/docs/image_cutouts/image_cutouts.rst @@ -2,9 +2,9 @@ .. _astroquery.image_cutouts: -************************************************ +************************************************** Image Cutout Services (`astroquery.image_cutouts`) -************************************************ +************************************************** This submodule is a collection of image cutout services, sorted by the projects that provide these services. diff --git a/docs/index.rst b/docs/index.rst index 6b35e9c1d0..26f767f557 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -350,6 +350,7 @@ topical submodules: :maxdepth: 1 solarsystem/solarsystem.rst + image_cutouts/image_cutouts.rst Developer documentation