-
Notifications
You must be signed in to change notification settings - Fork 1
/
settings.g
1773 lines (1118 loc) · 31.9 KB
/
settings.g
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
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//genesis
//
// $Id: settings.g 1.8.2.2.1.1.1.1.1.1.3.4.1.1.1.2 Thu, 04 Apr 2002 12:46:38 +0200 hugo $
//
//////////////////////////////////////////////////////////////////////////////
//'
//' Purkinje tutorial
//'
//' (C) 1998-2002 BBF-UIA
//'
//' see our site at http://www.bbf.uia.ac.be/ for more information regarding
//' the Purkinje cell and genesis simulation software.
//'
//'
//' functional ideas ... Erik De Schutter, [email protected]
//' genesis coding ..... Hugo Cornelis, [email protected]
//'
//' general feedback ... Reinoud Maex, Erik De Schutter
//'
//////////////////////////////////////////////////////////////////////////////
// settings.g : control panel settings
int include_settings
if ( {include_settings} == 0 )
include_settings = 1
include actions.g
//v normal path for xcell script
str cbXCell
///
/// SH: SettingsBasket
///
/// DE: display and handle settings for basket firing
/// synaptic strength
///
function SettingsBasket
//- give an informational message
echo "Settings for basket axon"
//- show settings form
xshow /settings/basket
end
///
/// SH: SettingsBasketHide
///
/// DE: Hide settings form for basket axon experiment
///
function SettingsBasketHide
//- give an informational message
echo "Hiding settings for basket axons"
//- show settings form
xhide /settings/basket
end
///
/// SH: SettingsBasketSetStrength
///
/// PA: value.: new strength/level for synapses
///
/// DE: Set the strength/level for basket synapses
///
function SettingsBasketSetStrength(value)
float value
//- give an informational message
echo "Setting strength for basket synapses to "{value}
//- set global variable
basketLevel = {value}
end
///
/// SH: SettingsBasketCreate
///
/// PA: path..: path of parent to contain the form
///
/// DE: create the form for the settings for basket axon firing
///
function SettingsBasketCreate(path)
str path
//- give an informational message
echo "Creating form for basket axons"
//- retreive registered values for geometry
int xgeom = {getfield /settings/globals xgeom}
int ygeom = {getfield /settings/globals ygeom}
int wgeom = {getfield /settings/globals wgeom}
int hgeom = {getfield /settings/globals hgeom}
//- create form
create xform {path}basket [{xgeom},{ygeom},350,95]
//- make it the current element
pushe {path}basket
//- create title label
create xlabel heading \
-label "Basket axon settings"
//- create dialog for synaptic strength
create xdialog strength \
-value {basketLevel} \
-title "Relative synaptic strength" \
-script "SettingsBasketSetStrength <v>"
//- create a button for closing the window
create xbutton close \
-title "Done" \
-script "SettingsBasketHide"
//- go to previous current element
pope
end
///
/// SH: SettingsClimbing
///
/// DE: display and handle settings for climbing fiber firing
/// delay parameter
/// synaptic strength
///
function SettingsClimbing
//- give an informational message
echo "Settings for climbing fiber"
//- show settings form
xshow /settings/climbing
end
///
/// SH: SettingsClimbingHide
///
/// DE: Hide settings form for climbing fiber experiment
///
function SettingsClimbingHide
//- give an informational message
echo "Hiding settings for climbing fiber"
//- show settings form
xhide /settings/climbing
end
///
/// SH: SettingsClimbingSetDelay
///
/// PA: value.: new delay between synapses (in msec)
///
/// DE: Set the delay between consecutive synapses for climbing fiber volley
///
function SettingsClimbingSetDelay(value)
float value
//- give an informational message
echo "Setting delay between climbing fiber synapses to "{value}" msec"
//- set global variable
delay = {value * 1.0e-3}
end
///
/// SH: SettingsClimbingSetStrength
///
/// PA: value.: new strength for synapses
///
/// DE: Set the strength for climbing fiber synapses
///
function SettingsClimbingSetStrength(value)
float value
//- give an informational message
echo "Setting strength for climbing fiber synapses to "{value}
//- set global variable
strength = {value}
end
///
/// SH: SettingsClimbingCreate
///
/// PA: path..: path of parent to contain the form
///
/// DE: create the form for the settings for climbing fiber firing
///
function SettingsClimbingCreate(path)
str path
//- give an informational message
echo "Creating form for climbing fiber"
//- retreive registered values for geometry
int xgeom = {getfield /settings/globals xgeom}
int ygeom = {getfield /settings/globals ygeom}
int wgeom = {getfield /settings/globals wgeom}
int hgeom = {getfield /settings/globals hgeom}
//- create form
create xform {path}climbing [{xgeom},{ygeom},350,120]
//- make it the current element
pushe {path}climbing
//- create title label
create xlabel heading \
-label "Climbing fiber settings"
//- create dialog for delay between synapses
create xdialog delay \
-value {delay * 1000} \
-title "Delay between synapses (msec) : " \
-script "SettingsClimbingSetDelay <v>"
//- create dialog for synaptic strength
create xdialog strength \
-value {strength} \
-title "Relative synaptic strength" \
-script "SettingsClimbingSetStrength <v>"
//- create a button for closing the window
create xbutton close \
-title "Done" \
-script "SettingsClimbingHide"
//- go to previous current element
pope
end
///
/// SH: SettingsIClamp
///
/// DE: display and handle settings for current clamp
///
function SettingsIClamp
//- give an informational message
echo "Settings for current clamp experiment"
//- show the form for current clamping
//! this still uses a hard coded path
xshow /settings/iClamp
end
///
/// SH: SettingsIClampSetGenerator
///
/// DE: Set the generator settings to respect the global variables
/// vars : {iClampCurrentBase}
/// {iClampCurrentOffset}
/// {iClampCurrentWidth}
/// {iClampCurrentPeriod}
///
/// NO: This function has become obsolete, it has been recoded in actions.g .
///
// function SettingsIClampSetGenerator
// //- set fields of generator
// setfield /settings/iClamp/current \
// level1 {{iClampCurrentBase + iClampCurrentOffset} * 1.0e-9} \
// baselevel {iClampCurrentBase * 1.0e-9} \
// width1 {iClampCurrentWidth * 1.0e-3} \
// delay2 {iClampCurrentPeriod * 1.0e-3} \
// ctecurrent {iClampCurrentBase * 1.0e-9} \
// delay1 0 \
// level2 0 \
// width2 0 \
// trig_mode 0
// end
///
/// SH: SettingsIClampCreateGenerator
///
/// PA: path..: path of parent to contain the object
///
/// DE: create the pulse generator for current injection experiments
/// A message to the soma of the cell is created, so the solver
/// must not yet be set up.
///
/// NO: This function has become obsolete, it has been recoded in actions.g .
///
// function SettingsIClampCreateGenerator(path)
// str path
// //- go to the given element
// pushe {path}
// //- create the pulsegen object
// create pulsegen current
// //- set fields for pulse generator
// setfield ^ \
// level1 2.0e-9 \
// width1 30 \
// delay1 0 \
// level2 0 \
// width2 0 \
// delay2 0 \
// baselevel 0 \
// trig_mode 0
// //- add a field for a constant current
// addfield ^ ctecurrent \
// -description "Constant current"
// //- set this field to something sensefull
// setfield ^ ctecurrent 2.0e-9
// //- create a disabled compartment for messaging the solver
// create compartment messenger
// //- add a message from the messenger to the soma of the cell
// addmsg messenger {cellpath}/soma INJECT inject
// //- set the fields for current clamp to registered globals
// //SettingsIClampSetGenerator
// ActionIClampSetGenerator /actions/iClamp/
// //- go to previous current element
// pope
// end
///
/// SH: SettingsIClampHide
///
/// DE: hide the IClamp settings window
///
function SettingsIClampHide
//- hide the window
//! this uses still a hard coded path
xhide /settings/iClamp
end
///
/// SH: SettingsIClampSetCurrent
///
/// PA: level.: value in nA for current
///
/// DE: set the current for the pulse generator and for cte current
///
function SettingsIClampSetCurrent(level)
float level
if (level <= 10)
//- give diagnostics
echo "Setting base current to "{level}" nA"
//- set global variable
iClampCurrentBase = {level}
//- set the fields for current clamp to registered globals
ActionIClampSetGenerator /actions/iClamp/
else
//- give diagnostics
echo "Base current above 10 nA not allowed."
//- reset dialog
setfield /settings/iClamp/level \
value {iClampCurrentBase}
end
end
///
/// SH: SettingsIClampSetOffset
///
/// PA: offset: value in nA for pulse offset
///
/// DE: set offset for current pulses
///
function SettingsIClampSetOffset(offset)
float period
if (offset <= 10)
//- give diagnostics
echo "Setting pulse offset to "{offset}" nA"
//- set global variable
iClampCurrentOffset = {offset}
//- set the fields for current clamp to registered globals
ActionIClampSetGenerator /actions/iClamp/
else
//- give diagnostics
echo "Pulse Amplitude above 10 nA not allowed."
//- reset dialog
setfield /settings/iClamp/offset \
value {iClampCurrentOffset}
end
end
///
/// SH: SettingsIClampSetPeriod
///
/// PA: period: value in msec for period
///
/// DE: set period for current pulses
///
function SettingsIClampSetPeriod(period)
float period
//- give diagnostics
echo "Setting pulse period to "{period}" msec"
//- if the period is smaller than the width
if (iClampCurrentWidth <= period)
//- set global variable
iClampCurrentPeriod = {period}
//- set the fields for current clamp to registered globals
ActionIClampSetGenerator /actions/iClamp/
//- else period is greater than width
else
//- notice the user
echo "Period must be greater than width"
end
end
///
/// SH: SettingsIClampSetTarget
///
/// PA: width.: value in msec for width of pulses
///
/// DE: set width for width of pulses
///
function SettingsIClampSetTarget(target)
str target
//- give diagnostics
echo "Setting current clamp target to compartment" \
{cellpath}"/"{target}
//- if exists
if ( {exists {{cellpath} @ "/" @ {target}}} )
//- set global variable
iClampCurrentTarget = {target}
//- set the fields for current clamp to registered globals
ActionIClampSetGenerator /actions/iClamp/
//- else
else
//- notice the user
echo "Compartment not found"
end
end
///
/// SH: SettingsIClampSetWidth
///
/// PA: width.: value in msec for width of pulses
///
/// DE: set width for width of pulses
///
function SettingsIClampSetWidth(width)
float width
//- give diagnostics
echo "Setting pulse width to "{width}" msec"
//- if the period is smaller than the width
if (width <= iClampCurrentPeriod)
//- set global variable
iClampCurrentWidth = {width}
//- set the fields for current clamp to registered globals
ActionIClampSetGenerator /actions/iClamp/
//- else period is greater than width
else
//- notice the user
echo "Period must be greater than width"
end
end
///
/// SH: SettingsIClampSwitch
///
/// DE: Enable/disable current clamp according to {iCurrentMode}
/// Enabling the current clamp mode means adding a message from the pulse
/// generator to the soma of the Purkinje cell. A look is made to the
/// state of the toggle button to make difference between constant current
/// and current pulses
///
/// NO: This function has become obsolete, current switching is now done in
/// in actions.g .
///
function SettingsIClampSwitch
//- if current clamp is enabled
if (iCurrentMode != 0)
//- if pulse train toggle button is clicked
if ( {getfield /settings/iClamp/pulse state} == 1)
//- give some info
echo "Switching to current pulses"
//- add message from generator to soma
//- for current pulses
addmsg /settings/iClamp/current \
/settings/iClamp/messenger \
INJECT output
//- else
else
//- give some info
echo "Switching to constant current"
//- from generator to soma for constant current
addmsg /settings/iClamp/current \
/settings/iClamp/messenger \
INJECT ctecurrent
end
//- reset the pulse generator
call /settings/iClamp/current RESET
//- else current clamp is disabled
else
//- give some info
echo "Switching off current injection"
//- delete outgoing message from the pulse generator
deletemsg /settings/iClamp/current 0 -outgoing
//- clear the inject field of the messenger object
setfield /settings/iClamp/messenger \
inject 0
end
end
///
/// SH: SettingsIClampToggleMode
///
/// DE: toggle pulse mode for the current injection
/// If the current mode is not active (iCurrentMode is zero),
/// nothing is done
///
function SettingsIClampToggleMode
//- get state of toggle button
int state = {getfield /settings/iClamp/pulse state}
//- check if current mode is enabled
if ( {iCurrentMode} != 0)
//- stop current mode
ActionIClampStop
//- start new current with appropriate state
ActionIClampStart {state}
end
//- check state of toggle button
if ( {state} == 1)
//- hide the offset, width and period labels
xhide /settings/iClamp/nooffset
xhide /settings/iClamp/nowidth
xhide /settings/iClamp/noperiod
//- show the offset, width and period dialogs
xshow /settings/iClamp/offset
xshow /settings/iClamp/width
xshow /settings/iClamp/period
else
//- hide the offset, width and period dialogs
xhide /settings/iClamp/offset
xhide /settings/iClamp/width
xhide /settings/iClamp/period
//- show the offset, width and period labels
xshow /settings/iClamp/nooffset
xshow /settings/iClamp/nowidth
xshow /settings/iClamp/noperiod
end
end
///
/// SH: SettingsIClampCreate
///
/// PA: path..: path of parent to contain the form (ending in /)
///
/// DE: create the form for the settings for current clamp
/// create the pulse generator for current clamp
///
function SettingsIClampCreate(path)
str path
//- give an informational message
echo "Creating form for current clamping"
//- retreive registered values for geometry
int xgeom = {getfield /settings/globals xgeom}
int ygeom = {getfield /settings/globals ygeom}
int wgeom = {getfield /settings/globals wgeom}
int hgeom = {getfield /settings/globals hgeom}
//- create form
create xform {path}iClamp [{xgeom},{ygeom},{wgeom},{hgeom}]
//- make it the current element
pushe {path}iClamp
//- create title label
create xlabel heading \
-label "Current clamp settings"
//- create dialog for current injection
create xdialog level \
-value {iClampCurrentBase} \
-title "Level (nA) : " \
-script "SettingsIClampSetCurrent <v>"
// // create dialog for target element
// create xdialog target \
// -value {iClampCurrentTarget} \
// -title "Target comp : " \
// -script "SettingsIClampSetTarget <v>"
//- create toggle button for pulse or constant
create xtoggle pulse \
-title ""
//- set fields for on/off state
setfield pulse \
onlabel "Current pulses" \
offlabel "Constant current"
//- set script for toggle button
setfield pulse \
script "SettingsIClampToggleMode"
//- create dialog for pulse offset
create xdialog offset \
-value {iClampCurrentOffset} \
-title "Pulse amplitude (nA) : " \
-script "SettingsIClampSetOffset <v> "
//- create dialog for pulse width
create xdialog width \
-value {iClampCurrentWidth} \
-title "Pulse width (msec) : " \
-script "SettingsIClampSetWidth <v>"
//- create dialog for period between pulses
create xdialog period \
-value {iClampCurrentPeriod} \
-title "Pulse period (msec) : " \
-script "SettingsIClampSetPeriod <v>"
//- create a button for closing the window
create xbutton close \
-title "Done" \
-script "SettingsIClampHide"
//- create a label for no offset
create xlabel nooffset \
-ygeom 3:pulse \
-title "Amplitude not available"
//- hide the offset dialog
xhide offset
//- create a label for no width
create xlabel nowidth \
-ygeom 3:offset \
-title "Width not available"
//- hide the width dialog
xhide width
//- create label for no period
create xlabel noperiod \
-ygeom 3:width \
-title "Period not available"
//- hide the period dialog
xhide period
//- pop previous current element
pope
end
///
/// SH: SettingsParallel
///
/// DE: display and handle settings for parallel synchro firing
/// handles localization within xcell
/// handles settings for uniform distribution
/// handles amplitude (strength of synapses)
///
function SettingsParallel
//- give an informational message
echo "Settings for synchronous parallel fiber firing"
//- show the form for current clamping
//! this still uses a hard coded path
xshow /settings/parallel
end
///
/// SH: SettingsParallelHide
///
/// DE: hide the parallel settings window
///
function SettingsParallelHide
//- hide the window
//! this uses still a hard coded path
xhide /settings/parallel
end
///
/// SH: SettingsParallelLocalSet
///
/// PA: branch: dendrite clicked on within xcell
///
/// DE: Set local dendrites for synchronous firing
/// Resets script field for xcell widget
///
function SettingsParallelLocalSet(branch)
//- default we give a popup
int bPopup = 1
//- reset field for xcell script
setfield /xcell/draw/xcell1 \
script {cbXCell}
//- isolate tail from clicked membrane
str branchTail = {getpath {branch} -tail}
//- find opening brace for array
int openBrace = {findchar {branchTail} "["}
//- if the argument is from an array
if (openBrace != -1)
//- cut off the index and set global variable
str branchNoIndex = {substring {branchTail} 0 {openBrace - 1}}
//- if the branch has an associated mapping
if ({exists /mappings/{branchNoIndex}})
//- set synchro global
synchroBranch = {branchNoIndex}
//- update the label field
setfield /settings/parallel/labelArea \
label "Branch : "{synchroBranch}
//- we should not give a popup
bPopup = 0
//- give diagnostics
echo \
"Synchronous parallel fiber set to" \
{synchroBranch}
end
end
//- if we should give a popup
if (bPopup)
//- show the popup
xshow /settings/localFailed
//- else the action completed
else
//- hide the local set action window
xhide /settings/localSet
end
end