Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vispy-morph): get title from cell object if no network is found #251

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions pyneuroml/plot/PlotMorphologyVispy.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ def create_new_vispy_canvas(
console_widget.write(f"Center: {view.camera.center}")
console_widget.write(console_text)
console_widget.write(
f"Current camera: {view.camera.name}: " + cam_text[view.camera].replace("\n", " ").strip()
f"Current camera: {view.camera.name}: "
+ cam_text[view.camera].replace("\n", " ").strip()
)

if axes_pos:
Expand Down Expand Up @@ -280,7 +281,8 @@ def vispy_on_key_press(event):
# console_widget.write(f"Center: {view.camera.center}")
console_widget.write(console_text)
console_widget.write(
f"Current camera: {view.camera.name}: " + cam_text[view.camera].replace("\n", " ").strip()
f"Current camera: {view.camera.name}: "
+ cam_text[view.camera].replace("\n", " ").strip()
)

return scene, view
Expand Down Expand Up @@ -348,7 +350,9 @@ def plot_interactive_3D(
elif isinstance(nml_file, NeuroMLDocument):
nml_model = nml_file
else:
raise TypeError("Passed model is not a NeuroML file path, nor a neuroml.Cell, nor a neuroml.NeuroMLDocument")
raise TypeError(
"Passed model is not a NeuroML file path, nor a neuroml.Cell, nor a neuroml.NeuroMLDocument"
)

(
cell_id_vs_cell,
Expand All @@ -368,7 +372,10 @@ def plot_interactive_3D(
marker_colors = []

if title is None:
title = f"{nml_model.networks[0].id} from {nml_file}"
try:
title = f"{nml_model.networks[0].id} from {nml_file}"
except IndexError:
title = f"{nml_model.cells[0].id} from {nml_file}"

logger.debug(f"positions: {positions}")
logger.debug(f"pop_id_vs_cell: {pop_id_vs_cell}")
Expand Down