Skip to content

Commit

Permalink
update doctests to use better burst sim spec
Browse files Browse the repository at this point in the history
  • Loading branch information
TomDonoghue committed Feb 11, 2025
1 parent feb7ed8 commit a112f92
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
20 changes: 10 additions & 10 deletions neurodsp/plts/rhythm.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ def plot_swm_pattern(pattern, ax=None, **kwargs):
>>> import numpy as np
>>> from neurodsp.sim import sim_combined
>>> from neurodsp.rhythm import sliding_window_matching
>>> sig = sim_combined(n_seconds=10, fs=500,
... components={'sim_powerlaw': {'f_range': (2, None)},
... 'sim_bursty_oscillation': {'freq': 20,
... 'enter_burst': .25,
... 'leave_burst': .25}})
>>> sim_components = {'sim_powerlaw': {'f_range': (2, None)},
... 'sim_bursty_oscillation': {'freq': 20,
... 'burst_params': {'enter_burst' : 0.25,
... 'leave_burst' : 0.25}}}
>>> sig = sim_combined(n_seconds=10, fs=500, components=sim_components)
>>> windows, _ = sliding_window_matching(sig, fs=500, win_len=0.05, win_spacing=0.5)
>>> avg_window = np.mean(windows)
>>> plot_swm_pattern(avg_window)
Expand Down Expand Up @@ -68,11 +68,11 @@ def plot_lagged_coherence(freqs, lcs, ax=None, **kwargs):
>>> from neurodsp.sim import sim_combined
>>> from neurodsp.rhythm import compute_lagged_coherence
>>> sig = sim_combined(n_seconds=10, fs=500,
... components={'sim_synaptic_current': {},
... 'sim_bursty_oscillation': {'freq': 20,
... 'enter_burst': .50,
... 'leave_burst': .25}})
>>> sim_components = {'sim_synaptic_current': {},
... 'sim_bursty_oscillation': {'freq': 20,
... 'burst_params': {'enter_burst' : 0.50,
... 'leave_burst' : 0.25}}}
>>> sig = sim_combined(n_seconds=10, fs=500, components=sim_components)
>>> lag_cohs, freqs = compute_lagged_coherence(sig, fs=500, freqs=(5, 35),
... return_spectrum=True)
>>> plot_lagged_coherence(freqs, lag_cohs)
Expand Down
7 changes: 4 additions & 3 deletions neurodsp/plts/spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,10 @@ def plot_scv_rs_matrix(freqs, t_inds, scv_rs, ax=None, **kwargs):
>>> from neurodsp.sim import sim_combined
>>> from neurodsp.spectral import compute_scv_rs
>>> sig = sim_combined(n_seconds=100, fs=500,
... components={'sim_synaptic_current': {},
... 'sim_bursty_oscillation': {'freq': 10, 'enter_burst':0.75}})
>>> sim_components = {'sim_synaptic_current': {},
... 'sim_bursty_oscillation': {'freq': 10,
... 'burst_params': {'enter_burst' : 0.75}}}
>>> sig = sim_combined(n_seconds=100, fs=500, components=sim_components)
>>> freqs, t_inds, scv_rs = compute_scv_rs(sig, fs=500, method='rolling', rs_params=(10, 2))
>>> # Plot the computed scv, plotting frequencies up to 20 Hz (index of 21)
>>> plot_scv_rs_matrix(freqs[:21], t_inds, scv_rs[:21])
Expand Down
10 changes: 5 additions & 5 deletions neurodsp/rhythm/lc.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ def compute_lagged_coherence(sig, fs, freqs, n_cycles=3, return_spectrum=False):
Compute lagged coherence for a simulated signal with beta oscillations:
>>> from neurodsp.sim import sim_combined
>>> sig = sim_combined(n_seconds=10, fs=500,
... components={'sim_synaptic_current': {},
... 'sim_bursty_oscillation': {'freq': 20,
... 'enter_burst': .50,
... 'leave_burst': .25}})
>>> sim_components = {'sim_synaptic_current': {},
... 'sim_bursty_oscillation': {'freq': 20,
... 'burst_params': {'enter_burst' : 0.50,
... 'leave_burst' : 0.25}}}
>>> sig = sim_combined(n_seconds=10, fs=500, components=sim_components)
>>> lag_cohs = compute_lagged_coherence(sig, fs=500, freqs=(5, 35))
"""

Expand Down

0 comments on commit a112f92

Please sign in to comment.