getinfo.py 753 B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env python3
  2. """
  3. Get info from NEURON model
  4. File: NEURON/getinfo.py
  5. Copyright 2022 Ankur Sinha
  6. Author: Ankur Sinha <sanjay DOT ankur AT gmail DOT com>
  7. """
  8. import sys
  9. import yaml
  10. from pyneuroml.neuron import morphinfo, getinfo, load_hoc_or_python_file
  11. from neuron import h
  12. if len(sys.argv) != 2:
  13. print("Error: only takes one argument")
  14. sys.exit(-1)
  15. cell = sys.argv[1]
  16. load_hoc_or_python_file(f"test_HL23{cell}.hoc")
  17. with open(f"NEURON-morphinfo-{cell}.yaml", "w") as f:
  18. retval = morphinfo()
  19. print(yaml.dump(retval, sort_keys=True, indent=4), file=f, flush=True)
  20. with open(f"NEURON-info-{cell}.yaml", "w") as f:
  21. retval = getinfo(h.allsec())
  22. print(yaml.dump(retval, sort_keys=True, indent=4), file=f, flush=True)