Querying ADS from IDL



This page gives information about how to query the ADS abstracts service from IDL. The software should be useful for IDL programmers who would like to efficiently maintain publication lists. Further technical details related to the software are available in a separate document.

The routines are available from the GitHub repository https://github.com/pryoung/cit-ads. Prior to October 2023 the routines were distributed through SolarSoft but they have now been removed.

Obtaining an API key

You will first need to create an account on the modern ADS system: go to https://ui.adsabs.harvard.edu/. If you already have an account on their old system, then you'll still have to create a new account.

Once you've created the account go to Account -> Customize Settings -> API Token. You can then generate a new key for yourself.

Save this string and put it in the file $HOME/.ads/dev_key on your computer. The file dev_key only contains the key token.

Information for a single article

If you have the bibcode for an article, then you can extract information for it by doing:

IDL> str=cit_get_ads_entry('2015ApJ...799..218Y')

The result is a structure with a number of tags. Note that some of the tags are IDL lists. For example:

IDL> n_authors=str.author.count()
IDL> for i=0,n_authors-1 do print,str.author[i]

You may notice that for conference proceedings some basic information, such as editors and conference series, is missing from the output structure. To get these I have to extract them from the article's Bibtex entry (see below).

Constructing an author's publication list

If you're creating your own publication list, I suggest you go to the ADS webpage (https://ui.adsabs.harvard.edu/) and create an ADS library containing all of your publications. If your name is unique then this is straightforward, otherwise it will require a little work to filter out other authors' papers. Once an ADS library is created then you should check out the 'Metrics' section of the ADS page to look at various statistics.

If you want to go further and customize your list and/or do some processing in IDL, then you need to download the bibcodes for your publications. There are two options for this that are described below, and I recommend using the ORCID option.

The ORCID option

Follow the instructions at my page Linking your publications to your ORCID ID using ADS. You will have to wait about 24 hours for ORCID to synchronize with ADS.

Once this is done, you can retrieve the bibcodes for all of your publications by doing:

IDL> bibcodes=cit_author_papers([ORCID_ID],/orcid)

where [ORCID_ID] is a string containing your ORCID ID.

ADS export option

From your ADS library click the 'Export' button and select 'Bibtex'. Download this file and call it something like 'my_papers.bbl'.

You can then extract the bibcodes from this file by doing:

IDL> str=cit_bbl2str('my_papers.bbl')
IDL> bibcodes=str.id

Writing your publication list in html format

With your bibcodes now in IDL, you can write out your publication list in html format by doing:

IDL> cit_author_html,bibcodes,html='my_papers.html'

As an example of the output, see my own publication list.

Customization options

For example,

IDL> cit_author_html,str.id,html='my_papers.html',name='Dr A.B. Smith',author='Dr H.G. Jones',   link_author='http://jones.org',surname='Smith',ads_data=ads_data

The input NAME puts the specified name in the webpage title (should be the person to which the publication list belongs!).

The input AUTHOR specifies the person who created the file, and the name is put in the page footer (note that this name may be different from the NAME input).

The input LINK_AUTHOR allows a link for the author to be specified.

The input SURNAME uses the specified surname to compute first author statistics for the publication list, which are printed to the IDL screen (not to the webpage).

If you maintain an ADS library for your publications, then you can set the input ADS_LIBRARY to the URL for the ADS library and a link will be added to the html page.

Note that I use all of these options for creating my own publication list.

The optional output ADS_DATA is an IDL structure that contains information on all of your publications. It can be generated outside of cit_author_html by doing:

IDL> ads_data=cit_get_ads_entry(bibcodes)

Downloading the bibtex entry for a publication

The bibtex entry for a bibcode can be accessed through:

IDL> bib=cit_get_ads_bibtex('2015ApJ...799..218Y')

which returns a string array. Some parts of the bibtex string can be extracted to a structure using:

IDL> str=cit_process_bibtex(bib)

in particular, I use this to extract conference proceedings data not available with cit_get_ads_entry.


Page maintained by Dr Peter Young.