Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions man/man1/pynml-archive.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH PYNML-ARCHIVE "1" "March 2024" "pynml-archive v1.2.8" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH PYNML-ARCHIVE "1" "April 2024" "pynml-archive v1.2.8" "User Commands"
.SH NAME
pynml-archive \- manual page for pynml-archive v1.2.8
.SH DESCRIPTION
Expand Down Expand Up @@ -45,4 +45,4 @@ Explicit list of files to create archive of.
Please see https://docs.neuroml.org for complete documentation on the NeuroML standard and the software ecosystem.
.SH ENVIRONMENT
.PP
pyNeuroML v1.2.8 (libNeuroML v0.5.9, jNeuroML v0.13.0)
pyNeuroML v1.2.8 (libNeuroML v0.5.8, jNeuroML v0.13.0)
6 changes: 3 additions & 3 deletions man/man1/pynml-channelanalysis.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH PYNML-CHANNELANALYSIS "1" "March 2024" "pynml-channelanalysis v1.2.8" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH PYNML-CHANNELANALYSIS "1" "April 2024" "pynml-channelanalysis v1.2.8" "User Commands"
.SH NAME
pynml-channelanalysis \- manual page for pynml-channelanalysis v1.2.8
.SH DESCRIPTION
Expand Down Expand Up @@ -110,4 +110,4 @@ plot current vs voltage for ion channel
Please see https://docs.neuroml.org for complete documentation on the NeuroML standard and the software ecosystem.
.SH ENVIRONMENT
.PP
pyNeuroML v1.2.8 (libNeuroML v0.5.9, jNeuroML v0.13.0)
pyNeuroML v1.2.8 (libNeuroML v0.5.8, jNeuroML v0.13.0)
6 changes: 3 additions & 3 deletions man/man1/pynml-channelml2nml.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH PYNML-CHANNELML2NML "1" "March 2024" "pynml-channelml2nml v1.2.8" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH PYNML-CHANNELML2NML "1" "April 2024" "pynml-channelml2nml v1.2.8" "User Commands"
.SH NAME
pynml-channelml2nml \- manual page for pynml-channelml2nml v1.2.8
.SH DESCRIPTION
Expand Down Expand Up @@ -41,4 +41,4 @@ Name of the outputfile file
Please see https://docs.neuroml.org for complete documentation on the NeuroML standard and the software ecosystem.
.SH ENVIRONMENT
.PP
pyNeuroML v1.2.8 (libNeuroML v0.5.9, jNeuroML v0.13.0)
pyNeuroML v1.2.8 (libNeuroML v0.5.8, jNeuroML v0.13.0)
6 changes: 3 additions & 3 deletions man/man1/pynml-modchananalysis.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH PYNML-MODCHANANALYSIS "1" "March 2024" "pynml-modchananalysis v1.2.8" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH PYNML-MODCHANANALYSIS "1" "April 2024" "pynml-modchananalysis v1.2.8" "User Commands"
.SH NAME
pynml-modchananalysis \- manual page for pynml-modchananalysis v1.2.8
.SH DESCRIPTION
Expand Down Expand Up @@ -72,4 +72,4 @@ Name of the mod file containing the channel
Please see https://docs.neuroml.org for complete documentation on the NeuroML standard and the software ecosystem.
.SH ENVIRONMENT
.PP
pyNeuroML v1.2.8 (libNeuroML v0.5.9, jNeuroML v0.13.0)
pyNeuroML v1.2.8 (libNeuroML v0.5.8, jNeuroML v0.13.0)
6 changes: 3 additions & 3 deletions man/man1/pynml-plotchan.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH PYNML-PLOTCHAN "1" "March 2024" "pynml-plotchan v1.2.8" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH PYNML-PLOTCHAN "1" "April 2024" "pynml-plotchan v1.2.8" "User Commands"
.SH NAME
pynml-plotchan \- manual page for pynml-plotchan v1.2.8
.SH DESCRIPTION
Expand Down Expand Up @@ -41,4 +41,4 @@ Do not show plots as they are generated
Please see https://docs.neuroml.org for complete documentation on the NeuroML standard and the software ecosystem.
.SH ENVIRONMENT
.PP
pyNeuroML v1.2.8 (libNeuroML v0.5.9, jNeuroML v0.13.0)
pyNeuroML v1.2.8 (libNeuroML v0.5.8, jNeuroML v0.13.0)
6 changes: 3 additions & 3 deletions man/man1/pynml-plotmorph.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH PYNML-PLOTMORPH "1" "March 2024" "pynml-plotmorph v1.2.8" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH PYNML-PLOTMORPH "1" "April 2024" "pynml-plotmorph v1.2.8" "User Commands"
.SH NAME
pynml-plotmorph \- manual page for pynml-plotmorph v1.2.8
.SH DESCRIPTION
Expand Down Expand Up @@ -71,4 +71,4 @@ Scale axes so that image is approximately square, for
Please see https://docs.neuroml.org for complete documentation on the NeuroML standard and the software ecosystem.
.SH ENVIRONMENT
.PP
pyNeuroML v1.2.8 (libNeuroML v0.5.9, jNeuroML v0.13.0)
pyNeuroML v1.2.8 (libNeuroML v0.5.8, jNeuroML v0.13.0)
6 changes: 3 additions & 3 deletions man/man1/pynml-plotspikes.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH PYNML-PLOTSPIKES "1" "March 2024" "pynml-plotspikes v1.2.8" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH PYNML-PLOTSPIKES "1" "April 2024" "pynml-plotspikes v1.2.8" "User Commands"
.SH NAME
pynml-plotspikes \- manual page for pynml-plotspikes v1.2.8
.SH DESCRIPTION
Expand Down Expand Up @@ -60,4 +60,4 @@ Number of bins for rate histogram
Please see https://docs.neuroml.org for complete documentation on the NeuroML standard and the software ecosystem.
.SH ENVIRONMENT
.PP
pyNeuroML v1.2.8 (libNeuroML v0.5.9, jNeuroML v0.13.0)
pyNeuroML v1.2.8 (libNeuroML v0.5.8, jNeuroML v0.13.0)
6 changes: 3 additions & 3 deletions man/man1/pynml-plottimeseries.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH PYNML-PLOTTIMESERIES "1" "March 2024" "pynml-plottimeseries v1.2.8" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH PYNML-PLOTTIMESERIES "1" "April 2024" "pynml-plottimeseries v1.2.8" "User Commands"
.SH NAME
pynml-plottimeseries \- manual page for pynml-plottimeseries v1.2.8
.SH DESCRIPTION
Expand Down Expand Up @@ -41,4 +41,4 @@ Name of the image file to save plot to
Please see https://docs.neuroml.org for complete documentation on the NeuroML standard and the software ecosystem.
.SH ENVIRONMENT
.PP
pyNeuroML v1.2.8 (libNeuroML v0.5.9, jNeuroML v0.13.0)
pyNeuroML v1.2.8 (libNeuroML v0.5.8, jNeuroML v0.13.0)
6 changes: 3 additions & 3 deletions man/man1/pynml-povray.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH PYNML-POVRAY "1" "March 2024" "pynml-povray v1.2.8" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH PYNML-POVRAY "1" "April 2024" "pynml-povray v1.2.8" "User Commands"
.SH NAME
pynml-povray \- manual page for pynml-povray v1.2.8
.SH DESCRIPTION
Expand Down Expand Up @@ -112,4 +112,4 @@ Show segment ids
Please see https://docs.neuroml.org for complete documentation on the NeuroML standard and the software ecosystem.
.SH ENVIRONMENT
.PP
pyNeuroML v1.2.8 (libNeuroML v0.5.9, jNeuroML v0.13.0)
pyNeuroML v1.2.8 (libNeuroML v0.5.8, jNeuroML v0.13.0)
6 changes: 3 additions & 3 deletions man/man1/pynml-sonata.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH PYNML-SONATA "1" "March 2024" "pynml-sonata v1.2.8" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH PYNML-SONATA "1" "April 2024" "pynml-sonata v1.2.8" "User Commands"
.SH NAME
pynml-sonata \- manual page for pynml-sonata v1.2.8
.SH DESCRIPTION
Expand Down Expand Up @@ -50,4 +50,4 @@ jNeuroML_NEURON
Please see https://docs.neuroml.org for complete documentation on the NeuroML standard and the software ecosystem.
.SH ENVIRONMENT
.PP
pyNeuroML v1.2.8 (libNeuroML v0.5.9, jNeuroML v0.13.0)
pyNeuroML v1.2.8 (libNeuroML v0.5.8, jNeuroML v0.13.0)
6 changes: 3 additions & 3 deletions man/man1/pynml-summary.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH PYNML-SUMMARY "1" "March 2024" "pynml-summary v1.2.8" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH PYNML-SUMMARY "1" "April 2024" "pynml-summary v1.2.8" "User Commands"
.SH NAME
pynml-summary \- manual page for pynml-summary v1.2.8
.SH DESCRIPTION
Expand Down Expand Up @@ -35,4 +35,4 @@ print this help text and exit
Please see https://docs.neuroml.org for complete documentation on the NeuroML standard and the software ecosystem.
.SH ENVIRONMENT
.PP
pyNeuroML v1.2.8 (libNeuroML v0.5.9, jNeuroML v0.13.0)
pyNeuroML v1.2.8 (libNeuroML v0.5.8, jNeuroML v0.13.0)
6 changes: 3 additions & 3 deletions man/man1/pynml-tune.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH PYNML-TUNE "1" "March 2024" "pynml-tune v1.2.8" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH PYNML-TUNE "1" "April 2024" "pynml-tune v1.2.8" "User Commands"
.SH NAME
pynml-tune \- manual page for pynml-tune v1.2.8
.SH DESCRIPTION
Expand Down Expand Up @@ -148,4 +148,4 @@ as optimisation progresses?
Please see https://docs.neuroml.org for complete documentation on the NeuroML standard and the software ecosystem.
.SH ENVIRONMENT
.PP
pyNeuroML v1.2.8 (libNeuroML v0.5.9, jNeuroML v0.13.0)
pyNeuroML v1.2.8 (libNeuroML v0.5.8, jNeuroML v0.13.0)
9 changes: 6 additions & 3 deletions man/man1/pynml.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH PYNML "1" "March 2024" "pynml v1.2.8" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH PYNML "1" "April 2024" "pynml v1.2.8" "User Commands"
.SH NAME
pynml \- manual page for pynml v1.2.8
.SH DESCRIPTION
Expand Down Expand Up @@ -203,6 +203,9 @@ Validate SBML file(s), unit consistency failure generates an error
.TP
\fB\-validate\-sedml\fR
Validate SEDML file(s)
.TP
\fB\-swc\fR
Load NeuroML file(s), and convert it to swc format
.SH "SEE-ALSO"
.BR pynml (1),
.BR pynml-archive (1),
Expand All @@ -221,4 +224,4 @@ Validate SEDML file(s)
Please see https://docs.neuroml.org for complete documentation on the NeuroML standard and the software ecosystem.
.SH ENVIRONMENT
.PP
pyNeuroML v1.2.8 (libNeuroML v0.5.9, jNeuroML v0.13.0)
pyNeuroML v1.2.8 (libNeuroML v0.5.8, jNeuroML v0.13.0)
2 changes: 1 addition & 1 deletion man/man1/version.h2m
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[environment]
.PP
pyNeuroML v1.2.8 (libNeuroML v0.5.9, jNeuroML v0.13.0)
pyNeuroML v1.2.8 (libNeuroML v0.5.8, jNeuroML v0.13.0)
15 changes: 15 additions & 0 deletions pyneuroml/pynml.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import lems.model.model as lems_model
from pyneuroml import DEFAULTS, JNEUROML_VERSION, __version__
from pyneuroml.errors import ARGUMENT_ERR, UNKNOWN_ERR
from pyneuroml.swc.ExportSWC import convert_to_swc
from pyneuroml.utils import extract_lems_definition_files

# these imports are included for backwards compatibility
Expand Down Expand Up @@ -415,6 +416,11 @@ def _parse_arguments():
action="store_true",
help=("Validate SEDML file(s)"),
)
mut_exc_opts.add_argument(
"-swc",
action="store_true",
help=("Load NeuroML file(s), and convert it to swc format\n"),
)

return parser.parse_args()

Expand Down Expand Up @@ -852,6 +858,15 @@ def _evaluate_arguments(args):
exit_on_fail = True
run_multi = True

elif args.swc:
convert_count = 0
for f in args.input_files:
confirm_neuroml_file(f)
logger.info(f"Trying to convert {f} to swc format...")
convert_count += 1 if convert_to_swc(f) else 0
logger.info(f"Converted {convert_count} file(s) to swc format")
sys.exit(0)

if run_multi is False:
run_jneuroml(
pre_args,
Expand Down
7 changes: 6 additions & 1 deletion pyneuroml/swc/ExportSWC.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ def convert_to_swc(nml_file_name, add_comments=False, target_dir=None):
lines = []
comment_lines = []

if len(nml_doc.cells) == 0:
return False

for cell in nml_doc.cells:
swc_file_name = "%s/%s.swc" % (target_dir, cell.id)
swc_file = open(swc_file_name, "w")
Expand Down Expand Up @@ -183,13 +186,15 @@ def convert_to_swc(nml_file_name, add_comments=False, target_dir=None):
for i in range(len(lines)):
line = lines[i]
swc_line = "%s" % (line)
print(swc_line)
logger.debug(swc_line)
swc_file.write("%s\n" % swc_line)

swc_file.close()

print("Written to %s" % swc_file_name)

return True


if __name__ == "__main__":
if len(sys.argv) == 1:
Expand Down
1 change: 1 addition & 0 deletions test-ghactions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ echo "## Test some conversions"

pynml NML2_SingleCompHHCell.nml -svg
pynml NML2_SingleCompHHCell.nml -png
pynml NML2_SingleCompHHCell.nml -swc
pynml LEMS_NML2_Ex5_DetCell.xml -sedml
pynml LEMS_NML2_Ex9_FN.xml -dlems
pynml LEMS_NML2_Ex9_FN.xml -brian
Expand Down