def test_monitor_stereoeeg(self): """ This has to be verified. """ monitor = monitors.iEEG() monitor.sensors = sensors.SensorsInternal(load_default=True) assert monitor.period == self.default_period
def test_monitor_stereoeeg(self): """ This has to be verified. """ monitor = monitors.iEEG() monitor.sensors = sensors.SensorsInternal(load_file="seeg_39.txt.bz2") assert monitor.period == self.default_period
def test_sensorsinternal(self): dt = sensors.SensorsInternal() dt.configure() self.assertFalse(dt.has_orientation) self.assertEqual(dt.labels.shape, (103,)) self.assertEqual(dt.locations.shape, (103, 3)) self.assertEqual(dt.number_of_sensors, 103) self.assertEqual(dt.orientations.shape, (0,)) self.assertEqual(dt.sensors_type, 'Internal')
def test_sensorsinternal(self): dt = sensors.SensorsInternal(load_default=True) dt.configure() self.assertTrue(isinstance(dt, sensors.SensorsInternal)) self.assertFalse(dt.has_orientation) self.assertEqual(dt.labels.shape, (103, )) self.assertEqual(dt.locations.shape, (103, 3)) self.assertEqual(dt.number_of_sensors, 103) self.assertEqual(dt.orientations.shape, (0, )) self.assertEqual(dt.sensors_type, INTERNAL_POLYMORPHIC_IDENTITY)
def test_sensorsinternal(self): dt = sensors.SensorsInternal(load_file="seeg_39.txt.bz2") dt.configure() assert isinstance(dt, sensors.SensorsInternal) assert not dt.has_orientation assert dt.labels.shape == (103,) assert dt.locations.shape == (103, 3) assert dt.number_of_sensors == 103 assert dt.orientations.shape == (0,) assert dt.sensors_type == INTERNAL_POLYMORPHIC_IDENTITY
class iEEG(Projection): "Forward solution for intracranial EEG (not ECoG!)." _ui_name = "Intracerebral / Stereo EEG" projection = ProjectionSurfaceSEEG( default=None, label='Projection matrix', doc='Projection matrix to apply to sources.') sigma = basic.Float(label="conductivity", default=1.0) sensors = sensors_module.SensorsInternal( label="Internal brain sensors", default=None, required=True, doc= "The set of SEEG sensors for which the forward solution will be calculated." ) @classmethod def from_file(cls, sensors_fname='seeg_588.txt', projection_fname='projection_seeg_588_surface_16k.npy', **kwargs): return Projection.from_file.im_func(cls, sensors_fname, projection_fname, **kwargs) def analytic(self, loc, ori): """Compute the projection matrix -- simple distance weight for now. Equation 12 from sarvas1987basic (point dipole in homogeneous space): V(r) = 1/(4*pi*\sigma)*Q*(r-r_0)/|r-r_0|^3 """ r_0, Q = loc, ori V_r = numpy.zeros((self.sensors.locations.shape[0], r_0.shape[0])) for sensor_k in numpy.arange(self.sensors.locations.shape[0]): a = self.sensors.locations[sensor_k, :] - r_0 na = numpy.sqrt(numpy.sum(a**2, axis=1))[:, numpy.newaxis] V_r[sensor_k, :] = numpy.sum( Q * (a / na**3), axis=1) / (4.0 * numpy.pi * self.sigma) return V_r def create_time_series(self, storage_path, connectivity=None, surface=None, region_map=None, region_volume_map=None): return TimeSeriesSEEG(storage_path=storage_path, sensors=self.sensors, sample_period=self.period, title=' ' + self.__class__.__name__, **self._transform_user_tags())
.. moduleauthor:: Stuart A. Knock <*****@*****.**> """ import numpy from tvb.simulator.lab import * import tvb.datatypes.sensors as sensors ##----------------------------------------------------------------------------## ##- Perform the simulation -## ##----------------------------------------------------------------------------## LOG.info("Configuring...") #Initialise a Model, Coupling, and Connectivity. sens = sensors.SensorsInternal() oscilator = models.Generic2dOscillator() white_matter = connectivity.Connectivity() white_matter.speed = numpy.array([4.0]) white_matter_coupling = coupling.Linear(a=0.014) #Initialise an Integrator heunint = integrators.HeunDeterministic(dt=2**-4) #Initialise some Monitors with period in physical time mon_tavg = monitors.TemporalAverage(period=2**-2) mon_savg = monitors.SpatialAverage(period=2**-2) mon_eeg = monitors.EEG(period=2**-2) mon_seeg = monitors.SEEG(period=2**-2)