{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from pathlib import Path\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import scipy\n",
    "from glob import glob\n",
    "import os\n",
    "from lib.lib import read_sp, read_xyz_alt, read_xy_alt, aggregate_sp_fd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'read_sp' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m",
      "\u001B[0;31mNameError\u001B[0m                                 Traceback (most recent call last)",
      "Cell \u001B[0;32mIn[1], line 1\u001B[0m\n\u001B[0;32m----> 1\u001B[0m d2_raw \u001B[38;5;241m=\u001B[39m \u001B[43mread_sp\u001B[49m(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m../data/rust-sticking-probability\u001B[39m\u001B[38;5;124m\"\u001B[39m, read_xy_alt)\n\u001B[1;32m      2\u001B[0m d2 \u001B[38;5;241m=\u001B[39m aggregate_sp_fd(d2_raw)\n",
      "\u001B[0;31mNameError\u001B[0m: name 'read_sp' is not defined"
     ]
    }
   ],
   "source": [
    "d2_raw = read_sp(\"../data/rust-sticking-probability\", read_xy_alt)\n",
    "d2 = aggregate_sp_fd(d2_raw)"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "d3_raw = read_sp(\"../data/rust-3d-offaxis-sp\", read_xyz_alt)\n",
    "d3 = aggregate_sp_fd(d3_raw)"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "outputs": [
    {
     "data": {
      "text/plain": "<Figure size 640x480 with 1 Axes>",
      "image/png": "[encoded data, 31712 characters]"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(\n",
    "    d2.index,\n",
    "    d2.fd,\n",
    "    color='tab:blue',\n",
    "    label='D2'\n",
    ")\n",
    "\n",
    "plt.plot(\n",
    "    d3.index,\n",
    "    d3.fd,\n",
    "    color='tab:orange',\n",
    "    label='D3'\n",
    ")\n",
    "\n",
    "plt.xlabel(\"$p_{stick}$\")\n",
    "plt.ylabel(\"$fd$\")\n",
    "plt.legend()\n",
    "\n",
    "plt.savefig('../figures/sp-fd-2d-3d.svg')\n",
    "plt.savefig('../figures/sp-fd-2d-3d.png')\n",
    "plt.show()"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "outputs": [
    {
     "data": {
      "text/plain": "             fd    fd_std\nprobability              \n0.1         NaN  0.112454\n0.2         NaN  0.116460\n0.3         NaN  0.097406\n0.4         NaN  0.107908\n0.5         NaN  0.103990\n0.6         NaN  0.098772\n0.7         NaN  0.096520\n0.8         NaN  0.093455\n0.9         NaN  0.104862\n1.0         NaN  0.091404",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>fd</th>\n      <th>fd_std</th>\n    </tr>\n    <tr>\n      <th>probability</th>\n      <th></th>\n      <th></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0.1</th>\n      <td>NaN</td>\n      <td>0.112454</td>\n    </tr>\n    <tr>\n      <th>0.2</th>\n      <td>NaN</td>\n      <td>0.116460</td>\n    </tr>\n    <tr>\n      <th>0.3</th>\n      <td>NaN</td>\n      <td>0.097406</td>\n    </tr>\n    <tr>\n      <th>0.4</th>\n      <td>NaN</td>\n      <td>0.107908</td>\n    </tr>\n    <tr>\n      <th>0.5</th>\n      <td>NaN</td>\n      <td>0.103990</td>\n    </tr>\n    <tr>\n      <th>0.6</th>\n      <td>NaN</td>\n      <td>0.098772</td>\n    </tr>\n    <tr>\n      <th>0.7</th>\n      <td>NaN</td>\n      <td>0.096520</td>\n    </tr>\n    <tr>\n      <th>0.8</th>\n      <td>NaN</td>\n      <td>0.093455</td>\n    </tr>\n    <tr>\n      <th>0.9</th>\n      <td>NaN</td>\n      <td>0.104862</td>\n    </tr>\n    <tr>\n      <th>1.0</th>\n      <td>NaN</td>\n      <td>0.091404</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d3"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "outputs": [
    {
     "data": {
      "text/plain": "                   fd    fd_std\nprobability                    \n0.1          2.481805  0.101417\n0.2          2.372849  0.091412\n0.3          2.318823  0.090325\n0.4          2.242464  0.088371\n0.5          2.215201  0.093227\n0.6          2.174664  0.086606\n0.7          2.161655  0.080741\n0.8          2.135019  0.080976\n0.9          2.112670  0.086004\n1.0          2.103077  0.083651",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>fd</th>\n      <th>fd_std</th>\n    </tr>\n    <tr>\n      <th>probability</th>\n      <th></th>\n      <th></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0.1</th>\n      <td>2.481805</td>\n      <td>0.101417</td>\n    </tr>\n    <tr>\n      <th>0.2</th>\n      <td>2.372849</td>\n      <td>0.091412</td>\n    </tr>\n    <tr>\n      <th>0.3</th>\n      <td>2.318823</td>\n      <td>0.090325</td>\n    </tr>\n    <tr>\n      <th>0.4</th>\n      <td>2.242464</td>\n      <td>0.088371</td>\n    </tr>\n    <tr>\n      <th>0.5</th>\n      <td>2.215201</td>\n      <td>0.093227</td>\n    </tr>\n    <tr>\n      <th>0.6</th>\n      <td>2.174664</td>\n      <td>0.086606</td>\n    </tr>\n    <tr>\n      <th>0.7</th>\n      <td>2.161655</td>\n      <td>0.080741</td>\n    </tr>\n    <tr>\n      <th>0.8</th>\n      <td>2.135019</td>\n      <td>0.080976</td>\n    </tr>\n    <tr>\n      <th>0.9</th>\n      <td>2.112670</td>\n      <td>0.086004</td>\n    </tr>\n    <tr>\n      <th>1.0</th>\n      <td>2.103077</td>\n      <td>0.083651</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d3"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false
   }
  }
 ],
 "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
}
