Skip to content

Commit 93a4cc1

Browse files
committed
Merge branch 'experimental' of github.com:NeuroML/pyNeuroML into experimental
* 'experimental' of github.com:NeuroML/pyNeuroML: (93 commits) Add plot spike support for nest 3.0 spiketime files Remove py2.7 in master tests Remove travis badge Test without argparse requirement Fix some issues with plot (was using marker='o' by default) chore: remove print statement improvement(3d-plotting): remove edge for spheres test: mark vispy tests to disable them on GitHub CI chore: format with black chore: format with black chore: complete comment feat(vispy): implement rotation for Turntable camera feat(vispy): expose theme setting to all methods perf(vispy-plotting): use single `Marker` object for all spheres improvement(vispy): remove axes from canvas chore(vispy): make turntable camera default chore: document method chore: format with black improvement(plot): tweak default scene range fix(plotting): fix point cell 3d plotting ...
2 parents cbc0a30 + 59298e7 commit 93a4cc1

20 files changed

+2729
-411
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ jobs:
6060
6161
- name: Run tests
6262
run: |
63-
pytest --cov=pyneuroml -m "not localonly" .
6463
pynml -h
6564
6665
./test-ghactions.sh -neuron

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,5 @@ examples/results/*.dat
153153
/tests/test_cell_analysis.cell.nml
154154
arm64
155155
*.neux
156+
/test_*plot*png
157+
/examples/plot.py

pyneuroml/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22

3-
__version__ = "0.7.6"
3+
__version__ = "1.0.0"
44

55
JNEUROML_VERSION = "0.12.1"
66

pyneuroml/analysis/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from pyneuroml import pynml
88
from pyneuroml.lems.LEMSSimulation import LEMSSimulation
99
from pyneuroml.lems import generate_lems_file_for_neuroml
10+
from pyneuroml.utils.plot import get_next_hex_color
1011
import neuroml as nml
1112
from pyelectro.analysis import max_min
1213
from pyelectro.analysis import mean_spike_frequency
@@ -240,7 +241,7 @@ def generate_current_vs_frequency_curve(
240241
for i in range(number_cells):
241242
ref = "v_cell%i" % i
242243
quantity = "%s[%i]/v" % (pop.id, i)
243-
ls.add_line_to_display(disp0, ref, quantity, "1mV", pynml.get_next_hex_color())
244+
ls.add_line_to_display(disp0, ref, quantity, "1mV", get_next_hex_color())
244245
ls.add_column_to_output_file(of0, ref, quantity)
245246

246247
lems_file_name = ls.save_to_file()

pyneuroml/lems/LEMSSimulation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from neuroml import __version__ as libnml_ver
1414
from pyneuroml.pynml import read_neuroml2_file
1515
from pyneuroml.pynml import read_lems_file
16-
from pyneuroml.pynml import get_next_hex_color
16+
from pyneuroml.utils.plot import get_next_hex_color
1717

1818
logger = logging.getLogger(__name__)
1919

pyneuroml/lems/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
import shutil
55
import os
66
import logging
7-
from pyneuroml.pynml import read_neuroml2_file, get_next_hex_color
7+
from pyneuroml.pynml import read_neuroml2_file
8+
from pyneuroml.utils.plot import get_next_hex_color
89
import random
910
import neuroml
1011

pyneuroml/plot/Plot.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ def generate_plot(
4545
save_figure_to: typing.Optional[str] = None,
4646
title_above_plot: bool = False,
4747
verbose: bool = False,
48-
) -> matplotlib.axes.Axes:
48+
close_plot: bool = False,
49+
) -> typing.Optional[matplotlib.axes.Axes]:
4950
"""Utility function to generate plots using the Matplotlib library.
5051
5152
This function can be used to generate graphs with multiple plot lines.
@@ -127,7 +128,9 @@ def generate_plot(
127128
:type title_above_plot: boolean
128129
:param verbose: enable/disable verbose logging (default: False)
129130
:type verbose: boolean
130-
:returns: matplotlib.axes.Axes object
131+
:param close_plot: call pyplot.close() to close plot after plotting
132+
:type close_plot: bool
133+
:returns: matplotlib.axes.Axes object if plot is not closed, else None
131134
"""
132135

133136
logger.info("Generating plot: %s" % (title))
@@ -174,15 +177,14 @@ def generate_plot(
174177
label = "" if not labels else labels[i]
175178
marker = None if not markers else markers[i]
176179
linewidth = 1 if not linewidths else linewidths[i]
177-
markersize = 6 if not markersizes else markersizes[i]
180+
markersize = None if not markersizes else markersizes[i]
178181

179182
if colors:
180183
plt.plot(
181184
xvalues[i],
182185
yvalues[i],
183-
"o",
184-
color=colors[i],
185186
marker=marker,
187+
color=colors[i],
186188
markersize=markersize,
187189
linestyle=linestyle,
188190
linewidth=linewidth,
@@ -192,7 +194,6 @@ def generate_plot(
192194
plt.plot(
193195
xvalues[i],
194196
yvalues[i],
195-
"o",
196197
marker=marker,
197198
markersize=markersize,
198199
linestyle=linestyle,
@@ -239,7 +240,13 @@ def generate_plot(
239240
if show_plot_already:
240241
plt.show()
241242

242-
return ax
243+
if close_plot:
244+
logger.info("Closing plot")
245+
plt.close()
246+
else:
247+
return ax
248+
249+
return None
243250

244251

245252
def generate_interactive_plot(
@@ -376,7 +383,7 @@ def generate_interactive_plot(
376383
raise ValueError("labels not provided correctly")
377384

378385
if not markersizes:
379-
markersizes = len(xvalues) * [6.0]
386+
markersizes = len(xvalues) * [6]
380387
if not markers:
381388
markers = len(xvalues) * [0]
382389
if not linestyles:

0 commit comments

Comments
 (0)