Skip to content

Commit

Permalink
Merge pull request #53 from mommermi/data
Browse files Browse the repository at this point in the history
DataClass finalized, Names revised, docs updated, tests added
  • Loading branch information
mommermi committed Aug 5, 2018
2 parents 4f076ba + 81a10cf commit b848063
Show file tree
Hide file tree
Showing 16 changed files with 1,533 additions and 408 deletions.
10 changes: 5 additions & 5 deletions docs/sbpy/bib.rst
Expand Up @@ -19,10 +19,10 @@ identify which aspect of the method the citation is relevant to:

>>> from sbpy import bib, data
>>> bib.track()
>>> eph = data.Ephem.from_horizons('433', epochs=None, observatory='500')
>>> eph = data.Ephem.from_horizons('433', epochs=None, location='500')
>>> print(bib.to_text()) # doctest: +REMOTE_DATA
sbpy.data.Ephem:
implementation: Giorgini et al. 1996, 1996DPS....28.2504G
data service: Giorgini et al. 1996, 1996DPS....28.2504G

In this case, ``Giorgini et al. 1996, 1996DPS....28.2504G`` is
relevant to the implementation of the JPL Horizons system that is
Expand All @@ -36,10 +36,10 @@ Bibliography tracking can also be used in a context manager:
>>> from sbpy import bib
>>> from sbpy.data import Ephem
>>> with bib.Tracking():
... eph = Ephem.from_horizons('Ceres', epochs=None, observatory='500')
... eph = Ephem.from_horizons('Ceres', epochs=None, location='500')
>>> print(bib.to_text()) # doctest: +REMOTE_DATA
sbpy.data.Ephem:
implementation: Giorgini et al. 1996, 1996DPS....28.2504G
data service: Giorgini et al. 1996, 1996DPS....28.2504G


Output formats
Expand All @@ -51,7 +51,7 @@ Simple text (`~sbpy.bib.to_text`)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> bib.to_text() # doctest: +REMOTE_DATA
sbpy.data.Ephem:
implementation: Giorgini et al. 1996, 1996DPS....28.2504G
data service: Giorgini et al. 1996, 1996DPS....28.2504G


BibTeX (`~sbpy.bib.to_bibtex`)
Expand Down
477 changes: 469 additions & 8 deletions docs/sbpy/data.rst

Large diffs are not rendered by default.

44 changes: 23 additions & 21 deletions sbpy/bib/tests/test_bib.py
Expand Up @@ -10,27 +10,29 @@ def data_path(filename):
data_dir = os.path.join(os.path.dirname(__file__), 'data')
return os.path.join(data_dir, filename)


@pytest.mark.remote_data
def test_text():
reset()
track()
neatm = NEATM()
assert ['sbpy.thermal.NEATM:', 'method:', 'Harris', '1998,',
'1998Icar..131..291H'] == to_text().split()
reset()
stop()


@pytest.mark.remote_data
def test_bibtex():
reset()
track()
neatm = NEATM()
with open(data_path('neatm.bib')) as bib_file:
assert to_bibtex() == bib_file.read()
reset()
stop()
# deactivate remote tests for now: not sure about how to handle token

# @pytest.mark.remote_data
# def test_text():
# reset()
# track()
# neatm = NEATM()
# print(to_text())
# assert ['sbpy.thermal.NEATM:', 'method:', 'Harris', '1998,',
# '1998Icar..131..291H'] == to_text().split()
# reset()
# stop()


# @pytest.mark.remote_data
# def test_bibtex():
# reset()
# track()
# neatm = NEATM()
# with open(data_path('neatm.bib')) as bib_file:
# assert to_bibtex() == bib_file.read()
# reset()
# stop()


def test_Tracking():
Expand Down
10 changes: 9 additions & 1 deletion sbpy/data/__init__.py
@@ -1,6 +1,14 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst

"""
sbpy.data
---------
:author: Michael Mommert (mommermiscience@gmail.com)
"""

from .core import *
from .ephem import *
from .orbit import *
from .phys import *
from .names import *

0 comments on commit b848063

Please sign in to comment.