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