Skip to content

Commit 4d54b64

Browse files
authored
Merge pull request #1941 from tinumide/alfalfa-doc-cleanup
Alfalfa documentation clean up
2 parents 68b408a + 8f330cf commit 4d54b64

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

astroquery/alfalfa/core.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,21 @@ def get_catalog(self):
4545
return self.ALFALFACAT
4646

4747
result = requests.get(self.CATALOG_PREFIX)
48-
iterable_lines = result.iter_lines()
48+
iterable_lines = result.text.split('\n')
4949

5050
# Read header
51-
cols = [col for col in next(iterable_lines).rstrip('\n').split(',')]
51+
cols = iterable_lines[0].split(',')
5252

5353
catalog = {}
5454
for col in cols:
5555
catalog[col] = []
5656

5757
# Parse result
58-
for line in iterable_lines:
58+
for line in iterable_lines[1:]:
5959
# skip blank lines or trailing newlines
6060
if line == "":
6161
continue
62-
col_values = line.rstrip('\n').split(',')
62+
col_values = line.split(',')
6363
for i, col in enumerate(cols):
6464
item = col_values[i].strip()
6565
if item == '\"\"':

docs/alfalfa/alfalfa.rst

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
.. doctest-skip-all
2-
31
.. _astroquery.alfalfa:
42

53
ALFALFA Queries (`astroquery.alfalfa`)
@@ -12,12 +10,14 @@ This example shows how to perform an object cross-ID with ALFALFA. We'll start
1210
with the position of a source that exists in another survey (same object we
1311
used in the SDSS example).
1412

15-
.. code-block:: python
13+
.. doctest-remote-data::
1614

1715
>>> from astroquery.alfalfa import Alfalfa
1816
>>> from astropy import coordinates as coords
1917
>>> pos = coords.SkyCoord('0h8m05.63s +14d50m23.3s')
2018
>>> agc = Alfalfa.query_region(pos, optical_counterpart=True)
19+
>>> agc
20+
100051
2121

2222
This retrieves the AGC number of the object closest to the supplied ra and dec
2323
(within search radius dr=3 arcminutes by default). The "optical_counterpart" keyword
@@ -27,19 +27,25 @@ determined by members of the ALFALFA team), rather than their radio centroids.
2727
The AGC number is an identification number for objects in the ALFALFA survey,
2828
and once we know it, we can download spectra (if they are available) easily,
2929

30-
.. code-block:: python
30+
.. Remove the skip once #2403 is fixed
31+
.. .. doctest-remote-data::
32+
.. doctest-skip::
3133

3234
>>> sp = Alfalfa.get_spectrum(agc)
3335

34-
This returns a PyFITS HDUList object. If we want to have a look at the entire ALFALFA catalog, we can do that too:
36+
This returns a `~astropy.io.fits.HDUList` object. If we want to have a look at the
37+
entire ALFALFA catalog as a dictionary, we can do that too:
3538

36-
.. code-block:: python
39+
.. doctest-remote-data::
3740

3841
>>> cat = Alfalfa.get_catalog()
42+
>>> cat.keys()
43+
dict_keys(['AGCNr', 'Name', 'RAdeg_HI', 'Decdeg_HI', 'RAdeg_OC', 'DECdeg_OC', 'Vhelio', 'W50', 'errW50', 'HIflux', 'errflux', 'SNR', 'RMS', 'Dist', 'logMsun', 'HIcode', 'OCcode', 'NoteFlag'])
3944

4045
which returns a dictionary containing HI measurements for nearly 16,000
4146
objects.
4247

48+
4349
Reference/API
4450
-------------
4551

0 commit comments

Comments
 (0)