Fitting SIP signaturesΒΆ

This example highlights some of the capabilities of pyGimli to analyze spectral induced polarization (SIP) signatures.

Author: Maximilian Weigand, University of Bonn (Modified(DRY) carsten-forty2

Import pyGIMLi and related stuff for SIP Spectra

from pygimli.physics.SIP import SIPSpectrum, modelColeColeRho
import numpy as np
import pygimli as pg

1. Generate synthetic data with a Double-Cole-Cole Model and initialize an SIPSpectrum object TODO merge with 3

f = np.logspace(-2, 5, 100)
Z1 = modelColeColeRho(f, rho=1, m=0.1, tau=0.5, c=0.5)
Z2 = modelColeColeRho(f, rho=1, m=0.25, tau=1e-6, c=1.0)

rho0 = 100 # (Ohm m)
Z = rho0 * (Z1 + Z2)

sip = SIPSpectrum(f=f, amp=np.abs(Z), phi=-np.angle(Z))
# Note the minus sign for the phases: we need to provide -phase[rad]

sip.showData()
sip.showDataKK()  # check Kramers-Kronig relations
  • plot fitting sip signatures
  • plot fitting sip signatures

Out:

(<Figure size 640x480 with 2 Axes>, array([<matplotlib.axes._subplots.AxesSubplot object at 0x7fb737b683c8>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x7fb71849ad30>],
      dtype=object))
  1. Fit a Cole-Cole model from synthetic data

Z = modelColeColeRho(f, rho=100, m=0.1, tau=0.01, c=0.5)
# TODO data need some noise

sip = SIPSpectrum(f=f, amp=np.abs(Z), phi=-np.angle(Z))
sip.fitColeCole(useCond=False, verbose=False)  # works for both rho and sigma models
sip.showAll()
CC: $\rho$=100.0 m=0.100 $\tau$=1.0e-02s c=0.50

Out:

(<Figure size 1200x1200 with 2 Axes>, array([<matplotlib.axes._subplots.AxesSubplot object at 0x7fb7157cc8d0>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x7fb71573a048>],
      dtype=object))
  1. Fit a double Cole-Cole model

f = np.logspace(-2, 5, 100)
Z1 = modelColeColeRho(f, rho=1, m=0.1, tau=0.5, c=0.5)
Z2 = modelColeColeRho(f, rho=1, m=0.25, tau=1e-6, c=1.0)

rho0 = 100 #(Ohm m)
Z = rho0 * (Z1 + Z2)

# TODO data need some noise
sip = SIPSpectrum(f=f, amp=np.abs(Z), phi=-np.angle(Z))
sip.fitCCEM(verbose=False) # fit an SIP Cole-Cole term and an EM term (also Cole-Cole)
sip.showAll()
CC: m=0.085 $\tau$=2.1e-02s c=0.16 $\tau_2$=1.0e-07s

Out:

(<Figure size 1200x1200 with 2 Axes>, array([<matplotlib.axes._subplots.AxesSubplot object at 0x7fb715360400>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x7fb70f2e2d30>],
      dtype=object))
  1. Fit a Cole-Cole model to

f = np.logspace(-2, 5, 100)
Z = modelColeColeRho(f, rho=100, m=0.1, tau=0.01, c=0.5)
sip = SIPSpectrum(f=f, amp=np.abs(Z), phi=-np.angle(Z))

sip.showAll()
sip.fitDebyeModel(new=True, showFit=True)
pg.wait()
  • plot fitting sip signatures
  • plot fitting sip signatures

Out:

ARMS= 0.00014135944091272931 RRMS= 0.14496805845904442

Note

This tutorial was kindly contributed by Maximilian Weigand (University of Bonn). If you also want to contribute an interesting example, check out our contribution guidelines https://www.pygimli.org/contrib.html.

Total running time of the script: ( 0 minutes 15.611 seconds)

Gallery generated by Sphinx-Gallery