-
Notifications
You must be signed in to change notification settings - Fork 0
/
args.py
80 lines (69 loc) · 1.82 KB
/
args.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# System imports.
import argparse
import sys
from os.path import expanduser
sys.path.insert(0, expanduser('~')+'/prog/geom')
sys.path.insert(0, expanduser('~')+'/prog/kman')
# Environment imports.
import numpy as np
import matplotlib.pyplot as plt
from cycler import cycler
from GEOM.Vehicle2D import *
from KMAN.Regressors import *
# Get the sub root directory (specific to my machines).
if 'linux' in sys.platform:
subroot = '/Documents'
elif 'darwin' in sys.platform:
subroot = '/prog'
# Command-line arguments.
parser = argparse.ArgumentParser()
parser.add_argument( '--save' )
parser.add_argument( '--show' )
parser.add_argument( '--sim' )
parser.add_argument( '--dtsim' )
parser.add_argument( '--pausesim' )
parser.add_argument( '--fheight' )
parser.add_argument( '--fontsize' )
# Program variables.
args = parser.parse_args()
save = args.save == '1'
show = args.show == '1'
sim = args.sim == '1' and not save
if args.dtsim is None:
dtsim = 1e-6
else:
dtsim = float( args.dtsim )
if args.pausesim is None:
pausesim = 1e-12
else:
pausesim = float( args.pausesim )
if args.fheight is None:
figheight = 5
else:
figheight = float( args.fheight )
if args.fontsize is None:
fontsize = 14
else:
fontsize = float( args.fontsize )
# Figure filepath.
figurepath = expanduser('~') \
+ subroot + '/papers/anchors/figures/'
# Plot font.
default_cycler = cycler(
color=[
'cornflowerblue',
'indianred',
'mediumpurple',
'sandybrown',
'yellowgreen',
'steelblue'
] )
plt.rcParams.update( {
'axes.prop_cycle': default_cycler,
'text.usetex': True,
'font.family': 'mathptmx',
'font.size': fontsize,
'text.latex.preamble': "\\usepackage{amsmath}",
} )
# Set global number print setting.
np.set_printoptions(precision=3, suppress=True, linewidth=np.inf)