Changeset 968 for trunk

Show
Ignore:
Timestamp:
05/27/11 13:15:38 (12 months ago)
Author:
apdavison
Message:

NineMLCellType subclasses now have sorted synapse_types

Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/examples/nineml_neuron.py

    r966 r968  
    2222celltype_cls = nineml_cell_type("if_cond_exp", 
    2323                                leaky_iaf.c1, 
    24                                 excitatory=coba_synapse.c1, 
    25                                 inhibitory=deepcopy(coba_synapse.c1), 
     24                                inhibitory=coba_synapse.c1, 
     25                                excitatory=deepcopy(coba_synapse.c1), 
    2626                                port_map={ 
    2727                                    'excitatory': [('V', 'V'), ('Isyn', 'Isyn')], 
  • trunk/src/neuron/nineml.py

    r966 r968  
    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"))                 
    104     nineml2nmodl = __import__("9ml2nmodl") 
    105  
    106     nineml2nmodl.write_nmodl(xml_file, weight_variables) # weight variables should really come from xml file 
     97     
     98    from nineml2nmodl import write_nmodl 
     99    write_nmodl(xml_file, weight_variables) # weight variables should really come from xml file 
    107100    p = subprocess.check_call(["nrnivmodl"]) 
    108101    os.chdir(cwd) 
  • trunk/src/nineml/cells.py

    r964 r968  
    224224        dct["default_initial_values"] = dict((name, 0.0) 
    225225                                          for name in combined_model.state_variables) 
    226         dct["synapse_types"] = dct["synapse_models"].keys() #really need an ordered dict 
     226        dct["synapse_types"] = sorted(dct["synapse_models"]) # using alphabetical order may make things easier code generators 
    227227        dct["injectable"] = True # need to determine this. How?? 
    228228        dct["recordable"] = [port.name for port in combined_model.analog_ports] + ['spikes', 'regime'] 
     
    231231        dct["model_name"] = name 
    232232        logger.debug("Creating class '%s' with bases %s and dictionary %s" % (name, bases, dct)) 
    233         # generate and compile NMODL code, then load the mechanism into NEUORN 
     233        # generate and compile code, then load the mechanism into the simulator 
    234234        dct["builder"](combined_model, dct["weight_variables"]) # weight variables should really be stored within combined_model 
    235235        return type.__new__(cls, name, bases, dct)