示例#1
0
ms, el_pos = mesh.create(h0=0.15, bbox=bbox)

no2xy = ms['node']
el2no = ms['element']

# report the status of the 2D mesh
quality.stats(no2xy, el2no)
""" 1. FEM forward simulations """
# setup EIT scan conditions
el_dist, step = 7, 1
ex_mat = eit_scan_lines(16, el_dist)

# calculate simulated data
fwd = Forward(ms, el_pos)

# in python, index start from 0
ex_line = ex_mat[1].ravel()

# change alpha
anomaly = [{'x': 0.40, 'y': 0.40, 'z': 0.0, 'd': 0.30, 'alpha': 100.0}]
ms_test = mesh.set_alpha(ms, anomaly=anomaly, background=1.0)
tri_perm = ms_test['alpha']
node_perm = pdeprtni(no2xy, el2no, np.real(tri_perm))

# solving once using fem
f, _ = fwd.solve_once(ex_line, tri_perm)
f = np.real(f)

# mplot.tetplot(p, t, edge_color=(0.2, 0.2, 1.0, 1.0), alpha=0.01)
mplot.tetplot(no2xy, el2no, vertex_color=f, alpha=1.0)
示例#2
0
import numpy as np
import matplotlib.pyplot as plt

# pyEIT 2D algo modules
import pyeit.mesh as mesh
from pyeit.eit.fem import forward
from pyeit.eit.utils import eit_scan_lines
import pyeit.eit.jac as jac

""" 1. setup """
ms, elPos = mesh.create(16)

# test function for altering the 'alpha' in mesh dictionary
anomaly = [{'x': 0.4, 'y': 0.4, 'd': 0.2, 'alpha': 100}]
ms1 = mesh.set_alpha(ms, anom=anomaly, background=1.)

# extract node, element, alpha
no2xy = ms['node']
el2no = ms['element']
alpha = ms1['alpha'] - ms['alpha']

# show alpha
fig = plt.figure()
plt.tripcolor(no2xy[:, 0], no2xy[:, 1], el2no,
              np.real(alpha), shading='flat')
plt.colorbar()
plt.title(r'$\Delta$ Permitivity')
fig.set_size_inches(6, 4.5)

""" 2. calculate simulated data using stack exMtx """
示例#3
0
import numpy as np
import matplotlib.pyplot as plt

# pyEIT 2D algorithm modules
import pyeit.mesh as mesh
from pyeit.eit.fem import Forward
from pyeit.eit.utils import eit_scan_lines
import pyeit.eit.jac as jac

""" 1. setup """
ms, el_pos = mesh.create(16)

# test function for altering the 'alpha' in mesh dictionary
anomaly = [{'x': 0.4, 'y': 0.4, 'd': 0.2, 'alpha': 100}]
ms1 = mesh.set_alpha(ms, anomaly=anomaly, background=1.)

# extract node, element, alpha
no2xy = ms['node']
el2no = ms['element']
alpha = ms1['alpha'] - ms['alpha']

# show alpha
fig, ax = plt.subplots(figsize=(6, 4))
im = ax.tripcolor(no2xy[:, 0], no2xy[:, 1], el2no,
                  np.real(alpha), shading='flat')
fig.colorbar(im)
ax.axis('tight')
ax.set_title(r'$\Delta$ Permitivity')

""" 2. calculate simulated data using stack ex_mat """
示例#4
0
quality.fstats(no2xy, el2no)

""" 1. FEM forward simulations """
# setup EIT scan conditions
elDist, step = 7, 1
exMtx = eit_scan_lines(16, elDist)

# calculate simulated data
fwd = forward(ms, elPos)

# in python, index start from 0
exLine = exMtx[0].ravel()

# change alpha
anomaly = [{"x": 0.50, "y": 0.50, "d": 0.20, "alpha": 10.0}]
ms_test = mesh.set_alpha(ms, anom=anomaly, background=1.0)
tri_perm = ms_test["alpha"]

# solving once using fem
f, _ = fwd.solve_once(exLine, tri_perm)
f = np.real(f)
vf = np.linspace(min(f), max(f), 32)

# plot
fig = plt.figure()
ax1 = fig.add_subplot(111)
ax1.tricontour(no2xy[:, 0], no2xy[:, 1], el2no, f, vf, linewidth=0.5, cmap=plt.cm.viridis)
ax1.tripcolor(
    no2xy[:, 0], no2xy[:, 1], el2no, np.real(tri_perm), edgecolors="k", shading="flat", alpha=0.5, cmap=plt.cm.Greys
)
ax1.plot(no2xy[elPos, 0], no2xy[elPos, 1], "ro")