pyastroapi

Subpackages

Submodules

Package Contents

Classes

article

journal

libraries

This is a collection of ADS libraries that supports iteration

library

An instance of a single ADS library

Functions

search(query[, limit, fields, dbg])

Performs an ADS search

first_author(author[, limit, fields, dbg])

Performs an ads search equivalent to: ^author

author_year(author, year[, limit, fields, dbg])

Performs an ads search equivalent to: ^author year:year

orcid(orcid[, limit, fields, dbg])

Performs an ads search equivalent to: orcid:orcid

bibcode(bibcode[, limit, fields, dbg])

Searches for a given bibcode

citations(bibcode[, limit, fields, dbg])

Gets citations to paper given by bibcode

references(bibcode[, limit, fields, dbg])

Get the papers referenced by paper given by bibcode

astro_ph([limit, fields, dbg])

Gets the previous (working) days Arxiv postings

Attributes

__version__

pyastroapi.__version__
class pyastroapi.article(bibcode: str = None, data: Dict = None, bibtex: str = None, search: str = None)
property export
property metrics
property visual
property pdf
property url
property first_author: str

Return the first author of the paper.

Returns:

_description_

Return type:

str

property authors: List[str]

Return a list of authors

property name: str

Make a pretty name for the paper (First author year)

property title: str

Return the paper title.

Returns:

_description_

Return type:

str

from_bibcode(bibcode: str)

Set the article to point to the paper given by bibcode

Parameters:

bibcode (str) – ADS bibcode

from_data(data: Dict)

Initialize given a dict containing atleast a bibcode key

Parameters:

data (t.Dict) – Dictionary of data

from_bibtex(bibtex: str)

Initialize given a bibtex fragment

Parameters:

bibtex (str) – A bibtex document as a string

Perform a search of ADS and return only the first result

Parameters:

search (str) – An ADS search query

abstract add_to_lib(library: str)

Add article to the ADS library

Parameters:

library (str) – An existing ADS library

Raises:

NotImplementedError – _description_

__getattr__(attr: str)
_identifer()
keys()

Return all available fields

Returns:

_description_

Return type:

_type_

items()
values()
__hash__()

Return hash(self).

__eq__(value)

Return self==value.

__str__()

Return str(self).

__repr__()

Return repr(self).

__dir__()

Default dir() implementation.

as_dict()
references()

Get a journal of references to this paper.

Returns:

_description_

Return type:

_type_

reference_count() int

Get a count of the references to this paper.

Returns:

_description_

Return type:

int

citations()

Get the citations to this paper.

Returns:

_description_

Return type:

_type_

__getstate__()
__setstate__(state)
class pyastroapi.journal(bibcodes: List = None, data: List = None, bibtex: str = None, search: str = None)
property export
property metrics
property visual
from_bibcodes(bibcodes: List)

Initialize from a list of bibcodes

Parameters:

bibcodes (t.List) –

Returns:

self

from_data(data: List)

Initialize from a list of dict-like objects

Each element must have at least a “bibcode” key

Parameters:

data (t.List) – List of dict-like objects

from_bibtex(bibtex: str)

Initialize from a bibtex string

Parameters:

bibtex (str) – A bibtex string of one or more bibtex’s

Initialize from an ADS search

Parameters:

search (str) – ADS query string

from_articles(data: List)

Initialize from list of articles

Parameters:

data (t.List) – List of articles

add_bibcode(bibcode: List)

Add papers given by bibcodes

Parameters:

bibcode (t.List) – List of bibcodes

add_data(data: List)

Add papers from list of dict-like objects

Parameters:

data (t.List) – List of dict-like objects. Each element must have at least “bibcode” as a key

add_articles(data: List)

Add papers from a list of articles

Parameters:

data (t.List) – List of articles

add_bibtex(bibtex: str)

Add papers from bibtex

Parameters:

bibtex (str) – One of more bibtex’s

bibcodes()

Returns the list of bibcodes in the journal

Returns:

List of bibcodes

Return type:

bibcodes (list)

__getitem__(bibcode)
__len__()
keys()

Return list of keys (bibcodes)

items()

Returns the items (bibcode and article) for each paper.

values()

Return stored values

Returns:

_description_

Return type:

_type_

__contains__(key: str)
__iter__()
__dir__()

Default dir() implementation.

__getattr__(attr)
pop(bibcodes)

Remove one or more bibcodes

Parameters:

bibcodes (str or list[str]) – One or more bibcodes to remove

__str__()

Return str(self).

__getstate__()
__setstate__(state)
citations()

Get the citations to all papers in journal.

This does remove duplicates

Returns:

_description_

Return type:

_type_

references()

Get the references to all papers in the journal

This does remove duplicates

Returns:

_description_

Return type:

_type_

citation_count(uniq=False) int

Return count of citations to all papers in journal

Parameters:

uniq (bool, optional) – If true remove duplicated citations. Defaults to False.

Returns:

Count of all citations

Return type:

int

reference_count(uniq=False) int

Return count of references to all papers in journal

Parameters:

uniq (bool, optional) – If true remove duplicated references. Defaults to False.

Returns:

Count of all references

Return type:

int

pyastroapi.search(query: str, limit: int = -1, fields: List[str] = None, dbg: bool = False)

Performs an ADS search

Parameters:
  • query (str) – Search query

  • limit (int, optional) – Number of rows to limit to (-1 is no limit). Defaults to -1.

  • fields (t.List[str], optional) – ADS fields to return, if None returns a default set of fields.

  • dbg (bool, optional) – Debugging flag. Defaults to False.

Returns:

Returns a generator where each element is a dict for each ADS record, with keys given by the fields

Return type:

generator

pyastroapi.first_author(author: str, limit: int = -1, fields: List[str] = None, dbg: bool = False)

Performs an ads search equivalent to: ^author

Parameters:
  • author (str) – Author to search for

  • limit (int, optional) – Number of rows to limit to (-1 is no limit). Defaults to -1.

  • fields (t.List[str], optional) – ADS fields to return, if None returns a default set of fields.

  • dbg (bool, optional) – Debugging flag. Defaults to False.

Returns:

Returns a generator where each element is a dict for each ADS record, with keys given by the fields

Return type:

generator

pyastroapi.author_year(author, year, limit: int = -1, fields: List[str] = None, dbg: bool = False)

Performs an ads search equivalent to: ^author year:year

Parameters:
  • author (str) – Author to search for

  • year (int) – Year to limit to

  • limit (int, optional) – Number of rows to limit to (-1 is no limit). Defaults to -1.

  • fields (t.List[str], optional) – ADS fields to return, if None returns a default set of fields.

  • dbg (bool, optional) – Debugging flag. Defaults to False.

Returns:

Returns a generator where each element is a dict for each ADS record, with keys given by the fields

Return type:

generator

pyastroapi.orcid(orcid: str, limit: int = -1, fields: List[str] = None, dbg: bool = False)

Performs an ads search equivalent to: orcid:orcid

Parameters:
  • orcid (str) – ORCID

  • limit (int, optional) – Number of rows to limit to (-1 is no limit). Defaults to -1.

  • fields (t.List[str], optional) – ADS fields to return, if None returns a default set of fields.

  • dbg (bool, optional) – Debugging flag. Defaults to False.

Returns:

Returns a generator where each element is a dict for each ADS record, with keys given by the fields

Return type:

generator

pyastroapi.bibcode(bibcode: str, limit: int = -1, fields: List[str] = None, dbg: bool = False)

Searches for a given bibcode

Parameters:
  • bibcode (str) – Bibcode

  • limit (int, optional) – Number of rows to limit to (-1 is no limit). Defaults to -1.

  • fields (t.List[str], optional) – ADS fields to return, if None returns a default set of fields.

  • dbg (bool, optional) – Debugging flag. Defaults to False.

Returns:

Returns a generator where each element is a dict for each ADS record, with keys given by the fields

Return type:

generator

pyastroapi.citations(bibcode: str, limit: int = -1, fields: List[str] = None, dbg: bool = False)

Gets citations to paper given by bibcode

Parameters:
  • bibcode (str) – Bibcode

  • limit (int, optional) – Number of rows to limit to (-1 is no limit). Defaults to -1.

  • fields (t.List[str], optional) – ADS fields to return, if None returns a default set of fields.

  • dbg (bool, optional) – Debugging flag. Defaults to False.

Returns:

Returns a generator where each element is a dict for each ADS record, with keys given by the fields

Return type:

generator

pyastroapi.references(bibcode: str, limit: int = -1, fields: List[str] = None, dbg: bool = False)

Get the papers referenced by paper given by bibcode

Args:

bibcode (str): Bibcode limit (int, optional): Number of rows to limit to (-1 is no limit). Defaults to -1. fields (t.List[str], optional): ADS fields to return, if None returns a default set of fields. dbg (bool, optional): Debugging flag. Defaults to False.

Returns:

Returns a generator where each element is a dict for each ADS record, with keys given by the fields

Return type:

generator

pyastroapi.astro_ph(limit: int = -1, fields: List[str] = None, dbg: bool = False)

Gets the previous (working) days Arxiv postings

Parameters:
  • limit (int, optional) – Number of rows to limit to (-1 is no limit). Defaults to -1.

  • fields (t.List[str], optional) – ADS fields to return, if None returns a default set of fields.

  • dbg (bool, optional) – Debugging flag. Defaults to False.

Returns:

Returns a generator where each element is a dict for each ADS record, with keys given by the fields

Return type:

generator

class pyastroapi.libraries

This is a collection of ADS libraries that supports iteration

__len__()
__contains__(key)
__iter__()
__dir__()

Default dir() implementation.

__getitem__(key)
names()
keys()
values()
items()
new(name, description='', public=False, bibcodes=None)
edit(name, description='', public=False, bibcodes=None)
pop(name)
update()
class pyastroapi.library(lid)

An instance of a single ADS library

update_all()
update_iter()
keys()
values()
items()
__len__()
__contains__(key)
__iter__()
__hash__()

Return hash(self).

__str__()

Return str(self).

__eq__(value)

Return self==value.

__getitem__(value)
add_bibcode(bibcodes)
add_from_bibtex(bibtex)
pop(bibcodes)
abstract edit(name='', description='', public=False)