Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] Multiple improvements to spectral_connectivity_time #113

Closed
wants to merge 67 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
41bd87b
FIX: compute connectivity over multiple tapers when mode='multitaper'…
ruuskas Aug 31, 2022
05ae8f6
require MNE-Python 1.0 or newer due to breaking changes in mne.time_f…
ruuskas Aug 31, 2022
9cc283c
update tests corresponding to API changes and use longer test signal
ruuskas Aug 31, 2022
924b4ab
update docstring: connectivity is not averaged over Epochs by default
ruuskas Sep 1, 2022
c5b75f8
fix docstring typo
ruuskas Sep 1, 2022
7699983
update docstring: faverage is False by default
ruuskas Sep 1, 2022
89f683a
update docstring: lower bound of frequency range for connectivity com…
ruuskas Sep 1, 2022
cb2dab5
update docstring: fmax may be None
ruuskas Sep 1, 2022
0fd34c9
update docstring
ruuskas Sep 2, 2022
f4992a7
new default for fmin
ruuskas Sep 2, 2022
cc1d69d
Merge branch 'spectral_time' of github.com:ruuskas/mne-connectivity i…
ruuskas Sep 2, 2022
fa9bce7
improve docstring and warnings for spectral_connectivity_time
ruuskas Sep 2, 2022
9e9f983
fix bug with indices: connectivity is now computed correctly between …
ruuskas Sep 5, 2022
2e4ccd1
DOC: improve documentation
ruuskas Sep 5, 2022
926c330
change smoothing default to no smoothing
ruuskas Sep 7, 2022
b881c34
DOC: updates to main docstring
ruuskas Sep 7, 2022
73fb937
BUG: number of blocks is now computed correctly
ruuskas Sep 7, 2022
baaca26
add test for time-resolved connectivity with simulated data
ruuskas Sep 12, 2022
2a7e09e
Change block_size default to 1
ruuskas Sep 22, 2022
2a0be06
Add documentation for block_size
ruuskas Sep 22, 2022
53ac7b5
Change for more useful variable names
ruuskas Sep 22, 2022
bc61e54
Remove regression test
ruuskas Oct 5, 2022
7ce13bd
Remove block_size parameter
ruuskas Oct 5, 2022
c7dd18c
Improve documentation
ruuskas Oct 5, 2022
4d2c1f0
Improve comments
ruuskas Oct 5, 2022
1b6224f
Remove unused code
ruuskas Oct 5, 2022
054512b
Merge branch 'main' into spectral_time
adam2392 Oct 16, 2022
283a1a1
Fix style issues
ruuskas Oct 17, 2022
083aa1b
Merge branch 'spectral_time' of github.com:ruuskas/mne-connectivity i…
ruuskas Oct 17, 2022
e89ac77
Add comment
ruuskas Oct 19, 2022
19603bd
Improve comment
ruuskas Oct 19, 2022
e5da3ae
Rename test function
ruuskas Oct 19, 2022
39f0ee6
Update docstring
ruuskas Oct 19, 2022
4b6311c
Add comments
ruuskas Oct 19, 2022
7c64633
Merge branch 'spectral_time' of github.com:ruuskas/mne-connectivity i…
ruuskas Oct 19, 2022
14cc7d0
Add ciPLV
ruuskas Oct 28, 2022
aa05ba4
Speed up computation
ruuskas Oct 31, 2022
8465068
Add logging
ruuskas Oct 31, 2022
f13f4e6
Add the option to specify freqs in all modes
ruuskas Nov 1, 2022
42db712
Add connectivity with Hilbert transform
ruuskas Nov 2, 2022
249afc7
Merge branch 'hilbert' into main
ruuskas Nov 2, 2022
f6684c0
DOC: Fix typos
ruuskas Nov 9, 2022
39fef93
DOC: Improve doc formulation
ruuskas Nov 9, 2022
08b5c79
DOC: Add note on memory mapping
ruuskas Nov 9, 2022
ccb0a2d
Remove unused names parameter
ruuskas Nov 9, 2022
fe727f7
Require sfreq with array input
ruuskas Nov 9, 2022
3b966ec
DOC: Improve documentation
ruuskas Nov 9, 2022
f082d6f
Add test for cwt_freqs
ruuskas Nov 9, 2022
84d073b
BUG: Fix spectral_connectivity time
ruuskas Nov 9, 2022
a5db88b
BUG: Average over CSD instead of connectivity
ruuskas Nov 10, 2022
3e7f208
Compute weighted average over CSD
ruuskas Nov 14, 2022
072b0bb
Add option to use part of signal as padding
ruuskas Nov 14, 2022
71b61ad
Fix style
ruuskas Nov 15, 2022
9e073c6
Update the docstring of spectral_connectivity_time
ruuskas Nov 15, 2022
dcfbc8b
Remove unnecessary defaults
ruuskas Nov 15, 2022
fb9869f
Add entries in whats_new.rst and authors.inc
ruuskas Nov 17, 2022
b2e8240
Merge spectral_time into main
ruuskas Nov 17, 2022
fa003bf
Fix test bug, use 'freqs' instead of 'cwt_freqs'
ruuskas Nov 17, 2022
6f3e803
Revert "Add connectivity with Hilbert transform"
ruuskas Nov 18, 2022
218ad37
Fix bug with dpss windows
ruuskas Nov 24, 2022
26d54fe
Only show progress bar if verbosity level is DEBUG
ruuskas Nov 24, 2022
31c4191
Merge branch 'main' of github.com:ruuskas/mne-connectivity into main
ruuskas Nov 24, 2022
966d569
Merge with upstream
ruuskas Nov 24, 2022
e2f0033
Improve doc
ruuskas Nov 24, 2022
aa5a92d
Fix style to make flake happy
ruuskas Nov 24, 2022
4c80f36
Fix whitespace
ruuskas Nov 24, 2022
871ce92
Fix doc
ruuskas Nov 24, 2022
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
15 changes: 8 additions & 7 deletions mne_connectivity/spectral/tests/test_spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ def test_epochs_tmin_tmax(kind):
assert len(w) == 1 # just one even though there were multiple epochs


@pytest.mark.parametrize('method', ['coh', 'plv', 'pli', 'wpli'])
@pytest.mark.parametrize('method', ['coh', 'plv', 'pli', 'wpli', 'ciplv'])
@pytest.mark.parametrize(
'mode', ['cwt_morlet', 'multitaper'])
@pytest.mark.parametrize('data_option', ['sync', 'random'])
Expand Down Expand Up @@ -504,11 +504,12 @@ def test_spectral_connectivity_time_phaselocked(method, mode, data_option):
# hypothesized "connection"
freq_band_low_limit = (8.)
freq_band_high_limit = (13.)
cwt_freqs = np.arange(freq_band_low_limit, freq_band_high_limit + 1)
freqs = np.arange(freq_band_low_limit, freq_band_high_limit + 1) \
if mode == 'cwt_morlet' else None
con = spectral_connectivity_time(data, method=method, mode=mode,
sfreq=sfreq, fmin=freq_band_low_limit,
fmax=freq_band_high_limit,
cwt_freqs=cwt_freqs, n_jobs=1,
freqs=freqs, n_jobs=1,
faverage=True, average=True, sm_times=0)
assert con.shape == (n_channels ** 2, len(con.freqs))
con_matrix = con.get_data('dense')[..., 0]
Expand All @@ -526,7 +527,7 @@ def test_spectral_connectivity_time_phaselocked(method, mode, data_option):
assert np.all(con_matrix) <= 0.5


@pytest.mark.parametrize('method', ['coh', 'plv', 'pli', 'wpli'])
@pytest.mark.parametrize('method', ['coh', 'plv', 'pli', 'wpli', 'ciplv'])
@pytest.mark.parametrize(
'cwt_freqs', [[8., 10.], [8, 10], 10., 10])
def test_spectral_connectivity_time_cwt_freqs(method, cwt_freqs):
Expand Down Expand Up @@ -555,7 +556,7 @@ def test_spectral_connectivity_time_cwt_freqs(method, cwt_freqs):
con = spectral_connectivity_time(data, method=method, mode='cwt_morlet',
sfreq=sfreq, fmin=np.min(cwt_freqs),
fmax=np.max(cwt_freqs),
cwt_freqs=cwt_freqs, n_jobs=1,
freqs=cwt_freqs, n_jobs=1,
faverage=True, average=True, sm_times=0)
assert con.shape == (n_channels ** 2, len(con.freqs))
con_matrix = con.get_data('dense')[..., 0]
Expand Down Expand Up @@ -589,11 +590,11 @@ def test_spectral_connectivity_time_resolved(method, mode):
data = EpochsArray(data, info)

# define some frequencies for cwt
freqs = np.arange(3, 20.5, 1)
freqs = np.arange(3, 20.5, 1) if mode == 'cwt_morlet' else None

# run connectivity estimation
con = spectral_connectivity_time(
data, sfreq=sfreq, cwt_freqs=freqs, method=method, mode=mode,
data, sfreq=sfreq, freqs=freqs, method=method, mode=mode,
n_cycles=5)
assert con.shape == (n_epochs, n_signals ** 2, len(con.freqs))
assert con.get_data(output='dense').shape == \
Expand Down
Loading