Commit e2334c47 authored by Chanelle Lee's avatar Chanelle Lee
Browse files

Starting to analyse some of the alpha/sigma behaviours

parent 7f49bccc
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import scipy\n",
"import seaborn as sns\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"def f(x, mu, s):\n",
" return scipy.stats.norm.pdf(x, loc=mu, scale=s)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"def F(x, mu, s):\n",
" return scipy.stats.norm.cdf(x, loc=mu, scale=s)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"qualities = {i: i/6 for i in range(1, 6)}"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [],
"source": [
"def integrand(x, i, j, s):\n",
" return f(x, qualities[i], s)*F(x, qualities[j], s)\n",
"\n",
"def probConfusion(i, j, s):\n",
" return scipy.integrate.quad(integrand, -np.inf, np.inf, args=(i, j, s))"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [],
"source": [
"s0 = 0.0000001\n",
"sf = 10\n",
"ss = np.linspace(s0, sf, 1000)\n",
"confusions = [probConfusion(1, 2, s)[0] for s in ss]"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x9c29c88>,\n",
" <matplotlib.lines.Line2D at 0x9c29dd8>]"
]
},
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRw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sli3VLnCxcVvAPvc/atB17MYzKzDzFoL2/XAHcDrwVZVOe7+n9x9nbt3kf//+Bl3/3TAZVWUmTUWbhDAzBqBjwIVuwuuqsLd3TPAzGLd+4An3X1PsFVVlpn9HfAL4D1m1mdmnw26pkXwQeD3yI/mdhd+fjvooipsDfCsmf2a/CDmZ+4eidsDI2QV8LyZvQK8BPyTuz9VqS+rqlshRUSkNFU1chcRkdIo3EVEQkjhLiISQgp3EZEQUriLiISQwl1EJIQU7iIiIaRwFxEJof8P+il4qxnsT80AAAAASUVORK5CYII=\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plt.plot(ss, confusions)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"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.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
%% Cell type:code id: tags:
``` python
import numpy as np
import scipy
import seaborn as sns
import matplotlib.pyplot as plt
```
%% Cell type:code id: tags:
``` python
def f(x, mu, s):
return scipy.stats.norm.pdf(x, loc=mu, scale=s)
```
%% Cell type:code id: tags:
``` python
def F(x, mu, s):
return scipy.stats.norm.cdf(x, loc=mu, scale=s)
```
%% Cell type:code id: tags:
``` python
qualities = {i: i/6 for i in range(1, 6)}
```
%% Cell type:code id: tags:
``` python
def integrand(x, i, j, s):
return f(x, qualities[i], s)*F(x, qualities[j], s)
def probConfusion(i, j, s):
return scipy.integrate.quad(integrand, -np.inf, np.inf, args=(i, j, s))
```
%% Cell type:code id: tags:
``` python
s0 = 0.0000001
sf = 10
ss = np.linspace(s0, sf, 1000)
confusions = [probConfusion(1, 2, s)[0] for s in ss]
```
%% Cell type:code id: tags:
``` python
plt.plot(ss, confusions)
```
%%%% Output: execute_result
[<matplotlib.lines.Line2D at 0x9c29c88>,
<matplotlib.lines.Line2D at 0x9c29dd8>]
%%%% Output: display_data
%% Cell type:code id: tags:
``` python
```
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import scipy\n",
"import seaborn as sns\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"def f(x, mu, s):\n",
" return scipy.stats.norm.pdf(x, loc=mu, scale=s)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"def F(x, mu, s):\n",
" return scipy.stats.norm.cdf(x, loc=mu, scale=s)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"qualities = {i: i/6 for i in range(1, 6)}"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [],
"source": [
"def integrand(x, i, j, s):\n",
" return f(x, qualities[i], s)*F(x, qualities[j], s)\n",
"\n",
"def probConfusion(i, j, s):\n",
" return scipy.integrate.quad(integrand, -np.inf, np.inf, args=(i, j, s))"
]
},
{
"cell_type": "code",
"execution_count": 49,
"metadata": {},
"outputs": [],
"source": [
"s0 = 0.0000001\n",
"sf = 100\n",
"ss = np.linspace(s0, sf, 1000)\n",
"confusions = [probConfusion(1, 2, s)[0] for s in ss]"
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x9cdc390>]"
]
},
"execution_count": 50,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxv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fFhFFBXuDPaw7uJl5uOZ+ZVq+RTt/9Fv46UPIv8k8POjqXD4ImI78C7gD6v1AN5O+4HrMH7HewXwVtrPQiAz5zPze4zxOa5MABurJ7ZtAh5nzM5zZv4Da59E1+u87gP+V7Z9GbgyIl4zjDpKC/dBHtY9ViJiF3AdcC9wbWY+Du3/AwBePbrKhu53gP8CtKr1a4DvVQ9ch/E7168H5oA/roai/jAiNjPG5zgzHwX+B/AI7VA/CdzHeJ/nZb3O67plWmnhPtCDuMdFRFwO/DnwK5n53KjrWS8R8a+BJzPzvs7NXZqO07meAH4M+HhmXge8wBgNwXRTjTPvA3YDrwU20x6WWG2cznM/6/b3vLRwH+Rh3WMhIiZpB/ufZOZfVJu/u/xPtur1yVHVN2Q/DdwcEQ/RHmp7O+2e/JXVP99h/M71LDCbmfdW65+jHfbjeo4BbgD+f2bOZeYC8BfATzHe53lZr/O6bplWWrgP8rDu4lXjzX8EPJCZv93xVueDyN8L/NWFrm09ZOZ/y8ztmbmL9jn9Ymb+W+BLtB+4DmN0vACZ+QRwIiK+v9r0DuB+xvQcVx4B3hIRm6q/48vHPLbnuUOv83oQ+PfVVTNvAU4uD9+8YplZ1B/g54BvAd8Bfn3U9azTMf4M7X+afQ34avXn52iPQ38B+Hb1evWoa12HY/9Z4PPV8uuB/wccB/4MuGzU9Q35WH8UOFKd578Erhr3cwz8JvBN4BvAp4DLxu08A5+m/ZvCAu2e+ft7nVfawzJ3VXn2ddpXEg2lDmeoStIYKm1YRpI0AMNdksaQ4S5JY8hwl6QxZLhL0hgy3CVpDBnukjSGDHdJGkP/Av1WEr+ad9bUAAAAAElFTkSuQmCC\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plt.plot(ss, confusions)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"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.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
%% Cell type:code id: tags:
``` python
import numpy as np
import scipy
import seaborn as sns
import matplotlib.pyplot as plt
```
%% Cell type:code id: tags:
``` python
def f(x, mu, s):
return scipy.stats.norm.pdf(x, loc=mu, scale=s)
```
%% Cell type:code id: tags:
``` python
def F(x, mu, s):
return scipy.stats.norm.cdf(x, loc=mu, scale=s)
```
%% Cell type:code id: tags:
``` python
qualities = {i: i/6 for i in range(1, 6)}
```
%% Cell type:code id: tags:
``` python
def integrand(x, i, j, s):
return f(x, qualities[i], s)*F(x, qualities[j], s)
def probConfusion(i, j, s):
return scipy.integrate.quad(integrand, -np.inf, np.inf, args=(i, j, s))
```
%% Cell type:code id: tags:
``` python
s0 = 0.0000001
sf = 100
ss = np.linspace(s0, sf, 1000)
confusions = [probConfusion(1, 2, s)[0] for s in ss]
```
%% Cell type:code id: tags:
``` python
plt.plot(ss, confusions)
```
%%%% Output: execute_result
[<matplotlib.lines.Line2D at 0x9cdc390>]
%%%% Output: display_data
%% Cell type:code id: tags:
``` python
```
...@@ -4,6 +4,7 @@ import vrep ...@@ -4,6 +4,7 @@ import vrep
import time import time
import numpy as np import numpy as np
import sys import sys
import subprocess
from ePucks import EPuckSim from ePucks import EPuckSim
from myThreads import ControllerThread from myThreads import ControllerThread
...@@ -16,6 +17,7 @@ logger_p = logging.getLogger('poolLogger') ...@@ -16,6 +17,7 @@ logger_p = logging.getLogger('poolLogger')
def main(numSims=1): def main(numSims=1):
logging.config.fileConfig('configuration.ini') logging.config.fileConfig('configuration.ini')
# Connect to V-REP # Connect to V-REP
subprocess.call("")
clientID = vrep.simxStart('127.0.0.1', 19997, True, True, 5000, 5) clientID = vrep.simxStart('127.0.0.1', 19997, True, True, 5000, 5)
if clientID != -1: if clientID != -1:
logger.info('Connected to remote API server') logger.info('Connected to remote API server')
...@@ -53,10 +55,10 @@ def main(numSims=1): ...@@ -53,10 +55,10 @@ def main(numSims=1):
time.sleep(240) time.sleep(240)
def setUp(): def setUp(noise):
optionsList = [0, 1, 2, 3, 4] optionsList = [0, 1, 2, 3, 4]
w = 1.0 w = 1.0
noise = 0.1 noise = noise
poolSize = 2 poolSize = 2
numEpucks = 5 # 20 numEpucks = 5 # 20
ePucks = [] ePucks = []
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment