Esempio n. 1
0
mpl.rc('lines', **linewidth)
linewidth = {'linewidth': 4.0}
mpl.rc('axes', **linewidth)
import matplotlib.cm as cm
import matplotlib.pyplot as plt

# *Bold Monitor*
# --------
#
#
#
# Let's start by creating an instance of the Bold monitor with its default parameters:

# In[3]:

bold = monitors.Bold()

# In general, the sampling period of a monitor is in milliseconds and must be an integral multiple of the integration-step size used in a simulation.
#
# Therefore, monitors need to know the integration time step (*dt*) because some data reduction mechanims (eg, downsampling to the monitor's sampling period) depend on it. An easy way to achieve this is:

# In[4]:

bold.dt = 2**-4  # Default value used in the scripts found at tvb/simulator/demos

# HRFs are TVB Equation datatypes, and you can explore their attributes, for instance:

# * which equation we use,

# In[5]:
Esempio n. 2
0
 def test_monitor_bold(self):
     """
     This has to be verified.
     """
     monitor = monitors.Bold()
     assert monitor.period == 2000.0
Esempio n. 3
0
 def test_monitor_bold(self):
     """
     This has to be verified.
     """
     monitor = monitors.Bold()
     self.assertEqual(monitor.period, 2000.0)
Esempio n. 4
0
        # sim_result = sub_sim.prepare_and_run(what_to_watch = what_to_watch, linear_coupling=linear_coupling.item(), conduction_speed=conduction_speed.item(),  K11=K11, K12=K12, K21=K21, simulation_length=simulation_length_PE, period_length=period_length_bold)

        sim_results.append(sim_result)

    # final result of this loop will be list of dictionaries. each dictionary is a simulation with one parameter combo.

    sim_results = remove_beg_of_ts(sim_results, throwaway_length_pe)

    #ideal_measure = FC_Ideal_Measure(sim_results = sim_results, empirical_results = sub.empfc)
    #ideal_params = ideal_measure.find_ideal_params()

    ideal_params = find_ideal_params_using_fc(sim_results, sub.empfc)
    # ideal_params = find_ideal_params_using_temp_subsample(sim_results, sub)

    what_to_watch = monitors.Bold(period=period_length_bold,
                                  hrf_kernel=equations.MixtureOfGammas(),
                                  variables_of_interest=variables_of_interest)

    # run the sim with these ideal params we have identified:
    #    sim_result_for_ideal_params = sub_sim.prepare_and_run(what_to_watch = what_to_watch, linear_coupling=linear_coupling, conduction_speed=conduction_speed, K11=ideal_params['K11'], K12=ideal_params['K12'], K21=ideal_params['K21'], simulation_length=simulation_length_sim, period_length=period_length_bold)

    sim_result_for_ideal_params = sub_sim.prepare_and_run(
        what_to_watch=what_to_watch,
        linear_coupling=ideal_params['linear_coupling'],
        conduction_speed=ideal_params['conduction_speed'],
        K11=ideal_params['K11'],
        K12=ideal_params['K12'],
        K21=ideal_params['K21'],
        simulation_length=simulation_length_sim,
        period_length=period_length_bold)
Esempio n. 5
0
##----------------------------------------------------------------------------##

LOG.info("Configuring...")
#Initialise a Model, Coupling, and Connectivity.
oscilator = models.Generic2dOscillator()  #ReducedSetHindmarshRose() #
white_matter = connectivity.Connectivity()
white_matter.speed = numpy.array([4.0])

white_matter_coupling = coupling.Linear(a=0.0126)

#Initialise an Integrator
heunint = integrators.HeunDeterministic(dt=2**-4)

#Initialise some Monitors with period in physical time
momo = monitors.TemporalAverage(period=1.0)  #1000Hz
mama = monitors.Bold(period=500)  #defaults to one data point every 2s

#Bundle them
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