-
Couldn't load subscription status.
- Fork 47
Description
Thanks for considering reporting an issue in rsatoolbox to us! Below are some tips that make it easier for us to understand what happened.
Describe the bug
_parse_input_rdms checks the two input RDMs only for equal number of NaNs, not that their positions match.
To Reproduce
import rsatoolbox as rsa
import numpy as np
vec1 = np.array([1, np.nan, 3])
vec2 = np.array([np.nan, 2, 3])
vec3 = np.array([1,2,3])
rsa.rdm.compare(vec1, vec2)
array([[0.96476382]])
rsa.rdm.compare(vec1, vec3)
ValueError: rdm1 and rdm2 have different nan positions
Expected behavior
vec1 and vec2 should raise the error as well.
The current behavior removes the nans and condenses the vectors down to their size without the NaNs. It then checks only that the vectors are the same size after condensing, finds they are (in the problem case), and returns them. Given the importance of position alignment for distance measurements, this seems problematic.
I'll submit a PR shortly that corrects the check to enforce identically placed NaNs.