Beispiel #1
0
def STA_stats( spikes = data['spikes'] ):
    stats = retina.accumulate_statistics( 
            retina.read_stimulus( data['spikes'],
                                 stimulus_pattern='cone_input_%d.mat' ,
                                 skip_pattern=(5,0) ) )
    print 'calculated STAs'
    sys.stdout.flush()
    return stats
Beispiel #2
0
def make_sparse_stats( rgc_type='off midget', stats={}, skip_pattern=None ):
    print 'Fitting sparse stats for',len(stats['rgc_index']),'RGCs'
    stats.update( retina.accumulate_statistics( 
        data_generator = retina.read_stimulus( stats['spikes'] , 
                                               skip_pattern=skip_pattern) ,
        feature        = lambda x : x                   ,
        pipelines      = retina.fit_U                    ,
        sparse_index   = stats['sparse_index']          ))
    return stats
Beispiel #3
0
def fit_U_stats( rgc_type='off midget', keep=15, stats=stats ):
    which_rgc = [i for i,ind in enumerate(data['rgc_ids'])
                   if  ind   in data['rgc_types'][rgc_type]]
    spikes = data['spikes'][which_rgc,:]
    sparse_index = [n_largest( sta, keep=keep ) for sta in stats['STA']]
    stats['rgc_type']  = rgc_type
    stats['rgc_index'] = which_rgc
    stats.update( retina.accumulate_statistics( 
        data_generator = retina.read_stimulus( spikes ) ,
        feature        = lambda x : x                   ,
        pipelines      = retina.fit_U                    ,
        sparse_index   = sparse_index                   ))
    return stats
Beispiel #4
0
def simulated_STAC( filename=None, rgctype='off parasol' ):
    print 'Calculating STAC for spikes generated with model', filename
    forward = load_model( filename, rgctype )
    def spike_generator( d ):
        return [numpy.random.poisson(r) for r in forward.rates(d)]
    stats = STA_stats()
    stats = make_sparse_indices( rgctype, stats )
    stats.update( retina.accumulate_statistics( 
        data_generator = retina.simulate_data( spike_generator,
                         retina.read_stimulus( which_spikes( rgctype) , 
                                               skip_pattern=(-5,0))) ,
        pipelines      = retina.fit_U                    ,
        sparse_index   = stats['sparse_index']          ))
    return stats