def __init__(self, network, parentRegion = None, ontologyTerm = None, *args, **keywords): """ Regions represent a physical subset of a nervous system. They can also be hierarchical with regions nested within other regions. Regions can also be associated with an entry in one of the :class:`ontologies <Library.Ontology.Ontology>` in the library. You create a region by messaging a network: >>> region1 = network.createRegion(...) """ if ontologyTerm is not None: if 'name' not in keywords: keywords['name'] = ontologyTerm.name if 'abbreviation' not in keywords and ontologyTerm.abbreviation is not None: keywords['abbreviation'] = ontologyTerm.abbreviation NeuroObject.__init__(self, network, *args, **keywords) self.parentRegion = None self.subRegions = [] self.ontologyTerm = ontologyTerm self.arborizations = [] self.pathways = [] self.neurons = [] if parentRegion is not None: parentRegion._addSubRegion(self)
def __init__(self, network, neurite1, neurite2, *args, **keywords): """ GapJunction objects represent a gap junction between two :class:`neurites <Network.Neurite.Neurite>` in a :class:`network <Network.Network.Network>`. Instances of this class are created by using the gapJunctionWith method of :meth:`Neuron <Network.Neuron.Neuron.gapJunctionWith>` and :meth:`Neurite <Network.Neurite.Neurite.gapJunctionWith>` objects. >>> neuron1.gapJunctionWith(neuron2) """ NeuroObject.__init__(self, network, *args, **keywords) self._neurites = set([neurite1, neurite2])
def __init__(self, network, *args, **keywords): """ Muscle objects represent muscles in the :class:`network <Network.Network.Network>` and can be :class:`innervated <Network.Innervation.Innervation>` by :class:`neurites <Network.Neurite.Neurite>`. Create a muscle by messaging the network: >>> muscle1 = network.createMuscle() >>> neuron1.innervate(muscle1) """ NeuroObject.__init__(self, network, *args, **keywords) self._innervations = []
def __init__(self, network, neurite, muscle, *args, **keywords): """ Innervations represent a :class:`neurite's <Network.Neurite.Neurite>` connection to a :class:`muscle <Network.Muscle.Muscle>`. Create an innervation by messaging a :meth:`neuron <Network.Neuron.Neuron.innervate>` or :meth:`neurite <Network.Neurite.Neurite.innervate>`: >>> neuron1 = network.createNeuron() >>> muscle1 = network.createMuscle() >>> innervation_1_1 = neuron1.innervate(muscle1) """ NeuroObject.__init__(self, network, *args, **keywords) self.neurite = neurite self.muscle = muscle
def __init__(self, network, preSynapticNeurite = None, postSynapticPartners = [], activation = None, *args, **keywords): """ A Synapse object represents a chemical synapse between a single pre-synaptic neurite and one or more post-synaptic neurites. Instances of this class are created by using the synapseOn method of :meth:`Neuron <Network.Neuron.Neuron.synapseOn>` and :meth:`Neurite <Network.Neurite.Neurite.synapseOn>` objects. A synapse's activation attribute should be one of None (meaning unknown), 'excitatory' or 'inhibitory'. >>> neuron1.synapseOn(neuron2, activation = 'excitatory') """ NeuroObject.__init__(self, network, *args, **keywords) self.preSynapticNeurite = preSynapticNeurite self.postSynapticPartners = postSynapticPartners self.activation = activation
def __init__(self, neurite, region, sendsOutput=None, receivesInput=None, *args, **keywords): """ Arborizations represent a neurite's arborization within a region. You create an arborization by messaging a :meth:`neuron <Network.Neuron.Neuron.arborize>` or :meth:`neurite <Network.Neurite.Neurite.arborize>`: >>> neuron1 = network.createNeuron() >>> region1 = network.createRegion() >>> arborization_1_1 = neuron1.arborize(region1) """ NeuroObject.__init__(self, neurite.network, *args, **keywords) self.neurite = neurite self.region = region self.sendsOutput = sendsOutput # does the neurite send output to the arbor? None = unknown self.receivesInput = receivesInput # does the neurite receive input from the arbor? None = unknown
def __init__(self, network, preSynapticNeurite = None, postSynapticPartners = [], activation = None, preSynapticRegion = None, postSynapticRegion = None, *args, **keywords): """ A Synapse object represents a chemical synapse between a single pre-synaptic neurite and one or more post-synaptic neurites. Instances of this class are created by using the synapseOn method of :meth:`Neuron <Network.Neuron.Neuron.synapseOn>` and :meth:`Neurite <Network.Neurite.Neurite.synapseOn>` objects. A synapse's activation attribute should be one of None (meaning unknown), 'excitatory' or 'inhibitory'. >>> neuron1.synapseOn(neuron2, activation = 'excitatory') """ NeuroObject.__init__(self, network, *args, **keywords) self.preSynapticNeurite = preSynapticNeurite self.postSynapticPartners = postSynapticPartners self.activation = activation self.preSynapticRegion = preSynapticRegion self.postSynapticRegion = postSynapticRegion
def __init__(self, network, target = None, modality = None, *args, **keywords): """ Stimulus objects represent external stimulation of objects in the network. Stimulii are created by calling the :meth:`stimulate <Network.Object.Object.stimulate>` method on an object in the network. The modality argument must be a :class:`modality <Library.Modality.Modality>` from the library or None to indicate unknown modality. >>> stimulus = neuron1.stimulate(modality = library.modality('light')) """ if target is None: raise ValueError, gettext('A stimulus must have a target') if not keywords.has_key('name') or keywords['name'] is None: keywords['name'] = modality.name NeuroObject.__init__(self, network, *args, **keywords) self.target = target self.modality = modality
def __init__(self, network, target=None, modality=None, *args, **keywords): """ Stimulus objects represent external stimulation of objects in the network. Stimulii are created by calling the :meth:`stimulate <Network.Object.Object.stimulate>` method on an object in the network. The modality argument must be a :class:`modality <Library.Modality.Modality>` from the library or None to indicate unknown modality. >>> stimulus = neuron1.stimulate(modality = library.modality('light')) """ if target is None: raise ValueError, gettext('A stimulus must have a target') if not keywords.has_key('name') or keywords['name'] is None: keywords['name'] = modality.name NeuroObject.__init__(self, network, *args, **keywords) self.target = target self.modality = modality
def __init__(self, region1 , region2, region1Projects = None, region1Activation = None, region2Projects = None, region2Activation = None, *args, **keywords): """ Pathways connect pairs of :class:`regions <Network.Region.Region>`. They consist of bundles of :class:`neurites <Network.Neurite.Neurite>` which can be optionally specified. You create a pathway by :meth:`messaging <Network.Region.Region.projectToRegion>` one of the regions: >>> pathway_1_2 = region1.projectToRegion(region2) """ NeuroObject.__init__(self, region1.network, *args, **keywords) self._neurites = [] self.region1 = region1 self.region1Projects = region1Projects self.region1Activation = region1Activation self.region2 = region2 self.region2Projects = region2Projects self.region2Activation = region2Activation
def __init__(self, network, root, pathway=None, *args, **keywords): """ Neurites represent projections from :class:`neurons <Network.Neuron.Neuron>` or other neurites. You create a neurite by messaging a :meth:`neuron <Network.Neuron.Neuron.extendNeurite>` or :meth:`neurite <Network.Neurite.Neurite.extendNeurite>`: >>> neurite1 = neuron.extendNeurite(...) >>> neurite2 = neurite1.extendNeurite(...) """ NeuroObject.__init__(self, network, *args, **keywords) self.root = root self._neurites = [] self.arborization = None self._synapses = [] self._gapJunctions = [] self._innervations = [] self._pathway = pathway if pathway is not None: pathway.addNeurite(self)
def __init__(self, network, root, pathway = None, *args, **keywords): """ Neurites represent projections from :class:`neurons <Network.Neuron.Neuron>` or other neurites. You create a neurite by messaging a :meth:`neuron <Network.Neuron.Neuron.extendNeurite>` or :meth:`neurite <Network.Neurite.Neurite.extendNeurite>`: >>> neurite1 = neuron.extendNeurite(...) >>> neurite2 = neurite1.extendNeurite(...) """ NeuroObject.__init__(self, network, *args, **keywords) self.root = root self._neurites = [] self.arborization = None self._synapses = [] self._gapJunctions = [] self._innervations = [] self._pathway = pathway if pathway is not None: pathway.addNeurite(self)
def __init__(self, network, neuronClass = None, *args, **keywordArgs): """ Neurons represent individual neural cells in the network. You create a neuron by messaging the network: >>> neuron1 = network.createNeuron(...) """ # Upconvert old 'function' singleton param to list expected by new 'functions' param. if 'function' in keywordArgs: functions = set([function]) del function # Upconvert old 'neurotransmitter' singleton param to list expected by new 'neurotransmitters' param. if 'neurotransmitter' in keywordArgs: neurotransmitters = [neurotransmitter] del neurotransmitter # Pull out the keyword arguments specific to this class before we call super. # We need to do this so we can know if the caller specified an argument or not. # For example, the caller might specify a neuron class and one attribute to override. We need to know which attributes _not_ to set. localAttrNames = ['activation', 'functions', 'neurotransmitters', 'polarity', 'region', 'neuronImage', 'links'] localKeywordArgs = {} for attrName in localAttrNames: if attrName in keywordArgs: localKeywordArgs[attrName] = keywordArgs[attrName] del keywordArgs[attrName] NeuroObject.__init__(self, network, *args, **keywordArgs) self._neurites = [] self.neuronClass = neuronClass self.activation = None self._functions = set() self.neurotransmitters = [] self.polarity = None self.region = None self._synapses = [] self.neuronImage = [] self.links = [] for attrName in localAttrNames: if attrName == 'functions': attrValue = set() elif attrName in ('neurotransmitters', 'links', 'neuronImage'): attrValue = [] else: attrValue = None if attrName in localKeywordArgs: # The user has explicitly set the attribute. if attrName == 'functions': attrValue = set(localKeywordArgs[attrName]) elif attrName == 'neuronImage': for img in localKeywordArgs[attrName]: if img['path']: imageLabel = img['label'] imageLocation = img['path'] myImage = self.Img(imageLabel, imageLocation) attrValue.append(myImage) else: attrValue = localKeywordArgs[attrName] elif self.neuronClass: attrValue = getattr(self.neuronClass, attrName) # Inherit the value from the class if attrName == 'functions': attrName = '_functions' setattr(self, attrName, attrValue) if self.region is not None: self.region.neurons.append(self)
def __init__(self, network, neuronClass = None, *args, **keywordArgs): """ Neurons represent individual neural cells in the network. You create a neuron by messaging the network: >>> neuron1 = network.createNeuron(...) """ # Upconvert old 'function' singleton param to list expected by new 'functions' param. if 'function' in keywordArgs: functions = set([function]) del function # Upconvert old 'neurotransmitter' singleton param to list expected by new 'neurotransmitters' param. if 'neurotransmitter' in keywordArgs: neurotransmitters = [neurotransmitter] del neurotransmitter # Pull out the keyword arguments specific to this class before we call super. # We need to do this so we can know if the caller specified an argument or not. # For example, the caller might specify a neuron class and one attribute to override. We need to know which attributes _not_ to set. localAttrNames = ['activation', 'functions', 'neurotransmitters', 'polarity', 'region', 'neuronImage', 'links'] localKeywordArgs = {} for attrName in localAttrNames: if attrName in keywordArgs: localKeywordArgs[attrName] = keywordArgs[attrName] del keywordArgs[attrName] NeuroObject.__init__(self, network, *args, **keywordArgs) self._neurites = [] self.neuronClass = neuronClass self.activation = None self._functions = set() self.neurotransmitters = [] self.polarity = None self.region = None self._synapses = [] self.neuronImage = [] self.links = [] for attrName in localAttrNames: if attrName == 'functions': attrValue = set() elif attrName in ('neurotransmitters', 'links', 'neuronImage'): attrValue = [] else: attrValue = None if attrName in localKeywordArgs: # The user has explicitly set the attribute. if attrName == 'functions': attrValue = set(localKeywordArgs[attrName]) if attrName == 'neuronImage': for img in localKeywordArgs[attrName]: imageLabel = img['label'] imageLocation = img['path'] myImage = self.Img(imageLabel, imageLocation) attrValue.append(myImage) else: attrValue = localKeywordArgs[attrName] elif self.neuronClass: attrValue = getattr(self.neuronClass, attrName) # Inherit the value from the class if attrName == 'functions': attrName = '_functions' setattr(self, attrName, attrValue) if self.region is not None: self.region.neurons.append(self)