<reponame>dbaranchuk/hnsw
cM16_M16_txt = '''
1	0.1087	58.9843 us	230.079 dcs	9.8505 hps
2	0.2347	71.471 us	313.831 dcs	13.3481 hps
3	0.3176	81.4942 us	366.165 dcs	15.5699 hps
4	0.3845	89.7411 us	407.8 dcs	17.3412 hps
5	0.4353	94.7879 us	444.492 dcs	18.915 hps
6	0.4813	99.9318 us	477.969 dcs	20.3575 hps
7	0.5193	104.787 us	509.377 dcs	21.7226 hps
8	0.5533	110.035 us	538.614 dcs	22.9999 hps
9	0.5804	116.517 us	565.844 dcs	24.2043 hps
10	0.6045	122.504 us	592.159 dcs	25.3713 hps
11	0.6249	128.618 us	617.286 dcs	26.4909 hps
12	0.6423	133.77 us	641.592 dcs	27.5795 hps
13	0.6591	140.296 us	665.889 dcs	28.6761 hps
14	0.6747	147.412 us	689.142 dcs	29.7322 hps
15	0.6889	152.354 us	712.826 dcs	30.8069 hps
16	0.7032	157.421 us	736.084 dcs	31.8682 hps
17	0.7137	163.425 us	758.332 dcs	32.8812 hps
18	0.7264	169.906 us	780.667 dcs	33.9105 hps
19	0.7354	175.649 us	801.858 dcs	34.9025 hps
20	0.7457	181.417 us	823.291 dcs	35.9013 hps
21	0.7566	187.863 us	844.592 dcs	36.8949 hps
22	0.7637	192.925 us	866.068 dcs	37.8991 hps
23	0.7714	197.168 us	886.991 dcs	38.8785 hps
24	0.7783	202.818 us	907.921 dcs	39.863 hps
25	0.7845	207.049 us	928.307 dcs	40.8261 hps
26	0.7912	212.989 us	948.927 dcs	41.8019 hps
27	0.7989	217.373 us	970.224 dcs	42.8117 hps
28	0.8045	221.32 us	990.547 dcs	43.7747 hps
29	0.8103	226.917 us	1011.24 dcs	44.7558 hps
30	0.8177	232.456 us	1031.42 dcs	45.7193 hps
40	0.8604	281.542 us	1228.41 dcs	55.287 hps
50	0.8889	330.045 us	1421.01 dcs	64.8312 hps
60	0.9085	381.825 us	1612.95 dcs	74.5014 hps
70	0.9242	421.612 us	1800.62 dcs	84.103 hps
80	0.936	469.301 us	1986.67 dcs	93.7421 hps
90	0.9434	515.595 us	2172.85 dcs	103.506 hps
100	0.951	562.659 us	2356.04 dcs	113.212 hps
140	0.9689	743.008 us	3080.26 dcs	154.292 hps
180	0.9776	925.775 us	3785.14 dcs	196.622 hps
220	0.9831	1110.83 us	4474.03 dcs	239.071 hps
260	0.9878	1283.9 us	5150.74 dcs	277.974 hps
300	0.9899	1462.13 us	5815.37 dcs	314.45 hps
340	0.9914	1641.09 us	6469.11 dcs	350.938 hps
380	0.9932	1817.21 us	7113.46 dcs	387.443 hps
420	0.9946	1992.27 us	7750.72 dcs	424.001 hps
460	0.995	2170.71 us	8380.48 dcs	460.541 hps
'''
cM16_M4_txt = '''
1	0.0143	19.217 us	122.398 dcs	7.30965 hps
2	0.0476	32.0744 us	174.257 dcs	11.4799 hps
3	0.0853	42.0453 us	211.591 dcs	14.7455 hps
4	0.1219	50.5798 us	240.386 dcs	17.4436 hps
5	0.1525	57.386 us	263.305 dcs	19.6461 hps
6	0.1812	63.7129 us	284.584 dcs	21.7362 hps
7	0.2025	69.2111 us	302.898 dcs	23.566 hps
8	0.2244	74.7485 us	320.198 dcs	25.2993 hps
9	0.2434	78.994 us	335.645 dcs	26.8827 hps
10	0.2602	83.8668 us	350.309 dcs	28.3938 hps
11	0.2781	88.0374 us	364.329 dcs	29.8432 hps
12	0.2958	92.5817 us	378.802 dcs	31.3441 hps
13	0.3134	96.2553 us	392.363 dcs	32.775 hps
14	0.3279	100.257 us	405.559 dcs	34.1572 hps
15	0.3412	103.597 us	417.597 dcs	35.4337 hps
16	0.3535	108.155 us	429.605 dcs	36.7378 hps
17	0.3651	110.937 us	441.088 dcs	37.982 hps
18	0.3779	115.177 us	452.717 dcs	39.2302 hps
19	0.3907	118.176 us	464.08 dcs	40.4868 hps
20	0.4007	122.453 us	475.539 dcs	41.7117 hps
21	0.4111	125.133 us	486.633 dcs	42.9164 hps
22	0.4199	129.076 us	497.562 dcs	44.0879 hps
23	0.4279	131.937 us	508.32 dcs	45.2747 hps
24	0.4359	135.553 us	518.672 dcs	46.4154 hps
25	0.444	138.005 us	529.495 dcs	47.5952 hps
26	0.4504	141.207 us	539.515 dcs	48.7111 hps
27	0.4577	145.767 us	549.687 dcs	49.8329 hps
28	0.4663	147.851 us	560.2 dcs	50.9852 hps
29	0.474	151.996 us	569.969 dcs	52.0854 hps
30	0.4812	153.643 us	580.184 dcs	53.2104 hps
40	0.5437	182.901 us	675.807 dcs	64.0128 hps
50	0.5869	209.52 us	765.016 dcs	74.237 hps
60	0.619	231.996 us	850.421 dcs	84.2207 hps
70	0.6473	256.997 us	933.764 dcs	94.0855 hps
80	0.6714	283.19 us	1015.66 dcs	103.899 hps
90	0.691	305.156 us	1095.17 dcs	113.591 hps
100	0.7098	328.674 us	1175.3 dcs	123.392 hps
140	0.7628	416.965 us	1484.68 dcs	164.618 hps
180	0.7952	507.501 us	1785.91 dcs	206.384 hps
220	0.8187	596.027 us	2080.71 dcs	248.141 hps
260	0.838	684.078 us	2373.39 dcs	285.404 hps
300	0.8534	768.943 us	2661.09 dcs	321.54 hps
340	0.8651	852.126 us	2945.61 dcs	357.746 hps
380	0.8759	935.877 us	3227.56 dcs	394.1 hps
420	0.8843	1022 us	3505.34 dcs	430.39 hps
460	0.8898	1109.81 us	3782.18 dcs	466.838 hps
500	0.896	1195.86 us	4054.3 dcs	503.145 hps
540	0.9023	1283.68 us	4325.59 dcs	548.809 hps
580	0.9072	1371.9 us	4594.33 dcs	597.425 hps
620	0.9116	1451.9 us	4861.61 dcs	646.073 hps
660	0.9143	1534.29 us	5127.27 dcs	694.736 hps
700	0.918	1615.29 us	5390.89 dcs	743.456 hps
'''

cM4_M4_txt = '''
1	0.003	7.5835 us	40.7297 dcs	6.55673 hps
2	0.0162	17.9025 us	72.4297 dcs	11.9064 hps
3	0.0337	27.5032 us	98.4861 dcs	16.2134 hps
4	0.0554	36.195 us	120.732 dcs	19.898 hps
5	0.0739	43.5132 us	139.333 dcs	22.9998 hps
6	0.0903	49.9931 us	155.693 dcs	25.7549 hps
7	0.1065	55.6048 us	170.471 dcs	28.2603 hps
8	0.1218	61.2945 us	183.577 dcs	30.4864 hps
9	0.1346	66.034 us	195.949 dcs	32.5985 hps
10	0.1471	70.9969 us	207.813 dcs	34.6317 hps
11	0.1607	75.6699 us	218.968 dcs	36.5575 hps
12	0.1733	80.225 us	229.885 dcs	38.4356 hps
13	0.184	84.1411 us	240.204 dcs	40.2208 hps
14	0.1962	87.0412 us	250.433 dcs	41.9991 hps
15	0.2063	92.4858 us	259.496 dcs	43.5876 hps
16	0.2174	96.0647 us	268.708 dcs	45.1963 hps
17	0.2266	99.0916 us	277.348 dcs	46.7067 hps
18	0.2359	104.29 us	286.642 dcs	48.3292 hps
19	0.2451	106.89 us	295.22 dcs	49.8332 hps
20	0.2527	110.73 us	303.661 dcs	51.3229 hps
21	0.2618	114.918 us	311.969 dcs	52.7833 hps
22	0.2702	118.055 us	320.329 dcs	54.2621 hps
23	0.2765	120.67 us	328.237 dcs	55.6591 hps
24	0.2843	124.368 us	336.669 dcs	57.1501 hps
25	0.2912	126.91 us	344.285 dcs	58.4973 hps
26	0.2988	130.296 us	352.126 dcs	59.8955 hps
27	0.3052	132.867 us	359.41 dcs	61.1891 hps
28	0.312	136.558 us	367.096 dcs	62.5647 hps
29	0.3187	138.868 us	374.789 dcs	63.9311 hps
30	0.3242	142.188 us	381.849 dcs	65.1927 hps
40	0.379	171.033 us	451.668 dcs	77.7742 hps
50	0.4159	197.222 us	514.787 dcs	89.277 hps
60	0.4435	220.853 us	574.737 dcs	100.333 hps
70	0.472	249.179 us	632.388 dcs	111.052 hps
80	0.4967	269.202 us	687.449 dcs	121.405 hps
90	0.5167	291.803 us	742.254 dcs	132.051 hps
100	0.5337	313.739 us	797.453 dcs	143.344 hps
140	0.5858	399.672 us	1005.5 dcs	186.524 hps
180	0.6223	489.184 us	1207.06 dcs	229.158 hps
220	0.6513	569.073 us	1404.97 dcs	269.413 hps
260	0.6742	648.253 us	1599.23 dcs	305.641 hps
300	0.6921	728.735 us	1790.63 dcs	341.782 hps
340	0.7079	816.413 us	1980.02 dcs	377.863 hps
380	0.7229	903.076 us	2168.19 dcs	414.032 hps
420	0.7354	984.082 us	2355.72 dcs	450.346 hps
460	0.7461	1061.47 us	2540.73 dcs	486.426 hps
500	0.7557	1137.46 us	2725.67 dcs	526.29 hps
540	0.7626	1215.5 us	2909.69 dcs	574.748 hps
580	0.7695	1295.44 us	3094.1 dcs	623.467 hps
620	0.7753	1371.74 us	3276.07 dcs	671.88 hps
660	0.7806	1450.59 us	3457.48 dcs	720.399 hps
700	0.7862	1550.36 us	3637.52 dcs	768.804 hps
'''

\
import matplotlib.pyplot as plt
import numpy
import re

# splitted_cM16_M16 = re.findall(r"[0-9.]+", cM16_M16_txt)
# splitted_cM16_M4 = re.findall(r"[0-9.]+", cM16_M4_txt)
# splitted_cM4_M4 = re.findall(r"[0-9.]+", cM4_M4_txt)
#
# cM16_M16 = splitted_cM16_M16[1::5]
# cM16_M4 = splitted_cM16_M4[1::5]
# cM4_M4 = splitted_cM4_M4[1::5]
#
# cM16_M16_us = splitted_cM16_M16[2::5]
# cM16_M4_us = splitted_cM16_M4[2::5]
# cM4_M4_us = splitted_cM4_M4[2::5]
#
#
# plt.plot(cM16_M16_us, cM16_M16, 'r', label = 'cM16_M16')
# plt.plot(cM4_M4_us, cM4_M4, 'g', label = 'cM4_M4')
# plt.plot(cM16_M4_us, cM16_M4, 'b', label = 'cM16_M4')
#
# plt.axis([0, 1550, 0, 1])
# plt.xlabel('Time', fontsize=14)
# plt.ylabel('Recall@1', fontsize=14)
# # plt.text(ef[-1]+1, cM16_M16[-1], 'cM16_M16_ef_240', fontsize=9, color=(1,0,0))
# # plt.text(ef[-1]+1, float(cM16_M2[-1])-0.1, 'cM16_M2_ef_240', fontsize=9, color=(0,0,1))
# # plt.text(ef[-1]+1, cM2_M2[-1], 'cM2_M2_ef_240', fontsize=9, color=(0,0.7,0))
# #
# # plt.text(ef[-1]+1, cM16_M16_ef_60[-1], 'cM16_M16_ef_60', fontsize=9, color=(1,0,0))
# # plt.text(ef[-1]+1, cM16_M2_ef_60[-1], 'cM16_M2_ef_60', fontsize=9, color=(0,0,1))
# # plt.text(ef[-1]+1, cM2_M2_ef_60[-1], 'cM2_M2_ef_60', fontsize=9, color=(0,0.7,0))
#
#
# plt.title('Recall/Time')
# plt.legend(bbox_to_anchor=(0., 1.01, 1., .101), loc=3,
#            ncol=3, mode="expand", borderaxespad=0., prop={'size': 11})
# plt.savefig('recall_us.png')

orig_txt = '''
120	0.787545	358.958 us	2122.75 dcs	129.144 hps
160	0.80585	455.181 us	2666.25 dcs	171.144 hps
200	0.815611	546.476 us	3185.79 dcs	213.77 hps
240	0.821317	636.143 us	3686.06 dcs	256.428 hps
280	0.824695	725.797 us	4169.93 dcs	294.125 hps
320	0.827003	814.607 us	4639.72 dcs	330.717 hps
360	0.828602	901.919 us	5096.82 dcs	367.312 hps
400	0.829683	986.963 us	5543.53 dcs	403.919 hps
440	0.830499	1071.78 us	5980.05 dcs	440.521 hps
480	0.831033	1153.97 us	6408.05 dcs	477.132 hps
'''

merge_txt = '''
120	0.808176	427.333 us	2568.52 dcs	128.981 hps
160	0.819529	540.34 us	3220.56 dcs	171.021 hps
200	0.825127	648.79 us	3839.98 dcs	213.665 hps
240	0.828123	756.561 us	4433.18 dcs	256.347 hps
280	0.829903	862.392 us	5005.18 dcs	294.059 hps
320	0.831001	969.558 us	5558.38 dcs	330.66 hps
360	0.831717	1069.41 us	6095.21 dcs	367.268 hps
400	0.832177	1169.57 us	6618.22 dcs	403.871 hps
440	0.832465	1268.94 us	7128.19 dcs	440.477 hps
480	0.832672	1365.06 us	7627.12 dcs	477.092 hps
'''

splitted_orig = re.findall(r"[0-9.]+", orig_txt)
splitted_merge = re.findall(r"[0-9.]+", merge_txt)

orig = splitted_orig[1::5]
merge = splitted_merge[1::5]

orig_us = splitted_orig[2::5]
merge_us = splitted_merge[2::5]


plt.plot(orig_us, orig, 'r', label = 'Original')
plt.plot(merge_us, merge, 'g', label = 'Merged')

plt.axis([0, 1160, 0.75, 1])
plt.xlabel('Time', fontsize=14)
plt.ylabel('Recall@120', fontsize=14)
# plt.text(ef[-1]+1, cM16_M16[-1], 'cM16_M16_ef_240', fontsize=9, color=(1,0,0))
# plt.text(ef[-1]+1, float(cM16_M2[-1])-0.1, 'cM16_M2_ef_240', fontsize=9, color=(0,0,1))
# plt.text(ef[-1]+1, cM2_M2[-1], 'cM2_M2_ef_240', fontsize=9, color=(0,0.7,0))
#
# plt.text(ef[-1]+1, cM16_M16_ef_60[-1], 'cM16_M16_ef_60', fontsize=9, color=(1,0,0))
# plt.text(ef[-1]+1, cM16_M2_ef_60[-1], 'cM16_M2_ef_60', fontsize=9, color=(0,0,1))
# plt.text(ef[-1]+1, cM2_M2_ef_60[-1], 'cM2_M2_ef_60', fontsize=9, color=(0,0.7,0))


plt.title('Recall/Time')
plt.legend(bbox_to_anchor=(0., 1.01, 1., .101), loc=3,
           ncol=3, mode="expand", borderaxespad=0., prop={'size': 11})
plt.savefig('recall_us_merge.png')
cM16_M16_txt = '''
1	0.1087	58.9843 us	230.079 dcs	9.8505 hps
2	0.2347	71.471 us	313.831 dcs	13.3481 hps
3	0.3176	81.4942 us	366.165 dcs	15.5699 hps
4	0.3845	89.7411 us	407.8 dcs	17.3412 hps
5	0.4353	94.7879 us	444.492 dcs	18.915 hps
6	0.4813	99.9318 us	477.969 dcs	20.3575 hps
7	0.5193	104.787 us	509.377 dcs	21.7226 hps
8	0.5533	110.035 us	538.614 dcs	22.9999 hps
9	0.5804	116.517 us	565.844 dcs	24.2043 hps
10	0.6045	122.504 us	592.159 dcs	25.3713 hps
11	0.6249	128.618 us	617.286 dcs	26.4909 hps
12	0.6423	133.77 us	641.592 dcs	27.5795 hps
13	0.6591	140.296 us	665.889 dcs	28.6761 hps
14	0.6747	147.412 us	689.142 dcs	29.7322 hps
15	0.6889	152.354 us	712.826 dcs	30.8069 hps
16	0.7032	157.421 us	736.084 dcs	31.8682 hps
17	0.7137	163.425 us	758.332 dcs	32.8812 hps
18	0.7264	169.906 us	780.667 dcs	33.9105 hps
19	0.7354	175.649 us	801.858 dcs	34.9025 hps
20	0.7457	181.417 us	823.291 dcs	35.9013 hps
21	0.7566	187.863 us	844.592 dcs	36.8949 hps
22	0.7637	192.925 us	866.068 dcs	37.8991 hps
23	0.7714	197.168 us	886.991 dcs	38.8785 hps
24	0.7783	202.818 us	907.921 dcs	39.863 hps
25	0.7845	207.049 us	928.307 dcs	40.8261 hps
26	0.7912	212.989 us	948.927 dcs	41.8019 hps
27	0.7989	217.373 us	970.224 dcs	42.8117 hps
28	0.8045	221.32 us	990.547 dcs	43.7747 hps
29	0.8103	226.917 us	1011.24 dcs	44.7558 hps
30	0.8177	232.456 us	1031.42 dcs	45.7193 hps
40	0.8604	281.542 us	1228.41 dcs	55.287 hps
50	0.8889	330.045 us	1421.01 dcs	64.8312 hps
60	0.9085	381.825 us	1612.95 dcs	74.5014 hps
70	0.9242	421.612 us	1800.62 dcs	84.103 hps
80	0.936	469.301 us	1986.67 dcs	93.7421 hps
90	0.9434	515.595 us	2172.85 dcs	103.506 hps
100	0.951	562.659 us	2356.04 dcs	113.212 hps
140	0.9689	743.008 us	3080.26 dcs	154.292 hps
180	0.9776	925.775 us	3785.14 dcs	196.622 hps
220	0.9831	1110.83 us	4474.03 dcs	239.071 hps
260	0.9878	1283.9 us	5150.74 dcs	277.974 hps
300	0.9899	1462.13 us	5815.37 dcs	314.45 hps
340	0.9914	1641.09 us	6469.11 dcs	350.938 hps
380	0.9932	1817.21 us	7113.46 dcs	387.443 hps
420	0.9946	1992.27 us	7750.72 dcs	424.001 hps
460	0.995	2170.71 us	8380.48 dcs	460.541 hps
'''
cM16_M4_txt = '''
1	0.0143	19.217 us	122.398 dcs	7.30965 hps
2	0.0476	32.0744 us	174.257 dcs	11.4799 hps
3	0.0853	42.0453 us	211.591 dcs	14.7455 hps
4	0.1219	50.5798 us	240.386 dcs	17.4436 hps
5	0.1525	57.386 us	263.305 dcs	19.6461 hps
6	0.1812	63.7129 us	284.584 dcs	21.7362 hps
7	0.2025	69.2111 us	302.898 dcs	23.566 hps
8	0.2244	74.7485 us	320.198 dcs	25.2993 hps
9	0.2434	78.994 us	335.645 dcs	26.8827 hps
10	0.2602	83.8668 us	350.309 dcs	28.3938 hps
11	0.2781	88.0374 us	364.329 dcs	29.8432 hps
12	0.2958	92.5817 us	378.802 dcs	31.3441 hps
13	0.3134	96.2553 us	392.363 dcs	32.775 hps
14	0.3279	100.257 us	405.559 dcs	34.1572 hps
15	0.3412	103.597 us	417.597 dcs	35.4337 hps
16	0.3535	108.155 us	429.605 dcs	36.7378 hps
17	0.3651	110.937 us	441.088 dcs	37.982 hps
18	0.3779	115.177 us	452.717 dcs	39.2302 hps
19	0.3907	118.176 us	464.08 dcs	40.4868 hps
20	0.4007	122.453 us	475.539 dcs	41.7117 hps
21	0.4111	125.133 us	486.633 dcs	42.9164 hps
22	0.4199	129.076 us	497.562 dcs	44.0879 hps
23	0.4279	131.937 us	508.32 dcs	45.2747 hps
24	0.4359	135.553 us	518.672 dcs	46.4154 hps
25	0.444	138.005 us	529.495 dcs	47.5952 hps
26	0.4504	141.207 us	539.515 dcs	48.7111 hps
27	0.4577	145.767 us	549.687 dcs	49.8329 hps
28	0.4663	147.851 us	560.2 dcs	50.9852 hps
29	0.474	151.996 us	569.969 dcs	52.0854 hps
30	0.4812	153.643 us	580.184 dcs	53.2104 hps
40	0.5437	182.901 us	675.807 dcs	64.0128 hps
50	0.5869	209.52 us	765.016 dcs	74.237 hps
60	0.619	231.996 us	850.421 dcs	84.2207 hps
70	0.6473	256.997 us	933.764 dcs	94.0855 hps
80	0.6714	283.19 us	1015.66 dcs	103.899 hps
90	0.691	305.156 us	1095.17 dcs	113.591 hps
100	0.7098	328.674 us	1175.3 dcs	123.392 hps
140	0.7628	416.965 us	1484.68 dcs	164.618 hps
180	0.7952	507.501 us	1785.91 dcs	206.384 hps
220	0.8187	596.027 us	2080.71 dcs	248.141 hps
260	0.838	684.078 us	2373.39 dcs	285.404 hps
300	0.8534	768.943 us	2661.09 dcs	321.54 hps
340	0.8651	852.126 us	2945.61 dcs	357.746 hps
380	0.8759	935.877 us	3227.56 dcs	394.1 hps
420	0.8843	1022 us	3505.34 dcs	430.39 hps
460	0.8898	1109.81 us	3782.18 dcs	466.838 hps
500	0.896	1195.86 us	4054.3 dcs	503.145 hps
540	0.9023	1283.68 us	4325.59 dcs	548.809 hps
580	0.9072	1371.9 us	4594.33 dcs	597.425 hps
620	0.9116	1451.9 us	4861.61 dcs	646.073 hps
660	0.9143	1534.29 us	5127.27 dcs	694.736 hps
700	0.918	1615.29 us	5390.89 dcs	743.456 hps
'''

cM4_M4_txt = '''
1	0.003	7.5835 us	40.7297 dcs	6.55673 hps
2	0.0162	17.9025 us	72.4297 dcs	11.9064 hps
3	0.0337	27.5032 us	98.4861 dcs	16.2134 hps
4	0.0554	36.195 us	120.732 dcs	19.898 hps
5	0.0739	43.5132 us	139.333 dcs	22.9998 hps
6	0.0903	49.9931 us	155.693 dcs	25.7549 hps
7	0.1065	55.6048 us	170.471 dcs	28.2603 hps
8	0.1218	61.2945 us	183.577 dcs	30.4864 hps
9	0.1346	66.034 us	195.949 dcs	32.5985 hps
10	0.1471	70.9969 us	207.813 dcs	34.6317 hps
11	0.1607	75.6699 us	218.968 dcs	36.5575 hps
12	0.1733	80.225 us	229.885 dcs	38.4356 hps
13	0.184	84.1411 us	240.204 dcs	40.2208 hps
14	0.1962	87.0412 us	250.433 dcs	41.9991 hps
15	0.2063	92.4858 us	259.496 dcs	43.5876 hps
16	0.2174	96.0647 us	268.708 dcs	45.1963 hps
17	0.2266	99.0916 us	277.348 dcs	46.7067 hps
18	0.2359	104.29 us	286.642 dcs	48.3292 hps
19	0.2451	106.89 us	295.22 dcs	49.8332 hps
20	0.2527	110.73 us	303.661 dcs	51.3229 hps
21	0.2618	114.918 us	311.969 dcs	52.7833 hps
22	0.2702	118.055 us	320.329 dcs	54.2621 hps
23	0.2765	120.67 us	328.237 dcs	55.6591 hps
24	0.2843	124.368 us	336.669 dcs	57.1501 hps
25	0.2912	126.91 us	344.285 dcs	58.4973 hps
26	0.2988	130.296 us	352.126 dcs	59.8955 hps
27	0.3052	132.867 us	359.41 dcs	61.1891 hps
28	0.312	136.558 us	367.096 dcs	62.5647 hps
29	0.3187	138.868 us	374.789 dcs	63.9311 hps
30	0.3242	142.188 us	381.849 dcs	65.1927 hps
40	0.379	171.033 us	451.668 dcs	77.7742 hps
50	0.4159	197.222 us	514.787 dcs	89.277 hps
60	0.4435	220.853 us	574.737 dcs	100.333 hps
70	0.472	249.179 us	632.388 dcs	111.052 hps
80	0.4967	269.202 us	687.449 dcs	121.405 hps
90	0.5167	291.803 us	742.254 dcs	132.051 hps
100	0.5337	313.739 us	797.453 dcs	143.344 hps
140	0.5858	399.672 us	1005.5 dcs	186.524 hps
180	0.6223	489.184 us	1207.06 dcs	229.158 hps
220	0.6513	569.073 us	1404.97 dcs	269.413 hps
260	0.6742	648.253 us	1599.23 dcs	305.641 hps
300	0.6921	728.735 us	1790.63 dcs	341.782 hps
340	0.7079	816.413 us	1980.02 dcs	377.863 hps
380	0.7229	903.076 us	2168.19 dcs	414.032 hps
420	0.7354	984.082 us	2355.72 dcs	450.346 hps
460	0.7461	1061.47 us	2540.73 dcs	486.426 hps
500	0.7557	1137.46 us	2725.67 dcs	526.29 hps
540	0.7626	1215.5 us	2909.69 dcs	574.748 hps
580	0.7695	1295.44 us	3094.1 dcs	623.467 hps
620	0.7753	1371.74 us	3276.07 dcs	671.88 hps
660	0.7806	1450.59 us	3457.48 dcs	720.399 hps
700	0.7862	1550.36 us	3637.52 dcs	768.804 hps
'''

\
import matplotlib.pyplot as plt
import numpy
import re

# splitted_cM16_M16 = re.findall(r"[0-9.]+", cM16_M16_txt)
# splitted_cM16_M4 = re.findall(r"[0-9.]+", cM16_M4_txt)
# splitted_cM4_M4 = re.findall(r"[0-9.]+", cM4_M4_txt)
#
# cM16_M16 = splitted_cM16_M16[1::5]
# cM16_M4 = splitted_cM16_M4[1::5]
# cM4_M4 = splitted_cM4_M4[1::5]
#
# cM16_M16_us = splitted_cM16_M16[2::5]
# cM16_M4_us = splitted_cM16_M4[2::5]
# cM4_M4_us = splitted_cM4_M4[2::5]
#
#
# plt.plot(cM16_M16_us, cM16_M16, 'r', label = 'cM16_M16')
# plt.plot(cM4_M4_us, cM4_M4, 'g', label = 'cM4_M4')
# plt.plot(cM16_M4_us, cM16_M4, 'b', label = 'cM16_M4')
#
# plt.axis([0, 1550, 0, 1])
# plt.xlabel('Time', fontsize=14)
# plt.ylabel('Recall@1', fontsize=14)
# # plt.text(ef[-1]+1, cM16_M16[-1], 'cM16_M16_ef_240', fontsize=9, color=(1,0,0))
# # plt.text(ef[-1]+1, float(cM16_M2[-1])-0.1, 'cM16_M2_ef_240', fontsize=9, color=(0,0,1))
# # plt.text(ef[-1]+1, cM2_M2[-1], 'cM2_M2_ef_240', fontsize=9, color=(0,0.7,0))
# #
# # plt.text(ef[-1]+1, cM16_M16_ef_60[-1], 'cM16_M16_ef_60', fontsize=9, color=(1,0,0))
# # plt.text(ef[-1]+1, cM16_M2_ef_60[-1], 'cM16_M2_ef_60', fontsize=9, color=(0,0,1))
# # plt.text(ef[-1]+1, cM2_M2_ef_60[-1], 'cM2_M2_ef_60', fontsize=9, color=(0,0.7,0))
#
#
# plt.title('Recall/Time')
# plt.legend(bbox_to_anchor=(0., 1.01, 1., .101), loc=3,
#            ncol=3, mode="expand", borderaxespad=0., prop={'size': 11})
# plt.savefig('recall_us.png')

orig_txt = '''
120	0.787545	358.958 us	2122.75 dcs	129.144 hps
160	0.80585	455.181 us	2666.25 dcs	171.144 hps
200	0.815611	546.476 us	3185.79 dcs	213.77 hps
240	0.821317	636.143 us	3686.06 dcs	256.428 hps
280	0.824695	725.797 us	4169.93 dcs	294.125 hps
320	0.827003	814.607 us	4639.72 dcs	330.717 hps
360	0.828602	901.919 us	5096.82 dcs	367.312 hps
400	0.829683	986.963 us	5543.53 dcs	403.919 hps
440	0.830499	1071.78 us	5980.05 dcs	440.521 hps
480	0.831033	1153.97 us	6408.05 dcs	477.132 hps
'''

merge_txt = '''
120	0.808176	427.333 us	2568.52 dcs	128.981 hps
160	0.819529	540.34 us	3220.56 dcs	171.021 hps
200	0.825127	648.79 us	3839.98 dcs	213.665 hps
240	0.828123	756.561 us	4433.18 dcs	256.347 hps
280	0.829903	862.392 us	5005.18 dcs	294.059 hps
320	0.831001	969.558 us	5558.38 dcs	330.66 hps
360	0.831717	1069.41 us	6095.21 dcs	367.268 hps
400	0.832177	1169.57 us	6618.22 dcs	403.871 hps
440	0.832465	1268.94 us	7128.19 dcs	440.477 hps
480	0.832672	1365.06 us	7627.12 dcs	477.092 hps
'''

splitted_orig = re.findall(r"[0-9.]+", orig_txt)
splitted_merge = re.findall(r"[0-9.]+", merge_txt)

orig = splitted_orig[1::5]
merge = splitted_merge[1::5]

orig_us = splitted_orig[2::5]
merge_us = splitted_merge[2::5]


plt.plot(orig_us, orig, 'r', label = 'Original')
plt.plot(merge_us, merge, 'g', label = 'Merged')

plt.axis([0, 1160, 0.75, 1])
plt.xlabel('Time', fontsize=14)
plt.ylabel('Recall@120', fontsize=14)
# plt.text(ef[-1]+1, cM16_M16[-1], 'cM16_M16_ef_240', fontsize=9, color=(1,0,0))
# plt.text(ef[-1]+1, float(cM16_M2[-1])-0.1, 'cM16_M2_ef_240', fontsize=9, color=(0,0,1))
# plt.text(ef[-1]+1, cM2_M2[-1], 'cM2_M2_ef_240', fontsize=9, color=(0,0.7,0))
#
# plt.text(ef[-1]+1, cM16_M16_ef_60[-1], 'cM16_M16_ef_60', fontsize=9, color=(1,0,0))
# plt.text(ef[-1]+1, cM16_M2_ef_60[-1], 'cM16_M2_ef_60', fontsize=9, color=(0,0,1))
# plt.text(ef[-1]+1, cM2_M2_ef_60[-1], 'cM2_M2_ef_60', fontsize=9, color=(0,0.7,0))


plt.title('Recall/Time')
plt.legend(bbox_to_anchor=(0., 1.01, 1., .101), loc=3,
           ncol=3, mode="expand", borderaxespad=0., prop={'size': 11})
plt.savefig('recall_us_merge.png')
1	0.1087	58.9843 us	230.079 dcs	9.8505 hps 2	0.2347	71.471 us	313.831 dcs	13.3481 hps 3	0.3176	81.4942 us	366.165 dcs	15.5699 hps 4	0.3845	89.7411 us	407.8 dcs	17.3412 hps 5	0.4353	94.7879 us	444.492 dcs	18.915 hps 6	0.4813	99.9318 us	477.969 dcs	20.3575 hps 7	0.5193	104.787 us	509.377 dcs	21.7226 hps 8	0.5533	110.035 us	538.614 dcs	22.9999 hps 9	0.5804	116.517 us	565.844 dcs	24.2043 hps 10	0.6045	122.504 us	592.159 dcs	25.3713 hps 11	0.6249	128.618 us	617.286 dcs	26.4909 hps 12	0.6423	133.77 us	641.592 dcs	27.5795 hps 13	0.6591	140.296 us	665.889 dcs	28.6761 hps 14	0.6747	147.412 us	689.142 dcs	29.7322 hps 15	0.6889	152.354 us	712.826 dcs	30.8069 hps 16	0.7032	157.421 us	736.084 dcs	31.8682 hps 17	0.7137	163.425 us	758.332 dcs	32.8812 hps 18	0.7264	169.906 us	780.667 dcs	33.9105 hps 19	0.7354	175.649 us	801.858 dcs	34.9025 hps 20	0.7457	181.417 us	823.291 dcs	35.9013 hps 21	0.7566	187.863 us	844.592 dcs	36.8949 hps 22	0.7637	192.925 us	866.068 dcs	37.8991 hps 23	0.7714	197.168 us	886.991 dcs	38.8785 hps 24	0.7783	202.818 us	907.921 dcs	39.863 hps 25	0.7845	207.049 us	928.307 dcs	40.8261 hps 26	0.7912	212.989 us	948.927 dcs	41.8019 hps 27	0.7989	217.373 us	970.224 dcs	42.8117 hps 28	0.8045	221.32 us	990.547 dcs	43.7747 hps 29	0.8103	226.917 us	1011.24 dcs	44.7558 hps 30	0.8177	232.456 us	1031.42 dcs	45.7193 hps 40	0.8604	281.542 us	1228.41 dcs	55.287 hps 50	0.8889	330.045 us	1421.01 dcs	64.8312 hps 60	0.9085	381.825 us	1612.95 dcs	74.5014 hps 70	0.9242	421.612 us	1800.62 dcs	84.103 hps 80	0.936	469.301 us	1986.67 dcs	93.7421 hps 90	0.9434	515.595 us	2172.85 dcs	103.506 hps 100	0.951	562.659 us	2356.04 dcs	113.212 hps 140	0.9689	743.008 us	3080.26 dcs	154.292 hps 180	0.9776	925.775 us	3785.14 dcs	196.622 hps 220	0.9831	1110.83 us	4474.03 dcs	239.071 hps 260	0.9878	1283.9 us	5150.74 dcs	277.974 hps 300	0.9899	1462.13 us	5815.37 dcs	314.45 hps 340	0.9914	1641.09 us	6469.11 dcs	350.938 hps 380	0.9932	1817.21 us	7113.46 dcs	387.443 hps 420	0.9946	1992.27 us	7750.72 dcs	424.001 hps 460	0.995	2170.71 us	8380.48 dcs	460.541 hps 1	0.0143	19.217 us	122.398 dcs	7.30965 hps 2	0.0476	32.0744 us	174.257 dcs	11.4799 hps 3	0.0853	42.0453 us	211.591 dcs	14.7455 hps 4	0.1219	50.5798 us	240.386 dcs	17.4436 hps 5	0.1525	57.386 us	263.305 dcs	19.6461 hps 6	0.1812	63.7129 us	284.584 dcs	21.7362 hps 7	0.2025	69.2111 us	302.898 dcs	23.566 hps 8	0.2244	74.7485 us	320.198 dcs	25.2993 hps 9	0.2434	78.994 us	335.645 dcs	26.8827 hps 10	0.2602	83.8668 us	350.309 dcs	28.3938 hps 11	0.2781	88.0374 us	364.329 dcs	29.8432 hps 12	0.2958	92.5817 us	378.802 dcs	31.3441 hps 13	0.3134	96.2553 us	392.363 dcs	32.775 hps 14	0.3279	100.257 us	405.559 dcs	34.1572 hps 15	0.3412	103.597 us	417.597 dcs	35.4337 hps 16	0.3535	108.155 us	429.605 dcs	36.7378 hps 17	0.3651	110.937 us	441.088 dcs	37.982 hps 18	0.3779	115.177 us	452.717 dcs	39.2302 hps 19	0.3907	118.176 us	464.08 dcs	40.4868 hps 20	0.4007	122.453 us	475.539 dcs	41.7117 hps 21	0.4111	125.133 us	486.633 dcs	42.9164 hps 22	0.4199	129.076 us	497.562 dcs	44.0879 hps 23	0.4279	131.937 us	508.32 dcs	45.2747 hps 24	0.4359	135.553 us	518.672 dcs	46.4154 hps 25	0.444	138.005 us	529.495 dcs	47.5952 hps 26	0.4504	141.207 us	539.515 dcs	48.7111 hps 27	0.4577	145.767 us	549.687 dcs	49.8329 hps 28	0.4663	147.851 us	560.2 dcs	50.9852 hps 29	0.474	151.996 us	569.969 dcs	52.0854 hps 30	0.4812	153.643 us	580.184 dcs	53.2104 hps 40	0.5437	182.901 us	675.807 dcs	64.0128 hps 50	0.5869	209.52 us	765.016 dcs	74.237 hps 60	0.619	231.996 us	850.421 dcs	84.2207 hps 70	0.6473	256.997 us	933.764 dcs	94.0855 hps 80	0.6714	283.19 us	1015.66 dcs	103.899 hps 90	0.691	305.156 us	1095.17 dcs	113.591 hps 100	0.7098	328.674 us	1175.3 dcs	123.392 hps 140	0.7628	416.965 us	1484.68 dcs	164.618 hps 180	0.7952	507.501 us	1785.91 dcs	206.384 hps 220	0.8187	596.027 us	2080.71 dcs	248.141 hps 260	0.838	684.078 us	2373.39 dcs	285.404 hps 300	0.8534	768.943 us	2661.09 dcs	321.54 hps 340	0.8651	852.126 us	2945.61 dcs	357.746 hps 380	0.8759	935.877 us	3227.56 dcs	394.1 hps 420	0.8843	1022 us	3505.34 dcs	430.39 hps 460	0.8898	1109.81 us	3782.18 dcs	466.838 hps 500	0.896	1195.86 us	4054.3 dcs	503.145 hps 540	0.9023	1283.68 us	4325.59 dcs	548.809 hps 580	0.9072	1371.9 us	4594.33 dcs	597.425 hps 620	0.9116	1451.9 us	4861.61 dcs	646.073 hps 660	0.9143	1534.29 us	5127.27 dcs	694.736 hps 700	0.918	1615.29 us	5390.89 dcs	743.456 hps 1	0.003	7.5835 us	40.7297 dcs	6.55673 hps 2	0.0162	17.9025 us	72.4297 dcs	11.9064 hps 3	0.0337	27.5032 us	98.4861 dcs	16.2134 hps 4	0.0554	36.195 us	120.732 dcs	19.898 hps 5	0.0739	43.5132 us	139.333 dcs	22.9998 hps 6	0.0903	49.9931 us	155.693 dcs	25.7549 hps 7	0.1065	55.6048 us	170.471 dcs	28.2603 hps 8	0.1218	61.2945 us	183.577 dcs	30.4864 hps 9	0.1346	66.034 us	195.949 dcs	32.5985 hps 10	0.1471	70.9969 us	207.813 dcs	34.6317 hps 11	0.1607	75.6699 us	218.968 dcs	36.5575 hps 12	0.1733	80.225 us	229.885 dcs	38.4356 hps 13	0.184	84.1411 us	240.204 dcs	40.2208 hps 14	0.1962	87.0412 us	250.433 dcs	41.9991 hps 15	0.2063	92.4858 us	259.496 dcs	43.5876 hps 16	0.2174	96.0647 us	268.708 dcs	45.1963 hps 17	0.2266	99.0916 us	277.348 dcs	46.7067 hps 18	0.2359	104.29 us	286.642 dcs	48.3292 hps 19	0.2451	106.89 us	295.22 dcs	49.8332 hps 20	0.2527	110.73 us	303.661 dcs	51.3229 hps 21	0.2618	114.918 us	311.969 dcs	52.7833 hps 22	0.2702	118.055 us	320.329 dcs	54.2621 hps 23	0.2765	120.67 us	328.237 dcs	55.6591 hps 24	0.2843	124.368 us	336.669 dcs	57.1501 hps 25	0.2912	126.91 us	344.285 dcs	58.4973 hps 26	0.2988	130.296 us	352.126 dcs	59.8955 hps 27	0.3052	132.867 us	359.41 dcs	61.1891 hps 28	0.312	136.558 us	367.096 dcs	62.5647 hps 29	0.3187	138.868 us	374.789 dcs	63.9311 hps 30	0.3242	142.188 us	381.849 dcs	65.1927 hps 40	0.379	171.033 us	451.668 dcs	77.7742 hps 50	0.4159	197.222 us	514.787 dcs	89.277 hps 60	0.4435	220.853 us	574.737 dcs	100.333 hps 70	0.472	249.179 us	632.388 dcs	111.052 hps 80	0.4967	269.202 us	687.449 dcs	121.405 hps 90	0.5167	291.803 us	742.254 dcs	132.051 hps 100	0.5337	313.739 us	797.453 dcs	143.344 hps 140	0.5858	399.672 us	1005.5 dcs	186.524 hps 180	0.6223	489.184 us	1207.06 dcs	229.158 hps 220	0.6513	569.073 us	1404.97 dcs	269.413 hps 260	0.6742	648.253 us	1599.23 dcs	305.641 hps 300	0.6921	728.735 us	1790.63 dcs	341.782 hps 340	0.7079	816.413 us	1980.02 dcs	377.863 hps 380	0.7229	903.076 us	2168.19 dcs	414.032 hps 420	0.7354	984.082 us	2355.72 dcs	450.346 hps 460	0.7461	1061.47 us	2540.73 dcs	486.426 hps 500	0.7557	1137.46 us	2725.67 dcs	526.29 hps 540	0.7626	1215.5 us	2909.69 dcs	574.748 hps 580	0.7695	1295.44 us	3094.1 dcs	623.467 hps 620	0.7753	1371.74 us	3276.07 dcs	671.88 hps 660	0.7806	1450.59 us	3457.48 dcs	720.399 hps 700	0.7862	1550.36 us	3637.52 dcs	768.804 hps # splitted_cM16_M16 = re.findall(r"[0-9.]+", cM16_M16_txt) # splitted_cM16_M4 = re.findall(r"[0-9.]+", cM16_M4_txt) # splitted_cM4_M4 = re.findall(r"[0-9.]+", cM4_M4_txt) # # cM16_M16 = splitted_cM16_M16[1::5] # cM16_M4 = splitted_cM16_M4[1::5] # cM4_M4 = splitted_cM4_M4[1::5] # # cM16_M16_us = splitted_cM16_M16[2::5] # cM16_M4_us = splitted_cM16_M4[2::5] # cM4_M4_us = splitted_cM4_M4[2::5] # # # plt.plot(cM16_M16_us, cM16_M16, 'r', label = 'cM16_M16') # plt.plot(cM4_M4_us, cM4_M4, 'g', label = 'cM4_M4') # plt.plot(cM16_M4_us, cM16_M4, 'b', label = 'cM16_M4') # # plt.axis([0, 1550, 0, 1]) # plt.xlabel('Time', fontsize=14) # plt.ylabel('Recall@1', fontsize=14) # # plt.text(ef[-1]+1, cM16_M16[-1], 'cM16_M16_ef_240', fontsize=9, color=(1,0,0)) # # plt.text(ef[-1]+1, float(cM16_M2[-1])-0.1, 'cM16_M2_ef_240', fontsize=9, color=(0,0,1)) # # plt.text(ef[-1]+1, cM2_M2[-1], 'cM2_M2_ef_240', fontsize=9, color=(0,0.7,0)) # # # # plt.text(ef[-1]+1, cM16_M16_ef_60[-1], 'cM16_M16_ef_60', fontsize=9, color=(1,0,0)) # # plt.text(ef[-1]+1, cM16_M2_ef_60[-1], 'cM16_M2_ef_60', fontsize=9, color=(0,0,1)) # # plt.text(ef[-1]+1, cM2_M2_ef_60[-1], 'cM2_M2_ef_60', fontsize=9, color=(0,0.7,0)) # # # plt.title('Recall/Time') # plt.legend(bbox_to_anchor=(0., 1.01, 1., .101), loc=3, #            ncol=3, mode="expand", borderaxespad=0., prop={'size': 11}) # plt.savefig('recall_us.png') 120	0.787545	358.958 us	2122.75 dcs	129.144 hps 160	0.80585	455.181 us	2666.25 dcs	171.144 hps 200	0.815611	546.476 us	3185.79 dcs	213.77 hps 240	0.821317	636.143 us	3686.06 dcs	256.428 hps 280	0.824695	725.797 us	4169.93 dcs	294.125 hps 320	0.827003	814.607 us	4639.72 dcs	330.717 hps 360	0.828602	901.919 us	5096.82 dcs	367.312 hps 400	0.829683	986.963 us	5543.53 dcs	403.919 hps 440	0.830499	1071.78 us	5980.05 dcs	440.521 hps 480	0.831033	1153.97 us	6408.05 dcs	477.132 hps 120	0.808176	427.333 us	2568.52 dcs	128.981 hps 160	0.819529	540.34 us	3220.56 dcs	171.021 hps 200	0.825127	648.79 us	3839.98 dcs	213.665 hps 240	0.828123	756.561 us	4433.18 dcs	256.347 hps 280	0.829903	862.392 us	5005.18 dcs	294.059 hps 320	0.831001	969.558 us	5558.38 dcs	330.66 hps 360	0.831717	1069.41 us	6095.21 dcs	367.268 hps 400	0.832177	1169.57 us	6618.22 dcs	403.871 hps 440	0.832465	1268.94 us	7128.19 dcs	440.477 hps 480	0.832672	1365.06 us	7627.12 dcs	477.092 hps # plt.text(ef[-1]+1, cM16_M16[-1], 'cM16_M16_ef_240', fontsize=9, color=(1,0,0)) # plt.text(ef[-1]+1, float(cM16_M2[-1])-0.1, 'cM16_M2_ef_240', fontsize=9, color=(0,0,1)) # plt.text(ef[-1]+1, cM2_M2[-1], 'cM2_M2_ef_240', fontsize=9, color=(0,0.7,0)) # # plt.text(ef[-1]+1, cM16_M16_ef_60[-1], 'cM16_M16_ef_60', fontsize=9, color=(1,0,0)) # plt.text(ef[-1]+1, cM16_M2_ef_60[-1], 'cM16_M2_ef_60', fontsize=9, color=(0,0,1)) # plt.text(ef[-1]+1, cM2_M2_ef_60[-1], 'cM2_M2_ef_60', fontsize=9, color=(0,0.7,0))