Module 3 - Inverse
- class module3_inverse.InverseProblem(mesh, ele_pos, data, I_all, l, z=None, select_pot_method=0)
Inverse Object EIT 2D
- Parameters
mesh (mesh) – Any mesh from Fenics module. We recommend from
MyMesh()
ele_pos (
electrodes_position()
) – Object, list of arrays with position of electrodes.z (array) – Vector of impedances in electrodes
data (array) – Vector with potencial in electrodes or any other vector.
I_all (
current_method()
or list of arrays) – Current density in each electrode for each measurementl (int) – Measurements number.
- Example
>>> InverseObject=InverseProblem(mesh_inverse, ele_pos, list_U0_noised, I_all, l, z) >>> InverseObject.solve_inverse() >>> gamma_k=InverseObject.gamma_k
- solve_inverse()
Function that solves the inverse problem.
- Example
>>> InverseObject=InverseProblem(mesh_inverse, ele_pos, list_U0_noised, I_all, l, z, select_pot_method=0) >>> InverseObject.solve_inverse()
- set_answer(gamma0, mesh0)
“Get and set the answer if we have it. It is usefull to determine the best solution reached.
error_gamma()
will return you the percentual error in L2.- Parameters
mesh0 (mesh) – Any mesh from Fenics module. We recommend from
MyMesh()
gamma0 – Finite Element Function
- set_NewtonParameters(**kwargs)
Newton Parameters
- Kwargs:
mu_i (float): Mu initial (0,1]
mumax (float): mumax (0,1]
nu (float): Decrease last mu_n
R (float): Minimal value for mu_n
- Default Parameters:
>>> self.mu_i=0.9 >>> self.mumax=0.999 >>> self.nu=0.99 >>> self.R=0.9
- Example
>>> InverseObject=InverseProblem(mesh_inverse, ele_pos, list_U0_noised, I_all, l, z) >>> InverseObject.set_NewtonParameters(mu_i=0.90, mumax=0.999, nu=0.985, R=0.90)
- set_NoiseParameters(tau, noise_level)
Noise Parameters to stop with Discrepancy Principle.
- Parameters
tau (float) – Tau for disprance principle [0, infty)
noise_level (float) – Noise_level(%) from data [0,1)
- Default Parameters:
>>> self.tau=0 >>> self.noise_level=0
- Example
>>> InverseObject=InverseProblem(mesh_inverse, ele_pos, list_U0_noised, I_all, l, z) >>> InverseObject.set_NoiseParameters(tau=5, noise_level=0.01)
- set_firstguess(Cellsgamma_k)
Default parameters for first guess in external step newton.
- Parameters
Cellsgamma_k (array) – We expect a vector that represents the value of gamma in your cell.
- Default Parameters:
>>> self.Cellsgamma_k=np.ones(self.mesh.num_cells())*0.9
- Example
>>> InverseObject=InverseProblem(mesh_inverse, ele_pos, list_U0_noised, I_all, l, z) >>> InverseObject.set_firstguess(np.ones(mesh_inverse.num_cells())*5)
- set_solverconfig(**kwargs)
Solver config.
- Kwargs:
weight_value (bool): Weight function in Jacobian matrix
step_limit (float): Step limit while solve
min_v (float): Minimal value in element for gamma_k
- Default Parameters:
>>> self.weight_value=True >>> self.step_limit=5 >>> self.min_v=0.05
- Example
>>> InverseObject=InverseProblem(mesh_inverse, ele_pos, list_U0_noised, I_all, l, z) >>> InverseObject.set_solverconfig(weight_value=True, step_limit=200, min_v=0.01)
- set_InnerParameters(**kwargs)
Inner-step Newton Parameters
- Kwargs:
inner_method (str): Method to solver inner step newton. Options: ‘Landweber’, ‘CG’, ‘ME’, ‘LM’, ‘Tikhonov’
land_a (int): Step-size Landweber
ME_reg (float): Minimal value in element for gamma_k
Tik_c0 (float): Regularization parameter Iterative Tikhonov
Tik_q (float): Regularization parameter Iterative Tikhonov
LM_c0 (float): Regularization parameter Levenberg-Marquadt
LM_q (float): Regularization parameter Levenberg-Marquadt
- Default Parameters:
>>> self.inner_method='Landweber' >>> self.land_a=1 >>> self.ME_reg=5E-4 >>> self.Tik_c0=1 >>> self.Tik_q=0.95 >>> self.LM_c0=1 >>> self.LM_q=0.95
- Example
>>> InverseObject=InverseProblem(mesh_inverse, ele_pos, list_U0_noised, I_all, l, z) >>> InverseObject.set_InnerParameters(inner_method='ME', ME_reg=5E-4)