Skip to content

Bib Sketches

Michael Mommert edited this page Aug 28, 2017 · 2 revisions

Bib Sketches

A class that will automatically track references for function used in the current session. A comprehensive bibliography can be produced after running the code in different formats.

from sbpy import bib
from sbpy.data import Ephem

eph = Ephem.from_horizons('encke')
print(bib.citations())
# Prints `None` because citation tracking has not been enabled.

bib.track()
eph = Ephem.from_horizons('encke')
print(bib.citations())
# Prints `Bib('Giorgini et al. 1996')`

# disable tracking and remove all tracked citations
bib.stop()
bib.reset()
eph = Ephem.from_horizons('encke')
print(bib.citations())
# Prints `None`

Meanwhile, sbpy methods would register their citations whenever they are used:

class NEATM():
    def __init__(D, Ap, eta):
        from .. import bib
        bib.register(Bib('1998Icar..131..291H', source='sbpy.thermal.NEATM'))

bib.register will check if the citation tracking is enabled and internally save the citation as needed.

Clone this wiki locally