Skip to content

Commit 3674f6b

Browse files
Merge pull request #263 from NeuroML/development
For 1.1.3 release
2 parents e49d725 + 03e3230 commit 3674f6b

File tree

10 files changed

+466
-377
lines changed

10 files changed

+466
-377
lines changed

docs/source/pyneuroml.plot.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,18 @@ pyneuroml.plot.PlotMorphology module
3131
:show-inheritance:
3232
:exclude-members: set, add_line, plot_from_console, main, process_args, LineDataUnits
3333

34+
pyneuroml.plot.PlotMorphologyVispy module
35+
------------------------------------------
36+
37+
.. automodule:: pyneuroml.plot.PlotMorphologyVispy
38+
:members:
39+
:undoc-members:
40+
:show-inheritance:
41+
42+
pyneuroml.plot.PlotMorphologyPlotly module
43+
------------------------------------------
44+
45+
.. automodule:: pyneuroml.plot.PlotMorphologyPlotly
46+
:members:
47+
:undoc-members:
48+
:show-inheritance:

pyneuroml/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
__version__ = importlib_metadata.version("pyNeuroML")
99

1010

11-
JNEUROML_VERSION = "0.12.4"
11+
JNEUROML_VERSION = "0.13.0"
1212

1313
# Define a logger for the package
1414
logging.basicConfig(

pyneuroml/analysis/ChannelDensityPlot.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ def plot_channel_densities(
564564
show_plots_already: bool = True,
565565
morph_plot_type: str = "constant",
566566
morph_min_width: float = 2.0,
567-
target_directory=None
567+
target_directory=None,
568568
):
569569
"""Plot channel densities on a Cell on morphology plots.
570570
@@ -601,11 +601,13 @@ def plot_channel_densities(
601601
:param colormap_name: name of matplotlib colormap to use for morph plot.
602602
Note that if there's only one overlay value, the colormap is modified
603603
to only show the max value of the colormap to indicate this.
604+
605+
See: https://matplotlib.org/stable/users/explain/colors/colormaps.html
604606
:type colormap_name: str
605607
:returns: None
606608
"""
607-
tgt_dir = target_directory+'/' if target_directory else './'
608-
609+
tgt_dir = target_directory + "/" if target_directory else "./"
610+
609611
if channel_density_ids is not None and ion_channels is not None:
610612
raise ValueError(
611613
"Only one of channel_density_ids or ions channels may be provided"
27.5 MB
Binary file not shown.

pyneuroml/plot/PlotMorphology.py

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,31 @@
99

1010

1111
import argparse
12+
import logging
1213
import os
13-
import sys
1414
import random
15-
15+
import sys
1616
import typing
17-
import logging
1817

19-
import numpy
2018
import matplotlib
19+
import numpy
2120
from matplotlib import pyplot as plt
22-
21+
from neuroml import Cell, NeuroMLDocument, Segment, SegmentGroup
22+
from neuroml.neuro_lex_ids import neuro_lex_ids
2323
from pyneuroml.pynml import read_neuroml2_file
24-
from pyneuroml.utils.cli import build_namespace
2524
from pyneuroml.utils import extract_position_info
25+
from pyneuroml.utils.cli import build_namespace
2626
from pyneuroml.utils.plot import (
27-
add_text_to_matplotlib_2D_plot,
28-
get_next_hex_color,
27+
DEFAULTS,
2928
add_box_to_matplotlib_2D_plot,
30-
get_new_matplotlib_morph_plot,
31-
autoscale_matplotlib_plot,
32-
add_scalebar_to_matplotlib_plot,
3329
add_line_to_matplotlib_2D_plot,
34-
DEFAULTS,
30+
add_scalebar_to_matplotlib_plot,
31+
add_text_to_matplotlib_2D_plot,
32+
autoscale_matplotlib_plot,
33+
get_new_matplotlib_morph_plot,
34+
get_next_hex_color,
35+
load_minimal_morphplottable__model,
3536
)
36-
from neuroml import SegmentGroup, Cell, Segment, NeuroMLDocument
37-
from neuroml.neuro_lex_ids import neuro_lex_ids
38-
3937

4038
logger = logging.getLogger(__name__)
4139
logger.setLevel(logging.INFO)
@@ -144,7 +142,7 @@ def plot_from_console(a: typing.Optional[typing.Any] = None, **kwargs: str):
144142
:param kwargs: other arguments
145143
"""
146144
a = build_namespace(DEFAULTS, a, **kwargs)
147-
print(a)
145+
logger.debug(a)
148146
if a.interactive3d:
149147
from pyneuroml.plot.PlotMorphologyVispy import plot_interactive_3D
150148

@@ -251,21 +249,27 @@ def plot_2D(
251249
if verbose:
252250
print("Plotting %s" % nml_file)
253251

254-
# do not recursive read the file, the extract_position_info function will
255-
# do that for us, from a copy of the model
256252
if type(nml_file) is str:
257-
nml_model = read_neuroml2_file(
258-
nml_file,
259-
include_includes=False,
260-
check_validity_pre_include=False,
261-
verbose=False,
262-
optimized=True,
263-
)
253+
# load without optimization for older HDF5 API
254+
# TODO: check if this is required: must for MultiscaleISN
255+
if nml_file.endswith(".h5"):
256+
nml_model = read_neuroml2_file(nml_file)
257+
else:
258+
nml_model = read_neuroml2_file(
259+
nml_file,
260+
include_includes=False,
261+
check_validity_pre_include=False,
262+
verbose=False,
263+
optimized=True,
264+
)
265+
load_minimal_morphplottable__model(nml_model, nml_file)
266+
264267
if title is None:
265268
try:
266269
title = f"{nml_model.networks[0].id} from {nml_file}"
267270
except IndexError:
268271
title = f"{nml_model.cells[0].id} from {nml_file}"
272+
269273
elif isinstance(nml_file, Cell):
270274
nml_model = NeuroMLDocument(id="newdoc")
271275
nml_model.add(nml_file)
@@ -290,9 +294,7 @@ def plot_2D(
290294
positions,
291295
pop_id_vs_color,
292296
pop_id_vs_radii,
293-
) = extract_position_info(
294-
nml_model, verbose, nml_file if type(nml_file) is str else ""
295-
)
297+
) = extract_position_info(nml_model, verbose)
296298

297299
if verbose:
298300
logger.debug(f"positions: {positions}")

0 commit comments

Comments
 (0)