import numpy as np
import sys

prefix = sys.argv[1]
target_T = float(sys.argv[2])


def get_frequency(file_in):
    f = open(file_in, 'r')
    f.readline()
    f.readline()
    data = f.readline().split()
    freq = float(data[-1])
    f.close()
    return freq

def get_gamma(file_in, T_in):
    data = np.loadtxt(file_in, dtype=np.float)
    for i in range(len(data)):
        if data[i,0] == T_in:
             return data[i,1]
    return None

for iq in range(10):
    file = prefix + ".Gamma." + str(iq+1)
    omega = get_frequency(file)
    gamma = get_gamma(file, target_T)
    print(omega, gamma)

