示例#1
0
 def testVmSeriesPlot(self):
     utils.setDefaultDt(elecdt=simdt)
     utils.assignDefaultTicks(modelRoot=self.m2.path)
     utils.assignTicks({0:'%s/##[ISA=HSolve]' % (self.m1.path),
                        1: '%s/##[ISA=PulseGen]' % (self.m1.path),
                        7: '%s/##[ISA=VClamp]' % (self.m1.path)})
     moose.reinit()
     tick = moose.element('/clock/tick')
     for ii in range(10):
         field = 'proc%d' % (ii)
         print 'Connected to', field
         for n in tick.neighbours[field]:
             print '\t', n
     ts = datetime.now()
     moose.start(simtime)
     te = datetime.now()
     td = te - ts
     t1 = np.linspace(0, simtime, len(self.p1['somaVm'].vec))
     t2 = np.linspace(0, simtime, len(self.p2['somaVm'].vec))
     pylab.plot(t1, self.p1['somaVm'].vec, label='hsolve')
     pylab.plot(t2, self.p2['somaVm'].vec, label='euler')
     config.logger.info('Finished simulation of %g s with %d process threads in %g s' % (simtime, moose.NUMPTHREADS, td.seconds + 1e-6 * td.microseconds))
     hsolve_data_file = os.path.join(config.data_dir, 'hsolve_tcr_%s.csv' % (config.filename_suffix))
     eeuler_data_file = os.path.join(config.data_dir, 'ee_tcr_%s.csv' % (config.filename_suffix))        
     np.savetxt(hsolve_data_file, np.vstack((t1, self.p1['somaVm'].vec)).transpose())
     np.savetxt(eeuler_data_file, np.vstack((t2, self.p2['somaVm'].vec)).transpose())
     print 'Saved Exp Euler data in %s\nHSolve data in %s' % (hsolve_data_file, eeuler_data_file)
     pylab.legend()
     pylab.show()
示例#2
0
 def doResetAndRun(self, tickDtMap, tickTargetMap, simtime, updateInterval):
     self._pause = False
     self._updateInterval = updateInterval
     self._simtime = simtime
     utils.updateTicks(tickDtMap)
     utils.assignTicks(tickTargetMap)
     self.resetAndRun.emit()
     moose.reinit()
     QtCore.QTimer.singleShot(0, self.run)