Skip to content

Commit

Permalink
Merge pull request #6 from IPAC-SW/docs
Browse files Browse the repository at this point in the history
Update Sphinx
  • Loading branch information
dahlend authored Apr 25, 2024
2 parents 09ad411 + 54418ee commit e569635
Show file tree
Hide file tree
Showing 24 changed files with 234 additions and 114 deletions.
12 changes: 0 additions & 12 deletions doc/_static/format.css

This file was deleted.

2 changes: 0 additions & 2 deletions doc/_static/layout.html

This file was deleted.

16 changes: 13 additions & 3 deletions doc/api/api.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
API
===

.. toctree::
:maxdepth: 1

constants

.. toctree::
:maxdepth: 2

core
interface
conversion
flux
population
interface
observatory
population
propagation
spice
time
vector
6 changes: 6 additions & 0 deletions doc/api/constants.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
constants
=========

.. automodule:: neospy.constants
:members:
:inherited-members:
6 changes: 6 additions & 0 deletions doc/api/conversion.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
conversion
==========

.. automodule:: neospy.conversion
:members:
:inherited-members:
44 changes: 0 additions & 44 deletions doc/api/core.rst

This file was deleted.

2 changes: 1 addition & 1 deletion doc/api/flux.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Flux
flux
====

shape
Expand Down
21 changes: 21 additions & 0 deletions doc/api/observatory.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
observatories
=============


NEOS
----
.. automodule:: neospy.neos
:members:
:inherited-members:

WISE
----
.. automodule:: neospy.wise
:members:
:inherited-members:

ZTF
---
.. automodule:: neospy.ztf
:members:
:inherited-members:
6 changes: 6 additions & 0 deletions doc/api/propagation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
propagation
===========

.. automodule:: neospy.propagation
:members:
:inherited-members:
6 changes: 6 additions & 0 deletions doc/api/spice.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
spice
=====

.. automodule:: neospy.spice
:members:
:inherited-members:
7 changes: 7 additions & 0 deletions doc/api/time.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Time
====

.. automodule:: neospy.time
:members:
:inherited-members:

6 changes: 6 additions & 0 deletions doc/api/vector.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
core
====

.. automodule:: neospy.vector
:members: Vector
:inherited-members:
8 changes: 1 addition & 7 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
}

autoclass_content = "both"
templates_path = ["_static"]
exclude_patterns = []

# Napoleon settings
Expand All @@ -50,8 +49,7 @@
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "alabaster"
html_static_path = ["_static"]
html_theme = "sphinx_rtd_theme"


# -- Sphinx gallery settings --------------------------------------------------
Expand Down Expand Up @@ -86,8 +84,4 @@
("py:class", "numpy.ma.core.MaskedArray"),
("py:class", "numpy.core.records.recarray"),
("py:class", "numpy._typing._array_like._ScalarType_co"),
# Mypy support is a little flaky still, ignore these internal links:
# https://github.com/sphinx-doc/sphinx/issues/10785
("py:class", "VecMultiLike"),
("py:class", "VecLike"),
]
9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ dev = ["black>=23.1.0",
"autodoc",
"sphinx-gallery",
"mypy",
"types-requests"]
docs = ["sphinx", "autodoc", "sphinx-gallery"]
"types-requests",
]
docs = ["sphinx",
"autodoc",
"sphinx-gallery",
"sphinx_rtd_theme",
]

# Options for pytest
[tool.pytest.ini_options]
Expand Down
34 changes: 17 additions & 17 deletions src/neospy/neos.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
from __future__ import annotations
import numpy as np

# Effective wavelength of the NC1 and NC2 bands in nm.
BANDS: list[float] = [4700.0, 8000.0]
"""Effective wavelength of the NC1 and NC2 bands in nm."""

FOV_WIDTH: float = 7.10
"""Expected effective field of view width in degrees"""

FOV_HEIGHT: float = 1.68
"""Expected effective field of view height in degrees"""

# Zero point magnitude for nc1 and nc2
ZERO_MAGS: list[float] = [170.662, 64.13]
"""Zero point magnitude for nc1 and nc2"""

COLOR_CORR = np.array(
[ # Tbb nc1 nc2
[200.0, 1.50001, 1.17925],
[220.0, 1.38320, 1.10277],
[240.0, 1.29964, 1.05175],
[260.0, 1.23789, 1.01713],
[280.0, 1.19106, 0.99348],
[300.0, 1.15477, 0.97740],
[400.0, 1.05708, 0.95284],
[500.0, 1.01897, 0.96149],
]
)
COLOR_CORR = [
# Tbb nc1 nc2
[200.0, 1.50001, 1.17925],
[220.0, 1.38320, 1.10277],
[240.0, 1.29964, 1.05175],
[260.0, 1.23789, 1.01713],
[280.0, 1.19106, 0.99348],
[300.0, 1.15477, 0.97740],
[400.0, 1.05708, 0.95284],
[500.0, 1.01897, 0.96149],
]
"""Expected color correction required for black body sources"""
4 changes: 2 additions & 2 deletions src/neospy/propagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
def propagate_n_body(
states: list[State],
jd: float,
include_asteroids=False,
include_asteroids: bool = False,
a_terms: Optional[list[Optional[tuple[float, float, float, bool]]]] = None,
suppress_errors=True,
suppress_errors: bool = True,
) -> list[State]:
"""
Propagate the provided :class:`~neospy.State` using N body mechanics to the
Expand Down
43 changes: 43 additions & 0 deletions src/neospy/rust/elements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,28 @@ pub struct PyCometElements(pub elements::CometElements);

#[pymethods]
impl PyCometElements {
/// Construct a new CometElements object.
///
/// Cometary elements are in the Ecliptic frame.
///
/// Parameters
/// ----------
/// desig: str
/// Designation of the object.
/// epoch: float
/// Epoch of the orbit fit in JD.
/// eccentricity: float
/// Eccentricity of the orbit.
/// inclination: float
/// Inclination of the orbit in degrees.
/// peri_dist: float
/// Perihelion Distance in au.
/// peri_arg: float
/// Argument of perihelion in degrees.
/// peri_time: float
/// Time of perihelion passage in JD.
/// lon_of_ascending: float
/// Longitude of ascending node in degrees.
#[new]
#[allow(clippy::too_many_arguments)]
pub fn new(
Expand All @@ -57,16 +79,24 @@ impl PyCometElements {
})
}

/// Construct a new CometElements object from a `State`.
///
/// Parameters
/// ----------
/// State :
/// State Object.
#[staticmethod]
pub fn from_state(state: &PyState) -> Self {
Self(elements::CometElements::from_state(&state.0))
}

/// Epoch of the elements in JD.
#[getter]
pub fn epoch(&self) -> f64 {
self.0.epoch
}

/// Designation of the object.
#[getter]
pub fn desig(&self) -> String {
match &self.0.desig {
Expand All @@ -80,66 +110,79 @@ impl PyCometElements {
}
}

/// Eccentricity of the orbit.
#[getter]
pub fn eccentricity(&self) -> f64 {
self.0.eccentricity
}

/// Inclination of the orbit in degrees.
#[getter]
pub fn inclination(&self) -> f64 {
self.0.inclination.to_degrees()
}

/// Longitude of the ascending node of the orbit in degrees.
#[getter]
pub fn lon_of_ascending(&self) -> f64 {
self.0.lon_of_ascending.to_degrees()
}

/// Perihelion time of the orbit in JD.
#[getter]
pub fn peri_time(&self) -> f64 {
self.0.peri_time
}

/// Argument of Perihelion of the orbit in degrees.
#[getter]
pub fn peri_arg(&self) -> f64 {
self.0.peri_arg.to_degrees()
}

/// Distance of Perihelion of the orbit in au.
#[getter]
pub fn peri_dist(&self) -> f64 {
self.0.peri_dist
}

/// Semi Major Axis of the orbit in au.
#[getter]
pub fn semi_major(&self) -> f64 {
self.0.semi_major()
}

/// Mean Motion of the orbit in degrees.
#[getter]
pub fn mean_motion(&self) -> f64 {
self.0.mean_motion().to_degrees()
}

/// Orbital Period in days, nan if non-elliptical.
#[getter]
pub fn orbital_period(&self) -> f64 {
self.0.orbital_period()
}

/// Convert the orbital elements into a cartesian State.
#[getter]
pub fn as_state(&self) -> PyResult<PyState> {
Ok(self.0.try_to_state()?.into())
}

/// Eccentric Anomaly in degrees.
#[getter]
pub fn eccentric_anomaly(&self) -> PyResult<f64> {
Ok(self.0.eccentric_anomaly().map(|x| x.to_degrees())?)
}

/// Mean Anomaly in degrees.
#[getter]
pub fn mean_anomaly(&self) -> f64 {
self.0.mean_anomaly().to_degrees()
}

/// True Anomaly in degrees.
#[getter]
pub fn true_anomaly(&self) -> PyResult<f64> {
Ok(self.0.true_anomaly().map(|x| x.to_degrees())?)
Expand Down
Loading

0 comments on commit e569635

Please sign in to comment.