Changeset 966 for trunk

Show
Ignore:
Timestamp:
05/25/11 19:48:33 (12 months ago)
Author:
emuller
Message:

Moved python lib9ml nineml examples to be importable -> Adjusted PyNN nineml_neuron.py example accordingly

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/examples/nineml_neuron.py

    r965 r966  
    55 
    66import sys 
    7 from os.path import abspath, realpath, join 
    87import nineml 
    9 root = abspath(join(realpath(nineml.__path__[0]), "../../..")) 
    10 sys.path.append(join(root, "lib9ml/python/examples/AL")) 
    11 sys.path.append(join(root, "code_generation/nmodl"))                 
    12 leaky_iaf = __import__("leaky_iaf") 
    13 coba_synapse = __import__("coba_synapse") 
    148import pyNN.neuron as sim 
    159from pyNN.neuron.nineml import nineml_cell_type 
     
    2014init_logging(None, debug=True) 
    2115sim.setup(timestep=0.1, min_delay=0.1, max_delay=2.0) 
     16 
     17 
     18# Get come models to work with 
     19from nineml.examples.AL import leaky_iaf 
     20from nineml.examples.AL import coba_synapse 
    2221 
    2322celltype_cls = nineml_cell_type("if_cond_exp", 
  • trunk/src/neuron/nineml.py

    r965 r966  
    9595    logger.debug("Writing NineML component to %s" % xml_file) 
    9696    nineml_component.write(xml_file) 
     97 
     98    # TODO: This way of importing is a cludge. 
     99    # To fix it, where should general nmodl code-generation live? Under nineml.code_generation ? 
     100    from os.path import abspath, realpath, join 
     101    import nineml, sys 
     102    root = abspath(join(realpath(nineml.__path__[0]), "../../..")) 
     103    sys.path.append(join(root, "code_generation/nmodl"))                 
    97104    nineml2nmodl = __import__("9ml2nmodl") 
     105 
    98106    nineml2nmodl.write_nmodl(xml_file, weight_variables) # weight variables should really come from xml file 
    99107    p = subprocess.check_call(["nrnivmodl"])