dirconn.simulation.simulation.simulate_on_head#
- dirconn.simulation.simulation.simulate_on_head(network: Network, head: HeadModel, *, sfreq: float, n_times: int, seed: int, n_trials: int = 1, dynamics: Mapping[str, NodeDynamics] | None = None, snr_db: float = 10.0, n_background: int = 10, background_fraction: float = 0.5, node_scale: str = 'unit', source_model: str = 'partial', coherence: float | None = None, noise_series: ndarray | None = None, delay_rounding: str = 'error', burn_in: int = 1000) SimulatedData#
Simulate sensor data of a network through a realistic head model.
Every cortical node must be named after a region of the head model (a DK label such as
"inferiortemporal-lh") and enters the sensors through its region, according tosource_model. The background 1/f sources are drawn without replacement from the sources that are not inside the regions of the network’s nodes, using a generator derived fromseed(any other source of the brain, labelled or not, can be a background source). Direct nodes bypass the head model. The rest, including the exact SNR, issimulate().- Parameters:
network (Network) – Cortical nodes named like the head model’s regions.
head (HeadModel) – See
dirconn.simulation.headmodel.load_head_model().source_model ({"partial", "focal", "patch"}) – How a region’s activity reaches the sensors.
"partial"(the default): every source of the region carriesc * node + sqrt(1 - c**2) * its own 1/f activitywith unit-variance parts, so the sources of a region are partly coherent (correlationc**2between two of them); the sensors see their mean. The coherent part enters asctimes the region’s mean topography and the local part as the sum of the independent activities, which is added to the signal and counted in the SNR."focal": one source, the region’s centre source (HeadModel.roi_centre), carries the node."patch": every source carries exactly the node (coherence 1), so the sensors see the region’s mean topography times the node.coherence (float, optional) –
cof"partial", in(0, 1]; default 0.7. Refused for the other models.noise_series (ndarray, shape (n_trials, n_sensors, n_times), optional) – A recorded noise of the head model’s sensors, used instead of the simulated noise (see
simulate()); needsn_background=0.sfreq – As in
simulate();seedis required.n_times – As in
simulate();seedis required.seed – As in
simulate();seedis required.n_trials – As in
simulate();seedis required.dynamics – As in
simulate();seedis required.snr_db – As in
simulate();seedis required.n_background – As in
simulate();seedis required.background_fraction – As in
simulate();seedis required.node_scale – As in
simulate().node_scaledefaults to"unit"here, unlike insimulate(): through a head model the node powers decide how much each node leaks into the sensors of the others, so they are equalised unless you say otherwise.delay_rounding – As in
simulate().node_scaledefaults to"unit"here, unlike insimulate(): through a head model the node powers decide how much each node leaks into the sensors of the others, so they are equalised unless you say otherwise.burn_in – As in
simulate().node_scaledefaults to"unit"here, unlike insimulate(): through a head model the node powers decide how much each node leaks into the sensors of the others, so they are equalised unless you say otherwise.
- Returns:
The sensors carry the head model’s channel names and type. The provenance records the head model, the visibility of each node’s region and the background sources used.
- Return type: