Distinct Disinhibitory Circuits Link Short-Term Adaptation to Familiarity and Reward Learning in Visual Cortex
Paper
Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Jupyter notebook · 642 lines · 22 KB · Apache-2.0
- # %% [markdown]
- # # Model Implementation Habituation Session 1
- # %% [markdown]
- # # Imports
- # %%
- import numpy as np
- import random
- import pandas as pd
- import matplotlib.pyplot as plt
- from scipy.integrate import odeint, solve_ivp
- import seaborn as sns
- from sklearn.metrics import mean_squared_error, r2_score
- from lmfit import Parameters
- from IPython import display
- # %% [markdown]
- # # Model diagram
- # %%
- display.Image(r'Model_diagram.png')
- # %% [markdown]
- # # Functions
- # %%
- def Step(t, stim = 5, inter = 10, amp = 1.0, base = 0, k = 0, delay = 0, decay_f = 0):
- """
- Feedback (FB) input:
- ------------------------------------
- Represented as a step function. Returns value of the input function in a time point t.
- ------------------------------------
- Parameters:
- t (running) - time in seconds;
- stim (fixed) = 5 s - time of the stimulus start;
- inter (fixed) = 10 s - duration of the stimulus;
- amp (fixed) = 1.0 Hz - amplitude of response;
- base (fixed) = 0 Hz - baseline activity;
- k (fixed) = 0 - slope of the slow component. Used to be varied while testing linear depression or sensitization component in the FB input;
- delay (variable) - delay of the FB input to the cell relative to the stimulus start;
- """
- if (t < stim + delay):
- h = base
- elif (t > stim + inter):
- h = amp * np.exp(-(t - stim - inter)*decay_f)
- else:
- h = amp*(t - stim - delay)*k*0.164745 + amp
- return h
- # %%
- def Sigm(t, stim = 5, inter = 10, ampl = 1.0, base = 0, rate = 1, delay = 0, decay_s = 1, dt = 0):
- """
- Slow Sensitizing (SS) input:
- ------------------------------------
- Represented as a sigmoid function. Returns value of the input function in a time point t.
- ------------------------------------
- Parameters:
- t (running) - time in seconds;
- stim (fixed) = 5 s - time of the stimulus start;
- inter (fixed) = 10 s - duration of the stimulus;
- ampl (fixed) = 1.0 Hz - amplitude of response;
- base (fixed) = 0 Hz - baseline activity;
- rate (variable) - time-constant of the SS input;
- delay (variable) - shift of the sigmoid center relative to stimulus start;
- decay_s (variable) - time-constant of the SS input exponential decay after the end of stimulation;
- """
- if (t < stim):
- h = base
- elif (t > stim + inter):
- h = (base + (ampl/(1 + np.exp((delay-inter - dt)/rate))))*np.exp(-(t - stim - inter)*decay_s) + base
- else:
- h = base + (ampl/(1 + np.exp((stim + delay - t)/rate))) #Actualy rate here is time constant, where 1/rate is actual rate
- return h
- # %%
- def expon(t, stim = 5, inter = 10, ampl = 1.5, base = 0, decay = 1, delay = 0, b = 0, decay_ff = 0, s_start = 0.1, k = 0.1):
- """
- Feedforward (FF) input:
- ------------------------------------
- Represented as a flat step function with fast exponential decay on the stimulus start and linear increase during 10 second period.
- Returns value of the input function in a time point t.
- ------------------------------------
- Parameters:
- t (running) - time in seconds;
- stim (fixed) = 5 s - time of the stimulus start;
- inter (fixed) = 10 s - duration of the stimulus;
- ampl (variable) - amplitude of peak;
- base (fixed) = 1 Hz - steady-state firing rate after fast exponential depression;
- decay (variable) - time-constant of the fast exponential depression;
- delay (variable) - delay of the FF input to the cell relative to the stimulus start;
- b (fixed) = 0 Hz - baseline activity;
- decay_ff (varaible) - time-constant of the FF input exponential decay after the end of stimulation;
- s_start (varaible) - delay after stimulus when linear modulation starts;
- k (varaible) - slope of the slow linear modulation;
- """
- if (t < stim + delay):
- h = b
- elif (t > stim + inter):
- h = (b + base + ampl*np.exp(-(inter-delay)*decay)+ (inter - delay - s_start)*k)*np.exp(-(t - stim - inter)*decay_ff)
- elif ((t >= stim + delay) and (t < stim + delay + s_start)):
- h = b + base + ampl*np.exp(-(t - stim - delay)*decay)
- else:
- h = b + base + ampl*np.exp(-(t - stim - delay)*decay)+ ((t - stim - delay - s_start)*k)
- return h
- # %%
- def model_step(t,
- y,
- w_0, w_1, w_2, w_3, w_4, w_5, w_6, w_7, w_8, w_9, w_10, w_11, w_12, w_13, w_14, w_15, w_16, w_17, w_18,
- w_19, w_20, w_21, w_22, w_23, tau_0, tau_1, tau_2, tau_3,
- threshold,
- power,
- q,
- i_0, i_1, i_2, i_3, i_4,
- r_1, decay, delay_1, delay_2, delay_3, ampl, base, decay_s, ampl_1, base_sigm, decay_f, decay_ff, s_start, k
- ):
- """
- Model basis:
- ------------------------------------
- Systems of first order differential equations that captures activity of populations (df_xdt).
- Returns an array of values of the derrivatives at a certain timepoint, calculated from values of functions in previous timepoint.
- ------------------------------------
- Parameters:
- t (running) - time in seconds;
- y (running) - values of activities on the previous timepoint;
- w_x (variable) - synaptic weights;
- tau_x (fixed) - neurons time-constants;
- threshold (fixed) = 0 Hz - minimum rectification value;
- power (fixed) = 2 - value of the power in the input-output function;
- q (fixed) = 1 - normalization coeficient in the input-output function;
- i_x (variable) - baseline activity of neurons;
- ...
- """
- f_e, f_p, f_s, f_v_pos, f_v_neg = y
- ## Model equations
- ff_e = (min(max((i_0 + w_0 * f_e + w_1 * expon(t, ampl = ampl, base = base, decay = decay, delay = delay_1, decay_ff = decay_ff, s_start = s_start, k = k) + w_2 * Sigm(t, ampl = ampl_1, rate = r_1, delay = delay_2, decay_s = decay_s, base = base_sigm) + w_16 * Step(t, k = 0, delay = delay_3, decay_f = decay_f) - w_3 * f_p - w_4 * f_s), threshold), 25))
- ff_p = (min(max((i_1 + w_17 * Step(t, k = 0, delay = delay_3, decay_f = decay_f) + w_5 * f_e + w_6 * expon(t, ampl = ampl, base = base, decay = decay, delay = delay_1, decay_ff = decay_ff, s_start = s_start, k = k) + w_7 * Sigm(t, ampl = ampl_1, rate = r_1, delay = delay_2, decay_s = decay_s, base = base_sigm) - w_8 * f_p - w_9 * f_s), threshold), 25))
- ff_s = (min(max((i_2 + w_10 * f_e + w_11 * Step(t, k = 0, delay = delay_3, decay_f = decay_f) - w_12 * f_v_pos - w_23 * f_v_neg), threshold), 25))
- ff_v_pos = (min(max((i_3 + w_18 * Step(t, k = 0, delay = delay_3, decay_f = decay_f) + w_13 * f_e - w_14 * f_s + w_15 * Sigm(t, ampl = ampl_1, rate = r_1, delay = delay_2, decay_s = decay_s, base = base_sigm)), threshold), 25))
- ff_v_neg = (min(max((i_4 + w_19 * Step(t, k = 0, delay = delay_3, decay_f = decay_f) + w_20 * f_e - w_21 * f_s + w_22 * Sigm(t, ampl = ampl_1, rate = r_1, delay = delay_2, decay_s = decay_s, base = base_sigm)), threshold), 25))
- df_edt = ((q * ff_e ** power) - f_e) / tau_0
- df_pdt = ((q * ff_p ** power) - f_p) / tau_1
- df_sdt = ((q * ff_s ** power) - f_s) / tau_2
- df_v_posdt = ((q * ff_v_pos ** power) - f_v_pos) / tau_3
- df_v_negdt = ((q * ff_v_neg ** power) - f_v_neg) / tau_3
- dydt = [df_edt, df_pdt, df_sdt, df_v_posdt, df_v_negdt]
- return dydt
- # %%
- names = ['PC_PC', # w_0
- 'FF_PC', # w_1
- 'SS_PC', # w_2
- 'PV_PC', # w_3
- 'SST_PC', # w_4
- 'PC_PV', # w_5
- 'FF_PV', # w_6
- 'SS_PV', # w_7
- 'PV_PV', # w_8
- 'SST_PV', # w_9
- 'PC_SST', # w_10
- 'FB_SST', # w_11
- 'VIP+_SST', # w_12
- 'PC_VIP+', # w_13
- 'SST_VIP+', # w_14
- 'SS_VIP+', # w_15
- 'FB_PC', # w_16
- 'FB_PV', # w_17
- 'FB_VIP+', # w_18
- 'FB_VIP-', # w_19
- 'PC_VIP-', # w_20
- 'SST_VIP-', # w_21
- 'SS_VIP-', # w_22
- 'VIP-_SST']# w_23
- # %%
- def exp_time(start, step, count, endpoint=False):
- """
- Experimental timepoints calculation:
- ------------------------------------
- Returns an array of values of the experimental timepoints.
- ------------------------------------
- Parameters:
- start - starting point;
- step - value of time step of experimental recordings;
- count - number of points;
- """
- stop = start+(step*count)
- return np.linspace(start, stop, count, endpoint=endpoint)
- # %%
- def odesol_step(tt, init, params):
- """
- Solves differential equation system defined in model_step() function.
- """
- y_init = init
- w_0 = params['w_0'].value
- w_1 = params['w_1'].value
- w_2 = params['w_2'].value
- w_3 = params['w_3'].value
- w_4 = params['w_4'].value
- w_5 = params['w_5'].value
- w_6 = params['w_6'].value
- w_7 = params['w_7'].value
- w_8 = params['w_8'].value
- w_9 = params['w_9'].value
- w_10 = params['w_10'].value
- w_11 = params['w_11'].value
- w_12 = params['w_12'].value
- w_13 = params['w_13'].value
- w_14 = params['w_14'].value
- w_15 = params['w_15'].value
- w_16 = params['w_16'].value
- w_17 = params['w_17'].value
- w_18 = params['w_18'].value
- w_19 = params['w_19'].value
- w_20 = params['w_20'].value
- w_21 = params['w_21'].value
- w_22 = params['w_22'].value
- w_23 = params['w_23'].value
- tau_0 = params['tau_0'].value
- tau_1 = params['tau_1'].value
- tau_2 = params['tau_2'].value
- tau_3 = params['tau_3'].value
- threshold = params['threshold'].value
- power = params['power'].value
- q = params['q'].value
- i_0 = params['i_0'].value
- i_1 = params['i_1'].value
- i_2 = params['i_2'].value
- i_3 = params['i_3'].value
- i_4 = params['i_4'].value
- ampl_1 = params['ampl_1'].value
- r_1 = params['r_1'].value
- delay_1 = params['delay_1'].value
- delay_2 = params['delay_2'].value
- delay_3 = params['delay_3'].value
- decay = params['decay'].value
- decay_s = params['decay_s'].value
- decay_f = params['decay_f'].value
- decay_ff = params['decay_ff'].value
- ampl = params['ampl'].value
- base = params['base'].value
- base_sigm = params['base_sigm'].value
- s_start = params['s_start'].value
- k = params['k'].value
- sol = solve_ivp(lambda t, y: model_step(t, y,
- w_0, w_1, w_2, w_3, w_4, w_5, w_6, w_7, w_8, w_9, w_10, w_11, w_12, w_13, w_14, w_15, w_16, w_17, w_18,
- w_19, w_20, w_21, w_22, w_23, tau_0, tau_1, tau_2, tau_3,
- threshold,
- power,
- q,
- i_0, i_1, i_2, i_3, i_4,
- r_1, decay, delay_1, delay_2, delay_3, ampl, base, decay_s, ampl_1, base_sigm, decay_f, decay_ff, s_start, k
- ),
- [tt[0], tt[-1]],
- y_init,
- method='RK45',
- t_eval=tt,
- )
- return sol
- # %%
- def simulate_step(tt, init, params):
- """
- Model simulation:
- ------------------------------------
- Returns a Pandas DataFrame of timesteps and populational activity traces.
- ------------------------------------
- Parameters:
- tt (running) - current timepoint;
- init (fixed) - intial conditions for differential equations;
- params - lmfit.Parameters() object with all parameters from the differential equations systems
- """
- sol = odesol_step(tt, init, params)
- dd = np.vstack((sol.t, sol.y[0], sol.y[1], sol.y[2], sol.y[3], sol.y[4])).T
- sim = pd.DataFrame(dd, columns=['t', 'f_e', 'f_pv', 'f_sst', 'f_vip_pos', 'f_vip_neg'])
- return sim
- # %%
- def RMSE_full(params, init, data_pc, data_pv, data_sst, data_vip_pos, data_vip_neg):
- """
- Root:Mean Square Error (RMSE) calculation:
- ------------------------------------
- Returns RMSE value for full fit of 4 averages of populations: PC, PV, SST, VIP.
- ------------------------------------
- Parameters:
- params - Parameters() object with all parameters from the differential equations systems
- init (fixed) - intial conditions for differential equations;
- data_pc - PC experimental data trace;
- data_pv - PV experimental data trace;
- data_sst - SST experimental data trace;
- data_vip_pos - VIP Positive experimental data trace;
- data_vip_neg - VIP Negative experimental data trace;
- """
- model = simulate_step(t_exp, init, params)
- sum = 0
- for i in range(len(data_pc)):
- sum += (model['f_e'].values[i] - data_pc[i])**2 + (model['f_pv'].values[i] - data_pv[i])**2 + (model['f_sst'].values[i] - data_sst[i])**2 + (model['f_vip_pos'].values[i] - data_vip_pos[i])**2 + (model['f_vip_neg'].values[i] - data_vip_neg[i])**2
- sum_norm = np.sqrt((sum)/(len(data_pc)*5))
- return sum_norm
- # %% [markdown]
- # # Experimental data
- # %%
- #timepoint
- dt = 0.164745
- # PC_average (whole population)
- pc_all = np.loadtxt(r'Experimental_Data\QA_Nor_PC_All_AvgSess1.txt')
- # Experimental time calculation
- t_exp_1 = exp_time(start=0.0, step=dt, count=len(pc_all))
- # PV_average (whole population)
- pv = np.loadtxt(r'Experimental_Data\QA_Nor_PV_AvgSess1.txt')
- # SST_average (whole population)
- sst = np.loadtxt(r'Experimental_Data\QA_Nor_SST_AvgSess1.txt')
- # VIP_Positive (whole population)
- vip_pos = np.loadtxt(r'Experimental_Data\QA_Nor_VIP_AvgSess1_Pos.txt')
- # VIP_Negative (whole population)
- vip_neg = np.loadtxt(r'Experimental_Data\QA_Nor_VIP_AvgSess1_Neg.txt')
- # %%
- # Inicialization of new arrays to cut traces for suitable range
- t_exp_1_new = []
- pv_new = []
- sst_new = []
- vip_pos_new = []
- vip_neg_new = []
- pc_all_new = []
- # Cutting the traces
- for ind, time in np.ndenumerate(t_exp_1):
- if (time >= 5) and (time <= 25):
- t_exp_1_new.append(time - 5)
- pv_new.append(pv[ind])
- sst_new.append(sst[ind])
- vip_pos_new.append(vip_pos[ind])
- vip_neg_new.append(vip_neg[ind])
- pc_all_new.append(pc_all[ind])
- # Adjusting for a missing initial point after deconvolution
- pv_new.insert(0, pv_new[0])
- sst_new.insert(0, sst_new[0])
- vip_pos_new.insert(0, vip_pos_new[0])
- vip_neg_new.insert(0, vip_neg_new[0])
- pc_all_new.insert(0, pc_all_new[0])
- t_exp_1_new.append(t_exp_1_new[-1] + dt)
- # %% [markdown]
- # # Model parameters
- # %%
- # ===============================================================
- # Setting initial and working parameters
- # ===============================================================
- #Fixed parameters
- t = np.float32(np.array(t_exp_1_new))
- t_exp = t
- threshold = np.float32(0)
- power = np.float32(2.0)
- q = np.float32(1.0)
- ampl_1 = 1.0
- r_1 = np.float32(1.713939)
- delay_1 = np.float32(0.1650418)
- delay_2 = np.float32(1.73305)
- delay_3 = np.float32(0.3695274)
- decay = np.float32(3.324089)
- decay_s = np.float32(0.2685497)
- decay_f = np.float32(0.8342502)
- decay_ff = np.float32(2.152722)
- ampl = np.float32(1.0)
- base = np.float32(1.0)
- base_sigm = np.float32(0)
- s_start = np.float32(0.1835884)
- init = np.float32(np.array([0.055, 0.011, 0.017, 0.208, 1.000]))
- tau = np.float32(np.array([0.015, 0.0075, 0.019, 0.019]))
- #Variable parameters
- k = np.float32(0.027309763)
- i = np.float32(np.array([0.284447361, 0.011142876, 0.116241266, 0.50467562, 0.942411609]))
- w = np.float32(np.array([
- 0.080753061, # w_0 PC -> PC
- 1.836526807, # w_1 FF -> PC
- 0.784303879, # w_2 SS -> PC
- 2.063944459, # w_3 PV -> PC
- 0.748021346, # w_4 SST -> PC
- 0.388020396, # w_5 PC -> PV
- 1.142616121, # w_6 FF -> PV
- 1.791791214, # w_7 SS -> PV
- 1.595357309, # w_8 PV -> PV
- 0.334000211, # w_9 SST -> PV
- 0.904594776, # w_10 PC -> SST
- 0.493489103, # w_11 FB -> SST
- 0.159572032, # w_12 VIP+ -> SST
- 0.254720976, # w_13 PC -> VIP+
- 0.167011082, # w_14 SST -> VIP+
- 0.692450185, # w_15 SS -> VIP+
- 1.35949409, # w_16 FB -> PC
- 0.304908259, # w_17 FB -> PV
- 0.232536359, # w_18 FB -> VIP+
- 0.146459393, # w_19 FB -> VIP-
- 0.3620719, # w_20 PC -> VIP-
- 0.727962823, # w_21 SST -> VIP-
- 0.174327124, # w_22 SS -> VIP-
- 0.000760818]))# w_23 VIP- -> SST
- data_pv = np.float32(np.array(pv_new))
- data_sst = np.float32(np.array(sst_new))
- data_vip_pos = np.float32(np.array(vip_pos_new))
- data_vip_neg = np.float32(np.array(vip_neg_new))
- data_pc_all = np.float32(np.array(pc_all_new))
- count = 0
- # %%
- # ============================
- # Parameter definition
- # ============================
- params = Parameters()
- params.add('w_0', value = w[0])
- params.add('w_1', value = w[1])
- params.add('w_2', value = w[2])
- params.add('w_3', value = w[3])
- params.add('w_4', value = w[4])
- params.add('w_5', value = w[5])
- params.add('w_6', value = w[6])
- params.add('w_7', value = w[7])
- params.add('w_8', value = w[8])
- params.add('w_9', value = w[9])
- params.add('w_10', value = w[10])
- params.add('w_11', value = w[11])
- params.add('w_12', value = w[12])
- params.add('w_13', value = w[13])
- params.add('w_14', value = w[14])
- params.add('w_15', value = w[15])
- params.add('w_16', value = w[16])
- params.add('w_17', value = w[17])
- params.add('w_18', value = w[18])
- params.add('w_19', value = w[19])
- params.add('w_20', value = w[20])
- params.add('w_21', value = w[21])
- params.add('w_22', value = w[22])
- params.add('w_23', value = w[23])
- params.add('tau_0', value = tau[0])
- params.add('tau_1', value = tau[1])
- params.add('tau_2', value = tau[2])
- params.add('tau_3', value = tau[3])
- params.add('threshold', value = threshold)
- params.add('power', value = power)
- params.add('q', value = q)
- params.add('i_0', value = i[0])
- params.add('i_1', value = i[1])
- params.add('i_2', value = i[2])
- params.add('i_3', value = i[3])
- params.add('i_4', value = i[4])
- params.add('ampl_1', value = ampl_1)
- params.add('r_1', value = r_1)
- params.add('delay_1', value = delay_1)
- params.add('delay_2', value = delay_2)
- params.add('delay_3', value = delay_3)
- params.add('decay', value = decay)
- params.add('decay_s', value = decay_s)
- params.add('decay_f', value = decay_f)
- params.add('decay_ff', value = decay_ff)
- params.add('ampl', value = ampl)
- params.add('base', value = base)
- params.add('base_sigm', value = base_sigm)
- params.add('s_start', value = s_start)
- params.add('k', value = k)
- # %% [markdown]
- # ## Model Simulation
- # %% [markdown]
- # ### Connection weights (wji)
- # %%
- vals = []
- for _, param in params.items():
- vals.append(param.value)
- plt.figure(figsize=(15,7.5))
- plt.ylabel(r"$w_{ji}$", fontsize=20)
- plt.bar(range(len(vals[:24])),vals[:24], color='blue')
- plt.xticks(range(len(vals[:24])), names[:24], rotation = 60, fontsize=15)
- plt.bar_label(plt.bar(range(len(vals[:24])),vals[:24]), fmt = '{:.2f}', fontsize=15)
- plt.yticks(np.arange(0,2.5,0.5), fontsize=15)
- plt.show()
- # %%
- # Simulate the model with parameters defined in params
- model = simulate_step(t_exp, init, params)
- # %% [markdown]
- # ### Fitting to experimental traces
- # %%
- # ============================
- # PC
- # ============================
- plt.figure(figsize=(4,4))
- plt.plot(t_exp, data_pc_all, color='#000000', marker='o', label='PC data')
- plt.plot(t_exp, model['f_e'].values, color='#ffaa00', label='fit', linewidth=3)
- plt.title('PC')
- plt.legend(loc='best')
- plt.ylabel("Spike Rate (Hz)", fontsize=14)
- plt.xlabel('t', fontsize=14)
- plt.xticks(np.arange(0,21,5))
- plt.yticks(np.arange(0,1.7,0.5))
- plt.show()
- # %%
- # ============================
- # VIP Positive
- # ============================
- plt.figure(figsize=(4,4))
- plt.plot(t_exp, data_vip_pos, color='#02ab81', marker='o', label='VIP Pos data')
- plt.plot(t_exp, model['f_vip_pos'].values, color='#ffaa00', label='fit', linewidth=3)
- plt.title('VIP Positive')
- plt.legend(loc='best')
- plt.ylabel("Spike Rate (Hz)", fontsize=14)
- plt.xlabel('t', fontsize=14)
- plt.xticks(np.arange(0,21,5))
- plt.yticks(np.arange(0,2.2,0.5))
- plt.show()
- # %%
- # ============================
- # VIP Negative
- # ============================
- plt.figure(figsize=(4,4))
- plt.plot(t_exp, data_vip_neg, color='#02ab81', marker='o', label='VIP Neg data')
- plt.plot(t_exp, model['f_vip_neg'].values, color='#ffaa00', label='fit', linewidth=3)
- plt.title('VIP Negative')
- plt.legend(loc='best')
- plt.ylabel("Spike Rate (Hz)", fontsize=14)
- plt.xlabel('t', fontsize=14)
- plt.xticks(np.arange(0,21,5))
- plt.yticks(np.arange(0,2.2,0.5))
- plt.show()
- # %%
- # ============================
- # PV
- # ============================
- plt.figure(figsize=(4,4))
- plt.plot(t_exp, data_pv, color='#ae00ff', marker='o', label='PV data')
- plt.plot(t_exp, model['f_pv'].values, color='#ffaa00', label='fit', linewidth=3)
- plt.title('PV')
- plt.legend(loc='best')
- plt.ylabel("Spike Rate (Hz)", fontsize=14)
- plt.xlabel('t', fontsize=14)
- plt.xticks(np.arange(0,21,5))
- plt.yticks(np.arange(0,1.7,0.4))
- plt.show()
- # %%
- # ============================
- # SST
- # ============================
- plt.figure(figsize=(4,4))
- plt.plot(t_exp, data_sst, color='#d80000', marker='o', label='SST data')
- plt.plot(t_exp, model['f_sst'].values, color='#ffaa00', label='fit', linewidth=3)
- plt.title('SST')
- plt.legend(loc='best')
- plt.ylabel("Spike Rate (Hz)", fontsize=14)
- plt.xlabel('t', fontsize=14)
- plt.xticks(np.arange(0,21,5))
- plt.yticks(np.arange(0,2.8,0.5))
- plt.show()
- # %% [markdown]
- # ### Root mean square error calculation (RMSE)
- # %%
- a_tot = RMSE_full(params, init, data_pc_all, data_pv, data_sst, data_vip_pos, data_vip_neg)
- print(a_tot)
- # %% [markdown]
- # ### Saving Traces
- # %%
- # Write csv file with output. f_e, f_p, f_s, f_v, f_e_o, f_p_o, f_s_o, f_v_o = y
- model[['t', 'f_e']].to_csv('Trace_PC_HabSess1.csv', index=False)
- model[['t', 'f_pv']].to_csv('Trace_PV_HabSess1.csv', index=False)
- model[['t', 'f_sst']].to_csv('Trace_SST_HabSess1.csv', index=False)
- model[['t', 'f_vip_pos']].to_csv('Trace_VIPPos_HabSess1.csv', index=False)
- model[['t', 'f_vip_neg']].to_csv('Trace_VIPNeg_HabSess1.csv', index=False)
Model_V1_Hab_Sess1-checkpoint.ipynb at commit 5d14a6b, under Apache-2.0 · at the source
Overview
Abstract
Sensory cortices filter repeated inputs through rapid adaptation over seconds and experience-driven learning over days. Although these forms of plasticity occur simultaneously, it is not known how they interact within cortical circuits. We combined two-photon calcium imaging, data-driven circuit modelling and optogenetics to investigate how short-term adaptation in layer 2/
Reproduced under the paper's license (CC BY), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above.
lagnadoLab/CortexModel-Learning
5d14a6b64a45586ce2fcdc96376f4d4dfea102eb, 24 March 2026Availability: 1 check, the latest on 30 September 2026: the link answers
- 30 September 2026: the link answers
42 files
- .ipynb_checkpoints/
Model_V1_Hab_Sess1-check , Jupyter, 642 linespoint.ipynb - .ipynb_checkpoints/
Model_V1_Hab_Sess6-check , Jupyter, 642 linespoint.ipynb - .ipynb_checkpoints/
Model_V1_Rew_Sess1-check , Jupyter, 631 linespoint.ipynb - .ipynb_checkpoints/
Model_V1_Rew_Sess6-check , Jupyter, 631 linespoint.ipynb - Fitting/
Habituation_Sess1/ , Python, 127 linesExtractWeightsAvg.py - Fitting/
Habituation_Sess1/ , Python, 41 linesSobol_test_global.py - Fitting/
Habituation_Sess1/ , Python, 45 linesSobol_test_local.py - Fitting/
Habituation_Sess1/ , Shell, 77 linesbatch_submitter.sh - Fitting/
Habituation_Sess1/ , Python, 37 linescombine_results.py - Fitting/
Habituation_Sess1/ , Python, 491 linesmodel_functions_loco_Hab 1.py - Fitting/
Habituation_Sess1/ , Python, 322 linesmodel_run_loco_Hab1.py - Fitting/
Habituation_Sess1/ , Shell, 21 linessubmit_ID_sweep.sh - Fitting/
Habituation_Sess6/ , Python, 126 linesExtractWeightsAvg.py - Fitting/
Habituation_Sess6/ , Python, 41 linesSobol_test_global.py - Fitting/
Habituation_Sess6/ , Python, 46 linesSobol_test_local.py - Fitting/
Habituation_Sess6/ , Shell, 77 linesbatch_submitter.sh - Fitting/
Habituation_Sess6/ , Python, 37 linescombine_results.py - Fitting/
Habituation_Sess6/ , Python, 485 linesmodel_functions_loco_Hab 6.py - Fitting/
Habituation_Sess6/ , Python, 322 linesmodel_run_loco_Hab6.py - Fitting/
Habituation_Sess6/ , Shell, 21 linessubmit_ID_sweep.sh - Fitting/
Reward_Sess1/ , Python, 126 linesExtractWeightsAvg.py - Fitting/
Reward_Sess1/ , Python, 41 linesSobol_test_global.py - Fitting/
Reward_Sess1/ , Python, 46 linesSobol_test_local.py - Fitting/
Reward_Sess1/ , Shell, 77 linesbatch_submitter.sh - Fitting/
Reward_Sess1/ , Python, 37 linescombine_results.py - Fitting/
Reward_Sess1/ , Python, 486 linesmodel_functions_loco_Rew 1.py - Fitting/
Reward_Sess1/ , Python, 292 linesmodel_run_loco_Rew1.py - Fitting/
Reward_Sess1/ , Shell, 21 linessubmit_ID_sweep.sh - Fitting/
Reward_Sess6/ , Python, 126 linesExtractWeightsAvg.py - Fitting/
Reward_Sess6/ , Python, 41 linesSobol_test_global.py - Fitting/
Reward_Sess6/ , Python, 46 linesSobol_test_local.py - Fitting/
Reward_Sess6/ , Shell, 77 linesbatch_submitter.sh - Fitting/
Reward_Sess6/ , Python, 37 linescombine_results.py - Fitting/
Reward_Sess6/ , Python, 486 linesmodel_functions_loco_Rew 6.py - Fitting/
Reward_Sess6/ , Python, 322 linesmodel_run_loco_Rew6.py - Fitting/
Reward_Sess6/ , Shell, 21 linessubmit_ID_sweep.sh - Model_V1_Hab_Sess1.ipynb
, Jupyter, 642 lines - Model_V1_Hab_Sess6.ipynb
, Jupyter, 642 lines - Model_V1_Rew_Sess1.ipynb
, Jupyter, 631 lines - Model_V1_Rew_Sess6.ipynb
, Jupyter, 631 lines - LICENSE, License, 201 lines
- README.md, Text, 83 lines
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 40 scripts, each with its path and the digest of its content;
- no match between paragraphs and code yet;
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
No dataset and no data link were found in the paper.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 30 September 2026: the first record
Recorded: type, journal, dates, 4 authors, 1 funder, 56 references.
Cite
This paper
Hinojosa, A., Dominiak, S., Kosiachkin, Y., & Lagnado, L. (2026). Distinct Disinhibitory Circuits Link Short-Term Adaptation to Familiarity and Reward Learning in Visual Cortex. bioRxiv (preprint). https://
BibTeX
@article{hinojosa2026dis
author = {Hinojosa, A.J. and Dominiak, S.E. and Kosiachkin, Ye. and Lagnado, L.},
title = {{Distinct Disinhibitory Circuits Link Short-Term Adaptation to Familiarity and Reward Learning in Visual Cortex}},
journal = {bioRxiv (preprint)},
year = {2026},
month = mar,
publisher = {bioRxiv},
issn = {2692-8205},
doi = {10.64898/
url = {https://
}
RIS
TY - JOUR
AU - Hinojosa, A.J.
AU - Dominiak, S.E.
AU - Kosiachkin, Ye.
AU - Lagnado, L.
TI - Distinct Disinhibitory Circuits Link Short-Term Adaptation to Familiarity and Reward Learning in Visual Cortex
T2 - bioRxiv (preprint)
J2 - bioRxiv
PY - 2026
DA - 2026/
SN - 2692-8205
PB - bioRxiv
DO - 10.64898/
UR - https://
ER -
CSL-JSON
{
"id": "10.64898/
"type": "article",
"title": "Distinct Disinhibitory Circuits Link Short-Term Adaptation to Familiarity and Reward Learning in Visual Cortex",
"container-title": "bioRxiv (preprint)",
"author": [
{
"family": "Hinojosa",
"given": "A.J."
},
{
"family": "Dominiak",
"given": "S.E."
},
{
"family": "Kosiachkin",
"given": "Ye."
},
{
"family": "Lagnado",
"given": "L."
}
],
"container-title-short":
"DOI": "10.64898/
"ISSN": "2692-8205",
"publisher": "bioRxiv",
"URL": "https://
"issued": {
"date-parts": [
[
2026,
3,
25
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1371/journal.pbio.3003518 [code]
- Context-dependent activation of V1 parvalbumin interneurons enhances visual discrimination.Journal: PLoS biologyIn common: pandas, SciPy, Matplotlib, 1 other tool, 9 references
- [2] doi:10.1126/sciadv.aed6417 [code]
- Intrinsic timing, not temporal prediction, underlies ramping dynamics in visual and parietal cortex during passive behavior.Journal: Science advancesIn common: seaborn, scikit-learn, pandas, 3 other tools, 6 references
- [3] doi:10.1523/jneurosci.0987-25.2026 [code]
- Cell-Type-Specific Synaptic Scaling Mechanisms Differentially Contribute to Associative Learning.Journal: The Journal of neuroscience : the official journal of the Society for NeuroscienceIn common: seaborn, pandas, SciPy, 2 other tools, 7 references
- [4] doi:10.1101/2025.05.14.654005 [code]
- Cell-type-specific synaptic scaling mechanisms differentially contribute to associative learningJournal: bioRxiv (preprint)In common: seaborn, pandas, SciPy, 2 other tools, 7 references
- [5] doi:10.1093/cercor/bhag047 [code]
- Association learning drives synaptic plasticity at feedforward synapses in somatosensory cortex.Journal: Cerebral cortex (New York, N.Y. : 1991)In common: scikit-learn, pandas, SciPy, 2 other tools, 6 references
- [6] doi:10.1073/pnas.2312898121 [code]
- A disinhibitory circuit mechanism explains a general principle of peak performance during mid-level arousal.Journal: Proceedings of the National Academy of Sciences of the United States of AmericaIn common: LMFIT, seaborn, scikit-learn, 4 other tools, 3 references
- [7] doi:10.1016/j.celrep.2023.113088
- VIP interneurons regulate cortical size tuning and visual perception.Journal: Cell reportsIn common: 8 references
- [8] doi:10.1016/j.isci.2025.114132 [code]
- FMRP restoration in parvalbumin interneurons: A circuit-specific improvement of visual learning in fragile X syndrome.Journal: iScienceIn common: seaborn, scikit-learn, pandas, 3 other tools, 4 references
- [9] doi:10.1073/pnas.2116895119 [code]
- A circuit mechanism for independent modulation of excitatory and inhibitory firing rates after sensory deprivation.Journal: Proceedings of the National Academy of Sciences of the United States of AmericaIn common: Matplotlib, NumPy, 7 references
- [10] doi:10.1038/s41467-025-65665-4 [code]
- Disrupted theta synchronization and synaptic connectivity in the visual cortex of Fmr1 KO mice.Journal: Nature communicationsIn common: seaborn, scikit-learn, pandas, 3 other tools, 4 references
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 40 scripts, and 0 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:55f590c16955dabe…
Add the badge to the code's README
If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.
Markdown
<!-- oscr-badge:start -->
[](https://openscicode.org/badge/doi/10.64898/2026.03.24.713929)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.64898/2026.03.24.713929.svg
:target: https://openscicode.org/badge/doi/10.64898/2026.03.24.713929
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.64898/2026.03.24.713929"><img src="https://openscicode.org/badge/doi/10.64898/2026.03.24.713929.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".
If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.
Report a mismatch between the code and the paper · Report a code error (signed in)
Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.
Report a reproduction failure (signed in)
Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
