GabrielKP / enc

The encoders
0 stars 0 forks source link

Shape mismatch loading the story `undertheinfluence` #7

Closed GabrielKP closed 2 months ago

GabrielKP commented 2 months ago

There is a bug when loading undertheinfluence: a shape mismatch between the X (303 tr's) and the y (304 tr's) data.

GabrielKP commented 2 months ago

The bug is caused by downsampling in this line: https://github.com/GabrielKP/enc/blob/b18ec313d1a06b1366d4af6837a917e741b1857f/src/main.py#L42

The data is loaded in with 27683702 samples at 44100hz -> 313.87 TRs which after trimming becomes 303.87 TRs which then in this line is rounded down to 303, whereas the fMRI data has 304 TRs: https://github.com/GabrielKP/enc/blob/b18ec313d1a06b1366d4af6837a917e741b1857f/src/features.py#L25

I cannot just replace the int with round, because the story naked will have the same problem if you start rounding. I have written a function which takes the y_data and computes the n_samples appropriately. This could distort the audio alignment slightly but the alternative is to mess with the padding subtraction.