{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Inversion of current source density apply to a roots imaging\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import os\nimport matplotlib.pyplot as plt\n\n# import numpy as np\n\n# maindir='E:/Padova/Software/SourceInversion/icsd_dev/'\n# os.chdir(maindir)\n\n# -----------------------------------#\n# Exemple cotton\n# -----------------------------------#\n# path2files=\"examples/Cotton_Soil/Nail1/\"\npath2files=\"./nail1/\"\n\n# path2files = os.path.join(os.path.dirname('__file__'), '/Cotton_Soil/Nail1/')\n# cwd=os.getcwd()\n\n# path2files= '../examples/nail1/'\n# DIR= cwd + path2files\n\n# os.chdir(DIR)\n# path2files = \n# fname = os.path.join(cwd, path2files)\n\n# from icsd2d_class import iCSD2d_Class as i2d\n# icsd=i2d(dirName=path2files)   \n# icsd.icsd_init()\n\n# # \n# icsd.wr=1 #weight regularization\n# icsd.run_single()\n# icsd.run_pareto()\n\n# -----------------------------------#\n# apply here a smallness contrainst to the regularisation\nfrom icsd3d_class import iCSD3d_Class as i3d\nfrom plotters import mpl_plot\n\n# mpl_plot.showObs2d(path2files)\n\n\n# import iCSD3d_Class as i3d\n\nicsd=i3d(dirName=path2files)   \nicsd.type='2d'\nicsd.obs_err='sqrt' # choose between constant weight and w = 1/sqrt(abs(obs))\nicsd.wr=1 #weight regularization\nicsd.alphaSxy=True\nicsd.x0_prior=True\nicsd.x0_ini_guess=True # initial guess\nicsd.icsd_init()\n\n\nicsd.estimateM0(methodM0='F1',show=True)\n\n# icsd.clim=[0,0.1]\n# icsd.run_single()\n\nsol= icsd.invert()\n# icsd.invert(pareto=True, regMesh='strc',x0_prior=True, \n#             pareto_MinErr=1, pareto_MaxErr=100)\n\n\n \nfig, ax = plt.subplots()\nax.scatter([0.2,0.4],[0.1,0.3],color='r',marker='v')\nicsd.showResults(ax=ax)\n# fig, ax = plt.subplots()\nplt.show()\n\n\nicsd.showResults()\n\n# icsd.ModelResolution(jacMi=305)\n\n# # run pareto\n# icsd.pareto_MinErr=0.001\n# icsd.pareto_MaxErr=1\n# icsd.pareto_nSteps=3\n\n# icsd.knee=True\n# icsd.run_pareto()"
      ]
    }
  ],
  "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.7.9"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}