Esempio n. 1
0
    def __init__(self):
        #interactive mode causes problems
        self.interactive = 0
        
        #references to plots
        self.TSSPlot = None
        self.RMSPlot = None
        self.pCorrectPlot = None
        self.hintonDiags = {}
        self.archDiag = None
        self.activDiag = None
        
        #parsed network
        self.netStruct = NetStruct.NetStruct(self)

        #data variables
        self.TSSData = []
        self.RMSData = []
        self.pCorrectData = []

        self.root = Tkinter.Tk()
        self.root.title("VisConx")
        self.root.resizable(0,0)
        self.root.protocol("WM_DELETE_WINDOW", self.handleWindowClose)

        # --BEGIN visualFrame
        self.visualFrame = Tkinter.Frame(self.root)
        Tkinter.Label(self.visualFrame, text="Visualization Tools:",
                      font=("Arial", 14, "bold")).grid(row=0, column=0, columnspan=2, sticky=Tkinter.W)
        
        #setup options for basic data plots
        Tkinter.Label(self.visualFrame, text="Plot:").grid(column=0, row=1, sticky= Tkinter.W)
        self.TSSCheck = Tkinter.Checkbutton(self.visualFrame, text="Show TSS Plot", command = self.handleTSSBox)
        self.TSSCheck.grid(column=1,row=1, sticky=Tkinter.W)
        self.RMSCheck = Tkinter.Checkbutton(self.visualFrame, text="Show RMS Plot", command = self.handleRMSBox)
        self.RMSCheck.grid(column=1,row=2, sticky=Tkinter.W)
        self.pCorrectCheck = Tkinter.Checkbutton(self.visualFrame, text="Show % Correct  Plot",
                                                 command = self.handlePCorrectBox)
        self.pCorrectCheck.grid(column=1,row=3, sticky=Tkinter.W)

        #options for displaying hinton diagrams
        Tkinter.Label(self.visualFrame, text="Connections:").grid(column=0, row=4, sticky=Tkinter.NW)
        self.hintonListBox = Tkinter.Listbox(self.visualFrame, selectmode = Tkinter.SINGLE, height=4, width = 40)
        self.hintonListBox.grid(column=1, row=4, sticky=Tkinter.NSEW)
        conButtonFrame = Tkinter.Frame(self.visualFrame)
        Tkinter.Button(conButtonFrame,text="Show connection weights",
                       command=self.createHintonDiag).grid(row=0, column=0, columnspan=2) 
        Tkinter.Button(conButtonFrame, text="Save all weights", command=self.saveAllWeights).grid(row=1, column=0)
        Tkinter.Button(conButtonFrame, text="Load all weights", command=self.loadAllWeights).grid(row=1, column=1)
        conButtonFrame.grid(column=1, row=5)
        self.refreshHintonListBox()

        #options for displaying the network topology
        Tkinter.Label(self.visualFrame, text="Network Architecture:").grid(column=0,row=6, sticky=Tkinter.W)
        self.archButton = Tkinter.Checkbutton(self.visualFrame, text="Draw network architecture",
                                              command=self.handleNetworkArchBox)
        self.archButton.grid(column=1,row=6, sticky=Tkinter.W)

        #options for displaying node activations
        Tkinter.Label(self.visualFrame, text="Node Activations:").grid(column=0,row=7,sticky=Tkinter.W)
        self.activButton = Tkinter.Checkbutton(self.visualFrame, text="Examine Node Activations",
                                               command=self.handleActivDiag)
        self.activButton.grid(column=1,row=7,sticky=Tkinter.W)
        #END - visualFrame

        #BEGIN - Command evaluation
        #evaluation window
        self.inputFrame = Tkinter.Frame(self.root)

        inputLabelFrame = Tkinter.Frame(self.inputFrame)
        Tkinter.Label(inputLabelFrame, text="Conx Commands:", font=("Arial", 14, "bold")).pack(side=Tkinter.LEFT)
        inputLabelFrame.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=Tkinter.YES)
        
        #output and scroll bar
        self.textFrame = Tkinter.Frame(self.inputFrame)
        self.textOutput = Tkinter.Text(self.textFrame, width = 40, height = 10,
                                   state=Tkinter.DISABLED, wrap=Tkinter.WORD)
        self.textOutput.pack(side=Tkinter.LEFT, expand=Tkinter.YES, fill=Tkinter.X)
        scrollbar = Tkinter.Scrollbar(self.textFrame, command=self.textOutput.yview)
        scrollbar.pack(side=Tkinter.LEFT,expand=Tkinter.NO,fill=Tkinter.Y)
        self.textOutput.configure(yscroll=scrollbar.set)
        self.textFrame.pack(side=Tkinter.TOP, expand=Tkinter.YES, fill=Tkinter.X)

        #input box
        Tkinter.Label(self.inputFrame, text="Command:").pack(side=Tkinter.LEFT)
        self.commandEntry = Tkinter.Entry(self.inputFrame)
        self.commandEntry.bind("<Return>", self.handleCommand)
        self.commandEntry.pack(side=Tkinter.LEFT,expand=Tkinter.YES,fill="x")
        #END - Command evaluation
        
        self.root.update_idletasks()
Esempio n. 2
0
 def updateStructureDiags(self):
     self.netStruct = NetStruct.NetStruct(self)
     self.refreshHintonListBox()
     self.refreshArchDiag()
     self.refreshActivDiag()