Skip to content

Commit

Permalink
refactor(lox-orbits): switch loop order for visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
helgee committed Feb 10, 2025
1 parent f0ca53e commit d5cf084
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions crates/lox-orbits/src/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -815,16 +815,16 @@ pub fn visibility_all(
let spacecraft = &spacecraft.get().0;
let ephemeris = &ephemeris.get().0;
Ok(py.allow_threads(|| {
ground_stations.iter().fold(
HashMap::with_capacity(ground_stations.len()),
|mut passes, (gs_name, (gs, mask))| {
spacecraft.iter().fold(
HashMap::with_capacity(spacecraft.len()),
|mut passes, (sc_name, sc)| {

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

View check run for this annotation

Codecov / codecov/patch

crates/lox-orbits/src/python.rs#L818-L820

Added lines #L818 - L820 were not covered by tests
passes.insert(
gs_name.clone(),
spacecraft
sc_name.clone(),
ground_stations

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

View check run for this annotation

Codecov / codecov/patch

crates/lox-orbits/src/python.rs#L822-L823

Added lines #L822 - L823 were not covered by tests
.par_iter()
.fold(HashMap::new, |mut passes, (sc_name, sc)| {
.fold(HashMap::new, |mut passes, (gs_name, (gs, mask))| {

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

View check run for this annotation

Codecov / codecov/patch

crates/lox-orbits/src/python.rs#L825

Added line #L825 was not covered by tests
passes.insert(
sc_name.clone(),
gs_name.clone(),

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

View check run for this annotation

Codecov / codecov/patch

crates/lox-orbits/src/python.rs#L827

Added line #L827 was not covered by tests
visibility_combined(
&times, &gs.0, &mask.0, &bodies, sc, ephemeris, provider,
)
Expand Down
4 changes: 2 additions & 2 deletions crates/lox-space/tests/test_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ def ensemble(oneweb):
@pytest.mark.benchmark()
def test_visibility_benchmark(estrack, ensemble, oneweb, provider, times, ephemeris):
passes = lox.visibility_all(times, estrack, ensemble, ephemeris, provider=provider)
assert len(passes) == len(estrack)
assert len(passes) == len(oneweb)
for sc_passes in passes.values():
assert len(sc_passes) == len(oneweb)
assert len(sc_passes) == len(estrack)

0 comments on commit d5cf084

Please sign in to comment.