This commit is contained in:
2026-05-27 14:38:40 +02:00
parent 1452d231aa
commit 018517b662

View File

@@ -39,7 +39,7 @@ def filter_data(file: Path) -> pd.DataFrame:
previous_crank = -1 previous_crank = -1
last_cam = -1 last_cam = -1
cam_flag = 0 cam_flag = 0
crank_flag = 0 crank_flag = False
for _, row in tqdm(df.iterrows(), total=len(df), desc="Derivative"): for _, row in tqdm(df.iterrows(), total=len(df), desc="Derivative"):
time_us: int = row["time_us"] time_us: int = row["time_us"]
@@ -48,11 +48,17 @@ def filter_data(file: Path) -> pd.DataFrame:
c1 = 0 c1 = 0
c2 = 0 c2 = 0
if crank==1: if crank==1:
d1 = tume_us-c1
d2 = d1-(c1-c2)
if crank_flag:
rows.append({ rows.append({
"time_us": time_us, "time_us": time_us,
"d1": time_us-c1, "d1": d1,
"d2": (time_us-2*c1+c2)/(c1-c2), "d2": d2,
"ratio": d2/d1
}) })
else:
crank_flag = True
c2=c1 c2=c1
c1=time_us c1=time_us
output = pd.DataFrame(rows) output = pd.DataFrame(rows)