{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib notebook"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Ziolkowski et al., 2007\n\nReproducing Figure 3 of Ziolkowski et al., 2007, Geophysics. This is a land\nMTEM example.\n\n**Reference**\n\n- **Ziolkowski, A., B. Hobbs, and D. Wright,  2007**, Multitransient\n  electromagnetic demonstration survey in France: Geophysics, 72, F197-F209;\n  DOI: [10.1190/1.2735802](http://dx.doi.org/10.1190/1.2735802).\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import empymod\nimport numpy as np\nfrom copy import deepcopy as dc\nimport matplotlib.pyplot as plt"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Computation\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "# Time\nt = np.linspace(0.001, 0.06, 101)\n\n# Target model\ninp2 = {'src': [0, 0, 0.001],\n        'rec': [1000, 0, 0.001],\n        'depth': [0, 500, 525],\n        'res': [2e14, 20, 500, 20],\n        'freqtime': t,\n        'verb': 1}\n\n# HS model\ninp1 = dc(inp2)\ninp1['depth'] = inp2['depth'][0]\ninp1['res'] = inp2['res'][:2]\n\n# Compute responses\nsths = empymod.dipole(**inp1, signal=1)  # Step, HS\nsttg = empymod.dipole(**inp2, signal=1)  # \" \"   Target\nimhs = empymod.dipole(**inp1, signal=0, ft='fftlog')  # Impulse, HS\nimtg = empymod.dipole(**inp2, signal=0, ft='fftlog')  # \" \"      Target"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Plot\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "plt.figure(figsize=(9, 4))\nplt.subplots_adjust(wspace=.3)\n\n# Step response\nplt.subplot(121)\nplt.title('(a)')\nplt.plot(np.r_[0, 0, t], np.r_[0, sths[0], sths], 'k',\n         label='Uniform half-space')\nplt.plot(np.r_[0, 0, t], np.r_[0, sttg[0], sttg], 'r',\n         label='Hydrocarbon reservoir')\nplt.axis([-.02, 0.06, 0, 8e-9])\nplt.xlabel('Time (s)')\nplt.ylabel('Electric field amplitude (V/m/A-m)')\nplt.legend()\n\n# Impulse response\nplt.subplot(122)\nplt.title('(b)')\n\n# Normalize by max-response\nntg = np.max(np.r_[imtg, imhs])\n\nplt.plot(np.r_[0, 0, t], np.r_[2, 0, imhs/ntg], 'k',\n         label='Uniform half-space')\nplt.plot(np.r_[0, t], np.r_[0, imtg/ntg], 'r', label='Hydrocarbon reservoir')\nplt.axis([-.02, 0.06, 0, 1.02])\nplt.xlabel('Time (s)')\nplt.ylabel(r'Normalized derivative ($\\Omega$/m$^2$/s)')\nplt.legend()\nplt.show()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Original Figure\n\nFigure 3 of Ziolkowski et al., 2007, Geophysics:\n\n<img src=\"file://../../_static/figures/Ziolkowski2007.jpg\">\n\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "empymod.Report()"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "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.6"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}