-
Notifications
You must be signed in to change notification settings - Fork 0
/
quantification.py
49 lines (43 loc) · 1.93 KB
/
quantification.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
from Objects.Patterns import SpiralPhyllotaxisPattern, ArchimedeanSpiralUniform, ArchimedeanSpiralNonUniform
from Tools.fibonacci import make_fibonacci
import matplotlib.pyplot as plt
fibonacci = make_fibonacci(5)
averages = []
averages_spir_uni = []
averages_spir_nonuni = []
rsds = []
rsds_spir_uni = []
rsds_spir_nonuni = []
phyllos = []
for fibo in fibonacci:
print('starting fibo = {}'.format(fibo))
phyllo = SpiralPhyllotaxisPattern(n_readouts_per_spoke=1,n_spokes_per_interleaf=34,n_interleaves=fibo,alternated_spokes=False)
# phyllo = SpiralPhyllotaxisPattern(fibo*34, fibo, alternated_points=False)
phyllos.append(phyllo)
averages.append(phyllo.compute_average_distance_between_spokes())
rsds.append(phyllo.compute_rsd())
spir_uni = ArchimedeanSpiralUniform(n_readouts_per_spoke=1,n_spokes_per_interleaf=34,n_interleaves=fibo)
averages_spir_uni.append(
spir_uni.compute_average_distance_between_spokes())
rsds_spir_uni.append(spir_uni.compute_rsd())
spir_nonuni = ArchimedeanSpiralNonUniform(n_readouts_per_spoke=1,n_spokes_per_interleaf=34,n_interleaves=fibo)
averages_spir_nonuni.append(
spir_nonuni.compute_average_distance_between_spokes())
rsds_spir_nonuni.append(spir_nonuni.compute_rsd())
plt.scatter(fibonacci, averages, label='phyllotaxis')
plt.scatter(fibonacci, averages_spir_uni, label='uniform Archimedean spiral')
plt.scatter(fibonacci, averages_spir_nonuni,
label='nonuniform Archimedean spiral')
plt.xlabel('number of interleaves')
plt.ylabel('average distance to next point')
plt.legend(loc='upper left')
plt.savefig('averages.png')
plt.show()
plt.scatter(fibonacci, rsds, label='phyllotaxis')
plt.scatter(fibonacci, rsds_spir_uni, label='uniform Archimedean spiral')
plt.scatter(fibonacci, rsds_spir_nonuni, label='nonuniform Archimedean spiral')
plt.xlabel('number of interleaves')
plt.ylabel('RSD (%)')
plt.legend(loc='upper left')
plt.savefig('rsds.png')
plt.show()