Skip to content

Commit

Permalink
TVB-3088 Merge notebooks display_surface_local_connectivity.ipynb int…
Browse files Browse the repository at this point in the history
…o exploring_a_surface_mesh.ipynb (as the LC was not displayed)
  • Loading branch information
liadomide committed Aug 22, 2023
1 parent 8a7cc6a commit 703b503
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 154 deletions.
9 changes: 0 additions & 9 deletions tvb_documentation/demos/Demos.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ examples.
.. _Analyze Region Corrcoef: https://nbviewer.thevirtualbrain.org/url/docs.thevirtualbrain.org/demos/analyze_region_corrcoef.ipynb
.. _Compare Connectivity Normalization: https://nbviewer.thevirtualbrain.org/url/docs.thevirtualbrain.org/demos/compare_connectivity_normalization.ipynb
.. _Display Source Sensor Geometry: https://nbviewer.thevirtualbrain.org/url/docs.thevirtualbrain.org/demos/display_source_sensor_geometry.ipynb
.. _Display Surface Local Connectivity: https://nbviewer.thevirtualbrain.org/url/docs.thevirtualbrain.org/demos/display_surface_local_connectivity.ipynb
.. _Encrypt Files before upload in TVB Web GUI: https://nbviewer.thevirtualbrain.org/url/docs.thevirtualbrain.org/demos/encrypt_data.ipynb
.. _Exploring Epileptor 2D: https://nbviewer.thevirtualbrain.org/url/docs.thevirtualbrain.org/demos/exploring_epileptor_2d.ipynb
.. _Exploring Longer Time Series: https://nbviewer.thevirtualbrain.org/url/docs.thevirtualbrain.org/demos/exploring_longer_time_series.ipynb
Expand Down Expand Up @@ -167,14 +166,6 @@ examples.
`Display Source Sensor Geometry`_


.. figure:: figures/display_surface_local_connectivity.png
:width: 200px
:figclass: demo-figure
:target: `Display Surface Local Connectivity`_

`Display Surface Local Connectivity`_


.. figure:: figures/exploring_longer_time_series.png
:width: 200px
:figclass: demo-figure
Expand Down
124 changes: 0 additions & 124 deletions tvb_documentation/demos/display_surface_local_connectivity.ipynb

This file was deleted.

34 changes: 32 additions & 2 deletions tvb_documentation/demos/exploring_a_surface_mesh.ipynb

Large diffs are not rendered by default.

Binary file not shown.
Binary file modified tvb_documentation/demos/figures/exploring_a_surface_mesh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 8 additions & 19 deletions tvb_library/tvb/simulator/plot/head_plotter_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@
# To visualise the sensors and surface
hp.display_source_sensor_geometry(surface, connectivity, meg_sensors, eeg_sensors)
# To visualise the sensors and surface
hp.display_surface_local_connectivity(cortex, local_connectivity)
# To visualise a Surface in 3D
hp.display_surface(surface)
"""

import numpy as np
import matplotlib.pyplot as plt
from tvb.simulator.lab import *
from deprecated import deprecated
Expand All @@ -53,7 +52,8 @@
@deprecated(reason="Use tvb-widgets instead")
class HeadPlotter3D(object):

def display_source_sensor_geometry(self, surface=None, conn=None, meg_sensors=None, eeg_sensors=None):
@staticmethod
def display_source_sensor_geometry(surface=None, conn=None, meg_sensors=None, eeg_sensors=None):
# type: (surfaces.SkinAir, connectivity.Connectivity, sensors.SensorsMEG, sensors.SensorsEEG ) -> None
"""
:param surface: Optional surfaces.SkinAir instance. When none, we will try loading a default
Expand Down Expand Up @@ -120,25 +120,14 @@ def plot(**plot_params):
out = widgets.interactive_output(plot, params)
display(control_box, out)

def display_surface_local_connectivity(self, ctx=None, loc_conn=None):
# type: (cortex.Cortex, local_connectivity.LocalConnectivity) -> None
@staticmethod
def display_surface(ctx):
# type: (surfaces.CorticalSurface) -> None
"""
:param cortex: Optional cortex.Cortex instance. When none, we will try loading a default
:param loc_conn: Optional. If None, and cortex local connectivity is None, we will try loading a default.
:param ctx: surface.CorticalSurfaceF
"""
# Start by configuring the cortical surface
if ctx is None:
ctx = cortex.Cortex.from_file()
if ctx.local_connectivity is None:
if loc_conn is None:
loc_conn = local_connectivity.LocalConnectivity(cutoff=20.0, surface=ctx.region_mapping_data.surface)
loc_conn.equation.parameters['sigma'] = 10.0
loc_conn.equation.parameters['amp'] = 1.0
ctx.local_connectivity = loc_conn
ctx.coupling_strength = np.array([0.0115])
ctx.configure()

# plot
plt.figure()
ax = plt.subplot(111, projection='3d')
x, y, z = ctx.vertices.T
Expand Down

0 comments on commit 703b503

Please sign in to comment.