OCD_modeling.models

class OCD_modeling.models.ReducedWongWangND(a=270.0, b=108.0, d=0.154, I_0=0.3, J_N=0.2609, w=0.9, G=1.0, tau_S=100.0, gamma=0.000641, sigma=0.001, N=2, dt=0.01, C=None, S=None, x=None, *args, **kwargs)[source]

Bases: object

Reduced Wong Wang model (N-dimensional)

H(x)[source]

Average synaptic gating.

a: slope (n/C); default=270 b: offset (Hz); default=108 d: decay (s); default=0.154

__init__(a=270.0, b=108.0, d=0.154, I_0=0.3, J_N=0.2609, w=0.9, G=1.0, tau_S=100.0, gamma=0.000641, sigma=0.001, N=2, dt=0.01, C=None, S=None, x=None, *args, **kwargs)[source]
dS()[source]

ODE of firing rate.

tau_S: kinetic parameter of local population (ms); default=100 gamma: kinetic parameter of coupled population (ms); default=0.000641 sigma: noise amplitude (nA); default=0.001 v_i: gaussian noise (n/a); default=0

integrate()[source]

Euler(-Maruyama) integration of the ODE

load_C_param(par, vals)[source]

Special case for connectivity control parameters as it is an array

prepare_auxiliary_variables(rec_vars, n_rec)[source]

creates dtata structures to recorded supplementary variables

prepare_control_params()[source]

Prepare the control parameters to be updated during the simulation

record_auxiliary_variables(rec_vars, rec_idx)[source]

Record variables other than S

run(t_tot=1000, sf=100, t_rec=None, rec_vars=[])[source]

Runs the model.

Parameters:
  • t_tot (int) – Total simulation time (s).

  • sf (int) – Sampling frequency of the reccording (Hz).

  • t_rec (list) – Interval of recording (s) in the form [start, stop].

  • rec_vars (list) – Variables to records (note that S is always recorded).

set_control_params(params: dict)[source]

Set the parameters to be updated during the simulation (e.g. a slow control parameter).

Parameters:

params (dict) – Parameters to be udpated, keys of this dict must match parameters names of the model. values of the dictionary are list of tuple indicating times and values of the parameter to be updated, i.e.: params = {I_0: [ (t0,v0), (t1,v1), (t2,v2), ... ]}

Note that the update is linear monotonic between referenced points, and the update frequency used is the sampling frequency (SF). Control parameter can only be changed during recording period.

update_control_params(index)[source]

Update the control parameters during the simulation

v()[source]

Implementing the Gaussian white noise process.

class OCD_modeling.models.ReducedWongWangOU(N=4, sigma_C=[], eta_C=[], *args, **kwargs)[source]

Bases: ReducedWongWangND

Reduced Wong-Wang model with Ornsetin-Uhlenbeck process for coupling (n dimensions)

__init__(N=4, sigma_C=[], eta_C=[], *args, **kwargs)[source]
integrate()[source]

Euler(-Maruyama) integration of the ODE

record_auxiliary_variables(rec_vars, rec_idx)[source]

Record auxiliary variables other than S

OCD_modeling.models.compute_bold(model, t_range=None, transient=30)[source]

BOLD timeseries and functional connectivity between regions.

Parameters:
  • model (OCD_modeling.models.ReducedWongWang.) – Model object.

  • t_range (list) – Times of interest (in sec), in the form [start, stop]. Default: all recorded time.

  • transient (int) – Time discarded at the beginning of t_range due to BOLD transient (in sec). Default: 30s.

OCD_modeling.models.create_sim_df(sim_objs, sim_type='sim-con', offset=0)[source]

Make a pandas DataFrame from list of simulation outputs objects

OCD_modeling.models.plot_auxiliary_variables(model, t_range=None, rec_vars=[])[source]

Visualize time serie generated by model

Parameters:

rww – ReducedWangWang object.

OCD_modeling.models.plot_bold(model, labels=['OFC', 'PFC', 'NAcc', 'Putamen'], colors=['blue', 'green', 'red', 'magenta'])[source]

plot BOLD timeseries and FC

OCD_modeling.models.plot_control_params(model, t_range=None, labels=[])[source]

Visualize time serie of control parameters.

Parameters:

model – ReducedWangWang object.

OCD_modeling.models.plot_correlations(rww, t_range=None)[source]

Visualize correlation between timeseries generated by model (S_rec, not BOLD).

Parameters:

rww – ReducedWangWang object.

OCD_modeling.models.plot_timeseries(model, t_range=None, labels=['OFC', 'PFC', 'NAcc', 'Put'])[source]

visualize time serie generated by model

Parameters:

model – ReducedWangWang object.

OCD_modeling.models.score_model(rww, coh='con')[source]

Score single model against empirical FC (only considering mean).

Parameters:
  • rww – instance of model to score.

  • coh – cohort to be scored against (‘con’ or ‘pat’).

(that is used when optimizing single models, not populations of models)

OCD_modeling.models.score_population_models(sim_objs, cohort='controls')[source]

Score a population of simulated model (using a parameter set) against experimental observations. Here, the whole distribution of models outputs is scored against the distributions of observations.