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)
        help="Path to the input file for which to continue the simulation.")
    parser.add_argument(
        '-t', '--time', type=float, nargs=1, required=True,
        help="Additional time to simulate in seconds.")
    parser.add_argument(
        'output', nargs=1, type=str,
        help="Filename of the HDF5 output file.")
    parser.add_argument(
        'label', nargs='?', type=str,
        help="Label for the simulation. Will create a directory with the same "
        + "to store the produced data.")
    args = parser.parse_args()

    outpath = 'Data'
    if args.label is not None:
        outpath = os.path.join(outpath, args.label)

    with tables.openFile(args.input[0], 'r') as input_data:
        config = input_data.getNodeAttr('/', 'config')
        b.defaultclock.dt = quantity(config['dt'])
        model = SingleCellModel(config)
        model.exc_synapses.w[:, :] = \
            input_data.root.weights.excitatory.weights[:, -1]
        model.inh_synapses.w[:, :] = \
            input_data.root.weights.inhibitory.weights[:, -1]
        recorder = SingleCellModelContinuedRecorder(input_data, model)

        with tables.openFile(os.path.join(outpath, args.output[0]), 'w') as outfile:
            outfile.setNodeAttr('/', 'config', config)
            recorder.record(outfile, args.time[0] * b.second)
Beispiel #3
0
    p.write(
        quantity, ['model', 'tau_exc'], r'\tau_{\text{E}}',
        'Decay constant of excitatory synaptic conductance')
    p.write(
        quantity, ['model', 'tau_inh'], r'\tau_{\text{I}}',
        'Decay constant of inhibitory synaptic conductance')
    end_section()

    start_section('Plasticity Model')
    p.write(
        quantity, ['model', 'tau_stdp'], r'\tau_{\text{STDP}}',
        'Decay constant of (pre and post) synaptic trace')
    p.write(float, ['model', 'eta'], r'\eta\I{}', 'Learning rate of inhibitory synapses')
    print r'$\eta\E{}$ & 0.0025, 0.005, 0.0075 & Learning rate of excitatory synapses\\'
    init_inh_w = set(str(
        config.quantity(c['model']['init_inh_w']) /
        config.quantity(c['model']['g_inh_bar'])) for c in p.configs)
    print r'$w\I{,i}(\SI{0}{\second})$ & %s & Initial inhibitory synaptic weights\\' % \
        ", ".join(init_inh_w)
    init_exc_w = r''''''
    print r'''$w\E{,j}(\SI{0}{\second})$ &
        $0.3 + \frac{1.1}{1 + (K(j) - P)^4} + \xi$ &
        Initial excitatory synaptic weights with input signal number
        $K(i) \in [1, N_S]$ of synapse $j$, position of the tuning curve peak $P$,
        and a noise term $\xi \in [0, 0.1]$\\'''
    print r'$P$ & 5 & Peak of the tuning curve\\'
    p.write(
        quantity, ['model', 'g_exc_bar'], r'\bar g_{\text{E}}',
        'Excitatory synaptic weight change to conductance conversion factor')
    p.write(
        quantity, ['model', 'g_inh_bar'], r'\bar g_{\text{I}}',