{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "Cross-Borehole example\n", "======================\n", "In this example we are going to invert one of the example given in the R2 manual. The aim is to detect a hidden block\n", "in the bottom left of the picture as shown below:\n", "and this pictures:\n", "\n", "![Xhb.png](./img/Xbh.png)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2022-10-25T15:26:11.580240Z", "iopub.status.busy": "2022-10-25T15:26:11.578211Z", "iopub.status.idle": "2022-10-25T15:26:13.319573Z", "shell.execute_reply": "2022-10-25T15:26:13.318637Z" } }, "outputs": [], "source": [ "%matplotlib inline\n", "import warnings\n", "warnings.filterwarnings('ignore')\n", "import os\n", "import sys\n", "import numpy as np # just for parsing the electrode position file\n", "sys.path.append((os.path.relpath('../src'))) # add here the relative path of the API folder\n", "testdir = '../src/examples/dc-2d-borehole/'\n", "from resipy import Project" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Then we will import the `protocol.dat` file that was outputed by the forward model with this geometry and invert it. Note what we also need to import the electrodes position from a .csv file with 3 columns:x, y, buried. The `buried` column contains 1 if the electrode is buried and 0 if not." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2022-10-25T15:26:13.324497Z", "iopub.status.busy": "2022-10-25T15:26:13.323688Z", "iopub.status.idle": "2022-10-25T15:26:20.207920Z", "shell.execute_reply": "2022-10-25T15:26:20.206885Z" } }, "outputs": [], "source": [ "k = Project(typ='R2')\n", "k.createSurvey(testdir + 'protocol.dat', ftype='ProtocolDC')\n", "k.importElec(testdir + 'elec.csv')\n", "k.createMesh('trian', cl=0.5, cl_factor=20, fmd=20)\n", "# cl is characteristic length, it defines the resolution of the mesh around the electrodes, the smaller, the finer\n", "# cl_factor is how the mesh will grow away from the electrode\n", "# NOTE that a too fine mesh (very small cl) will takes a lot of RAM\n", "# but a too coarse mesh won't be able to resolve the target\n", "k.zlim = [-20, 0]\n", "k.showMesh()\n", "k.invert()\n", "k.showResults(sens=False, contour=True)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.15" }, "other_supplementary_files": [ "img/Xbh.png" ] }, "nbformat": 4, "nbformat_minor": 4 }