Exemplo n.º 1
0
 def populateKKitPlots(self,path):
     graphs = self.getKKitGraphs(path) #clocks are assigned in the script itself!
     #currently putting all plots on Plot Window 1 by default - perhaps not the nicest way to do it.
     self.plotWindowFieldTableDict['Plot Window 1'] = graphs
     plotWin = newPlotSubWindow(self.mdiArea)
     #plotWin = MoosePlotWindow()
     #plot = MoosePlot(plotWin)
     #plot.setObjectName("plot")
     #plotWin.setWidget(plot)
     self.mdiArea.addSubWindow(plotWin)
     #self.mdiArea.setActiveSubWindow(plotWin)
     plotWin.setWindowTitle('Plot Window 1')
     for graph in graphs:
         tab = moose.element(graph)
         tableObject = tab.getNeighbors('requestData')
         if(len(tableObject) > 0):
             iteminfo = tableObject[0].path+'/info'
             c = moose.Annotator(iteminfo).getField('color')
             graphColor = self.colorCheck(c)
         else: graphColor = 'blue'
         plotWin.plot.addTable(graph,graph.getField('name'),graphColor)
     plotWin.show()
     plotWin.plot.nicePlaceLegend()
     plotWin.plot.axes.figure.canvas.draw()
     self.plotNameWinDict['Plot Window 1'] = plotWin
     self.mdiArea.setActiveSubWindow(self.activeWindow)
     self.activeWindow = plotWin
Exemplo n.º 2
0
    def addFieldToPlot(self):
        #creates tables - called when 'Okay' pressed in plotconfig dock
        dataNeutral = moose.Neutral(self.plotConfigCurrentSelection.getField('path')+'/data')
        newTable = moose.Table(self.plotConfigCurrentSelection.getField('path')+'/data/'+str(self.plotConfigFieldSelectionComboBox.currentText()))
        moose.connect(newTable,'requestData', self.plotConfigCurrentSelection,'get_'+str(self.plotConfigFieldSelectionComboBox.currentText()))
        moose.useClock(8, newTable.getField('path'), 'process') #assign clock after creation itself 

        if str(self.plotConfigWinSelectionComboBox.currentText()) in self.plotWindowFieldTableDict:
            #case when plotwin already exists - append new table to mooseplotwin
            self.plotWindowFieldTableDict[str(self.plotConfigWinSelectionComboBox.currentText())].append(newTable)
            #select the corresponding plot (mooseplot) from the plotwindow (mooseplotwindow) 
            plotWin = self.plotNameWinDict[str(self.plotConfigWinSelectionComboBox.currentText())] 
            #harsha start:The color shd be accessed only for KKIT file and for neuronal model shd pass none, for now hacking
            iteminfo = self.plotConfigCurrentSelection.getField('path')+'/info'
            c = moose.Annotator(iteminfo).getField('color')
            graphColor = self.colorCheck(c)
            #end
            
            if graphColor == "white":
                graphColor = None
            #print "F",graphColor
            plotWin.plot.addTable(newTable,self.plotConfigCurrentSelection.getField('name')+'.'+newTable.getField('name'),graphColor)
            plotWin.plot.nicePlaceLegend()
            plotWin.plot.axes.figure.canvas.draw()    
            self.activeWindow = plotWin
            self.plotConfigOverlayPlotsCheckBox.setChecked(plotWin.plot.overlayPlots)
        else:
            #no previous mooseplotwin - so create, and add table to corresp dict
            self.plotWindowFieldTableDict[str(self.plotConfigWinSelectionComboBox.currentText())] = [newTable]
            plotWin = newPlotSubWindow(self.mdiArea)
            plotWin.setWindowTitle(str(self.plotConfigWinSelectionComboBox.currentText()))
            #harsha start:The color shd be accessed only for KKIT file and for neuronal model shd pass none, for now hacking
            iteminfo = self.plotConfigCurrentSelection.getField('path')+'/info'
            c = moose.Annotator(iteminfo).getField('color')
            graphColor = self.colorCheck(c)
            #end
            if graphColor == "white":
                graphColor = None
            plotWin.plot.addTable(newTable,self.plotConfigCurrentSelection.getField('name')+'.'+newTable.getField('name'),graphColor)
            plotWin.plot.nicePlaceLegend()
            plotWin.plot.axes.figure.canvas.draw()
            plotWin.show()
            self.plotNameWinDict[str(self.plotConfigWinSelectionComboBox.currentText())] = plotWin
            self.plotConfigOverlayPlotsCheckBox.setChecked(False)
            #self.mdiArea.addSubWindow(plotWin)
            self.activeWindow = plotWin
Exemplo n.º 3
0
    def plotConfigAddNewPlotWindow(self):
        #called when new plotwindow pressed in plotconfig dock
        count = len(self.plotNameWinDict)
        if count != 0:
            self.plotConfigWinSelectionComboBox.addItem('Plot Window '+str(count+1))
        self.plotConfigWinSelectionComboBox.setCurrentIndex(count)

        plotWin = newPlotSubWindow(self)
        plotWin.setWindowTitle(str(self.plotConfigWinSelectionComboBox.currentText()))

        self.plotNameWinDict[str(self.plotConfigWinSelectionComboBox.currentText())] = plotWin
        self.plotWindowFieldTableDict[str(self.plotConfigWinSelectionComboBox.currentText())] = []
        self.plotConfigOverlayPlotsCheckBox.setChecked(False)
        #plotWin.plot.nicePlaceLegend()
        self.plotConfigOverlayPlotsCheckBox.setChecked(False)
        self.mdiArea.addSubWindow(plotWin)
        self.mdiArea.setActiveSubWindow(plotWin)
        plotWin.show()        

        self.activeWindow = plotWin