Normalize motion data in chunks (#10497)

This commit is contained in:
Nicolas Mowen 2024-03-17 06:30:39 -06:00 committed by GitHub
parent 1983de6528
commit 4e7808ac0c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -390,9 +390,15 @@ def motion_activity():
.apply(lambda x: max(x, key=abs, default=0.0))
.fillna(0.0)
)
df["motion"] = (
(df["motion"] - df["motion"].min())
/ (df["motion"].max() - df["motion"].min())
length = df.shape[0]
chunk = int(60 * (60 / scale))
for i in range(0, length, chunk):
part = df.iloc[i : i + chunk]
df.iloc[i : i + chunk, 0] = (
(part["motion"] - part["motion"].min())
/ (part["motion"].max() - part["motion"].min())
* 100
)