diff --git a/pyneuroml/plot/PlotMorphology.py b/pyneuroml/plot/PlotMorphology.py index e42a9b4c..543c7e37 100644 --- a/pyneuroml/plot/PlotMorphology.py +++ b/pyneuroml/plot/PlotMorphology.py @@ -483,7 +483,7 @@ def plot_2D( radius = pop_id_vs_radii[pop_id] if pop_id in pop_id_vs_radii else 10 color = pop_id_vs_color[pop_id] if pop_id in pop_id_vs_color else None - if cell is None: + if cell is None or not isinstance(cell, Cell): plot_2D_point_cells( offset=pos, plane2d=plane2d, diff --git a/pyneuroml/plot/PlotMorphologyVispy.py b/pyneuroml/plot/PlotMorphologyVispy.py index 7848e112..9c338230 100644 --- a/pyneuroml/plot/PlotMorphologyVispy.py +++ b/pyneuroml/plot/PlotMorphologyVispy.py @@ -607,6 +607,9 @@ def plot_interactive_3D( # other networks else: plottable_nml_model = nml_model + + logger.debug(plottable_nml_model.info(show_contents=True)) + # what did we get? else: raise ValueError(f"Could not process argument: {nml_model}") @@ -671,7 +674,7 @@ def plot_interactive_3D( else: cell = list(pop_id_vs_cell.values())[0] - if cell is not None: + if cell is not None and isinstance(cell, Cell): view_min, view_max = get_cell_bound_box(cell) else: logger.debug("Got a point cell") @@ -790,7 +793,8 @@ def plot_interactive_3D( except AttributeError: logging.debug(f"Plotting a point cell at {pos}") - if cell is None: + # a point cell component type + if cell is None or not isinstance(cell, Cell): meshdata.append( ( f"{radius:.1f}", diff --git a/pyneuroml/utils/__init__.py b/pyneuroml/utils/__init__.py index 5a7dd075..6580132f 100644 --- a/pyneuroml/utils/__init__.py +++ b/pyneuroml/utils/__init__.py @@ -97,8 +97,15 @@ def extract_position_info( cell_elements = [] popElements = [] - cell_elements.extend(nml_model.cells) - cell_elements.extend(nml_model.cell2_ca_poolses) + members = nml_model.info(show_contents=True, return_format="dict") + + for member, mdict in members.items(): + if "cell" in mdict["type"].lower(): + try: + cell_elements.extend(mdict["members"]) + except TypeError: + pass + # cell_elements.extend(nml_model.cell2_ca_poolses) # if there are no cells, look at morphologies if len(cell_elements) == 0: @@ -715,7 +722,6 @@ def get_model_file_list( lems_def_dir = get_model_file_list(inc, filelist, rootdir, lems_def_dir) elif rootfile.endswith(".sedml"): - try: import libsedml except ModuleNotFoundError: diff --git a/pyneuroml/utils/plot.py b/pyneuroml/utils/plot.py index 5ba53f90..499993a2 100644 --- a/pyneuroml/utils/plot.py +++ b/pyneuroml/utils/plot.py @@ -351,7 +351,6 @@ def load_minimal_morphplottable__model( model_members = list(vars(nml_model).keys()) required_members = [ "id", - "cells", "morphology", "cell2_ca_poolses", "networks", @@ -359,7 +358,7 @@ def load_minimal_morphplottable__model( "includes", ] for m in model_members: - if m not in required_members: + if m not in required_members and "cells" not in m: setattr(nml_model, m, None) logger.debug(f"Dropped {m}")