Exemple #1
0
def SimSpikingStimulus(N_INPUTS, **kwargs):
    '''
    Times must be sorted. ex: times = [0, 1, 2] ; scale = [1,0]
    *poisson*: integer, output is a poisson process with mean data/poisson, scaled by *poisson*.
    '''
    # Generate input spike pattern
    #ids,spkt,tp,p = genEmbeddedSpikePattern(N=N_INPUTS, 
    #                                        rate=kwargs['f'], 
    #                                        t=kwargs['t_sim'], 
    #                                        pf=kwargs['pf'], 
    #                                        pd=kwargs['tp'], 
    #                                        target= 'mixed',
    #                                        NP=kwargs['NP'],
    #                                        jitter=kwargs['jitter'],
    #                                        target_patterns=['random',
    #                                                         'random',
    #                                                         'random',
    #                                                         'random']
    #                                       )
    ids, spkt, tp, p, pds = genEmbeddedSpikePattern(N=N_INPUTS,
                                               t=kwargs['t_sim'],
                                               pf=kwargs['pf']*kwargs['NP'],
                                               pd=50,
                                               rate = kwargs['f'],
                                               target=range(kwargs['NP']))

    # Input spike pattern
    stimSpk = np.concatenate([[ids],[spkt]]).T
    stimSpk = stimSpk.astype(int)
    SL = nsat.build_SpikeList(spkt, ids)

    return SL, tp, p
Exemple #2
0
def SimSpikingStimulus(N_INPUTS, **kwargs):
    '''
    Times must be sorted. ex: times = [0, 1, 2] ; scale = [1,0]
    *poisson*: integer, output is a poisson process with mean data/poisson, scaled by *poisson*.
    '''
    ids, spkt, tp = genCoincidencePattern(N=N_INPUTS,
                                          t=kwargs['t_sim'],
                                          pf=kwargs['pf'],
                                          rate=kwargs['f'],
                                          Nf_co=0.1,
                                          jitter=kwargs['jitter'])

    # Input spike pattern
    stimSpk = np.concatenate([[ids], [spkt]]).T
    stimSpk = stimSpk.astype(int)
    SL = nsat.build_SpikeList(spkt, ids)
    add = SL.id_list().astype('i')
    SL_shuffled = pyST.SpikeList(id_list=range(max(add)))
    # g = np.arange(110)
    np.random.shuffle(add)
    for i, k in enumerate(add):
        SL_shuffled[i] = SL[k]
    return SL_shuffled, tp
Exemple #3
0
        cont = f.read()
    size = int(len(cont) / 4)
    return np.array(st.unpack('i' * size, cont))


if __name__ == '__main__':
    cfg = pyNSATlib.ConfigurationNSAT(N_CORES=2,
                                      N_INPUTS=[10, 10],
                                      N_NEURONS=[512, 100],
                                      N_STATES=[4, 2],
                                      bm_rng=True,
                                      ben_clock=True)

    cfg.core_cfgs[0].W[:cfg.core_cfgs[0].n_inputs,
                       cfg.core_cfgs[0].n_inputs:] = 1
    cfg.core_cfgs[0].CW[:cfg.core_cfgs[0].n_inputs,
                        cfg.core_cfgs[0].n_inputs:] = 1
    cfg.core_cfgs[1].W[:cfg.core_cfgs[1].n_inputs,
                       cfg.core_cfgs[1].n_inputs:] = 1
    cfg.core_cfgs[1].CW[:cfg.core_cfgs[1].n_inputs,
                        cfg.core_cfgs[1].n_inputs:] = 1
    cfg.set_L1_connectivity({(0, 1): ((1, 0), (1, 1))})

    SL1 = pyNSATlib.build_SpikeList(evs_time=[1, 2, 3], evs_addr=[5, 6, 7])
    SL2 = pyNSATlib.build_SpikeList(evs_time=[2, 5, 1], evs_addr=[3, 9, 5])
    evs = pyNSATlib.exportAER([SL1, SL2])
    cfg.set_ext_events(evs)

    c_nsat_writer = C_NSATWriter(cfg, path='/tmp/', prefix='test')
    c_nsat_writer.write()