You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
while i was doing some experiments with realign with more parameters than the default and with spm_imatrix i found out the following problems:
even though realign.py can compute more parameters than the default 6 rigid body, it returns only the first 6 and i think the problem is in this line where 6 is hardcoded, but it should be dependent on lkp, i.e. sess_rp[..., :len(self.lkp)]
spm_imatrix seems incorrect and the following test case identifies the issues
running the above test, IndexError: index 3 is out of bounds for axis 1 with size 3 is raised in this line. Comparing it with spm's spm_imatrix i think it came up from the different indexing in matlab and it should be p[5] = np.arctan2(-rang(R1[1, 0]), rang(-R1[2, 0] / R[0, 2])). After correcting this, the test fails with
E AssertionError:
E Arrays are not almost equal to 6 decimals
E
E (mismatch 41.6666666667%)
E x: array([-3.118113, 3.421206, -3.672955, 0. , 1.570796, -1.934645,
E 1. , 1. , 1. , 0. , 0. , 0. ])
E y: array([-3.118113, 3.421206, -3.672955, -0.74295 , 0.204528, -0.983781,
E 1. , 1. , 1. , 1.2 , 3. , 0. ])
The reason of this error is in this line and the different flattening method where numpy.ravel by default concatenates the rows, while in matlab the columns. So, two possible solutions (i'm not sure which one is preferable) would be
p[9:12] = C.ravel(order='F')[[3, 6, 7]]
p[9:12] = C.T.ravel()[[3, 6, 7]]
If you agree with these issues and corresponding solutions, i can open a PR.
The text was updated successfully, but these errors were encountered:
Hi,
while i was doing some experiments with realign with more parameters than the default and with spm_imatrix i found out the following problems:
even though realign.py can compute more parameters than the default 6 rigid body, it returns only the first 6 and i think the problem is in this line where 6 is hardcoded, but it should be dependent on
lkp
, i.e.sess_rp[..., :len(self.lkp)]
spm_imatrix seems incorrect and the following test case identifies the issues
running the above test,
IndexError: index 3 is out of bounds for axis 1 with size 3
is raised in this line. Comparing it with spm's spm_imatrix i think it came up from the different indexing in matlab and it should bep[5] = np.arctan2(-rang(R1[1, 0]), rang(-R1[2, 0] / R[0, 2]))
. After correcting this, the test fails withThe reason of this error is in this line and the different flattening method where numpy.ravel by default concatenates the rows, while in matlab the columns. So, two possible solutions (i'm not sure which one is preferable) would be
p[9:12] = C.ravel(order='F')[[3, 6, 7]]
p[9:12] = C.T.ravel()[[3, 6, 7]]
If you agree with these issues and corresponding solutions, i can open a PR.
The text was updated successfully, but these errors were encountered: