-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_plot.py
37 lines (27 loc) · 996 Bytes
/
main_plot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import argparse
import _pickle
from plot.plot import plot_main
def output(args):
if args.output is not None:
return args.output
out = args.input.split('/')[-1].split('.')[0]
out = out[:-7] if out.endswith('_pickle') else out
return "output/images/" + out + ".png"
def plot_parameters():
parser = argparse.ArgumentParser()
parser.add_argument('input',
help='input pickle data file')
parser.add_argument('--output', dest='output', default=None,
help='output image file')
args = parser.parse_args()
args.output = output(args)
return args
def main():
args = plot_parameters()
# data -> epoch * (i_x_t, i_y_t, i_t_t)
data = _pickle.load(open(args.input, 'rb'))
mi = list(zip(*map(lambda el: (el[0], *el[1]), data.items())))
epochs, i_x_t, i_y_t, i_t_t = mi
plot_main(i_x_t, i_y_t, epoch=max(epochs), filename=args.output, show=True)
if __name__ == '__main__':
main()