{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": "<Figure size 1008x576 with 18 Axes>",
      "image/png": "[encoded data, 116164 characters]\n"
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "\n",
    "forces = [\"zero\",\"const\",\"harmonic\"]\n",
    "integrators = [\"1_Euler\", \"2_Heun\", \"3_Exact\", \"4_BDAS\", \"5_MBD\"]\n",
    "computes = [\"msd\", \"oaf\", \"empxx\", \"empyy\", \"x\", \"x_squared\"]\n",
    "\n",
    "\n",
    "analytisch = [[True,True,True,True,True,False],\n",
    "              [False,True,False,False,False,False],\n",
    "              [True,True,False,False,True,True]]\n",
    "kwargs = [[{},{},{},{},{},{}],\n",
    "              [{},{},{},{},{},{}],\n",
    "              [{},{},{},{},{},{}]]\n",
    "\n",
    "\n",
    "path = \"../data/out/\"\n",
    "length = \"_1.000000\"\n",
    "fig, ax = plt.subplots(3,6,figsize=(14,8))\n",
    "\n",
    "for forceindex,force in enumerate(forces):\n",
    "    for compute_index,compute in enumerate(computes):\n",
    "        for index,integrator in enumerate(integrators):\n",
    "            file = path+compute+\"_\"+integrator+\"_\"+force+length+\".dat\"\n",
    "            data = np.loadtxt(file,delimiter=\" \")\n",
    "            ax[forceindex][compute_index].errorbar(data[:,0],data[:,1],yerr=data[:,2],label=integrator,**kwargs[forceindex][compute_index])\n",
    "            if index==0 and analytisch[forceindex][compute_index]:\n",
    "                 ax[forceindex][compute_index].plot(data[:,0],data[:,3],\":\",label=\"analyitsch\", zorder=100)\n",
    "        ax[forceindex][compute_index].set_title(compute)\n",
    "        #ax[forceindex][compute_index].legend()\n",
    "        if forceindex==0 and compute_index==0:\n",
    "            plt.figlegend( loc = 'lower center', ncol=6, labelspacing=0. )\n",
    "\n",
    "ax[0][0].set_ylabel(\"zero\")\n",
    "ax[1][0].set_ylabel(\"const\")\n",
    "ax[2][0].set_ylabel(\"harmonic\")\n",
    "ax[0][1].axvline(1,color=\"r\")\n",
    "ax[1][1].axvline(1,color=\"r\")\n",
    "ax[2][1].axvline(1,color=\"r\")\n",
    "ax[2][0].axvline(1,color=\"r\")\n",
    "\n",
    "\n",
    "ax[0][2].set_ylim([0.8,1.2])\n",
    "ax[0][3].set_ylim([0.8,1.2])\n",
    "ax[0][4].set_ylim([0.8,1.2])\n",
    "ax[2][5].set_ylim([0.8,1.2])\n",
    "#plt.tight_layout()\n",
    "fig.suptitle('Sphere', fontsize=16)\n",
    "plt.savefig(\"../sphere_2d.pdf\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "outputs": [
    {
     "data": {
      "text/plain": "<Figure size 1008x576 with 18 Axes>",
      "image/png": "[encoded data, 132408 characters]\n"
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "analytisch = [[True,True,True,True,False,False],\n",
    "              [False,True,False,False,False,False],\n",
    "              [False,True,False,False,False,False]]\n",
    "kwargs = [[{},{},{},{},{},{}],\n",
    "              [{},{},{},{},{},{}],\n",
    "              [{},{},{},{},{},{}]]\n",
    "\n",
    "\n",
    "path = \"../data/out/\"\n",
    "fig, ax = plt.subplots(3,6,figsize=(14,8))\n",
    "length = \"_3.000000\"\n",
    "for forceindex,force in enumerate(forces):\n",
    "    for compute_index,compute in enumerate(computes):\n",
    "        for index,integrator in enumerate(integrators):\n",
    "            file = path+compute+\"_\"+integrator+\"_\"+force+length+\".dat\"\n",
    "            data = np.loadtxt(file,delimiter=\" \")\n",
    "            ax[forceindex][compute_index].errorbar(data[:,0],data[:,1],yerr=data[:,2],label=integrator,**kwargs[forceindex][compute_index])\n",
    "            if index==0 and analytisch[forceindex][compute_index]:\n",
    "                 ax[forceindex][compute_index].plot(data[:,0],data[:,3],\":\",label=\"analyitsch\", zorder=100)\n",
    "        ax[forceindex][compute_index].set_title(compute)\n",
    "        if forceindex==0 and compute_index==0:\n",
    "            plt.figlegend( loc = 'lower center', ncol=6, labelspacing=0. )\n",
    "\n",
    "ax[0][0].set_ylabel(\"zero\")\n",
    "ax[1][0].set_ylabel(\"const\")\n",
    "ax[2][0].set_ylabel(\"harmonic\")\n",
    "ax[0][1].axvline(1,color=\"r\")\n",
    "ax[1][1].axvline(1,color=\"r\")\n",
    "ax[2][1].axvline(1,color=\"r\")\n",
    "ax[2][0].axvline(1,color=\"r\")\n",
    "\n",
    "fig.suptitle('Rod length 3', fontsize=16)\n",
    "\n",
    "#ax[0][2].set_ylim([0.8,1.2])\n",
    "#ax[0][3].set_ylim([0.8,1.2])\n",
    "ax[0][4].set_ylim([0.95,1.05])\n",
    "#ax[2][5].set_ylim([0.8,1.2])\n",
    "#plt.tight_layout()\n",
    "plt.savefig(\"../length3_2d.pdf\")\n",
    "plt.show()\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}