Skip to main content
Ctrl+K

pyGIMLi

Site Navigation

  • Home
  • Documentation
  • API Reference
  • Installation
  • Tutorials
  • Examples

Site Navigation

  • Home
  • Documentation
  • API Reference
  • Installation
  • Tutorials
  • Examples

Section Navigation

  • Mesh generation
    • Meshing the Omega aka. BERT logo
    • CAD to mesh tutorial
    • Extrude a 2D mesh to 3D
    • Flexible mesh generation using Gmsh
    • Building a hybrid mesh in 2D
  • Seismic refraction and traveltime tomography
    • 2D Refraction modelling and inversion
    • Crosshole traveltime tomography
    • Raypaths in layered and gradient models
    • Field data inversion (“Koenigsee”)
    • Refraction in 3D
  • Electrical resistivity tomography
    • 2D ERT modelling and inversion
    • ERT field data with topography
    • 2D FEM modelling on two-layer example
    • Geoelectrics in 2.5D
    • Four-point sensitivities
    • 2D crosshole ERT inversion
    • ERT inversion of data measured on a standing tree
    • 3D surface ERT inversion
    • 3D crosshole ERT inversion
    • Timelapse ERT
    • Reciprocal data analysis of field ERT data
    • 3D modelling in a closed geometry
  • Induced polarization
    • Generating SIP signatures
    • Fitting SIP signatures
    • Complex-valued electrical modelling
    • Naive complex-valued electrical inversion
    • Synthetic TDIP modelling and inversion
  • Gravimetry and magnetics
    • Semianalytical Gravimetry and Geomagnetics in 2D
    • Gravimetry in 2D - Part I
    • 2D gravity modelling and inversion
    • 3D gravity modelling and inversion
    • 3D magnetics modelling and inversion
  • Flow and transport
    • 3D Darcy flow
    • Hydrogeophysical modelling
  • Inversion
    • DC-EM joint inversion
    • Incorporating additional constraints as equations
    • Petrophysical joint inversion
    • Inversion with structural constraints
    • Incorporating prior data into ERT inversion
    • Computing resolution properties
  • Examples
  • Mesh generation
  • Meshing the Omega aka. BERT logo

Note

Go to the end 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))

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

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
(-10.0, 37.0)

Download Jupyter notebook: plot_bert-logo.ipynb

Download Python source code: plot_bert-logo.py

Download zipped: plot_bert-logo.zip

Gallery generated by Sphinx-Gallery

previous

Mesh generation

next

CAD to mesh tutorial

Improve this page
2025 - pyGIMLi Development Team
Created using Sphinx with the PyData theme and pyGIMLi 1.5.4 on Mar 31, 2025.