From e693db93b46749081b61be978a63c597ea1cf84b Mon Sep 17 00:00:00 2001 From: Joan Massich Date: Mon, 19 Aug 2019 13:43:57 +0200 Subject: [PATCH] TST: reveal missing test --- mne/channels/montage.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/mne/channels/montage.py b/mne/channels/montage.py index df5b99c2422..d85dbee7eb7 100644 --- a/mne/channels/montage.py +++ b/mne/channels/montage.py @@ -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 @@ -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