Module 4 - Auxiliar
- module4_auxiliar.plot_figure(function, name, save=False, map='inferno')
Plot a given function with an optional color map and save the plot if specified.
- Parameters:
function (
dolfin.function.Function
) – The function to plot.name (str) – The title of the plot.
save (bool, optional) – If True, save the plot with the title as the filename.
colormap (str, optional) – The name of the colormap to use for the plot.
- Returns:
None
- Example:
>>> plot_figure(u, "Potential Field", save=True, colormap='viridis')
- module4_auxiliar.getBoundaryVertex(mesh, u)
Get the values of a function u at the boundary vertices of a given mesh.
- Parameters:
mesh (Mesh) – The input mesh.
u (Function) – The function to evaluate at the boundary vertices.
- Returns:
A list of function values at the boundary vertices.
- Return type:
list
- module4_auxiliar.plot_boundary(mesh, data, name='boundary', line=2, data2=1, save=False, plot=True)
Plot the boundary of a mesh along with data.
- Parameters:
mesh (Mesh) – The mesh to plot.
data (numpy.ndarray) – The data to plot on the boundary.
name (str) – The name of the plot (default ‘boundary’).
line (int) – The line width for plotting (default 2).
data2 (int or numpy.ndarray) – Additional data to plot (default 1).
save (bool) – Whether to save the plot (default False).
plot (bool) – Whether to display the plot (default True).
- Returns:
The boundary plot as a numpy array.
- Return type:
numpy.ndarray
- module4_auxiliar.plot_electrodes(mesh, linewidth_mesh=1, linewidth_elec=5, figsize=(5, 5), fontsize=20, elec_num=True, axis=False)
Plot the electrodes on a mesh.
- Parameters:
mesh (Mesh) – A mesh object.
linewidth_mesh (int) – The width of the mesh lines (default 1).
linewidth_elec (int) – The width of the electrode lines (default 5).
figsize (tuple) – The size of the figure (default (5,5)).
fontsize (int) – The font size of the electrode numbers (default 20).
elec_num (bool) – Whether to show electrode numbers (default True).
axis (bool) – Whether to show the axis (default False).
- Returns:
The figure object.
- Return type:
matplotlib.figure.Figure
- module4_auxiliar.EstimateDelta(list_U_noised: ndarray, I: ndarray) float
Estimate the noise level in potential measurements obtained from a grounded electrode system. The method was based on
Robert Winkler work: A model-aware inexact Newton scheme for electrical impedance tomography, 2016.
- Parameters:
list_U_noised (numpy.ndarray) – Noisy potential measurements with shape (l, L).
I (numpy.ndarray) – Current pattern matrix with shape (l, L).
- Returns:
A scalar value representing the estimated noise level in the potential measurements.
- Return type:
float
- Notes:
The data must be measured through a grounded electrode, i.e., the sum of potential of each of the electrodes must be zero.
This function estimates the noise level in potential measurements obtained from a grounded electrode system. It takes two arguments as inputs: list_U_noised and I.
- module4_auxiliar.ConvertingData(U, method)
Convert data from different measurement patterns to the ground pattern.
- Parameters:
U (numpy.ndarray) – The data to be converted.
method (str) – The measurement pattern to be converted to. Currently only “KIT4” is supported.
- Returns:
The converted data.
- Return type:
numpy.ndarray
- module4_auxiliar.EstimateCond(list_U0, I, mesh, z, method='CONT')
Estimate the conductivity of the background based on noisy voltage measurements.
- Parameters:
list_U0 (list) – A list of noisy voltage measurements.
I (numpy.ndarray) – A current pattern matrix.
mesh (Mesh) – A mesh object.
z (numpy.ndarray) – The background impedance (default 1E-5).
method (str) – The method used for estimating conductivity. Options: “CONT”, “SHUNT”, “CEM1”, “CEM2”.
- Returns:
A tuple containing the estimated conductivity and minimum potential.
- Return type:
tuple(float, float)
- module4_auxiliar.EstimateCondIterative(list_U0, I, mesh, z, zmin=1e-05)
Estimate the conductivity of the background based on noisy voltage measurements using an iterative approach.
- Parameters:
list_U0 (list) – A list of noisy voltage measurements.
I (numpy.ndarray) – A current pattern matrix.
mesh (Mesh) – A mesh object.
z (numpy.ndarray) – The background impedance (default 1E-5).
zmin (float) – The minimum background impedance value (default 1E-5).
- Returns:
A tuple containing the estimated conductivity and impedance.
- Return type:
tuple(float, float)