Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic documentation + small fixes #4

Merged
merged 4 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ ssapy/data/de430.bsp filter=lfs diff=lfs merge=lfs -text
ssapy/data/gggrx_1200a_sha.lbl filter=lfs diff=lfs merge=lfs -text
ssapy/data/gggrx_1200a_sha.tab filter=lfs diff=lfs merge=lfs -text
ssapy/data/moon_pa_de440_200625.bpc filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.egm.cof filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ cover/

# Sphinx documentation
docs/_build/
docs/source/api
docs/source/modules

# Jupyter Notebook
**/*.ipynb_checkpoints
Expand Down
19 changes: 19 additions & 0 deletions docs/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
SSAPy Documentation
===================

Building the docs
-----------------

First, build and _install_ `ssapy` following the `Installing SSAPy <https://LLNL.github.io/SSAPy/installation.html>`_ section of the documentation.

Then, to build the HTML documentation locally, from the `docs` directory, run

.. code-block:: bash

make html

(run it twice to generate all files.)

Then open `_build/html/index.html` to browse the docs locally.

Note that if you updated docstrings, you'll need to re-build and re-install ssapy before re-building the docs.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might add that you can also use the python package sphinx-autobuild to build and host the documentation (https://pypi.org/project/sphinx-autobuild/). To view the documentation point the browser to http://127.0.0.1:8000/.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I tried but I'm using python 3.9 and the version of sphinx-autobuild I have installed requires python 3.10+ (we should pin versions!)

I still added it to the README!

2 changes: 1 addition & 1 deletion docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ These requirements can be easily installed on most modern macOS and Linux system
.. code-block:: console

brew update
brew install gcc git git-lfs python3 svn graphviz
brew install gcc git git-lfs python3 graphviz
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove svn?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It couldn't tell why it was needed, I didn't install it and didn't run into any issues, and it didn't seem required for other platforms (lines above) so I assumed it was outdated. Is it still needed?


Installation
------------
Expand Down
5 changes: 5 additions & 0 deletions ssapy/accel.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""
Classes for modeling accelerations.
"""

import numpy as np

from . import _ssapy
Expand Down Expand Up @@ -101,6 +105,7 @@ def __eq__(self, rhs):


class AccelProd(Accel):
"""Acceleration defined as the product of an acceleration with a constant factor."""
def __init__(self, accel, factor):
super().__init__()
self.accel = accel
Expand Down
8 changes: 6 additions & 2 deletions ssapy/body.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""
Classes representing celestial bodies.
"""

import erfa
import numpy as np
from .utils import _gpsToTT, iers_interp
Expand Down Expand Up @@ -103,7 +107,7 @@ def __init__(self):
from jplephem.spk import SPK
from . import datadir

fn = os.path.join(datadir, "de430.bsp") # https://naif.jpl.nasa.gov/pub/naif/LUCY/kernels/spk/de430s.bsp.lbl
fn = os.path.join(datadir, "de430.bsp") # https://naif.jpl.nasa.gov/pub/naif/LUCY/kernels/spk/de430s.bsp
self.kernel = SPK.open(fn)

def __call__(self, t):
Expand Down Expand Up @@ -134,7 +138,7 @@ def __init__(self):
from jplephem.spk import SPK
from . import datadir

fn = os.path.join(datadir, "de430.bsp") # https://naif.jpl.nasa.gov/pub/naif/LUCY/kernels/spk/de430s.bsp.lbl
fn = os.path.join(datadir, "de430.bsp") # https://naif.jpl.nasa.gov/pub/naif/LUCY/kernels/spk/de430s.bsp
self.kernel = SPK.open(fn)

def __call__(self, t):
Expand Down
4 changes: 4 additions & 0 deletions ssapy/constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""
A collection of physical constants.
"""

import numpy as np

# GM
Expand Down
4 changes: 2 additions & 2 deletions ssapy/correlate_tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2012,7 +2012,7 @@ def summarize_tracklet(arc):
pmra, pmdec: the proper motion in right ascension and declination
dpmra, dpmdec: the uncertainty in the proper motion in RA and declination
"""
unit = ssapy.utils.lb2unit(arc['ra'].to(u.rad).value,
unit = ssapy.utils.lb_to_unit(arc['ra'].to(u.rad).value,
arc['dec'].to(u.rad).value)
meanunit = np.mean(unit, axis=0)
# defines tangent plane
Expand All @@ -2033,7 +2033,7 @@ def summarize_tracklet(arc):
rasig = np.sqrt(np.diag(racovar))
decp, deccovar = np.polyfit(dt, dectp, 1, w=1./dpos, cov='unscaled')
decsig = np.sqrt(np.diag(deccovar))
meanra, meandec = ssapy.utils.unit2lb(meanunit[None, :])
meanra, meandec = ssapy.utils.unit_to_lb(meanunit[None, :])
rap[1] += meanra[0]
decp[1] += meandec[0]
out = [(rap[1]*u.rad, decp[1]*u.rad),
Expand Down
8 changes: 8 additions & 0 deletions ssapy/ellipsoid.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
"""
Class to handle transformations between ECEF x,y,z coords and geodetic
longitude, latitude, and height.

Technically, only handles a one-axis ellipsoid, defined via a flattening
parameter f, but that's good enough for simple Earth models.
"""

import numpy as np

from ._ssapy import Ellipsoid
Expand Down
10 changes: 7 additions & 3 deletions ssapy/gravity.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
"""
Classes for gravity-related accelerations.
"""

# from functools import lru_cache

import numpy as np

from .accel import Accel, _invnorm
from .accel import Accel as _Accel, _invnorm
from .utils import find_file, norm
from . import _ssapy

Expand Down Expand Up @@ -220,7 +224,7 @@ def __eq__(self, rhs):
)


class AccelThirdBody(Accel):
class AccelThirdBody(_Accel):
"""Acceleration due to a third body.

Parameters
Expand Down Expand Up @@ -254,7 +258,7 @@ def __call__(self, r, v, t, **kwargs):
return -self.body.mu * (s / norm(s)**3 - d / norm(d)**3)


class AccelHarmonic(Accel):
class AccelHarmonic(_Accel):
"""Acceleration due to a harmonic potential.

Parameters
Expand Down
4 changes: 4 additions & 0 deletions ssapy/io.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""
Collection of functions to read from and write to various file formats.
"""

import datetime
import numpy as np
from astropy.time import Time
Expand Down
Loading
Loading