Changeset 957
- Timestamp:
- 05/03/11 15:44:15 (13 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 70 modified
-
AUTHORS (added)
-
README (modified) (1 diff)
-
examples/nineml_neuron.py (modified) (1 diff)
-
setup.py (modified) (2 diffs)
-
src/__init__.py (modified) (1 diff)
-
src/brian/__init__.py (modified) (1 diff)
-
src/brian/connectors.py (modified) (1 diff)
-
src/brian/electrodes.py (modified) (1 diff)
-
src/brian/recording.py (modified) (1 diff)
-
src/brian/simulator.py (modified) (1 diff)
-
src/brian/standardmodels/cells.py (modified) (1 diff)
-
src/brian/standardmodels/synapses.py (modified) (1 diff)
-
src/common.py (modified) (2 diffs)
-
src/connectors.py (modified) (1 diff)
-
src/core.py (modified) (1 diff)
-
src/descriptions/__init__.py (modified) (1 diff)
-
src/errors.py (modified) (1 diff)
-
src/models.py (modified) (1 diff)
-
src/moose/__init__.py (modified) (1 diff)
-
src/moose/cells.py (modified) (1 diff)
-
src/moose/recording.py (modified) (1 diff)
-
src/moose/simulator.py (modified) (1 diff)
-
src/moose/standardmodels/cells.py (modified) (1 diff)
-
src/multisim.py (modified) (1 diff)
-
src/nemo/__init__.py (modified) (1 diff)
-
src/nemo/connectors.py (modified) (1 diff)
-
src/nemo/electrodes.py (modified) (1 diff)
-
src/nemo/recording.py (modified) (1 diff)
-
src/nemo/simulator.py (modified) (1 diff)
-
src/nemo/standardmodels/cells.py (modified) (1 diff)
-
src/nemo/standardmodels/synapses.py (modified) (1 diff)
-
src/nest/__init__.py (modified) (1 diff)
-
src/nest/cells.py (modified) (1 diff)
-
src/nest/connectors.py (modified) (1 diff)
-
src/nest/electrodes.py (modified) (1 diff)
-
src/nest/recording.py (modified) (1 diff)
-
src/nest/simulator.py (modified) (1 diff)
-
src/nest/standardmodels/cells.py (modified) (1 diff)
-
src/nest/standardmodels/synapses.py (modified) (1 diff)
-
src/nest/synapses.py (modified) (1 diff)
-
src/neuroml.py (modified) (1 diff)
-
src/neuron/__init__.py (modified) (1 diff)
-
src/neuron/cells.py (modified) (1 diff)
-
src/neuron/connectors.py (modified) (1 diff)
-
src/neuron/electrodes.py (modified) (1 diff)
-
src/neuron/nineml.py (modified) (5 diffs)
-
src/neuron/recording.py (modified) (1 diff)
-
src/neuron/simulator.py (modified) (1 diff)
-
src/neuron/standardmodels/cells.py (modified) (1 diff)
-
src/neuron/standardmodels/synapses.py (modified) (1 diff)
-
src/nineml/__init__.py (modified) (1 diff)
-
src/nineml/cells.py (modified) (1 diff)
-
src/nineml/connectors.py (modified) (1 diff)
-
src/nineml/read.py (modified) (1 diff)
-
src/nineml/synapses.py (modified) (1 diff)
-
src/nineml/utility.py (modified) (1 diff)
-
src/pcsim/__init__.py (modified) (1 diff)
-
src/pcsim/connectors.py (modified) (1 diff)
-
src/pcsim/electrodes.py (modified) (1 diff)
-
src/pcsim/recording.py (modified) (1 diff)
-
src/pcsim/simulator.py (modified) (1 diff)
-
src/pcsim/standardmodels/cells.py (modified) (1 diff)
-
src/pcsim/standardmodels/synapses.py (modified) (1 diff)
-
src/random.py (modified) (1 diff)
-
src/recording/__init__.py (modified) (1 diff)
-
src/recording/files.py (modified) (1 diff)
-
src/space.py (modified) (1 diff)
-
src/standardmodels/__init__.py (modified) (1 diff)
-
src/standardmodels/cells.py (modified) (1 diff)
-
src/standardmodels/synapses.py (modified) (1 diff)
-
src/utility.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/README
r601 r957 28 28 http://neuralensemble.org/PyNN 29 29 30 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 31 :license: CeCILL, see LICENSE for details. -
trunk/examples/nineml_neuron.py
r955 r957 12 12 leaky_iaf = __import__("leaky_iaf") 13 13 coba_synapse = __import__("coba_synapse") 14 import pyNN.neuron as sim 14 15 from pyNN.neuron.nineml import nineml_cell_type 15 16 from pyNN.utility import init_logging 16 import pyNN.neuron as sim 17 17 18 from copy import deepcopy 18 19 -
trunk/setup.py
r935 r957 15 15 import subprocess 16 16 p = subprocess.Popen(nrnivmodl, shell=True, stdin=subprocess.PIPE, 17 stdout=subprocess.PIPE, stderr=subprocess. PIPE,17 stdout=subprocess.PIPE, stderr=subprocess.STDOUT, 18 18 close_fds=True, cwd=os.path.join(os.getcwd(), self.build_lib, 'pyNN/neuron/nmodl')) 19 stdout = p.stdout.readlines() 19 20 result = p.wait() 20 21 # test if nrnivmodl was successful 21 22 if result != 0: 22 errorMsg = p.stderr.readlines() 23 print "Unable to compile NEURON extensions. Error message was:" 24 print errorMsg 23 print "Unable to compile NEURON extensions. Output was:" 24 print ' '.join([''] + stdout) # indent error msg for easy comprehension 25 25 else: 26 26 print "Successfully compiled NEURON extensions." … … 41 41 setup( 42 42 name = "PyNN", 43 version = "0.7. 0",43 version = "0.7.1", 44 44 package_dir={'pyNN': 'src'}, 45 packages = ['pyNN','pyNN.nest', 'pyNN.pcsim', 'pyNN.neuron', 'pyNN.brian', 'pyNN.nemo',45 packages = ['pyNN','pyNN.nest', 'pyNN.pcsim', 'pyNN.neuron', 'pyNN.brian', 46 46 'pyNN.recording', 'pyNN.standardmodels', 'pyNN.descriptions', 47 47 'pyNN.nest.standardmodels', 'pyNN.pcsim.standardmodels', 48 'pyNN.neuron.standardmodels', 'pyNN.brian.standardmodels' , 'pyNN.nemo.standardmodels'],48 'pyNN.neuron.standardmodels', 'pyNN.brian.standardmodels'], 49 49 package_data = {'pyNN': ['neuron/nmodl/*.mod', "descriptions/templates/*/*"]}, 50 author = "The NeuralEnsemble Community",50 author = "The PyNN team", 51 51 author_email = "pynn@neuralensemble.org", 52 52 description = "A Python package for simulator-independent specification of neuronal network models", -
trunk/src/__init__.py
r932 r957 66 66 random 67 67 68 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 69 :license: CeCILL, see LICENSE for details. 68 70 """ 69 71 70 __version__ = '0.7. 0( $Rev$)'.replace(' $','')72 __version__ = '0.7.1 ( $Rev$)'.replace(' $','') 71 73 __all__ = ["common", "random", "nest", "neuron", "pcsim", "brian", "nemo", "recording", "errors", "space", "descriptions", "standardmodels"] -
trunk/src/brian/__init__.py
r927 r957 2 2 """ 3 3 Brian implementation of the PyNN API. 4 5 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 6 :license: CeCILL, see LICENSE for details. 4 7 5 8 $Id$ -
trunk/src/brian/connectors.py
r833 r957 1 1 """ 2 2 Connection method classes for the brian module 3 4 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 5 :license: CeCILL, see LICENSE for details. 3 6 4 7 $Id$ -
trunk/src/brian/electrodes.py
r922 r957 5 5 DCSource -- a single pulse of current of constant amplitude. 6 6 StepCurrentSource -- a step-wise time-varying current. 7 8 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 9 :license: CeCILL, see LICENSE for details. 7 10 8 11 $Id$ -
trunk/src/brian/recording.py
r900 r957 1 """ 2 3 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 4 :license: CeCILL, see LICENSE for details. 5 """ 6 1 7 import numpy 2 8 import brian -
trunk/src/brian/simulator.py
r926 r957 23 23 All other functions and classes are private, and should not be used by other 24 24 modules. 25 25 26 27 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 28 :license: CeCILL, see LICENSE for details. 29 26 30 $Id$ 27 31 """ -
trunk/src/brian/standardmodels/cells.py
r897 r957 1 1 """ 2 2 Standard cells for the brian module 3 4 5 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 6 :license: CeCILL, see LICENSE for details. 3 7 4 8 $Id$ -
trunk/src/brian/standardmodels/synapses.py
r888 r957 1 1 """ 2 2 Synapse Dynamics classes for the brian module. 3 4 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 5 :license: CeCILL, see LICENSE for details. 3 6 4 7 $Id$ -
trunk/src/common.py
r941 r957 41 41 Assembly 42 42 Projection 43 44 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 45 :license: CeCILL, see LICENSE for details. 43 46 44 47 $Id$ … … 1888 1891 max = weights.max() 1889 1892 bins = numpy.linspace(min, max, nbins+1) 1890 return numpy.histogram(weights, bins , new=True) # returns n, bins1893 return numpy.histogram(weights, bins) # returns n, bins 1891 1894 1892 1895 def describe(self, template='projection_default.txt', engine='default'): -
trunk/src/connectors.py
r955 r957 4 4 Simulator modules may use these directly, or may implement their own versions 5 5 for improved performance. 6 7 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 8 :license: CeCILL, see LICENSE for details. 6 9 """ 7 10 -
trunk/src/core.py
r926 r957 1 1 """ 2 2 Assorted utility classes and functions. 3 4 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 5 :license: CeCILL, see LICENSE for details. 3 6 """ 4 7 -
trunk/src/descriptions/__init__.py
r808 r957 17 17 from pyNN import descriptions 18 18 descriptions.DEFAULT_TEMPLATE_ENGINE = 'jinja2' 19 20 21 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 22 :license: CeCILL, see LICENSE for details. 19 23 """ 20 24 -
trunk/src/errors.py
r848 r957 13 13 NotLocalError 14 14 RecordingError 15 16 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 17 :license: CeCILL, see LICENSE for details. 15 18 """ 16 19 -
trunk/src/models.py
r888 r957 2 2 Base classes for cell and synapse models, whether "standard" (cross-simulator) 3 3 or "native" (restricted to an individual simulator). 4 5 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 6 :license: CeCILL, see LICENSE for details. 4 7 """ 5 8 -
trunk/src/moose/__init__.py
r893 r957 4 4 5 5 Authors: Subhasis Ray and Andrew Davison 6 7 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 8 :license: CeCILL, see LICENSE for details. 6 9 7 10 $Id$ -
trunk/src/moose/cells.py
r893 r957 1 """ 2 3 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 4 :license: CeCILL, see LICENSE for details. 5 """ 6 1 7 import moose 2 8 import numpy -
trunk/src/moose/recording.py
r900 r957 1 """ 2 3 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 4 :license: CeCILL, see LICENSE for details. 5 """ 6 1 7 import numpy 2 8 from pyNN import recording -
trunk/src/moose/simulator.py
r893 r957 10 10 All other functions and classes are private, and should not be used by other 11 11 modules. 12 12 13 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 14 :license: CeCILL, see LICENSE for details. 15 13 16 $Id:$ 14 17 """ -
trunk/src/moose/standardmodels/cells.py
r891 r957 1 """ 2 3 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 4 :license: CeCILL, see LICENSE for details. 5 """ 6 7 1 8 from pyNN.standardmodels import build_translations, cells 2 9 from pyNN.moose.cells import StandardIF, SingleCompHH, RandomSpikeSource, VectorSpikeSource -
trunk/src/multisim.py
r696 r957 2 2 A small framework to make it easier to run the same model on multiple 3 3 simulators. 4 5 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 6 :license: CeCILL, see LICENSE for details. 4 7 """ 5 8 -
trunk/src/nemo/__init__.py
r939 r957 2 2 """ 3 3 Nemo implementation of the PyNN API. 4 5 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 6 :license: CeCILL, see LICENSE for details. 4 7 5 8 $Id: __init__.py 927 2011-02-03 16:56:10Z pierre $ -
trunk/src/nemo/connectors.py
r932 r957 1 1 """ 2 2 Connection method classes for the nemo module 3 4 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 5 :license: CeCILL, see LICENSE for details. 3 6 4 7 $Id: connectors.py 833 2010-11-26 11:56:38Z pierre $ -
trunk/src/nemo/electrodes.py
r932 r957 5 5 DCSource -- a single pulse of current of constant amplitude. 6 6 StepCurrentSource -- a step-wise time-varying current. 7 8 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 9 :license: CeCILL, see LICENSE for details. 7 10 8 11 $Id: electrodes.py 922 2011-02-02 16:41:12Z pierre $ -
trunk/src/nemo/recording.py
r946 r957 1 """ 2 3 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 4 :license: CeCILL, see LICENSE for details. 5 """ 6 1 7 import numpy 2 8 from pyNN import recording -
trunk/src/nemo/simulator.py
r949 r957 23 23 All other functions and classes are private, and should not be used by other 24 24 modules. 25 25 26 27 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 28 :license: CeCILL, see LICENSE for details. 29 26 30 $Id: simulator.py 926 2011-02-03 13:44:28Z apdavison $ 27 31 """ -
trunk/src/nemo/standardmodels/cells.py
r949 r957 1 1 """ 2 2 Standard cells for the nemo module 3 4 5 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 6 :license: CeCILL, see LICENSE for details. 3 7 4 8 $Id: cells.py 897 2011-01-13 12:47:23Z pierre $ -
trunk/src/nemo/standardmodels/synapses.py
r937 r957 1 1 """ 2 2 Synapse Dynamics classes for the nemo module. 3 4 5 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 6 :license: CeCILL, see LICENSE for details. 3 7 4 8 $Id: synapses.py 888 2011-01-04 15:17:54Z pierre $ -
trunk/src/nest/__init__.py
r927 r957 2 2 """ 3 3 NEST v2 implementation of the PyNN API. 4 5 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 6 :license: CeCILL, see LICENSE for details. 4 7 5 8 $Id$ -
trunk/src/nest/cells.py
r905 r957 1 1 """ 2 2 Definition of NativeCellType class for NEST. 3 4 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 5 :license: CeCILL, see LICENSE for details. 3 6 """ 4 7 -
trunk/src/nest/connectors.py
r954 r957 1 1 """ 2 2 Connection method classes for nest 3 4 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 5 :license: CeCILL, see LICENSE for details. 3 6 4 7 $Id$ -
trunk/src/nest/electrodes.py
r922 r957 6 6 StepCurrentSource -- a step-wise time-varying current. 7 7 NoisyCurrentSource -- a Gaussian whitish noise current. 8 9 10 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 11 :license: CeCILL, see LICENSE for details. 8 12 9 13 $Id$ -
trunk/src/nest/recording.py
r931 r957 1 """ 2 3 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 4 :license: CeCILL, see LICENSE for details. 5 """ 6 1 7 import tempfile 2 8 import os -
trunk/src/nest/simulator.py
r956 r957 22 22 All other functions and classes are private, and should not be used by other 23 23 modules. 24 24 25 26 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 27 :license: CeCILL, see LICENSE for details. 28 25 29 $Id$ 26 30 """ -
trunk/src/nest/standardmodels/cells.py
r897 r957 1 1 """ 2 2 Standard cells for nest 3 4 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 5 :license: CeCILL, see LICENSE for details. 3 6 4 7 $Id$ -
trunk/src/nest/standardmodels/synapses.py
r931 r957 1 1 """ 2 2 Synapse Dynamics classes for nest 3 4 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 5 :license: CeCILL, see LICENSE for details. 3 6 4 7 $Id$ -
trunk/src/nest/synapses.py
r907 r957 1 1 """ 2 2 Definition of NativeSynapseType class for NEST 3 4 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 5 :license: CeCILL, see LICENSE for details. 3 6 """ 4 7 -
trunk/src/neuroml.py
r801 r957 2 2 """ 3 3 PyNN-->NeuroML 4 5 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 6 :license: CeCILL, see LICENSE for details. 7 4 8 $Id$ 5 9 """ -
trunk/src/neuron/__init__.py
r927 r957 2 2 """ 3 3 nrnpython implementation of the PyNN API. 4 4 5 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 6 :license: CeCILL, see LICENSE for details. 7 5 8 $Id:__init__.py 188 2008-01-29 10:03:59Z apdavison $ 6 9 """ -
trunk/src/neuron/cells.py
r919 r957 2 2 """ 3 3 Standard cells for the neuron module. 4 5 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 6 :license: CeCILL, see LICENSE for details. 4 7 5 8 $Id$ -
trunk/src/neuron/connectors.py
r770 r957 1 1 """ 2 2 Connection method classes for the neuron module 3 4 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 5 :license: CeCILL, see LICENSE for details. 3 6 4 7 $Id$ -
trunk/src/neuron/electrodes.py
r888 r957 5 5 DCSource -- a single pulse of current of constant amplitude. 6 6 StepCurrentSource -- a step-wise time-varying current. 7 8 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 9 :license: CeCILL, see LICENSE for details. 7 10 8 11 $Id$ -
trunk/src/neuron/nineml.py
r955 r957 13 13 Constants: 14 14 NMODL_DIR - subdirectory to which NMODL mechanisms will be written 15 15 16 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 17 :license: CeCILL, see LICENSE for details. 18 16 19 """ 17 20 … … 19 22 import subprocess 20 23 import neuron 21 from pyNN.models import BaseCellType 22 import nineml.abstraction_layer as nineml 24 25 from pyNN.nineml.cells import join, _add_prefix, _build_nineml_celltype, NineMLCellType 23 26 import logging 24 27 import os 25 import re26 from itertools import chain27 28 28 29 h = neuron.h … … 69 70 70 71 71 class NineMLCellType(BaseCellType):72 model = NineMLCell73 74 def __init__(self, parameters):75 BaseCellType.__init__(self, parameters)76 self.parameters["type"] = self77 78 79 72 def _compile_nmodl(nineml_component, weight_variables): # weight variables should really be within component 80 73 """ … … 96 89 97 90 98 def _add_prefix(synapse_model, prefix, port_map):99 """100 Add a prefix to all variables in `synapse_model`, except for variables with101 receive ports and specified in `port_map`.102 """103 synapse_model.__cache__ = {}104 exclude = []105 new_port_map = []106 for name1, name2 in port_map:107 if synapse_model.ports_map[name2].mode == 'recv':108 exclude.append(name2)109 new_port_map.append((name1, name2))110 else:111 new_port_map.append((name1, prefix + '_' + name2))112 synapse_model.add_prefix(prefix + '_', exclude=exclude)113 return new_port_map114 115 116 class _build_nineml_celltype(type):117 """118 Metaclass for building NineMLCellType subclasses119 """120 def __new__(cls, name, bases, dct):121 # join the neuron and synapse components into a single component122 combined_model = dct["neuron_model"]123 for label in dct["synapse_models"].keys():124 port_map = dct["port_map"][label]125 port_map = _add_prefix(dct["synapse_models"][label], label, port_map)126 dct["weight_variables"][label] = label + "_" + dct["weight_variables"][label]127 combined_model = join(combined_model,128 dct["synapse_models"][label],129 port_map,130 name=name)131 dct["combined_model"] = combined_model132 # set class attributes required for a PyNN cell type class133 dct["default_parameters"] = dict((name, 1.0)134 for name in combined_model.parameters)135 dct["default_initial_values"] = dict((name, 0.0)136 for name in combined_model.state_variables)137 dct["synapse_types"] = dct["synapse_models"].keys() #really need an ordered dict138 dct["injectable"] = True # need to determine this. How??139 dct["recordable"] = [port.name for port in combined_model.analog_ports] + ['spikes', 'regime']140 dct["standard_receptor_type"] = (dct["synapse_types"] == ('excitatory', 'inhibitory'))141 dct["conductance_based"] = True # how to determine this??142 dct["model_name"] = name143 logger.debug("Creating class '%s' with bases %s and dictionary %s" % (name, bases, dct))144 # generate and compile NMODL code, then load the mechanism into NEUORN145 _compile_nmodl(combined_model, dct["weight_variables"]) # weight variables should really be stored within combined_model146 return type.__new__(cls, name, bases, dct)147 148 149 150 91 def nineml_cell_type(name, neuron_model, port_map={}, weight_variables={}, **synapse_models): 151 92 """ … … 157 98 'port_map': port_map, 158 99 'weight_variables': weight_variables}) 159 160 161 def join(c1, c2, port_map=[], name=None):162 """Create a NineML component by joining the two given components."""163 logger.debug("Joining components %s and %s with port map %s" % (c1, c2, port_map))164 logger.debug("New component will have name '%s'" % name)165 # combine bindings from c1 and c2166 bindings = {}167 for b in chain(c1.bindings, c2.bindings):168 bindings[b.name] = b169 # combine ports (some will later be removed)170 all_ports = c1.ports_map.copy()171 all_ports.update(c2.ports_map)172 # event ports do not be passed to the constructor, as they are attached to transitions173 for port_name, port in all_ports.items():174 if isinstance(port, nineml.EventPort):175 all_ports.pop(port_name)176 # connect ports.177 # currently, when ports are connected they disappear. It might be better to178 # explicitly keep the ports in the new component but mark them as connected179 for name1, name2 in port_map:180 assert name1 in c1.ports_map, "%s is not in %s" % (name1, c1.ports_map.keys())181 assert name2 in c2.ports_map, "%s is not in %s" % (name2, c2.ports_map.keys())182 183 port1 = c1.ports_map[name1]184 port2 = c2.ports_map[name2]185 assert port1.mode != port2.mode186 if port1.mode == 'send':187 send_port = port1188 recv_port = port2189 send_port_name = name1190 recv_port_name = name2191 else:192 send_port = port2193 recv_port = port1194 send_port_name = name2195 recv_port_name = name1196 # when connecting ports in which the send port has an expression, need197 # to create a binding for this expression in the new component198 if send_port.expr:199 func_args = c1.non_parameter_symbols.union(c2.non_parameter_symbols).intersection(send_port.expr.names)200 lhs = "%s(%s)" % (send_port_name, ",".join(func_args))201 send_binding = nineml.Binding(lhs, send_port.expr.rhs)202 bindings[send_binding.name] = send_binding203 for eq in chain(c1.equations, c2.equations):204 if send_port_name in eq.names:205 eq.rhs = eq.rhs_name_transform({send_port_name: lhs})206 if recv_port.mode == 'reduce':207 # need to retain reduce ports as they can be connected to in a future join208 if recv_port_name in bindings:209 # this reduce port has already been connected to, so combine using its reduce_op210 reduce_binding = bindings[recv_port_name]211 func_args = func_args.union(reduce_binding.args)212 lhs = "%s(%s)" % (recv_port_name, ",".join(func_args))213 rhs = recv_port.reduce_op.join([reduce_binding.rhs, send_binding.lhs])214 else:215 # this is the first time this reduce port has been connected to216 lhs = "%s(%s)" % (recv_port_name, ",".join(func_args))217 rhs = send_binding.lhs218 bindings[recv_port_name] = nineml.Binding(lhs, rhs)219 recv_port.connected = True220 else:221 all_ports.pop(name1)222 else:223 if recv_port.mode == 'reduce':224 raise NotImplementedError225 else:226 all_ports.pop(name1)227 228 if name1 != name2:229 #c2.substitute(name2, name1) # need to implement this. Currently this all only works if name1 == name2230 # probably needs to happen sooner in the function231 all_ports.pop(name2)232 233 # where parameters have become bindings due to connecting ports, replace234 # bare names with function calls in the equations235 for bname, binding in bindings.items():236 for eq in chain(c1.equations, c2.equations):237 if bname in eq.names:238 print "#### replacing %s by %s" % (bname, binding.lhs)239 pattern = re.compile(r'%s(\([\w\, ]*\))?' % bname)240 m = pattern.search(eq.rhs)241 if m:242 eq.rhs = pattern.sub(binding.lhs, eq.rhs)243 else:244 eq.rhs = eq.rhs_name_transform({bname: binding.lhs})245 246 # create new regimes from all possible combinations of the regimes from the247 # two components248 regime_map = {}249 for r1 in c1.regimes:250 regime_map[r1.name] = {}251 for r2 in c2.regimes:252 if r1.name == r2.name:253 new_name = r1.name254 else:255 new_name = "%s_AND_%s" % (r1.name, r2.name)256 kwargs = {'name': new_name}257 new_regime = nineml.Regime(*r1.nodes.union(r2.nodes), **kwargs)258 regime_map[r1.name][r2.name] = new_regime259 # create transitions between all the new regimes260 transitions = []261 for r1 in c1.regimes:262 for r2 in c2.regimes:263 for t in r1.transitions:264 new_transition = nineml.Transition(*t.nodes,265 from_=regime_map[r1.name][r2.name],266 to=regime_map[t.to.name][r2.name],267 condition=t.condition)268 transitions.append(new_transition)269 for t in r2.transitions:270 new_transition = nineml.Transition(*t.nodes,271 from_=regime_map[r1.name][r2.name],272 to=regime_map[r1.name][t.to.name],273 condition=t.condition)274 transitions.append(new_transition)275 276 regimes = []277 for d in regime_map.values():278 regimes.extend(d.values())279 name = name or "%s__%s" % (c1.name, c2.name)280 return nineml.Component(name,281 regimes=regimes,282 transitions=transitions,283 ports=all_ports.values(),284 bindings=bindings.values()) -
trunk/src/neuron/recording.py
r947 r957 1 """ 2 3 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 4 :license: CeCILL, see LICENSE for details. 5 """ 6 1 7 import numpy 2 8 from pyNN import recording -
trunk/src/neuron/simulator.py
r947 r957 24 24 All other functions and classes are private, and should not be used by other 25 25 modules. 26 26 27 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 28 :license: CeCILL, see LICENSE for details. 29 27 30 $Id$ 28 31 """ -
trunk/src/neuron/standardmodels/cells.py
r897 r957 2 2 """ 3 3 Standard cells for the neuron module. 4 5 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 6 :license: CeCILL, see LICENSE for details. 4 7 5 8 $Id: cells.py 873 2010-12-13 22:40:03Z apdavison $ -
trunk/src/neuron/standardmodels/synapses.py
r888 r957 1 1 """ 2 2 Synapse Dynamics classes for the neuron module. 3 4 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 5 :license: CeCILL, see LICENSE for details. 3 6 4 7 $Id$ -
trunk/src/nineml/__init__.py
r788 r957 1 1 # encoding: utf-8 2 """ 3 4 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 5 :license: CeCILL, see LICENSE for details. 6 """ 2 7 import nineml.user_layer as nineml 3 8 from pyNN import common, standardmodels, random, recording -
trunk/src/nineml/cells.py
r788 r957 1 1 """ 2 2 Standard cells for 9ML 3 4 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 5 :license: CeCILL, see LICENSE for details. 3 6 """ 4 7 -
trunk/src/nineml/connectors.py
r771 r957 1 """ 2 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 3 :license: CeCILL, see LICENSE for details. 4 """ 5 1 6 from pyNN import connectors 2 7 from utility import build_parameter_set, catalog_url -
trunk/src/nineml/read.py
r955 r957 10 10 Classes: 11 11 Network -- container for a network model. 12 12 13 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 14 :license: CeCILL, see LICENSE for details. 13 15 """ 14 16 -
trunk/src/nineml/synapses.py
r771 r957 1 """ 2 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 3 :license: CeCILL, see LICENSE for details. 4 """ 1 5 2 6 from utility import catalog_url -
trunk/src/nineml/utility.py
r786 r957 1 1 # encoding: utf-8 2 """ 3 4 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 5 :license: CeCILL, see LICENSE for details. 6 """ 7 2 8 from pyNN import random 3 9 import nineml.user_layer as nineml -
trunk/src/pcsim/__init__.py
r927 r957 8 8 9 9 December 2006- 10 11 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 12 :license: CeCILL, see LICENSE for details. 13 10 14 $Id$ 11 15 """ -
trunk/src/pcsim/connectors.py
r784 r957 1 1 """ 2 2 Connection method classes for pcsim 3 4 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 5 :license: CeCILL, see LICENSE for details. 3 6 4 7 $Id$ -
trunk/src/pcsim/electrodes.py
r870 r957 5 5 DCSource -- a single pulse of current of constant amplitude. 6 6 StepCurrentSource -- a step-wise time-varying current. 7 8 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 9 :license: CeCILL, see LICENSE for details. 7 10 8 11 $Id$ -
trunk/src/pcsim/recording.py
r916 r957 1 """ 2 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 3 :license: CeCILL, see LICENSE for details. 4 """ 5 1 6 import numpy 2 7 import pypcsim -
trunk/src/pcsim/simulator.py
r926 r957 22 22 All other functions and classes are private, and should not be used by other 23 23 modules. 24 24 25 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 26 :license: CeCILL, see LICENSE for details. 27 25 28 $Id$ 26 29 """ -
trunk/src/pcsim/standardmodels/cells.py
r888 r957 1 1 """ 2 2 Standard cells for pcsim 3 4 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 5 :license: CeCILL, see LICENSE for details. 3 6 4 7 $Id$ -
trunk/src/pcsim/standardmodels/synapses.py
r916 r957 1 1 """ 2 2 Synapse Dynamics classes for pcsim 3 4 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 5 :license: CeCILL, see LICENSE for details. 3 6 4 7 $Id$ -
trunk/src/random.py
r912 r957 12 12 built-in RNG 13 13 RandomDistribution - produces random numbers from a specific distribution 14 15 16 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 17 :license: CeCILL, see LICENSE for details. 14 18 15 19 $Id:random.py 188 2008-01-29 10:03:59Z apdavison $ -
trunk/src/recording/__init__.py
r914 r957 5 5 These classes and functions are not part of the PyNN API, and are only for 6 6 internal use. 7 8 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 9 :license: CeCILL, see LICENSE for details. 7 10 8 11 $Id$ -
trunk/src/recording/files.py
r940 r957 11 11 NumpyBinaryFile 12 12 HDF5ArrayFile - requires PyTables 13 14 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 15 :license: CeCILL, see LICENSE for details. 13 16 14 17 $Id$ -
trunk/src/space.py
r924 r957 17 17 Cuboid - representation of a cuboidal volume, for use with RandomStructure. 18 18 Sphere - representation of a spherical volume, for use with RandomStructure. 19 20 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 21 :license: CeCILL, see LICENSE for details. 19 22 """ 20 23 -
trunk/src/standardmodels/__init__.py
r888 r957 16 16 STDPWeightDependence 17 17 STDPTimingDependence 18 18 19 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 20 :license: CeCILL, see LICENSE for details. 21 19 22 """ 20 23 -
trunk/src/standardmodels/cells.py
r897 r957 24 24 SpikeSourceArray 25 25 SpikeSourceInhGamma 26 26 27 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 28 :license: CeCILL, see LICENSE for details. 27 29 """ 28 30 -
trunk/src/standardmodels/synapses.py
r901 r957 13 13 GutigWeightDependence 14 14 SpikePairRule 15 15 16 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 17 :license: CeCILL, see LICENSE for details. 16 18 """ 17 19 -
trunk/src/utility.py
r907 r957 12 12 Timer - a convenience wrapper around the time.time() function from the 13 13 standard library. 14 15 :copyright: Copyright 2006-2011 by the PyNN team, see AUTHORS. 16 :license: CeCILL, see LICENSE for details. 14 17 15 18 $Id$
