-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse_data.py
More file actions
51 lines (29 loc) · 1.06 KB
/
parse_data.py
File metadata and controls
51 lines (29 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import sys
import os
from pathlib import Path
import numpy as np
import polars as pl
import matplotlib.pyplot as plt
def load_window(file: Path) -> pl.DataFrame:
df = pl.read_ipc(file)
return df
def plot_values(df: pl.DataFrame, emitter: str, output_folder: str):
filtered_df = df.filter(df["emitter"] == emitter)
for col in set(filtered_df.columns) - {"emitter", "arrival_time"}:
time_list = filtered_df["arrival_time"].to_list()
y_list = filtered_df[col].to_list()
plt.figure()
plt.plot(time_list, y_list, marker="o", linestyle="-")
plt.xlabel("Time")
plt.ylabel(col)
plt.title(f"Emitter {emitter}: {col} vs Time")
plt.tight_layout()
os.makedirs(output_folder, exist_ok=True)
file_name = os.path.join(output_folder, f"emitter_{emitter}_{col}.png")
plt.savefig(file_name)
plt.close()
if __name__ == "__main__":
file = Path(sys.argv[1])
df = load_window(file)
print(df)
plot_values(df, "Emitter11", "output")