Skip to content

Commit 4df6c54

Browse files
Merge pull request #327 from YBCS/dev-buda-development-nogui
figures generated by `pynml-modchananalysis` are saved by default
2 parents a7239a7 + 2a5d357 commit 4df6c54

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

man/man1/pynml-modchananalysis.1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
.SH NAME
44
pynml-modchananalysis \- manual page for pynml-modchananalysis v1.2.8
55
.SH DESCRIPTION
6-
usage: pynml\-modchananalysis [\-h] [\-v] [\-nogui] [\-minV <min v>]
6+
usage: pynml\-modchananalysis [\-h] [\-v] [\-nogui] [\-savePlots] [\-minV <min v>]
77
.TP
88
[\-maxV <max v>] [\-stepV <step v>]
99
[\-dt <time step>] [\-duration <duration>]
@@ -30,6 +30,9 @@ Verbose output
3030
\fB\-nogui\fR
3131
Supress plotting of variables and only save to file
3232
.TP
33+
\fB\-savePlots\fR
34+
Export image (.png) of plotted figures to device
35+
.TP
3336
\fB\-minV\fR <min v>
3437
Minimum voltage to test (integer, mV)
3538
.TP

pyneuroml/neuron/analysis/HHanalyse.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ def process_args():
4444
help="Supress plotting of variables and only save to file",
4545
)
4646

47+
parser.add_argument(
48+
"-savePlots",
49+
action="store_true",
50+
default=False,
51+
help="Export image (.png) of plotted figures to device",
52+
)
53+
4754
parser.add_argument(
4855
"-minV",
4956
type=int,
@@ -535,6 +542,16 @@ def main():
535542
file.close()
536543
print("Written info to file: %s" % file_name)
537544

545+
if args.savePlots:
546+
figs = pylab.get_fignums()
547+
548+
for fig in figs:
549+
pylab.figure(fig)
550+
window_title = pylab.get_current_fig_manager().get_window_title()
551+
file_name = f"{window_title}.png"
552+
plt.savefig(file_name)
553+
print("Exported img to file: %s" % file_name)
554+
538555
if not args.nogui:
539556
pylab.show()
540557

0 commit comments

Comments
 (0)