Esempio n. 1
0
 def connect_to_input(self, source: Nucleus):
     source.nuclei(Neurotransmitters.GLU.value).connect(
         nucleus=self.__structure[0].get_right_group().nuclei(Neurotransmitters.GLU.value),
         synapse=Synapses.GLUTAMATERGIC.value,
         weight=Weights.MR.value,
         conn_type=ConnectionTypes.ALL_TO_ALL.value
     )
Esempio n. 2
0
    def __init__(self, index: int):

        self.index = index

        self.left_excitatory = Nucleus(
            nucleus_name='HiddenTier{}LeftExcitatory'.format(self.index))
        self.right_excitatory = Nucleus(
            nucleus_name='HiddenTier{}RightExcitatory'.format(self.index))
        self.right_inhibitory = Nucleus(
            nucleus_name='HiddenTier{}RightInhibitory'.format(self.index))
        self.left_inhibitory = Nucleus(
            nucleus_name='HiddenTier{}LeftInhibitory'.format(self.index))

        self.left_excitatory.addSubNucleus(
            neurotransmitter=Neurotransmitters.GLU.value,
            number=Constants.NEURONS_IN_GROUP.value,
            params=Neurons.NEUCOGAR.value)
        self.right_excitatory.addSubNucleus(
            neurotransmitter=Neurotransmitters.GLU.value,
            number=Constants.NEURONS_IN_GROUP.value,
            params=Neurons.NEUCOGAR.value)
        self.left_inhibitory.addSubNucleus(
            neurotransmitter=Neurotransmitters.GABA.value,
            number=Constants.NEURONS_IN_GROUP.value,
            params=Neurons.NEUCOGAR.value)
        self.right_inhibitory.addSubNucleus(
            neurotransmitter=Neurotransmitters.GABA.value,
            number=Constants.NEURONS_IN_GROUP.value,
            params=Neurons.NEUCOGAR.value)

        self.add_neurons(Constants.NEURONS_IN_GROUP.value * 4)
Esempio n. 3
0
 def connect_output_to_pool(self, pool: Nucleus):
     for tier in self.__structure:
         tier.get_left_group().nuclei(Neurotransmitters.GLU.value).connect(
             nucleus=pool.nuclei(Neurotransmitters.GLU.value),
             synapse=Synapses.GLUTAMATERGIC.value,
             weight=Weights.LIP.value[tier.get_tier()+1],
             conn_type=ConnectionTypes.ALL_TO_ALL.value
         )
def connect_spike_generator(target: Nucleus):
    spike_generator = api_kernel.NEST.Create(
        'spike_generator', 1, {
            'spike_times': Constants.SPIKE_GENERATOR_TIMES.value,
            'spike_weights': Constants.SPIKE_GENERATOR_WEIGHTS.value
        })

    api_kernel.NEST.Connect(
        spike_generator,
        target.nuclei(Neurotransmitters.GLU.value).getNeurons())
Esempio n. 5
0
    def __init__(self):
        self.polysynaptic_circuit = PolysynapticCircuit()
        self.mediator = Nucleus('Mediator')
        self.interneuronal_pool = Nucleus('InterneuronalPool')

        self.mediator.addSubNucleus(
            neurotransmitter=Neurotransmitters.GLU.value,
            number=1,
            params=Neurons.NEUCOGAR.value)

        self.interneuronal_pool.addSubNucleus(
            neurotransmitter=Neurotransmitters.GLU.value,
            number=1,
            params=Neurons.NEUCOGAR.value)

        CreateNetwork(simulation_neuron_number=PolysynapticCircuit.
                      get_number_of_neurons() + 2)
        self.set_connections()
        self.connect_multimeters()
        self.connect_spike_generator()
Esempio n. 6
0
    def __init__(self, index: int):
        """
        Args:
            index: a number of the index in order
        """
        self.index = index

        self.left_group = Nucleus(nucleus_name='Tier{}Left'.format(index))
        self.left_group.addSubNucleus(
            neurotransmitter=Neurotransmitters.GLU.value,
            number=Constants.NEURONS_IN_GROUP.value,
            params=Neurons.NEUCOGAR.value)

        self.right_group = Nucleus(nucleus_name='Tier{}Right'.format(index))
        self.right_group.addSubNucleus(
            neurotransmitter=Neurotransmitters.GLU.value,
            number=Constants.NEURONS_IN_GROUP.value,
            params=Neurons.NEUCOGAR.value)

        self.inhibitory_group = Nucleus(
            nucleus_name='Tier{}Inhibitory'.format(index))
        self.inhibitory_group.addSubNucleus(
            neurotransmitter=Neurotransmitters.GABA.value,
            number=Constants.NEURONS_IN_GROUP.value,
            params=Neurons.NEUCOGAR.value)

        self.add_neurons(Constants.NEURONS_IN_GROUP.value * 3)
Esempio n. 7
0
    def __init__(self, tier, inhibitory_group=False):

        self.tier = tier

        self.left_group = Nucleus(nucleus_name='Tier{}Left'.format(tier))
        self.left_group.addSubNucleus(
            neurotransmitter=Neurotransmitters.GLU.value,
            number=Constants.NEURONS_IN_GROUP.value,
            params=Neurons.NEUCOGAR.value)

        self.right_group = Nucleus(nucleus_name='Tier{}Right'.format(tier))
        self.right_group.addSubNucleus(
            neurotransmitter=Neurotransmitters.GLU.value,
            number=Constants.NEURONS_IN_GROUP.value,
            params=Neurons.NEUCOGAR.value)

        if inhibitory_group:
            self.inhibitory_group = Nucleus(
                nucleus_name='Tier{}Inhibitory'.format(tier))
            self.inhibitory_group.addSubNucleus(
                neurotransmitter=Neurotransmitters.GABA.value,
                number=Constants.NEURONS_IN_GROUP.value,
                params=Neurons.NEUCOGAR.value)

        self.right_group.nuclei(Neurotransmitters.GLU.value).connect(
            nucleus=self.left_group.nuclei(Neurotransmitters.GLU.value),
            synapse=Synapses.GLUTAMATERGIC.value,
            weight=Weights.RL.value.reverse()[tier - 1],
            conn_type=ConnectionTypes.ONE_TO_ONE.value)

        self.left_group.nuclei(Neurotransmitters.GLU.value).connect(
            nucleus=self.right_group.nuclei(Neurotransmitters.GLU.value),
            synapse=Synapses.GLUTAMATERGIC.value,
            weight=Weights.LR.value.reverse()[tier - 1],
            conn_type=ConnectionTypes.ONE_TO_ONE.value)

        if inhibitory_group:
            self.inhibitory_group.nuclei(Neurotransmitters.GABA.value).connect(
                nucleus=self.right_group.nuclei(Neurotransmitters.GLU.value),
                synapse=Synapses.GABAERGIC.value,
                weight=Weights.IR.value.reverse()[tier - 1],
                conn_type=ConnectionTypes.ONE_TO_ONE.value)
Esempio n. 8
0
from neucogar.namespaces import *
from neucogar.Nucleus import Nucleus
from neucogar.api_kernel import CreateNetwork

from .parameters import *

hippocampus = Nucleus("Hippocampus")
hippocampus.addSubNucleus(Glu, params=nrn_parameters,
                          number=5000)  # ToDo Check
hippocampus.addSubNucleus(GABA, params=nrn_parameters,
                          number=1000)  # ToDo Check

amygdala = Nucleus("Amygdala")
amygdala.addSubNucleus(Glu, params=nrn_parameters,
                       number=3000)  # ToDo not real

hypothalamus = Nucleus("Hypothalamus")
hypothalamus.addSubNucleus(Glu, params=nrn_parameters,
                           number=1000)  # ToDo not real
hypothalamus.addSubNucleus(GABA, params=nrn_parameters,
                           number=1000)  # ToDo not real

drn = Nucleus("Raphe nucleus")
drn.addSubNucleus(HT5, params=nrn_parameters, number=15000)
drn.addSubNucleus(GABA, params=nrn_parameters, number=1000)  # ToDo not real

locus_coeruleus = Nucleus("Locus coeruleus")
locus_coeruleus.addSubNucleus(NA, params=nrn_parameters, number=1500)

CreateNetwork(28000)
Esempio n. 9
0
 def __init__(self, column_index):
     # Create Nucleus objects and put into the dict of the layers
     self._dict_layers = {
         L2: Nucleus("Column {} Layer 2".format(column_index)),
         L3: Nucleus("Column {} Layer 3".format(column_index)),
         L4: Nucleus("Column {} Layer 4".format(column_index)),
         L5A: Nucleus("Column {} Layer 5A".format(column_index)),
         L5B: Nucleus("Column {} Layer 5B".format(column_index)),
         L6: Nucleus("Column {} Layer 6".format(column_index))
     }
     # Add sub-nucleui and create neurons without sqaling (because of flag 'forColumns'=True)
     self.layers(L2).addSubNucleus(Glu,
                                   number=546,
                                   params=self._nrn_parameters,
                                   forColumns=True)
     self.layers(L2).addSubNucleus(GABA,
                                   number=107,
                                   params=self._nrn_parameters,
                                   forColumns=True)
     self.layers(L3).addSubNucleus(Glu,
                                   number=1145,
                                   params=self._nrn_parameters,
                                   forColumns=True)
     self.layers(L3).addSubNucleus(GABA,
                                   number=123,
                                   params=self._nrn_parameters,
                                   forColumns=True)
     self.layers(L4).addSubNucleus(Glu,
                                   number=1656,
                                   params=self._nrn_parameters,
                                   forColumns=True)
     self.layers(L4).addSubNucleus(GABA,
                                   number=140,
                                   params=self._nrn_parameters,
                                   forColumns=True)
     self.layers(L5A).addSubNucleus(Glu,
                                    number=454,
                                    params=self._nrn_parameters,
                                    forColumns=True)
     self.layers(L5A).addSubNucleus(GABA,
                                    number=90,
                                    params=self._nrn_parameters,
                                    forColumns=True)
     self.layers(L5B).addSubNucleus(Glu,
                                    number=641,
                                    params=self._nrn_parameters,
                                    forColumns=True)
     self.layers(L5B).addSubNucleus(GABA,
                                    number=131,
                                    params=self._nrn_parameters,
                                    forColumns=True)
     self.layers(L6).addSubNucleus(Glu,
                                   number=1288,
                                   params=self._nrn_parameters,
                                   forColumns=True)
     self.layers(L6).addSubNucleus(GABA,
                                   number=127,
                                   params=self._nrn_parameters,
                                   forColumns=True)
     # Invoke method to create synapses
     self.setConnectomes()
Esempio n. 10
0
class Tier:
    def __init__(self, tier, inhibitory_group=False):

        self.tier = tier

        self.left_group = Nucleus(nucleus_name='Tier{}Left'.format(tier))
        self.left_group.addSubNucleus(
            neurotransmitter=Neurotransmitters.GLU.value,
            number=Constants.NEURONS_IN_GROUP.value,
            params=Neurons.NEUCOGAR.value)

        self.right_group = Nucleus(nucleus_name='Tier{}Right'.format(tier))
        self.right_group.addSubNucleus(
            neurotransmitter=Neurotransmitters.GLU.value,
            number=Constants.NEURONS_IN_GROUP.value,
            params=Neurons.NEUCOGAR.value)

        if inhibitory_group:
            self.inhibitory_group = Nucleus(
                nucleus_name='Tier{}Inhibitory'.format(tier))
            self.inhibitory_group.addSubNucleus(
                neurotransmitter=Neurotransmitters.GABA.value,
                number=Constants.NEURONS_IN_GROUP.value,
                params=Neurons.NEUCOGAR.value)

        self.right_group.nuclei(Neurotransmitters.GLU.value).connect(
            nucleus=self.left_group.nuclei(Neurotransmitters.GLU.value),
            synapse=Synapses.GLUTAMATERGIC.value,
            weight=Weights.RL.value.reverse()[tier - 1],
            conn_type=ConnectionTypes.ONE_TO_ONE.value)

        self.left_group.nuclei(Neurotransmitters.GLU.value).connect(
            nucleus=self.right_group.nuclei(Neurotransmitters.GLU.value),
            synapse=Synapses.GLUTAMATERGIC.value,
            weight=Weights.LR.value.reverse()[tier - 1],
            conn_type=ConnectionTypes.ONE_TO_ONE.value)

        if inhibitory_group:
            self.inhibitory_group.nuclei(Neurotransmitters.GABA.value).connect(
                nucleus=self.right_group.nuclei(Neurotransmitters.GLU.value),
                synapse=Synapses.GABAERGIC.value,
                weight=Weights.IR.value.reverse()[tier - 1],
                conn_type=ConnectionTypes.ONE_TO_ONE.value)

    def connect_to_tier(self, tier):
        """
        Connects this tier to another tier
        Args:
            tier: Tier

        Returns:
            bool

        """

        if self.tier - tier.get_tier() == 1:

            self.left_group.nuclei(Neurotransmitters.GLU.value).connect(
                nucleus=tier.get_left_group().nuclei(
                    Neurotransmitters.GLU.value),
                synapse=Synapses.GLUTAMATERGIC.value,
                weight=Weights.LL.value.reverse()[tier.get_tier() - 1],
                conn_type=ConnectionTypes.ONE_TO_ONE.value)

            tier.right_group().nuclei(Neurotransmitters.GLU.value).connect(
                nucleus=self.right_group.nuclei(Neurotransmitters.GLU.value),
                synapse=Synapses.GLUTAMATERGIC.value,
                weight=Weights.RR.value.reverse()[tier.get_tier() - 2],
                conn_type=ConnectionTypes.ONE_TO_ONE.value)

            self.right_group.nuclei(Neurotransmitters.GLU.value).connect(
                nucleus=tier.get_inhibitory_group().nuclei(
                    Neurotransmitters.GLU.value),
                synapse=Synapses.GLUTAMATERGIC.value,
                weight=Weights.RI.value.reverse()[tier.get_tier() - 1],
                conn_type=ConnectionTypes.ONE_TO_ONE.value)

            return True
        else:
            return False

    def get_tier(self):
        return self.tier

    def get_left_group(self):
        return self.left_group

    def get_right_group(self):
        return self.right_group

    def get_inhibitory_group(self):
        return self.inhibitory_group if self.inhibitory_group else None
Esempio n. 11
0
class Layer2:
    def __init__(self):
        self.polysynaptic_circuit = PolysynapticCircuit()
        self.mediator = Nucleus('Mediator')
        self.interneuronal_pool = Nucleus('InterneuronalPool')

        self.mediator.addSubNucleus(
            neurotransmitter=Neurotransmitters.GLU.value,
            number=1,
            params=Neurons.NEUCOGAR.value)

        self.interneuronal_pool.addSubNucleus(
            neurotransmitter=Neurotransmitters.GLU.value,
            number=1,
            params=Neurons.NEUCOGAR.value)

        CreateNetwork(simulation_neuron_number=PolysynapticCircuit.
                      get_number_of_neurons() + 2)
        self.set_connections()
        self.connect_multimeters()
        self.connect_spike_generator()

    def set_connections(self):
        self.mediator.nuclei(Neurotransmitters.GLU.value).connect(
            nucleus=self.polysynaptic_circuit.get_input().nuclei(
                Neurotransmitters.GLU.value),
            synapse=Synapses.GLUTAMATERGIC.value,
            weight=Weights.MR.value,
            conn_type=ConnectionTypes.ALL_TO_ALL.value)
        for tier, weight in zip(self.polysynaptic_circuit.get_output(),
                                Weights.LIP.value[::-1]):
            tier.nuclei(Neurotransmitters.GLU.value).connect(
                nucleus=self.interneuronal_pool.nuclei(
                    Neurotransmitters.GLU.value),
                synapse=Synapses.GLUTAMATERGIC.value,
                weight=weight,
                conn_type=ConnectionTypes.ALL_TO_ALL.value)
        for tier in self.polysynaptic_circuit.get_tiers():
            tier.set_connections()
        for hidden_tier in self.polysynaptic_circuit.get_hidden_tiers():
            hidden_tier.set_connections()

        self.polysynaptic_circuit.set_connections()

    def connect_multimeters(self):
        self.mediator.nuclei(Neurotransmitters.GLU.value).ConnectMultimeter()
        self.interneuronal_pool.nuclei(
            Neurotransmitters.GLU.value).ConnectMultimeter()
        for tier in self.polysynaptic_circuit.get_tiers():
            tier.connect_multimeters()
        for hidden_tier in self.polysynaptic_circuit.get_hidden_tiers():
            hidden_tier.connect_multimeters()

    def connect_spike_generator(self):
        spike_generator = api_kernel.NEST.Create(
            'spike_generator', 1, {
                'spike_times': Constants.SPIKE_GENERATOR_TIMES.value,
                'spike_weights': Constants.SPIKE_GENERATOR_WEIGHTS.value
            })

        api_kernel.NEST.Connect(
            spike_generator,
            self.mediator.nuclei(Neurotransmitters.GLU.value).getNeurons())
    def __init__(self):
        layer2 = Layer2()

        mediator = Nucleus(nucleus_name='Mediator')
        mediator.addSubNucleus(neurotransmitter=Neurotransmitters.GLU.value,
                               number=1,
                               params=Neurons.NEUCOGAR.value)
        mediator.ConnectMultimeter()
        mediator.ConnectDetector()
        connect_spike_generator(mediator)
        layer2.connect_to_input(mediator)

        interneuronal_pool = Nucleus(nucleus_name='Interneuronal_Pool')
        interneuronal_pool.addSubNucleus(
            neurotransmitter=Neurotransmitters.GLU.value,
            number=1,
            params=Neurons.NEUCOGAR.value)
        interneuronal_pool.ConnectMultimeter()
        interneuronal_pool.ConnectDetector()
        layer2.connect_output_to_pool(interneuronal_pool)
Esempio n. 13
0
class Tier:
    __number_of_neurons = 0

    @classmethod
    def add_neurons(cls, number: int):
        cls.__number_of_neurons += number

    @classmethod
    def get_number_of_neurons(cls):
        return cls.__number_of_neurons

    def __init__(self, index: int):
        """
        Args:
            index: a number of the index in order
        """
        self.index = index

        self.left_group = Nucleus(nucleus_name='Tier{}Left'.format(index))
        self.left_group.addSubNucleus(
            neurotransmitter=Neurotransmitters.GLU.value,
            number=Constants.NEURONS_IN_GROUP.value,
            params=Neurons.NEUCOGAR.value)

        self.right_group = Nucleus(nucleus_name='Tier{}Right'.format(index))
        self.right_group.addSubNucleus(
            neurotransmitter=Neurotransmitters.GLU.value,
            number=Constants.NEURONS_IN_GROUP.value,
            params=Neurons.NEUCOGAR.value)

        self.inhibitory_group = Nucleus(
            nucleus_name='Tier{}Inhibitory'.format(index))
        self.inhibitory_group.addSubNucleus(
            neurotransmitter=Neurotransmitters.GABA.value,
            number=Constants.NEURONS_IN_GROUP.value,
            params=Neurons.NEUCOGAR.value)

        self.add_neurons(Constants.NEURONS_IN_GROUP.value * 3)

    def connect_multimeters(self):
        self.right_group.nuclei(
            Neurotransmitters.GLU.value).ConnectMultimeter()
        self.left_group.nuclei(Neurotransmitters.GLU.value).ConnectMultimeter()
        self.inhibitory_group.nuclei(
            Neurotransmitters.GABA.value).ConnectMultimeter()

    def set_connections(self):
        # connect right group to left group
        self.right_group.nuclei(Neurotransmitters.GLU.value).connect(
            nucleus=self.left_group.nuclei(Neurotransmitters.GLU.value),
            synapse=Synapses.GLUTAMATERGIC.value,
            weight=Weights.RL.value[::-1][self.get_index() - 1],
            conn_type=ConnectionTypes.ONE_TO_ONE.value)

        # connect left group to right group
        self.left_group.nuclei(Neurotransmitters.GLU.value).connect(
            nucleus=self.right_group.nuclei(Neurotransmitters.GLU.value),
            synapse=Synapses.GLUTAMATERGIC.value,
            weight=Weights.LR.value[::-1][self.get_index() - 1],
            conn_type=ConnectionTypes.ONE_TO_ONE.value)

        # connect inhibitory group to right group
        self.inhibitory_group.nuclei(Neurotransmitters.GABA.value).connect(
            nucleus=self.right_group.nuclei(Neurotransmitters.GLU.value),
            synapse=Synapses.GABAERGIC.value,
            weight=Weights.IR.value[::-1][self.get_index() - 1],
            conn_type=ConnectionTypes.ONE_TO_ONE.value)

        # connect right group to inhibitory group
        self.right_group.nuclei(Neurotransmitters.GLU.value).connect(
            nucleus=self.inhibitory_group.nuclei(Neurotransmitters.GABA.value),
            synapse=Synapses.GLUTAMATERGIC.value,
            weight=Weights.RI.value[::-1][self.get_index() - 1],
            conn_type=ConnectionTypes.ONE_TO_ONE.value)

    def connect(self, tier):
        """
        Connects this tier to a lower tier
        Args:
            tier (Tier): a lower tier
        Returns:
            bool

        """

        if self.index - tier.get_index() == 1:

            self.left_group.nuclei(Neurotransmitters.GLU.value).connect(
                nucleus=tier.get_left_group().nuclei(
                    Neurotransmitters.GLU.value),
                synapse=Synapses.GLUTAMATERGIC.value,
                weight=Weights.LL.value[::-1][tier.get_index() - 1],
                conn_type=ConnectionTypes.ONE_TO_ONE.value)

            tier.get_right_group().nuclei(Neurotransmitters.GLU.value).connect(
                nucleus=self.right_group.nuclei(Neurotransmitters.GLU.value),
                synapse=Synapses.GLUTAMATERGIC.value,
                weight=Weights.RR.value[::-1][tier.get_index() - 1],
                conn_type=ConnectionTypes.ONE_TO_ONE.value)

            return True
        else:
            return False

    def get_index(self):
        return self.index

    def get_left_group(self):
        return self.left_group

    def get_right_group(self):
        return self.right_group

    def get_inhibitory_group(self):
        return self.inhibitory_group
Esempio n. 14
0
class HiddenTier:
    __number_of_neurons = 0

    @classmethod
    def add_neurons(cls, number: int):
        cls.__number_of_neurons += number

    @classmethod
    def get_number_of_neurons(cls):
        return cls.__number_of_neurons

    def __init__(self, index: int):

        self.index = index

        self.left_excitatory = Nucleus(
            nucleus_name='HiddenTier{}LeftExcitatory'.format(self.index))
        self.right_excitatory = Nucleus(
            nucleus_name='HiddenTier{}RightExcitatory'.format(self.index))
        self.right_inhibitory = Nucleus(
            nucleus_name='HiddenTier{}RightInhibitory'.format(self.index))
        self.left_inhibitory = Nucleus(
            nucleus_name='HiddenTier{}LeftInhibitory'.format(self.index))

        self.left_excitatory.addSubNucleus(
            neurotransmitter=Neurotransmitters.GLU.value,
            number=Constants.NEURONS_IN_GROUP.value,
            params=Neurons.NEUCOGAR.value)
        self.right_excitatory.addSubNucleus(
            neurotransmitter=Neurotransmitters.GLU.value,
            number=Constants.NEURONS_IN_GROUP.value,
            params=Neurons.NEUCOGAR.value)
        self.left_inhibitory.addSubNucleus(
            neurotransmitter=Neurotransmitters.GABA.value,
            number=Constants.NEURONS_IN_GROUP.value,
            params=Neurons.NEUCOGAR.value)
        self.right_inhibitory.addSubNucleus(
            neurotransmitter=Neurotransmitters.GABA.value,
            number=Constants.NEURONS_IN_GROUP.value,
            params=Neurons.NEUCOGAR.value)

        self.add_neurons(Constants.NEURONS_IN_GROUP.value * 4)

    def connect_multimeters(self):
        self.left_excitatory.nuclei(
            Neurotransmitters.GLU.value).ConnectMultimeter()
        self.right_excitatory.nuclei(
            Neurotransmitters.GLU.value).ConnectMultimeter()
        self.left_inhibitory.nuclei(
            Neurotransmitters.GABA.value).ConnectMultimeter()
        self.right_inhibitory.nuclei(
            Neurotransmitters.GABA.value).ConnectMultimeter()

    def set_connections(self):
        self.left_excitatory.nuclei(Neurotransmitters.GLU.value).connect(
            nucleus=self.right_excitatory.nuclei(Neurotransmitters.GLU.value),
            synapse=Synapses.GLUTAMATERGIC.value,
            weight=HiddenWeights.LR.value[::-1][self.index - 1],
            conn_type=ConnectionTypes.ONE_TO_ONE.value)
        self.right_excitatory.nuclei(Neurotransmitters.GLU.value).connect(
            nucleus=self.left_excitatory.nuclei(Neurotransmitters.GLU.value),
            synapse=Synapses.GLUTAMATERGIC.value,
            weight=HiddenWeights.RL.value[::-1][self.index - 1],
            conn_type=ConnectionTypes.ONE_TO_ONE.value)
        self.right_excitatory.nuclei(Neurotransmitters.GLU.value).connect(
            nucleus=self.left_inhibitory.nuclei(Neurotransmitters.GABA.value),
            synapse=Synapses.GABAERGIC.value,
            weight=HiddenWeights.RI.value[::-1][self.index - 1],
            conn_type=ConnectionTypes.ONE_TO_ONE.value)
        self.left_inhibitory.nuclei(Neurotransmitters.GABA.value).connect(
            nucleus=self.right_excitatory.nuclei(Neurotransmitters.GLU.value),
            synapse=Synapses.GABAERGIC.value,
            weight=HiddenWeights.IR.value[::-1][self.index - 1],
            conn_type=ConnectionTypes.ONE_TO_ONE.value)

    def get_index(self):
        return self.index

    def get_right_excitatory(self):
        return self.right_excitatory

    def get_right_inhibitory(self):
        return self.right_inhibitory

    def connect(self, upper_tier: Tier, lower_tier: Tier):

        self.get_right_excitatory().nuclei(
            Neurotransmitters.GLU.value).connect(
                nucleus=upper_tier.get_right_group().nuclei(
                    Neurotransmitters.GLU.value),
                synapse=Synapses.GLUTAMATERGIC.value,
                weight=HiddenWeights.RRU.value[::-1][self.get_index() - 1],
                conn_type=ConnectionTypes.ONE_TO_ONE.value)

        self.get_right_inhibitory().nuclei(
            Neurotransmitters.GABA.value).connect(
                nucleus=lower_tier.get_right_group().nuclei(
                    Neurotransmitters.GLU.value),
                synapse=Synapses.GABAERGIC.value,
                weight=HiddenWeights.IRD.value[::-1][self.get_index() - 1],
                conn_type=ConnectionTypes.ONE_TO_ONE.value)

        upper_tier.get_right_group().nuclei(
            Neurotransmitters.GLU.value).connect(
                nucleus=self.get_right_inhibitory().nuclei(
                    Neurotransmitters.GABA.value),
                synapse=Synapses.GLUTAMATERGIC.value,
                weight=HiddenWeights.RID.value[::-1][self.get_index() - 1],
                conn_type=ConnectionTypes.ONE_TO_ONE.value)

        lower_tier.get_right_group().nuclei(
            Neurotransmitters.GLU.value).connect(
                nucleus=self.get_right_excitatory().nuclei(
                    Neurotransmitters.GLU.value),
                synapse=Synapses.GLUTAMATERGIC.value,
                weight=HiddenWeights.RDR.value[::-1][self.get_index() - 1],
                conn_type=ConnectionTypes.ONE_TO_ONE.value)
Esempio n. 15
0
from neucogar.Nucleus import Nucleus
from neucogar.api_kernel import CreateNetwork

from neucogar.namespaces import *
from parameters import *

motor_cortex = Nucleus("Motor cortex")
motor_cortex.addSubNucleus(Glu_0, params=nrn_parameters, number=3866666)
motor_cortex.addSubNucleus(Glu_1, params=nrn_parameters, number=966666)

thalamus = Nucleus("Thalamus")
thalamus.addSubNucleus(Glu, params=nrn_parameters, number=833333)

striatum = Nucleus("Striatum")
striatum.addSubNucleus(GABA_D1, params=nrn_parameters, number=1062500)
striatum.addSubNucleus(GABA_D2, params=nrn_parameters, number=1062500)

gpe = Nucleus("GPe")
gpe.addSubNucleus(GABA, params=nrn_parameters, number=84100)

gpi = Nucleus("GPi")
gpi.addSubNucleus(GABA, params=nrn_parameters, number=12600)

stn = Nucleus("STN")
stn.addSubNucleus(Glu, params=nrn_parameters, number=22700)

snr = Nucleus("SNr")
snr.addSubNucleus(GABA, params=nrn_parameters, number=47200)

snc = Nucleus("SNc")
snc.addSubNucleus(DA, params=nrn_parameters, number=12700)