### Install python3-setuptools Source: https://github.com/emsig/empymod/blob/main/docs/dev/release.md This command installs the python3-setuptools package using apt, which might be required if the conda skeleton build fails due to missing setuptools. ```shell sudo apt install python3-setuptools ``` -------------------------------- ### Install Development Dependencies Source: https://github.com/emsig/empymod/blob/main/docs/dev/tests.md Install all development toolchain requirements listed in `requirements-dev.txt` using pip. ```console pip install -r requirements_dev.txt ``` -------------------------------- ### Install empymod using Pip Source: https://github.com/emsig/empymod/blob/main/docs/manual/installation.md Use this command to install empymod via pip. ```console pip install empymod ``` -------------------------------- ### Install Current Branch in Editable Mode Source: https://github.com/emsig/empymod/blob/main/docs/dev/tests.md Install the current branch of the project in editable mode using the Makefile. ```console make install ``` -------------------------------- ### printstartfinish Source: https://github.com/emsig/empymod/blob/main/docs/api/utils.md Print start and finish with time measure and kernel count. ```APIDOC ## printstartfinish ### Description Print start and finish with time measure and kernel count. ### Parameters - **verb**: Verbosity level. - **inp**: Optional input parameter. - **kcount**: Optional kernel count parameter. ``` -------------------------------- ### empymod.utils.printstartfinish Source: https://github.com/emsig/empymod/blob/main/docs/api/empymod.utils.printstartfinish.md Prints the start and finish of a process, including time measurement and kernel count. ```APIDOC ## empymod.utils.printstartfinish(verb, inp=None, kcount=None) ### Description Prints the start and finish of a process, including time measurement and kernel count. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Method Function Call ### Endpoint None ### Parameters * **verb** (bool) - Required - Whether to print the start and finish messages. * **inp** (object, optional) - The input object to measure time from. Defaults to None. * **kcount** (int, optional) - The number of kernels to count. Defaults to None. ``` -------------------------------- ### Install empymod using Conda Source: https://github.com/emsig/empymod/blob/main/docs/manual/installation.md Use this command to install empymod from the conda-forge channel. ```console conda install -c conda-forge empymod ``` -------------------------------- ### Clone GitHub Repository Source: https://github.com/emsig/empymod/blob/main/docs/dev/tests.md Clone the empymod GitHub repository locally to start development. ```console git clone git@github.com:emsig/empymod.git ``` -------------------------------- ### Build Documentation Source: https://github.com/emsig/empymod/blob/main/docs/dev/tests.md Build the project documentation in HTML format using Sphinx via the Makefile. ```console make html ``` -------------------------------- ### Create and Load a DigitalFilter Source: https://github.com/emsig/empymod/blob/main/docs/api/empymod.filters.DigitalFilter.md Demonstrates how to instantiate a DigitalFilter with a given name and then load its base and coefficient data from ASCII files. Assumes files are located in a 'filters' directory with names matching the filter's base name. ```python import empymod # Create an empty filter; # Name has to be the base of the text files filt = empymod.filters.DigitalFilter('my-filter') # Load the ASCII-files filt.fromfile() # This will load the following three files: # ./filters/my-filter_base.txt # ./filters/my-filter_j0.txt # ./filters/my-filter_j1.txt # and store them in filt.base, filt.j0, and filt.j1. ``` -------------------------------- ### get_layer_nr Source: https://github.com/emsig/empymod/blob/main/docs/api/utils.md Get number of layer in which inp resides. ```APIDOC ## get_layer_nr ### Description Get number of layer in which inp resides. ### Parameters - **inp**: Input parameter. - **depth**: The depth of the layers. ``` -------------------------------- ### List All Makefile Targets Source: https://github.com/emsig/empymod/blob/main/docs/dev/tests.md Display all available targets and commands in the Makefile. ```console make ``` -------------------------------- ### get_azm_dip Source: https://github.com/emsig/empymod/blob/main/docs/api/utils.md Get angles, interpolation weights and normalization weights. ```APIDOC ## get_azm_dip ### Description Get angles, interpolation weights and normalization weights. ### Parameters - **inp**: Input parameter. - **iz**: Index for z-coordinate. - **ninpz**: Number of points in z-direction. - **intpts**: Interpolation points. - **...**: Additional parameters. ``` -------------------------------- ### Create a Default Report Source: https://github.com/emsig/empymod/blob/main/docs/api/empymod.utils.Report.md Instantiate the Report class with default parameters to display system and package version information. ```python >>> import pytest >>> import dateutil >>> from empymod import Report >>> Report() # Default values ``` -------------------------------- ### get_abs Source: https://github.com/emsig/empymod/blob/main/docs/api/utils.md Get required ab's for given angles. ```APIDOC ## get_abs ### Description Get required ab's for given angles. ### Parameters - **msrc**: Source midpoint parameter. - **mrec**: Receiver midpoint parameter. - **srcazm**: Source azimuth. - **srcdip**: Source dip. - **recazm**: Receiver azimuth. - **...**: Additional parameters. ``` -------------------------------- ### get_geo_fact Source: https://github.com/emsig/empymod/blob/main/docs/api/utils.md Get required geometrical scaling factor for given angles. ```APIDOC ## get_geo_fact ### Description Get required geometrical scaling factor for given angles. ### Parameters - **ab**: Source-receiver configuration parameter. - **srcazm**: Source azimuth. - **srcdip**: Source dip. - **recazm**: Receiver azimuth. - **...**: Additional parameters. ``` -------------------------------- ### Check README Description with rst2html Source: https://github.com/emsig/empymod/blob/main/docs/dev/release.md Use this command to preview how the long description from README will be rendered as HTML. This is useful if changes were made to the README. ```shell python setup.py --long-description | rst2html.py --no-raw > index.html ``` -------------------------------- ### Create a Report with Multiple Packages and Custom Columns Source: https://github.com/emsig/empymod/blob/main/docs/api/empymod.utils.Report.md Instantiate the Report class with a list of additional packages (e.g., pytest, dateutil) and specify the number of columns for the HTML table output. ```python >>> Report([pytest, dateutil], ncol=5) # Set nr of columns ``` -------------------------------- ### get_off_ang Source: https://github.com/emsig/empymod/blob/main/docs/api/utils.md Get depths, offsets, angles, hence spatial input parameters. ```APIDOC ## get_off_ang ### Description Get depths, offsets, angles, hence spatial input parameters. ### Parameters - **src**: Source parameter. - **rec**: Receiver parameter. - **nsrc**: Number of sources. - **nrec**: Number of receivers. - **verb**: Verbosity level. ``` -------------------------------- ### Compare DLF, Quadrature, and Analytical Hankel Transforms Source: https://github.com/emsig/empymod/blob/main/docs/manual/info.md This script compares the results of the DLF, quadrature, and analytical Hankel transform methods for various source-receiver configurations. It demonstrates the impact of the minimum offset on the DLF method and highlights the accuracy of the quadrature and analytical methods at zero offset. The script requires empymod, numpy, and matplotlib. ```python import empymod import numpy as np import matplotlib.pyplot as plt xy = np.arange(1001.)/500-1 # x=y-offsets off = np.sign(xy)*np.sqrt(2*xy**2) # Offset res = 1 # Fullspace resistivity zoff = 1 # Vertical distance freq = 1 # Frequency # Collect input inp = {'src': [0, 0, 0], 'rec': [xy, xy, zoff], 'depth': [], 'res': res, 'freqtime': freq, 'verb': 2} pab = [11, 12, 13, 14, 15, 16, 21, 22, 23, 24, 25, 26, 31, 32, 33, 34, 35, 36, 41, 42, 43, 44, 45, 46, 51, 52, 53, 54, 55, 56, 61, 62, 63, 64, 65, 66] # Loop over all source-receiver combinations for ab in pab: # Enforce minimum offset empymod.set_minimum(min_off=1e-3) print(' --- DLF ---') num = empymod.dipole( ab=ab, xdirect=False, htarg={'pts_per_dec': 0}, **inp) # Remove minimum offset empymod.set_minimum(min_off=0) print(' --- QUAD ---') qua = empymod.dipole( ab=ab, xdirect=False, ht='quad', **inp, htarg={'a': 1e-3, 'b': 5e1, 'rtol': 1e-4, 'pts_per_dec': 100}) print(' --- Analytical ---') ana = empymod.dipole(ab=ab, xdirect=True, **inp) # Plot the result plt.figure(num=ab) plt.suptitle(f"ab = {ab}") ax1 = plt.subplot(221) plt.title('Real') plt.ylabel('E-field (V/m)') plt.plot(off, ana.real, 'k-') plt.plot(off, qua.real, 'C0--') plt.plot(off, num.real, 'C1-.') plt.xticks([-1, -0.5, 0, 0.5, 1], ()) ax3 = plt.subplot(223) plt.xlabel('Offset (m)') plt.ylabel('Rel. Error (%)') plt.plot(off, 100*abs((qua.real-ana.real)/ana.real), 'C0--') plt.plot(off, 100*abs((num.real-ana.real)/ana.real), 'C1-.') plt.yscale('log') ax2 = plt.subplot(222, sharey=ax1) plt.title('Imag') plt.plot(off, ana.imag, 'k-', label='analytical') plt.plot(off, qua.imag, 'C0--', label='QUAD') plt.plot(off, num.imag, 'C1-.', label='DLF') ax2.yaxis.set_label_position("right") ax2.yaxis.tick_right() plt.xticks([-1, -0.5, 0, 0.5, 1], ()) plt.legend() ax4 = plt.subplot(224, sharey=ax3) plt.xlabel('Offset (m)') plt.plot(off, 100*abs((qua.imag-ana.imag)/ana.imag), 'C0--') plt.plot(off, 100*abs((num.imag-ana.imag)/ana.imag), 'C1-.') ax4.yaxis.set_label_position("right") ax4.yaxis.tick_right() plt.yscale('log') plt.tight_layout() plt.show() ``` -------------------------------- ### ip_and_q Source: https://github.com/emsig/empymod/blob/main/docs/api/model.md Return In-Phase and Quadrature components for provided model and system. ```APIDOC ## ip_and_q ### Description Return In-Phase and Quadrature components for provided model and system. ### Method Not specified (likely a function call in a Python library) ### Parameters - **kwargs**: Keyword arguments for model and system ``` -------------------------------- ### User-Defined Eta Computation Function Source: https://github.com/emsig/empymod/blob/main/docs/manual/info.md Example of a custom function to compute etaH and etaV. This function can use parameters provided in the 'inp' dictionary and those computed by empymod in 'p_dict'. ```python def my_new_eta(inp, p_dict): # Your computations, using the parameters you provided # in `inp` and the parameters from empymod in `p_dict`. # In the example line below, we provide, e.g., inp['tau'] return etaH, etaV ``` -------------------------------- ### empymod.model.gpr Source: https://github.com/emsig/empymod/blob/main/docs/api/empymod.model.gpr.md Calculates the Ground-Penetrating Radar signal. This function is experimental and should be used with caution. It is designed as an example for calculating GPR responses and relies on specific Hankel and Fourier transform methods. ```APIDOC ## empymod.model.gpr ### Description Calculates the Ground-Penetrating Radar signal. This function is experimental and should be used with caution. It is designed as an example for calculating GPR responses and relies on specific Hankel and Fourier transform methods. ### Parameters * **src**, **rec**, **freqtime**: See docstring of [`dipole`](empymod.model.dipole.md#empymod.model.dipole) for a description. * **depth**, **res**, **aniso**, **epermH**, **epermV**, **mpermH**, **mpermV**: See docstring of [`dipole`](empymod.model.dipole.md#empymod.model.dipole) for a description. * **cf** (float): Centre frequency of GPR-signal, in Hz. Sensible values are between 10 MHz and 3000 MHz. * **gain** (float, optional): Power of gain function. If None, no gain is applied. Only used if signal!=None. Defaults to None. * **ab** (int, optional): Defaults to 11. * **ht**, **htarg**, **ft**, **ftarg**, **xdirect**, **loop**: See docstring of [`bipole`](empymod.model.bipole.md#empymod.model.bipole) for a description. ### Returns * **EM** (numpy.ndarray): GPR response ``` -------------------------------- ### Create a Report with an Additional Package Source: https://github.com/emsig/empymod/blob/main/docs/api/empymod.utils.Report.md Instantiate the Report class and provide an additional package (e.g., pytest) to include its version information in the report. ```python >>> Report(pytest) # Provide additional package ``` -------------------------------- ### Implement Hankel Transform Pair J0_1 Source: https://github.com/emsig/empymod/blob/main/docs/api/fdesign.md Implement the analytical Hankel transform pair J0_1 using the Ghosh function. This example defines the left-hand side (lhs) and right-hand side (rhs) functions for the transform. ```python def j0_1(a=1): """Hankel transform pair J0_1 ([Ande75]_).""" def lhs(l): return l*np.exp(-a*l**2) def rhs(r): return np.exp(-r**2/(4*a))/(2*a) return Ghosh('j0', lhs, rhs) ``` -------------------------------- ### empymod.model.ip_and_q Source: https://github.com/emsig/empymod/blob/main/docs/api/index.md Provides functionality for In-phase and Quadrature calculations. ```APIDOC ## empymod.model.ip_and_q ### Description In-phase and Quadrature. ### Module empymod.model ``` -------------------------------- ### Check Linting Source: https://github.com/emsig/empymod/blob/main/docs/dev/tests.md Run the flake8 linter to check for code style issues using the Makefile. ```console make flake8 ``` -------------------------------- ### Run empymod bipole from CLI Source: https://github.com/emsig/empymod/blob/main/docs/manual/iocli.md Executes the empymod bipole routine using a JSON input file and saves the output to a text file. ```console empymod bipole myrun.json mydata.txt ``` -------------------------------- ### Load Input Parameters from JSON Source: https://github.com/emsig/empymod/blob/main/docs/manual/iocli.md Loads input parameters from a JSON file to rerun the exact same simulation. ```python import empymod # Load input parameters from a JSON file input_params = empymod.load_input('myrun.json') ``` -------------------------------- ### conv_warning Source: https://github.com/emsig/empymod/blob/main/docs/api/utils.md Print error if QWE/QUAD did not converge at least once. ```APIDOC ## conv_warning ### Description Print error if QWE/QUAD did not converge at least once. ### Parameters - **conv**: Convergence parameter. - **targ**: Target parameter. - **name**: Name of the convergence check. - **verb**: Verbosity level. ``` -------------------------------- ### EMArray Amplitude and Phase Calculation Source: https://github.com/emsig/empymod/blob/main/docs/api/empymod.utils.EMArray.md Demonstrates creating an EMArray and calculating its amplitude and phase. Supports phase in degrees or radians, with options for unwrapping and lag/lead. ```python import numpy as np from empymod.utils import EMArray emvalues = EMArray(np.array([1+1j, 1-4j, -1+2j])) print(f"Amplitude : {emvalues.amp()}") print(f"Phase (rad) : {emvalues.pha()}") print(f"Phase (deg) : {emvalues.pha(deg=True))}") print(f"Phase (deg; lead) : {emvalues.pha(deg=True, lag=False))}") ``` -------------------------------- ### check_solution Source: https://github.com/emsig/empymod/blob/main/docs/api/utils.md Check required solution with parameters. ```APIDOC ## check_solution ### Description Check required solution with parameters. ### Parameters - **solution**: The solution parameter. - **signal**: The signal parameter. - **ab**: Source-receiver configuration parameter. - **msrc**: Source midpoint parameter. - **mrec**: Receiver midpoint parameter. ``` -------------------------------- ### fromfile Method Source: https://github.com/emsig/empymod/blob/main/docs/api/empymod.filters.DigitalFilter.md Loads filter values (base and coefficients) from ASCII files located in a specified directory. The filenames are derived from the filter's name. ```APIDOC ## fromfile(path='filters') ### Description Load filter values from ASCII-files. Load filter base and filter coefficients from ASCII files in the directory path; path can be a relative or absolute path. ### Parameters * **path** (str, optional) - The directory path where the filter files are located. Defaults to 'filters'. ### Examples ```pycon >>> import empymod >>> # Create an empty filter; >>> # Name has to be the base of the text files >>> filt = empymod.filters.DigitalFilter('my-filter') >>> # Load the ASCII-files >>> filt.fromfile() >>> # This will load the following three files: >>> # ./filters/my-filter_base.txt >>> # ./filters/my-filter_j0.txt >>> # ./filters/my-filter_j1.txt >>> # and store them in filt.base, filt.j0, and filt.j1. ``` ``` -------------------------------- ### Basic Frequency-Domain EM Response Calculation Source: https://github.com/emsig/empymod/blob/main/docs/manual/usage.md This snippet demonstrates a basic frequency-domain electromagnetic response calculation using empymod. It defines survey parameters, the resistivity model, and computes the response at receiver locations. Ensure necessary imports are present. ```python import empymod import numpy as np # Survey parameters freq = np.array([1.]) # Frequency in Hz rec_z = np.array([0. ]) # Receiver z-coordinates rec_x = np.array([0. ]) # Receiver x-coordinates rec_y = np.array([0. ]) # Receiver y-coordinates src_z = np.array([0. ]) # Source z-coordinates src_x = np.array([0. ]) # Source x-coordinates src_y = np.array([0. ]) # Source y-coordinates src_type = 'e' src_mid = np.array([0. ]) # Source midpoint # Resistivity model res = np.array([1.]) # Resistivity in Ohm-m # Anisotropy, permittivity, permeability are not specified, so defaults are used. # Compute the electromagnetic response result = empymod.model.bipole( freq, rec_z, rec_x, rec_y, src_z, src_x, src_y, src_type, src_mid, res, aniso=None, epsilon_r_h=None, epsilon_r_v=None, mu_r_h=None, mu_r_v=None, lm=None, nlay=None, verb=0, abs_tol=1e-05, rel_tol=1e-05, sem=True, ft=None, dlf=None, qwe=None, hdf=None, mpl=None, store_only_needed_kernels=False, nsolver=None, nquad=None, max_threads=None, verbose=None, out=None) print(result) ``` -------------------------------- ### Display empymod CLI Help Source: https://github.com/emsig/empymod/blob/main/docs/manual/iocli.md Shows the help message for the empymod command-line interface, listing available routines and options. ```console empymod --help ``` -------------------------------- ### analytical Source: https://github.com/emsig/empymod/blob/main/docs/api/model.md Return analytical full- or half-space solution. ```APIDOC ## analytical ### Description Return analytical full- or half-space solution. ### Method Not specified (likely a function call in a Python library) ### Parameters - **src**: Source parameters - **rec**: Receiver parameters - **res**: Layer resistivities - **freqtime**: Frequencies or times - **...**: Additional parameters ``` -------------------------------- ### empymod.utils.Report Class Source: https://github.com/emsig/empymod/blob/main/docs/api/empymod.utils.Report.md Initializes and displays system and package version information. It can optionally include additional packages and customize the output format. ```APIDOC ## Class: empymod.utils.Report ### Description Prints date, time, and version information using the scooby library. It displays OS, CPU count, numpy, scipy, numba, empymod, sys.version, and time/date by default. Optionally includes IPython, matplotlib, MKL information, and user-specified packages. Requires the 'scooby' package to be installed. ### Parameters * **add_pckg** (Package or list of packages) - Optional - Packages or list of packages to add to output information. These must be imported beforehand. * **ncol** (int) - Optional - Number of package-columns in html table. Defaults to 3. Has no effect in text-version. * **text_width** (int) - Optional - The text width for non-HTML display modes. * **sort** (bool) - Optional - Sort the packages when the report is shown. ### Examples ```python >>> import pytest >>> import dateutil >>> from empymod import Report >>> Report() # Default values >>> Report(pytest) # Provide additional package >>> Report([pytest, dateutil], ncol=5) # Set nr of columns ``` ``` -------------------------------- ### Upload to TestPyPI with Twine Source: https://github.com/emsig/empymod/blob/main/docs/dev/release.md This command uploads distribution files to the TestPyPI repository. It requires a configured ~/.pypirc file and is useful for testing the release process before deploying to the main PyPI. ```shell ~/anaconda3/bin/twine upload dist/* -r testpypi ``` -------------------------------- ### load_input Source: https://github.com/emsig/empymod/blob/main/docs/api/io.md Loads an input dictionary from a file. Accepts a filename and returns the loaded input dictionary. ```APIDOC ## load_input ### Description Loads an input dictionary from a file. ### Method Not applicable (Python function) ### Parameters - **fname** (string) - Required - The filename to load the input from. ### Request Example ```python input_data = empymod.io.load_input('my_input.json') ``` ### Response #### Success Response - **input_data** (dict) - The loaded input dictionary. ``` -------------------------------- ### qwe Source: https://github.com/emsig/empymod/blob/main/docs/api/transform.md Quadrature-With-Extrapolation. ```APIDOC ## qwe ### Description Quadrature-With-Extrapolation. ### Parameters - **rtol** (type) - Required - Relative tolerance. - **atol** (type) - Required - Absolute tolerance. - **maxint** (type) - Required - Maximum number of intervals. - **inp** (type) - Required - Input function. - **intervals** (type) - Required - Integration intervals. - **...** (type) - Optional - Additional arguments. ``` -------------------------------- ### empymod.kernel.reflections Source: https://github.com/emsig/empymod/blob/main/docs/api/empymod.kernel.reflections.md Calculate Rp, Rm. This function corresponds to equations 64/65 and A-11/A-12 in [[HuTS15]](../manual/references.md#huts15), and loosely to the corresponding files Rmin.F90 and Rplus.F90. This function is called from the function [`greenfct`](empymod.kernel.greenfct.md#empymod.kernel.greenfct). ```APIDOC ## empymod.kernel.reflections(depth, e_zH, Gam, lrec, lsrc) ### Description Calculate Rp, Rm. ### Parameters * **depth** (float) - The depth of the interface. * **e_zH** (complex) - The electric field at the interface. * **Gam** (float) - The reflection coefficient at the interface. * **lrec** (bool) - Whether to calculate reflected fields. * **lsrc** (bool) - Whether to calculate source fields. ### Returns * **Rp** (complex) - The reflection coefficient for the primary wave. * **Rm** (complex) - The reflection coefficient for the multiple wave. ``` -------------------------------- ### check_ab Source: https://github.com/emsig/empymod/blob/main/docs/api/utils.md Check source-receiver configuration. ```APIDOC ## check_ab ### Description Check source-receiver configuration. ### Parameters - **ab**: Source-receiver configuration parameter. - **verb**: Verbosity level. ``` -------------------------------- ### empymod.model.ip_and_q Source: https://github.com/emsig/empymod/blob/main/docs/api/empymod.model.ip_and_q.md Calculates the In-Phase (IP) and Quadrature (Q) components for a given model and system. This function internally calls the `dipole` function twice to compute the secondary and primary fields, then returns their ratio scaled by a factor. ```APIDOC ## empymod.model.ip_and_q ### Description Returns In-Phase and Quadrature components for provided model and system. This function is only implemented for frequency-domain data of magnetic sources and receivers. ### Method N/A (Python function) ### Endpoint N/A (Python function) ### Parameters All parameters are the same as for [`empymod.model.dipole`](empymod.model.dipole.md#empymod.model.dipole), with the following restrictions: - `ab` must be one of [44, 45, 46, 54, 55, 56, 64, 65, 66] (magnetic source and receiver). - `xdirect` is ignored; it is first set to `None` for Hs, and then to `True` for Hp. - `signal` must be `None` (frequency domain); `ft` and `ftarg` have hence no effect. #### scale Multiplication factor. E.g., 1e3 for ppt, 1e6 for ppm. ### Returns #### IP, Q In-phase and quadrature values. ``` -------------------------------- ### empymod.io.load_input Source: https://github.com/emsig/empymod/blob/main/docs/api/empymod.io.load_input.md Loads input data from a file. Currently, only JSON files are supported. ```APIDOC ## empymod.io.load_input(fname) ### Description Loads input data from a file. Currently, only JSON files are supported. ### Parameters #### Path Parameters - **fname** (string) - Required - File name with absolute or relative path including suffix, which defines the used data format. Implemented is currently only `.json`. ### Returns #### Success Response - **data** (dict) - Dictionary containing the input that was stored in the file. ``` -------------------------------- ### Run Pytest Source: https://github.com/emsig/empymod/blob/main/docs/dev/tests.md Execute the pytest test suite to run all tests using the Makefile. ```console make pytest ``` -------------------------------- ### Load Computation Data from Text File Source: https://github.com/emsig/empymod/blob/main/docs/manual/iocli.md Loads computation data from a plain text file, parsing the header and data rows. ```python import empymod # Load data from a text file data = empymod.load_data('mydata.txt') ```