示例#1
0
    start = math.log(10**start_exp)
    end = math.log(10**end_exp)
    step = (end - start) / (n * number_of_decades - 1)
    uniform_time = []
    for i in range(n * number_of_decades):
        uniform_time.append(b**(start + step * i))
    existingfiles = glob.glob(prefix + '*')
    existingfiles = filter(lambda u: u[u.index('.', 5) + 1:].isdigit(),
                           existingfiles)
    existingfiles = [int(u[u.index('.', 5) + 1:]) for u in existingfiles]
    existingfiles.sort()
    uniform_time = [
        pypolymer.find_closest_existing_file(existingfiles, u)
        for u in uniform_time
    ]
    uniform_time = pypolymer.unique(uniform_time)
    blockfiles = [prefix + str(u) for u in uniform_time]

else:

    sys.stderr.write('ERROR: blockfiles_method\n')
    sys.exit()

sys.stdout.write('\n\n')
sys.stdout.write('=================================================\n')
sys.stdout.write('                        S(q)                     \n')
sys.stdout.write('=================================================\n')
sys.stdout.write('\n\nTotal number of files: ' + str(len(blockfiles)) + '\n')
if (len(blockfiles) > 2):
    sys.stdout.write('  blockfiles[0] = ' + blockfiles[0] + '\n')
    sys.stdout.write('  blockfiles[1] = ' + blockfiles[1] + '\n')
    # base
    b = math.e

    number_of_decades = end_exp - start_exp
    start = math.log(10 ** start_exp)
    end = math.log(10 ** end_exp)
    step = (end - start) / (n * number_of_decades - 1)
    uniform_time = []
    for i in range(n * number_of_decades):
        uniform_time.append(b ** (start + step * i))
    existingfiles = glob.glob(prefix + "*")
    existingfiles = filter(lambda u: u[u.index(".", 5) + 1 :].isdigit(), existingfiles)
    existingfiles = [int(u[u.index(".", 5) + 1 :]) for u in existingfiles]
    existingfiles.sort()
    uniform_time = [pypolymer.find_closest_existing_file(existingfiles, u) for u in uniform_time]
    uniform_time = pypolymer.unique(uniform_time)
    blockfiles = [prefix + str(u) for u in uniform_time]

else:

    sys.stderr.write("ERROR: blockfiles_method\n")
    sys.exit()

sys.stdout.write("\n\n")
sys.stdout.write("=================================================\n")
sys.stdout.write("                        S(q)                     \n")
sys.stdout.write("=================================================\n")
sys.stdout.write("\n\nTotal number of files: " + str(len(blockfiles)) + "\n")
if len(blockfiles) > 2:
    sys.stdout.write("  blockfiles[0] = " + blockfiles[0] + "\n")
    sys.stdout.write("  blockfiles[1] = " + blockfiles[1] + "\n")