Skip to content

Commit

Permalink
FIX : fix explained var type on read for proj (mne-tools#10331)
Browse files Browse the repository at this point in the history
  • Loading branch information
agramfort authored Feb 13, 2022
1 parent 8babd8c commit 20078a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mne/io/proj.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def _read_proj(fid, node, *, ch_names_mapping=None, verbose=None):

tag = find_tag(fid, item, FIFF.FIFF_MNE_ICA_PCA_EXPLAINED_VAR)
if tag is not None:
explained_var = tag.data
explained_var = float(tag.data)
else:
explained_var = None

Expand Down
1 change: 1 addition & 0 deletions mne/tests/test_proj.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ def test_compute_proj_epochs(tmp_path):
corr = np.corrcoef(p1_data, p2_data)[0, 1]
assert_array_almost_equal(corr, 1.0, 5)
if p2['explained_var']:
assert isinstance(p2['explained_var'], float)
assert_array_almost_equal(p1['explained_var'],
p2['explained_var'])

Expand Down

0 comments on commit 20078a1

Please sign in to comment.