Ejemplo n.º 1
0
def get_data(filename):
    
    bload = bcontrol.Bcontrol_Loader(filename, mem_behavior = True, auto_validate = 0) 
    bdata = bload.load()
    bcontrol.process_for_saving(bdata)
    
    return bdata
Ejemplo n.º 2
0
def load_bhv_data(filename):
    ''' Accepts a file name (the absolute path) to a .mat file containing
        recorded behavior data.  Returns a dictionary with the data in a form
        that can be used in Python '''
        
    bload = bcontrol.Bcontrol_Loader(filename, mem_behavior = True, auto_validate = 0) 
    bdata = bload.load()
    bcontrol.process_for_saving(bdata)
    
    return bdata
Ejemplo n.º 3
0
    loader = ns5.Loader(neural_file)
    loader.load_header()
    loader.load_file()
       
    audio = [ loader.get_analog_channel_as_array(n) for n in [7,8] ] 
    audio = np.array(audio)*4096./2**16
        
    onsets_obj = AudioTools.OnsetDetector(audio, verbose = True, 
        minimum_threshhold=-20)
    onsets_obj.execute()
    n_onsets = Onsets(onsets_obj.detected_onsets)

        
    bcload = bcontrol.Bcontrol_Loader(filename = behave_file, mem_behavior= True, auto_validate = 0) 
    bcdata = bcload.load()
    b_onsets = Onsets(bcdata['onsets'])
       
    syncer = DataSession.BehavingSyncer()
    syncer.sync(b_onsets,n_onsets, force_run = 1)
       
    with open(save_as + '.bhv','w') as f:
        bcontrol.process_for_saving(bcdata)
        pkl.dump(bcdata,f)

    with open(save_as + '.ons','w') as f:
        pkl.dump(n_onsets.audio_onsets,f)
         
    with open(save_as+ '.syn','w') as f:
        pkl.dump(syncer,f)