diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bbd3a07..b794f03 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,10 +15,10 @@ jobs: matrix: python-version: [ "3.8", "3.9" ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/notebooks.yml b/.github/workflows/notebooks.yml index 35d864d..41812ac 100644 --- a/.github/workflows/notebooks.yml +++ b/.github/workflows/notebooks.yml @@ -1,22 +1,30 @@ name: Test Notebooks on: + push: + branches: + - '*' pull_request: types: [opened, synchronize, reopened] jobs: build: name: Run notebooks - runs-on: windows-latest + runs-on: ubuntu-latest strategy: fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: 3.8 + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y libgl1 xvfb + - name: Install dependencies run: | python -m pip install --upgrade pip @@ -24,4 +32,4 @@ jobs: python -m pip install nbformat nbconvert - name: Run notebooks - run: python ./dev/notebook_runner.py notebooks + run: xvfb-run -a python ./dev/notebook_runner.py notebooks diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f4d8a94..b4363c4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install dependencies run: | diff --git a/notebooks/TimeSeriesEDF.ipynb b/notebooks/TimeSeriesEDF.ipynb index 75786cb..83fd5d2 100644 --- a/notebooks/TimeSeriesEDF.ipynb +++ b/notebooks/TimeSeriesEDF.ipynb @@ -26,7 +26,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "56d5c4b6-7804-46d6-931f-fcc5593977d1", "metadata": {}, "outputs": [], @@ -36,26 +36,13 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "28420169-2274-4e0e-a73d-c1ab54e6da9c", "metadata": { "scrolled": true, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "17-04-2024 05:02:37 - DEBUG - tvbwidgets - Package is not fully installed\n", - "17-04-2024 05:02:37 - DEBUG - tvbwidgets - Version read from the internal package.json file\n", - "17-04-2024 05:02:37 - INFO - tvbwidgets - Version: 2.0.0\n", - "Using matplotlib as 2D backend.\n", - " INFO Cannot import syncrypto library.\n", - "17-04-2024 05:02:49 - INFO - tvbwidgets.core.pse.parameters - ImportError: Dask dependency is not included, so this functionality won't be available\n" - ] - } - ], + "outputs": [], "source": [ "import numpy as np\n", "from tvbwidgets.api import plot_timeseries\n", @@ -72,45 +59,27 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "94687d23-0222-4e9f-887e-e97169737304", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Extracting EDF parameters from C:\\Work\\TVB\\tvb-widgets\\tvbwidgets\\tests\\data\\test_file.edf...\n", - "EDF file detected\n", - "Setting channel info structure...\n", - "Creating raw.info structure...\n" - ] - } - ], + "outputs": [], "source": [ - "edf_file_path = '../tvbwidgets/tests/data/test_file.edf' # replace path with your actual EDF file path\n", + "edf_file_path = 'tvbwidgets/tests/data/test_file.edf' # replace path with your actual EDF file path\n", + " # set this path file for notebooks tests\n", + "# you can use: '../tvbwidgets/tests/data/test_file.edf'\n", "data, freq, index = read_edf_file(edf_file_path)" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "12da93b3-f96f-44cf-8555-52eee8aaecfd", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(92000, 32)\n", - "400.0\n" - ] - } - ], + "outputs": [], "source": [ "print(data.shape)\n", "print(freq)" @@ -126,7 +95,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "cac83fe3-b4fe-486a-8955-70203dda1004", "metadata": {}, "outputs": [], @@ -136,35 +105,10 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "20c3eae2-49dd-4d01-af9a-06a0dba15888", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "17-04-2024 05:02:49 - INFO - tvbwidgets.ui.ts.plotly_ts_widget - TimeSeries Widget with Plotly initialized\n", - "Creating RawArray with float64 data, n_channels=32, n_times=92000\n", - " Range : 0 ... 91999 = 0.000 ... 229.998 secs\n", - "Ready.\n" - ] - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "28d8ffb85be94f28b59e85b521e4aeeb", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "TimeSeriesWidgetPlotly(children=(HBox(children=(Output(),)), VBox(children=(Dropdown(description='Colormap:', …" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "tsw = plot_timeseries(data=data, sample_freq=freq, ch_idx=index, backend=backend)" ] @@ -194,7 +138,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.18" + "version": "3.9.19" } }, "nbformat": 4, diff --git a/tvbwidgets/ui/connectivity_ipy/connectivity_widget.py b/tvbwidgets/ui/connectivity_ipy/connectivity_widget.py index a447fe0..c171995 100644 --- a/tvbwidgets/ui/connectivity_ipy/connectivity_widget.py +++ b/tvbwidgets/ui/connectivity_ipy/connectivity_widget.py @@ -20,9 +20,9 @@ from tvbwidgets.ui.connectivity_ipy.global_context import CONTEXT, ObservableAttrs DROPDOWN_KEY = 'dropdown' - pyvista.set_jupyter_backend('trame') + class CustomOutput(ipywidgets.Output): CONFIG = ConnectivityConfig() @@ -118,10 +118,9 @@ def __init__(self, width, height, **kwargs): super(Connectivity3DViewer, self).__init__([self.output], *kwargs) self.__init_view_connectivity() - CONTEXT.observe(lambda *args: self.__init_view_connectivity(), ObservableAttrs.CONNECTIVITY) + CONTEXT.observe(lambda *args: self.__refresh_connectivity(), ObservableAttrs.CONNECTIVITY) def __init_view_connectivity(self): - self.output.plotter.clear() points, edges = self.__add_actors() points_toggle, edges_toggle = self.__init_controls() @@ -143,13 +142,16 @@ def on_change_edges(change): edges_toggle.observe(on_change_edges, 'value') - self.children = [ ipywidgets.HBox(children=( points_toggle, edges_toggle)), self.output] self.output.display_actor(points) self.output.display_actor(edges) + + def __refresh_connectivity(self): + self.output.plotter.clear() + self.__init_view_connectivity() self.output.update_plot() def __init_controls(self): diff --git a/tvbwidgets/ui/head_widget.py b/tvbwidgets/ui/head_widget.py index e13860f..59299da 100644 --- a/tvbwidgets/ui/head_widget.py +++ b/tvbwidgets/ui/head_widget.py @@ -16,7 +16,9 @@ from tvbwidgets.ui.base_widget import TVBWidget from tvbwidgets.ui.widget_with_browser import TVBWidgetWithBrowser +from tvbwidgets.core.logger.builder import get_logger +LOGGER = get_logger(__name__) pyvista.set_jupyter_backend('trame') @@ -85,6 +87,7 @@ def hide_actor(self, actor): def update_plot(self): with self: + LOGGER.info('Update plot.') self.clear_output(wait=True) self.plotter.show()