Last active
November 25, 2021 16:10
-
-
Save jcheong0428/0de74d5855ee5f3ef9b0f4cf63cd76d1 to your computer and use it in GitHub Desktop.
synchrony02.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set window size to compute moving window synchrony. | |
r_window_size = 120 | |
# Interpolate missing data. | |
df_interpolated = df.interpolate() | |
# Compute rolling window synchrony | |
rolling_r = df_interpolated['S1_Joy'].rolling(window=r_window_size, center=True).corr(df_interpolated['S2_Joy']) | |
f,ax=plt.subplots(2,1,figsize=(14,6),sharex=True) | |
df.rolling(window=30,center=True).median().plot(ax=ax[0]) | |
ax[0].set(xlabel='Frame',ylabel='Smiling Evidence') | |
rolling_r.plot(ax=ax[1]) | |
ax[1].set(xlabel='Frame',ylabel='Pearson r') | |
plt.suptitle("Smiling data and rolling window correlation") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment