def main():

    if len(sys.argv) == 1:
        directory = '.'
        FILES = [f for f in os.listdir('.') if f.lower().endswith('.h5')]
    elif len(sys.argv) == 2 and sys.argv[1] in ('-h','--help'):
        usage()
        sys.exit(0)
    else:
        FILES = sys.argv[1:]

    for F in FILES:
        if os.path.isdir(F):
            files = [f for f in os.listdir(F) if f.lower().endswith('.h5')]
            for f in files:
                print('Processing file [%s/%s].' % (F,f))
                try:
                    lcg.computeElectrodeKernel(F + '/' + f)
                except:
                    print('%s/%s: not a valid H5 file.' % (F,f))
        elif os.path.isfile(F):
            print('Processing file [' + F + '].')
            try:
                lcg.computeElectrodeKernel(F)
            except:
                print('%s: not a valid H5 file.' % F)
        else:
            print(F + ': no such file or directory.')
            sys.exit(1)
Exemple #2
0
def main():

    if len(sys.argv) == 1:
        directory = '.'
        FILES = [f for f in os.listdir('.') if f.lower().endswith('.h5')]
    elif len(sys.argv) == 2 and sys.argv[1] in ('-h', '--help'):
        usage()
        sys.exit(0)
    else:
        FILES = sys.argv[1:]

    for F in FILES:
        if os.path.isdir(F):
            files = [f for f in os.listdir(F) if f.lower().endswith('.h5')]
            for f in files:
                print('Processing file [%s/%s].' % (F, f))
                try:
                    lcg.computeElectrodeKernel(F + '/' + f)
                except:
                    print('%s/%s: not a valid H5 file.' % (F, f))
        elif os.path.isfile(F):
            print('Processing file [' + F + '].')
            try:
                lcg.computeElectrodeKernel(F)
            except:
                print('%s: not a valid H5 file.' % F)
        else:
            print(F + ': no such file or directory.')
            sys.exit(1)
Exemple #3
0
    if append:
        suffix = '-' + str(ai) + '-' + str(ao)
    else:
        suffix = ''
    stim = [[duration,11,0,amplitude,0,0,0,1,int(rnd.uniform(high=10000)),0,0,1],
            [1,1,0,0,0,0,0,0,0,0,0,1]]
    lcg.writeStimFile(stim_file,stim,True)
    channels = [{'type':'input', 'channel':ai, 'factor':input_factor, 'units':input_units},
                {'type':'output', 'channel':ao, 'factor':output_factor, 'units':output_units, 'stimfile':stim_file}]
    lcg.writeIOConfigurationFile(config_file,sampling_rate,duration+3.61,channels,realtime)
    oldfiles = glob.glob('*.h5')    
    sub.call(lcg.common.prog_name + ' -c ' + config_file, shell=True)
    try:
        os.system('beep')
    except:
        pass
    files = glob.glob('*.h5')
    for ff in files:
        if ff not in oldfiles:
            data_file = ff
    lcg.computeElectrodeKernel(os.path.abspath(data_file))
    try:
        os.remove('kernel' + suffix + '.dat')
    except:
        pass
    os.symlink(data_file[:-3] + '_kernel.dat', 'kernel' + suffix + '.dat')

if __name__ == '__main__':
    main()