예제 #1
0
def postpro_test(f, g, m, cam, U, res):
    if PLOT:
        plt.figure()
        m.Plot()
        plt.plot(m.pgx, m.pgy, 'k.')
        plt.title('Mesh and Integration Points')

        plt.figure()
        m.Plot(edgecolor='#CCCCCC')
        m.Plot(U, 30, facecolor='r')
        px.PlotMeshImage(f, m, cam)
        px.PlotMeshImage(g, m, cam, U)

        m.PlotContourDispl(U, s=30)
        m.PlotContourStrain(U)
        m.PlotResidualMap(res, cam, 1e5)

    m.VTKMesh('unitary_test_0')
    m.VTKSol('unitary_test_1', U)
예제 #2
0
# Visualization of the mesh using Matplotlib
m.Plot()
# Or Visualization of the mesh using Paraview
m.VTKMesh('dic_composite/Mesh')

#%% ============================================================================
# Pre-processing  ==============================================================
# ==============================================================================

# Build the connectivity table
m.Connectivity()
# Build the quadrature rule; compute FE basis functions and derivatives
m.DICIntegration(cam)
# Plot Mesh on the reference image
px.PlotMeshImage(f,m,cam)

# Open reference image
imdef = imagefile % imnums[-2]
g = px.Image(imdef).Load()

# Multiscale initialization of the displacement
U0=px.MultiscaleInit(m,f,g,cam,3)
m.Plot(U0,30)

#%% ============================================================================
# Classic Modified Gauss Newton  ===============================================
# ==============================================================================
U=U0.copy()
dic=px.DICEngine()
H=dic.ComputeLHS(f,m,cam)
예제 #3
0
m = px.ReadMeshGMSH('gmsh_t3_mm.msh')
m.Plot()

#%% CAMERA MODEL

do_calibration = False

if do_calibration:
    ls = px.LSCalibrator(f, m)
    ls.NewCircle()
    ls.NewLine()
    ls.NewLine()
    ls.FineTuning()
    cam = ls.Calibration()
else:
    # reuse previous calibration parameters
    cam = px.Camera(np.array([-10.509228, -51.082099, 6.440112, -1.573678]))

px.PlotMeshImage(f, m, cam)

#%%

m.Connectivity()
m.DICIntegration(cam)
m.DICIntegrationFast(cam)

U = px.MultiscaleInit(f, g, m, cam, scales=[3, 2, 1])
U, res = px.Correlate(f, g, m, cam, U0=U)

m.PlotContourDispl(U, s=30)
예제 #4
0
    Example 5:
        Other element types.

     """

import numpy as np
import pyxel as px
import matplotlib.pyplot as plt

f = px.Image('zoom-0053_1.tif').Load()
g = px.Image('zoom-0070_1.tif').Load()

# f.SelectROI()
roi = np.array([[537, 24], [850, 488]])
m = dict()
m[0], cam = px.MeshFromROI(roi, 50, f, typel=2)  # tri3
m[1], _ = px.MeshFromROI(roi, 50, f, typel=3)  # qua4
m[2], _ = px.MeshFromROI(roi, 50, f, typel=9)  # tri6
m[3], _ = px.MeshFromROI(roi, 50, f, typel=10)  # qua9
m[4], _ = px.MeshFromROI(roi, 50, f, typel=16)  # qua8

for k in m.keys():
    px.PlotMeshImage(f, m[k], cam)
    m[k].Connectivity()
    m[k].DICIntegration(cam)
    U = px.MultiscaleInit(f, g, m[k], cam, scales=[3, 2, 1], l0=30)
    U, res = px.Correlate(f, g, m[k], cam, U0=U)
    plt.figure()
    m[k].Plot(edgecolor='#CCCCCC')
    m[k].Plot(U, 30)