def run(self, tstop=None): # TODO: Check if cells/connections need to be rebuilt. # Create the networ dipde_pops = [p.dipde_obj for p in self._graph.populations] dipde_conns = [c.dipde_obj for c in self._graph.connections] #print dipde_pops #print dipde_conns #exit() self._dipde_network = dipde.Network(population_list=dipde_pops, connection_list=dipde_conns) #self._dipde_network = dipde.Network(population_list=self._graph.populations, # connection_list=self._graph.connections) if tstop is None: tstop = self.tstop #print tstop, self.dt #print self._graph.populations #exit() print("running simulation...") self._dipde_network.run(t0=0.0, tf=tstop, dt=self.dt) # TODO: make record_rates optional? self.__record_rates() print("done simulation.")
def run(self, duration=None): # TODO: Check if cells/connections need to be rebuilt. # Create the networ self._dipde_network = dipde.Network(population_list=self.populations, connection_list=self.__connection_list) if duration is None: duration = self.duration print "running simulation..." self._dipde_network.run(t0=0.0, tf=duration, dt=self.dt) # TODO: make record_rates optional? self.__record_rates() print "done simulation."
def run(self, tstop=None): # TODO: Check if cells/connections need to be rebuilt. # Create the network dipde_pops = [p.dipde_obj for p in self._graph.populations] dipde_conns = [c.dipde_obj for c in self._graph.connections] self._dipde_network = dipde.Network(population_list=dipde_pops, connection_list=dipde_conns) if tstop is None: tstop = self.tstop self.io.log_info("Running simulation.") self._dipde_network.run(t0=0.0, tf=tstop, dt=self.dt) # TODO: make record_rates optional? self.__record_rates() self.io.log_info("Finished simulation.")
def test_equvalent_discrete(): import dipde test_list = [.001, {'distribution': 'delta', 'loc': 0}, '{"distribution":"delta", "loc":0}', ([0], [1]), sps.rv_discrete(values=([0], [1]))] for p0 in test_list: print p0 i1 = dipde.InternalPopulation(v_min=0, v_max=.02, dv=.001, p0=p0) b1 = dipde.ExternalPopulation('100') b1_i1 = dipde.Connection(b1, i1, 1, weights=.005) network = dipde.Network([b1, i1], [b1_i1]) network.run(dt=.001, tf=.2) np.testing.assert_almost_equal(i1.firing_rate_record[-1], 5.39156805318, 10)
def test_equvalent_continuous(): import dipde test_list = [dipde.InternalPopulation(v_min=0, v_max=.02, dv=.001, p0=sps.norm(scale=.003)), dipde.InternalPopulation(v_min=0, v_max=.02, dv=.001, p0=sps.norm(loc=0, scale=.003)), dipde.InternalPopulation(v_min=0, v_max=.02, dv=.001, p0=(sps.norm(loc=0, scale=.003), 25)), dipde.InternalPopulation(v_min=0, v_max=.02, dv=.001, p0={"distribution": "norm", "loc": 0, "scale": 0.003}), dipde.InternalPopulation(v_min=0, v_max=.02, dv=.001, p0={"distribution": "norm", "loc": 0, "scale": 0.003, "N": 25}), dipde.InternalPopulation(v_min=0, v_max=.02, dv=.001, p0='{"distribution":"norm", "loc":0, "scale":0.003, "N":25}')] for i1 in test_list: b1 = dipde.ExternalPopulation('100') b1_i1 = dipde.Connection(b1, i1, 1, weights=.005) network = dipde.Network([b1, i1], [b1_i1]) network.run(dt=.001, tf=.2) np.testing.assert_almost_equal(i1.firing_rate_record[-1], 5.3915680916372484, 10)