Passed
Push — master ( 13200e...4b50d2 )
by Simon
04:24
created

create_performance_plots   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 21
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A create_performance_plots() 0 23 1
1
from tqdm import tqdm
2
import numpy as np
3
import pandas as pd
4
import matplotlib.pyplot as plt
5
6
7
def create_performance_plots(study_name):
8
    results = pd.read_csv("./_data/" + study_name + ".csv", index_col=0)
9
10
    total_time = results.loc["total_time_mean"].values
11
    eval_time = results.loc["eval_time_mean"].values
12
    iter_time = results.loc["iter_time_mean"].values
13
14
    ind = np.arange(total_time.shape[0])  # the x locations for the groups
15
    width = 0.35  # the width of the bars: can also be len(x) sequence
16
17
    plt.figure(figsize=(15, 5))
18
19
    p2 = plt.bar(ind, iter_time, width, bottom=eval_time)
20
    p1 = plt.bar(ind, eval_time, width)
21
22
    plt.ylabel("Time [s]")
23
    # plt.title(title)
24
    plt.xticks(ind, results.columns, rotation=75)
25
    # plt.yticks()
26
    plt.legend((p1[0], p2[0]), ("Eval time", "Opt time"))
27
28
    plt.tight_layout()
29
    plt.savefig("./_plots/performance.png", dpi=300)
30
31
32
create_performance_plots("simple function")
33