123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- #!/usr/bin/tclsh
- #ToDo
- # ShowWeights (without Tom)
- # ShowWeights at SetTrialNr (driven from simulation)
- # switch between facilitatory and normal inhibition (set default to normal)
- # WeightSum
- # switch between linear and quadratic
- # choose Stimulus Set (radio button)
- # ShowSelectivity
- package require Tk
- package require BWidget
- wm minsize . 350 400
- set SimulationName minimal
- set LibSimcontrolPath "$env(HOME)/prog/objsim/src"
- source "$LibSimcontrolPath/libsimcontrol.tcl"
- source "$env(HOME)/prog/objsim/scripts/getSimLayout.tcl"
- TestLibSimcontrol
- SetSimDirAndFileNames minimal
- proc SetTrialNr {nr} {
- set ::TrialNr $nr
- ShowListWeights ${::LBname}
- }
- proc StartSim {} {
- set CmdParas {}
- append CmdParas " --SimControlName [tk appname] "
- foreach CmdOpt $::SimOptionsList {
- if {$CmdOpt != "SimControlName"} {
- append CmdParas " --$CmdOpt $::SimOptions($CmdOpt) "
- }
- }
- foreach CmdFlag $::SimFlagsList {
- if {$::SimFlags($CmdFlag) == 0} {
- set CmdFlag "No$CmdFlag"
- }
- append CmdParas " --$CmdFlag "
- }
- puts "CommandLineParameter: $CmdParas"
- # exec "./startsim $CmdParas >zombi.txt"
- set ::inout [open "|./startsim $CmdParas" "r"]
- # puts "Neuronentyp: $::NType"
- # fconfigure $::inout -blocking 0 -buffering line -translation crlf -eofchar {}
- while {[eof $::inout] != 1} {
- puts [gets $::inout]
- }
- close $::inout
- # puts [read $::inout]
- # ShowSim
- }
- proc StopSim {} {
- # puts $::SimName
- set ::inout [open "|./startsim stop" "r"]
- while {[eof $::inout] != 1} {
- puts [gets $::inout]
- }
- close $::inout
- # puts "Neuronentyp: $::NType"
- # fconfigure $::inout -blocking 0 -buffering line -translation crlf -eofchar {}
- # puts [read $::inout]
- # ShowSim
- }
- proc ShowSim {} {
- set ShowOptions {}
- if {$::SimOptions(NeuronType) == 0} {
- append ShowOptions ",CutSpikes=$::CutSpikePot "
- }
- set Command "csim_showsimspikes, dirname=\"$::SimDataDir\", /sec $ShowOptions \n"
- # set Command "csim_showsimspikes, dirname=\"$::SimDataDir\", /sec \n"
- puts $Command
- puts $::idl $Command
- }
- proc GenerateParaOverlapInput {} {
- set Options {}
- append ShowOptions ", Active=$::Active "
- append ShowOptions ", Overlap=$::Overlap"
- append ShowOptions ", NPatterns=4"
- append ShowOptions ", OW=5"
- append ShowOptions ", OH=8"
- append ShowOptions ", /Show"
- set Command "makeobjmovie_paraoverlap $ShowOptions \n"
- puts $Command
- puts $::idl $Command
- }
- proc TestParaEntry {} {
- puts $::InputStrength
- puts $::LearnRate
- puts $::CheckVar
- }
- ####################StartOfMainProgram
- OpenIDL
- ReadSimConfigFile
- # pack [button .dummy -command "ReadIDL" -text "ReadIDL"]
- # pack [button .showsim -command "ShowSim" -text "ShowSim"]
- labelframe .but0 -width 1500 -height 100 -borderwidth 4 -relief sunken -text "SimControl" -padx 10 -pady 5
- pack .but0 -pady 10
- set curframe .but0
- # pack [button ${curframe}.test -command "ShowWM1" -text "ChangeWeightFile"] -side left
- # pack [button ${curframe}.test2 -command "ShowWM1" -text "ChangeWeightFile"] -side left
- #pack [button ${curframe}.change -command "ShowWM1" -text "ChangeWeightFile"] -side left
- frame ${curframe}.startstop
- pack ${curframe}.startstop -pady 3
- set curframe1 ${curframe}.startstop
- pack [button ${curframe1}.startsim -command "StartSim" -text "StartSim"] -side left -padx 5
- pack [button ${curframe1}.stopsim -command "StopSim" -text "StopSim"] -side left
- # labelframe ${curframe}.modelchose -text "Choose Neuron Model" -padx 5
- # pack ${curframe}.modelchose
- # set curframe1 ${curframe}.modelchose
- # pack [radiobutton ${curframe1}.one -value 0 -text "Izhikevich-Neuron" -variable SimOptions(NeuronType)] -anchor sw
- # pack [radiobutton ${curframe1}.two -value 1 -text "Izh7-Model-Neuron" -variable SimOptions(NeuronType)] -anchor sw
- # pack [radiobutton ${curframe1}.three -value 2 -text "Izh8-Model-Neuron" -variable SimOptions(NeuronType)] -anchor sw
- # pack [radiobutton ${curframe1}.four -value 3 -text "Marburg-Model-Neuron" -variable SimOptions(NeuronType)] -anchor sw
- # lappend SimOptionsList NeuronType
- # frame ${curframe}.stimselectionframe -padx 1
- # pack ${curframe}.stimselectionframe -side top
- # set curframe1 ${curframe}.stimselectionframe
- # labelframe ${curframe1}.stimsetchoose -text "ChooseStimType" -padx 5
- # pack ${curframe1}.stimsetchoose -side right
- # set curframe2 ${curframe1}.stimsetchoose
- # # pack [radiobutton ${curframe1}.test -value 9 -text "test" -variable SimOptions(StimulusNumber)] -anchor sw
- # set StimTypeList {}
- # lappend StimTypeList [radiobutton ${curframe2}.one -value 0 -command "ShowRadioStimSet 0" -text "Test" -variable SimOptions(StimulusSet)]
- # lappend StimTypeList [radiobutton ${curframe2}.two -value 1 -command "ShowRadioStimSet 1" -text "Parametric" -variable SimOptions(StimulusSet)]
- # lappend StimTypeList [radiobutton ${curframe2}.three -value 2 -command "ShowRadioStimSet 2" -text "Scan" -variable SimOptions(StimulusSet)]
- # lappend StimTypeList [radiobutton ${curframe2}.four -value 3 -command "ShowRadioStimSet 3" -text "File" -variable SimOptions(StimulusSet)]
- # lappend StimTypeList [radiobutton ${curframe2}.five -value 4 -command "ShowRadioStimSet 4" -text "ASCII" -variable SimOptions(StimulusSet)]
- # lappend StimTypeList [radiobutton ${curframe2}.six -value 6 -command "ShowRadioStimSet 3" -text "Sequence" -variable SimOptions(StimulusSet)]
- # foreach ListItem $StimTypeList {
- # pack $ListItem -anchor sw
- # }
- # lappend SimOptionsList StimulusSet
- # labelframe ${curframe1}.stimchoose -text "Choose Stimulus Set" -padx 2
- # #frame ${curframe1}.stimchoose -padx 5
- # pack ${curframe1}.stimchoose -side left
- # set StimNumberChooseFrame ${curframe1}.stimchoose
- # set StimSelectionList {}
- proc ShowRadioStimSet {StimSetNr} {
- puts $StimSetNr
- set curframe1 $::StimNumberChooseFrame
- DestroyElements $::StimSelectionList
- set Delindex [lsearch $::SimOptionsList StimFileName]
- if {$Delindex != -1} {
- set ::SimOptionsList [lreplace $::SimOptionsList $Delindex $Delindex]
- }
- if {$StimSetNr == 0} {
- set ::StimSelectionList {}
- lappend ::StimSelectionList [radiobutton ${curframe1}.one -value 0 -text "5x5, 4 stim, no overlap" -variable ::SimOptions(StimulusNumber)]
- lappend ::StimSelectionList [radiobutton ${curframe1}.two -value 1 -text "5x5, 4 stim, small overlap" -variable ::SimOptions(StimulusNumber)]
- lappend ::StimSelectionList [radiobutton ${curframe1}.three -value 2 -text "5x5, 4 stim, high overlap" -variable ::SimOptions(StimulusNumber)]
- foreach ListItem $::StimSelectionList {
- pack $ListItem -anchor sw
- }
- }
- if {$StimSetNr == 1} {
- frame ${curframe1}.genovpat
- pack ${curframe1}.genovpat
- set curframe2 ${curframe1}.genovpat
- lappend ::StimSelectionList $curframe2
- set ::Active 0.2
- set ::Overlap 0.8
- SimParaEntry active ::Active $curframe2
- SimParaEntry overlap ::Overlap $curframe2
- pack [button ${curframe2}.genoverlapbutton -command "GenerateParaOverlapInput" -text "GenOvInput"] -side bottom
- }
- if {$StimSetNr == 3} {
- frame ${curframe1}.stmfilename
- pack ${curframe1}.stmfilename
- set curframe2 ${curframe1}.stmfilename
- lappend ::StimSelectionList $curframe2
- lappend ::SimOptionsList StimFileName
- # SimOptionsEntry stmfile StimFileName $curframe2
- label ${curframe2}.stmfilelabel -text "StimulusFileName"
- pack ${curframe2}.stmfilelabel -anchor sw -side top
- set mybut [entry ${curframe2}.stmfileentry -textvariable ::SimOptions(StimFileName) -width 15 -bg white -relief sunken -border 1 -highlightcolor green]
- pack $mybut -side left -anchor n -side bottom -pady 2
- }
- }
- # ShowRadioStimSet 0
- # lappend SimOptionsList StimulusNumber
- labelframe ${curframe}.setparameter -text "Set Simulation Parameters" -padx 5 -pady 3
- pack ${curframe}.setparameter -pady 5
- set curframe1 ${curframe}.setparameter
- # SimFlagsEntry defaultconfigfile MakeDefaultConfig $curframe1
- # SimOptionsEntry2 NTrials $curframe1
- # SimOptionsEntry2 NSteps $curframe1
- # SimOptionsEntry2 ITNx $curframe1
- # SimOptionsEntry2 ITNy $curframe1
- # SimOptionsEntry2 InputStrength $curframe1
- # SimOptionsEntry2 InitialWeights $curframe1
- # SimOptionsEntry2 LearnRate $curframe1
- # SimOptionsEntry2 FWMaxWeights $curframe1
- # SimOptionsEntry2 WeightSum $curframe1
- # SimFlagsEntry quadnorm QuadraticNorm $curframe1
- # SimFlagsEntry loadweights LoadWeights $curframe1
- # SimOptionsEntry2 ITExExWeights $curframe1
- # SimOptionsEntry2 ITExExRange $curframe1
- set ResultsWindowName .simresultswin
- frame ${curframe}.results3 -borderwidth 1 -relief sunken
- pack ${curframe}.results3
- set curframe1 ${curframe}.results3
- pack [checkbutton ${curframe1}.show -text "Show Simulation Results" -variable VisibleSimResults -command [list ShowHideWin ${::ResultsWindowName} VisibleSimResults]] -side top
- ShowResultsWindow $ResultsWindowName
- set LayoutWindowName .simlayoutwin
- pack [checkbutton ${curframe1}.show2 -text "Show Network Layout" -variable VisibleSimLayout -command [list ShowHideWin ${::LayoutWindowName} VisibleSimLayout] ] -side top
- ShowLayoutWindow $LayoutWindowName $SimDataDir
- set OptionsWindowName .simoptionswin
- pack [checkbutton ${curframe1}.show3 -text "Show Options" -variable VisibleSimOptions -command [list ShowHideWin ${::OptionsWindowName} VisibleSimOptions] ] -side top
- ShowOptionsWindow $OptionsWindowName
- set SimOutputWindowName .simoutputwin
- pack [checkbutton ${curframe1}.show4 -text "Show Simulation Output " -variable VisibleSimoutputWindow -command [list ShowHideOutputWin ${::SimOutputWindowName} ::VisibleSimoutputWindow] ] -side top
- ShowSimoutputWindow $SimOutputWindowName
- ShowHideWin ${::SimOutputWindowName} ::VisibleSimoutputWindow
|