-
Notifications
You must be signed in to change notification settings - Fork 1
/
synapseGUI.m~
590 lines (408 loc) · 20.3 KB
/
synapseGUI.m~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
function varargout = synapseGUI(varargin)
% SYNAPSEGUI MATLAB code for synapseGUI.fig
% SYNAPSEGUI, by itself, creates a new SYNAPSEGUI or raises the existing
% singleton*.
%
% H = SYNAPSEGUI returns the handle to a new SYNAPSEGUI or the handle to
% the existing singleton*.
%
% SYNAPSEGUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in SYNAPSEGUI.M with the given input arguments.
%
% SYNAPSEGUI('Property','Value',...) creates a new SYNAPSEGUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before launcher_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to launcher_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help synapseGUI
% Last Modified by GUIDE v2.5 27-Nov-2018 23:13:14
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @launcher_OpeningFcn, ...
'gui_OutputFcn', @launcher_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before synapseGUI is made visible.
function launcher_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to synapseGUI (see VARARGIN)
% Choose default command line output for synapseGUI
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% Loading default values in table
set(handles.synParams,'Data',cell(1,11));
defSyn = getSynapse();
defSynData = [defSyn.tau_Ca, ...
defSyn.tau_rho, ...
defSyn.tau_x, ...
defSyn.C_pre, ...
defSyn.C_post, ...
defSyn.delay_pre, ...
defSyn.theta_pot, ...
defSyn.theta_dep, ...
defSyn.S_attr, ...
defSyn.noise_lvl, ...
defSyn.dampFactor];
set(handles.synParams,'Data',defSynData);
handles.env = getEnv();
addpath(genpath(handles.env.functionsRoot));
% UIWAIT makes synapseGUI wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = launcher_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% %%%%%% FREQUENCY MAP PANEL %%%%%%%%%%%%%%%%%%%%%%%%%%
function FMminDtedit_Callback(hObject, eventdata, handles)
handles.dataFit.dt.min = str2double(get(hObject,'String'));
function FMminDtedit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function FMmaxDtedit_Callback(hObject, eventdata, handles)
handles.dataFit.dt.max = str2double(get(hObject,'String'));
function FMmaxDtedit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function FMdtStepedit_Callback(hObject, eventdata, handles)
handles.dataFit.dt.step = str2double(get(hObject,'String'));
function FMdtStepedit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function FMmaxFreqedit_Callback(hObject, eventdata, handles)
handles.dataFit.freq.max = str2double(get(hObject,'String'));
function FMmaxFreqedit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function FMstepFreqedit_Callback(hObject, eventdata, handles)
handles.dataFit.freq.step = str2double(get(hObject,'String'));
function FMstepFreqedit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function modelistbox_Callback(hObject, eventdata, handles)
function modelistbox_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in freqMapPush.
function freqMapPush_Callback(hObject, eventdata, handles)
addpath(handles.env.dataRoot);
data.path = strcat(env.dataRoot,'Venance2016/');
data.freqSTDP.data = csvread(strcat(data.path, 'STDP_Frequency.csv'),1,0);
data.freqSTDP.length = size(data.freqSTDP.data,1);
handles.simu.n_iter = str2double(get(handles.nPairsSTDPedit,'String'));
handles.simu.frequency = str2double(get(handles.freqSTDPedit,'String'));
handles.simu.int_step = str2double(get(handles.intStepedit,'String'));
handles.simu.T = str2double(get(handles.STDPDurationedit,'String'));
handles.simu.int_scheme = 'euler_expl';
handles.simu.model = 'caProd';
synData = get(handles.synParams,'Data');
synData = synData(1,:);
params = getSynapse();
params.tau_Ca = synData(1,1);
params.tau_rho = synData(1,2);
params.tau_x = synData(1,3);
params.C_pre = synData(1,4);
params.C_post = synData(1,5);
params.delay_pre = synData(1,6);
params.theta_pot = synData(1,7);
params.theta_dep = synData(1,8);
params.S_attr = synData(1,9);
params.noise_lvl = synData(1,10);
params.dampFactor = synData(1,11);
params.theta_act = params.theta_dep;
params.TD = 0;
params.tau_x = 1e3 .* params.tau_x;
params.tau_Ca = 1e3 .* params.tau_Ca;
params.tau_rho = 1e3 .* params.tau_rho;
params.delay_pre = 1e3 .* params.delay_pre;
params.tau_w = 50000;
dataFit = handles.simu;
dataFit.mode = str2double(get(handles.modelistbox,'Value'));
dataFit.dt.min = str2double(get(handles.FMminDtedit,'String'));
dataFit.dt.max = str2double(get(handles.FMmaxDtedit,'String'));
dataFit.dt.step = str2double(get(handles.FMdtStepedit,'String'));
dataFit.freq.max = str2double(get(handles.FMmaxFreqedit,'String'));
dataFit.freq.step = str2double(get(handles.FMstepFreqedit,'String'));
dataFit.heat = get_freq_heatmap(dataFit, params);
figure('Name','SYN_DataFit','NumberTitle','off')
data.freqSTDP.freqs=unique(data.freqSTDP.data(:,5));
n_data_freqs=length(data.freqSTDP.freqs);
scatter3(data.freqSTDP.data(:,5), data.freqSTDP.data(:,2), data.freqSTDP.data(:,3)./100, 50*ones(size(data.freqSTDP.data,1),1), '*r')
hold on
[freq_grid, dt_grid] = meshgrid(1:dataFit.freq.step:dataFit.freq.max, dataFit.dt.min:dataFit.dt.step:dataFit.dt.max);
dataFit.interpol = griddata(dataFit.heat(:,1), dataFit.heat(:,2), dataFit.heat(:,3), freq_grid, dt_grid);
ribboncoloredZ(gca,dt_grid,dataFit.interpol);
surf(freq_grid, dt_grid, dataFit.interpol);
colormap(bluewhitered), colorbar;
alpha 0.3
for f=1:n_data_freqs
hold on
ids=find(data.freqSTDP.data(:,5)==data.freqSTDP.freqs(f) & data.freqSTDP.data(:,7)~=0);
filtered_freq=data.freqSTDP.data(ids,:);
[a,b]=sort(filtered_freq(:,2));
h = ribbon(filtered_freq(b,2), filtered_freq(b,3)./100, 0.15);
set(h, 'XData', filtered_freq(b,5)-1 + get(h, 'XData'));
end
dataFit.paramPos.x = 10.0;
dataFit.paramPos.y = 65.0;
dataFit.paramPos.z = 2.6;
dataFit.paramPos.colSepY = 25.0;
dataFit.paramPos.colSepZ = 0.15;
dataFit.paramPos.ftSize = 8;
stampParams(params, dataFit.paramPos);
% %%%%%%%%%%%%%%% STDP PANEL %%%%%%%%%%%%%%%%%%%%
function freqSTDPedit_Callback(hObject, eventdata, handles)
handles.simu.frequency = str2double(get(hObject,'String'));
function freqSTDPedit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function nPairsSTDPedit_Callback(hObject, eventdata, handles)
handles.simu.n_iter = str2double(get(hObject,'String'));
function nPairsSTDPedit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function STDPDurationedit_Callback(hObject, eventdata, handles)
handles.simu.T = str2double(get(hObject,'String'));
function STDPDurationedit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function intStepedit_Callback(hObject, eventdata, handles)
handles.simu.int_step = str2double(get(hObject,'String'));
function intStepedit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in STDPPush.
function STDPPush_Callback(hObject, eventdata, handles)
env = getEnv();
addpath(genpath(env.functionsRoot), env.dataRoot);
data.path = strcat(env.dataRoot,'Venance2016/');
handles.simu.n_iter = str2double(get(handles.nPairsSTDPedit,'String'));
handles.simu.frequency = str2double(get(handles.freqSTDPedit,'String'));
handles.simu.int_step = str2double(get(handles.intStepedit,'String'));
handles.simu.T = str2double(get(handles.STDPDurationedit,'String'));
handles.simu.int_scheme = 'euler_expl';
handles.simu.model = 'caProd';
synData = get(handles.synParams,'Data');
synData = synData(1,:);
params = getSynapse();
params.tau_Ca = synData(1,1);
params.tau_rho = synData(1,2);
params.tau_x = synData(1,3);
params.C_pre = synData(1,4);
params.C_post = synData(1,5);
params.delay_pre = synData(1,6);
params.theta_pot = synData(1,7);
params.theta_dep = synData(1,8);
params.S_attr = synData(1,9);
params.noise_lvl = synData(1,10);
params.dampFactor = synData(1,11);
params.theta_act = params.theta_dep;
params.TD = 0;
params.tau_x = 1e3 .* params.tau_x;
params.tau_Ca = 1e3 .* params.tau_Ca;
params.tau_rho = 1e3 .* params.tau_rho;
params.delay_pre = 1e3 .* params.delay_pre;
params.tau_w = 50000;
STDP = handles.simu;
STDP.dt.min = -75;
STDP.dt.max = 75;
STDP.dt.step = 1;
STDP.mode = 'rel';
STDP.function = get_STDP_CaProd(STDP, params);
STDP.integral = sum(STDP.function(:,2))*STDP.dt.step;
STDP.expectation = STDP.integral/(STDP.dt.max - STDP.dt.min);
axes(handles.STDPaxes);
STDP.plot = plot(STDP.function(:,1), STDP.function(:,2), '.b');
dim = [.15 .6 .3 .3];
sidestr = strcat('STDP expectation: ', num2str(100*STDP.expectation, 3+1), '%');
annotation('textbox',dim,'String',sidestr,'FitBoxToText','on');
neutral_hline = refline([0 1]);
neutral_hline.Color = 'b';
% title('Plasticity as a function of pre-post spike delay')
xlabel('Pre-post spike delay (ms)')
ylabel('Relative change in synaptic strength')
% %% POISSON MAP PANEL %%%%%%%%%%%%%%%%%%%
function poissonNPairsedit_Callback(hObject, eventdata, handles)
handles.pSTDP.nTry = str2double(get(hObject,'String'));
function poissonNPairsedit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function poissonStepfPostedit_Callback(hObject, eventdata, handles)
handles.pSTDP.nuPost.step = str2double(get(hObject,'String'));
function poissonStepfPostedit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function poissonMaxfPostedit_Callback(hObject, eventdata, handles)
handles.pSTDP.nuPost.max = str2double(get(hObject,'String'));
function poissonMaxfPostedit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function poissonMinfPostedit_Callback(hObject, eventdata, handles)
handles.pSTDP.nuPost.min = str2double(get(hObject,'String'));
function poissonMinfPostedit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function poissonStepfPreedit_Callback(hObject, eventdata, handles)
handles.pSTDP.nuPre.step = str2double(get(hObject,'String'));
function poissonStepfPreedit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function poissonMaxfPreedit_Callback(hObject, eventdata, handles)
handles.pSTDP.nuPre.max = str2double(get(hObject,'String'));
function poissonMaxfPreedit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function poissonMinfPreedit_Callback(hObject, eventdata, handles)
handles.pSTDP.nuPre.min = str2double(get(hObject,'String'));
function poissonMinfPreedit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function poissonTedit_Callback(hObject, eventdata, handles)
handles.pSTDP.T = str2double(get(hObject,'String'));
function poissonTedit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function poissonCorsTypelistbox_Callback(hObject, eventdata, handles)
handles.pSTDP.corr.type = str2double(get(hObject,'String'));
function poissonCorsTypelistbox_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function poissonCorsC12edit_Callback(hObject, eventdata, handles)
handles.pSTDP.corr.c12 = str2double(get(hObject,'String'));
function poissonCorsC12edit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function poissonCorstcedit_Callback(hObject, eventdata, handles)
handles.pSTDP.corr.tc = str2double(get(hObject,'String'));
function poissonCorstcedit_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in poissonMapPush.
function poissonMapPush_Callback(hObject, eventdata, handles)
env = getEnv();
addpath(genpath(env.functionsRoot), env.dataRoot);
data.path = strcat(env.dataRoot,'Venance2016/');
getSimuVars(handles);
pSTDP = handles.simu;
pSTDP.nuPre.min = str2double(get(handles.poissonMinfPreedit,'String'));
pSTDP.nuPre.max = str2double(get(handles.poissonMaxfPreedit,'String'));
pSTDP.nuPre.step = str2double(get(handles.poissonStepfPreedit,'String'));
pSTDP.nuPost.min = str2double(get(handles.poissonMinfPostedit,'String'));
pSTDP.nuPost.max = str2double(get(handles.poissonMaxfPostedit,'String'));
pSTDP.nuPost.step = str2double(get(handles.poissonStepfPostedit,'String'));
pSTDP.nTry = str2double(get(handles.poissonNPairsedit,'String'));
pSTDP.corr.type = str2double(get(handles.poissonCorsTypelistbox,'Value'));
pSTDP.corr.c12 = str2double(get(handles.poissonCorsC12edit,'String'));
pSTDP.corr.tc = str2double(get(handles.poissonCorstcedit,'String'));
pSTDP.map = poissonMap(handles.params, pSTDP);
[pre_grid_intp, post_grid_intp] = meshgrid(pSTDP.nuPre.min:0.2*pSTDP.nuPre.step:pSTDP.nuPre.max, pSTDP.nuPost.min:0.2*pSTDP.nuPost.step:pSTDP.nuPost.max);
[pre_grid_spl, post_grid_spl] = meshgrid(pSTDP.nuPre.min:pSTDP.nuPre.step:pSTDP.nuPre.max, pSTDP.nuPost.min:pSTDP.nuPost.step:pSTDP.nuPost.max);
pSTDP.interpol = griddata(pre_grid_spl, post_grid_spl, pSTDP.map, pre_grid_intp, post_grid_intp);
% ribboncoloredZ(gca,dt_grid,dataFit.interpol);
figure('Name','SYN_PoissonMap','NumberTitle','off')
pSTDP.plot = log(pSTDP.interpol);
surf(pre_grid_intp, post_grid_intp, pSTDP.plot);
xlabel('Presyn rate')
ylabel('Postsyn rate')
zlabel('Log potentiation')
colormap(bluewhitered), colorbar;
alpha 0.3
pSTDP.paramPos.x = pSTDP.nuPre.min + 0.85*(pSTDP.nuPre.max - pSTDP.nuPre.min);
pSTDP.paramPos.y = pSTDP.nuPost.min + 0.85*(pSTDP.nuPost.max - pSTDP.nuPost.min);
pSTDP.paramPos.z = max(max(pSTDP.plot)) - 0.6*(max(max(pSTDP.plot)) - min(min(pSTDP.plot)));
pSTDP.paramPos.colSepY = 0.15*(pSTDP.nuPost.max - pSTDP.nuPost.min);
pSTDP.paramPos.colSepZ = 0.05*(max(max(pSTDP.plot)) - min(min(pSTDP.plot)));
pSTDP.paramPos.ftSize = 8;
stampParams(handles.params, pSTDP.paramPos);
% %% CLEAR & CLOSE PUSH BUTTONS %%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on button press in clearAllPush.
function clearAllPush_Callback(hObject, eventdata, handles)
% hObject handle to clearAllPush (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
clear all
% --- Executes on button press in closeAllPush.
function closeAllPush_Callback(hObject, eventdata, handles)
% hObject handle to closeAllPush (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
figs2keep = gcf;
all_figs = findobj(0, 'type', 'figure');
delete(setdiff(all_figs, figs2keep));
% --- Executes during object creation, after setting all properties.
function figure1_CreateFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
function getSimuVars(handles)
handles.simu.n_iter = str2double(get(handles.nPairsSTDPedit,'String'));
handles.simu.frequency = str2double(get(handles.freqSTDPedit,'String'));
handles.simu.int_step = str2double(get(handles.intStepedit,'String'));
handles.simu.T = str2double(get(handles.STDPDurationedit,'String'));
handles.simu.int_scheme = 'euler_expl';
handles.simu.model = 'caProd';
synData = get(handles.synParams,'Data');
synData = synData(1,:);
handles.params = getSynapse();
handles.params.tau_Ca = synData(1,1);
handles.params.tau_rho = synData(1,2);
handles.params.tau_x = synData(1,3);
handles.params.C_pre = synData(1,4);
handles.params.C_post = synData(1,5);
handles.params.delay_pre = synData(1,6);
handles.params.theta_pot = synData(1,7);
handles.params.theta_dep = synData(1,8);
handles.params.S_attr = synData(1,9);
handles.params.noise_lvl = synData(1,10);
handles.params.dampFactor = synData(1,11);
handles.params.theta_act = handles.params.theta_dep;
handles.params.TD = 0;
handles.params.tau_x = 1e3 .* handles.params.tau_x;
handles.params.tau_Ca = 1e3 .* handles.params.tau_Ca;
handles.params.tau_rho = 1e3 .* handles.params.tau_rho;
handles.params.delay_pre = 1e3 .* handles.params.delay_pre;
handles.params.tau_w = 50000;