# pygimli.physics.em¶

Frequency-domain (FD) or time-domain (TD) semi-analytical 1D solutions

## Overview¶

Functions

 importMaxminData(filename[, verbose]) Import function reading in positions, data, frequencies, geometry. readusffile(filename[, data]) Read data from single USF (universal sounding file) file. rhoafromB(B, t, Tx[, current]) Apparent resistivity from B-field TEM rhoafromU(U, t, Tx[, current, Rx]) Apparent resistivity curve from classical TEM (U or dB/dt)

Classes

 FDEM([x, freqs, coilSpacing, inphase, …]) Class for managing Frequency Domain EM data and their inversions. HEMmodelling(nlay, height[, f, r]) HEM Airborne modelling class based on the BGR RESOLVE system. TDEM([filename]) TEM class mainly for holding data etc. VMDTimeDomainModelling(times, txArea[, rxArea])

## Functions¶

### importMaxminData¶

pygimli.physics.em.importMaxminData(filename, verbose=False)[source]

Import function reading in positions, data, frequencies, geometry.

pygimli.physics.em.readusffile(filename, data=None)[source]

Read data from single USF (universal sounding file) file.

data = readusffile( filename ) data = readusffile( filename, data ) will append to data

### rhoafromB¶

pygimli.physics.em.rhoafromB(B, t, Tx, current=1)[source]

Apparent resistivity from B-field TEM

$\rho_a = ( (A_{Tx}*I*\mu_0 ) / (30B) )^2/3 * 4e-7 / t$

### rhoafromU¶

pygimli.physics.em.rhoafromU(U, t, Tx, current=1.0, Rx=None)[source]

Apparent resistivity curve from classical TEM (U or dB/dt)

rhoafromU(U/I, t, TXarea[, RXarea])

$\rho_a = ( A_{Rx} *A_{Tx} * \mu_0 / 20 / (U/I) )^2/3*t^{-5/3}*4e-7$

## Classes¶

FDEM

class pygimli.physics.em.FDEM(x=None, freqs=None, coilSpacing=None, inphase=None, outphase=None, filename=None, scaleFreeAir=False)[source]

Bases: object

Class for managing Frequency Domain EM data and their inversions.

FOP(nlay=2)[source]

Forward modelling operator using a block discretization.

Parameters

nlay (int) – Number of blocks

FOP2d(nlay)[source]

2d forward modelling operator.

FOPsmooth(zvec)[source]

Forward modelling operator using fixed layers (smooth inversion)

Parameters

zvec (array) –

__init__(x=None, freqs=None, coilSpacing=None, inphase=None, outphase=None, filename=None, scaleFreeAir=False)[source]

Initialize data class and load data. Provide filename or data.

If filename is given, data is loaded, overwriting settings.

Parameters
• x (array) – Array of measurement positions

• freq (array) – Measured frequencies

• coilSpacing (float) – Distance between 2 two coils

• inphase (array) – real part of $$|amplitude| * \exp^{i phase}$$

• outphase (array) – imaginary part of $$|amplitude| * \exp^{i phase}$$

• filename (str) – Filename to read from. Supported: .xyz (MaxMin), *.txt (Emsys)

• scaleFreeAir (bool) – Scale inphase and outphase data by free air (primary) solution

datavec(xpos=0)[source]

Extract data vector (stack in and out phase) for given pos/no.

deactivate(fr)[source]

Deactivate a single frequency.

error(xpos=0)[source]

Return error as vector.

errorvec(xpos=0, minvalue=0.0)[source]

Extract error vector for a give position or sounding number.

freq()[source]

Return active (i.e., non-deactivated) frequencies.

importEmsysAsciiData(filename)[source]

Import data from emsys text export file.

columns: no, pos(1-3), separation(4), frequency(6), error(8), inphase (9-11), outphase (12-14), reads: positions, data, frequencies, error and geometry

importMaxminData(filename, verbose=False)[source]

Import MaxMin IPX format with pos, data, frequencies & geometry.

inv2D(nlay, lam=100.0, resL=1.0, resU=1000.0, thkL=1.0, thkU=100.0, minErr=1.0)[source]

2d LCI inversion class.

invBlock(xpos=0, nlay=2, noise=1.0, stmod=30.0, lam=100.0, lBound=0.0, uBound=0.0, verbose=False)[source]

Create and return Gimli inversion instance for block inversion.

Parameters
• xpos (array) – position vector

• nLay (int) – Number of layers of the model to be determined OR vector of layer numbers OR forward operator

• noise (float) – Absolute data err in percent

• stmod (float or pg.Vector) – Starting model

• lam (float) – Global regularization parameter lambda.

• lBound (float) – Lower boundary for the model

• uBound (float) – Upper boundary for the model. 0 means no upper booundary

• verbose (bool) – Be verbose

plotAllData(orientation='horizontal', aspect=1000, outname=None, show=False, figsize=11, 6, everyx=1)[source]

Plot data along a profile as image plots for IP and OP.

plotData(xpos=0, response=None, error=None, ax=None, marker='bo-', rmarker='rx-', clf=True, addlabel='', nv=2)[source]

Plot data as curves at given position.

plotDataOld(xpos=0, response=None, marker='bo-', rmarker='rx-', clf=True)[source]

Plot data as curves at given position.

plotModelAndData(model, xpos, response, modelL=None, modelU=None)[source]

Plot both model and data in subfigures.

readHEMData(filename, takeevery=1, choosevcp=True)[source]

Read RESOLVE type airborne EM data from .XYZ file.

selectData(xpos=0)[source]

Select sounding at a specific position or by number.

Retrieve inphase, outphase and error(if exist) vector from index or near given position

Returns

array OP : array ERR : array or None (if no error is specified)

Return type

IP

showModelAndData(model, xpos=0, response=None, figsize=8, 6)[source]

Show both model and data with response in subfigures.

HEMmodelling

class pygimli.physics.em.HEMmodelling(nlay, height, f=None, r=None, **kwargs)[source]

Bases: pygimli.core.ModellingBaseMT__

HEM Airborne modelling class based on the BGR RESOLVE system.

__init__(nlay, height, f=None, r=None, **kwargs)[source]

Initialize class with geometry

Parameters
• nlay (int) – number of layers

• height (float) – helicopter

• f (array [BGR RESOLVE system 387Hz-133kHz]) – frequency vector

• r (array [BGR RESOLVE system 7.91-7.94]) – distance vector

• scaling (float) – scaling factor or string (ppm=1e6, percent=1e2)

c0 = 299792251.7596404
calc_forward(x, h, rho, d, epr, mur, quasistatic=False)[source]

Calculate forward response.

downward(rho, d, z, epr, mur, lam)[source]

Downward continuation of fields.

ep0 = 8.8542e-12
fdefault = array([ 387., 1821., 8388., 41460., 133300.])
mu0 = 1.2566370614359173e-06
rdefault = array([7.94, 7.93, 7.93, 7.91, 7.92])
response(par)[source]

Compute response vector by pasting in-phase and out-phase data.

scaling = 1000000.0
vmd_hem(h, rho, d, epr=1.0, mur=1.0, quasistatic=False)[source]

Vertical magnetic dipole (VMD) response.

Parameters
• h (float) – flight height

• rho (array) – resistivity vector

• d (array) – thickness vector

vmd_total_Ef(h, z, rho, d, epr, mur, tm)[source]

VMD E-phi field (not used actively).

TDEM

class pygimli.physics.em.TDEM(filename=None)[source]

Bases: object

TEM class mainly for holding data etc.

__init__(filename=None)[source]

Initialize class and (optionally) load data

getFOP(nr=0)[source]

Return forward operator.

invert(nr=0, nlay=4, thickness=None)[source]

Do inversion.

load(filename)[source]

Road data from usf, txt (siroTEM), tem (TEMfast) or UniK file.

plotRhoa(ax=None, ploterror=False, corrramp=False, **kwargs)[source]

Plot all apparent resistivity curves into one window.

plotTransients(ax=None, **kwargs)[source]

Plot all transients into one window

showInfos()[source]
stackAll(tmin=0, tmax=100)[source]

Stack all measurements yielding a new TDEM class instance.

VMDTimeDomainModelling

class pygimli.physics.em.VMDTimeDomainModelling(times, txArea, rxArea=None, **kwargs)[source]

Bases: pygimli.physics.em.vmd.VMDModelling

__init__(times, txArea, rxArea=None, **kwargs)[source]
calcEphiT(tMin, tMax, rho, d, rMin, rMax, z, dipm)[source]

calcRhoa(thk, res)[source]

Compute apparent resistivity response

createStartModel(rhoa, nLayers=None, thickness=None)[source]

Create suitable starting model.

Create suitable starting model based on median apparent resistivity values and skin depth approximation.

response(par)[source]

par = [thicknesses(nLay), res(nlay + 1)]

response_mt(par, i=0)[source]

par = [thicknesses, res]