-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKTzV2_Data_Header.cs
1989 lines (1815 loc) · 95.5 KB
/
KTzV2_Data_Header.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MatFileHandler;
/*
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.Data.Matlab;
/**/
namespace KTzV2.Data.Header
{
public enum KTzParamGroups
{
Network,
Neuron,
InitCond,
Synapse,
Stimulus,
Simulation
}
public enum OutputFileFormat
{
txt,
mat
}
public enum QuenchedDisorderType
{
Gaussian,
Uniform,
None
}
public class QuenchedDisorderParse
{
public KTzParameters Param { get; private set; }
public QuenchedDisorderType Type { get; private set; }
public Double Mean { get; private set; }
public Double Stddev { get; private set; }
public Double Min { get; private set; }
public Double Max { get; private set; }
private KTzV2.Maths.Random.GaussianRand GRand { get; set; }
private KTzV2.Maths.Random.HomogeneousRand URand { get; set; }
public Func<Double> NextSample { get; private set; }
public Action<Double> Set { get; private set; }
public QuenchedDisorderParse(KTzParameters param, String setting)
{
this.Param = param;
this.Parse(setting);
}
private void Parse(String setting)
{
String[] ss = setting.Split(':');
if (ss.Length != 3)
throw new ArgumentException(String.Format("Disorder setting for {0} must have two numbers: {0}Disorder=Uniform_or_Gaussian:min_or_mean:max_or_stddev",this.Param));
try
{
this.Type = (QuenchedDisorderType)Enum.Parse(typeof(QuenchedDisorderType), ss[0], true);
}
catch (ArgumentException)
{
Console.WriteLine("WARNING: Unknown disorder type for {0}: {1}", this.Param, ss[0]);
}
switch (this.Type)
{
case QuenchedDisorderType.Gaussian:
this.Mean = Convert.ToDouble(ss[1]);
this.Stddev = Convert.ToDouble(ss[2]);
this.Min = Double.NegativeInfinity;
this.Max = Double.PositiveInfinity;
this.GRand = new KTzV2.Maths.Random.GaussianRand(this.Mean, this.Stddev);
this.NextSample = this.NextSample_G;
this.Set = this.SetG;
break;
case QuenchedDisorderType.Uniform:
this.Min = Convert.ToDouble(ss[1]);
this.Max = Convert.ToDouble(ss[2]);
this.Mean = (this.Min + this.Max) / 2.0D;
this.Stddev = Math.Sqrt( Math.Pow(this.Max - this.Min,2.0D)/12.0D );
this.URand = new KTzV2.Maths.Random.HomogeneousRand();
this.NextSample = this.NextSample_U;
this.Set = this.SetU;
break;
case QuenchedDisorderType.None:
this.SetNone(Convert.ToDouble(ss[1]));
this.NextSample = () => this.Mean;
this.Set = this.SetNone;
break;
default:
throw new ArgumentException("unknown disorder type");
}
}
private void SetNone(Double Mean)
{
this.Mean = Mean;
this.Stddev = 0.0D;
this.Min = this.Mean;
this.Max = this.Mean;
}
private void SetU(Double Mean)
{
var d = Math.Abs(this.Max - this.Min);
this.Mean = Mean;
this.Min = this.Mean - d/2.0D;
this.Max = this.Mean + d/2.0D;
this.Stddev = Math.Sqrt(Math.Pow(this.Max - this.Min, 2.0D) / 12.0D);
}
private void SetG(Double Mean)
{
Double cv = this.Stddev / this.Mean;
this.Mean = Mean;
this.Stddev = cv * this.Mean;
this.GRand = new KTzV2.Maths.Random.GaussianRand(this.Mean, this.Stddev);
}
public override String ToString()
{
if (this.Type != QuenchedDisorderType.None)
return String.Format("{0}_Disorder={1}:(min,max,mean,std)=({2},{3},{4},{5})",this.Param,this.Type,this.Min,this.Max,this.Mean,this.Stddev);
return String.Format("{0}_Disorder={1}",this.Param,this.Type);
}
private Double NextSample_U()
{
return (this.Max - this.Min) * this.URand.GetRandomFull() + this.Min;
}
private Double NextSample_G()
{
return this.GRand.getRandom();
}
}
public static class MyExtensionMethods
{
public static MatFileHandler.IArrayOf<T> NewArray<T>(this MatFileHandler.DataBuilder matDataBuilder, T[][] data, params int[] dimensions)
where T : struct
{
var array = matDataBuilder.NewArray<T>(dimensions);
var m = data.Length;
var n = data[0].Length;
for (var i = 0; i < m; i++)
{
for (var j = 0; j < n; j++)
{
array[j * m + i] = data[i][j];
//array[i * n + j] = data[i][j];
}
}
return array;
}
public static T[][] Transpose<T>(this T[][] arr)
where T : struct
{
int rowCount = arr.Length;
int columnCount = arr[0].Length;
T[][] transposed = new T[columnCount][];
if (rowCount == columnCount)
{
transposed = (T[][])arr.Clone();
for (int i = 1; i < rowCount; i++)
{
for (int j = 0; j < i; j++)
{
T temp = transposed[i][j];
transposed[i][j] = transposed[j][i];
transposed[j][i] = temp;
}
}
}
else
{
for (int column = 0; column < columnCount; column++)
{
transposed[column] = new T[rowCount];
for (int row = 0; row < rowCount; row++)
{
transposed[column][row] = arr[row][column];
}
}
}
return transposed;
}
public static T[] GetCol<T>(this T[][] X, int j)
where T: struct
{
T[] c = new T[X.Length];
int i = 0;
while (i < X.Length)
{
c[i] = X[i][j];
i++;
}
return c;
}
public static IEnumerable<Double> ToDouble(this List<int> x)
{
return x.Select(el => Convert.ToDouble(el));
}
}
public static class KTzHeader
{
public static Boolean WAIT_ON_FINISH = false;
public static Dictionary<KTzParameters, Double> ParamList_Double { get; private set; }
public static Dictionary<KTzParameters, Int32> ParamList_Int32 { get; private set; }
public static Dictionary<KTzParameters, String> ParamList_String { get; private set; }
public static Dictionary<KTzParameters, String> ParamDescription { get; private set; }
public static Dictionary<KTzParameters, KTzParamGroups> ParamGroups { get; private set; }
public static Dictionary<KTzParameters, Func<Int32, String>> ParamConverter { get; private set; }
public static HashSet<KTzParameters> ParamAllowedQuenchedDisorder { get; private set; }
public static Dictionary<KTzParameters, QuenchedDisorderParse> ParamDisorderSetting { get; private set; }
public static String inputArgsStr { get; private set; }
public static bool CanHaveDisorder(KTzParameters p, bool silent = true)
{
bool hasDisorderParam = Enum.TryParse(p.ToString() + "Disorder", false, out KTzParameters pdis);
if ((!hasDisorderParam) && (!silent))
Console.WriteLine("WARNING: {0}Disorder is not defined in the KTzParameters enum and its disorder cannot be set", p);
return hasDisorderParam && ParamAllowedQuenchedDisorder.Contains(p);
}
public static bool CanHaveDisorder(String p, bool silent = true)
{
try
{
return KTzHeader.CanHaveDisorder((KTzParameters)Enum.Parse(typeof(KTzParameters), p, false), silent: silent);
}
catch (ArgumentException)
{
Console.WriteLine("WARNING: {0} is not a valid param name", p);
return false;
}
}
public static bool IsDisorderInputParam(KTzParameters p, bool silent = true)
{
return KTzHeader.IsDisorderInputParam(p.ToString(), silent: silent);
}
public static bool IsDisorderInputParam(String p, bool silent=true)
{
String par = p.Replace("Disorder", "");
if ((!KTzHeader.CanHaveDisorder(par)) && (!silent))
Console.WriteLine("WARNING: {0} cannot have quenched disorder", par);
return p.Contains("Disorder") && KTzHeader.CanHaveDisorder(par, silent: silent);
}
public static QuenchedDisorderParse GetDisorderSetting(KTzParameters p)
{
return KTzHeader.ParamDisorderSetting[p];
}
public static Boolean CheckForInputArguments(String[] args)
{
if ((args.Length == 0) || (!args.Contains<String>("-run")))
{
KTzHeader.ShowHelp();
return false;
}
String temp = args[0].ToLower();
if (temp[0] == '-') temp = temp.Substring(1);
if (temp == "help")
{
KTzHeader.ShowHelp();
return false;
}
if (args.Contains("-wait")) KTzHeader.WAIT_ON_FINISH = true;
KTzParameters p;
KTzHeader.inputArgsStr = KTzHeader.GetKTzV2ExeName();
foreach (String str in args)
{
KTzHeader.inputArgsStr += " " + str;
if ((str == "-ask") || (str == "-run") || (str == "-wait")) continue;
String[] parVal = str.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries);
if (parVal[0][0] == '-') parVal[0] = parVal[0].Substring(1); // ignoring the "-" in the beginning
try
{
p = (KTzParameters)Enum.Parse(typeof(KTzParameters), parVal[0], false);
}
catch (ArgumentException)
{
KTzHeader.ErrorUnknownParameter(parVal[0], parVal[1]);
return false;
}
try
{
if (KTzHeader.ParamList_Double.ContainsKey(p))
{
KTzHeader.SetPar(p, Convert.ToDouble(parVal[1]));
}
else
{
KTzHeader.SetPar(p, Convert.ToInt32(parVal[1]));
}
}
catch (FormatException)
{
try
{
KTzHeader.SetParByText(p, parVal[1]);
}
catch (ArgumentOutOfRangeException e)
{
KTzHeader.ErrorUnacceptedValue(parVal[0], parVal[1]);
Console.WriteLine(e.Message);
return false;
}
catch (ArgumentException e)
{
KTzHeader.ErrorUnknownParameter(parVal[0], parVal[1]);
Console.WriteLine(e.Message);
return false;
}
}
catch (ArgumentException e)
{
KTzHeader.ErrorUnknownParameter(parVal[0], parVal[1]);
Console.WriteLine(e.Message);
return false;
}
Console.WriteLine("Set: {0} = {1}", parVal[0], parVal[1]);
}
if (args.Contains<String>("-ask"))
{
Console.Write(KTzHeader.GetAllParamString(true));
KTzHeader.AskForParamsChanges();
}
return true;
}
private static void SetParByText(KTzParameters p, String value)
{
Object val;
switch (p)
{
case KTzParameters.netType:
val = Enum.Parse(typeof(KTzV2.Maths.Matrices.AdjacencyMatrix.AdjacencyMatrixType), value, true);
break;
case KTzParameters.sType:
val = Enum.Parse(typeof(KTzV2.Synapses.SynapseType), value, true);
break;
case KTzParameters.noiseType:
val = Enum.Parse(typeof(KTzV2.Synapses.NoiseType), value, true);
break;
case KTzParameters.neuron:
val = Enum.Parse(typeof(KTzV2.Neurons.NeuronType), value, true);
break;
case KTzParameters.stimType:
val = Enum.Parse(typeof(KTzV2.Stimuli.StimulusType), value, true);
break;
case KTzParameters.iCond:
val = Enum.Parse(typeof(KTzV2.Data.InitialConditionType), value, true);
break;
case KTzParameters.samp:
val = Enum.Parse(typeof(KTzV2.Data.NetworkSamplingType), value, true);
break;
case KTzParameters.simType:
val = Enum.Parse(typeof(KTzV2.SimulationType), value, true);
break;
case KTzParameters.dynType:
val = Enum.Parse(typeof(KTzV2.DynamicsSimType), value, true);
break;
case KTzParameters.cVar:
val = Enum.Parse(typeof(KTzV2.Data.CountVariable), value, true);
break;
case KTzParameters.bifWrite:
val = Enum.Parse(typeof(KTzV2.BifurcationWritePolicy), value, true);
break;
case KTzParameters.indChoice:
val = Enum.Parse(typeof(KTzV2.Sims.Network.StimulusIndexChoice), value, true);
break;
case KTzParameters.outAvgMode:
val = Enum.Parse(typeof(KTzV2.OutputAverageMode), value, true);
break;
case KTzParameters.coupParam:
val = Enum.Parse(typeof(KTzV2.Sims.Network.CouplingParam), value, true);
break;
case KTzParameters.oFileFormat:
val = Enum.Parse(typeof(KTzV2.Data.Header.OutputFileFormat), value, true);
break;
case KTzParameters.ParamForRange:
val = Enum.Parse(typeof(KTzV2.ParamForRangeInDynamicsSim), value, true);
break;
case KTzParameters.simTimeScheme:
val = Enum.Parse(typeof(KTzV2.Sims.Network.SimulationTimeScheme), value, true);
break;
case KTzParameters.avgInp:
case KTzParameters.wCSV:
case KTzParameters.wData:
case KTzParameters.wDif:
case KTzParameters.wAvalDist:
case KTzParameters.saveSpikeTimes:
case KTzParameters.netDir:
case KTzParameters.wObs:
case KTzParameters.writeRhoTS:
val = Enum.Parse(typeof(KTzV2.Data.YesOrNoAnswer), value, true);
break;
default:
if (KTzHeader.ParamList_String.ContainsKey(p))
{
if ((p == KTzParameters.netFile) || (p == KTzParameters.oFile))
{
char[] cseq;
if (value.Contains(System.IO.Path.DirectorySeparatorChar))
cseq = System.IO.Path.GetInvalidPathChars();
else
cseq = System.IO.Path.GetInvalidFileNameChars();
foreach (char c in cseq)
{
if (value.Contains(c))
{
throw new ArgumentOutOfRangeException(String.Format("The value {0} has invalid characters.", value));
}
}
}
KTzHeader.SetPar(p, value);
return;
}
val = null;
break;
}
if (KTzHeader.IsDisorderInputParam(p))
{
KTzHeader.AddParDisorder(p, value);
}
else
{
if (val == null)
{
throw new ArgumentOutOfRangeException(String.Format("Parameter {0} was not found as a text settable parameter.", p.ToString()));
}
if (KTzHeader.ParamList_Int32.ContainsKey(p))
{
KTzHeader.SetPar(p, (Int32)val);
return;
}
throw new ArgumentOutOfRangeException(String.Format("Parameter {0} was not part of the Int32 valued list nor the String valued list.", p.ToString()));
}
}
public static void AskForParamsChanges()
{
String input;
KTzParameters p;
Object val = new Object();
Console.WriteLine("-");
Console.WriteLine("to change any parameter, type its name and press <ENTER>");
Console.WriteLine("or just press <ENTER> to continue");
do
{
Console.Write("... param name: ");
input = Console.ReadLine();
try
{
p = (KTzParameters)Enum.Parse(typeof(KTzParameters), input, false);
if (ParamList_Double.ContainsKey(p))
{
val = KTzHeader.query<Double>(input, ParamList_Double[p]);
KTzHeader.SetPar(p, (Double)val);
}
else
{
val = KTzHeader.query<Int32>(input, ParamList_Int32[p]);
KTzHeader.SetPar(p, (Int32)val);
}
}
catch (ArgumentException)
{
KTzHeader.ErrorUnknownParameter(input, "");
}
Console.WriteLine("param set -> " + input + " = " + (String)val);
} while (input != String.Empty);
}
public static T query<T>(String queryTxt, T defaultInput) where T : struct
{
System.ComponentModel.TypeConverter converter = System.ComponentModel.TypeDescriptor.GetConverter(typeof(T));
if (!converter.CanConvertFrom(typeof(String)))
throw new NotSupportedException("Can't convert to " + typeof(T).Name);
String input;
T result;
while (true)
{
Console.WriteLine(" {0} (press only <ENTER> for default)", queryTxt);
Console.Write(" default value = {0}, new value = ", defaultInput);
input = Console.ReadLine();
if (input != String.Empty)
{
try
{
result = (T)converter.ConvertFromInvariantString(input);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
continue;
}
}
else
{
result = defaultInput;
Console.WriteLine("using default value: " + defaultInput);
}
break;
}
return result;
}
private static void AddParDisorder(KTzParameters parDisorder, String disorder_setting)
{
var pp = (KTzParameters)Enum.Parse(typeof(KTzParameters), parDisorder.ToString().Replace("Disorder", ""), false);
KTzHeader.ParamDisorderSetting.Add(pp, new QuenchedDisorderParse(pp, disorder_setting));
KTzHeader.AddPar(parDisorder, KTzHeader.ParamDisorderSetting[pp].ToString(), KTzHeader.ParamGroups[pp]);
KTzHeader.ParamDescription.Add(parDisorder, String.Format("Quenched disorder definition for {0} parameter {1}", KTzHeader.ParamGroups[pp], pp));
}
private static void AddPar(KTzParameters par, Double val, KTzParamGroups group, bool allowsDisorder = false)
{
KTzHeader.ParamList_Double.Add(par, val);
KTzHeader.ParamGroups.Add(par, group);
if (allowsDisorder)
KTzHeader.ParamAllowedQuenchedDisorder.Add(par);
}
private static void AddPar(KTzParameters par, Int32 val, KTzParamGroups group)
{
KTzHeader.ParamList_Int32.Add(par, val);
KTzHeader.ParamGroups.Add(par, group);
}
private static void AddPar(KTzParameters par, Int32 val, KTzParamGroups group, Type T)
{
KTzHeader.ParamList_Int32.Add(par, val);
KTzHeader.ParamGroups.Add(par, group);
if (T.IsEnum)
KTzHeader.ParamConverter.Add(par,k => Enum.GetName(T, k));
}
private static void AddPar(KTzParameters par, String val, KTzParamGroups group)
{
KTzHeader.ParamList_String.Add(par, val);
KTzHeader.ParamGroups.Add(par, group);
}
public static void SetPar(KTzParameters par, Double val)
{
KTzHeader.ParamList_Double[par] = val;
if (KTzHeader.ParamDisorderSetting.Keys.Contains(par))
KTzHeader.ParamDisorderSetting[par].Set(val);
}
public static void SetPar(KTzParameters par, Int32 val)
{
KTzHeader.ParamList_Int32[par] = val;
}
public static void SetPar(KTzParameters par, String val)
{
KTzHeader.ParamList_String[par] = val;
}
/*
public static T GetPar<T>(KTzParameters p)
{
System.ComponentModel.TypeConverter converter = System.ComponentModel.TypeDescriptor.GetConverter(typeof(T));
T res;
switch (Type.GetTypeCode(typeof(T)))
{
case TypeCode.Int32:
res = (T)converter.ConvertFrom(GetPar_Int32(p));
break;
case TypeCode.Double:
res = (T)converter.ConvertFrom(GetPar_Double(p));
break;
case TypeCode.String:
res = (T)converter.ConvertFrom(GetPar_String(p));
break;
default:
throw new ArgumentOutOfRangeException("T","unknown type T");
}
return res;
}
/**/
public static Double GetPar_Double(KTzParameters p)
{
if (KTzHeader.ParamDisorderSetting.Keys.Contains(p))
return KTzHeader.ParamDisorderSetting[p].NextSample();
return KTzHeader.ParamList_Double[p];
}
public static Int32 GetPar_Int32(KTzParameters p)
{
return KTzHeader.ParamList_Int32[p];
}
public static String GetPar_String(KTzParameters p)
{
return KTzHeader.ParamList_String[p];
}
public static Boolean HasParam(KTzParameters p)
{
return KTzHeader.ParamList_Double.ContainsKey(p) || KTzHeader.ParamList_Int32.ContainsKey(p) || KTzHeader.ParamList_String.ContainsKey(p);
}
private static void ErrorUnacceptedValue(String par, String val)
{
Console.WriteLine("Parameter {0} does not accept value {1}", par, val);
Console.WriteLine("Exiting...");
KTzHeader.ShowHelp();
}
private static void ErrorUnknownParameter(String par, String val)
{
Console.WriteLine("Unknown parameter's value: {0} = {1}", par, val);
Console.WriteLine("Exiting...");
KTzHeader.ShowHelp();
}
private static void ShowHelp()
{
Console.WriteLine("This program may run two different kinds of simulation: (1) Avalanche Dynamics and (2) Bifurcation.");
Console.WriteLine("(1) The avalanche dynamics runs the specified network and returns avalanche distributions.");
Console.WriteLine("(2) Bifurcation simulation runs the network for the specified J (or alpha) and I (or r) intervals and returns phase transition information as the parameters change.");
Console.WriteLine("-");
Console.WriteLine("USAGE");
Console.WriteLine("-----");
Console.WriteLine("$ " + KTzHeader.GetKTzV2ExeName() + " [-run] [-ask] [-wait] [PARAM1=VALUE1 PARAM2=VALUE2 ...]");
Console.WriteLine("arguments between braces are optional");
Console.WriteLine("-run\t\truns the program; if it is not specified, this message is printed");
Console.WriteLine("-ask\t\tasks for params change");
Console.WriteLine("-wait\t\twait for ENTER on the end of the program");
Console.WriteLine("-");
Console.WriteLine("QUENCHED DISORDER");
Console.WriteLine("-------- --------");
Console.WriteLine("Some parameters allow quenched disorder (see in the description of each parameter below).");
Console.WriteLine("To set disorder, use: XDisorder=Type:X_Min_OR_X_Mean:X_Max_OR_X_Stddev");
Console.WriteLine("E.g.,");
Console.WriteLine("$ " + KTzHeader.GetKTzV2ExeName() + " [...] XDisorder=Type:X_Min_OR_X_Mean:X_Max_OR_X_Stddev [...]");
Console.WriteLine("where X is the exact name of the parameter that accepts disorder; Type is either Gaussian or Uniform;");
Console.WriteLine("if Type is Uniform, then provide min and max values; if type is Gaussian, then provide mean and stddev values");
Console.WriteLine("For example: you can put in the param list: dDisorder=Gaussian:0.001:0.0001 TDisorder=Uniform:0.2:0.5");
Console.WriteLine("to add Gaussian quenched disorder to the neuron's d parameter with mean=0.001 and stddev=0.0001;");
Console.WriteLine("and uniform quenched disorder to T between 0.2 and 0.5.");
Console.WriteLine("NOTE: Gaussian disorder is NOT 'restricted' and may change the sign of the parameter for some neurons/synapses!");
Console.WriteLine(" Use with caution specially in the synapse parameters!");
Console.WriteLine("-");
Console.WriteLine("ALLOWED PARAMETERS");
Console.WriteLine("------- ----------");
Console.WriteLine("*** parameters which are not specified will have the values below");
Console.WriteLine("*** the following names are available for PARAMX:");
Console.Write(KTzHeader.GetAllParamString(true));
//Console.WriteLine("TEST");
}
public static Dictionary<KTzParamGroups, Dictionary<String, String[]>> GetAllParamPairsAsStr()
{
var pGroups = new Dictionary<KTzParamGroups, Dictionary<String, String[]>>();
foreach (var group in Enum.GetValues(typeof(KTzParamGroups)))
{
pGroups.Add((KTzParamGroups)group, KTzHeader.GetAllParamPairsAsStr((KTzParamGroups)group));
}
return pGroups;
}
public static Dictionary<String, String[]> GetAllParamPairsAsStr(KTzParamGroups group)
{
Func<Int32, String> get_par;
Dictionary<String, String[]> p_list = new Dictionary<String, String[]>();
foreach (KeyValuePair<KTzParameters, Double> par in KTzHeader.ParamList_Double)
{
if (KTzHeader.ParamGroups[par.Key] == group)
p_list.Add(par.Key.ToString(), new String[] { par.Value.ToString(), KTzHeader.ParamDescription[par.Key] });
}
foreach (KeyValuePair<KTzParameters, Int32> par in KTzHeader.ParamList_Int32)
{
if (KTzHeader.ParamGroups[par.Key] == group)
{
if (KTzHeader.ParamConverter.ContainsKey(par.Key))
get_par = KTzHeader.ParamConverter[par.Key];
else
get_par = k => k.ToString();
p_list.Add(par.Key.ToString(), new String[] { get_par(par.Value), KTzHeader.ParamDescription[par.Key] });
}
}
foreach (KeyValuePair<KTzParameters, String> par in KTzHeader.ParamList_String)
{
if (KTzHeader.ParamGroups[par.Key] == group)
p_list.Add(par.Key.ToString(), new String[] { par.Value, KTzHeader.ParamDescription[par.Key] });
}
return p_list;
}
public static String GetAllParamString(bool addLinePadding = false)
{
String str = "# " + KTzHeader.inputArgsStr + Environment.NewLine + "# -" + Environment.NewLine;
foreach (var pGroup in KTzHeader.GetAllParamPairsAsStr())
{
String dashes = new String('-', (pGroup.Key.ToString() + " Parameters ").Length);
str += "#" + Environment.NewLine;
str += "#-----------------" + dashes + "------------------" + Environment.NewLine;
str += "#-----------------" + dashes + "------------------" + Environment.NewLine;
str += "#----------------- " + pGroup.Key.ToString() + " Parameters ------------------" + Environment.NewLine;
str += "#-----------------" + dashes + "------------------" + Environment.NewLine;
str += "#-----------------" + dashes + "------------------" + Environment.NewLine;
foreach (KeyValuePair<String, String[]> par in pGroup.Value)
{
if (addLinePadding)
str += "# " + Environment.NewLine;
str += "# " + par.Key + " = " + par.Value[0] + "\t\t" + par.Value[1] + Environment.NewLine;
if (addLinePadding)
str += "# " + Environment.NewLine;
}
}
return str;
}
public static Dictionary<KTzParamGroups, MatFileHandler.IVariable> GetAllParamPairsAsMatlabStruct(MatFileHandler.DataBuilder matDataBuilder)
{
//var matDataBuilder = new MatFileHandler.DataBuilder();
var pGroups = new Dictionary<KTzParamGroups, MatFileHandler.IVariable>();
foreach (var group in Enum.GetValues(typeof(KTzParamGroups)))
{
var par_in_group = KTzHeader.GetAllParamPairsAsMatlabStruct((KTzParamGroups)group, matDataBuilder);
var s = matDataBuilder.NewStructureArray(par_in_group.Keys.Select(k => KTzHeader.KeepLetterOrDigit(k.ToString())), 1, 1);
foreach (KTzParameters f in par_in_group.Keys)
{
s[f.ToString(), 0, 0] = par_in_group[f];
}
pGroups.Add((KTzParamGroups)group, matDataBuilder.NewVariable((String)group.ToString() + "_Param",s));
}
return pGroups;
}
public static Dictionary<KTzParameters, MatFileHandler.IArray> GetAllParamPairsAsMatlabStruct(KTzParamGroups group, MatFileHandler.DataBuilder matDataBuilder)
{
var p_list = new Dictionary<KTzParameters, MatFileHandler.IArray>();
foreach (KeyValuePair<KTzParameters, Double> par in KTzHeader.ParamList_Double)
{
if (KTzHeader.ParamGroups[par.Key] == group)
p_list.Add(par.Key, matDataBuilder.NewArray(new Double[] { par.Value }, 1, 1));
}
foreach (KeyValuePair<KTzParameters, Int32> par in KTzHeader.ParamList_Int32)
{
if (KTzHeader.ParamGroups[par.Key] == group)
{
if (KTzHeader.ParamConverter.ContainsKey(par.Key))
p_list.Add(par.Key, matDataBuilder.NewCharArray(KTzHeader.ParamConverter[par.Key](par.Value)));
else
p_list.Add(par.Key, matDataBuilder.NewArray(new Int32[] { par.Value }, 1, 1));
}
}
foreach (KeyValuePair<KTzParameters, String> par in KTzHeader.ParamList_String)
{
if (KTzHeader.ParamGroups[par.Key] == group)
p_list.Add(par.Key, matDataBuilder.NewCharArray(par.Value));
}
return p_list;
}
public static void ResetAllParamLists()
{
KTzHeader.ParamList_Double = new Dictionary<KTzParameters, Double>();
KTzHeader.ParamList_Int32 = new Dictionary<KTzParameters, Int32>();
KTzHeader.ParamList_String = new Dictionary<KTzParameters, String>();
KTzHeader.ParamDescription = new Dictionary<KTzParameters, String>();
KTzHeader.ParamGroups = new Dictionary<KTzParameters, KTzParamGroups>();
KTzHeader.ParamConverter = new Dictionary<KTzParameters, Func<Int32, String>>();
KTzHeader.ParamAllowedQuenchedDisorder = new HashSet<KTzParameters>();
KTzHeader.ParamDisorderSetting = new Dictionary<KTzParameters, QuenchedDisorderParse>();
KTzHeader.ParamDescription.Add(KTzParameters.K, "(allows quenched disorder) K self-interaction intensity between y and x");
KTzHeader.AddPar(KTzParameters.K, 0.6, KTzParamGroups.Neuron, allowsDisorder: true);
KTzHeader.ParamDescription.Add(KTzParameters.T, "(allows quenched disorder) T neuronal gain of the x variable");
KTzHeader.AddPar(KTzParameters.T, 0.35, KTzParamGroups.Neuron, allowsDisorder: true);
KTzHeader.ParamDescription.Add(KTzParameters.d, "(allows quenched disorder) delta: z recovery inverse time scale, controls refractory period and burst damping");
KTzHeader.AddPar(KTzParameters.d, 0.001, KTzParamGroups.Neuron, allowsDisorder: true);
KTzHeader.ParamDescription.Add(KTzParameters.l, "(allows quenched disorder) lambda: z-x coupling time scale, controls refractory period");
KTzHeader.AddPar(KTzParameters.l, 0.008, KTzParamGroups.Neuron, allowsDisorder: true);
KTzHeader.ParamDescription.Add(KTzParameters.xR, "(allows quenched disorder) z-x coupling recovery x potential, controls burst duration");
KTzHeader.AddPar(KTzParameters.xR, -0.7, KTzParamGroups.Neuron, allowsDisorder: true);
KTzHeader.ParamDescription.Add(KTzParameters.H, "(allows quenched disorder) polarizing current (external field in x; or in y if KTz2H neuron is selected)");
KTzHeader.AddPar(KTzParameters.H, 0.0D, KTzParamGroups.Neuron, allowsDisorder: true);
KTzHeader.ParamDescription.Add(KTzParameters.Q, "(allows quenched disorder) polarizing current for x in KTz2Tanh (external field)");
KTzHeader.AddPar(KTzParameters.Q, 0.0D, KTzParamGroups.Neuron, allowsDisorder: true);
KTzHeader.ParamDescription.Add(KTzParameters.J, "(allows quenched disorder) coupling intensity (conductance)");
KTzHeader.AddPar(KTzParameters.J, -0.15, KTzParamGroups.Synapse, allowsDisorder: true);
KTzHeader.ParamDescription.Add(KTzParameters.tauf, "(allows quenched disorder) tau_f: recovery time scale of the f variable for the chemical synapse");
KTzHeader.AddPar(KTzParameters.tauf, 2.0, KTzParamGroups.Synapse, allowsDisorder: true);
KTzHeader.ParamDescription.Add(KTzParameters.taug, "(allows quenched disorder) tau_g: recovery time scale of the g variable for the chemical synapse");
KTzHeader.AddPar(KTzParameters.taug, 2.0, KTzParamGroups.Synapse, allowsDisorder: true);
KTzHeader.ParamDescription.Add(KTzParameters.x0, "neuron initial condition on x");
KTzHeader.AddPar(KTzParameters.x0, -0.6971564118917724, KTzParamGroups.InitCond);
KTzHeader.ParamDescription.Add(KTzParameters.y0, "neuron initial condition on y");
KTzHeader.AddPar(KTzParameters.y0, -0.6971564118917724, KTzParamGroups.InitCond);
KTzHeader.ParamDescription.Add(KTzParameters.z0, "neuron initial condition on z");
KTzHeader.AddPar(KTzParameters.z0, -0.0227487048658225, KTzParamGroups.InitCond);
KTzHeader.ParamDescription.Add(KTzParameters.minJ, "minimum J on bifurcation simulations");
KTzHeader.AddPar(KTzParameters.minJ, -0.2, KTzParamGroups.Synapse);
KTzHeader.ParamDescription.Add(KTzParameters.maxJ, "maximum J on bifurcation simulations");
KTzHeader.AddPar(KTzParameters.maxJ, -0.01, KTzParamGroups.Synapse);
KTzHeader.ParamDescription.Add(KTzParameters.I, "stimulus intensity");
KTzHeader.AddPar(KTzParameters.I, 0.1, KTzParamGroups.Stimulus);
KTzHeader.ParamDescription.Add(KTzParameters.minI, "minimum I on bifurcation simulations");
KTzHeader.AddPar(KTzParameters.minI, 0.03, KTzParamGroups.Stimulus);
KTzHeader.ParamDescription.Add(KTzParameters.maxI, "maximum I on bifurcation simulations");
KTzHeader.AddPar(KTzParameters.maxI, 0.13, KTzParamGroups.Stimulus);
KTzHeader.ParamDescription.Add(KTzParameters.r, "Poisson stimulus rate");
KTzHeader.AddPar(KTzParameters.r, 0.1, KTzParamGroups.Stimulus);
KTzHeader.ParamDescription.Add(KTzParameters.minr, "minimum Poisson stimulus rate on bifurcation simulations");
KTzHeader.AddPar(KTzParameters.minr, 0.00001, KTzParamGroups.Stimulus);
KTzHeader.ParamDescription.Add(KTzParameters.maxr, "maximum Poisson stimulus rate on bifurcation simulations");
KTzHeader.AddPar(KTzParameters.maxr, 10.0, KTzParamGroups.Stimulus);
KTzHeader.ParamDescription.Add(KTzParameters.IStdDev, "std deviation of I in case of Poisson stimulus: set to 0 to have the same intensity for every stimulus");
KTzHeader.AddPar(KTzParameters.IStdDev, 0.0, KTzParamGroups.Stimulus);
KTzHeader.ParamDescription.Add(KTzParameters.R, "(allows quenched disorder) noise amplitude");
KTzHeader.AddPar(KTzParameters.R, 0.036, KTzParamGroups.Synapse, allowsDisorder: true);
KTzHeader.ParamDescription.Add(KTzParameters.noiseRatio, "(allows quenched disorder) fraction of J to use as noise amplitude");
KTzHeader.AddPar(KTzParameters.noiseRatio, 0.1, KTzParamGroups.Synapse, allowsDisorder: true);
KTzHeader.ParamDescription.Add(KTzParameters.alpha, "(allows quenched disorder) LHG-like dynamics for J in Chemical Synapses: coupling intensity * u");
KTzHeader.AddPar(KTzParameters.alpha, 1.5, KTzParamGroups.Synapse, allowsDisorder: true);
KTzHeader.ParamDescription.Add(KTzParameters.minalpha, "LHG-like dynamics for J in Chemical Synapses: minimum couplingintensity*u on bifurcation simulations");
KTzHeader.AddPar(KTzParameters.minalpha, 0.8, KTzParamGroups.Synapse);
KTzHeader.ParamDescription.Add(KTzParameters.maxalpha, "LHG-like dynamics for J in Chemical Synapses: maximum couplingintensity*u on bifurcation simulations");
KTzHeader.AddPar(KTzParameters.maxalpha, 1.8, KTzParamGroups.Synapse);
KTzHeader.ParamDescription.Add(KTzParameters.u, "(allows quenched disorder) LHG-like dynamics for J in Chemical Synapses: synapse depression strength");
KTzHeader.AddPar(KTzParameters.u, 0.2, KTzParamGroups.Synapse, allowsDisorder: true);
KTzHeader.ParamDescription.Add(KTzParameters.tauJ, "(allows quenched disorder) LHG-like dynamics for J in Chemical Synapses: coupling J recovery time scale");
KTzHeader.AddPar(KTzParameters.tauJ, 3000.0, KTzParamGroups.Synapse, allowsDisorder: true);
KTzHeader.ParamDescription.Add(KTzParameters.dt, "LHG-like dynamics for J in Chemical Synapses: precision on the integration of the J equations (with Euler method)");
KTzHeader.AddPar(KTzParameters.dt, 0.5, KTzParamGroups.Synapse);
KTzHeader.ParamDescription.Add(KTzParameters.rewP, "Watts-Strogatz or Random Graph Network parameter - rewire probability or edge creation prob");
KTzHeader.AddPar(KTzParameters.rewP, 0.02, KTzParamGroups.Network);
KTzHeader.ParamDescription.Add(KTzParameters.sampFrac, "fraction of neurons to sample from the network -- when subsampling is intended");
KTzHeader.AddPar(KTzParameters.sampFrac, 1.0, KTzParamGroups.Simulation);
KTzHeader.ParamDescription.Add(KTzParameters.Lx, "Amount of elements on x axis (linear size) (total amount is always assumed as Lx*Ly*Lz)");
KTzHeader.AddPar(KTzParameters.Lx, 40, KTzParamGroups.Network);
KTzHeader.ParamDescription.Add(KTzParameters.Ly, "Amount of elements on y axis (linear size) (total amount is always assumed as Lx*Ly*Lz)");
KTzHeader.AddPar(KTzParameters.Ly, 40, KTzParamGroups.Network);
KTzHeader.ParamDescription.Add(KTzParameters.Lz, "Amount of elements on z axis (linear size) (total amount is always assumed as Lx*Ly*Lz)");
KTzHeader.AddPar(KTzParameters.Lz, 1, KTzParamGroups.Network);
KTzHeader.ParamDescription.Add(KTzParameters.nSteps, "total timesteps to run each simulation");
KTzHeader.AddPar(KTzParameters.nSteps, 10000, KTzParamGroups.Simulation);
KTzHeader.ParamDescription.Add(KTzParameters.nStart, "timestep in which the network starts to be recorded");
KTzHeader.AddPar(KTzParameters.nStart, 0, KTzParamGroups.Simulation);
KTzHeader.ParamDescription.Add(KTzParameters.netType, "network architecture" + Environment.NewLine + KTzHeader.GetEnumListStr<KTzV2.Maths.Matrices.AdjacencyMatrix.AdjacencyMatrixType>());
KTzHeader.AddPar(KTzParameters.netType, (Int32)KTzV2.Maths.Matrices.AdjacencyMatrix.AdjacencyMatrixType.SquareLatticeFreeBC, KTzParamGroups.Network, typeof(KTzV2.Maths.Matrices.AdjacencyMatrix.AdjacencyMatrixType));
KTzHeader.ParamDescription.Add(KTzParameters.netDir, "directed = yes: the synapses are one-way i->j; directed = no: two-way synapses" + Environment.NewLine + KTzHeader.GetEnumListStr<KTzV2.Data.YesOrNoAnswer>());
KTzHeader.AddPar(KTzParameters.netDir, (Int32)KTzV2.Data.YesOrNoAnswer.No, KTzParamGroups.Network, typeof(KTzV2.Data.YesOrNoAnswer));
KTzHeader.ParamDescription.Add(KTzParameters.sType, "type of the synapse" + Environment.NewLine + KTzHeader.GetEnumListStr<KTzV2.Synapses.SynapseType>());
KTzHeader.AddPar(KTzParameters.sType, (Int32)KTzV2.Synapses.SynapseType.KTNoisyChemicalSynapse, KTzParamGroups.Synapse, typeof(KTzV2.Synapses.SynapseType));
KTzHeader.ParamDescription.Add(KTzParameters.noiseType, "type of the synaptic noise" + Environment.NewLine + KTzHeader.GetEnumListStr<KTzV2.Synapses.NoiseType>());
KTzHeader.AddPar(KTzParameters.noiseType, (Int32)KTzV2.Synapses.NoiseType.ProportionalAmplitude, KTzParamGroups.Synapse, typeof(KTzV2.Synapses.NoiseType));
KTzHeader.ParamDescription.Add(KTzParameters.neuron, "type of neuron to use" + Environment.NewLine + KTzHeader.GetEnumListStr<KTzV2.Neurons.NeuronType>());
KTzHeader.AddPar(KTzParameters.neuron, (Int32)KTzV2.Neurons.NeuronType.KTz, KTzParamGroups.Neuron, typeof(KTzV2.Neurons.NeuronType));
KTzHeader.ParamDescription.Add(KTzParameters.iCond, "type of initial condition" + Environment.NewLine + KTzHeader.GetEnumListStr<KTzV2.Data.InitialConditionType>());
KTzHeader.AddPar(KTzParameters.iCond, (Int32)KTzV2.Data.InitialConditionType.ProgramSpecified, KTzParamGroups.InitCond, typeof(KTzV2.Data.InitialConditionType));
KTzHeader.ParamDescription.Add(KTzParameters.dim, "dimension of the network (network will have L^dim neurons)");
KTzHeader.AddPar(KTzParameters.dim, 2, KTzParamGroups.Network);
KTzHeader.ParamDescription.Add(KTzParameters.stimType, "type of the stimulus" + Environment.NewLine + KTzHeader.GetEnumListStr<KTzV2.Stimuli.StimulusType>());
KTzHeader.AddPar(KTzParameters.stimType, (Int32)KTzV2.Stimuli.StimulusType.Delta, KTzParamGroups.Stimulus, typeof(KTzV2.Stimuli.StimulusType));
KTzHeader.ParamDescription.Add(KTzParameters.simTimeScheme, "CAUTION: simulation will become VERY SLOW for small Poisson Rate r; if 'ProportionalToPoissonRate' then (nSteps - nStartStep) = 10/(r*N), where r-> Poisson rate; N=Lx*Ly*Lz (number of neurons)" + Environment.NewLine + KTzHeader.GetEnumListStr<KTzV2.Sims.Network.SimulationTimeScheme>());
KTzHeader.AddPar(KTzParameters.simTimeScheme, (Int32)KTzV2.Sims.Network.SimulationTimeScheme.Free, KTzParamGroups.Simulation, typeof(KTzV2.Sims.Network.SimulationTimeScheme));
KTzHeader.ParamDescription.Add(KTzParameters.sStim, "timestep in which the network will be stimulated for each run");
KTzHeader.AddPar(KTzParameters.sStim, 0, KTzParamGroups.Stimulus);
KTzHeader.ParamDescription.Add(KTzParameters.iStim, "index of the neuron which will be stimulated");
KTzHeader.AddPar(KTzParameters.iStim, -1, KTzParamGroups.Stimulus);
KTzHeader.ParamDescription.Add(KTzParameters.tBin, "size of the bin (in timesteps) to divide nSteps in order to run the simulation");
KTzHeader.AddPar(KTzParameters.tBin, 20, KTzParamGroups.Simulation);
KTzHeader.ParamDescription.Add(KTzParameters.wData, "choose whether the program will run a simulation only to write output data in the case of dynamics simulation" + Environment.NewLine + KTzHeader.GetEnumListStr<KTzV2.Data.YesOrNoAnswer>());
KTzHeader.AddPar(KTzParameters.wData, (Int32)KTzV2.Data.YesOrNoAnswer.No, KTzParamGroups.Simulation, typeof(KTzV2.Data.YesOrNoAnswer));
KTzHeader.ParamDescription.Add(KTzParameters.wCSV, "if wData=Yes, then wCSV=Yes writes a CSV file with the x_i(t) data" + Environment.NewLine + KTzHeader.GetEnumListStr<KTzV2.Data.YesOrNoAnswer>());
KTzHeader.AddPar(KTzParameters.wCSV, (Int32)KTzV2.Data.YesOrNoAnswer.No, KTzParamGroups.Simulation, typeof(KTzV2.Data.YesOrNoAnswer));
KTzHeader.ParamDescription.Add(KTzParameters.wAvalDist, "choose whether the program will run a simulation only to write an avalanche spike distribution file in the case of dynamics simulation" + Environment.NewLine + KTzHeader.GetEnumListStr<KTzV2.Data.YesOrNoAnswer>());
KTzHeader.AddPar(KTzParameters.wAvalDist, (Int32)KTzV2.Data.YesOrNoAnswer.Yes, KTzParamGroups.Simulation, typeof(KTzV2.Data.YesOrNoAnswer));
KTzHeader.ParamDescription.Add(KTzParameters.saveSpikeTimes, "chooses whether to save spike times for each neuron during a simulation" + Environment.NewLine + KTzHeader.GetEnumListStr<KTzV2.Data.YesOrNoAnswer>());
KTzHeader.AddPar(KTzParameters.saveSpikeTimes, (Int32)KTzV2.Data.YesOrNoAnswer.Yes, KTzParamGroups.Simulation, typeof(KTzV2.Data.YesOrNoAnswer));
KTzHeader.ParamDescription.Add(KTzParameters.wObs, "write observations of the avalanche sizes for Bifurcation sim type for each (par1,par2) pair" + Environment.NewLine + KTzHeader.GetEnumListStr<KTzV2.Data.YesOrNoAnswer>());
KTzHeader.AddPar(KTzParameters.wObs, (Int32)KTzV2.Data.YesOrNoAnswer.No, KTzParamGroups.Simulation, typeof(KTzV2.Data.YesOrNoAnswer));
KTzHeader.ParamDescription.Add(KTzParameters.nJ, "amount of J (synaptic coupling) on bifurcation simulations");
KTzHeader.AddPar(KTzParameters.nJ, 100, KTzParamGroups.Synapse);
KTzHeader.ParamDescription.Add(KTzParameters.nI, "amount of I (stimulus intensity) on bifurcation simulations");
KTzHeader.AddPar(KTzParameters.nI, 100, KTzParamGroups.Stimulus);
KTzHeader.ParamDescription.Add(KTzParameters.nr, "amount of r (Poisson rate) on bifurcation simulations");
KTzHeader.AddPar(KTzParameters.nr, 100, KTzParamGroups.Stimulus);
KTzHeader.ParamDescription.Add(KTzParameters.nalpha, "amount of alpha (LHG J adaptation intensity) on bifurcation simulations");
KTzHeader.AddPar(KTzParameters.nalpha, 100, KTzParamGroups.Synapse);
KTzHeader.ParamDescription.Add(KTzParameters.wDif, "choose whether the program will write a file containing xi-xj data; WARNING FILE WILL BE VERY LARGE if N is big" + Environment.NewLine + KTzHeader.GetEnumListStr<KTzV2.Data.YesOrNoAnswer>());
KTzHeader.AddPar(KTzParameters.wDif, (Int32)KTzV2.Data.YesOrNoAnswer.No, KTzParamGroups.Simulation, typeof(KTzV2.Data.YesOrNoAnswer));
KTzHeader.ParamDescription.Add(KTzParameters.nSim, "amount of realizations for each pair (stimulus,coupling) on bifurcation simulations");
KTzHeader.AddPar(KTzParameters.nSim, 20, KTzParamGroups.Simulation);
KTzHeader.ParamDescription.Add(KTzParameters.deltaT, "time interval between two consecutive delta stimuli");
KTzHeader.AddPar(KTzParameters.deltaT, 20, KTzParamGroups.Stimulus);
KTzHeader.ParamDescription.Add(KTzParameters.nNeigh, "Watts-Strogatz network parameter - amount of neighbours in the initial configuration of WS network");
KTzHeader.AddPar(KTzParameters.nNeigh, 4, KTzParamGroups.Network);
KTzHeader.ParamDescription.Add(KTzParameters.nConn, "Barabasi-Albert network parameter - amount of connections which a new node will initially have when creating BA network");
KTzHeader.AddPar(KTzParameters.nConn, 3, KTzParamGroups.Network);
KTzHeader.ParamDescription.Add(KTzParameters.cVar, "choose if the program will count number of neurons spiking or number of spikes; if NumberOfNeurons is set, then each of the nSim run is performed during nSteps timesteps" + Environment.NewLine + KTzHeader.GetEnumListStr<KTzV2.Data.CountVariable>());
KTzHeader.AddPar(KTzParameters.cVar, (Int32)KTzV2.Data.CountVariable.NumberOfNeurons, KTzParamGroups.Simulation, typeof(KTzV2.Data.CountVariable));
KTzHeader.ParamDescription.Add(KTzParameters.avgInp, "choose whether the neuron will average its synaptic input (may be useful in mean-field networks)" + Environment.NewLine + KTzHeader.GetEnumListStr<KTzV2.Data.YesOrNoAnswer>());
KTzHeader.AddPar(KTzParameters.avgInp, (Int32)KTzV2.Data.YesOrNoAnswer.No, KTzParamGroups.Neuron, typeof(KTzV2.Data.YesOrNoAnswer));
KTzHeader.ParamDescription.Add(KTzParameters.samp, "choose the sampling type (full or subsampled)" + Environment.NewLine + KTzHeader.GetEnumListStr<KTzV2.Data.NetworkSamplingType>());
KTzHeader.AddPar(KTzParameters.samp, (Int32)KTzV2.Data.NetworkSamplingType.Full, KTzParamGroups.Simulation, typeof(KTzV2.Data.NetworkSamplingType));
KTzHeader.ParamDescription.Add(KTzParameters.rest, "interval (in tBin's) between an avalanche and a new stimulus for no activity stimulus type (i.e., if no activity is detected in a time bin)");
KTzHeader.AddPar(KTzParameters.rest, 10, KTzParamGroups.Simulation);
KTzHeader.ParamDescription.Add(KTzParameters.simType, "choose if the program will run bifurcation or dynamics" + Environment.NewLine + KTzHeader.GetEnumListStr<KTzV2.SimulationType>());
KTzHeader.AddPar(KTzParameters.simType, (Int32)KTzV2.SimulationType.Dynamics, KTzParamGroups.Simulation, typeof(KTzV2.SimulationType));
KTzHeader.ParamDescription.Add(KTzParameters.dynType, "each avalanche is generated independently of each other or after a time window" + Environment.NewLine + KTzHeader.GetEnumListStr<KTzV2.DynamicsSimType>());
KTzHeader.AddPar(KTzParameters.dynType, (Int32)KTzV2.DynamicsSimType.NetworkReset, KTzParamGroups.Simulation, typeof(KTzV2.DynamicsSimType));
KTzHeader.ParamDescription.Add(KTzParameters.oFile, "prefix of the output file name -- do not use an extension");
KTzHeader.AddPar(KTzParameters.oFile, "", KTzParamGroups.Simulation);
KTzHeader.ParamDescription.Add(KTzParameters.oFileFormat, "Chooses whether to write the main outputs either in txt (.dat extension) or mat-file format (.mat MATLAB format)" + Environment.NewLine + KTzHeader.GetEnumListStr<KTzV2.Data.Header.OutputFileFormat>());
KTzHeader.AddPar(KTzParameters.oFileFormat, (Int32)KTzV2.Data.Header.OutputFileFormat.txt, KTzParamGroups.Simulation, typeof(KTzV2.Data.Header.OutputFileFormat));
KTzHeader.ParamDescription.Add(KTzParameters.netFile, "input file with adjacency matrix");
KTzHeader.AddPar(KTzParameters.netFile, "", KTzParamGroups.Simulation);