Skip to content

Commit

Permalink
TVB-3079 Change the used connectivity in the example simulate_surface…
Browse files Browse the repository at this point in the history
…_seeg_eeg_meg.ipynb, to not have subcortical regions, until bug TVB-3018 gets fixed
  • Loading branch information
liadomide committed Sep 9, 2023
1 parent 57e5ea9 commit 4660042
Showing 1 changed file with 51 additions and 15 deletions.
66 changes: 51 additions & 15 deletions tvb_documentation/demos/simulate_surface_seeg_eeg_meg.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,48 +33,84 @@
"\n",
"oscillator = models.Generic2dOscillator(a=numpy.array([0.1]), tau=numpy.array([2.0]))\n",
"\n",
"white_matter = connectivity.Connectivity.from_file('connectivity_192.zip')\n",
"white_matter = connectivity.Connectivity.from_file(\"connectivity_76.zip\") # TVB-3018: \"connectivity_192.zip\"\n",
"white_matter.speed = numpy.array([4.0])\n",
"white_matter_coupling = coupling.Difference(a=numpy.array([0.014]))\n",
"\n",
"rm_f_name = 'regionMapping_16k_192.txt'\n",
"rm_f_name = 'regionMapping_16k_76.txt' # TVB-3018: 'regionMapping_16k_192.txt'\n",
"rm = RegionMapping.from_file(rm_f_name)\n",
"sensorsEEG = SensorsEEG.from_file('eeg_unitvector_62.txt.bz2')\n",
"prEEG = ProjectionSurfaceEEG.from_file('projection_eeg_62_surface_16k.mat', matlab_data_name=\"ProjectionMatrix\")\n",
"\n",
"heunint = integrators.HeunStochastic(\n",
" dt=2**-4,\n",
" noise=noise.Additive(nsig=numpy.array([2 ** -5, ]))\n",
")\n",
"\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Monitors\n",
"See shown here 3 different ways of configuring monitors.\n",
"These methods are available for all projection monitors"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fsamp = 1e3/1024.0 # 1024 Hz\n",
"# See shown here 3 different ways of configuring monitors.\n",
"# These methods are available for all projection monitors\n",
"\n",
"monitor_MEG=monitors.MEG.from_file(rm_f_name=rm_f_name)\n",
"monitor_MEG.period=fsamp\n",
"mons = (\n",
" monitors.EEG(sensors=sensorsEEG, projection=prEEG, region_mapping=rm, period=fsamp),\n",
" monitor_MEG,\n",
" monitors.iEEG.from_file('seeg_588.txt', 'projection_seeg_588_surface_16k.npy', rm_f_name=rm_f_name, period=fsamp),\n",
" monitors.ProgressLogger(period=100.0),\n",
" monitors.ProgressLogger(period=10.0),\n",
")\n",
"\n",
"local_coupling_strength = numpy.array([2 ** -10])\n",
"default_cortex = Cortex.from_file(region_mapping_file='regionMapping_16k_192.txt')\n",
"default_cortex = Cortex.from_file(region_mapping_file=rm_f_name)\n",
"default_cortex.region_mapping_data.connectivity = white_matter\n",
"default_cortex.coupling_strength = local_coupling_strength\n",
"\n",
"default_cortex.coupling_strength = local_coupling_strength"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Bellow, adjust the simulation length to match your machine and needs"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"sim = simulator.Simulator(\n",
" model=oscillator,\n",
" connectivity=white_matter,\n",
" coupling=white_matter_coupling,\n",
" integrator=heunint,\n",
" monitors=mons,\n",
" surface=default_cortex,\n",
" simulation_length=10.0\n",
" simulation_length=200.0\n",
")\n",
"sim.configure()\n",
"\n",
"sim.configure()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"eeg, meg, seeg, _ = sim.run()"
]
},
Expand Down Expand Up @@ -105,7 +141,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -119,7 +155,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 4660042

Please sign in to comment.