Test TFR plotting.
()
| 840 | |
| 841 | |
| 842 | def test_plot(): |
| 843 | """Test TFR plotting.""" |
| 844 | data = np.zeros((3, 2, 3)) |
| 845 | times = np.array([0.1, 0.2, 0.3]) |
| 846 | freqs = np.array([0.10, 0.20]) |
| 847 | info = mne.create_info( |
| 848 | ["MEG 001", "MEG 002", "MEG 003"], 1000.0, ["mag", "mag", "mag"] |
| 849 | ) |
| 850 | tfr = AverageTFRArray( |
| 851 | info=info, |
| 852 | data=data, |
| 853 | times=times, |
| 854 | freqs=freqs, |
| 855 | nave=20, |
| 856 | comment="test", |
| 857 | method="crazy-tfr", |
| 858 | ) |
| 859 | |
| 860 | # interactive mode on by default |
| 861 | fig = tfr.plot(picks=[1], cmap="RdBu_r")[0] |
| 862 | _fake_keypress(fig, "up") |
| 863 | _fake_keypress(fig, " ") |
| 864 | _fake_keypress(fig, "down") |
| 865 | _fake_keypress(fig, " ") |
| 866 | _fake_keypress(fig, "+") |
| 867 | _fake_keypress(fig, " ") |
| 868 | _fake_keypress(fig, "-") |
| 869 | _fake_keypress(fig, " ") |
| 870 | _fake_keypress(fig, "pageup") |
| 871 | _fake_keypress(fig, " ") |
| 872 | _fake_keypress(fig, "pagedown") |
| 873 | |
| 874 | cbar = fig.get_axes()[0].CB # Fake dragging with mouse. |
| 875 | ax = cbar.cbar.ax |
| 876 | _fake_click(fig, ax, (0.1, 0.1)) |
| 877 | _fake_click(fig, ax, (0.1, 0.2), kind="motion") |
| 878 | _fake_click(fig, ax, (0.1, 0.3), kind="release") |
| 879 | |
| 880 | _fake_click(fig, ax, (0.1, 0.1), button=3) |
| 881 | _fake_click(fig, ax, (0.1, 0.2), button=3, kind="motion") |
| 882 | _fake_click(fig, ax, (0.1, 0.3), kind="release") |
| 883 | |
| 884 | _fake_scroll(fig, 0.5, 0.5, -0.5) # scroll down |
| 885 | _fake_scroll(fig, 0.5, 0.5, 0.5) # scroll up |
| 886 | |
| 887 | plt.close("all") |
| 888 | |
| 889 | |
| 890 | @pytest.mark.parametrize("output", ("complex", "phase")) |
nothing calls this directly
no test coverage detected