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

feat(lox-orbits): check los with other bodies #209

Merged
merged 1 commit into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
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 @@
}

#[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>>,

Check warning on line 748 in crates/lox-orbits/src/python.rs

View check run for this annotation

Codecov / codecov/patch

crates/lox-orbits/src/python.rs#L747-L748

Added lines #L747 - L748 were not covered by tests
provider: Option<&Bound<'_, PyUt1Provider>>,
) -> PyResult<Vec<PyWindow>> {
let sc = sc.get();
Expand All @@ -759,12 +761,18 @@
.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,

Check warning on line 771 in crates/lox-orbits/src/python.rs

View check run for this annotation

Codecov / codecov/patch

crates/lox-orbits/src/python.rs#L764-L771

Added lines #L764 - L771 were not covered by tests
)
.into_iter()
.map(PyWindow)
.collect())

Check warning on line 775 in crates/lox-orbits/src/python.rs

View check run for this annotation

Codecov / codecov/patch

crates/lox-orbits/src/python.rs#L773-L775

Added lines #L773 - L775 were not covered by tests
}

#[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
Loading