Skip to main content
[![Build Status](https://travis-ci.org/adsabs/adsutils.svg?branch=master)](https://travis-ci.org/adsabs/adsutils)
[![Coverage Status](https://coveralls.io/repos/github/adsabs/adsutils/badge.svg?branch=master)](https://coveralls.io/github/adsabs/adsutils?branch=master)

ADSutils
========

This is a module with various ADS specific utilities

## Installing
If you just want to work with these utilities, you can install `adsutils` with pip. It is still advisable to use it in a virtual environment. In your virtual environment just do
```
pip install adsutils
```
and you should be all set to go. This has been tested under MacOS X, CentOS and Ubuntu with Python 2.7.

In case you want to work with the code: clone the repo to a local directory
```
git clone https://github.com/adsabs/adsutils adsutils
```
Go into the newly created directory and create a virtual environment
```
virtualenv --no-site-packages -ppython2.7 venv
```
and start it
```
source venv/bin/activate
```
Update `pip` like
```
pip install -U pip
```
and then install the required software
```
pip install -r requirements.txt
```
Test if things are working:
```
python adsutils/test/nosetests.py
```
## Utility to create bibcodes

Import the relevant module:
```
from adsutils import make_bibcode
```
and provide the necessary metadata:
```
data = {"year":"2006",
"bibstem":'PhRvL',
"volume":"96",
"page":"295701",
"author":'Grünwald, Michael',
}
```
and then call
```
bibcode = make_bibcode(data)
```
and a bibcode will get generated. You will have to determine the correct journal abbreviation (bibstem). The journal abbreviations are available here: http://adsabs.harvard.edu/abs_doc/journals2.html

## Utility to resolve reference strings

Import the relevant module:
```
from adsutils import resolve_references
```
You can provide reference data in various formats:
* A single reference string
* A newline-separated set of reference strings
* A (Python) list of reference strings

Examples:
A case with just one reference string:
```
refdata = 'Hermsen, W., et. al. 1992, IAU Circ. No. 5541'
result = resolve_references(refdata)
```
in which case the result (always a list of dictionaries) will look like
```
[{'refstring': u'Hermsen, W., et. al. 1992, IAU Circ. No. 5541',
'confidence': 'Success',
'bibcode': u'1992IAUC.5541....1H'
}]
```
Multiple reference strings work as follows:
```
refdata = ['J. B. Gupta, and J. H. Hamilton, Phys. Rev. C 16, 427 (1977)', 'Pollock, J. T. 1982, Ph. D. Thesis, University of Florida']
result = resolve_references(refdata)
```
in which case the result (always a list of dictionaries) will look like
```
[{'refstring': u'J. B. Gupta, and J. H. Hamilton, Phys. Rev. C 16, 427 (1977)',
'confidence': 'Success',
'bibcode': u'1977PhRvC..16..427G'},
{'refstring': u'Pollock, J. T. 1982, Ph. D. Thesis, University of Florida',
'confidence': 'Success',
'bibcode': u'1982PhDT.........1P'}]
```
# Possible outcome
The resolver can return three classes of 'confidence' levels:
* Success
* Failed
* Not verified

The only class that needs some explanation is the last one; it is quite possible that the metadata contains enough information to guess a bibcode. The year could be off by 1 (which can also apply to the page or volume number) or a journal was abbreviated in a non-standard way. It is also possible that all the metadata is correct, but the record is not in the ADS database. Even though a bibcode is returned, you cannot assume it is correct. These <em>Not verified</em> cases need further inspection.

## Utility to get ADS journal abbreviation from publication name

An essential part of the ADS publication identifier (<em>bibcode</em>) is the publication abbreviation (<em>bibstem</em>). This utility takes a string representing the publication name and attempts to match it to an ADS abbreviation. It returns a list of candidates and associated scores.

Import the relevant module:
```
from adsutils import get_pub_abbreviation
```
The bibstem candidates are then found as follows:
```
pubstring = 'American Astronautical Society Meeting'
result = get_pub_abbreviation(pubstring)
```
which returns a list of tuples with candidates and their associated scores (sorted by score, descending):
```
[(1.0, 'aans.meet'), (0.98545706272125244, 'AAS......'), (0.95637118816375732, 'aans.symp'), (0.93698060512542725, 'AAS......'), (0.91897505521774292, 'acs..meet')]
```
You can specify that you are only interested in exact matches in the following way:
```
pubstring = 'Astrophysical Journal'
result = get_pub_abbreviation(pubstring, exact=True)
```
which would result in
```
[(1, 'ApJ......')]
```
while
```
pubstring = 'Astrophysical Journ'
result = get_pub_abbreviation(pubstring, exact=True)
```
would result in
```
[]
```

Metadata

Release files for adsutils 1.0.33

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adsutils 1.0.33
File Size Uploaded Provenance
adsutils-1.0.33.tar.gz 567.9 kB Without provenance Details

Release files / adsutils-1.0.33.tar.gz

Download URL adsutils-1.0.33.tar.gz
Size 567.9 kB
Tags Source
SHA-256 checksum
How to use checksums
fb9e6d07af4b8e627416cb7e0b088a8c650e18534864a51cb40c45187ad4ad2a
BLAKE2b-256 checksum
How to use checksums
c4d9471a9b5f509b05bbfd887d9519fca92fab08f9b4ddbf4c7c626536e7e3c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for adsutils 1.0.33

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.33 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page