diff --git a/notebooks/DicomWidget.ipynb b/notebooks/DicomWidget.ipynb index 0fd965d..6280310 100644 --- a/notebooks/DicomWidget.ipynb +++ b/notebooks/DicomWidget.ipynb @@ -94,7 +94,8 @@ "outputs": [], "source": [ "# create demo array just to demonstrate the usage of the API\n", - "data = np.random.rand(255,255,255)" + "rng = np.random.default_rng()\n", + "data = rng.random((255,255,255))" ] }, { diff --git a/notebooks/TimeSeriesArray.ipynb b/notebooks/TimeSeriesArray.ipynb index 57844ff..089c987 100644 --- a/notebooks/TimeSeriesArray.ipynb +++ b/notebooks/TimeSeriesArray.ipynb @@ -26,7 +26,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "56d5c4b6-7804-46d6-931f-fcc5593977d1", "metadata": {}, "outputs": [], @@ -38,21 +38,13 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "28420169-2274-4e0e-a73d-c1ab54e6da9c", "metadata": { "scrolled": true, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "12-05-2023 03:15:02 - 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" @@ -73,7 +65,8 @@ "metadata": {}, "outputs": [], "source": [ - "raw = np.random.rand(30000, 50)" + "rng = np.random.default_rng()\n", + "raw = rng.random((30000, 50))" ] }, { @@ -103,6 +96,14 @@ "source": [ "tsw = plot_timeseries(data=raw, sample_freq=0.1, ch_idx=1, backend=backend)" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a26933b8-b43f-4442-8af1-b79565293e9b", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { @@ -121,7 +122,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.16" + "version": "3.9.18" } }, "nbformat": 4, diff --git a/tvbwidgets/ui/connectivity_matrix_editor_widget.py b/tvbwidgets/ui/connectivity_matrix_editor_widget.py index e60b91c..51dbdc3 100644 --- a/tvbwidgets/ui/connectivity_matrix_editor_widget.py +++ b/tvbwidgets/ui/connectivity_matrix_editor_widget.py @@ -16,8 +16,12 @@ import matplotlib.colors as mcolors from IPython.display import display from tvb.datatypes.connectivity import Connectivity + +from tvbwidgets import get_logger from tvbwidgets.ui.base_widget import TVBWidget +LOGGER = get_logger(__name__) + class ConnectivityMatrixEditor(TVBWidget): def __init__(self, connectivity, size=None, **kwargs): @@ -49,7 +53,7 @@ def _make_header(self): self.change_button = widgets.Button(description="Change", layout=widgets.Layout(width="80px", visibility="hidden")) - self.change_button.on_click(lambda change: self.on_apply_change(change)) + self.change_button.on_click(self.on_apply_change) self.save_button = widgets.Button(description="Save", layout=widgets.Layout(width="100px", margin='0 0 0 auto')) @@ -239,7 +243,8 @@ def on_apply_change(self, change): matrix_ui = getattr(self, matrix_name) try: value = float(self.cell_value.value) - except: + except (ValueError, TypeError): + LOGGER.error(f'An exception occurred when retrieving the cell value.') value = None if value is not None: diff --git a/tvbwidgets/ui/spacetime_widget.py b/tvbwidgets/ui/spacetime_widget.py index b076702..5616b34 100644 --- a/tvbwidgets/ui/spacetime_widget.py +++ b/tvbwidgets/ui/spacetime_widget.py @@ -94,7 +94,7 @@ def _prepare_slices(self): def _create_graph_slice(self, i): - z_coordinate = -i*3 + 14 if i is 0 else -i*2 + 11 - 0.1*i*i + z_coordinate = -i*3 + 14 if i == 0 else -i*2 + 11 - 0.1*i*i return p3.Mesh( p3.BoxBufferGeometry(width=7, height=7, depth=0.1), p3.MeshPhysicalMaterial(),