Cleanup of user_libs especially docs.
5
.gitignore
vendored
@@ -25,10 +25,5 @@ docs/.buildinfo
|
||||
|
||||
# Craig's files
|
||||
.vscode
|
||||
user_libs/landmines/*
|
||||
user_libs/rocks/*
|
||||
user_models/GPU-paper-landmines/
|
||||
user_models/IWAGPR2017-challenge/
|
||||
user_models/to-update/
|
||||
tests/*.out
|
||||
tests/*.png
|
||||
|
@@ -14,6 +14,7 @@ References
|
||||
.. [GIA1997] Giannopoulos, A. (1997). The investigation of Transmission-Line Matrix and Finite-Difference Time-Domain Methods for the Forward Problem of Ground Probing Radar, D.Phil thesis, Department of Electronics, University of York, UK. (http://etheses.whiterose.ac.uk/id/eprint/2443)
|
||||
.. [GIA2012] Giannopoulos, A. (2012). Unsplit implementation of higher order PMLs. Antennas and Propagation, IEEE Transactions on, 60(3), 1479-1485. (http://dx.doi.org/10.1109/tap.2011.2180344)
|
||||
.. [IRE2013] Ireland, D., & Abbosh, A. (2013). Modeling human head at microwave frequencies using optimized Debye models and FDTD method. Antennas and Propagation, IEEE Transactions on, 61(4), 2352-2355. (http://dx.doi.org/10.1109/tap.2013.2242037)
|
||||
.. [KEL2007] Kelley, D. F., Destan, T. J., & Luebbers, R. J. (2007). Debye function expansions of complex permittivity using a hybrid particle swarm-least squares optimization approach. IEEE Transactions on Antennas and propagation, 55(7), 1999-2005. (https://doi.org/10.1109/TAP.2007.900230)
|
||||
.. [KUN1993] Kunz, K. S., & Luebbers, R. J. (1993). The finite difference time domain method for electromagnetics. CRC press.
|
||||
.. [LI2013] Li, J., Guo, L. X., Jiao, Y. C., & Wang, R. (2013). Composite scattering of a plasma-coated target above dispersive sea surface by the ADE-FDTD method. Geoscience and Remote Sensing Letters, IEEE, 10(1), 4-8. (http://dx.doi.org/10.1109/lgrs.2012.2189751)
|
||||
.. [LUE1994] Luebbers, R., Steich, D., & Kunz, K. (1993). FDTD calculation of scattering from frequency-dependent materials. Antennas and Propagation, IEEE Transactions on, 41(9), 1249-1257. (http://dx.doi.org/10.1109/8.247751)
|
||||
|
@@ -210,8 +210,6 @@ def check_cmd_names(processedlines, checkessential=True):
|
||||
# - these will be lists within the dictionary
|
||||
multiplecmds = {key: [] for key in ['#geometry_view',
|
||||
'#geometry_objects_write', '#material',
|
||||
'#havriliak_negami', '#jonscher',
|
||||
'#crim', '#raw_data',
|
||||
'#soil_peplinski',
|
||||
'#add_dispersion_debye',
|
||||
'#add_dispersion_lorentz',
|
||||
|
@@ -17,12 +17,8 @@
|
||||
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
os.path.join(os.path.dirname(__file__), '..', 'user_libs', 'DebyeFit')
|
||||
from user_libs.DebyeFit import (HavriliakNegami, Jonscher, Crim, Rawdata)
|
||||
|
||||
from .cmds_multiuse import (PMLCFS, AddDebyeDispersion, AddDrudeDispersion,
|
||||
from .cmds_multiuse import (AddDebyeDispersion, AddDrudeDispersion,
|
||||
AddLorentzDispersion, GeometryObjectsWrite,
|
||||
GeometryView, HertzianDipole, MagneticDipole,
|
||||
Material, Rx, RxArray, Snapshot, SoilPeplinski,
|
||||
@@ -174,105 +170,6 @@ def process_multicmds(multicmds):
|
||||
|
||||
scene_objects.append(snapshot)
|
||||
|
||||
cmdname = '#havriliak_negami'
|
||||
if multicmds[cmdname] is not None:
|
||||
for cmdinstance in multicmds[cmdname]:
|
||||
tmp = cmdinstance.split()
|
||||
|
||||
if len(tmp) != 12 and len(tmp) != 13:
|
||||
logger.exception("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' requires either twelve or thirteen parameters')
|
||||
raise ValueError
|
||||
seed = None
|
||||
if len(tmp) == 13:
|
||||
seed = int(tmp[12])
|
||||
|
||||
setup = HavriliakNegami(f_min=float(tmp[0]), f_max=float(tmp[1]),
|
||||
alpha=float(tmp[2]), beta=float(tmp[3]),
|
||||
e_inf=float(tmp[4]), de=float(tmp[5]), tau_0=float(tmp[6]),
|
||||
sigma=float(tmp[7]), mu=float(tmp[8]), mu_sigma=float(tmp[9]),
|
||||
number_of_debye_poles=int(tmp[10]), material_name=tmp[11],
|
||||
optimizer_options={'seed': seed})
|
||||
_, properties = setup.run()
|
||||
|
||||
multicmds['#material'].append(properties[0].split(':')[1].strip(' \t\n'))
|
||||
multicmds['#add_dispersion_debye'].append(properties[1].split(':')[1].strip(' \t\n'))
|
||||
|
||||
cmdname = '#jonscher'
|
||||
if multicmds[cmdname] is not None:
|
||||
for cmdinstance in multicmds[cmdname]:
|
||||
tmp = cmdinstance.split()
|
||||
|
||||
if len(tmp) != 11 and len(tmp) != 12:
|
||||
logger.exception("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' requires either eleven or twelve parameters')
|
||||
raise ValueError
|
||||
seed = None
|
||||
if len(tmp) == 12:
|
||||
seed = int(tmp[11])
|
||||
|
||||
setup = Jonscher(f_min=float(tmp[0]), f_max=float(tmp[1]),
|
||||
e_inf=float(tmp[2]), a_p=float(tmp[3]),
|
||||
omega_p=float(tmp[4]), n_p=float(tmp[5]),
|
||||
sigma=float(tmp[6]), mu=float(tmp[7]), mu_sigma=float(tmp[8]),
|
||||
number_of_debye_poles=int(tmp[9]), material_name=tmp[10],
|
||||
optimizer_options={'seed': seed})
|
||||
_, properties = setup.run()
|
||||
|
||||
multicmds['#material'].append(properties[0].split(':')[1].strip(' \t\n'))
|
||||
multicmds['#add_dispersion_debye'].append(properties[1].split(':')[1].strip(' \t\n'))
|
||||
|
||||
cmdname = '#crim'
|
||||
if multicmds[cmdname] is not None:
|
||||
for cmdinstance in multicmds[cmdname]:
|
||||
tmp = cmdinstance.split()
|
||||
|
||||
if len(tmp) != 10 and len(tmp) != 11:
|
||||
logger.exception("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' requires either ten or eleven parameters')
|
||||
raise ValueError
|
||||
seed = None
|
||||
if len(tmp) == 11:
|
||||
seed = int(tmp[10])
|
||||
|
||||
if (tmp[3][0] != '[' and tmp[3][-1] != ']') or (tmp[4][0] != '[' and tmp[4][-1] != ']'):
|
||||
logger.exception("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' requires list at 6th and 7th position')
|
||||
raise ValueError
|
||||
vol_frac = [float(i) for i in tmp[3].strip('[]').split(',')]
|
||||
material = [float(i) for i in tmp[4].strip('[]').split(',')]
|
||||
if len(material) % 3 != 0:
|
||||
logger.exception("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' each material requires three parameters: e_inf, de, tau_0')
|
||||
raise ValueError
|
||||
materials = [material[n:n+3] for n in range(0, len(material), 3)]
|
||||
|
||||
setup = Crim(f_min=float(tmp[0]), f_max=float(tmp[1]), a=float(tmp[2]),
|
||||
volumetric_fractions=vol_frac, materials=materials,
|
||||
sigma=float(tmp[5]), mu=float(tmp[6]), mu_sigma=float(tmp[7]),
|
||||
number_of_debye_poles=int(tmp[8]), material_name=tmp[9],
|
||||
optimizer_options={'seed': seed})
|
||||
_, properties = setup.run()
|
||||
|
||||
multicmds['#material'].append(properties[0].split(':')[1].strip(' \t\n'))
|
||||
multicmds['#add_dispersion_debye'].append(properties[1].split(':')[1].strip(' \t\n'))
|
||||
|
||||
cmdname = '#raw_data'
|
||||
if multicmds[cmdname] is not None:
|
||||
for cmdinstance in multicmds[cmdname]:
|
||||
tmp = cmdinstance.split()
|
||||
|
||||
if len(tmp) != 6 and len(tmp) != 7:
|
||||
logger.exception("'" + cmdname + ': ' + ' '.join(tmp) + "'" + ' requires either six or seven parameters')
|
||||
raise ValueError
|
||||
seed = None
|
||||
if len(tmp) == 7:
|
||||
seed = int(tmp[6])
|
||||
|
||||
setup = Rawdata(filename=tmp[0], sigma=float(tmp[1]),
|
||||
mu=float(tmp[2]), mu_sigma=float(tmp[3]),
|
||||
number_of_debye_poles=int(tmp[4]), material_name=tmp[5],
|
||||
optimizer_options={'seed': seed})
|
||||
_, properties = setup.run()
|
||||
|
||||
multicmds['#material'].append(properties[0].split(':')[1].strip(' \t\n'))
|
||||
multicmds['#add_dispersion_debye'].append(properties[1].split(':')[1].strip(' \t\n'))
|
||||
|
||||
cmdname = '#material'
|
||||
if multicmds[cmdname] is not None:
|
||||
for cmdinstance in multicmds[cmdname]:
|
||||
|
@@ -17,6 +17,7 @@
|
||||
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import os
|
||||
|
||||
import h5py
|
||||
@@ -24,6 +25,8 @@ import matplotlib.image as mpimg
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Cursor(object):
|
||||
"""Get RGB(A) value of pixel at x,y coordinate of button press and store in a list."""
|
||||
@@ -50,7 +53,7 @@ class Cursor(object):
|
||||
pixel = np.floor(pixel * 255).astype(np.int16) # Convert pixel values from float (0-1) to integer (0-255)
|
||||
match = pixel_match(materials, pixel)
|
||||
if match is False:
|
||||
print('x, y: {} {} px; RGB: {}; material ID: {}'.format(int(x), int(y), pixel[:-1], len(self.materials)))
|
||||
logger.info('x, y: {} {} px; RGB: {}; material ID: {}'.format(int(x), int(y), pixel[:-1], len(self.materials)))
|
||||
materials.append(pixel)
|
||||
|
||||
def pixel_match(pixellist, pixeltest):
|
||||
@@ -87,8 +90,8 @@ if __name__ == "__main__":
|
||||
imdata = np.rot90(im, k=3) # Rotate 90CW
|
||||
imdata = np.floor(imdata * 255).astype(np.int16) # Convert pixel values from float (0-1) to integer (0-255)
|
||||
|
||||
print('Reading PNG image file: {}'.format(os.path.split(args.imagefile)[1]))
|
||||
print(' 1. Select discrete material colours by clicking on parts of the image.\n 2. When all materials have been selected close the image.')
|
||||
logger.info('Reading PNG image file: {}'.format(os.path.split(args.imagefile)[1]))
|
||||
logger.info(' 1. Select discrete material colours by clicking on parts of the image.\n 2. When all materials have been selected close the image.')
|
||||
|
||||
# List to hold selected RGB values from image
|
||||
materials = []
|
||||
@@ -123,4 +126,4 @@ if __name__ == "__main__":
|
||||
# Write data to file
|
||||
fout.create_dataset('data', data=data)
|
||||
|
||||
print('Written HDF5 file: {}'.format(os.path.split(hdf5file)[1]))
|
||||
logger.info('Written HDF5 file: {}'.format(os.path.split(hdf5file)[1]))
|
||||
|
@@ -54,9 +54,9 @@ def calculate_antenna_params(filename, tltxnumber=1, tlrxnumber=None, rxnumber=N
|
||||
time = np.linspace(0, (iterations - 1) * dt, num=iterations)
|
||||
df = 1 / np.amax(time)
|
||||
|
||||
print(f'Time window: {np.amax(time):g} s ({iterations} iterations)')
|
||||
print(f'Time step: {dt:g} s')
|
||||
print(f'Frequency bin spacing: {df:g} Hz')
|
||||
logger.info(f'Time window: {np.amax(time):g} s ({iterations} iterations)')
|
||||
logger.info(f'Time step: {dt:g} s')
|
||||
logger.info(f'Frequency bin spacing: {df:g} Hz')
|
||||
|
||||
# Read/calculate voltages and currents from transmitter antenna
|
||||
tltxpath = '/tls/tl' + str(tltxnumber) + '/'
|
||||
@@ -175,11 +175,11 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref,
|
||||
|
||||
# Print some useful values from s11, and input impedance
|
||||
s11minfreq = np.where(s11[pltrange] == np.amin(s11[pltrange]))[0][0]
|
||||
print(f's11 minimum: {np.amin(s11[pltrange]):g} dB at {freqs[s11minfreq + pltrangemin]:g} Hz')
|
||||
print(f'At {freqs[s11minfreq + pltrangemin]:g} Hz...')
|
||||
print(f'Input impedance: {np.abs(zin[s11minfreq + pltrangemin]):.1f}{zin[s11minfreq + pltrangemin].imag:+.1f}j Ohms')
|
||||
# print(f'Input admittance (mag): {np.abs(yin[s11minfreq + pltrangemin]):g} S')
|
||||
# print(f'Input admittance (phase): {np.angle(yin[s11minfreq + pltrangemin], deg=True):.1f} deg')
|
||||
logger.info(f's11 minimum: {np.amin(s11[pltrange]):g} dB at {freqs[s11minfreq + pltrangemin]:g} Hz')
|
||||
logger.info(f'At {freqs[s11minfreq + pltrangemin]:g} Hz...')
|
||||
logger.info(f'Input impedance: {np.abs(zin[s11minfreq + pltrangemin]):.1f}{zin[s11minfreq + pltrangemin].imag:+.1f}j Ohms')
|
||||
# logger.info(f'Input admittance (mag): {np.abs(yin[s11minfreq + pltrangemin]):g} S')
|
||||
# logger.info(f'Input admittance (phase): {np.angle(yin[s11minfreq + pltrangemin], deg=True):.1f} deg')
|
||||
|
||||
# Figure 1
|
||||
# Plot incident voltage
|
||||
|
@@ -81,23 +81,23 @@ def mpl_plot(w, timewindow, dt, iterations, fft=False):
|
||||
waveform[timeiter.index] = w.calculate_value(timeiter[0], dt)
|
||||
timeiter.iternext()
|
||||
|
||||
print('Waveform characteristics...')
|
||||
print(f'Type: {w.type}')
|
||||
print(f'Maximum (absolute) amplitude: {np.max(np.abs(waveform)):g}')
|
||||
logger.info('Waveform characteristics...')
|
||||
logger.info(f'Type: {w.type}')
|
||||
logger.info(f'Maximum (absolute) amplitude: {np.max(np.abs(waveform)):g}')
|
||||
|
||||
if w.freq and not w.type == 'gaussian':
|
||||
print(f'Centre frequency: {w.freq:g} Hz')
|
||||
logger.info(f'Centre frequency: {w.freq:g} Hz')
|
||||
|
||||
if (w.type == 'gaussian' or w.type == 'gaussiandot' or w.type == 'gaussiandotnorm'
|
||||
or w.type == 'gaussianprime' or w.type == 'gaussiandoubleprime'):
|
||||
delay = 1 / w.freq
|
||||
print(f'Time to centre of pulse: {delay:g} s')
|
||||
logger.info(f'Time to centre of pulse: {delay:g} s')
|
||||
elif w.type == 'gaussiandotdot' or w.type == 'gaussiandotdotnorm' or w.type == 'ricker':
|
||||
delay = np.sqrt(2) / w.freq
|
||||
print(f'Time to centre of pulse: {delay:g} s')
|
||||
logger.info(f'Time to centre of pulse: {delay:g} s')
|
||||
|
||||
print(f'Time window: {timewindow:g} s ({iterations} iterations)')
|
||||
print(f'Time step: {dt:g} s')
|
||||
logger.info(f'Time window: {timewindow:g} s ({iterations} iterations)')
|
||||
logger.info(f'Time step: {dt:g} s')
|
||||
|
||||
if fft:
|
||||
# FFT
|
||||
|
@@ -17,7 +17,7 @@ Information
|
||||
|
||||
`AustinMan and AustinWoman <http://bit.ly/AustinMan>`_ are open source electromagnetic voxel models of the human body, which are developed by the `Computational Electromagnetics Group <http://www.ece.utexas.edu/research/areas/electromagnetics-acoustics>`_ at `The University of Texas at Austin <http://www.utexas.edu>`_. The models are based on data from the `National Library of Medicine’s Visible Human Project <https://www.nlm.nih.gov/research/visible/visible_human.html>`_.
|
||||
|
||||
.. figure:: images/user_libs/AustinMan_head.png
|
||||
.. figure:: images/AustinMan_head.png
|
||||
:width: 600 px
|
||||
|
||||
FDTD geometry mesh showing the head of the AustinMan model (2x2x2mm :math:`^3`).
|
||||
@@ -37,7 +37,7 @@ AustinWoman 2x2x2 342 x 187 x 865
|
||||
AustinWoman 1x1x1 683 x 374 x 1730
|
||||
=========== ========================== ==================
|
||||
|
||||
Package overview
|
||||
Package contents
|
||||
================
|
||||
|
||||
.. code-block:: none
|
||||
@@ -56,8 +56,8 @@ Package overview
|
||||
|
||||
* ``head_only_h5.py`` is a script to assist with creating a model of only the head from a full body AustinMan/Woman model.
|
||||
|
||||
How to use the models
|
||||
=====================
|
||||
How to use the package
|
||||
======================
|
||||
|
||||
The AustinMan and AustinWoman models themselves are not included in the user libraries sub-package.
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2015-2021, Iraklis Giannakis and Sylwia Majchrowska
|
||||
# Copyright (C) 2015-2022, Iraklis Giannakis and Sylwia Majchrowska
|
||||
#
|
||||
# This module is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||
# To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/.
|
||||
|
@@ -1,356 +0,0 @@
|
||||
Fitting multi-pole Debye model to dielectric data
|
||||
=================================================
|
||||
|
||||
All electromagnetic phenomena are governed by the Maxwell's equations, which describing how electric and magnetic fields are distributed due to charges and currents,
|
||||
and how they are changing in time. gprMax is open source software that simulates electromagnetic wave propagation by using
|
||||
Yee's algorithm to solve (3+1)D Maxwell’s equations with Finite-Difference Time-Domain (FDTD) method.
|
||||
The behavior of the electromagnetic wave is closely dependent on the material in which it propagates.
|
||||
Some dispersive media have quite complex electromagnetic properties depending on the wavelength.
|
||||
This, for example, means that for different frequencies the wave can propagate with a different speed in different materials.
|
||||
This significantly affects the solver’s output. The main goal of the GSoC 2021 project was to enhance series of scripts,
|
||||
which modelled electromagnetic properties of the variety range of materials.
|
||||
|
||||
Multi-pole Debye model
|
||||
======================
|
||||
|
||||
Electric permittivity is a complex function with both real and imaginary parts.
|
||||
In general, as a hard and fast rule, the real part dictates the velocity of the medium while the imaginary part is related to the electromagnetic losses.
|
||||
The generic form of dispersive media takes a form of
|
||||
|
||||
.. math::
|
||||
|
||||
\epsilon(\omega) = \epsilon^{'}(\omega) - j\epsilon^{''}(\omega),
|
||||
|
||||
where :math:`\omega` is the angular frequency, :math:`\epsilon^{'}` and :math:`\epsilon^{''}` are the real and imaginary parts of the permittivity respectively.
|
||||
|
||||
In the ``user_libs`` sub-package is a module called ``DebyeFit`` which can be used to fit a multi-Debye expansion to dielectric data, defined as
|
||||
|
||||
.. math::
|
||||
|
||||
\epsilon(\omega) = \epsilon_{\infty} + \sum_{i=1}^{N}\frac{\Delta\epsilon_{i}}{1+j\omega t_{0,i}},
|
||||
|
||||
where :math:`\epsilon(\omega)` is frequency dependent dielectric permittivity, :math:`\Delta\epsilon` - difference between the real permittivity at zero and infinity frequency.
|
||||
:math:`\tau_{0}` is relaxation time (s), :math:`\epsilon_{\infty}` - real part of relative permittivity at infinity frequency, and :math:`N` is number of the Debye poles.
|
||||
|
||||
The user can choose between Havriliak-Negami, Jonscher, Complex Refractive Index Mixing models, and arbitrary dielectric data derived experimentally
|
||||
or calculated using some other function to fit the data to a multi-Debye expansion.
|
||||
|
||||
<div align="center">
|
||||
<img src="docs/epsilon.png" width="600"/>
|
||||
</div>
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
``DebyeFit`` sub-package is currently released under the `GNU General Public License v3 or higher <http://www.gnu.org/copyleft/gpl.html>`_.
|
||||
|
||||
Code structure
|
||||
==============
|
||||
|
||||
The ``DebyeFit`` sub-package contains two main scripts:
|
||||
|
||||
* ```Debye_fit.py``` with definition of all Relaxation functions classes,
|
||||
* ```optimization.py``` with definition of three choosen global optimization methods.
|
||||
|
||||
|
||||
Class Relaxation
|
||||
################
|
||||
|
||||
This class is designed for modelling different relaxation functions, like Havriliak-Negami (```Class HavriliakNegami```), Jonscher (```Class Jonscher```), Complex Refractive Index Mixing (```Class CRIM```) models, and arbitrary dielectric data derived experimentally
|
||||
or calculated using some other function (```Class Rawdata```).
|
||||
|
||||
More about ``Class Relaxation`` structure can be found in [relaxation.md](docs/relaxation.md).
|
||||
|
||||
Havriliak-Negami Function
|
||||
*************************
|
||||
|
||||
The Havriliak–Negami relaxation is an empirical modification of the Debye relaxation model in electromagnetism, which in additionto the Debye equation has two exponential parameters
|
||||
|
||||
.. math::
|
||||
|
||||
\epsilon(\omega) = \epsilon_{\infty} + \frac{\Delta\epsilon}{\left(1+\left(j\omega t_{0}\right)^{a}\right)^{b}}
|
||||
|
||||
|
||||
The ``HavriliakNegami`` class has the following structure:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
HavriliakNegami(f_min, f_max,
|
||||
alpha, beta, e_inf, de, tau_0,
|
||||
sigma, mu, mu_sigma, material_name,
|
||||
number_of_debye_poles=-1, f_n=50,
|
||||
plot=False, save=True,
|
||||
optimizer=PSO_DLS,
|
||||
optimizer_options={})
|
||||
|
||||
|
||||
* ``f_min`` is first bound of the frequency range used to approximate the given function (Hz),
|
||||
* ``f_max`` is second bound of the frequency range used to approximate the given function (Hz),
|
||||
* ``alpha`` is real positive float number which varies 0 < $\alpha$ < 1,
|
||||
* ``beta`` is real positive float number which varies 0 < $\beta$ < 1,
|
||||
* ``e_inf`` is a real part of relative permittivity at infinity frequency,
|
||||
* ``de`` is a difference between the real permittivity at zero and infinity frequency,
|
||||
* ``tau_0`` is a relaxation time (s),
|
||||
* ``sigma`` is a conductivity (Siemens/metre),
|
||||
* ``mu`` is a relative permeability,
|
||||
* ``mu_sigma`` is a magnetic loss (Ohms/metre),
|
||||
* ``material_name`` is definition of material name,
|
||||
* ``number_of_debye_poles`` is choosen number of Debye poles,
|
||||
* ``f_n`` is choosen number of frequences,
|
||||
* ``plot`` is a switch to turn on the plotting,
|
||||
* ``save`` is a switch to turn on the saving final material properties,
|
||||
* ``optimizer`` is a choosen optimizer to fit model to dielectric data,
|
||||
* ``optimizer_options`` is a dict for options of choosen optimizer.
|
||||
|
||||
Jonscher Function
|
||||
****************
|
||||
|
||||
Jonscher function is mainly used to describe the dielectric properties of concrete and soils. The frequency domain expression of Jonscher
|
||||
function is given by
|
||||
|
||||
.. math::
|
||||
|
||||
\epsilon(\omega) = \epsilon_{\infty} + a_{p}*\left( -j*\frac{\omega}{\omega_{p}} \right)^{n}
|
||||
|
||||
|
||||
The ``Jonscher`` class has the following structure:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
Jonscher(f_min, f_max,
|
||||
e_inf, a_p, omega_p, n_p,
|
||||
sigma, mu, mu_sigma,
|
||||
material_name, number_of_debye_poles=-1,
|
||||
f_n=50, plot=False, save=True,
|
||||
optimizer=PSO_DLS,
|
||||
optimizer_options={})
|
||||
|
||||
|
||||
* ``f_min`` is first bound of the frequency range used to approximate the given function (Hz),
|
||||
* ``f_max`` is second bound of the frequency range used to approximate the given function (Hz),
|
||||
* ``e_inf`` is a real part of relative permittivity at infinity frequency,
|
||||
* ``a_p``` is a Jonscher parameter. Real positive float number,
|
||||
* ``omega_p`` is a Jonscher parameter. Real positive float number,
|
||||
* ``n_p`` Jonscher parameter, 0 < n_p < 1.
|
||||
|
||||
Complex Refractive Index Mixing (CRIM) Function
|
||||
***********************************************
|
||||
|
||||
CRIM is the most mainstream approach for estimating the bulk permittivity of heterogeneous materials and has been widely applied for GPR applications. The function takes form of
|
||||
|
||||
.. math::
|
||||
|
||||
\epsilon(\omega)^{d} = \sum_{i=1}^{m}f_{i}\epsilon_{m,i}(\omega)^{d}
|
||||
|
||||
|
||||
The ``CRIM`` class has the following structure:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
CRIM(f_min, f_max, a, volumetric_fractions,
|
||||
materials, sigma, mu, mu_sigma, material_name,
|
||||
number_of_debye_poles=-1, f_n=50,
|
||||
plot=False, save=True,
|
||||
optimizer=PSO_DLS,
|
||||
optimizer_options={})
|
||||
|
||||
|
||||
* ``f_min`` is first bound of the frequency range used to approximate the given function (Hz),
|
||||
* ``f_max`` is second bound of the frequency range used to approximate the given function (Hz),
|
||||
* ``a`` is a shape factor,
|
||||
* ``volumetric_fractions`` is a volumetric fraction for each material,
|
||||
* ``materials`` are arrays of materials properties, for each material [e_inf, de, tau_0].
|
||||
|
||||
Rawdata Class
|
||||
*************
|
||||
|
||||
The present package has the ability to model dielectric properties obtained experimentally by fitting multi-Debye functions to data given from a file.
|
||||
The format of the file should be three columns. The first column contains the frequencies (Hz) associated with the electric permittivity point.
|
||||
The second column contains the real part of the relative permittivity. The third column contains the imaginary part of the relative permittivity.
|
||||
The columns should separated by coma by default (is it posible to define different separator).
|
||||
|
||||
The ``Rawdata`` class has the following structure:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
Rawdata(self, filename,
|
||||
sigma, mu, mu_sigma,
|
||||
material_name, number_of_debye_poles=-1,
|
||||
f_n=50, delimiter =',',
|
||||
plot=False, save=True,
|
||||
optimizer=PSO_DLS,
|
||||
optimizer_options={})
|
||||
|
||||
|
||||
* ``filename`` is a path to text file which contains three columns,
|
||||
* ``delimiter`` is a separator for three data columns.
|
||||
|
||||
Class Optimizer
|
||||
###############
|
||||
|
||||
This class supports global optimization algorithms (particle swarm, duall annealing, evolutionary algorithms) for finding an optimal set of relaxation times that minimise the error between the actual and the approximated electric permittivity and calculate optimised weights for the given relaxation times.
|
||||
Code written here is mainly based on external libraries, like ```scipy``` and ```pyswarm```.
|
||||
|
||||
More about ``Class Optimizer`` structure can be found in [optimization.md](docs/optimization.md).
|
||||
|
||||
PSO_DLS Class
|
||||
*************
|
||||
|
||||
Creation of hybrid Particle Swarm-Damped Least Squares optimisation object with predefined parameters.
|
||||
The current code is a modified edition of the pyswarm package which can be found at https://pythonhosted.org/pyswarm/.
|
||||
|
||||
DA_DLS Class
|
||||
************
|
||||
|
||||
Creation of Dual Annealing-Damped Least Squares optimisation object with predefined parameters. The current class is a modified edition of the scipy.optimize package which can be found at:
|
||||
https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.dual_annealing.html#scipy.optimize.dual_annealing.
|
||||
|
||||
DE_DLS Class
|
||||
************
|
||||
|
||||
Creation of Differential Evolution-Damped Least Squares object with predefined parameters. The current class is a modified edition of the scipy.optimize package which can be found at:
|
||||
https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.differential_evolution.html#scipy.optimize.differential_evolution.
|
||||
|
||||
DLS function
|
||||
************
|
||||
|
||||
Finding the weights using a non-linear least squares (LS) method, the Levenberg–Marquardt algorithm (LMA or just LM), also known as the damped least-squares (DLS) method.
|
||||
|
||||
Examples
|
||||
########
|
||||
|
||||
In directory [examples](./examles), we provided jupyter notebooks, scripts and data to show how use stand alone script ```DebyeFit.py```:
|
||||
|
||||
* ```example_DebyeFitting.ipynb```: simple cases of using all available implemented relaxation functions,
|
||||
* ```example_BiologicalTissues.ipynb```: simple cases of using Cole-Cole function for biological tissues,
|
||||
* ```example_ColeCole.py```: simple cases of using Cole-Cole function in case of 3, 5 and automatically chosen number of Debye poles,
|
||||
* ```Test.txt```: raw data for testing ```Rawdata Class```, file contains 3 columns: the first column contains the frequencies (Hz) associated with the value of the permittivity, second column contains the real part of the relative permittivity, and the third one the imaginary part of the relative permittivity. The columns should separated by comma.
|
||||
|
||||
Dispersive material commands
|
||||
============================
|
||||
|
||||
gprMax has implemented an optimisation approach to fit a multi-Debye expansion to dielectric data.
|
||||
The user can choose between Havriliak-Negami, Johnsher and Complex Refractive Index Mixing models, fit arbitrary dielectric data derived experimentally or calculated using some other function.
|
||||
Notice that Havriliak-Negami is an inclusive function that holds as special cases the widely-used **Cole-Cole** and **Cole-Davidson** functions.
|
||||
|
||||
.. note::
|
||||
|
||||
The technique employed here as a default is a hybrid linear-nonlinear optimisation proposed by Kelley et. al (2007).
|
||||
Their method was slightly adjusted to overcome some instability issues and thus making the process more robust and faster.
|
||||
In particular, in the case of negative weights we inverse the sign in order to introduce a large penalty in the optimisation process thus indirectly constraining the weights
|
||||
to be always positive. This made dumbing factors unnecessary and consequently they were removed from the algorithm. Furthermore we added the real part to the cost action
|
||||
to avoid possible instabilities to arbitrary given functions that does not follow the Kramers–Kronig relationship.
|
||||
|
||||
.. warning::
|
||||
|
||||
* The fitting accuracy depends on the number of the Debye poles as well as the fitted function. It is advised to check if the resulted accuracy is sufficient for your application.
|
||||
|
||||
* Increasing the number of Debye poles will make the approximation more accurate but it will increase the overall computational resources of FDTD.
|
||||
|
||||
#havriliak_negami:
|
||||
##################
|
||||
|
||||
Allows you to model dielectric properties by fitting multi-Debye functions to Havriliak-Negami function. The syntax of the command is:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
#havriliak_negami: f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 i1 str1 [i2]
|
||||
|
||||
* ``f1`` is the lower frequency bound (Hz).
|
||||
* ``f2`` is the upper frequency bound (Hz).
|
||||
* ``f3`` is the :math:`\alpha` parameter beetwen bonds :math:`\left(0 < \alpha < 1 \right)`.
|
||||
* ``f4`` is the :math:`\beta` parameter beetwen bonds :math:`\left(0 < \beta < 1 \right)`.
|
||||
* ``f5`` is the real relative permittivity at infinity frequency, :math:`\epsilon_{\infty}`.
|
||||
* ``f6`` is the difference between the real permittivity at zero and infinity frequency, :math:`\Delta\epsilon`.
|
||||
* ``f7`` is the relaxation time (s), :math:`t_{0}`.
|
||||
* ``f8`` is the conductivity (Siemens/metre), :math:`\sigma`
|
||||
* ``f9`` is the relative permeability, :math:`\mu_r`
|
||||
* ``f10`` is the magnetic loss (Ohms/metre), :math:`\sigma_*`
|
||||
* ``i1`` is the number of Debye poles, set to -1 will be automatically calculated tends to minimize the relative absolut error.
|
||||
* ``str1`` is an identifier for the material.
|
||||
* ``i2`` is an optional parameter which controls the seeding of the random number generator used in stochastic global optimizator. By default (if you don't specify this parameter) the random number generator will be seeded by trying to read data from ``/dev/urandom`` (or the Windows analogue) if available or from the clock otherwise.
|
||||
|
||||
|
||||
For example ``#havriliak_negami: 1e4 1e11 0.3 1 3.4 2.7 0.8e-10 4.5e-4 1 0 5 dry_sand`` creates a material called ``dry_sand``, and approximates using five Debye poles a Cole-Cole function with :math:`\epsilon_{\infty}=3.4`, :math:`\Delta\epsilon=2.7`, :math:`t_{0}=8^{-9}` and :math:`a=0.3`.
|
||||
The resulting output is the set of gprMax commands and optional a plot with the actual and the approximated Cole-Cole function.
|
||||
|
||||
#jonscher:
|
||||
##########
|
||||
|
||||
Allows you to model dielectric properties by fitting multi-Debye functions to Jonscher function. The syntax of the command is:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
#jonscher: f1 f2 f3 f4 f5 f6 f7 f8 f9 i1 str1 [i2]
|
||||
|
||||
* ``f1`` is the lower frequency bound (in Hz).
|
||||
* ``f2`` is the upper frequency bound (in Hz).
|
||||
* ``f3`` is the real relative permittivity at infinity frequency, :math:`\epsilon_{\infty}`.
|
||||
* ``f4`` is the :math:`a_{p}` parameter.
|
||||
* ``f5`` is the :math:`\omega_{p}` parameter.
|
||||
* ``f6`` is the :math:`n_{p}` parameter.
|
||||
* ``f7`` is the conductivity (Siemens/metre), :math:`\sigma`
|
||||
* ``f8`` is the relative permeability, :math:`\mu_r`
|
||||
* ``f9`` is the magnetic loss (Ohms/metre), :math:`\sigma_*`
|
||||
* ``i1`` is the number of Debye poles, set to -1 will be automatically calculated tends to minimize the relative absolut error.
|
||||
* ``str1`` is an identifier for the material.
|
||||
* ``i2`` is an optional parameter which controls the seeding of the random number generator used in stochastic global optimizator. By default (if you don't specify this parameter) the random number generator will be seeded by trying to read data from ``/dev/urandom`` (or the Windows analogue) if available or from the clock otherwise.
|
||||
|
||||
For example ``#jonscher: 1e6 1e-5 4.39 7.49 5e-10 0.4 0.1 1 0.1 4 Material_Jonscher`` creates a material called ``Material_Jonscher``, and approximates using four Debye poles a Johnsher function with :math:`\epsilon_{\infty}=4.39`, :math:`a_{p}=7.49`, :math:`\omega_{p}=0.5\times 10^{9}` and :math:`n=0.4`.
|
||||
The resulting output is the set of gprMax commands and optional a plot with the actual and the approximated Johnsher function.
|
||||
|
||||
#crim:
|
||||
######
|
||||
|
||||
Allows you to model dielectric properties by fitting multi-Debye functions to CRIM function. The syntax of the command is:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
#crim: f1 f2 f3 v1 v2 f4 f5 f6 i1 str1 [i2]
|
||||
|
||||
* ``f1`` is the lower frequency bound (in Hz).
|
||||
* ``f2`` is the upper frequency bound (in Hz).
|
||||
* ``f3`` is the shape factor, :math:`a`
|
||||
* ``v1`` is the vector (paramiter given in input file with `[]`) of volumetric fractions [f1, f2 .... ]. The nuber of paramiters depend on number of materials.
|
||||
* ``v2`` is the vector (paramiter given in input file with `[]`) containing the materials properties [:math:`\epsilon_{1\infty}`, :math:`\Delta\epsilon_{1}`, :math:`t_{0}_{1}`, :math:`\epsilon_{2\infty}`, :math:`\Delta\epsilon_{2}`, :math:`t_{0}_{2}` .... ]. The number of material vector must be divisible by three.
|
||||
* ``f4`` is the conductivity (Siemens/metre), :math:`\sigma`
|
||||
* ``f5`` is the relative permeability, :math:`\mu_r`
|
||||
* ``f6`` is the magnetic loss (Ohms/metre), :math:`\sigma_*`
|
||||
* ``i1`` is the number of Debye poles, set to -1 will be automatically calculated tends to minimize the relative absolut error.
|
||||
* ``str1`` is an identifier for the material.
|
||||
* ``i2`` is an optional parameter which controls the seeding of the random number generator used in stochastic global optimizator. By default (if you don't specify this parameter) the random number generator will be seeded by trying to read data from ``/dev/urandom`` (or the Windows analogue) if available or from the clock otherwise.
|
||||
|
||||
For example ``#crim: 1e-1 1e-9 0.5 [0.5,0.1,0.4] [3,25,1e-8,3,25,1e-9,1,10,1e-10] 0 1 0 5 CRIM`` creates a material called ``CRIM``, and approximates using five Debye poles the following CRIM function
|
||||
|
||||
.. math::
|
||||
\epsilon(\omega)^{0.5} = \sum_{i=1}^{m}f_{i}\epsilon_{m,i}(\omega)^{0.5}
|
||||
.. math::
|
||||
f = [0.5, 0.1, 0.4]
|
||||
.. math::
|
||||
\epsilon_{m,1} = 3 + \frac{25}{1+j\omega\times 10^{-8}}
|
||||
.. math::
|
||||
\epsilon_{m,2} = 3 + \frac{25}{1+j\omega\times 10^{-9}}
|
||||
.. math::
|
||||
\epsilon_{m,3} = 1 + \frac{10}{1+j\omega\times 10^{-10}}
|
||||
|
||||
The resulting output is the set of gprMax commands and optional a plot with the actual and the approximated CRIM function.
|
||||
|
||||
#raw_data:
|
||||
##########
|
||||
|
||||
Allows you to model dielectric properties obtained experimentally by fitting multi-Debye functions to data given from a file. The syntax of the command is:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
#raw_data: file1 f1 f2 f3 i1 str1 [i2]
|
||||
|
||||
* ``file1`` is an path to text file with experimental data points.
|
||||
* ``f1`` is the conductivity (Siemens/metre), :math:`\sigma`
|
||||
* ``f2`` is the relative permeability, :math:`\mu_r`
|
||||
* ``f3`` is the magnetic loss (Ohms/metre), :math:`\sigma_*`
|
||||
* ``i1`` is the number of Debye poles, set to -1 will be automatically calculated tends to minimize the relative absolut error.
|
||||
* ``str1`` is an identifier for the material.
|
||||
* ``i2`` is an optional parameter which controls the seeding of the random number generator used in stochastic global optimizator. By default (if you don't specify this parameter) the random number generator will be seeded by trying to read data from ``/dev/urandom`` (or the Windows analogue) if available or from the clock otherwise.
|
||||
|
||||
For example ``#raw_data: user_libs/DebyeFit/examples/Test.txt 0.1 1 0.1 3 Experimental`` creates a material called ``Experimental`` which model dielectric properties obtained experimentally by fitting three Debye poles function to data given from a ``user_libs/DebyeFit/examples/Test.txt`` file.
|
||||
The resulting output is the set of gprMax commands and optional a plot with the actual and the approximated function.
|
@@ -1,8 +0,0 @@
|
||||
import os, sys; sys.path.append(os.path.dirname(os.path.realpath(__file__)))
|
||||
from .Debye_Fit import Crim, HavriliakNegami, Jonscher, Rawdata
|
||||
|
||||
__all__ = [
|
||||
'HavriliakNegami', 'Jonscher', 'Crim',
|
||||
'Rawdata'
|
||||
]
|
||||
|
||||
|
246
user_libs/DebyeFit/docs/README.rst
普通文件
@@ -0,0 +1,246 @@
|
||||
User libraries is a sub-package where useful Python modules contributed by users are stored.
|
||||
|
||||
********
|
||||
DebyeFit
|
||||
********
|
||||
|
||||
Information
|
||||
===========
|
||||
|
||||
**Author/Contact**: Iraklis Giannakis (iraklis.giannakis@abdn.ac.uk), University of Aberdeen, UK and Sylwia Majchrowska (Sylwia.Majchrowska1993@gmail.com)
|
||||
|
||||
This module was created as part of the `Google Summer of Code <https://summerofcode.withgoogle.com/>`_ programme 2021 which gprMax participated.
|
||||
|
||||
**License**: `Creative Commons Attribution-ShareAlike 4.0 International License <http://creativecommons.org/licenses/by-sa/4.0/>`_
|
||||
|
||||
**Attribution/cite**: Giannakis, I., & Giannopoulos, A. (2014). A novel piecewise linear recursive convolution approach for dispersive media using the finite-difference time-domain method. *IEEE Transactions on Antennas and Propagation*, 62(5), 2669-2678. (http://dx.doi.org/10.1109/TAP.2014.2308549)
|
||||
|
||||
Electric permittivity is a complex function with both real and imaginary parts.
|
||||
In general, as a hard and fast rule, the real part dictates the velocity of the medium while the imaginary part is related to the electromagnetic losses.
|
||||
The generic form of dispersive media is
|
||||
|
||||
.. math::
|
||||
|
||||
\epsilon(\omega) = \epsilon^{'}(\omega) - j\epsilon^{''}(\omega),
|
||||
|
||||
where :math:`\omega` is the angular frequency, :math:`\epsilon^{'}` and :math:`\epsilon^{''}` are the real and imaginary parts of the permittivity respectively.
|
||||
|
||||
This package provides scripts and tools which can be used to fit a multi-Debye expansion to dielectric data, defined as
|
||||
|
||||
.. math::
|
||||
|
||||
\epsilon(\omega) = \epsilon_{\infty} + \sum_{i=1}^{N}\frac{\Delta\epsilon_{i}}{1+j\omega t_{0,i}},
|
||||
|
||||
where :math:`\epsilon(\omega)` is frequency dependent dielectric permittivity, :math:`\Delta\epsilon` - difference between the real permittivity at zero and infinite frequency.
|
||||
:math:`\tau_{0}` is relaxation time (seconds), :math:`\epsilon_{\infty}` - real part of relative permittivity at infinite frequency, and :math:`N` is number of the Debye poles.
|
||||
|
||||
To fit the data to a multi-Debye expansion, you can choose between Havriliak-Negami, Jonscher, or Complex Refractive Index Mixing (CRIM) models, as well as arbitrary dielectric data derived experimentally or calculated using a different function.
|
||||
|
||||
.. figure:: images/epsilon.png
|
||||
:width: 600 px
|
||||
|
||||
Real and imaginary parts of frequency-dependent permittivity
|
||||
|
||||
|
||||
Package contents
|
||||
================
|
||||
|
||||
There are two main scripts:
|
||||
|
||||
* ```Debye_fit.py``` contains definitions of all Relaxation functions classes
|
||||
* ```optimization.py``` contains definitions of three choosen global optimization methods
|
||||
|
||||
|
||||
Relaxation Class
|
||||
----------------
|
||||
|
||||
This class is designed for modelling different relaxation functions, like Havriliak-Negami (```HavriliakNegami```), Jonscher (```Jonscher```), Complex Refractive Index Mixing (```CRIM```) models, and arbitrary dielectric data derived experimentally or calculated using some other function (```Rawdata```).
|
||||
|
||||
More about the ``Relaxation`` class structure can be found in the :doc:`Relaxation doc <relaxation.rst>`.
|
||||
|
||||
Havriliak-Negami Function
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The Havriliak-Negami relaxation is an empirical modification of the Debye relaxation model in electromagnetism, which in addition to the Debye equation has two exponential parameters
|
||||
|
||||
.. math::
|
||||
|
||||
\epsilon(\omega) = \epsilon_{\infty} + \frac{\Delta\epsilon}{\left(1+\left(j\omega t_{0}\right)^{a}\right)^{b}}
|
||||
|
||||
|
||||
The ``HavriliakNegami`` class has the following structure:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
HavriliakNegami(f_min, f_max,
|
||||
alpha, beta, e_inf, de, tau_0,
|
||||
sigma, mu, mu_sigma, material_name,
|
||||
number_of_debye_poles=-1, f_n=50,
|
||||
plot=False, save=True,
|
||||
optimizer=PSO_DLS,
|
||||
optimizer_options={})
|
||||
|
||||
|
||||
* ``f_min`` is first bound of the frequency range used to approximate the given function (Hz),
|
||||
* ``f_max`` is second bound of the frequency range used to approximate the given function (Hz),
|
||||
* ``alpha`` is real positive float number which varies 0 < $\alpha$ < 1,
|
||||
* ``beta`` is real positive float number which varies 0 < $\beta$ < 1,
|
||||
* ``e_inf`` is a real part of relative permittivity at infinite frequency,
|
||||
* ``de`` is a difference between the real permittivity at zero and infinite frequency,
|
||||
* ``tau_0`` is a relaxation time (seconds),
|
||||
* ``sigma`` is a conductivity (Siemens/metre),
|
||||
* ``mu`` is a relative permeability,
|
||||
* ``mu_sigma`` is a magnetic loss (Ohms/metre),
|
||||
* ``material_name`` is the material name,
|
||||
* ``number_of_debye_poles`` is the chosen number of Debye poles,
|
||||
* ``f_n`` is the chosen number of frequences,
|
||||
* ``plot`` is a switch to turn on the plotting,
|
||||
* ``save`` is a switch to turn on saving final material properties,
|
||||
* ``optimizer`` is a chosen optimizer to fit model to dielectric data,
|
||||
* ``optimizer_options`` is a dict for options of chosen optimizer.
|
||||
|
||||
Jonscher Function
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
Jonscher function is mainly used to describe the dielectric properties of concrete and soils. The frequency domain expression of Jonscher
|
||||
function is given by
|
||||
|
||||
.. math::
|
||||
|
||||
\epsilon(\omega) = \epsilon_{\infty} + a_{p}*\left( -j*\frac{\omega}{\omega_{p}} \right)^{n}
|
||||
|
||||
|
||||
The ``Jonscher`` class has the following structure:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
Jonscher(f_min, f_max,
|
||||
e_inf, a_p, omega_p, n_p,
|
||||
sigma, mu, mu_sigma,
|
||||
material_name, number_of_debye_poles=-1,
|
||||
f_n=50, plot=False, save=True,
|
||||
optimizer=PSO_DLS,
|
||||
optimizer_options={})
|
||||
|
||||
|
||||
* ``f_min`` is first bound of the frequency range used to approximate the given function (Hz),
|
||||
* ``f_max`` is second bound of the frequency range used to approximate the given function (Hz),
|
||||
* ``e_inf`` is a real part of relative permittivity at infinite frequency,
|
||||
* ``a_p``` is a Jonscher parameter. Real positive float number,
|
||||
* ``omega_p`` is a Jonscher parameter. Real positive float number,
|
||||
* ``n_p`` Jonscher parameter, 0 < n_p < 1.
|
||||
|
||||
Complex Refractive Index Mixing (CRIM) Function
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
CRIM is the most mainstream approach for estimating the bulk permittivity of heterogeneous materials and has been widely applied for GPR applications. The function takes form of
|
||||
|
||||
.. math::
|
||||
|
||||
\epsilon(\omega)^{d} = \sum_{i=1}^{m}f_{i}\epsilon_{m,i}(\omega)^{d}
|
||||
|
||||
|
||||
The ``CRIM`` class has the following structure:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
CRIM(f_min, f_max, a, volumetric_fractions,
|
||||
materials, sigma, mu, mu_sigma, material_name,
|
||||
number_of_debye_poles=-1, f_n=50,
|
||||
plot=False, save=True,
|
||||
optimizer=PSO_DLS,
|
||||
optimizer_options={})
|
||||
|
||||
|
||||
* ``f_min`` is first bound of the frequency range used to approximate the given function (Hz),
|
||||
* ``f_max`` is second bound of the frequency range used to approximate the given function (Hz),
|
||||
* ``a`` is a shape factor,
|
||||
* ``volumetric_fractions`` is a volumetric fraction for each material,
|
||||
* ``materials`` are arrays of materials properties, for each material [e_inf, de, tau_0].
|
||||
|
||||
Rawdata Class
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
This package also has the ability to model dielectric properties obtained experimentally by fitting multi-Debye functions to data given from a file.
|
||||
The format of the file should be three columns: the first column contains the frequencies (Hz) associated with the electric permittivity; the second column contains the real part of the relative permittivity; the third column contains the imaginary part of the relative permittivity. The columns should separated by a coma by default, but it is also possible to define a different separator.
|
||||
|
||||
The ``Rawdata`` class has the following structure:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
Rawdata(self, filename,
|
||||
sigma, mu, mu_sigma,
|
||||
material_name, number_of_debye_poles=-1,
|
||||
f_n=50, delimiter =',',
|
||||
plot=False, save=True,
|
||||
optimizer=PSO_DLS,
|
||||
optimizer_options={})
|
||||
|
||||
|
||||
* ``filename`` is a path to text file which contains three columns,
|
||||
* ``delimiter`` is a separator for three data columns.
|
||||
|
||||
Class Optimizer
|
||||
---------------
|
||||
|
||||
This class supports global optimization algorithms (particle swarm, dual annealing, evolutionary algorithms) for finding an optimal set of relaxation times that minimise the error between the actual and the approximated electric permittivity, and calculates optimised weights for the given relaxation times.
|
||||
Code written here is mainly based on external libraries, like ```scipy``` and ```pyswarm```.
|
||||
|
||||
More about the ``Optimizer`` class structure can be found in the :doc:`Optimisation doc <optimisation.rst>`.
|
||||
|
||||
PSO_DLS Class
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
Creation of hybrid Particle Swarm-Damped Least Squares optimisation object with predefined parameters.
|
||||
The code is a modified version of the pyswarm package which can be found at https://pythonhosted.org/pyswarm/.
|
||||
|
||||
DA_DLS Class
|
||||
^^^^^^^^^^^^
|
||||
|
||||
Creation of Dual Annealing-Damped Least Squares optimisation object with predefined parameters. The class is a modified version of the scipy.optimize package which can be found at:
|
||||
https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.dual_annealing.html#scipy.optimize.dual_annealing.
|
||||
|
||||
DE_DLS Class
|
||||
^^^^^^^^^^^^
|
||||
|
||||
Creation of Differential Evolution-Damped Least Squares object with predefined parameters. The class is a modified version of the scipy.optimize package which can be found at:
|
||||
https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.differential_evolution.html#scipy.optimize.differential_evolution.
|
||||
|
||||
DLS function
|
||||
^^^^^^^^^^^^
|
||||
|
||||
Finding the weights using a non-linear least squares (LS) method, the Levenberg-Marquardt algorithm (LMA or just LM), also known as the damped least-squares (DLS) method.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
In the examples directory you will find Jupyter notebooks, scripts, and data that demonstrate different cases of how to use the main script ```DebyeFit.py```:
|
||||
|
||||
* ```example_DebyeFitting.ipynb```: simple cases of using all available implemented relaxation functions,
|
||||
* ```example_BiologicalTissues.ipynb```: simple cases of using Cole-Cole function for biological tissues,
|
||||
* ```example_ColeCole.py```: simple cases of using Cole-Cole function in case of 3, 5 and automatically chosen number of Debye poles,
|
||||
* ```Test.txt```: raw data for testing ```Rawdata``` class, file contains 3 columns: the first column contains the frequencies (Hz) associated with the value of the permittivity; the second column contains the real part of the relative permittivity; and the third column contains the imaginary part of the relative permittivity.
|
||||
|
||||
The following code shows a basic example of how to use the Havriliak-Negami function:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# set Havrilak-Negami function with initial parameters
|
||||
setup = HavriliakNegami(f_min=1e4, f_max=1e11,
|
||||
alpha=0.3, beta=1,
|
||||
e_inf=3.4, de=2.7, tau_0=.8e-10,
|
||||
sigma=0.45e-3, mu=1, mu_sigma=0,
|
||||
material_name="dry_sand", f_n=100,
|
||||
plot=True, save=False,
|
||||
number_of_debye_poles=3,
|
||||
optimizer_options={'swarmsize':30,
|
||||
'maxiter':100,
|
||||
'omega':0.5,
|
||||
'phip':1.4,
|
||||
'phig':1.4,
|
||||
'minstep':1e-8,
|
||||
'minfun':1e-8,
|
||||
'seed': 111,
|
||||
'pflag': True})
|
||||
# run optimization
|
||||
setup.run()
|
之前 宽度: | 高度: | 大小: 49 KiB 之后 宽度: | 高度: | 大小: 49 KiB |
@@ -1,6 +1,7 @@
|
||||
# Optimization methods of multi-Debye fitting
|
||||
Optimization methods of multi-Debye fitting
|
||||
-------------------------------------------
|
||||
|
||||
``Class Optimizer`` supports global optimization algorithms (particle swarm, duall annealing, evolutionary algorithms) for finding an optimal set of relaxation times that minimise the error between the actual and the approximated electric permittivity and calculate optimised weights for the given relaxation times.
|
||||
The ``Optimizer`` class supports global optimization algorithms (particle swarm, dual annealing, evolutionary algorithms) for finding an optimal set of relaxation times that minimise the error between the actual and the approximated electric permittivity, and calculates optimised weights for the given relaxation times.
|
||||
Code written here is mainly based on external libraries, like ```scipy``` and ```pyswarm```.
|
||||
|
||||
Supported methods:
|
||||
@@ -8,9 +9,10 @@ Supported methods:
|
||||
- [x] hybrid Dual Annealing-Damped Least Squares
|
||||
- [x] hybrid Differential Evolution-Damped Least Squares
|
||||
|
||||
## Methods
|
||||
Methods
|
||||
^^^^^^^
|
||||
|
||||
1. __constructor__ - it is called in all childern classes.
|
||||
1. __constructor__ - is called in all child classes.
|
||||
|
||||
It takes the following arguments:
|
||||
- `maxiter`: maximum number of iterations for the optimizer,
|
||||
@@ -22,21 +24,21 @@ Supported methods:
|
||||
- `calc_weights` (used to fit weight, non-linear least squares (LS) method is used as a default)
|
||||
are set.
|
||||
|
||||
2. __fit__ - it is inherited by all children classes. It calls the optimization function that tries to find an optimal set of relaxation times that minimise the error between the actual and the approximated electric permittivity and calculate optimised weights for the given relaxation times.
|
||||
2. __fit__ - is inherited by all children classes. It calls the optimization function that tries to find an optimal set of relaxation times that minimise the error between the actual and the approximated electric permittivity and calculate optimised weights for the given relaxation times.
|
||||
It takes the following arguments:
|
||||
- `func`: objective function to be optimized,
|
||||
- `lb`: the lower bounds of the design variable(s),
|
||||
- `ub`: the upper bounds of the design variable(s),
|
||||
- `funckwargs`: optional arguments takien by objective function.
|
||||
|
||||
3. __cost_function__ - it is inherited by all children classes. It calculate cost function as the average error between the actual and the approximated electric permittivity (sum of real and imaginary part).
|
||||
3. __cost_function__ - is inherited by all child classes. It calculates the cost function as the average error between the actual and the approximated electric permittivity (sum of real and imaginary part).
|
||||
It takes the following arguments:
|
||||
- `x`: the logarithm with base 10 of relaxation times of the Debyes poles,
|
||||
- `rl`: real parts of chosen relaxation function for given frequency points,
|
||||
- `im`: imaginary parts of chosen relaxation function for given frequency points,
|
||||
- `freq`: the frequencies vector for defined grid.
|
||||
|
||||
4. __calc_relaxation_times__ - it find an optimal set of relaxation times that minimise an objective function using appropriate optimization procedure.
|
||||
4. __calc_relaxation_times__ - it finds an optimal set of relaxation times that minimise an objective function using appropriate optimization procedure.
|
||||
It takes the following arguments:
|
||||
- `func`: objective function to be optimized,
|
||||
- `lb`: the lower bounds of the design variable(s),
|
@@ -1,69 +0,0 @@
|
||||
# Relaxation classes for multi-Debye fitting
|
||||
|
||||
This class is designed for modelling different relaxation functions, like Havriliak-Negami (```Class HavriliakNegami```), Jonscher (```Class Jonscher```), Complex Refractive Index Mixing (```Class CRIM```) models, and arbitrary dielectric data derived experimentally or calculated using some other function (```Class Rawdata```).
|
||||
|
||||
Supported relaxation classes:
|
||||
|
||||
- [x] Havriliak-Negami,
|
||||
- [x] Jonscher,
|
||||
- [x] Complex Refractive Index Mixing,
|
||||
- [x] Experimental data,
|
||||
|
||||
## Methods
|
||||
|
||||
1. __constructor__ - it is called in all childern classes, creates Relaxation function object for complex material.
|
||||
|
||||
It takes the following arguments:
|
||||
- ``sigma`` is a conductivity (Siemens/metre),
|
||||
- ``mu`` is a relative permeability,
|
||||
- ``mu_sigma`` is a magnetic loss (Ohms/metre),
|
||||
- ``material_name`` is definition of material name,
|
||||
- ``number_of_debye_poles`` is choosen number of Debye poles,
|
||||
- ``f_n`` is choosen number of frequences,
|
||||
- ``plot`` is a switch to turn on the plotting,
|
||||
- ``save`` is a switch to turn on the saving final material properties,
|
||||
- ``optimizer`` is a choosen optimizer to fit model to dielectric data,
|
||||
- ``optimizer_options`` is a dict for options of choosen optimizer.
|
||||
|
||||
Additional parameters:
|
||||
- ``rl`` calculated real part of chosen relaxation function for given frequency points,
|
||||
- ``im`` calculated imaginary part of chosen relaxation function for given frequency points.
|
||||
|
||||
2. __set_freq__ - it is inherited by all childern classes, interpolates frequency vector using n equally logarithmicaly spaced frequencies.
|
||||
It takes the following arguments:
|
||||
- `f_min_`: first bound of the frequency range used to approximate the given function (Hz),
|
||||
- `f_max`: second bound of the frequency range used to approximate the given function (Hz),
|
||||
- `f_n`: the number of frequency points in frequency grid (Default: 50).
|
||||
|
||||
3. __run__ - it is inherited by all childern classes, solves the problem described by the given relaxation function (main operational method).
|
||||
It consists of following steps:
|
||||
1) Check the validity of the inputs using ```check_inputs``` method.
|
||||
2) Print information about chosen approximation settings using ```print_info``` method.
|
||||
3) Calculate both real and imaginary parts using ```calculation``` method, and then set ```self.rl``` and ```self.im``` properties.
|
||||
4) Calling the main optimisation module using ```optimize``` method and calculate error based on ```error``` method.
|
||||
a) [OPTIONAL] If number of debye poles is set to -1 optimization procedure is repeted until percentage error goes smaller than 5% or 20 Debye poles is reached.
|
||||
5) Print the results in gprMax format style using ```print_output``` method.
|
||||
6) [OPTIONAL] Save results in gprMax style using ```save_result``` method.
|
||||
7) [OPTIONAL] Plot the actual and the approximate dielectric properties using ```plot_result``` method.
|
||||
|
||||
4. __check_inputs__ - it is called in all childern classes, finds an optimal set of relaxation times that minimise an objective function using appropriate optimization procedure.
|
||||
|
||||
5. __calculation__ - it is inherited by all childern classes, should be definied in all new children classes, approximates the given relaxation function.
|
||||
|
||||
6. __print_info__ - it is inherited by all childern classes, prints readable string of parameters for given approximation settings.
|
||||
|
||||
7. __optimize__ - it is inherited by all childern classes, calls the main optimisation module with defined lower and upper boundaries of search.
|
||||
|
||||
8. __print_output__ - it is inherited by all childern classes, prints out the resulting Debye parameters in a gprMax format.
|
||||
|
||||
9. __plot_result__ - it is inherited by all childern classes, plots the actual and the approximated electric permittivity, along with relative error for real and imaginary parts using a semilogarithm X axes.
|
||||
|
||||
10. __save_result__ - it is inherited by all childern classes, saves the resulting Debye parameters in a gprMax format.
|
||||
|
||||
11. __error__ - it is inherited by all childern classes, calculates the average fractional error separately for relative permittivity (real part) and conductivity (imaginary part).
|
||||
|
||||
Each new class of relaxation object should:
|
||||
|
||||
- define constructor with appropriate arguments,
|
||||
- define __check_inputs__ method to check relaxation class specific parameters,
|
||||
- overload __calculation__ method.
|
@@ -0,0 +1,71 @@
|
||||
Relaxation classes for multi-Debye fitting
|
||||
------------------------------------------
|
||||
|
||||
This class is designed for modelling different relaxation functions, like Havriliak-Negami (```HavriliakNegami```), Jonscher (```Jonscher```), Complex Refractive Index Mixing (```CRIM```) models, and arbitrary dielectric data derived experimentally or calculated using some other function (```Rawdata```).
|
||||
|
||||
Supported relaxation classes:
|
||||
|
||||
- [x] Havriliak-Negami,
|
||||
- [x] Jonscher,
|
||||
- [x] Complex Refractive Index Mixing,
|
||||
- [x] Experimental data,
|
||||
|
||||
Methods
|
||||
^^^^^^^
|
||||
|
||||
1. __constructor__ - is called in all child classes, creates Relaxation function object for complex material.
|
||||
|
||||
It takes the following arguments:
|
||||
- ``sigma`` is a conductivity (Siemens/metre),
|
||||
- ``mu`` is a relative permeability,
|
||||
- ``mu_sigma`` is a magnetic loss (Ohms/metre),
|
||||
- ``material_name`` is definition of material name,
|
||||
- ``number_of_debye_poles`` is choosen number of Debye poles,
|
||||
- ``f_n`` is the chosen number of frequences,
|
||||
- ``plot`` is a switch to turn on the plotting,
|
||||
- ``save`` is a switch to turn on the saving final material properties,
|
||||
- ``optimizer`` is a chosen optimizer to fit model to dielectric data,
|
||||
- ``optimizer_options`` is a dict for options of chosen optimizer.
|
||||
|
||||
Additional parameters:
|
||||
- ``rl`` calculated real part of chosen relaxation function for given frequency points,
|
||||
- ``im`` calculated imaginary part of chosen relaxation function for given frequency points.
|
||||
|
||||
2. __set_freq__ - is inherited by all child classes, interpolates frequency vector using n equally logarithmicaly spaced frequencies.
|
||||
It takes the following arguments:
|
||||
- `f_min_`: first bound of the frequency range used to approximate the given function (Hz),
|
||||
- `f_max`: second bound of the frequency range used to approximate the given function (Hz),
|
||||
- `f_n`: the number of frequency points in frequency grid (Default: 50).
|
||||
|
||||
3. __run__ - is inherited by all child classes, solves the problem described by the given relaxation function (main operational method).
|
||||
It consists of following steps:
|
||||
1) Check the validity of the inputs using ```check_inputs``` method.
|
||||
2) Print information about chosen approximation settings using ```print_info``` method.
|
||||
3) Calculate both real and imaginary parts using ```calculation``` method, and then set ```self.rl``` and ```self.im``` properties.
|
||||
4) Calling the main optimisation module using ```optimize``` method and calculate error based on ```error``` method.
|
||||
a) [OPTIONAL] If number of debye poles is set to -1 optimization procedure is repeated until the percentage error is les than 5% or 20 Debye poles is reached.
|
||||
5) Print the results in gprMax format style using ```print_output``` method.
|
||||
6) [OPTIONAL] Save results in gprMax style using ```save_result``` method.
|
||||
7) [OPTIONAL] Plot the actual and the approximate dielectric properties using ```plot_result``` method.
|
||||
|
||||
4. __check_inputs__ - is called in all child classes, finds an optimal set of relaxation times that minimise an objective function using appropriate optimization procedure.
|
||||
|
||||
5. __calculation__ - is inherited by all child classes, should be definied in all new chil classes, approximates the given relaxation function.
|
||||
|
||||
6. __print_info__ - is inherited by all child classes, prints readable string of parameters for given approximation settings.
|
||||
|
||||
7. __optimize__ - is inherited by all child classes, calls the main optimisation module with defined lower and upper boundaries of search.
|
||||
|
||||
8. __print_output__ - is inherited by all child classes, prints out the resulting Debye parameters in a gprMax format.
|
||||
|
||||
9. __plot_result__ - is inherited by all child classes, plots the actual and the approximated electric permittivity, along with relative error for real and imaginary parts using a semilogarithm X axes.
|
||||
|
||||
10. __save_result__ - is inherited by all child classes, saves the resulting Debye parameters in a gprMax format.
|
||||
|
||||
11. __error__ -is inherited by all child classes, calculates the average fractional error separately for relative permittivity (real part) and conductivity (imaginary part).
|
||||
|
||||
Each new class of relaxation object should:
|
||||
|
||||
- define constructor with appropriate arguments,
|
||||
- define __check_inputs__ method to check relaxation class specific parameters,
|
||||
- overload __calculation__ method.
|
@@ -1,33 +0,0 @@
|
||||
# Getting started
|
||||
|
||||
Please see provided examples for the basic usage of ``DebyeFit`` module. We provide jupyter tutorials, and full guidance for quick run with existing relaxation functions and optimizers:
|
||||
|
||||
* ```example_DebyeFitting.ipynb```: simple cases of using all available implemented relaxation functions,
|
||||
* ```example_BiologicalTissues.ipynb```: simple cases of using Cole-Cole function for biological tissues,
|
||||
* ```example_ColeCole.py```: simple cases of using Cole-Cole function in case of 3, 5 and automatically chosen number of Debye poles.
|
||||
|
||||
Main usage of the specific relaxation fucntion based on creation of choosen relaxation model and then calling run method.
|
||||
|
||||
```python
|
||||
|
||||
# set Havrilak-Negami function with initial parameters
|
||||
setup = HavriliakNegami(f_min=1e4, f_max=1e11,
|
||||
alpha=0.3, beta=1,
|
||||
e_inf=3.4, de=2.7, tau_0=.8e-10,
|
||||
sigma=0.45e-3, mu=1, mu_sigma=0,
|
||||
material_name="dry_sand", f_n=100,
|
||||
plot=True, save=False,
|
||||
number_of_debye_poles=3,
|
||||
optimizer_options={'swarmsize':30,
|
||||
'maxiter':100,
|
||||
'omega':0.5,
|
||||
'phip':1.4,
|
||||
'phig':1.4,
|
||||
'minstep':1e-8,
|
||||
'minfun':1e-8,
|
||||
'seed': 111,
|
||||
'pflag': True})
|
||||
# run optimization
|
||||
setup.run()
|
||||
|
||||
```
|
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2015-2021, Iraklis Giannakis and Sylwia Majchrowska
|
||||
# Copyright (C) 2015-2022, Iraklis Giannakis and Sylwia Majchrowska
|
||||
#
|
||||
# This module is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||
# To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/.
|
||||
|
@@ -13,7 +13,7 @@ Information
|
||||
|
||||
**Attribution/cite**: Warren, C., Giannopoulos, A. (2016). Characterisation of a Ground Penetrating Radar Antenna in Lossless Homogeneous and Lossy Heterogeneous Environments. *Signal Processing* (http://dx.doi.org/10.1016/j.sigpro.2016.04.010)
|
||||
|
||||
The package features contains modules to help calculate, process, and visualise field patterns from simulations that contain models of antennas.
|
||||
The package contains scripts to help calculate, process, and visualise field patterns from simulations that contain models of antennas.
|
||||
|
||||
.. warning::
|
||||
|
||||
@@ -23,8 +23,8 @@ The package features contains modules to help calculate, process, and visualise
|
||||
* Requires knowledge of Python to contruct input files with antenna models and positioning of receivers, as well as to edit/modify the saving and processing modules
|
||||
* Can require simulations that demand significant computational resource depending on the distance from the antenna at which the field patterns are observed, e.g. the example models, set with a maximum observation distance of 0.6m, require ~30GB of RAM
|
||||
|
||||
Module overview
|
||||
===============
|
||||
Package contents
|
||||
================
|
||||
|
||||
* ``initial_save.py`` is a module that calculates and stores (in a Numpy file) the field patterns from the output file of a simulation.
|
||||
* ``plot_fields.py`` is a module that plots the field patterns. It should be used after the field pattern data has been processed and stored using the ``initial_save.py`` module.
|
||||
@@ -35,8 +35,8 @@ The package has been designed to work with input files that follow examples foun
|
||||
* ``antenna_like_GSSI_1500_patterns_H.in`` is an input file that includes an antenna model similar to a GSSI 1.5 GHz antenna and receivers to calculate a field pattern in the principal H-plane of the antenna
|
||||
|
||||
|
||||
How to use the module
|
||||
=====================
|
||||
How to use the package
|
||||
======================
|
||||
|
||||
* Firstly you should familiarise yourself with the example model input file. Edit the input file as desired and run one of the simulations for either E-plane or H-plane patterns.
|
||||
* Whilst the simulation is running edit the 'user configurable parameters' sections of the ``initial_save.py`` and ``plot_fields.py`` modules to match the setup of the simulation.
|
||||
|
@@ -7,7 +7,7 @@ GPR antenna models
|
||||
Information
|
||||
===========
|
||||
|
||||
The module features models of antennas similar to commercial GPR antennas. The following antenna models are included:
|
||||
The package features models of antennas similar to commercial GPR antennas. The following antenna models are included:
|
||||
|
||||
======================== ============= ============= ========================================================================================================================================================================================================================= ================
|
||||
Manufacturer/Model Dimensions Resolution(s) Author/Contact Attribution/Cite
|
||||
@@ -25,16 +25,16 @@ GSSI 400MHz 300x300x170mm 0.5, 1, 2mm Sam Stadler (Sam.Stadler@li
|
||||
2. Giannakis, I., Giannopoulos, A., & Warren, C. (2019). Realistic FDTD GPR antenna models optimised using a novel linear/non-linear Full Waveform Inversion. *IEEE Transactions on Geoscience and Remote Sensing*, 57(3), 1768-1778. (https://doi.org/10.1109/TGRS.2018.2869027)
|
||||
3. Stadler. S., Igel J. (2018). A Numerical Study on Using Guided GPR Waves Along Metallic Cylinders in Boreholes for Permittivity Sounding. 17th International Conference on GPR. (https://tinyurl.com/y6vdab22)
|
||||
|
||||
Module overview
|
||||
===============
|
||||
Package contents
|
||||
================
|
||||
|
||||
* ``GSSI.py`` is a module containing models of antennas similar to those manufactured by `Geophysical Survey Systems, Inc. (GSSI) <http://www.geophysical.com>`_.
|
||||
* ``MALA.py`` is a module containing models of antennas similar to those manufactured by `MALA Geoscience <http://www.malags.com/>`_.
|
||||
|
||||
Descriptions of how the models were created can be found in the aforementioned attributions.
|
||||
|
||||
How to use the module
|
||||
=====================
|
||||
How to use the package
|
||||
======================
|
||||
|
||||
The antenna models can be accessed from within a block of Python code in an input file. The models are inserted at location x,y,z. The coordinates are relative to the geometric centre of the antenna in the x-y plane and the bottom of the antenna skid in the z direction. The models must be used with cubic spatial resolutions of either 0.5mm (GSSI 400MHz antenna only), 1mm (default), or 2mm by setting the keyword argument, e.g. ``resolution=0.002``. The antenna models can be rotated 90 degrees counter-clockwise (CCW) in the x-y plane by setting the keyword argument ``rotate90=True``.
|
||||
|
||||
|
二进制
user_libs/landmines/PMA_1x1x1.h5
普通文件
二进制
user_libs/landmines/PMA_2x2x2.h5
普通文件
@@ -0,0 +1,5 @@
|
||||
## PMA landmine material properties
|
||||
#material: 1 inf 1 0 pec
|
||||
#material: 1 0 1 0 freespace
|
||||
#material: 2.5 0 1 0 plastic
|
||||
#material: 6 0 1 0 rubber
|
二进制
user_libs/landmines/PMN_1x1x1.h5
普通文件
二进制
user_libs/landmines/PMN_2x2x2.h5
普通文件
@@ -0,0 +1,6 @@
|
||||
## PMN landmine material properties
|
||||
#material: 1 inf 1 0 pec
|
||||
#material: 1 0 1 0 freespace
|
||||
#material: 3 0 1 0 plastic
|
||||
#material: 3.5 0 1 0 bakelite
|
||||
#material: 6 0 1 0 rubber
|
@@ -0,0 +1,6 @@
|
||||
## PMN landmine material properties
|
||||
#material: 1 inf 1 0 pec
|
||||
#material: 1 0 1 0 freespace
|
||||
#material: 3 0 1 0 plastic
|
||||
#material: 3.5 0 1 0 bakelite
|
||||
#material: 6 0 1 0 rubber
|
二进制
user_libs/landmines/TS50_1x1x1.h5
普通文件
二进制
user_libs/landmines/TS50_2x2x2.h5
普通文件
@@ -0,0 +1,7 @@
|
||||
## TS50 landmine material properties
|
||||
#material: 1 inf 1 0 pec
|
||||
#material: 1 0 1 0 freespace
|
||||
#material: 2.5 0 1 0 mat25
|
||||
#material: 3 0 1 0 mat3
|
||||
#material: 4 0 1 0 mat4
|
||||
#material: 5 0 1 0 mat5
|
二进制
user_libs/landmines/can_1x1x1.h5
普通文件
二进制
user_libs/landmines/can_2x2x2.h5
普通文件
@@ -0,0 +1,2 @@
|
||||
## can landmine material properties
|
||||
#material: 1 inf 1 0 pec
|
@@ -0,0 +1,87 @@
|
||||
User libraries is a sub-package where useful Python modules contributed by users are stored.
|
||||
|
||||
*********
|
||||
Landmines
|
||||
*********
|
||||
|
||||
Information
|
||||
===========
|
||||
|
||||
**Author/Contact**: Iraklis Giannakis (iraklis.giannakis@abdn.ac.uk), University of Aberdeen, UK
|
||||
|
||||
**License**: `Creative Commons Attribution-ShareAlike 4.0 International License <http://creativecommons.org/licenses/by-sa/4.0/>`_
|
||||
|
||||
**Attribution/cite**: Giannakis, I., Giannopoulos, A., Warren, C. (2016). A Realistic FDTD Numerical Modeling Framework of Ground Penetrating Radar for Landmine Detection. *IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing*, 9(1), 37-51. (http://dx.doi.org/10.1109/JSTARS.2015.2468597)
|
||||
|
||||
The package currently features models of different anti-personnel (AP) landmines and a metal can which can be used as a false target. They are:
|
||||
|
||||
* **PMA-1**: a blast AP landmine with minimum metal content, manufactured in the former Yugoslavia. It is possible to detect the PMA-1 with a metal detector because it contains a metal fuse, but there are reports of types of PMA-1 with plastic fuses. The PMA-1 contains 200g of high explosive (TNT). The dimensions of the PMA-1 model are: 140x64x34mm.
|
||||
* **PMN**: one of the oldest and most widely used landmines, it is a palm shaped cylindrical blast AP landmine, manufactured in Russia. Similar to PMA-1, the PMN contains a large amount, 240g, of high explosive (TNT). It has a minimum metal content which can make it detectable with a metal detector. The dimensions of the PMN model are: 116x156x50mm.
|
||||
* **TS-50**: a blast AP landmine with minimum metal content, manufactured in Italy. The dimensions of the TS-50 model are: 90x90x44mm.
|
||||
* **Metal can**: a cylindrical metal can which is can be useful as a false target. The dimensions of the metal can model are: 76x76x108mm.
|
||||
|
||||
The landmine models and the metal can be used with a cubic spatial resolution of either 1mm or 2mm.
|
||||
|
||||
The dielectric properties of the landmines were obtained through an iterative process of matching numerical and laboratory measurements of scattered electromagnetic fields in free space. A full description of how the models were created can be found at the reference given by the aforementioned attribution/cite.
|
||||
|
||||
Package contents
|
||||
================
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
can_1x1x1.h5
|
||||
can_2x2x2.h5
|
||||
can_materials.txt
|
||||
PMA_1x1x1.h5
|
||||
PMA_2x2x2.h5
|
||||
PMA_materials.txt
|
||||
PMN_1x1x1.h5
|
||||
PMN_2x2x2.h5
|
||||
PMN_materials.txt
|
||||
TS50_1x1x1.h5
|
||||
TS50_2x2x2.h5
|
||||
TS50_materials.txt
|
||||
|
||||
* ``can_1x1x1.h5`` is a HDF5 file containing a description of the geometry of the metal can (false target) with a cubic spatial resolution of 1mm
|
||||
* ``can_2x2x2.h5`` is a HDF5 file containing a description of the geometry of the metal can (false target) with a cubic spatial resolution of 2mm
|
||||
* ``can_materials.txt`` is a text file containing material properties associated with the metal can
|
||||
* ``PMA_1x1x1.h5`` is a HDF5 file containing a description of the geometry of the PMA landmine with a cubic spatial resolution of 1mm
|
||||
* ``PMA_2x2x2.h5`` is a HDF5 file containing a description of the geometry of the PMA landmine with a cubic spatial resolution of 2mm
|
||||
* ``PMA_materials.txt`` is a text file containing material properties associated with the PMA landmine
|
||||
* ``PMN_1x1x1.h5`` is a HDF5 file containing a description of the geometry of the PMN landmine with a cubic spatial resolution of 1mm
|
||||
* ``PMN_2x2x2.h5`` is a HDF5 file containing a description of the geometry of the PMN landmine with a cubic spatial resolution of 2mm
|
||||
* ``PMN_materials.txt`` is a text file containing material properties associated with the PMN landmine
|
||||
* ``TS50_1x1x1.h5`` is a HDF5 file containing a description of the geometry of the TS-50 landmine with a cubic spatial resolution of 1mm
|
||||
* ``TS50_2x2x2.h5`` is a HDF5 file containing a description of the geometry of the TS-50 landmine with a cubic spatial resolution of 2mm
|
||||
* ``TS50_materials.txt`` is a text file containing material properties associated with the TS-50 landmine
|
||||
|
||||
How to use the package
|
||||
======================
|
||||
|
||||
To insert any of the landmine models or metal can into a simulation use the ``#geometry_objects_read`` command.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
The input file for inserting the PMN landmine, with the lower left corner 10mm from the origin of the domain, into an empty domain (free-space) would be:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
#title: PMN landmine (116x156x50mm) in free space
|
||||
#domain: 0.136 0.176 0.070
|
||||
#dx_dy_dz: 0.001 0.001 0.001
|
||||
#time_window: 5e-9
|
||||
#geometry_objects_read: 0.010 0.010 0.010 ../user_libs/landmines/PMN_1x1x1.h5 ../user_libs/landmines/PMN_materials.txt
|
||||
#geometry_view: 0 0 0 0.136 0.176 0.070 0.001 0.001 0.001 landmine_PMN_fs n
|
||||
|
||||
For further information on the ``#geometry_objects_read`` see the section on object contruction commands in the :ref:`Input commands section <commands>`.
|
||||
|
||||
.. figure:: images/PMA.png
|
||||
:width: 600 px
|
||||
|
||||
FDTD geometry mesh showing the PMA-1 landmine model.
|
||||
|
||||
.. figure:: images/PMN.png
|
||||
:width: 600 px
|
||||
|
||||
FDTD geometry mesh showing the PMN landmine model.
|
之后 宽度: | 高度: | 大小: 138 KiB |
之后 宽度: | 高度: | 大小: 306 KiB |
@@ -7,12 +7,12 @@ Materials
|
||||
Information
|
||||
===========
|
||||
|
||||
The module is intended to provide a database of electromagnetic properties of different materials. It currently includes the following material libraries:
|
||||
The package is intended to provide a database of electromagnetic properties of different materials. It currently includes the following material libraries:
|
||||
|
||||
* ``eccosorb.txt`` contains information on some of the `Eccosorb LS series <http://www.eccosorb.com/products-eccosorb-ls.htm>`_ of electromagnetic absorber materials manufactured by `Laird NV <http://www.eccosorb.eu>`_ (formerly Emerson & Cuming Microwave Products NV). LS 14, 16, 18, 20, 22, 26, 28, and 30 are included. They are simulated using a 3-pole Debye model.
|
||||
|
||||
How to use the module
|
||||
=====================
|
||||
How to use the package
|
||||
======================
|
||||
|
||||
Example
|
||||
-------
|
||||
|
@@ -7,26 +7,26 @@ stltovoxel
|
||||
Information
|
||||
===========
|
||||
|
||||
**Author/Contact**: Kartik Bansal (kartikbn21000@gmail.com), India
|
||||
**Author/Contact**: Kartik Bansal (kartikbn21000@gmail.com)
|
||||
|
||||
This module provides the ability to directly model real objects without having to build their geometries manually using geometry primitives such as the ``#edge``, ``#plate``, ``#box`` etc.. commands. It specifically provides a tool to convert a `STL file <https://en.wikipedia.org/wiki/STL_(file_format)>`_, which can be produced by many CAD software packages, to a voxelised mesh (FDTD Yee cells) which is saved as a geometry file in HDF5 format suitable for directly importing into gprMax.
|
||||
This package provides the ability to directly model real objects without having to build their geometries manually using geometry primitives such as the ``#edge``, ``#plate``, ``#box`` etc.. commands. It specifically provides a tool to convert a `STL file <https://en.wikipedia.org/wiki/STL_(file_format)>`_, which can be produced by many CAD software packages, to a voxelised mesh (FDTD Yee cells) which is saved as a geometry file in HDF5 format suitable for directly importing into gprMax.
|
||||
|
||||
This module was created as part of the `Google Summer of Code <https://summerofcode.withgoogle.com/>`_ programme 2021 which gprMax participated. The module is based on the `stl-to-voxel <https://github.com/cpederkoff/stl-to-voxel>`_ Python library by Christian Pederkoff.
|
||||
This package was created as part of the `Google Summer of Code <https://summerofcode.withgoogle.com/>`_ programme 2021 which gprMax participated. The package uses the `stl-to-voxel <https://github.com/cpederkoff/stl-to-voxel>`_ Python library by Christian Pederkoff.
|
||||
|
||||
**License**: `Creative Commons Attribution-ShareAlike 4.0 International License <http://creativecommons.org/licenses/by-sa/4.0/>`_
|
||||
|
||||
**Attribution/cite**: TBC
|
||||
|
||||
Module overview
|
||||
===============
|
||||
Package contents
|
||||
================
|
||||
|
||||
* ``stltovoxel.py`` is the main script which should be executed to convert a STL file to a voxelised mesh which is saved as a geometry file in HDF5 format suitable for directly importing into gprMax.
|
||||
* ``examples`` is a folder containing example STL files as well as gprMax input files that can be used to import the resulting HDF5 geometry files.
|
||||
* ``convert.py``, ``perimeter.py``, ``slice.py`` are modules adapted from the `stl-to-voxel <https://github.com/cpederkoff/stl-to-voxel>`_ Python library by Christian Pederkoff.
|
||||
* ``license.md`` is the license for the `stl-to-voxel <https://github.com/cpederkoff/stl-to-voxel>`_ Python library by Christian Pederkoff.
|
||||
|
||||
How to use the module
|
||||
=====================
|
||||
How to use the package
|
||||
======================
|
||||
|
||||
The main script is ``stltovoxel.py`` which should be run at the command line and takes three arguments:
|
||||
|
||||
|
之前 宽度: | 高度: | 大小: 174 KiB 之后 宽度: | 高度: | 大小: 174 KiB |
之前 宽度: | 高度: | 大小: 486 KiB 之后 宽度: | 高度: | 大小: 486 KiB |
之前 宽度: | 高度: | 大小: 650 KiB 之后 宽度: | 高度: | 大小: 650 KiB |
之前 宽度: | 高度: | 大小: 14 KiB 之后 宽度: | 高度: | 大小: 14 KiB |
之前 宽度: | 高度: | 大小: 23 KiB 之后 宽度: | 高度: | 大小: 23 KiB |
之前 宽度: | 高度: | 大小: 193 KiB 之后 宽度: | 高度: | 大小: 193 KiB |
之前 宽度: | 高度: | 大小: 25 KiB 之后 宽度: | 高度: | 大小: 25 KiB |
之前 宽度: | 高度: | 大小: 9.3 KiB 之后 宽度: | 高度: | 大小: 9.3 KiB |
之前 宽度: | 高度: | 大小: 17 KiB 之后 宽度: | 高度: | 大小: 17 KiB |
之前 宽度: | 高度: | 大小: 13 KiB 之后 宽度: | 高度: | 大小: 13 KiB |
之前 宽度: | 高度: | 大小: 29 KiB 之后 宽度: | 高度: | 大小: 29 KiB |
之前 宽度: | 高度: | 大小: 59 KiB 之后 宽度: | 高度: | 大小: 59 KiB |
之前 宽度: | 高度: | 大小: 74 KiB 之后 宽度: | 高度: | 大小: 74 KiB |
之前 宽度: | 高度: | 大小: 244 KiB 之后 宽度: | 高度: | 大小: 244 KiB |
之前 宽度: | 高度: | 大小: 48 KiB 之后 宽度: | 高度: | 大小: 48 KiB |
之前 宽度: | 高度: | 大小: 40 KiB 之后 宽度: | 高度: | 大小: 40 KiB |
之前 宽度: | 高度: | 大小: 6.2 KiB 之后 宽度: | 高度: | 大小: 6.2 KiB |
@@ -3,7 +3,6 @@ import logging
|
||||
from pathlib import Path
|
||||
|
||||
import h5py
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
from .convert import convert_file
|
||||
|
||||
|