Exemplo n.º 1
0
    def create_stimuli(n_nodes, node_idx, node_weights, **params):
        weighting = np.zeros(n_nodes)
        weighting[node_idx] = node_weights

        eqn_t = equations.DiscreteTemporalEquation()
        eqn_t.parameters.update(params)

        stimulus = patterns.StimuliRegion(temporal=eqn_t,
                                          connectivity=connectome,
                                          weight=weighting
                                          )

        return stimulus
Exemplo n.º 2
0
 def test_stimuliregion(self):
     conn = connectivity.Connectivity(load_default=True)
     conn.configure()
     dt = patterns.StimuliRegion()
     dt.connectivity = conn
     dt.spatial = equations.DiscreteEquation()
     dt.temporal = equations.Gaussian()
     dt.weight = [0 for _ in range(conn.number_of_regions)]
     dt.configure_space()
     assert dt.summary_info['Type'] == 'StimuliRegion'
     assert dt.connectivity is not None
     assert dt.space.shape == (76, 1)
     assert dt.spatial_pattern.shape == (76, 1)
     assert isinstance(dt.temporal, equations.Gaussian)
     assert dt.temporal_pattern is None
     assert dt.time is None
Exemplo n.º 3
0
 def test_stimuliregion(self):
     conn = connectivity.Connectivity()
     conn.configure()
     dt = patterns.StimuliRegion()
     dt.connectivity = conn
     dt.spatial = equations.DiscreteEquation()
     dt.temporal = equations.Gaussian()
     dt.weight = [0 for _ in range(conn.number_of_regions)]
     dt.configure_space()
     self.assertEqual(dt.summary_info['Type'], 'StimuliRegion')
     self.assertTrue(dt.connectivity is not None)
     self.assertEqual(dt.space.shape, (74, 1))
     self.assertEqual(dt.spatial_pattern.shape, (74, 1))
     self.assertTrue(isinstance(dt.temporal, equations.Gaussian))
     self.assertTrue(dt.temporal_pattern is None)
     self.assertTrue(dt.time is None)
Exemplo n.º 4
0
 def test_stimuliregion(self):
     conn = connectivity.Connectivity.from_file()
     conn.configure()
     dt = patterns.StimuliRegion()
     dt.connectivity = conn
     dt.spatial = DiscreteEquation()
     dt.temporal = Gaussian()
     dt.weight = numpy.array([0 for _ in range(conn.number_of_regions)])
     dt.configure_space()
     assert dt.summary_info()['Type'] == 'StimuliRegion'
     assert dt.connectivity is not None
     assert dt.space.shape == (76, 1)
     assert dt.spatial_pattern.shape == (76, 1)
     assert isinstance(dt.temporal, Gaussian)
     assert dt.temporal_pattern is None
     assert dt.time is None
Exemplo n.º 5
0
what_to_watch = (momo, mama)

#Define the stimulus
#Specify a weighting for regions to receive stimuli...
white_matter.configure()  # Because we want access to number_of_regions
nodes = [0, 7, 13, 33, 42]
weighting = numpy.zeros((white_matter.number_of_regions, ))  #1
weighting[nodes] = numpy.array([2.0**-2, 2.0**-3, 2.0**-4, 2.0**-5,
                                2.0**-6])  # [:, numpy.newaxis]

eqn_t = equations.Gaussian()
eqn_t.parameters["midpoint"] = 15000.0
eqn_t.parameters["sigma"] = 4.0

stimulus = patterns.StimuliRegion(temporal=eqn_t,
                                  connectivity=white_matter,
                                  weight=weighting)

#Initialise Simulator -- Model, Connectivity, Integrator, Monitors, and stimulus.
sim = simulator.Simulator(model=oscilator,
                          connectivity=white_matter,
                          coupling=white_matter_coupling,
                          integrator=heunint,
                          monitors=what_to_watch,
                          stimulus=stimulus)  # surface=default_cortex,

sim.configure()

LOG.info("Starting simulation...")
#Perform the simulation
tavg_time = []