diff --git a/pyneuroml/plot/PlotMorphologyVispy.py b/pyneuroml/plot/PlotMorphologyVispy.py index 489e1f8a..a9c0e544 100644 --- a/pyneuroml/plot/PlotMorphologyVispy.py +++ b/pyneuroml/plot/PlotMorphologyVispy.py @@ -318,7 +318,6 @@ def plot_interactive_3D( highlight_spec: typing.Optional[typing.Dict[typing.Any, typing.Any]] = None, precision: typing.Tuple[int, int] = (4, 200), upright: bool = False, - jupyter: bool = False, ): """Plot interactive plots in 3D using Vispy @@ -435,8 +434,6 @@ def plot_interactive_3D( "upwards" instead of "downwards" in most cases. Note that the original cell object is unchanged, this is for visualization purposes only. :type upright: bool - :param jupyter: Set to True to run visualizations in jupyter notebooks. Default is False - :type jupyter: bool :throws ValueError: if `plot_type` is not one of "detailed", "constant", "schematic", or "point" @@ -454,13 +451,9 @@ def plot_interactive_3D( if verbose: logger.info(f"Visualising {nml_file}") - if not jupyter: - from IPython import get_ipython - - ipython = get_ipython() - # Check if the IPython instance is using the kernel environment - if ipython and "IPKernelApp" in ipython.config: - logging.warning("Kernel detected. Try setting jupyter=True") + jupyter = False + if app.Application.is_interactive(app): + jupyter = True # if it's a file, load it first if isinstance(nml_file, str): @@ -706,7 +699,6 @@ def plot_interactive_3D( meshdata=meshdata, mesh_precision=precision[0], upright=upright, - jupyter=jupyter, ) elif ( plot_type == "detailed" @@ -736,7 +728,6 @@ def plot_interactive_3D( mesh_precision=precision[0], highlight_spec=cell_highlight_spec, upright=upright, - jupyter=jupyter, ) # if too many meshes, reduce precision and retry, recursively @@ -759,7 +750,6 @@ def plot_interactive_3D( precision=precision, highlight_spec=highlight_spec, upright=upright, - jupyter=jupyter, ) # break the recursion, don't plot in the calling method return @@ -857,7 +847,6 @@ def plot_3D_cell_morphology( mesh_precision: int = 2, highlight_spec: typing.Optional[typing.Dict[typing.Any, typing.Any]] = None, upright: bool = False, - jupyter: bool = False, ): """Plot the detailed 3D morphology of a cell using vispy. https://vispy.org/ @@ -958,8 +947,6 @@ def plot_3D_cell_morphology( "upwards" instead of "downwards" in most cases. Note that the original cell object is unchanged, this is for visualization purposes only. :type upright: bool - :param jupyter: Set to True to run visualizations in jupyter notebooks. Default is False - :type jupyter: bool :raises: ValueError if `cell` is None """ @@ -972,13 +959,9 @@ def plot_3D_cell_morphology( highlight_spec = {} logging.debug("highlight_spec is " + str(highlight_spec)) - if not jupyter: - from IPython import get_ipython - - ipython = get_ipython() - # Check if the IPython instance is using the kernel environment - if ipython and "IPKernelApp" in ipython.config: - logging.warning("Kernel detected. Try setting jupyter=True") + jupyter = False + if app.Application.is_interactive(app): + jupyter = True view_center = None if upright: @@ -1257,7 +1240,6 @@ def plot_3D_schematic( meshdata: typing.Optional[typing.Dict[typing.Any, typing.Any]] = None, mesh_precision: int = 2, upright: bool = False, - jupyter: bool = False, ) -> None: """Plot a 3D schematic of the provided segment groups using vispy. layer.. @@ -1330,19 +1312,13 @@ def plot_3D_schematic( "upwards" instead of "downwards" in most cases. Note that the original cell object is unchanged, this is for visualization purposes only. :type upright: bool - :param jupyter: Set to True to run visualizations in jupyter notebooks. Default is False - :type jupyter: bool """ if title == "": title = f"3D schematic of segment groups from {cell.id}" - if not jupyter: - from IPython import get_ipython - - ipython = get_ipython() - # Check if the IPython instance is using the kernel environment - if ipython and "IPKernelApp" in ipython.config: - logging.warning("Kernel detected. Try setting jupyter=True") + jupyter = False + if app.Application.is_interactive(app): + jupyter = True view_center = None if upright: