GWeindel / hmp

Repository for the hmp python package
BSD 3-Clause "New" or "Revised" License
32 stars 8 forks source link

Sped up centering operation in transform_data #140

Closed rickdott closed 4 months ago

rickdott commented 4 months ago

Using (Boehm, 2014) data, participants 1-5:

Before: CPU times: user 52.8 s, sys: 516 ms, total: 53.3 s Wall time: 53.3 s

After: CPU times: user 6.32 s, sys: 91.4 ms, total: 6.42 s Wall time: 6.43 s

Should also scale better to larger datasets.

rickdott commented 4 months ago

Does now print this:

RuntimeWarning: Mean of empty slice
  mean_last_dim = np.nanmean(data.values, axis=-1)

When running, let me know if this is an issue then we can catch the warning so it does not print: https://stackoverflow.com/questions/29688168/mean-nanmean-and-warning-mean-of-empty-slice