ppsp-team / HyPyP

The Hyperscanning Python Pipeline
BSD 3-Clause "New" or "Revised" License
75 stars 42 forks source link

fix flaky test and add random seed to have deterministic tests #199

Closed patricefortin closed 2 months ago

patricefortin commented 2 months ago

In some cases (non deterministic), test_filt was failing due to the strategy on PSD comparison.

The change here fix the test, and also add a random seed for which the test was failing.

patricefortin commented 2 months ago

This image shows the values of the sum of psd for the first frequencies, when the test is failing

plt.plot(np.arange(raw_psd.shape[1])[:10], np.sum(raw_psd, axis=0)[:10], label="raw")
plt.plot(np.arange(raw_filt_default_psd.shape[1])[:10], np.sum(raw_filt_default_psd, axis=0)[:10], label="filtered")
plt.legend()
plt.show()

image