Add visualization
This commit is contained in:
parent
59a01b77ed
commit
002c7ecd9d
1 changed files with 24 additions and 3 deletions
|
@ -7,7 +7,7 @@ from backscattering_analyzer import (
|
||||||
opt_compute_light,
|
opt_compute_light,
|
||||||
interpolate,
|
interpolate,
|
||||||
)
|
)
|
||||||
from numpy import loadtxt, pi
|
from numpy import loadtxt, logspace, pi
|
||||||
from scipy.io.matlab import loadmat
|
from scipy.io.matlab import loadmat
|
||||||
from scipy.optimize import Bounds, minimize
|
from scipy.optimize import Bounds, minimize
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ class Analyzer:
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
bounds = Bounds(0, 1)
|
bounds = Bounds(1e-30, 1e-3)
|
||||||
min_result = minimize(
|
min_result = minimize(
|
||||||
fit_compute_light,
|
fit_compute_light,
|
||||||
guess,
|
guess,
|
||||||
|
@ -194,7 +194,7 @@ class Analyzer:
|
||||||
data,
|
data,
|
||||||
reference,
|
reference,
|
||||||
),
|
),
|
||||||
method = 'TNC',
|
method="Powell",
|
||||||
bounds=bounds,
|
bounds=bounds,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -232,4 +232,25 @@ class Analyzer:
|
||||||
_ = plt.legend()
|
_ = plt.legend()
|
||||||
_ = plt.show()
|
_ = plt.show()
|
||||||
|
|
||||||
|
"""
|
||||||
|
as the minimization does not work (why ?), visual help
|
||||||
|
"""
|
||||||
|
x = logspace(-50, 0, 1000)
|
||||||
|
y = [
|
||||||
|
fit_compute_light(
|
||||||
|
x[i],
|
||||||
|
factor_n,
|
||||||
|
coupling_n,
|
||||||
|
factor_d,
|
||||||
|
coupling_d,
|
||||||
|
self.settings.power_in,
|
||||||
|
self.settings.power_out,
|
||||||
|
data,
|
||||||
|
reference,
|
||||||
|
)
|
||||||
|
for i in range(len(x))
|
||||||
|
]
|
||||||
|
_ = plt.loglog(x, y)
|
||||||
|
_ = plt.show()
|
||||||
|
|
||||||
return min_result.x
|
return min_result.x
|
||||||
|
|
Loading…
Reference in a new issue