Download loaders/examples/quickstart.py from anonymous-uploader/linger-sample: direct link, hf CLI and curl.
- Browser
- Download file 1.47 kB
-
https://huggingface.co/datasets/anonymous-uploader/linger-sample/resolve/main/loaders/examples/quickstart.py
- Command line
-
hf download hf://datasets/anonymous-uploader/linger-sample/loaders/examples/quickstart.py
-
curl -L -o quickstart.py https://huggingface.co/datasets/anonymous-uploader/linger-sample/resolve/main/loaders/examples/quickstart.py
1.47 kB
| # SPDX-License-Identifier: MIT | |
| """Plot one benchmark session's offline tracks over the static map and the study area. | |
| usage: python quickstart.py [ROOT] [quiet|moderate|busy] [out.png] | |
| """ | |
| import sys | |
| import numpy as np | |
| import matplotlib | |
| matplotlib.use("Agg") | |
| import matplotlib.pyplot as plt | |
| from linger_loaders import load_tracklets, load_static_map, load_study_area | |
| root = sys.argv[1] if len(sys.argv) > 1 else "linger" | |
| level = sys.argv[2] if len(sys.argv) > 2 else "busy" | |
| out = sys.argv[3] if len(sys.argv) > 3 else f"quickstart_{level}.png" | |
| tr = load_tracklets(f"{root}/benchmark/{level}/tracks_final_5hz.csv.gz") | |
| sm = load_static_map(f"{root}/environment/static_map.npz") | |
| area = load_study_area(f"{root}/environment/study_area.json") | |
| h = sm["points"][:, 2] - sm["floor_z"] | |
| walls = sm["points"][(h > 1.4) & (h < 2.3)] # structure above the furniture, below the ceiling | |
| fig, ax = plt.subplots(figsize=(8, 6)) | |
| ax.scatter(walls[:, 0], walls[:, 1], s=0.05, c="0.6", lw=0) | |
| ax.plot(*np.vstack([area, area[:1]]).T, color="0.3", lw=0.6, ls="--") | |
| for tid in np.unique(tr["track_id"]): | |
| m = tr["track_id"] == tid | |
| ax.plot(tr["x"][m], tr["y"][m], lw=0.4, alpha=0.6) | |
| ax.set_aspect("equal"); ax.set_xlabel("x (m)"); ax.set_ylabel("y (m)") | |
| ax.set_title(f"{level} session: {len(np.unique(tr['track_id']))} offline tracks, " | |
| f"{(~tr['coasting']).mean():.0%} of rows detected") | |
| fig.savefig(out, dpi=150, bbox_inches="tight") | |
| print("wrote", out) | |