pyANOVAapprox 2.0.1__tar.gz → 2.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/PKG-INFO +1 -1
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/pyproject.toml +1 -1
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/simpleTest/exampleAutoapproximate.py +1 -1
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/simpleTest/exampleCheb.py +5 -5
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/simpleTest/exampleClassification.py +2 -2
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/simpleTest/exampleNonPeriodic.py +8 -8
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/simpleTest/examplePeriodic.py +1 -1
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/simpleTest/exampleWavelet.py +10 -10
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/src/pyANOVAapprox/__init__.py +2 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/src/pyANOVAapprox/approx.py +43 -18
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/src/pyANOVAapprox/bandwidth.py +30 -20
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/.github/workflows/ci.yml +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/.github/workflows/documentation.yml +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/.github/workflows/format.yml +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/.github/workflows/release.yml +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/.gitignore +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/LICENSE +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/README.md +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/docs/Makefile +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/docs/source/Analysis.rst +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/docs/source/Approximation.rst +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/docs/source/Errors.rst +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/docs/source/conf.py +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/docs/source/index.rst +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/simpleTest/TestFunctionPeriodic.py +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/src/pyANOVAapprox/analysis.py +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/src/pyANOVAapprox/errors.py +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/src/pyANOVAapprox/fista.py +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/src/pyANOVAapprox/trafos.py +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/tests/TestFunctionCheb.py +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/tests/TestFunctionPeriodic.py +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/tests/cheb_fista.py +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/tests/cheb_lsqr.py +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/tests/per_fista.py +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/tests/per_lsqr.py +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/tests/run_tests.py +0 -0
- {pyanovaapprox-2.0.1 → pyanovaapprox-2.0.2}/tests/wav_lsqr.py +0 -0
|
@@ -56,7 +56,7 @@ ads.autoapproximate()
|
|
|
56
56
|
## get approximation accuracy ##
|
|
57
57
|
################################
|
|
58
58
|
|
|
59
|
-
# mse =
|
|
59
|
+
# mse = ads.get_mse() # get mse error at the given training points
|
|
60
60
|
mse = ads.get_mse(X=X_test, y=y_test) # get mse error at the test points
|
|
61
61
|
λ_min = min(
|
|
62
62
|
mse, key=mse.get
|
|
@@ -86,8 +86,8 @@ ads.approximate(lam=lambdas, max_iter=max_iter, solver="lsqr")
|
|
|
86
86
|
## get approximation accuracy ##
|
|
87
87
|
################################
|
|
88
88
|
|
|
89
|
-
# mse =
|
|
90
|
-
mse =
|
|
89
|
+
# mse = ads.get_mse() # get mse error at the given training points
|
|
90
|
+
mse = ads.get_mse(X=X_test, y=y_test) # get mse error at the test points
|
|
91
91
|
λ_min = min(
|
|
92
92
|
mse, key=mse.get
|
|
93
93
|
) # get the regularisation parameter which leads to the minimal error
|
|
@@ -100,7 +100,7 @@ print("mse = " + str(mse_min))
|
|
|
100
100
|
###############################################
|
|
101
101
|
|
|
102
102
|
|
|
103
|
-
ar =
|
|
103
|
+
ar = ads.get_AttributeRanking(lam=λ_min) # get the attrbute ranking
|
|
104
104
|
|
|
105
105
|
plt.figure()
|
|
106
106
|
markers, stemlines, baseline = plt.stem(
|
|
@@ -121,7 +121,7 @@ plt.grid(True, which="both", ls="--", linewidth=0.5)
|
|
|
121
121
|
plt.show() # plot the arrtibute ranking in an logplot
|
|
122
122
|
print("active dimensions: " + str(ar[ar > 1e-2]))
|
|
123
123
|
|
|
124
|
-
gsis =
|
|
124
|
+
gsis = ads.get_GSI(lam=λ_min)
|
|
125
125
|
label = list(ads.U[1:])
|
|
126
126
|
l = len(label)
|
|
127
127
|
plt.figure()
|
|
@@ -166,7 +166,7 @@ a.approximate(
|
|
|
166
166
|
lam=lambdas, max_iter=max_iter, solver="lsqr"
|
|
167
167
|
) # do the approximation for all specified regularisation parameters
|
|
168
168
|
|
|
169
|
-
mse =
|
|
169
|
+
mse = a.get_mse(X=X_test, y=y_test) # get mse error at the test points
|
|
170
170
|
λ_min = min(
|
|
171
171
|
mse, key=mse.get
|
|
172
172
|
) # get the regularisation parameter which leads to the minimal error
|
|
@@ -97,7 +97,7 @@ print("accuracity = " + str(acc))
|
|
|
97
97
|
## Analyze the model to improve the accuracy ##
|
|
98
98
|
###############################################
|
|
99
99
|
|
|
100
|
-
ar =
|
|
100
|
+
ar = ads.get_AttributeRanking(lam=0.0) # get the attrbute ranking
|
|
101
101
|
|
|
102
102
|
plt.figure()
|
|
103
103
|
markers, stemlines, baseline = plt.stem(
|
|
@@ -118,7 +118,7 @@ plt.grid(True, which="both", ls="--", linewidth=0.5)
|
|
|
118
118
|
plt.show() # plot the arrtibute ranking in an logplot
|
|
119
119
|
print("active dimensions: " + str(ar[ar > 1e-2]))
|
|
120
120
|
|
|
121
|
-
gsis =
|
|
121
|
+
gsis = ads.get_GSI(lam=0.0)
|
|
122
122
|
label = list(ads.U[1:])
|
|
123
123
|
l = len(label)
|
|
124
124
|
plt.figure()
|
|
@@ -84,8 +84,8 @@ ads.approximate(lam=lambdas, max_iter=max_iter, solver="lsqr")
|
|
|
84
84
|
## get approximation accuracy ##
|
|
85
85
|
################################
|
|
86
86
|
|
|
87
|
-
# mse =
|
|
88
|
-
mse =
|
|
87
|
+
# mse = ads.get_mse() # get mse error at the given training points
|
|
88
|
+
mse = ads.get_mse(X=X_test, y=y_test) # get mse error at the test points
|
|
89
89
|
λ_min = min(
|
|
90
90
|
mse, key=mse.get
|
|
91
91
|
) # get the regularisation parameter which leads to the minimal error
|
|
@@ -98,7 +98,7 @@ print("mse = " + str(mse_min))
|
|
|
98
98
|
###############################################
|
|
99
99
|
|
|
100
100
|
|
|
101
|
-
ar =
|
|
101
|
+
ar = ads.get_AttributeRanking(lam=λ_min) # get the attrbute ranking
|
|
102
102
|
|
|
103
103
|
plt.figure()
|
|
104
104
|
markers, stemlines, baseline = plt.stem(
|
|
@@ -119,8 +119,8 @@ plt.grid(True, which="both", ls="--", linewidth=0.5)
|
|
|
119
119
|
plt.show() # plot the arrtibute ranking in an logplot
|
|
120
120
|
print("active dimensions: " + str(ar[ar > 1e-2]))
|
|
121
121
|
|
|
122
|
-
gsis =
|
|
123
|
-
label = list(ads.U[1:])
|
|
122
|
+
gsis = ads.get_GSI(lam=λ_min)
|
|
123
|
+
label = list(ads.getSetting().U[1:])
|
|
124
124
|
l = len(label)
|
|
125
125
|
plt.figure()
|
|
126
126
|
x_values = np.arange(1, l + 1)
|
|
@@ -150,7 +150,7 @@ print(
|
|
|
150
150
|
################################################
|
|
151
151
|
|
|
152
152
|
Umask = np.append(np.array([True]), gsis > 1e-2)
|
|
153
|
-
U = [ads.U[i] for i in np.arange(0, len(Umask))[Umask]] # get important subsets
|
|
153
|
+
U = [ads.getSetting().U[i] for i in np.arange(0, len(Umask))[Umask]] # get important subsets
|
|
154
154
|
bws = M / (math.log10(M) * (len(U) - 1)) # calculate frequencies per subset
|
|
155
155
|
N = [
|
|
156
156
|
math.floor(bws ** (1 / max(1, len(u))) / 2) * 2 for u in U
|
|
@@ -164,7 +164,7 @@ a.approximate(
|
|
|
164
164
|
lam=lambdas, max_iter=max_iter, solver="lsqr"
|
|
165
165
|
) # do the approximation for all specified regularisation parameters
|
|
166
166
|
|
|
167
|
-
mse =
|
|
167
|
+
mse = a.get_mse(X=X_test, y=y_test) # get mse error at the test points
|
|
168
168
|
λ_min = min(
|
|
169
169
|
mse, key=mse.get
|
|
170
170
|
) # get the regularisation parameter which leads to the minimal error
|
|
@@ -183,7 +183,7 @@ print("mse = " + str(mse_min))
|
|
|
183
183
|
y_eval_anova = a.evaluateANOVAterms(
|
|
184
184
|
X=X_test, lam=λ_min
|
|
185
185
|
) # evaluate all of the ANOVA terms
|
|
186
|
-
pos = a.U.index((3,)) # find the index for the subset u=[3]
|
|
186
|
+
pos = a.getSetting().U.index((3,)) # find the index for the subset u=[3]
|
|
187
187
|
y_eval_anova_3 = y_eval_anova.T[pos]
|
|
188
188
|
|
|
189
189
|
perm = np.argsort(X_test.T[3])
|
|
@@ -89,7 +89,7 @@ ads.approximate(lam=lambdas, max_iter=max_iter, solver="lsqr")
|
|
|
89
89
|
## get approximation accuracy ##
|
|
90
90
|
################################
|
|
91
91
|
|
|
92
|
-
# mse =
|
|
92
|
+
# mse = ads.get_mse() # get mse error at the given training points
|
|
93
93
|
mse = ads.get_mse(X=X_test, y=y_test) # get mse error at the test points
|
|
94
94
|
λ_min = min(
|
|
95
95
|
mse, key=mse.get
|
|
@@ -81,10 +81,10 @@ print("Total number of used parameters = " + str(len(anova_model.fc[lambdas[0]].
|
|
|
81
81
|
#######################
|
|
82
82
|
|
|
83
83
|
### Do sensitivity analysis ####
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
anova_model.get_GSI(
|
|
85
|
+
lam=0.0
|
|
86
86
|
) # calculates indices for importance of terms (gsis is vector, with indices belonging to terms in anova_model.U)
|
|
87
|
-
|
|
87
|
+
anova_model.get_GSI(lam=0.0, Dict=true)
|
|
88
88
|
|
|
89
89
|
y_min_calc = 10 ** (np.min(np.log10(gsis)) - 0.5)
|
|
90
90
|
label = list(anova_model.U[1:])
|
|
@@ -113,8 +113,8 @@ plt.show()
|
|
|
113
113
|
################################
|
|
114
114
|
|
|
115
115
|
### error analysis ###
|
|
116
|
-
mse_train =
|
|
117
|
-
mse_test =
|
|
116
|
+
mse_train = anova_model.get_mse(lam=0.0)
|
|
117
|
+
mse_test = anova_model.get_mse(X=X_test, y=y_test, lam=0.0)
|
|
118
118
|
|
|
119
119
|
print("MSE on test points: " + str(mse_test))
|
|
120
120
|
|
|
@@ -122,13 +122,13 @@ print("MSE on test points: " + str(mse_test))
|
|
|
122
122
|
## Approximation with better suited index set ##
|
|
123
123
|
################################################
|
|
124
124
|
|
|
125
|
-
U =
|
|
125
|
+
U = anova_model.get_ActiveSet(eps=[0.01, 0.01], lam=0.0)
|
|
126
126
|
print("Found index-set U: " + str(U))
|
|
127
|
-
anova_model =
|
|
128
|
-
X, y, U=U, N=[i + 2 for i in N], basis=basis
|
|
127
|
+
anova_model = anova_model.approx(
|
|
128
|
+
X=X, y=y, U=U, N=[i + 2 for i in N], basis=basis
|
|
129
129
|
) # increase number of paramers in N for the important terms
|
|
130
130
|
anova_model.approximate(lam=lambdas)
|
|
131
131
|
print("Total number of used parameters = " + str(len(anova_model.fc[lambdas[0]].vec())))
|
|
132
|
-
mse_train =
|
|
133
|
-
mse_test =
|
|
132
|
+
mse_train = anova_model.get_mse(lam=0.0)
|
|
133
|
+
mse_test = anova_model.get_mse(X=X_test, y=y_test, lam=0.0)
|
|
134
134
|
print("MSE on test points after ANOVA truncation: " + str(mse_test))
|
|
@@ -187,6 +187,9 @@ class approx:
|
|
|
187
187
|
):
|
|
188
188
|
|
|
189
189
|
self.X = X
|
|
190
|
+
|
|
191
|
+
if X.shape[0] != y.shape[0]:
|
|
192
|
+
raise ValueError("X and y have different lengths.")
|
|
190
193
|
|
|
191
194
|
setting = approx_setting(
|
|
192
195
|
parent=self,
|
|
@@ -384,7 +387,7 @@ class approx:
|
|
|
384
387
|
B,
|
|
385
388
|
maxiter,
|
|
386
389
|
solver,
|
|
387
|
-
|
|
390
|
+
verbosity,
|
|
388
391
|
solver_max_iter,
|
|
389
392
|
solver_weights,
|
|
390
393
|
solver_verbose,
|
|
@@ -398,8 +401,16 @@ class approx:
|
|
|
398
401
|
|
|
399
402
|
D = dict([(u, tuple([1.0] * len(u))) for u in setting.U])
|
|
400
403
|
t = dict([(u, tuple([1.0] * len(u))) for u in setting.U])
|
|
404
|
+
|
|
405
|
+
if verbosity>3:
|
|
406
|
+
if not os.path.exists("log"):
|
|
407
|
+
os.mkdir("log")
|
|
408
|
+
with open('log/log.csv', 'w', newline='') as csvfile:
|
|
409
|
+
csv.writer(csvfile, delimiter=',').writerow(["it"] + setting.U)
|
|
401
410
|
|
|
402
411
|
for idx in range(maxiter):
|
|
412
|
+
if verbosity > 0:
|
|
413
|
+
print("===== Iteration ", str(idx + 1), " =====")
|
|
403
414
|
bw = compute_bandwidth(B, D, t)
|
|
404
415
|
if setting.N is not None:
|
|
405
416
|
self.addSetting(setting)
|
|
@@ -409,9 +420,14 @@ class approx:
|
|
|
409
420
|
setting.N = [bw[i] for i in setting.U]
|
|
410
421
|
self.addTrafo()
|
|
411
422
|
|
|
412
|
-
if
|
|
413
|
-
|
|
414
|
-
|
|
423
|
+
if verbosity > 0:
|
|
424
|
+
for i in setting.U:
|
|
425
|
+
print("bw in", str(i), ":", bw[i])
|
|
426
|
+
#print("bw in iteration", str(idx + 1), "are", str(bw))
|
|
427
|
+
print()
|
|
428
|
+
if verbosity > 3:
|
|
429
|
+
with open('log/log.csv', 'a', newline='') as csvfile:
|
|
430
|
+
csv.writer(csvfile, delimiter=',').writerow(["bw in it"+str(idx+1)] + [str(bw[i]) for i in setting.U])
|
|
415
431
|
self.approximate(
|
|
416
432
|
lam=lam,
|
|
417
433
|
solver=solver,
|
|
@@ -421,16 +437,25 @@ class approx:
|
|
|
421
437
|
tol=solver_tol,
|
|
422
438
|
)
|
|
423
439
|
|
|
424
|
-
D, t = self.estimate_rates(lam=lam,
|
|
425
|
-
if
|
|
426
|
-
|
|
427
|
-
"estimated rates
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
440
|
+
D, t = self.estimate_rates(lam=lam, verbosity=verbosity)
|
|
441
|
+
if verbosity > 1:
|
|
442
|
+
for i in setting.U:
|
|
443
|
+
print("estimated rates for", str(i), ": D = ", str(D[i]), "and t = ", str(t[i]) )
|
|
444
|
+
print()
|
|
445
|
+
|
|
446
|
+
#print(
|
|
447
|
+
# "estimated rates in iteration",
|
|
448
|
+
# str(idx + 1),
|
|
449
|
+
# "are D =",
|
|
450
|
+
# str(D),
|
|
451
|
+
# "and t =",
|
|
452
|
+
# str(t),
|
|
453
|
+
#)
|
|
454
|
+
if verbosity > 3:
|
|
455
|
+
with open('log/log.csv', 'a', newline='') as csvfile:
|
|
456
|
+
wr = csv.writer(csvfile, delimiter=',')
|
|
457
|
+
wr.writerow(["D in it"+str(idx+1)] + [str(D[i]) for i in setting.U])
|
|
458
|
+
wr.writerow(["t in it"+str(idx+1)] + [str(t[i]) for i in setting.U])
|
|
434
459
|
return D, t
|
|
435
460
|
|
|
436
461
|
def autoapproximate(
|
|
@@ -440,7 +465,7 @@ class approx:
|
|
|
440
465
|
B=None,
|
|
441
466
|
maxiter=2,
|
|
442
467
|
solver="lsqr",
|
|
443
|
-
|
|
468
|
+
verbosity=0,
|
|
444
469
|
solver_max_iter=50,
|
|
445
470
|
solver_weights=None,
|
|
446
471
|
solver_verbose=False,
|
|
@@ -462,7 +487,7 @@ class approx:
|
|
|
462
487
|
B=B,
|
|
463
488
|
maxiter=maxiter,
|
|
464
489
|
solver=solver,
|
|
465
|
-
|
|
490
|
+
verbosity=verbosity,
|
|
466
491
|
solver_max_iter=solver_max_iter,
|
|
467
492
|
solver_weights=solver_weights,
|
|
468
493
|
solver_verbose=solver_verbose,
|
|
@@ -476,7 +501,7 @@ class approx:
|
|
|
476
501
|
B=B,
|
|
477
502
|
maxiter=maxiter,
|
|
478
503
|
solver=solver,
|
|
479
|
-
|
|
504
|
+
verbosity=verbosity,
|
|
480
505
|
solver_max_iter=solver_max_iter,
|
|
481
506
|
solver_weights=solver_weights,
|
|
482
507
|
solver_verbose=solver_verbose,
|
|
@@ -541,7 +566,7 @@ class approx:
|
|
|
541
566
|
|
|
542
567
|
Xt = transformX(X, setting.basis)
|
|
543
568
|
|
|
544
|
-
if self.
|
|
569
|
+
if self.getSetting(settingnr).basis == "per":
|
|
545
570
|
values = np.zeros((Xt.shape[0], len(self.setting[settingnr].U)), "complex")
|
|
546
571
|
else:
|
|
547
572
|
values = np.zeros((Xt.shape[0], len(self.setting[settingnr].U)), "float")
|
|
@@ -13,17 +13,22 @@ def getfcu(ghat, u):
|
|
|
13
13
|
return fcu
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
def getaxissum(ghat, u, j):
|
|
16
|
+
def getaxissum(ghat, u, j, system):
|
|
17
17
|
fcu = getfcu(ghat, u)
|
|
18
18
|
idx = [s.u for s in ghat.settings].index(u)
|
|
19
19
|
bws = ghat.settings[idx].bandwidths
|
|
20
20
|
|
|
21
21
|
fcuj = np.sum(abs(fcu) ** 2, axis=tuple([i for i in range(len(u)) if i != j]))
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
fcuj
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
if system == "exp":
|
|
24
|
+
fcuj = (
|
|
25
|
+
fcuj[np.mod(range(int(bws[j] / 2), bws[j]), bws[j] - 1)]
|
|
26
|
+
+ fcuj[range(int(bws[j] / 2) - 1, -1, -1)]
|
|
27
|
+
)
|
|
28
|
+
elif system == "cos":
|
|
29
|
+
pass
|
|
30
|
+
else:
|
|
31
|
+
raise ValueError("For this basis is estimate rates not implemented")
|
|
27
32
|
# fcuj = np.concatenate(fcuj[math.ceil(bws[j]/2):] + [fcuj[0]]) + fcuj[math.ceil(bws[j]/2)-1::-1]
|
|
28
33
|
return fcuj
|
|
29
34
|
|
|
@@ -106,7 +111,7 @@ def most_common_value(data):
|
|
|
106
111
|
return t[max_index]
|
|
107
112
|
|
|
108
113
|
|
|
109
|
-
def estimate_rates(self, lam, settingnr=None,
|
|
114
|
+
def estimate_rates(self, lam, settingnr=None, verbosity=0):
|
|
110
115
|
us = [s.u for s in self.getTrafo(settingnr).settings]
|
|
111
116
|
nhat = GroupedCoefficients(
|
|
112
117
|
self.getTrafo(settingnr).settings,
|
|
@@ -118,25 +123,28 @@ def estimate_rates(self, lam, settingnr=None, verbose=False):
|
|
|
118
123
|
|
|
119
124
|
mcl = np.exp(most_common_value(np.log(abs(self.getFc(settingnr)[lam].data))))
|
|
120
125
|
threshold = 100 * mcl**2
|
|
121
|
-
|
|
122
|
-
if
|
|
123
|
-
|
|
126
|
+
|
|
127
|
+
if verbosity>5:
|
|
128
|
+
if not os.path.exists(os.path.join("log","figures")):
|
|
129
|
+
os.mkdir(os.path.join("log","figures"))
|
|
130
|
+
num = 0
|
|
131
|
+
|
|
132
|
+
system = self.getTrafo(settingnr).system
|
|
124
133
|
|
|
125
134
|
for u in us:
|
|
126
135
|
if len(u) == 0:
|
|
127
136
|
continue
|
|
128
137
|
|
|
129
|
-
if
|
|
138
|
+
if verbosity>5:
|
|
130
139
|
fig, ax = plt.subplots()
|
|
131
140
|
ax.set_xscale("log")
|
|
132
141
|
ax.set_yscale("log")
|
|
133
142
|
ax.set_title(str(u))
|
|
134
|
-
ps.append(ax)
|
|
135
143
|
|
|
136
144
|
for j in range(len(u)):
|
|
137
|
-
axissum = getaxissum(self.getFc(settingnr)[lam], u, j)
|
|
145
|
+
axissum = getaxissum(self.getFc(settingnr)[lam], u, j, system)
|
|
138
146
|
|
|
139
|
-
axissumnum = getaxissum(nhat, u, j)
|
|
147
|
+
axissumnum = getaxissum(nhat, u, j, system)
|
|
140
148
|
idx = next(
|
|
141
149
|
(
|
|
142
150
|
i
|
|
@@ -146,7 +154,7 @@ def estimate_rates(self, lam, settingnr=None, verbose=False):
|
|
|
146
154
|
None,
|
|
147
155
|
)
|
|
148
156
|
|
|
149
|
-
if
|
|
157
|
+
if verbosity>5:
|
|
150
158
|
|
|
151
159
|
y = np.cumsum(axissum[::-1])[::-1]
|
|
152
160
|
ax.plot(
|
|
@@ -166,7 +174,7 @@ def estimate_rates(self, lam, settingnr=None, verbose=False):
|
|
|
166
174
|
D[u][j] = Duj
|
|
167
175
|
t[u][j] = -tuj / 2
|
|
168
176
|
|
|
169
|
-
if
|
|
177
|
+
if verbosity>5:
|
|
170
178
|
x = np.arange(1, idx + 1)
|
|
171
179
|
ax.plot(
|
|
172
180
|
x,
|
|
@@ -174,10 +182,12 @@ def estimate_rates(self, lam, settingnr=None, verbose=False):
|
|
|
174
182
|
linewidth=2,
|
|
175
183
|
# color=j
|
|
176
184
|
)
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
plt.sca(ax)
|
|
181
|
-
|
|
185
|
+
if verbosity>5:
|
|
186
|
+
#plt.figure(figsize=(12, 9))
|
|
187
|
+
#for ax in ps:
|
|
188
|
+
# plt.sca(ax)
|
|
189
|
+
fig.savefig(os.path.join("log","figures", str(num).strip()+ "_rates_" + str(u).strip() + ".png"))
|
|
190
|
+
num = num + 1
|
|
191
|
+
plt.close(fig)
|
|
182
192
|
|
|
183
193
|
return D, t
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|