Пример #1
0
def gen_basis(tessellation, gradient):
    file1 = '%dvectors.txt' % tessellation
    file2 = '%dvectors.txt' % gradient
    data, dsize = gen_1fib(file1, file2)
    filename = 's_t%d_g%d_f1.flt' % (tessellation, gradient)
    flt_utils.write_flt_file(filename, data, dsize)
    return data, dsize, filename
Пример #2
0
def gen_basis(tessellation,gradient):
    file1 = '%dvectors.txt'%tessellation
    file2 = '%dvectors.txt'%gradient
    data, dsize = gen_1fib(file1, file2)
    filename = 's_t%d_g%d_f1.flt'%(tessellation,gradient)
    flt_utils.write_flt_file(filename,data,dsize)
    return data,dsize,filename
Пример #3
0
def add_rician_noise_to_file(filename, stds, shuffle=False):
    #stds = numpy.arange(0.01,0.1,0.01)
    flt_filename = filename + '.flt'
    dsize, data = flt_utils.read_flt_file(flt_filename)
    inds = numpy.arange(data.shape[1])
    for std in stds:
        s_noise = add_rician_noise(data, std)
        k, n = s_noise.shape
        if shuffle:
            numpy.random.shuffle(inds)
        output_filename = '%s_sd%03d.flt' % (filename, std * 100)
        txt_filename = '%s_sd%03d.txt' % (filename, std * 100)
        flt_utils.write_flt_file(output_filename, s_noise[:, inds], dsize)
        f = open(txt_filename, 'w')
        f.write('\n'.join([str(ind) for ind in inds]))
        f.close()
Пример #4
0
def add_rician_noise_to_file(filename, stds, shuffle = False):
    #stds = numpy.arange(0.01,0.1,0.01)
    flt_filename = filename + '.flt'
    dsize, data = flt_utils.read_flt_file(flt_filename)
    inds = numpy.arange(data.shape[1])
    for std in stds:
        s_noise = add_rician_noise(data, std)
        k,n = s_noise.shape
        if shuffle:
            numpy.random.shuffle(inds)
        output_filename = '%s_sd%03d.flt'%(filename,std*100)
        txt_filename = '%s_sd%03d.txt'%(filename,std*100)
        flt_utils.write_flt_file(output_filename,s_noise[:,inds],dsize)
        f = open(txt_filename,'w')
        f.write('\n'.join([str(ind) for ind in inds]))
        f.close()