refactor motion calculation (#10380)

* refactor motion calculation

* Use float
This commit is contained in:
Nicolas Mowen 2024-03-11 07:53:13 -06:00 committed by GitHub
parent 838ef636f8
commit 3515361320
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -404,6 +404,9 @@ def motion_activity():
# normalize data # normalize data
df = df.resample(f"{scale}S").sum().fillna(0.0) df = df.resample(f"{scale}S").sum().fillna(0.0)
mean = df["motion"].mean()
std = df["motion"].std()
df["motion"] = (df["motion"] - mean) / std
df["motion"] = ( df["motion"] = (
(df["motion"] - df["motion"].min()) (df["motion"] - df["motion"].min())
/ (df["motion"].max() - df["motion"].min()) / (df["motion"].max() - df["motion"].min())