Skip to content

Commit

Permalink
Merge pull request #429 from NeuroML/experimental
Browse files Browse the repository at this point in the history
Fixes for validating - should be possible to validate xml files as nml too...
  • Loading branch information
sanjayankur31 authored Sep 25, 2024
2 parents d088537 + 74a186a commit ae7d8f0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions pyneuroml/pynml.py
Original file line number Diff line number Diff line change
Expand Up @@ -874,13 +874,13 @@ def _evaluate_arguments(args):

exit(0)
elif args.validate:
file_types = ["nml"]
file_types = ["nml","xml"]
pre_args = "-validate"
exit_on_fail = True
run_multi = True

elif args.validatev1:
file_types = ["nml"]
file_types = ["nml","xml"]
pre_args = "-validatev1"
exit_on_fail = True
run_multi = True
Expand Down
7 changes: 2 additions & 5 deletions pyneuroml/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,14 +770,11 @@ def run_jneuroml(
return False

if report_jnml_output:
logger.debug(
logger.info(
"Successfully ran the following command using pyNeuroML v%s: \n %s"
% (__version__, command)
)
logger.debug("Output:\n\n%s" % output)

# except KeyboardInterrupt as e:
# raise e
logger.info("Output:\n\n%s" % output)

except Exception as e:
logger.error("*** Execution of jnml has failed! ***")
Expand Down
13 changes: 7 additions & 6 deletions pyneuroml/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

try:
import libsedml
except ModuleNotFoundError:
logger.warning("Please install optional dependencies to use SED-ML features:")
logger.warning("pip install pyneuroml[combine]")


MAX_COLOUR = (255, 0, 0) # type: typing.Tuple[int, int, int]
MIN_COLOUR = (255, 255, 0) # type: typing.Tuple[int, int, int]
Expand Down Expand Up @@ -721,6 +715,13 @@ def get_model_file_list(
lems_def_dir = get_model_file_list(inc, filelist, rootdir, lems_def_dir)

elif rootfile.endswith(".sedml"):

try:
import libsedml
except ModuleNotFoundError:
logger.error("Please install optional dependencies to use SED-ML features:")
logger.error("pip install pyneuroml[combine]")

if pathlib.Path(rootfile).is_absolute():
rootdoc = libsedml.readSedMLFromFile(rootfile)
else:
Expand Down

0 comments on commit ae7d8f0

Please sign in to comment.