<jupyter_start><jupyter_text>data file<jupyter_code>pi_list = range(9)
sigma_list = range(9)

f = open("{}.data".format(test_name), 'w')

for (k_pi, pi) in enumerate(pi_list):
    for (k_sigma, sigma) in enumerate(sigma_list):
        
        k = k_pi*len(sigma_list)+k_sigma
        if (sigma < 3.0):
            if (pi < 3.0):
                f.write("{} 4.0\n".format(k))
            elif (pi < 6.0):
                f.write("{} -2.0\n".format(k))
            else:
                f.write("{} 5.0\n".format(k))
                        
        elif (sigma < 6.0):
            if (pi < 3.0):
                f.write("{} -8.0\n".format(k))
            elif (pi < 6.0):
                f.write("{} 10.0\n".format(k))
            else:
                f.write("{} -3.0\n".format(k))
                
        else:
            if (pi < 3.0):
                f.write("{} 1.0\n".format(k))
            elif (pi < 6.0):
                f.write("{} -7.0\n".format(k))
            else:
                f.write("{} 6.0\n".format(k))

f.close()<jupyter_output><empty_output><jupyter_text>cov file<jupyter_code>f = open("{}.cov".format(test_name), 'w')

for i in range(80):
    f.write("{} {} 1.0\n".format(i, i))
    f.write("{} {} 0.25\n".format(i, i + 1))
f.write("80 80 1.0\n")
f.close()<jupyter_output><empty_output><jupyter_text>rebin file<jupyter_code>f = open("{}.rebin".format(test_name), 'w')

f.write("pi")
for i in range(10):
    f.write(" {:.1f}".format(i))
f.write(" sigma")
for i in range(10):
    f.write(" {:.1f}".format(i))
f.write("\n")

f.write("R0 pi")
for i in range(0, 10, 3):
    f.write(" {:.1f}".format(i))
f.write(" sigma")
for i in range(0, 10, 3):
    f.write(" {:.1f}".format(i))

f.close()<jupyter_output><empty_output><jupyter_text>sol file<jupyter_code>cov_mat = np.zeros(81*81, dtype=float).reshape((81,81))

for i in range(80):
    cov_mat[i, i] = 1.0
    cov_mat[i, i+1] = 0.25
    cov_mat[i+1, i] = 0.25
cov_mat[-1,-1] = 1.0

inv_cov_mat = np.linalg.inv(cov_mat)
transformation_matrix = np.zeros(81*9, dtype=float).reshape(81,9)

for i in range(9):
    for j in range(81):
        if i == 0 and j in [0, 1, 2, 9, 10, 11, 18, 19, 20]:
            transformation_matrix[j,i] = 1.0
        elif i == 1 and j in [3, 4, 5, 12, 13, 14, 21, 22, 23]:
            transformation_matrix[j,i] = 1.0
        elif i == 2 and j in [6, 7, 8, 15, 16, 17, 24, 25, 26]:
            transformation_matrix[j,i] = 1.0
        elif i == 3 and j in [27, 28, 29, 36, 37, 38, 45, 46, 47]:
            transformation_matrix[j,i] = 1.0
        elif i == 4 and j in [30, 31, 32, 39, 40, 41, 48, 49, 50]:
            transformation_matrix[j,i] = 1.0
        elif i == 5 and j in [33, 34, 35, 42, 43, 44, 51, 52, 53]:
            transformation_matrix[j,i] = 1.0
        elif i == 6 and j in [54, 55, 56, 63, 64, 65, 72, 73, 74]:
            transformation_matrix[j,i] = 1.0
        elif i == 7 and j in [57, 58, 59, 66, 67, 68, 75, 76, 77]:
            transformation_matrix[j,i] = 1.0
        elif i == 8 and j in [60, 61, 62, 69, 70, 71, 78, 79, 80]:
            transformation_matrix[j,i] = 1.0
            
inv_cov_mat_new = np.dot(transformation_matrix.transpose(), np.dot(inv_cov_mat, transformation_matrix))
cov_mat_new = np.linalg.inv(inv_cov_mat_new)
        
print np.dot(inv_cov_mat, transformation_matrix)
pi_list = range(0, 9, 3)
sigma_list = range(0, 9, 3)

f = open("{}.sol".format(test_name), 'w')

f.write("R0 data")
for (k_pi, pi) in enumerate(pi_list):
    for (k_sigma, sigma) in enumerate(sigma_list):
        if (sigma < 3.0):
            if (pi < 3.0):
                f.write(" 4.0000")
            elif (pi < 6.0):
                f.write(" -2.0000")
            else:
                f.write(" 5.0000")
                        
        elif (sigma < 6.0):
            if (pi < 3.0):
                f.write(" -8.0000")
            elif (pi < 6.0):
                f.write(" 10.0000")
            else:
                f.write(" -3.0000")
                
        else:
            if (pi < 3.0):
                f.write(" 1.0000")
            elif (pi < 6.0):
                f.write(" -7.0000")
            else:
                f.write(" 6.0000")
                
f.write(" cov")
for i in range(9):
    for j in range(9):
        f.write(" {:.4f}".format(cov_mat_new[i,j]))
                
    
f.close()
cov_mat = np.zeros(81*81, dtype=float).reshape((81,81))

for i in range(80):
    cov_mat[i, i] = 1.0
    cov_mat[i, i+1] = 0.25
    cov_mat[i+1, i] = 0.25
cov_mat[-1,-1] = 1.0

print cov_mat
inv_cov_mat = np.linalg.inv(cov_mat)
print inv_cov_mat
transformation_matrix = np.zeros(81*9, dtype=float).reshape(81,9)

for i in range(9):
    for j in range(81):
        if i == 0 and j in [0, 1, 2, 9, 10, 11, 18, 19, 20]:
            transformation_matrix[j,i] = 1.0
        elif i == 1 and j in [3, 4, 5, 12, 13, 14, 21, 22, 23]:
            transformation_matrix[j,i] = 1.0
        elif i == 2 and j in [6, 7, 8, 15, 16, 17, 24, 25, 26]:
            transformation_matrix[j,i] = 1.0
        elif i == 3 and j in [27, 28, 29, 36, 36, 38, 45, 46, 47]:
            transformation_matrix[j,i] = 1.0
        elif i == 4 and j in [30, 31, 32, 39, 40, 41, 48, 49, 50]:
            transformation_matrix[j,i] = 1.0
        elif i == 5 and j in [33, 34, 35, 42, 43, 44, 51, 52, 53]:
            transformation_matrix[j,i] = 1.0
        elif i == 6 and j in [54, 55, 56, 63, 64, 65, 72, 73, 74]:
            transformation_matrix[j,i] = 1.0
        elif i == 7 and j in [57, 58, 59, 66, 67, 68, 75, 76, 77]:
            transformation_matrix[j,i] = 1.0
        elif i == 8 and j in [60, 61, 62, 69, 70, 71, 78, 79, 80]:
            transformation_matrix[j,i] = 1.0
        
            
plt.figure()
plt.subplot(111)
plt.contour(transformation_matrix)
plt.show()
inv_cov_mat_new = np.dot(transformation_matrix.transpose(), np.dot(inv_cov_mat, transformation_matrix))
print inv_cov_mat_new
cov_mat_new = np.linalg.inv(inv_cov_mat_new)
print cov_mat_new.shape
print cov_mat_new

plt.figure()
plt.subplot(121)
plt.contourf(inv_cov_mat)
plt.subplot(122)
plt.contourf(inv_cov_mat_new)
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.176489742754803, 'fraction_numerical': 0.09329208726799089, 'mean_word_length': 1.9705029013539652, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '150890', 'license': 'MIT', 'n_tokens_mistral': 2877, 'n_tokens_neox': 2419, 'n_words': 610, 'path': 'lib/test_rebinning/.ipynb_checkpoints/new_test-checkpoint.ipynb', 'repo_name': 'iprafols/cross_correlations', 'size': '6142'}