<jupyter_start><jupyter_text>Room size experiment<jupyter_code>results = np.load('results_dictionary.npy')
results
type(results)
len(results)
collections.defaultdict(results)
import collections
import pickle
y = []
x = []
with open('fs_1x_results', 'rb') as f:
    results = pickle.load(f)
for k in sorted(results.keys()):
    if k < 40000:
        x.append(k)
        y.append(np.mean(results[k]))


with open('fs_mc_1x_results', 'rb') as f:
    results = pickle.load(f)
for k in sorted(results.keys()):
    if k > 40000:
        x.append(k)
        y.append(np.mean(results[k]))

plt.plot(x, y)
y = []
x = []
with open('fs_10x_results', 'rb') as f:
    results = pickle.load(f)
for k in sorted(results.keys()):
    if k < 40000:
        x.append(k)
        y.append(np.mean(results[k]))


with open('fs_mc_10x_results', 'rb') as f:
    results = pickle.load(f)
for k in sorted(results.keys()):
    if k > 40000:
        x.append(k)
        y.append(np.mean(results[k]))

plt.plot(x, y)
def plot_fs(ax, d1, d2, label=None, color=None):
    y = []
    x = []
    with open(d1, 'rb') as f:
        results = pickle.load(f)
    for k in sorted(results.keys()):
        if k < 40000:
            x.append(k)
            y.append(np.mean(results[k]))


    with open(d2, 'rb') as f:
        results = pickle.load(f)
    for k in sorted(results.keys()):
        if k > 40000:
            x.append(k)
            y.append(np.mean(results[k]))

    ax.plot(x, y, 'o-', linewidth=2, label=label, color=color)
    plt.legend(loc='best')
fig = plt.figure()
ax = fig.gca()
plot_fs(ax, 'fs_1x_results', 'fs_mc_1x_results', color=tudelft_cyan, label="No upsampling")
plot_fs(ax, 'fs_10x_results', 'fs_mc_10x_results', color=tudelft_orange, label="10x upsampling")
plot_fs(ax, 'fs_100x_results', 'fs_mc_100x_results', color=tudelft_purple, label="100x upsampling")
plt.xlabel('Sample Frequency [Hz]')
plt.ylabel('Room estimation error [m]')
plt.grid('on')
plt.xticks((16000, 32000, 48000, 96000, 2*96000), ('16k', '32k', '48k', '96k', '192k'), color=tudelft_black)
plt.show()
help(plt.xticks)
from matplotlib.colors import ColorConverter

cc = ColorConverter()

# colors
tudelft_cyan = cc.to_rgba("#00ADEF")
tudelft_black = cc.to_rgba("#231F20")
tudelft_white = cc.to_rgba("#FFFFFF")
tudelft_sea_green = cc.to_rgba("#70C8BB")
tudelft_green = cc.to_rgba("#0097A1")
tudelft_dark_blue = cc.to_rgba("#1B1464")
tudelft_purple = cc.to_rgba("#211869")
tudelft_turquoise = cc.to_rgba("#00A9BD")
tudelft_sky_blue = cc.to_rgba("#7AC6DC")
tudelft_lavender = cc.to_rgba("#7FA7D0")
tudelft_orange = cc.to_rgba("#F0883F"   )
tudelft_warm_purple = cc.to_rgba("#80268C")
tudelft_fuchsia = cc.to_rgba("#A70576")
tudelft_bright_green = cc.to_rgba("#AFD135")
tudelft_yellow = cc.to_rgba("#FDF391")
#'N5_w5l7h3.5', 'N5_w8l7h3.5', 
#          'N5_w9l10h5', 'N5_w11l13h5', 'N5_w9l8h5', 'N5_w19l18h9', 
#         'N5_w15l15h6_', 

files = ['N5_w5l7h3.5', 'N5_w8l7h3.5', 'N5_w5l5h5', 'N5_w6l5h5', 'N5_w6l6h5', 'N5_w7l6h5', 'N5_w7l7h5', 
         'N5_w8l7h5', 'N5_w8l8h5', 'N5_w9l9h5', 'N5_w10l10h5', 'N5_w8l10h5'] #, 'N5_w8l7h5', 'N5_w9l8h5', 'N5_w9l10h5', 'N5_w11l13h5']

x = []
y = []
z = []
for file in files:
    with open(file, 'rb') as f:
        results = pickle.load(f)
    volume = sorted(results.keys())[0]
    results = results[volume]
    errors, times = zip(*results)
    print(volume,len(errors), len(errors)/50)
    y.append(np.array(errors))
    x.append(volume)
    z.append(np.array(times))
    
#i = np.argsort(x)
#x = np.array(x)[i]
#y = np.array(y)[i]
#z = np.array(z)[i]
x = np.array(x)
y = np.hstack(y)
z = np.hstack(z)


(len(y)-23-25)/500
np.mean(y)
np.sqrt(np.var(y))
np.min(y)
np.mean(z)
np.var(z)
np.min(z)
with open('N_2-16', 'rb') as f:
    results = pickle.load(f)
NN = sorted(results.keys())
mean_err = []
mean_time = []
for N in NN:
    res = results[N]  
    errors, times = zip(*res)
    mean_err.append(np.mean(errors))
    mean_time.append(np.mean(times))
plt.figure(1)
plt.plot(NN, mean_err/mean_err[0], 'o-', linewidth=2, color=tudelft_cyan)
plt.grid('on')
plt.figure(2)
plt.plot(NN, mean_time, 'o-', linewidth=2, color=tudelft_orange)
plt.grid('on')
with open('N_2-16-1', 'rb') as f:
    results = pickle.load(f)
NN = sorted(results.keys())
mean_err = []
mean_time = []
for N in NN:
    res = results[N]  
    errors, times = zip(*res)
    mean_err.append(np.mean(errors))
    mean_time.append(np.mean(times))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18396757487052465, 'fraction_numerical': 0.06304886286872326, 'mean_word_length': 4.04199772985244, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '483771', 'license': 'MIT', 'n_tokens_mistral': 2148, 'n_tokens_neox': 2004, 'n_words': 340, 'path': 'Test.ipynb', 'repo_name': 'ijager/Thesis', 'size': '4441'}