123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910 |
- # Copyright (C) 2005, 2006 Frank Michler, Philipps-University Marburg, Germany
- # This program is free software; you can redistribute it and/or
- # modify it under the terms of the GNU General Public License
- # as published by the Free Software Foundation; either version 2
- # of the License, or (at your option) any later version.
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- # You should have received a copy of the GNU General Public License
- # along with this program; if not, write to the Free Software
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- set None -9999
- proc MakeList2D {x y {DefaultValue 0}} {
- set tmprow {}
- for {set i 0} {$i < $y} {incr i} {
- lappend tmprow $DefaultValue
- }
- set arr2d {}
- for {set j 0} {$j < $x} {incr j} {
- lappend arr2d $tmprow
- }
- return $arr2d
- }
- proc MakeList3D {x y z {DefaultValue 0}} {
- set tmprow [MakeList2D $y $z]
- set arr3d {}
- for {set j 0} {$j < $x} {incr j} {
- lappend arr3d $tmprow
- }
- return $arr3d
- }
- proc List2DToArray2D {OriList} {
- set i 0
- array set OutputArray {}
- foreach Row $OriList {
- set j 0
- foreach Elm $Row {
- set OutputArray($i,$j) $Elm
- incr j
- }
- incr i
- }
- set OutputArray(x) $i
- set OutputArray(y) $j
- return [array get OutputArray]
- }
- proc Array2DToList2D {ParaArray} {
- array set OriArray $ParaArray
- set OutputList {}
- for {set i 0} {$i < $OriArray(x)} {incr i} {
- set tmprow {}
- for {set j 0} {$j < $OriArray(y)} {incr j} {
- lappend tmprow $OriArray($i,$j)
- }
- lappend OutputList $tmprow
- }
- return $OutputList
- }
- proc SetArray2DToList2D {ParaArray Value} {
- array set OriArray $ParaArray
- set OutputList {}
- for {set i 0} {$i < $OriArray(x)} {incr i} {
- set tmprow {}
- for {set j 0} {$j < $OriArray(y)} {incr j} {
- lappend tmprow $Value
- }
- lappend OutputList $tmprow
- }
- return $OutputList
- }
- proc SetDiagonal2D {ArrayName value} {
- upvar $ArrayName MyArr
- for {set xx 0} {$xx<$MyArr(x)} {incr xx} {
- set MyArr($xx,$xx) $value
- }
- }
- proc SetWholeArray2D {ArrayName value} {
- upvar $ArrayName MyArr
- for {set xx 0} {$xx<$MyArr(x)} {incr xx} {
- for {set yy 0} {$yy<$MyArr(x)} {incr yy} {
- set MyArr($xx,$yy) $value
- }
- }
- }
- proc L1Dincr {MyList x} {
- upvar $MyList UpList
- lset UpList $x [expr [lindex $UpList $x]+1]
- }
- proc L2Dincr {MyList x y} {
- upvar $MyList UpList
- lset UpList $x $y [expr [lindex $UpList $x $y]+1]
- }
- #nicht effizient, aber allgemein
- # evtl. mit case-Abfrage die Länge von args berücksichtigen
- proc lincr {MyList args} {
- upvar $MyList UpList
- eval lset [concat UpList $args [expr [eval lindex [concat [list $UpList] $args]] +1]]
- }
- proc TestLibSimcontrol {} {
- puts "LibSimcontrol, Version 0.01"
- }
- proc DestroyElements {ElementList} {
- foreach w $ElementList {
- destroy $w
- }
- }
- #####################################
- #HIER GEHTS WEITER
- proc SetSimDirAndFileNames {SName} {
- puts "SimulationName= $SName"
- set ::SimDir [pwd]
- set ::SimDir "${::SimDir}/"
- set ::SimName ${::SimDir}${::SimulationName}
- puts "SimName= $::SimName"
- set ::SimConfigFile ${::SimDir}settings_${::SimulationName}.cfg
- set ::SimOptionsFile ${::SimDir}options_${::SimulationName}.cfg
- ReadSimConfigFile
- # SimDataDir aus config file auslesen, $HOME durch $::env(HOME) ersetzen
- puts "DataDirectory= $::SimOptions(DataDirectory) \n"
- set ::SimDataDir [regsub {\$HOME} $::SimOptions(DataDirectory) $::env(HOME)]
- #set ::SimDataDir "$::env(HOME)/data/sim/csim/$::SimulationName/"
- if {[regexp "/$" $::SimDataDir] != 1} {
- puts "add trailing slash to SimDataDir\n";
- set ::SimDataDir $::SimDataDir/
- }
- puts "DataDirectory= $::SimDataDir"
- }
- proc SimFlagsEntry {ParaName ParaLabel ParentFrame} {
- lappend ::SimFlagsList $ParaLabel
- set CurCheckbutton [checkbutton ${ParentFrame}.$ParaName -text "$ParaLabel" -variable ::SimFlags($ParaLabel)]
- pack $CurCheckbutton -anchor sw -side top
- }
- proc SimFlagsEntry2 {ParaName ParaLabel ParentFrame} {
- lappend ::SimFlagsList $ParaLabel
- frame ${ParentFrame}.${ParaName}
- pack ${ParentFrame}.${ParaName} -anchor e
- set curframe2 ${ParentFrame}.${ParaName}
- set CurCheckbutton [checkbutton ${curframe2}.checkbutton -text "$ParaLabel" -variable ::SimFlags($ParaLabel)]
- pack $CurCheckbutton -anchor sw -side left
- pack [button ${curframe2}.hideButton -command "HideOptionEntry $curframe2 $ParaLabel" -text "Hide"] -side left -anchor center -pady 0
- }
- proc SimOptionsEntry {ParaName ParaLabel ParentFrame} {
- lappend ::SimOptionsList $ParaLabel
- frame ${ParentFrame}.${ParaName}
- pack ${ParentFrame}.${ParaName} -anchor e
- set curframe2 ${ParentFrame}.${ParaName}
- label ${curframe2}.${ParaName}label -text "$ParaLabel="
- pack ${curframe2}.${ParaName}label -anchor sw -side left
- # set mybut [entry ${curframe2}.${ParaName}entry -textvariable ::$ParaLabel -width 7 -bg white -relief flat -border 5 -highlightcolor green]
- set mybut [entry ${curframe2}.${ParaName}entry -textvariable ::SimOptions($ParaLabel) -width 7 -bg white -relief sunken -border 1 -highlightcolor green]
- pack $mybut -side left -anchor n -side right -pady 2
- }
- proc SimOptionsEntry2 {ParaName ParentFrame} {
- set ParaLabel $ParaName
- set FrameName soe$ParaName
- lappend ::SimOptionsList $ParaLabel
- frame ${ParentFrame}.${FrameName}
- pack ${ParentFrame}.${FrameName} -anchor e
- set curframe2 ${ParentFrame}.${FrameName}
- label ${curframe2}.${FrameName}label -text "$ParaLabel="
- pack ${curframe2}.${FrameName}label -anchor sw -side left
- set mybut [entry ${curframe2}.${FrameName}entry -textvariable ::SimOptions($ParaName) -width 7 -bg white -relief sunken -border 1 -highlightcolor green]
- pack $mybut -side left -anchor n -side right -pady 2
- }
- proc HideOptionEntry {Frame Label} {
- destroy $Frame
- set size [file size ${::SimOptionsFile}]
- set fd [open ${::SimOptionsFile}]
- set xml [read $fd $size]
- close $fd
- set doc [dom parse -simple $xml]
- set root [$doc documentElement]
- set node [$root child 1 $Label]
- $node setAttribute flag 0
- set fd [open ${::SimOptionsFile} w]
- puts $fd [$root asXML]
- close $fd
- $doc delete
- }
- proc SimOptionsEntry3 {ParaName ParaLabel ParentFrame} {
- lappend ::SimOptionsList $ParaLabel
- frame ${ParentFrame}.${ParaName}
- pack ${ParentFrame}.${ParaName} -anchor e
- set curframe2 ${ParentFrame}.${ParaName}
- label ${curframe2}.${ParaName}label -text "$ParaLabel="
- pack ${curframe2}.${ParaName}label -anchor center -side left -pady 0
- set mybut [entry ${curframe2}.${ParaName}entry -textvariable ::SimOptions($ParaLabel) -width 7 -bg white -relief sunken -border 1 -highlightcolor green]
- pack $mybut -side left -anchor center -pady 0
- pack [button ${curframe2}.hideButton -command "HideOptionEntry $curframe2 $ParaLabel" -text "Hide"] -side left -anchor center -pady 0
- }
- proc SimParaEntry {ParaName ParaLabel ParentFrame} {
- frame ${ParentFrame}.${ParaName}
- pack ${ParentFrame}.${ParaName} -anchor e
- set curframe2 ${ParentFrame}.${ParaName}
- label ${curframe2}.${ParaName}label -text "$ParaLabel="
- pack ${curframe2}.${ParaName}label -anchor sw -side left
- # set mybut [entry ${curframe2}.${ParaName}entry -textvariable ::$ParaLabel -width 7 -bg white -relief flat -border 5 -highlightcolor green]
- set mybut [entry ${curframe2}.${ParaName}entry -textvariable ::$ParaLabel -width 7 -bg white -relief sunken -border 1 -highlightcolor green]
- pack $mybut -side left -anchor n -side right -pady 2
- }
- proc SimParaEntry2 {ParaName ParentFrame} {
- set ParseString "::"
- set Nothing {}
- set ParaLabel [regsub $ParseString $ParaName $Nothing]
- set FrameName spe$ParaLabel
- frame ${ParentFrame}.${FrameName}
- pack ${ParentFrame}.${FrameName} -anchor e
- set curframe2 ${ParentFrame}.${FrameName}
- label ${curframe2}.${FrameName}label -text "$ParaLabel="
- pack ${curframe2}.${FrameName}label -anchor sw -side left
- # set mybut [entry ${curframe2}.${FrameName}entry -textvariable ::$ParaLabel -width 7 -bg white -relief flat -border 5 -highlightcolor green]
- set mybut [entry ${curframe2}.${FrameName}entry -textvariable ::$ParaLabel -width 7 -bg white -relief sunken -border 1 -highlightcolor green]
- pack $mybut -side left -anchor n -side right -pady 2
- }
- array set SimOptions {}
- array set SimFlags {}
- set SimOptionsList {}
- set SimFlagsList {}
- proc ReadSimConfigFile {} {
- puts "Read SimConfigFile= $::SimConfigFile"
- set fw [open $::SimConfigFile "r"]
- while {[eof $fw] != 1} {
- set CurLine [gets $fw]
- if {[regexp "^\[\[:space:\]\]*\[\[:alpha:\]\]" $CurLine] == 1} {
- # puts "Line $CurLine"
- set ParseOption "^\[\[:space:\]\]*(\[\[:alnum:\]\]*)\[\[:space:\]\]{1,}:\[\[:space:\]\]{1,}(\[^\[:space:\]\]*)"
- if {[regexp $ParseOption $CurLine Match Name Value] == 1} {
- # puts "Option $Name = $Value"
- set ::SimOptions($Name) $Value
- } else {
- set ParseFlag "^\[\[:space:\]\]*(\[\[:alpha:\]\]*)"
- if {[regexp $ParseFlag $CurLine Match Name] == 1} {
- if {[regexp "^No(.*)" $Name Match FlagName] ==1} {
- set Value 0
- } else {
- set FlagName $Name
- set Value 1
- }
- # puts "Flag $FlagName = $Value"
- set ::SimFlags($FlagName) $Value
- }
- }
- }
- }
- }
- proc ShowOptionsWindow {OptionsWindowName} {
- set ::VisibleSimOptions 1
- toplevel $OptionsWindowName
- wm protocol $OptionsWindowName WM_DELETE_WINDOW "HideWin $OptionsWindowName ::VisibleSimOptions"
- set curframe ${::OptionsWindowName}
- # ScrolledWindow ${curframe}.scrollwin
- # set curframe2 ${curframe}
- # pack $curframe2
- # frame ${curframe}.lbframe
- # pack ${curframe}.lbframe -side bottom
- # set curframe1 ${curframe}.lbframe
- # set LBname ${curframe1}.lb
- # set SBname ${curframe1}.sb
- # ScrollableFrame ${LBname} -areaheight 30
- # scrollbar ${SBname} -command [list ${LBname} yview]
- # ${LBname} configure -yscrollcommand [list ${SBname} set]
- # pack ${SBname} ${LBname} -in ${curframe1} -side right -expand 1 -fill both
- # set curframe2 $LBname
- # Programmzeilen aus http://wiki.tcl.tk/9924
- set sw [ScrolledWindow ${curframe}.sw]
- pack $sw -fill both -expand 0
- set sf [ScrollableFrame $sw.sf -areawidth 0 -height 600]
- $sw setwidget $sf
- set uf [$sf getframe]
- set curframe2 $uf
- if {[file exists ${::SimOptionsFile}] == 0} {
- set initFile [open ${::SimOptionsFile} a+]
- puts $initFile "<ShowOptionsFlags>"
- puts $initFile "</ShowOptionsFlags>"
- close $initFile
- }
- set size [file size ${::SimOptionsFile}]
- set fd [open ${::SimOptionsFile}]
- set xml [read $fd $size]
- close $fd
- set doc [dom parse -simple $xml]
- set root [$doc documentElement]
- puts "Read SimConfigFile= $::SimConfigFile"
- set fw [open $::SimConfigFile "r"]
- while {[eof $fw] != 1} {
- set CurLine [gets $fw]
- if {[regexp "^\[\[:space:\]\]*\[\[:alpha:\]\]" $CurLine] == 1} {
- # puts "Line $CurLine"
- set ParseOption "^\[\[:space:\]\]*(\[\[:alnum:\]_\]*)\[\[:space:\]\]{1,}:\[\[:space:\]\]{1,}(\[^\[:space:\]\]*)"
- if {[regexp $ParseOption $CurLine Match Name Value] == 1} {
- # puts "Option $Name = $Value"
- set node [$root child 1 $Name]
- if {$node == ""} {
- $root appendFromList [list $Name {flag 1} {}]
- set ::SimOptions($Name) $Value
- SimOptionsEntry3 win$Name $Name $curframe2
- } else {
- if {[$node getAttribute flag] == 1} {
- set ::SimOptions($Name) $Value
- SimOptionsEntry3 win$Name $Name $curframe2
- }
- }
- } else {
- set ParseFlag "^\[\[:space:\]\]*(\[\[:alpha:\]\]*)"
- if {[regexp $ParseFlag $CurLine Match Name] == 1} {
- if {[regexp "^No(.*)" $Name Match FlagName] ==1} {
- set Value 0
- } else {
- set FlagName $Name
- set Value 1
- }
- # puts "Flag $FlagName = $Value"
- set node [$root child 1 $FlagName]
- if {$node == ""} {
- $root appendFromList [list $FlagName {flag 1} {}]
- set ::SimFlags($FlagName) $Value
- SimFlagsEntry2 win$FlagName $FlagName $curframe2
- } else {
- if {[$node getAttribute flag] == 1} {
- set ::SimFlags($FlagName) $Value
- SimFlagsEntry2 win$FlagName $FlagName $curframe2
- }
- }
- }
- }
- }
- }
- set fd [open ${::SimOptionsFile} w]
- puts $fd [$root asXML]
- close $fd
- $doc delete
- # scrollbar ${SBname} -command [list ${LBname} yview]
- # ${LBname} configure -yscrollcommand [list ${SBname} set]
- # pack ${SBname} ${LBname} -in ${curframe1} -side right -expand 1 -fill both
- }
- proc HideWin {WinName WinVisible} {
- upvar $WinVisible VisibleState
- wm withdraw $WinName
- set VisibleState 0
- }
- proc ShowHideWin {WinName WinVisible} {
- upvar $WinVisible VisibleState
- if {$VisibleState == 0} {
- wm withdraw $WinName
- } else {
- wm deiconify $WinName
- }
- }
- proc OpenIDL {} {
- set ::idl [open "|idl-console-start" "w"]
- fconfigure $::idl -blocking 0 -buffering line -translation crlf -eofchar {}
- puts "OpenIDL"
- }
- proc ResetIDL {} {
- puts $::idl "retall"
- puts $::idl "widget_control,/reset"
- puts $::idl "close,/all"
- puts $::idl "heap_gc,/verbose"
- # close $::idl
- # OpenIDL
- }
- proc RestartIDL {} {
- close $::idl
- OpenIDL
- }
- proc ShowSpikes {} {
- set ShowOptions {}
- # if {$::NType == 0} {
- # append ShowOptions ",CutSpikes=$::CutSpikePot "
- # }
- if {$::ShowTestSpikes == 1} {
- append ShowOptions ",/Test, TrialNr= $::TrialNr "
- }
- if {$::UseMinMaxTime == 1} {
- append ShowOptions ",Time=\[$::MinTime, $::MaxTime\]"
- }
- # if {$::SimOptions(NeuronType) == 0} {
- # append ShowOptions ",CutSpikes=$::CutSpikePot "
- # }
- if {$::SpikeOpt != {}} {
- append ShowOptions ", $::SpikeOpt "
- }
- append ShowOptions ",ShowPotentials=$::ShowPotLayer "
- set Command "gklearn_showsimspikes, dirname=\"$::SimDataDir\", /ShowSpikes, /sec $ShowOptions \n"
- # set Command "csim_showsimspikes, dirname=\"$::SimDataDir\", /sec \n"
- puts $Command
- puts $::idl $Command
- }
- proc ShowMovie {} {
- set ShowOptions {}
- append ShowOptions ",Tau=\[$::MovieTau0, $::MovieTau1\]"
- append ShowOptions ",Gain=\[$::MovieGain0, $::MovieGain1\]"
- if {$::ShowTestSpikes == 1} {
- append ShowOptions ",/Test, TrialNr= $::TrialNr "
- }
- set Command "gklearn_showsimspikes, dirname=\"$::SimDataDir\", /sec, /movie $ShowOptions \n"
- # set Command "csim_showsimspikes, dirname=\"$::SimDataDir\", /sec \n"
- puts $Command
- puts $::idl $Command
- }
- proc ShowMovieF2 {} {
- set ShowOptions {}
- append ShowOptions ",Tau=\[$::MovieTau0, $::MovieTau1, $::MovieTau1\]"
- append ShowOptions ",Gain=\[$::MovieGain0, $::MovieGain1, $::MovieGain1\]"
- if {$::ShowTestSpikes == 1} {
- append ShowOptions ",/Test, TrialNr= $::TrialNr "
- }
- append ShowOptions ", /XLinear"
- set Command "gklearn_showsimspikes, dirname=\"$::SimDataDir\", /sec, /movie $ShowOptions \n"
- # set Command "csim_showsimspikes, dirname=\"$::SimDataDir\", /sec \n"
- puts $Command
- puts $::idl $Command
- }
- proc ConnectionNames {} {
- #ToDo: Check wether SimInfoFile exists or not!!
- set ::ConnectionList {}
- set SimInfoFile ${::SimDataDir}Sim.SimInfo
- puts "InfoFilename $SimInfoFile"
- set fw [open $SimInfoFile "r"]
- while {[eof $fw] != 1} {
- set CurLine [gets $fw]
- set exp "<Connection.*Name=\"(.*)\""
- if {[regexp $exp $CurLine Match Name]} {
- puts $CurLine
- lappend ::ConnectionList $Name
- }
- }
- close $fw
- }
- proc ReadLbSelection {List} {
- set CurSelection [$List curselection]
- if {$CurSelection == {}} {
- # puts "No Weight Selected, use last selection"
- set CurSelection $::LastWeightSelection
- $List selection set $::LastWeightSelection
- }
- set ::LastWeightSelection $CurSelection
- return $CurSelection
- }
- proc ShowWeights {{WeightNr 0}} {
- set ConName [lindex $::ConnectionList $WeightNr]
- set ShowOptions {}
- append ShowOptions ", ConSelection=\"$ConName\""
- if {$::UseTrialWeights == 1} {
- append ShowOptions ", TrialNr='$::TrialNr'"
- }
- append ShowOptions ", Receptive=$::TWReceptive"
- append ShowOptions ", Zoom=2 "
- set Command "gklearn_showweights, dirname=\"$::SimDataDir\" $ShowOptions \n"
- puts $Command
- puts $::idl $Command
- }
- proc ShowListWeights {List} {
- ShowWeights [ReadLbSelection $List]
- ConnectionNames
- }
- proc TomWaits {List} {
- set ConName [lindex $::ConnectionList [ReadLbSelection $List]]
- set ShowOptions {}
- append ShowOptions ", ConSelection=\"$ConName\""
- if {$::UseTrialWeights == 1} {
- append ShowOptions ", TrialNr='$::TrialNr'"
- }
- append ShowOptions ", zoom=$::TWZoom"
- append ShowOptions ", magnify=$::TWMagnify"
- set Command "gklearn_tomwaits, dirname=\"$::SimDataDir\" $ShowOptions \n"
- # set Command "csim_showsimspikes, dirname=\"$::SimDataDir\", /sec \n"
- puts $Command
- puts $::idl $Command
- }
- proc TomWaitsQt {List} {
- set ConName [lindex $::ConnectionList [ReadLbSelection $List]]
- set ShowOptions {}
- append ShowOptions "$::SimDataDir$ConName"
- append ShowOptions "weights.dat"
- if {$::UseTrialWeights == 1} {
- append ShowOptions "$::TrialNr"
- }
- set Command "$::LibSimcontrolPath/../tools/tomwaits/tomwaits"
- puts $Command
- puts $ShowOptions
- exec $Command $ShowOptions &
- }
- proc CalcWeightMovie {List} {
- set ConName [lindex $::ConnectionList [ReadLbSelection $List]]
- set ShowOptions {}
- append ShowOptions ", ConSelection=\"$ConName\""
- append ShowOptions ", NTrials=$::WeightMovieTrials "
- append ShowOptions ", /show"
- # append ShowOptions ", Receptive=$::TWReceptive"
- # append ShowOptions ", Zoom=2 "
- set Command "csim_calcweightmovie, dirname=\"$::SimDataDir\" $ShowOptions \n"
- puts $Command
- puts $::idl $Command
- }
- proc ShowWeightMovie {List} {
- set ConName [lindex $::ConnectionList [ReadLbSelection $List]]
- set ShowOptions {}
- append ShowOptions ", ConSelection=\"$ConName\""
- # append ShowOptions ", Receptive=$::TWReceptive"
- # append ShowOptions ", Zoom=2 "
- set Command "csim_showweightmovie, dirname=\"$::SimDataDir\" $ShowOptions \n"
- puts $Command
- puts $::idl $Command
- }
- proc ShowSelectivity {} {
- set ShowOptions {}
- append ShowOptions ", TrialNr='$::TrialNr'"
- append ShowOptions ", /Test "
- set Command "gklearn_showsimspikes, dirname=\"$::SimDataDir\", /sec, /ShowSelectivity $ShowOptions \n"
- puts $Command
- puts $::idl $Command
- }
- #############################
- proc ShowResultsParaWin {} {
- set ::VisibleResultsPara 0
- toplevel .rpara
- set curframe1 .rpara
- wm protocol .rpara WM_DELETE_WINDOW "HideWin .rpara VisibleResultsPara"
- set ::TWZoom 1
- SimParaEntry2 ::TWZoom $curframe1
- set ::TWMagnify 2
- SimParaEntry2 ::TWMagnify $curframe1
- # frame ${curframe}.sub1
- # pack ${curframe}.sub1
- # set curframe1 ${curframe}.sub1
- set ::TWReceptive 1
- pack [radiobutton ${curframe1}.one -value 1 -text "Receptive Fields" -variable ::TWReceptive] -anchor sw
- pack [radiobutton ${curframe1}.two -value 0 -text "Projective Fields" -variable ::TWReceptive] -anchor sw
-
- set ::MovieTau0 50
- set ::MovieTau1 50
- set ::MovieGain0 30
- set ::MovieGain1 30
- SimParaEntry2 ::MovieTau0 $curframe1
- SimParaEntry2 ::MovieTau1 $curframe1
- SimParaEntry2 ::MovieGain0 $curframe1
- SimParaEntry2 ::MovieGain1 $curframe1
- set ::WeightMovieTrials 30
- SimParaEntry2 ::WeightMovieTrials $curframe1
- set ::ShowPotLayer 1
- SimParaEntry2 ::ShowPotLayer $curframe1
- }
- proc ShowResultsWindow {ResultsWindowName} {
- set ::VisibleSimResults 1
- toplevel $ResultsWindowName
- wm protocol $ResultsWindowName WM_DELETE_WINDOW "HideWin $ResultsWindowName ::VisibleSimResults"
- labelframe ${::ResultsWindowName}.showsim -text "Show Sim Results" -borderwidth 4 -relief sunken -padx 10 -pady 2
- pack ${::ResultsWindowName}.showsim -pady 2
- set curframe ${::ResultsWindowName}.showsim
-
- frame ${curframe}.rcontrol1
- pack ${curframe}.rcontrol1
- set curframe1 ${curframe}.rcontrol1
-
- frame ${curframe1}.sub1
- pack ${curframe1}.sub1 -side right
- set curframe2 ${curframe1}.sub1
-
- set ::TrialNr 0
- SimParaEntry2 ::TrialNr $curframe2
-
- frame ${curframe2}.sub2
- pack ${curframe2}.sub2 -side bottom -expand 1 -fill both
- set curframe3 ${curframe2}.sub2
- set ::UseTrialWeights 0
- set CurCheckbutton [checkbutton ${curframe3}.useTrialWeights -text "UseTrialWeights" -variable ::UseTrialWeights]
- pack $CurCheckbutton -anchor sw -side right
-
- ShowResultsParaWin
- ShowHideWin .rpara ::VisibleResultsPara
- pack [checkbutton ${curframe1}.show -text "ShowResParas" -variable ::VisibleResultsPara -command [list ShowHideWin .rpara ::VisibleResultsPara]] -side left
-
- frame ${curframe}.resultbuttons
- pack ${curframe}.resultbuttons
- set curframe1 ${curframe}.resultbuttons
-
- pack [button ${curframe1}.resetidl -command "ResetIDL" -text "ResetIDL"] -side left
- pack [button ${curframe1}.showmovie -command "ShowMovie" -text "Movie"] -side left
- pack [button ${curframe1}.showselectivity -command "ShowSelectivity" -text "Selectivity"] -side left
-
-
- ConnectionNames
-
- frame ${curframe}.weightshow
- pack ${curframe}.weightshow
- set curframe1 ${curframe}.weightshow
-
- frame ${curframe1}.lbframe
- pack ${curframe1}.lbframe -side bottom
- set curframe3 ${curframe1}.lbframe
- set ::LBname ${curframe3}.lb
- set ::SBname ${curframe3}.sb
- listbox ${::LBname} -selectmode single -height 3 -listvariable ConnectionList -activestyle dotbox
- scrollbar ${::SBname} -command [list ${::LBname} yview]
- ${::LBname} configure -yscrollcommand [list ${::SBname} set]
- #eval ${::LBname} insert 0 $ConnectionList
- pack ${::SBname} ${::LBname} -in ${curframe3} -side right -expand 1 -fill both
- #pack ${::LBname} -side left
-
- set LastWeightSelection 1
- ${::LBname} selection set 1
- #${::LBname} activate 1
- frame ${curframe1}.sub1
- pack ${curframe1}.sub1 -side top
- set curframe2 ${curframe1}.sub1
-
- pack [button ${curframe2}.showweights -command "[list ShowListWeights ${::LBname}]" -text "ShowWeights"] -side left
- pack [button ${curframe2}.tomwaits -command "[list TomWaits ${::LBname}]" -text "TomWaits"] -side left
- pack [button ${curframe2}.tomwaitsqt -command "[list TomWaitsQt ${::LBname}]" -text "TomWaitsQt"] -side left
- frame ${curframe3}.weightbuttonframe
- pack ${curframe3}.weightbuttonframe -side left
- set curframe4 ${curframe3}.weightbuttonframe
- pack [button ${curframe4}.calcwm -command "[list CalcWeightMovie ${::LBname}]" -text "CalcWeightMovie"] -side top
- pack [button ${curframe4}.showwm -command "[list ShowWeightMovie ${::LBname}]" -text "ShowWeightMovie"] -side top
-
-
- frame ${curframe}.results2
- pack ${curframe}.results2
- set curframe1 ${curframe}.results2
-
- frame ${curframe1}.buttoncheck
- pack ${curframe1}.buttoncheck -side left
- set curframe2 ${curframe1}.buttoncheck
- pack [button ${curframe2}.showspikes -command "ShowSpikes" -text "Spikes"] -side top
- set ::UseMinMaxTime 1
- pack [checkbutton ${curframe2}.yrange -text "MinMaxTime" -variable ::UseMinMaxTime -command "puts HalloMinMaxTime" ] -anchor sw -side top
- set ::ShowTestSpikes 0
- pack [checkbutton ${curframe2}.stsp -text "ShowTestSpikes" -variable ShowTestSpikes] -anchor sw -side top
-
- frame ${curframe1}.timeframe
- pack ${curframe1}.timeframe -side right
- set curframe2 ${curframe1}.timeframe
- set ::CutSpikePot 30
- SimParaEntry2 ::CutSpikePot $curframe2
- set ::MinTime 0
- SimParaEntry2 ::MinTime $curframe2
- set ::MaxTime 3
- SimParaEntry2 ::MaxTime $curframe2
- set ::SpikeOpt {}
- SimParaEntry2 ::SpikeOpt $curframe2
-
- frame ${curframe1}.cutsp
- pack ${curframe1}.cutsp -side right
- set curframe2 ${curframe1}.cutsp
- }
- proc ShowResultsWindow2 {ResultsWindowName} {
- set ::VisibleSimResults 1
- toplevel $ResultsWindowName
- wm protocol $ResultsWindowName WM_DELETE_WINDOW "HideWin $ResultsWindowName ::VisibleSimResults"
- labelframe ${::ResultsWindowName}.showsim -text "Show Sim Results" -borderwidth 4 -relief sunken -padx 10 -pady 2
- pack ${::ResultsWindowName}.showsim -pady 2
- set curframe ${::ResultsWindowName}.showsim
-
- frame ${curframe}.rcontrol1
- pack ${curframe}.rcontrol1
- set curframe1 ${curframe}.rcontrol1
-
- frame ${curframe1}.sub1
- pack ${curframe1}.sub1 -side right
- set curframe2 ${curframe1}.sub1
-
- frame ${curframe1}.sub2
- pack ${curframe1}.sub2 -side left -expand 1 -fill both
- set curframe2 ${curframe1}.sub2
-
- ShowResultsParaWin
- ShowHideWin .rpara ::VisibleResultsPara
- pack [checkbutton ${curframe1}.show -text "ShowResParas" -variable ::VisibleResultsPara -command [list ShowHideWin .rpara ::VisibleResultsPara]] -side left
-
- frame ${curframe}.resultbuttons
- pack ${curframe}.resultbuttons
- set curframe1 ${curframe}.resultbuttons
-
- # pack [button ${curframe1}.resetidl -command "ResetIDL" -text "ResetIDL"] -side top
- # pack [button ${curframe1}.showmovie -command "ShowMovie" -text "Movie"] -side top
- # pack [button ${curframe1}.showselectivity -command "ShowSelectivity" -text "Selectivity"] -side top
-
- frame ${curframe1}.sub1
- pack ${curframe1}.sub1 -side top
- set curframe2 ${curframe1}.sub1
-
- pack [button ${curframe2}.showweights -command "[list ShowListWeights ${::LBname}]" -text "ShowWeights"] -side left
- pack [button ${curframe2}.tomwaits -command "[list TomWaits ${::LBname}]" -text "TomWaits"] -side left
- pack [button ${curframe2}.showmovie -command "ShowMovieF2" -text "Movie"] -side left
-
- frame ${curframe}.results2
- pack ${curframe}.results2
- set curframe1 ${curframe}.results2
-
- frame ${curframe1}.buttoncheck
- pack ${curframe1}.buttoncheck -side left
- set curframe2 ${curframe1}.buttoncheck
- pack [button ${curframe2}.showspikes -command "ShowSpikes" -text "Spikes"] -side top
- set ::UseMinMaxTime 1
- pack [checkbutton ${curframe2}.yrange -text "MinMaxTime" -variable ::UseMinMaxTime -command "puts HalloMinMaxTime" ] -anchor sw -side top
- set ::ShowTestSpikes 0
- pack [checkbutton ${curframe2}.stsp -text "ShowTestSpikes" -variable ShowTestSpikes] -anchor sw -side top
-
- frame ${curframe1}.timeframe
- pack ${curframe1}.timeframe -side right
- set curframe2 ${curframe1}.timeframe
- set ::CutSpikePot 30
- SimParaEntry2 ::CutSpikePot $curframe2
- set ::MinTime 0
- SimParaEntry2 ::MinTime $curframe2
- set ::MaxTime 3
- SimParaEntry2 ::MaxTime $curframe2
-
- frame ${curframe1}.cutsp
- pack ${curframe1}.cutsp -side right
- set curframe2 ${curframe1}.cutsp
- }
- proc PutSimoutputToText { {CurFrame ::.fmtextfeld} {NLines 200} } {
- if {$::SimOutOrError == 0} {
- set SimOutputFile simoutput.txt
- } else {
- set SimOutputFile simerror.txt
- }
- # Text löschen
- $CurFrame delete 0.0 end
- # Text aus Datei einfügen
- # check file existence
- if ([file exists $SimOutputFile]) {
- $CurFrame insert end [exec tail $SimOutputFile -n $::NLines]
- } else {
- $CurFrame insert end "$SimOutputFile doesn't exist"
- }
- $CurFrame see end
- }
- proc ShowHideOutputWin {WinName WinVisible} {
- upvar $WinVisible VisibleState
- if {$VisibleState == 0} {
- wm withdraw $WinName
- } else {
- wm deiconify $WinName
- PutSimoutputToText $::fmtextfeld $::NLines
- }
- }
- proc ShowSimoutputWindow {SimOutputWindowName} {
- set ::VisibleSimoutputWindow 0
- set ::SimOutOrError 0
- toplevel $SimOutputWindowName
- wm protocol $SimOutputWindowName WM_DELETE_WINDOW "HideWin $SimOutputWindowName VisibleSimoutputWindow"
- # set curframe ${::SimOutputWindowName}
- # Textfeld generieren
- set curframe ${::SimOutputWindowName}.myfmtextfeld
- frame $curframe -width 900 -height 600
- pack $curframe
- text ${curframe}.mytext
- set curframe2 ${curframe}.mytext
- set ::fmtextfeld $curframe2
- set curframe1 ${curframe}.oben
- frame $curframe1
- pack $curframe1 -side top
- set ::NLines 24
- button ${curframe1}.b -text {Text aktualisieren (tail simoutput.txt -n NLines)} -background red -command {PutSimoutputToText $::fmtextfeld $::NLines}
- pack ${curframe1}.b -side left -fill x
- set curframeright ${curframe1}.right
- frame $curframeright
- pack $curframeright -side right
- set curframe3 ${curframeright}.nlines
- frame $curframe3
- pack $curframe3 -anchor sw -side left
- label ${curframe3}.nlineslabel -text "NLines"
- pack ${curframe3}.nlineslabel -side left
- set mybut [entry ${curframe3}.nlinesentry -textvariable ::NLines -width 7 -bg white -relief sunken -border 1 -highlightcolor green]
- pack $mybut -side top -anchor n -side right -pady 2
- # Textfeld platzieren
- pack $curframe2 -side bottom
- # Text in Textfeld einfuegen
- PutSimoutputToText $::fmtextfeld $::NLines
- #ToDo 14.08.08: 2 Radio-Buttons: umschalten zwischen SimOutput und SimError -Ausgabe
- set curframe4 ${curframeright}.outorerror
- frame $curframe4
- pack $curframe4 -anchor sw -side right
- radiobutton ${curframe4}.out -value 0 -command "PutSimoutputToText $::fmtextfeld $::NLines" -text "SimOutput" -variable ::SimOutOrError
- pack ${curframe4}.out -side left
- radiobutton ${curframe4}.err -value 1 -command "PutSimoutputToText $::fmtextfeld $::NLines" -text "SimError" -variable ::SimOutOrError
- pack ${curframe4}.err -side right
- }
|