def __init__(self, config):
        Configurable.__init__(self, config)
        self._add_config_value('tau', quantity)  # membrane time constant
        self._add_config_value('V_rest', quantity)  # resting membrane potential
        self._add_config_value('threshold', quantity)  # spiking threshold
        self._add_config_value('g_leak', quantity)  # leak conductance
        self._add_config_value('refractory_period', quantity)

        self._add_config_value('V_exc', quantity)  # excitatory reversal potential
        self._add_config_value('V_inh', quantity)  # inhibitory reversal potential
        self._add_config_value('I_b', quantity)  # additional current

        self._add_config_value('g_exc_bar', quantity)
        self._add_config_value('g_inh_bar', quantity)
        self._add_config_value('init_inh_w', quantity)
        self._add_config_value('tau_exc', quantity)  # excitat. syn. time constant
        self._add_config_value('tau_inh', quantity)  # inhibit. syn. time constant
        self._add_config_value('tau_stdp', quantity)
        self._add_config_value('tau_w', quantity)
        self._add_config_value('eta', float)
        self._add_config_value('rho', quantity)

        self.alpha = 2 * self.rho * self.tau_stdp

        self.eqs = b.Equations('''
            dg_exc/dt = -g_exc / self.tau_exc : siemens
            I_exc = g_exc * (self.V_exc - V) : amp
            dg_inh/dt = -g_inh / self.tau_inh : siemens
            I_inh = g_inh * (self.V_inh - V) : amp
            dV/dt = ((self.V_rest - V) + (I_exc + I_inh + self.I_b) / \
                self.g_leak) / self.tau : volt
            dx/dt = -x / self.tau_stdp : 1
            ''')
Beispiel #2
0
 def __init__(self):
     Interface.__init__(self, "TC")
     Configurable.__init__(self)
     self.__lastStatus = None
     self.__lastElement = None
     self.__useConfig = {}
     LOG("Created")
    def __init__(self, input_data, model):
        config = input_data.getNodeAttr('/', 'config')
        Configurable.__init__(self, config['recording'])
        self._add_config_value('recording_duration', quantity)
        self._add_config_value('rate_bin_size', quantity)
        self._add_config_value('store_times', quantity_list)
        self._add_config_value('current_timestep', int)
        self._add_config_value('weights_timestep', int)
        self.input_data = input_data
        self.dt = quantity(config['dt'])
        self.model = model

        self.m_spikes = b.SpikeMonitor(model.neuron)
        self.m_rates = b.PopulationRateMonitor(model.neuron, self.rate_bin_size)
        self.m_exc_syn_currents = b.RecentStateMonitor(
            model.neuron, 'I_exc', self.recording_duration,
            timestep=self.current_timestep)
        self.m_inh_syn_currents = b.RecentStateMonitor(
            model.neuron, 'I_inh', self.recording_duration,
            timestep=self.current_timestep)
        self.m_exc_weights = b.StateMonitor(
            model.exc_synapses, 'w', record=True,
            timestep=self.weights_timestep)
        self.m_inh_weights = b.StateMonitor(
            model.inh_synapses, 'w', record=True,
            timestep=self.weights_timestep)

        self.model.add(
            self.m_spikes, self.m_rates, self.m_exc_syn_currents,
            self.m_inh_syn_currents, self.m_exc_weights, self.m_inh_weights)
Beispiel #4
0
 def __init__(self):
     Interface.__init__(self, "RSC")
     Configurable.__init__(self)
     LOG("Created")
     self.toCheck = [ 'TM', 'TC' ]
     self.rscStatus = {}
     self.rscCallbacks = []
Beispiel #5
0
 def __init__(self):
     Interface.__init__(self, "TC")
     Configurable.__init__(self)
     self.__lastStatus = None
     self.__lastElement = None
     self.__useConfig = {}
     LOG("Created")
    def __init__(self, config, model):
        Configurable.__init__(self, config)
        self._add_config_value('stimulus_duration', quantity)
        self._add_config_value('num_trials', int)
        self.model = model

        self.m_spikes = b.SpikeMonitor(model.neuron)
        self.model.add(self.m_spikes)
Beispiel #7
0
 def __init__(self):
     Interface.__init__(self, "TM")
     Configurable.__init__(self)
     self.__tmParameters = {}
     self.__verifiers = []
     self.__verifTable = []
     self.__verifMutex = thread.allocate_lock()
     self.__ctxName = None
     LOG("Created")
Beispiel #8
0
 def __init__(self, tcClass, cmd, description = ""):
     Configurable.__init__(self)
     self.__tcClass = tcClass
     self.__cmdName = cmd
     self.__cmdDescription = description
     self.__parameters= []
     self.__completed       = [False]
     self.__success         = [False]
     self.__elements        = [ self.__cmdName ]
     self.__executionStage  = ['UKN']
     self.__executionStatus = ['UKN']
     self.__comment         = [" "]
     self.__updateTime      = [" "]
Beispiel #9
0
 def __init__(self, config, duration=None):
     Configurable.__init__(self, config)
     self._add_config_value('peak_firing_rate', quantity)
     self._add_config_value('background_activity', quantity)
     self._add_config_value('sparseness', int)
     self._add_config_value('approximate_normalization', float)
     self._add_config_value('filter_time_constant', quantity)
     self._add_config_value('dt', quantity)
     self.current_raw_value = 0.0
     self.current_time = 0.0 * brian.second
     self.sparsification_start = 1
     self.signal = None
     self.duration = duration
Beispiel #10
0
 def __init__(self, tcClass, cmd, description=""):
     Configurable.__init__(self)
     self.__tcClass = tcClass
     self.__cmdName = cmd
     self.__cmdDescription = description
     self.__parameters = []
     self.__completed = [False]
     self.__success = [False]
     self.__elements = [self.__cmdName]
     self.__executionStage = ['UKN']
     self.__executionStatus = ['UKN']
     self.__comment = [" "]
     self.__updateTime = [" "]
 def __init__(self, tmClass, name, description = None):
     
     # Super constructor
     Configurable.__init__(self)
     # Initialize basics
     self._tmClass = tmClass
     self._name = name
     self._description = description
     self._rawValue = None
     self._engValue = None
     self._status = None
     # Default item configuration is given by the TM interface
     # TM interface shall be a Configurable as well
     self.setConfig( tmClass )
Beispiel #12
0
    def __init__(self, tmClass, name, description=None):

        # Super constructor
        Configurable.__init__(self)
        # Initialize basics
        self._tmClass = tmClass
        self._name = name
        self._description = description
        self._rawValue = None
        self._engValue = None
        self._status = None
        # Default item configuration is given by the TM interface
        # TM interface shall be a Configurable as well
        self.setConfig(tmClass)
Beispiel #13
0
    def __init__(self, config, outfile):
        Configurable.__init__(self, config)
        self._add_config_value('epoch_duration', quantity)
        self._add_config_value('num_tunings', int)
        self._add_config_value('num_epochs', int)
        self._add_config_value('eta', float)
        self._add_config_value('rho', quantity)

        self.outfile = outfile

        self.exc_weights = 0.5 * (0.35 + 1.1 / (
            1.0 + (np.arange(self.num_tunings) - 4) ** 4))
        self.inh_weights = np.empty(self.num_tunings)
        self.inh_weights.fill(0.05)
        self.signal_gens = [InputSignalGenerator(
            self._config['raw_signals'], self.epoch_duration)
            for i in xrange(self.num_tunings)]
Beispiel #14
0
    def __init__(self, config, duration=None):
        Configurable.__init__(self, config)

        self._add_config_value('num_tunings', int)
        self._add_config_value('num_trains', int)
        self._add_config_value('fraction_inhibitory', float)
        self._add_config_value('refractory_period', quantity)

        self.num_trains_per_tuning = self.num_trains // self.num_tunings
        self.num_inhibitory = int(self.fraction_inhibitory * self.num_trains)
        self.num_excitatory = self.num_trains - self.num_inhibitory
        self.num_inhib_per_tuning = self.num_inhibitory / self.num_tunings
        self.num_excit_per_tuning = self.num_excitatory / self.num_tunings

        self.signal_gens = [
            InputSignalGenerator(self._config['raw_signals'], duration)
            for i in xrange(self.num_tunings)]
        time_gens = [PoissonSpikeTimesGenerator(
            gen, self.neuron_indices_of_group(i), self.refractory_period)
            for i, gen in enumerate(self.signal_gens)]
        self.merged_times = heapq.merge(*time_gens)
    def __init__(self, config, exc_weights, inh_weights):
        b.Network.__init__(self)
        Configurable.__init__(self, config)
        self._add_config_value('stimulus_duration', quantity)

        builder = TrainedLearningModelBuilder(config['model'])
        self.input_gen = inputs.GroupedSpikeTimesGenerator(
            config['inputs'], self.stimulus_duration)
        self.indexing_scheme = self.input_gen.get_indexing_scheme()

        self.neuron = builder.build_neuron_group()
        self.input_neurons = b.SpikeGeneratorGroup(
            self.input_gen.num_trains, inputs.swap_tuple_values(self.input_gen))
        self.input_groups = ModelInputGroups(
            self.indexing_scheme, self.input_neurons)
        self.exc_synapses = builder.build_exc_synapses(
            self.input_groups.excitatory, self.neuron, exc_weights)
        self.inh_synapses = builder.build_inh_synapses(
            self.input_groups.inhibitory, self.neuron, inh_weights)

        self.add(
            self.neuron, self.input_neurons, self.inh_synapses,
            self.exc_synapses)
Beispiel #16
0
    def __init__(self, config, model):
        Configurable.__init__(self, config)
        self._add_config_value('store_times', quantity_list)
        self.model = model

        self.m_spike_count = b.PopulationSpikeCounter(model.neuron)
Beispiel #17
0
 def __init__(self):
     Interface.__init__(self, "USR")
     Configurable.__init__(self)
     LOG("Created")
Beispiel #18
0
 def __init__(self):
     Interface.__init__(self, "RNG")
     Configurable.__init__(self)
     self.__ctxName = None
     LOG("Created")
Beispiel #19
0
 def __init__(self):
     Interface.__init__(self, "MEM")
     Configurable.__init__(self)
     self.__ctxName = None
     LOG("Created")
 def __init__(self):
     Interface.__init__(self, "USR")
     Configurable.__init__(self)
     LOG("Created")
Beispiel #21
0
 def __init__(self, config):
     Configurable.__init__(self, config)
     self._add_config_value('equations', EquationString('\n'))
     self._add_config_value('pre', EquationString('; '))
     self._add_config_value('post', EquationString('; '))