Skip to content

Commit 586c1e4

Browse files
tinuademargaretbsipocz
authored andcommitted
nasa_ads
1 parent 3cdf684 commit 586c1e4

File tree

1 file changed

+11
-22
lines changed

1 file changed

+11
-22
lines changed

docs/nasa_ads/nasa_ads.rst

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

53
****************************************
@@ -23,36 +21,30 @@ Examples
2321
Search works by specific identifier
2422
-----------------------------------
2523
.. code-block:: python
24+
.. doctest-skip::
2625

27-
from astroquery import nasa_ads as na
28-
26+
>>> from astroquery import nasa_ads as na
2927
# if you don't store your token as an environment variable
3028
# or in a file, give it here
31-
na.ADS.TOKEN = 'your-token-goes-here'
32-
29+
>>> na.ADS.TOKEN = 'your-token-goes-here'
3330
# by default, the top 10 records are returned, sorted in
3431
# reverse chronological order. This can be changed
35-
3632
# change the number of rows returned
37-
na.ADS.NROWS = 20
33+
>>> na.ADS.NROWS = 20
3834
# change the sort order
39-
na.ADS.SORT = 'bibcode desc'
35+
>>> na.ADS.SORT = 'bibcode desc'
4036
# change the fields that are returned (enter as strings in a list)
41-
na.ADS.ADS_FIELDS = ['author','title','abstract','pubdate']
42-
37+
>>> na.ADS.ADS_FIELDS = ['author','title','abstract','pubdate']
4338
# the "^" makes ADS to return only papers where Persson
4439
# is first author
45-
results = na.ADS.query_simple('^Persson Origin of water\
46-
around deeply embedded low-mass protostars') results[0].title
47-
40+
>>> results = na.ADS.query_simple('^Persson Origin of water around deeply embedded low-mass protostars')
41+
>>> results[0].title
4842
# to sort after publication date
49-
results.sort(['pubdate'])
50-
43+
>>> results.sort(['pubdate'])
5144
# get the title of the last hit
52-
title = results[-1]['title'][0]
53-
45+
>>> title = results[-1]['title'][0]
5446
# printout the authors of the last hit
55-
print(results[-1]['author'])
47+
>>> print(results[-1]['author'])
5648

5749

5850
Reference/API
@@ -64,6 +56,3 @@ Reference/API
6456
.. _nasa_ads: http://adsabs.harvard.edu/
6557
.. _SAO/NASA Astrophysics Data System: https://ui.adsabs.harvard.edu/
6658
.. _account settings.: https://ui.adsabs.harvard.edu/#user/settings/token
67-
68-
69-

0 commit comments

Comments
 (0)