Ejemplo n.º 1
0
 def test_manual_weight_overrides_connector(self, sim_mock):
     dev = PoissonGenerator(connector={
         'weight': 2,
         'delay': 4,
         'mode': 'AllToAll'
     },
                            weight=42)
     dev.connect(Mock())
     self.assertTrue(sim_mock().Population.called)
     self.assertFalse(sim_mock().initialize.called)
     self.assertDictEqual(
         dev._parameters, {
             "duration": float("inf"),
             "start": 0.0,
             "rate": 0.0,
             "connector": sim_mock().AllToAllConnector(),
             "weight": 42,
             "delay": 4,
             "source": None,
             "receptor_type": "excitatory",
             "synapse_type": sim_mock().StaticSynapse(),
             "label": None,
             "rng": None,
             "n": 1
         })
Ejemplo n.º 2
0
    def test_activation(self, sim_mock):
        dev = PoissonGenerator()
        dev.connect(Mock())

        self.assertTrue(dev.active)

        dev.active = False
        self.assertFalse(dev.active)

        dev.active = True
        self.assertTrue(dev.active)
Ejemplo n.º 3
0
 def test_synapse_dynamics(self, sim_mock):
     dev = PoissonGenerator(synapse_type={
         'type': 'TsodyksMarkram',
         'U': 0,
         'tau_rec': 8,
         'tau_facil': 15
     })
     dev.connect(Mock())
     self.assertTrue(sim_mock().Population.called)
     self.assertFalse(sim_mock().initialize.called)
     self.assertIsNotNone(dev._parameters["synapse_type"])
     self.assertTrue(sim_mock().TsodyksMarkramSynapse.called)
Ejemplo n.º 4
0
 def test_inhibitory(self, sim_mock):
     dev = PoissonGenerator(receptor_type="inhibitory")
     dev.connect(Mock())
     self.assertTrue(sim_mock().Population.called)
     self.assertFalse(sim_mock().initialize.called)
     self.assertDictEqual(
         dev._parameters, {
             "duration": float("inf"),
             "start": 0.0,
             "rate": 0.0,
             "connector": sim_mock().AllToAllConnector(),
             "weight": 0.00015,
             "delay": 0.1,
             "source": None,
             "receptor_type": "inhibitory",
             "synapse_type": sim_mock().StaticSynapse(),
             "label": None,
             "rng": None,
             "n": 1
         })
Ejemplo n.º 5
0
 def test_connector_no_delays(self, sim_mock):
     dev = PoissonGenerator(connector={
         'weight': 1,
         'mode': 'Fixed',
         'n': 1
     })
     dev.connect(Mock())
     self.assertTrue(sim_mock().Population.called)
     self.assertFalse(sim_mock().initialize.called)
     self.assertDictEqual(
         dev._parameters, {
             "duration": float("inf"),
             "start": 0.0,
             "rate": 0.0,
             "connector": sim_mock().FixedNumberPreConnector(),
             "weight": 1,
             "delay": 0.1,
             "source": None,
             "receptor_type": "excitatory",
             "synapse_type": sim_mock().StaticSynapse(),
             "label": None,
             "rng": None,
             "n": 1
         })