Commit 3a858f29 authored by Kelly Chang's avatar Kelly Chang

Merge branch 'master' of https://git.elphel.com/Elphel/master

parents 271201a3 5ff7f723
...@@ -776,7 +776,7 @@ ...@@ -776,7 +776,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 72, "execution_count": 16,
"id": "64832ca7", "id": "64832ca7",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
...@@ -784,7 +784,18 @@ ...@@ -784,7 +784,18 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"6.736892561802416\n" "[58 38 13 ... 65 97 32]\n"
]
},
{
"ename": "NameError",
"evalue": "name 'o' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m~\\AppData\\Local\\Temp/ipykernel_2620/2795330121.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 7\u001b[0m \u001b[0mfreqs\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcount\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mvalue\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m/\u001b[0m \u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mvalue\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mset\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 8\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mfreqs\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 9\u001b[1;33m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mstats\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mentropy\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mrel_freq\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlist\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mravel\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mo\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 10\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 11\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mentropy_check\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0my\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;31mNameError\u001b[0m: name 'o' is not defined"
] ]
} }
], ],
...@@ -798,7 +809,7 @@ ...@@ -798,7 +809,7 @@
"def rel_freq(x):\n", "def rel_freq(x):\n",
" freqs = [x.count(value) / len(x) for value in set(x)] \n", " freqs = [x.count(value) / len(x) for value in set(x)] \n",
" return freqs\n", " return freqs\n",
"print(sp.stats.entropy(rel_freq(list(np.ravel(o)))))\n", "print(sp.stats.entropy(rel_freq(list(np.ravel(image)))))\n",
"\n", "\n",
"def entropy_check(x, y):\n", "def entropy_check(x, y):\n",
" #freq = rel_freq(list(np.ravel(o)))\n", " #freq = rel_freq(list(np.ravel(o)))\n",
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 2,
"id": "0d67d099", "id": "5bb42c2c",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 3,
"id": "fc76b964", "id": "ec24fcba",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 4,
"id": "b781115b", "id": "c2430512",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 10,
"id": "fe145ec0", "id": "b973ed91",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -202,7 +202,7 @@ ...@@ -202,7 +202,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 6,
"id": "4fb8f5d0", "id": "4f6a5a0d",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -231,7 +231,7 @@ ...@@ -231,7 +231,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 7,
"id": "9a39a65b", "id": "4b65c7e9",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -293,7 +293,7 @@ ...@@ -293,7 +293,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 11,
"id": "fc4d80bd", "id": "280aafd3",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -307,7 +307,7 @@ ...@@ -307,7 +307,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 12,
"id": "2d82e61a", "id": "c4242b52",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -329,7 +329,7 @@ ...@@ -329,7 +329,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 16, "execution_count": 16,
"id": "e35be607", "id": "a9502e22",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
......
...@@ -805,11 +805,11 @@ ...@@ -805,11 +805,11 @@
"plt.colorbar()\n", "plt.colorbar()\n",
"plt.xlim(0,50)\n", "plt.xlim(0,50)\n",
"plt.ylim(0,100)\"\"\"\n", "plt.ylim(0,100)\"\"\"\n",
"print(diff)\n", "\n",
"def rel_freq(x):\n", "def rel_freq(x):\n",
" freqs = [x.count(value) / len(x) for value in set(x)] \n", " freqs = [x.count(value) / len(x) for value in set(x)] \n",
" return freqs\n", " return freqs\n",
"print(sp.stats.entropy(rel_freq(list(np.ravel(o)))))\n", "print(sp.stats.entropy(rel_freq(list(np.ravel(image)))))\n",
"\n", "\n",
"def entropy_check(x, y):\n", "def entropy_check(x, y):\n",
" #freq = rel_freq(list(np.ravel(o)))\n", " #freq = rel_freq(list(np.ravel(o)))\n",
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 2,
"id": "0d67d099", "id": "5bb42c2c",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 3,
"id": "fc76b964", "id": "ec24fcba",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 4,
"id": "b781115b", "id": "c2430512",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 10,
"id": "fe145ec0", "id": "b973ed91",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -202,7 +202,7 @@ ...@@ -202,7 +202,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 6,
"id": "4fb8f5d0", "id": "4f6a5a0d",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -231,7 +231,7 @@ ...@@ -231,7 +231,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 7,
"id": "9a39a65b", "id": "4b65c7e9",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -293,7 +293,7 @@ ...@@ -293,7 +293,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 11,
"id": "fc4d80bd", "id": "280aafd3",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -307,7 +307,7 @@ ...@@ -307,7 +307,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 12,
"id": "2d82e61a", "id": "c4242b52",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -329,7 +329,7 @@ ...@@ -329,7 +329,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 16, "execution_count": 16,
"id": "e35be607", "id": "a9502e22",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
......
Markdown is supported
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