• Home
  • Documentation
  • Installation
  • Tutorials
  • Examples

Note

Click here to download the full example code

Meshing the Omega aka. BERT logoΒΆ

This is a fun example creating a logo for the BERT software. It illustrates the possibility to hand over matplotlib path objects to the TriangleWrapper.

import matplotlib as mpl
import matplotlib.pyplot as plt

import pygimli as pg

We start by generating a matplotlib path respresenting the \(\Omega\) character.

logo_path = mpl.textpath.TextPath((0, 0), r'$\Omega$', size=5)
patch = mpl.patches.PathPatch(logo_path)

The vertices of the path are defined as mesh nodes and connected with edges.

poly = pg.Mesh(2)

for n in patch.get_verts() * 10:
    poly.createNodeWithCheck(n)

for i in range(poly.nodeCount() - 1):
    poly.createEdge(poly.node(i), poly.node(i + 1))

poly.createEdge(poly.node(poly.nodeCount() - 1), poly.node(0))

Out:

<pygimli.core._pygimli_.Edge object at 0x7f4b712ca850>

We create mesh from the polygone and set the x values as the data for a color transition.

mesh = pg.meshtools.createMesh(poly, area=5)

Last, we create a BERT caption, visualize the mesh and fine-tune the figure.

fig, ax = plt.subplots(figsize=(4, 3))
ax.axis('off')
offset = -10
t = ax.text(mesh.xmin() + (mesh.xmax()-mesh.xmin())/2, offset, 'BERT',
            horizontalalignment='center', size=40, fontweight='bold')
pg.show(mesh, pg.x(mesh.cellCenters()), ax=ax, cMap='Spectral_r',
        logScale=False, showLater=True, showMesh=True, colorBar=False)
ax.set_ylim(offset, mesh.ymax())
plot bert logo

Out:

(-10.0, 37.0)

Download Python source code: plot_bert-logo.py

Download Jupyter notebook: plot_bert-logo.ipynb

Gallery generated by Sphinx-Gallery

  • Examples
  • CAD to mesh tutorial
Tutorial & example gallery
Extrude a 2D mesh to 3D
CAD to mesh tutorial
Building a hybrid mesh in 2D
Flexible mesh generation using Gmsh
Meshing the Omega aka. BERT logo
2D FEM modelling on two-layer example
2D ERT modeling and inversion
3D modeling in a closed geometry
ERT field data with topography
Generating SIP signatures
Complex-valued electrical modeling
Fitting SIP signatures
Four-point sensitivities
Naive complex-valued electrical inversion
Geoelectrics in 2.5D
Crosshole traveltime tomography
Refraction Manager
Refraction in 3D
Raypaths in layered and gradient models
Field data inversion ("Koenigsee")
Gravimetry in 2D - Part I
Semianalytical Gravimetry and Geomagnetics in 2D
Hydrogeophysical modeling
DC-EM Joint inversion
3D Darcy flow
Petrophysical joint inversion
Mesh interpolation
GIMLi Basics
Quality of unstructured meshes
Region markers
The anatomy of a pyGIMLi mesh
Basics of Finite Element Analysis
Modelling with Boundary Conditions
Heat equation in 2D
Polyfit
VES inversion for a blocky model
Geostatistical regularization
VES inversion for a smooth model
Simple fit
Previous Next
Quick links
  • API documentation
  • Code repository
  • Report a bug
  • Researchgate project
  • Citation
  • View page source
  • View page history
  • Improve this page

2021 - GIMLi Development Team
Created using Bootstrap, Sphinx and pyGIMLi 1.1.1+95.g916e10c3 on Mar 06, 2021.