-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_volume_scaled.py
79 lines (64 loc) · 1.69 KB
/
plot_volume_scaled.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
import os
import sys
import glob
import calc_sectors
import matplotlib.pyplot as plot
import numpy as np
import re
nruns = 80
if len(sys.argv) > 1 :
folder_postfix = sys.argv[1]
else:
print("usage: plot_volume_scaled.py folder_postfix")
scaleV = False
scaleL = False
xshift = False
yshift = False
if len(sys.argv) > 2 :
for arg in argv[2:]:
if arg == 'scaleV':
scaleV = True
elif arg == 'scaleL':
scaleL = True
elif arg == 'xshift':
xshift = True
elif arg == 'yshift':
yshift = True
else:
print(f"Option {arg} not recognized")
colors = iter(['black','blue','red','green','magenta','yellow']*20)
symbols = iter(['o','x']*30)
folders = glob.glob("L*"+folder_postfix)
for folder in folders:
os.chdir(folder)
mean, sigma = calc_sectors.calc_sectors()
os.chdir('..')
L = int(re.search('L(.+?)'+folder_postfix, folder).group(1))
x = np.linspace(0, sigma.shape[0]-1, sigma.shape[0])
print(L)
if xshift:
maxindex = np.argmax(mean)
first = max(maxindex-2,0)
xw = x[first:first+5]
mw = mean[first:first+5]
poly = np.polyfit( xw, mw, 2)
maxindex = -poly[1]/poly[0]/2
x -= maxindex
if scaleV:
x = x/L**2
if scaleL:
x *= L
if yshift:
mean += np.log(L)
plot.errorbar( x, mean, sigma, fmt='o', color=next(colors), label = f"L{L}" )
plot.legend(loc='upper right')
if rescale:
plot.xlabel('Sector / L displaced')
plot.ylabel('F + log(L)')
elif noscale:
plot.xlabel('Sector')
plot.ylabel('F')
else:
plot.xlabel('Sector / Volume')
plot.ylabel('F + log(L)')
plot.show()