Esempio n. 1
0
                        #spikeTrace.setCommentOnPoint(pointNum, "Point for electrotonic len: "+str(maxElecLen))
                        spikeTrace.setCommentOnPoint(pointNum, morphProp)

                        if plotSims:
                            simConfigName = simData.getSimulationProperties(
                            ).getProperty("Sim Config")

                            if simConfigName.find('(') >= 0:
                                simConfigName = simConfigName[0:simConfigName.
                                                              find('(')]

                            for dataStore in simData.getAllLoadedDataStores():

                                ds = simData.getDataSet(
                                    dataStore.getCellSegRef(),
                                    dataStore.getVariable(), False)

                                if not plotVoltageOnly or dataStore.getVariable(
                                ) == SimPlot.VOLTAGE:
                                    if not plotSomaOnly or dataStore.getAssumedSegmentId(
                                    ) == 0:

                                        plotFrame = PlotManager.getPlotterFrame("Behaviour of "+dataStore.getVariable() \
                                            +" on: %s for sim config: %s"%(str(simulators), simConfigName))

                                        plotFrame.addDataSet(ds)

                except:
                    print "Error analysing simulation data from: %s" % simDir.getCanonicalPath(
                    )
Esempio n. 2
0
project = pm.loadProject(projFile)

print 'Successfully loaded project: ', project.getProjectName()

simDir = File(projFile.getParentFile(), "/simulations/"+simRef)
print
print "--- Reloading data from simulation in directory: %s"%simDir.getCanonicalPath()

plotFrame = PlotManager.getPlotterFrame("All voltage traces from simulation: "+simRef, False)

try:
    simData = SimulationData(simDir)
    simData.initialise()

    volt_traces = simData.getCellSegRefs(True)
    for trace in volt_traces:
        ds = simData.getDataSet(trace, SimPlot.VOLTAGE, False)
        plotFrame.addDataSet(ds)

except:
    print "Error analysing simulation data from: %s"%simDir.getCanonicalPath()
    print exc_info()

plotFrame.setVisible(True) 






                                        
                    comps = morphProp.split(":")[-1]

                    pointNum = spikeTrace.addPoint(float(comps), spikeTimes[spikeIndex])

                    #spikeTrace.setCommentOnPoint(pointNum, "Point for electrotonic len: "+str(maxElecLen))
                    spikeTrace.setCommentOnPoint(pointNum, morphProp)
    
                    if plotSims:
                        simConfigName = simData.getSimulationProperties().getProperty("Sim Config")
    
                        if simConfigName.find('(')>=0:
                            simConfigName = simConfigName[0:simConfigName.find('(')]
    
                        for dataStore in simData.getAllLoadedDataStores():
    
                            ds = simData.getDataSet(dataStore.getCellSegRef(), dataStore.getVariable(), False)
                            
    
                            if not plotVoltageOnly or dataStore.getVariable() == SimPlot.VOLTAGE:
                                if not plotSomaOnly or dataStore.getAssumedSegmentId() == 0:
    
                                    plotFrame = PlotManager.getPlotterFrame("Behaviour of "+dataStore.getVariable() \
                                        +" on: %s for sim config: %s"%(str(simulators), simConfigName))
                                        
    
                                    plotFrame.addDataSet(ds)



            except:
                print "Error analysing simulation data from: %s"%simDir.getCanonicalPath()
Esempio n. 4
0
def reloadSims(waitForSimsToFinish):


    print "Trying to reload sims: "+str(allFinishedSims)

    plottedSims = []

    for simRef in allFinishedSims:

        simDir = File(projFile.getParentFile(), "/simulations/"+simRef)
        timeFile = File(simDir, "time.dat")
        timeFile2 = File(simDir,"time.txt") # for PSICS...


        if timeFile.exists() or timeFile2.exists():
            if verbose: print "--- Reloading data from simulation in directory: %s"%simDir.getCanonicalPath()
            time.sleep(1) # wait a while...

            try:
                simData = SimulationData(simDir)
                simData.initialise()
                times = simData.getAllTimes()

                if analyseSims:
                    '''
                    volts = simData.getVoltageAtAllTimes(cellSegmentRef)

                    if verbose: print "Got "+str(len(volts))+" data points on cell seg ref: "+cellSegmentRef

                    analyseStartTime = 0
                    analyseStopTime = simConfig.getSimDuration()
                    analyseThreshold = -20 # mV

                    spikeTimes = SpikeAnalyser.getSpikeTimes(volts, times, analyseThreshold, analyseStartTime, analyseStopTime)

                    print "Spike times in %s for sim %s: %s"%(cellSegmentRef, simRef, str(spikeTimes))
                    '''

                if plotSims:

                    simConfigName = simData.getSimulationProperties().getProperty("Sim Config")

                    if simConfigName.find('(')>=0:
                        simConfigName = simConfigName[0:simConfigName.find('(')]

                    for dataStore in simData.getAllLoadedDataStores():

                        ds = simData.getDataSet(dataStore.getCellSegRef(), dataStore.getVariable(), False)

                        if not plotVoltageOnly or dataStore.getVariable() == SimPlot.VOLTAGE:

                            plotFrame = PlotManager.getPlotterFrame("Behaviour of "+dataStore.getVariable() \
                                +" on: %s for sim config: %s"%(str(simulators), simConfigName))

                            plotFrame.addDataSet(ds)


                    plottedSims.append(simRef)


            except:
                print "Error analysing simulation data from: %s"%simDir.getCanonicalPath()
                print sys.exc_info()

    for simRef in plottedSims:
        allFinishedSims.remove(simRef)


    if waitForSimsToFinish and len(allRunningSims)>0:

        if verbose: print "Waiting for sims: %s to finish..."%str(allRunningSims)

        time.sleep(2) # wait a while...
        updateSimsRunning()
        reloadSims(True)