Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions mne/channels/montage.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,26 @@ def _transform_to_head(self):
_data = _foo_get_data_from_dig(self.dig) # XXX: dig_ch_pos will always be None. I'm not sure if I'm breaking something. # noqa
_data['point_names'] = self.point_names # XXX: this attribute should remain # noqa

# Test
from mne.utils import object_diff
from copy import deepcopy
_xxx = _digmontage_to_bunch(self)
my_diff = object_diff(_data.dig_ch_pos, _xxx.dig_ch_pos)
assert my_diff == ''
original_dig_ch_pos = deepcopy(_data.dig_ch_pos)

# Original operation
_data = _transform_to_head_call(_data)

# more test
max_diff = np.array(
[abs(_data.dig_ch_pos[kk] - original_dig_ch_pos[kk])
for kk in _data.dig_ch_pos.keys()]
).max()
assert max_diff < 1e-7 # This shows that this is never called with a real transformation # noqa

_data_copy = deepcopy(_data)

self.coord_frame = _data.coord_frame
self.dig_ch_pos = _data.dig_ch_pos

Expand All @@ -533,6 +553,8 @@ def _transform_to_head(self):
extra_points=_data.hsp, dig_ch_pos=_data.dig_ch_pos
)

assert object_diff(_data_copy, _data) == ''

def _compute_dev_head_t(self):
"""Compute the Neuromag dev_head_t from matched points."""
# XXX: This is already a free function
Expand Down