Skip to content

Commit

Permalink
minor edits
Browse files Browse the repository at this point in the history
  • Loading branch information
xoolive committed Sep 10, 2024
1 parent 6547ac7 commit da4ed85
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions crates/rs1090/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The directions ambitioned by rs1090 boil down to:

If you just want to decode ADS-B messages from your Raspberry and visualize the data on a map, you may want to stick to one of the dump0190 implementations.

The rs1090 library comes with a companion application [decode1090](https://crates.io/crates/decode1090) and a Python binding [rs1090](https://pypi.org/project/rs1090).
The rs1090 library comes with a companion application [decode1090](https://crates.io/crates/decode1090), a live decoder [jet1090](https://crates.io/crates/jet1090), and a Python binding [rs1090](https://pypi.org/project/rs1090).

## Performance

Expand All @@ -31,7 +31,7 @@ The Python script for benchmarking is in [python/examples](python/examples/bench
The Rust benchmark is executed with `cargo bench`.
Both scripts are run on an Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz.

![](./python/examples/benchmark.svg)
![Benchmark image](./python/examples/benchmark.svg)

> [!NOTE]
> The default out-of-the-box mode of `rs1090` is an execution distributed on all your cores. This benchmark was performed on a regular laptop. It can be much faster on supercomputers, but considering that most laptops now have at least 4 cores, this benchmark yields the speed-up you should get on your own computer.
Expand Down
2 changes: 1 addition & 1 deletion python/examples/bench_pms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Any

from pyModeS import adsb, bds, commb, py_common
from pyModeS import adsb, bds, commb, py_common # type: ignore


def decode(msg: str, common: Any = py_common) -> dict[str, Any]:
Expand Down
4 changes: 2 additions & 2 deletions python/examples/flarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@


# %%
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt # type: ignore
from cartes.crs import Lambert93, PlateCarree # type: ignore
from cartes.osm import Overpass # type: ignore

Expand All @@ -86,7 +86,7 @@
)
ax.spines["geo"].set_visible(False)
ax.yaxis.set_visible(False)
ax.set_extent((5.1, 5.16, 43.59, 43.64))
ax.set_extent((5.1, 5.16, 43.59, 43.64)) # type: ignore
fig.savefig("flarm.png")

# %%
30 changes: 15 additions & 15 deletions python/rs1090/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ def decode(
if timestamp is not None and len(timestamp) != len(msg):
raise ValueError("`msg` and `timestamp` must be of the same length")

batches = list(batched(msg, batch))
batches = list(batched(msg, batch)) # type: ignore
if timestamp is None:
payload = decode_1090_vec(batches)
else:
ts = list(batched(timestamp, batch))
ts = list(batched(timestamp, batch)) # type: ignore
payload = decode_1090t_vec(batches, ts, reference)

return pickle.loads(bytes(payload)) # type: ignore
Expand All @@ -153,20 +153,20 @@ def flarm(

@overload
def flarm(
msg: Sequence[str],
timestamp: Sequence[int],
reference_latitude: Sequence[float],
reference_longitude: Sequence[float],
msg: Sequence[str] | pd.Series,
timestamp: Sequence[int] | pd.Series,
reference_latitude: Sequence[float] | pd.Series,
reference_longitude: Sequence[float] | pd.Series,
*,
batch: int = 1000,
) -> list[Flarm]: ...


def flarm(
msg: str | Sequence[str],
timestamp: int | Sequence[int],
reference_latitude: float | Sequence[float],
reference_longitude: float | Sequence[float],
msg: str | Sequence[str] | pd.Series,
timestamp: int | Sequence[int] | pd.Series,
reference_latitude: float | Sequence[float] | pd.Series,
reference_longitude: float | Sequence[float] | pd.Series,
*,
batch: int = 1000,
) -> Flarm | list[Flarm]:
Expand All @@ -176,19 +176,19 @@ def flarm(
assert isinstance(reference_longitude, (int, float))
payload = decode_flarm(
msg,
timestamp,
timestamp, # type: ignore
reference_latitude,
reference_longitude,
)
else:
batches = list(batched(msg, batch))
batches = list(batched(msg, batch)) # type: ignore
assert not isinstance(timestamp, (int, float))
assert not isinstance(reference_latitude, (int, float))
assert not isinstance(reference_longitude, (int, float))

t = list(batched(timestamp, batch))
reflat = list(batched(reference_latitude, batch))
reflon = list(batched(reference_longitude, batch))
t = list(batched(timestamp, batch)) # type: ignore
reflat = list(batched(reference_latitude, batch)) # type: ignore
reflon = list(batched(reference_longitude, batch)) # type: ignore

payload = decode_flarm_vec(batches, t, reflat, reflon)

Expand Down

0 comments on commit da4ed85

Please sign in to comment.