Skip to content

Commit

Permalink
updated with url pulling fitted model
Browse files Browse the repository at this point in the history
  • Loading branch information
P-Oveisi committed Jul 31, 2024
1 parent effe5c7 commit 3431bfe
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions examples/eg__vary_b_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"TMS-evoked responses are driven by recurrent large-scale network dynamics."
# eLife, [doi: 10.7554/eLife.83232](https://elifesciences.org/articles/83232)
This code loads up a previously-fit whobpyt model, varies a specific model parameter (the inhibitory time constant; b), and simulates TEPs to visualize what effect this model parameter has on the output.
This code loads up a previously-fit whobpyt model, varies a specific model parameter (the inhibitory rate constant; b), and simulates TEPs to visualize what effect this model parameter has on the output.
"""
Expand Down Expand Up @@ -54,19 +54,20 @@
# %%
# Download and load necessary data for the example
download_data = True
url = 'https://drive.google.com/drive/folders/1dpyyfJl9wjTrWVo5lqOmB8HRhD3irjNj?usp=drive_link'
url = 'https://drive.google.com/drive/folders/1DTdF_xR78DxB6kzxqY3SVYBAcdU9IkAB?usp=drive_link'
if download_data: gdown.download_folder(url, quiet=True)
data_dir = os.path.abspath('eg__replicate_Momi2023_data')
data_dir = os.path.abspath('eg__tmseeg_data')


# # %%
# # load in a previously completed model fitting results object
# full_run_fname = os.path.join(data_dir, 'Subject_1_low_voltage_fittingresults_stim_exp.pkl')
# F = pickle.load(open(full_run_fname, 'rb'))
# F.evaluate(u = u, empRec = data_mean, TPperWindow = batch_size, base_window_num = 20)
full_run_fname = os.path.join(data_dir, 'Subject_1_low_voltage_fittingresults_stim_exp.pkl')
F = pickle.load(open(full_run_fname, 'rb'))

# define relevant variables for whobpyt fititng/simuations

# %%
# Define relevant variables for whobpyt fititng/simuations

# Load EEG data from a file
file_name = os.path.join(data_dir, 'Subject_1_low_voltage.fif')
epoched = mne.read_epochs(file_name, verbose=False);
Expand Down Expand Up @@ -103,6 +104,10 @@


# %%

# Run simulation
F.evaluate(u = u, empRec = data_mean, TPperWindow = batch_size, base_window_num = 20)

# Visualizng the original fit
ts_args = dict(xlim=[-0.1,0.3])
ch, peak_locs1 = evoked.get_peak(ch_type='eeg', tmin=-0.05, tmax=0.01)
Expand Down Expand Up @@ -155,6 +160,6 @@
# ---------------------------------------------------
#
#
# Here we replicate the results of Momi et al. 2023 (Fig. 5D). As the inhibitory synaptic time constant b increases,
# Here we replicate the results of Momi et al. 2023 (Fig. 5D). As the inhibitory synaptic rate constant b increases (or equivalently, the time constant decreases),
# we observe an increase in the amplitude of the first, early, and local TEP components; and a decrease of the second,
# late, and global TEP components.

0 comments on commit 3431bfe

Please sign in to comment.