|
27 | 27 | create_info,
|
28 | 28 | read_cov,
|
29 | 29 | EvokedArray,
|
| 30 | + compute_proj_raw, |
30 | 31 | Projection,
|
31 | 32 | )
|
32 | 33 | from mne._fiff.proj import make_eeg_average_ref_proj
|
|
71 | 72 | layout = read_layout("Vectorview-all")
|
72 | 73 | cov_fname = base_dir / "test-cov.fif"
|
73 | 74 |
|
| 75 | +fast_test = dict(res=8, contours=0, sensors=False) |
| 76 | + |
74 | 77 |
|
75 | 78 | @pytest.mark.parametrize("constrained_layout", (False, True))
|
76 | 79 | def test_plot_topomap_interactive(constrained_layout):
|
@@ -135,32 +138,36 @@ def test_plot_projs_topomap():
|
135 | 138 | """Test plot_projs_topomap."""
|
136 | 139 | projs = read_proj(ecg_fname)
|
137 | 140 | info = read_info(raw_fname)
|
138 |
| - fast_test = {"res": 8, "contours": 0, "sensors": False} |
139 | 141 | plot_projs_topomap(projs, info=info, colorbar=True, **fast_test)
|
140 |
| - plt.close("all") |
141 |
| - ax = plt.subplot(111) |
| 142 | + _, ax = plt.subplots() |
142 | 143 | projs[3].plot_topomap(info)
|
143 | 144 | plot_projs_topomap(projs[:1], info, axes=ax, **fast_test) # test axes
|
144 |
| - plt.close("all") |
145 | 145 | triux_info = read_info(triux_fname)
|
146 | 146 | plot_projs_topomap(triux_info["projs"][-1:], triux_info, **fast_test)
|
147 |
| - plt.close("all") |
148 | 147 | plot_projs_topomap(triux_info["projs"][:1], triux_info, **fast_test)
|
149 |
| - plt.close("all") |
150 | 148 | eeg_avg = make_eeg_average_ref_proj(info)
|
151 | 149 | eeg_avg.plot_topomap(info, **fast_test)
|
152 |
| - plt.close("all") |
153 | 150 | # test vlims
|
154 | 151 | for vlim in ("joint", (-1, 1), (None, 0.5), (0.5, None), (None, None)):
|
155 | 152 | plot_projs_topomap(projs[:-1], info, vlim=vlim, colorbar=True)
|
156 |
| - plt.close("all") |
157 | 153 |
|
158 | 154 | eeg_proj = make_eeg_average_ref_proj(info)
|
159 | 155 | info_meg = pick_info(info, pick_types(info, meg=True, eeg=False))
|
160 | 156 | with pytest.raises(ValueError, match="Missing channels"):
|
161 | 157 | plot_projs_topomap([eeg_proj], info_meg)
|
162 | 158 |
|
163 | 159 |
|
| 160 | +@pytest.mark.parametrize("vlim", ("joint", None)) |
| 161 | +@pytest.mark.parametrize("meg", ("combined", "separate")) |
| 162 | +def test_plot_projs_topomap_joint(meg, vlim, raw): |
| 163 | + """Test that plot_projs_topomap works with joint vlim.""" |
| 164 | + if vlim is None: |
| 165 | + vlim = (None, None) |
| 166 | + projs = compute_proj_raw(raw, meg=meg) |
| 167 | + fig = plot_projs_topomap(projs, info=raw.info, vlim=vlim, **fast_test) |
| 168 | + assert len(fig.axes) == 4 # 2 mag, 2 grad |
| 169 | + |
| 170 | + |
164 | 171 | def test_plot_topomap_animation(capsys):
|
165 | 172 | """Test topomap plotting."""
|
166 | 173 | # evoked
|
@@ -322,7 +329,6 @@ def test_plot_topomap_basic():
|
322 | 329 | """Test basics of topomap plotting."""
|
323 | 330 | evoked = read_evokeds(evoked_fname, "Left Auditory", baseline=(None, 0))
|
324 | 331 | res = 8
|
325 |
| - fast_test = dict(res=res, contours=0, sensors=False, time_unit="s") |
326 | 332 | fast_test_noscale = dict(res=res, contours=0, sensors=False)
|
327 | 333 | ev_bad = evoked.copy().pick(picks="eeg")
|
328 | 334 | ev_bad.pick(ev_bad.ch_names[:2])
|
@@ -649,8 +655,6 @@ def test_plot_arrowmap(evoked):
|
649 | 655 | @testing.requires_testing_data
|
650 | 656 | def test_plot_topomap_neuromag122():
|
651 | 657 | """Test topomap plotting."""
|
652 |
| - res = 8 |
653 |
| - fast_test = dict(res=res, contours=0, sensors=False) |
654 | 658 | evoked = read_evokeds(evoked_fname, "Left Auditory", baseline=(None, 0))
|
655 | 659 | evoked.pick(picks="grad")
|
656 | 660 | evoked.pick(evoked.ch_names[:122])
|
|
0 commit comments