def demthread(datasource, commonseed, dumpfolder, dpars):
    print(f'{datasource}')
    t0 = time.time()
    video_real = np.swapaxes(scipy.io.loadmat(datasource)['video_data'], 0, 2)
    dpars['dataset'] = datasource
    starttime = int(time.time()*10E5*np.random.rand())
    print(starttime)
    video_real = video_real[-500:]
    [traces, spatial, err_progress] = sdmx.demix_speckles_video(video_real, dpars)

    picklename = datasource.split('.')[0]+'_%d_%d.pickle'%(commonseed, starttime)
    picklename = dumpfolder+picklename.split('/')[-1]
    filehandler = open(picklename, 'wb')
    dpars['computing time'] = time.time()-t0
    dpars['error_progression'] = err_progress
    pickle.dump([traces, spatial, dpars], filehandler, pickle.HIGHEST_PROTOCOL)
    filehandler.close()
    print(f'Written to {picklename}')
Ejemplo n.º 2
0
def demthread(datasource, commonseed, dumpfolder, dpars):
    print(f'{datasource}')
    t0 = time.time()
    video_real = spkstf.extract_from_mat(datasource, 'video_data')
    dpars['dataset'] = datasource
    starttime = int(time.time() * 10E5 * np.random.rand())
    print(starttime)
    # remove the ground truths before demixing
    video_real = video_real[-500:]
    [traces, spatial,
     err_progress] = sdmx.demix_speckles_video(video_real, dpars)

    picklename = datasource.split('.')[0] + '_%d_%d.pickle' % (commonseed,
                                                               starttime)
    picklename = dumpfolder + picklename.split('/')[-1]
    filehandler = open(picklename, 'wb')
    dpars['computing time'] = time.time() - t0
    dpars['error_progression'] = err_progress
    pickle.dump([traces, spatial, dpars], filehandler, pickle.HIGHEST_PROTOCOL)
    filehandler.close()
    print(f'Written to {picklename}')