-
Notifications
You must be signed in to change notification settings - Fork 1
/
A00Module.py
95 lines (78 loc) · 3.19 KB
/
A00Module.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
from scipy import exp
import os
import SloppyScaling
reload(SloppyScaling)
import WindowScalingInfo as WS
reload(WS)
import Utils
reload(Utils)
name = 'A00' # This is the name used in the files
Xname = 's'
XscaledName = 'Ss'
Xscaled = "(s/W**(1.+zeta))"
#Xscaled = "(s*(1.0*k/L)**(sigma_k*(1.+zeta)))"
XscaledTeX = r'$s / W^{1+\zeta}$'
Yname = 'A00' # This must be the name of the module !!!!!!!!!
Ytheory = "(s*(k/L)**(sigma_k*(1.+zeta)))**(2.-tau) /s * exp(-(Ss*Ixs)**ns+U0)"
Yscaled = \
"(1.0*k/L)**((sigma_k)*(tau-2.)*(1.+zeta)) * s**(tau-1.) * A00"
YscaledTeX = \
r'${\cal{A}_{00}} = (k/L)^{\sigma_k (\tau-2) (1+\zeta)} s^{\tau-1} A_{00}$'
title = 'A(s,k,W): Area covered by avalanches of size S in window of width W'
scalingTitle = 'A(s,k,W) scaling function'
#
# Include corrections
#
# for large Ws, this should just be the A(s,k) below
#Ytheory = "(1.0*k/L)**(sigma_k*(2.-tau)*(1.+zeta)) * S**(2.-tau) / S *exp(-((S**(1./(1.+zeta))*(1.0*k/L)**sigma_k)*Ixs)**ns+U0)"
#Ytheory_corrections= "exp(-U1/S)"
Ytheory_corrections = "(A0-A1/s+A2/s**2)"
# XXX Ixh_1 and Ixw_1 aren't used yet? More natural names?
parameterNames = "tau,sigma_k,zeta,ns,Ixs,U0"
#parameterNames_corrections = "U1"
parameterNames_corrections = "A0,A1, A2"
initialParameterValues = (1.18,0.39,0.79,1.6,7.07,-1.81)
#initialParameterValues_corrections = (0.1,)
initialParameterValues_corrections = (1.0,1.0,0.5)
if WS.corrections_to_scaling:
Ytheory = Ytheory + "*" + Ytheory_corrections
parameterNames = parameterNames + "," + parameterNames_corrections
initialParameterValues = initialParameterValues + initialParameterValues_corrections
# If single independent parameter, must have comma after it -- makes it a tuple
theory = SloppyScaling.ScalingTheory(Ytheory, parameterNames, \
initialParameterValues, WS.independentNames, \
scalingX = Xscaled, scalingY = Yscaled, \
scalingXTeX = XscaledTeX, \
scalingYTeX = YscaledTeX, \
title = title, \
scalingTitle = scalingTitle, \
Xname=Xname, XscaledName=XscaledName, \
Yname=Yname, \
normalization = WS.normalization)
data = SloppyScaling.Data()
loaded = 0
for independent in WS.independentValues:
L, k, W = independent
ext = "_" + WS.simulType + ".bnd"
if os.getlogin() == 'yj':
k_string = "_k"
else:
k_string = "_k="
fileName = "".join([WS.dataDirectory,name,"_W=",str(W).rjust(4, str(0)),\
k_string,str(k), "_System_Size=",str(2*L), "x", str(L), ext])
success = data.InstallCurve(independent, fileName, \
pointSymbol=WS.Symbol[independent], \
pointColor=WS.Color[independent], \
initialSkip = WS.rows_to_skip)
loaded += success
nFiles = len(WS.independentValues)
if loaded == nFiles:
print "Loaded %2d/%2d files (%s)" % (loaded, nFiles, name)
else:
print "====================="
print "Attention! %2d/%2d files are missing (%s)" % (nFiles-loaded, nFiles, name)
print "====================="
f = __file__
f = f.split("/")[-1]
thisModule = f.split('Module.py')[0]
exec(thisModule + "= SloppyScaling.Model(theory, data, name, WS.sortedValues)")