Skip to content

Commit

Permalink
feat(lox-orbits): check los with other bodies
Browse files Browse the repository at this point in the history
  • Loading branch information
helgee committed Feb 12, 2025
1 parent 4493ac9 commit b464507
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
20 changes: 14 additions & 6 deletions crates/lox-orbits/src/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -738,12 +738,14 @@ impl PySgp4 {
}

#[pyfunction]
#[pyo3(signature = (times, gs, mask, sc, provider = None))]
#[pyo3(signature = (times, gs, mask, sc, ephemeris, bodies=None, provider=None))]
pub fn visibility(
times: &Bound<'_, PyList>,
gs: PyGroundLocation,
mask: &Bound<'_, PyElevationMask>,
sc: &Bound<'_, PyTrajectory>,
ephemeris: &Bound<'_, PySpk>,
bodies: Option<Vec<PyOrigin>>,
provider: Option<&Bound<'_, PyUt1Provider>>,
) -> PyResult<Vec<PyWindow>> {
let sc = sc.get();
Expand All @@ -759,12 +761,18 @@ pub fn visibility(
.collect();
let provider = provider.map(|p| &p.get().0);
let mask = &mask.borrow().0;
Ok(
crate::analysis::visibility_dyn(&times, &gs.0, mask, &sc.0, provider)
.into_iter()
.map(PyWindow)
.collect(),
let ephemeris = &ephemeris.get().0;
let bodies: Vec<DynOrigin> = bodies
.unwrap_or_default()
.into_iter()
.map(|b| b.0)
.collect();
Ok(crate::analysis::visibility_combined(
&times, &gs.0, mask, &bodies, &sc.0, ephemeris, provider,
)
.into_iter()
.map(PyWindow)
.collect())
}

#[pyclass(name = "Ensemble", module = "lox_space", frozen)]
Expand Down
4 changes: 3 additions & 1 deletion crates/lox-space/lox_space.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ def visibility(
gs: GroundLocation,
mask: ElevationMask,
sc: Trajectory,
provider: UT1Provider,
ephemeris: SPK,
bodies: list[Origin] | None = None,
provider: UT1Provider | None = None,
) -> list[Window]: ...
def visibility_all(
times: list[Time],
Expand Down

0 comments on commit b464507

Please sign in to comment.