-
Notifications
You must be signed in to change notification settings - Fork 0
/
shifting.py
47 lines (38 loc) · 1.12 KB
/
shifting.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
""" Shifting Polynomials
Script generating plots describing the movement of samples for a path in the space of polynomial,
not included in the paper.
To use just run
python shifting-exp.py
script does not take any command line arguments or flags.
"""
import itertools
from plots import *
from matplotlib import pylab
from pylab import rcParams
rcParams['figure.figsize'] = 5, 4
pol = SignalPolynomial([2, -1, 1])
pylab.show()
change = np.array([1, -1, 0])
alpha = np.linspace(0, 5)
sample_postitons = [0.2, 0.4, 0.6, 0.8]
colors = itertools.cycle(["b", "c", "g", "r"])
pylab.ion()
plot_results(pol, color='k')
for s in sample_postitons:
stem_results([s], [pol.get_samples(s)], color=next(colors))
pylab.gcf().subplots_adjust(bottom=0.15)
pylab.xlabel(r'$t$', fontsize=20)
pylab.xlim(0, 1)
pylab.ioff()
pylab.show()
pylab.ion()
for s in sample_postitons:
print(pol.get_samples(s))
p = pol.path(s, 0.1 * change)
pylab.plot(p, alpha, lw=3, color=next(colors))
pylab.gcf().subplots_adjust(bottom=0.15)
pylab.ylabel(r'$\alpha$', fontsize=20)
pylab.xlabel(r'$t$', fontsize=20)
pylab.xlim(0, 1)
pylab.ioff()
pylab.show()