make_forward_solution changing values in tranformation matrix

Hello,

I am doing source reconstruction on some MEG data. Instead of using the fiducials, the participant was equipt with a helmet with HPI coils.

I have two transformation matrices head2device and device2mri (calculated using hpi locations on mri)

I have combined them by using mne.transforms.combine_transforms() like so:

trans_d_m = mne.transforms.Transform('meg', 'mri', trans=trans_device_mri)
trans = mne.transforms.combine_transforms(trans_h_d, trans_d_m, fro = 'head', to =  'mri')

When i inspect the transformation matrix, i get the following:

trans.get('trans')

# output
array([[-0.95273168, -0.22523215, -0.20389583,  7.33291472],
[ 0.24723111, -0.96481994, -0.0894398 , 61.02247187],
[ 0.17657799,  0.13562154, -0.9748986 ,  5.6462251 ],
[ 0.        ,  0.        ,  0.        ,  1.        ]])

The problem arises when i calculate the forward solution.

# compute forward solution
fwd = mne.make_forward_solution(epochs.info, src = src, trans = trans, bem = bem_sol, meg = True, eeg = False)

Below is a part of the output. It seems as if the scale of the last column has been modified.

Coordinate transformation: MRI (surface RAS) -> head
-0.952898 -0.272829 -0.132474    5641.82 mm
0.286426 -0.953151 -0.097282    60441.65 mm
0.099727  0.130644 -0.986401    -10845.87 mm

To test, i took the inverse of the transformation matrix.

np.linalg.inv(trans.get('trans'))

# output
array([[ -0.95289838,  -0.2728294 ,  -0.13247441,   5.64181602],
[  0.28642612,  -0.9531508 ,  -0.09728217,  60.44165041],
[  0.09972663,   0.13064415,  -0.98640104, -10.84587322],
[  0.        ,   0.        ,   0.        ,   1.        ]])

As it can be seen, the other 3 columns are what is expected.

The source reconstruction i end up with makes no sense, and when i plot the alignment of the surface from meg and helmet, the helmet is far away from the head.

How do i prevent the calculation of the forward model to modify the transformation matrix in this weird way?