Skip to content

Instantly share code, notes, and snippets.

@barrbrain
Last active June 2, 2019 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barrbrain/42d52c9e23ae0a23930b2108d71479b9 to your computer and use it in GitHub Desktop.
Save barrbrain/42d52c9e23ae0a23930b2108d71479b9 to your computer and use it in GitHub Desktop.
Activity masking effect in cdef_dist_8x8
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Activity masking effect in cdef_dist_8x8"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
"<!-- Created with matplotlib (http://matplotlib.org/) -->\n",
"<svg height=\"523.818125pt\" version=\"1.1\" viewBox=\"0 0 710.403125 523.818125\" width=\"710.403125pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
" <defs>\n",
" <style type=\"text/css\">\n",
"*{stroke-linecap:butt;stroke-linejoin:round;}\n",
" </style>\n",
" </defs>\n",
" <g id=\"figure_1\">\n",
" <g id=\"patch_1\">\n",
" <path d=\"M 0 523.818125 \n",
"L 710.403125 523.818125 \n",
"L 710.403125 0 \n",
"L 0 0 \n",
"z\n",
"\" style=\"fill:none;\"/>\n",
" </g>\n",
" <g id=\"axes_1\">\n",
" <g id=\"patch_2\">\n",
" <path d=\"M 30.103125 499.94 \n",
"L 699.703125 499.94 \n",
"L 699.703125 10.7 \n",
"L 30.103125 10.7 \n",
"z\n",
"\" style=\"fill:#ffffff;\"/>\n",
" </g>\n",
" <g id=\"matplotlib.axis_1\">\n",
" <g id=\"xtick_1\">\n",
" <g id=\"line2d_1\">\n",
" <defs>\n",
" <path d=\"M 0 0 \n",
"L 0 3.5 \n",
"\" id=\"m60d197a366\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
" </defs>\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"60.539489\" xlink:href=\"#m60d197a366\" y=\"499.94\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_1\">\n",
" <text style=\"font-family:DejaVu Sans;font-size:10px;font-style:normal;font-weight:normal;text-anchor:middle;\" transform=\"rotate(-0, 60.539489, 514.538437)\" x=\"60.539489\" y=\"514.538437\">0</text>\n",
" </g>\n",
" </g>\n",
" <g id=\"xtick_2\">\n",
" <g id=\"line2d_2\">\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"135.094563\" xlink:href=\"#m60d197a366\" y=\"499.94\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_2\">\n",
" <text style=\"font-family:DejaVu Sans;font-size:10px;font-style:normal;font-weight:normal;text-anchor:middle;\" transform=\"rotate(-0, 135.094563, 514.538437)\" x=\"135.094563\" y=\"514.538437\">2500</text>\n",
" </g>\n",
" </g>\n",
" <g id=\"xtick_3\">\n",
" <g id=\"line2d_3\">\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"209.649638\" xlink:href=\"#m60d197a366\" y=\"499.94\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_3\">\n",
" <text style=\"font-family:DejaVu Sans;font-size:10px;font-style:normal;font-weight:normal;text-anchor:middle;\" transform=\"rotate(-0, 209.649638, 514.538437)\" x=\"209.649638\" y=\"514.538437\">5000</text>\n",
" </g>\n",
" </g>\n",
" <g id=\"xtick_4\">\n",
" <g id=\"line2d_4\">\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"284.204712\" xlink:href=\"#m60d197a366\" y=\"499.94\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_4\">\n",
" <text style=\"font-family:DejaVu Sans;font-size:10px;font-style:normal;font-weight:normal;text-anchor:middle;\" transform=\"rotate(-0, 284.204712, 514.538437)\" x=\"284.204712\" y=\"514.538437\">7500</text>\n",
" </g>\n",
" </g>\n",
" <g id=\"xtick_5\">\n",
" <g id=\"line2d_5\">\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"358.759787\" xlink:href=\"#m60d197a366\" y=\"499.94\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_5\">\n",
" <text style=\"font-family:DejaVu Sans;font-size:10px;font-style:normal;font-weight:normal;text-anchor:middle;\" transform=\"rotate(-0, 358.759787, 514.538437)\" x=\"358.759787\" y=\"514.538437\">10000</text>\n",
" </g>\n",
" </g>\n",
" <g id=\"xtick_6\">\n",
" <g id=\"line2d_6\">\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"433.314861\" xlink:href=\"#m60d197a366\" y=\"499.94\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_6\">\n",
" <text style=\"font-family:DejaVu Sans;font-size:10px;font-style:normal;font-weight:normal;text-anchor:middle;\" transform=\"rotate(-0, 433.314861, 514.538437)\" x=\"433.314861\" y=\"514.538437\">12500</text>\n",
" </g>\n",
" </g>\n",
" <g id=\"xtick_7\">\n",
" <g id=\"line2d_7\">\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"507.869936\" xlink:href=\"#m60d197a366\" y=\"499.94\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_7\">\n",
" <text style=\"font-family:DejaVu Sans;font-size:10px;font-style:normal;font-weight:normal;text-anchor:middle;\" transform=\"rotate(-0, 507.869936, 514.538437)\" x=\"507.869936\" y=\"514.538437\">15000</text>\n",
" </g>\n",
" </g>\n",
" <g id=\"xtick_8\">\n",
" <g id=\"line2d_8\">\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"582.425011\" xlink:href=\"#m60d197a366\" y=\"499.94\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_8\">\n",
" <text style=\"font-family:DejaVu Sans;font-size:10px;font-style:normal;font-weight:normal;text-anchor:middle;\" transform=\"rotate(-0, 582.425011, 514.538437)\" x=\"582.425011\" y=\"514.538437\">17500</text>\n",
" </g>\n",
" </g>\n",
" <g id=\"xtick_9\">\n",
" <g id=\"line2d_9\">\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"656.980085\" xlink:href=\"#m60d197a366\" y=\"499.94\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_9\">\n",
" <text style=\"font-family:DejaVu Sans;font-size:10px;font-style:normal;font-weight:normal;text-anchor:middle;\" transform=\"rotate(-0, 656.980085, 514.538437)\" x=\"656.980085\" y=\"514.538437\">20000</text>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"matplotlib.axis_2\">\n",
" <g id=\"ytick_1\">\n",
" <g id=\"line2d_10\">\n",
" <defs>\n",
" <path d=\"M 0 0 \n",
"L -3.5 0 \n",
"\" id=\"mc8fbdbf1ff\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n",
" </defs>\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"30.103125\" xlink:href=\"#mc8fbdbf1ff\" y=\"454.131993\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_10\">\n",
" <text style=\"font-family:DejaVu Sans;font-size:10px;font-style:normal;font-weight:normal;text-anchor:end;\" transform=\"rotate(-0, 23.103125, 457.931212)\" x=\"23.103125\" y=\"457.931212\">0.7</text>\n",
" </g>\n",
" </g>\n",
" <g id=\"ytick_2\">\n",
" <g id=\"line2d_11\">\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"30.103125\" xlink:href=\"#mc8fbdbf1ff\" y=\"352.514271\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_11\">\n",
" <text style=\"font-family:DejaVu Sans;font-size:10px;font-style:normal;font-weight:normal;text-anchor:end;\" transform=\"rotate(-0, 23.103125, 356.31349)\" x=\"23.103125\" y=\"356.31349\">0.8</text>\n",
" </g>\n",
" </g>\n",
" <g id=\"ytick_3\">\n",
" <g id=\"line2d_12\">\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"30.103125\" xlink:href=\"#mc8fbdbf1ff\" y=\"250.896549\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_12\">\n",
" <text style=\"font-family:DejaVu Sans;font-size:10px;font-style:normal;font-weight:normal;text-anchor:end;\" transform=\"rotate(-0, 23.103125, 254.695767)\" x=\"23.103125\" y=\"254.695767\">0.9</text>\n",
" </g>\n",
" </g>\n",
" <g id=\"ytick_4\">\n",
" <g id=\"line2d_13\">\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"30.103125\" xlink:href=\"#mc8fbdbf1ff\" y=\"149.278826\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_13\">\n",
" <text style=\"font-family:DejaVu Sans;font-size:10px;font-style:normal;font-weight:normal;text-anchor:end;\" transform=\"rotate(-0, 23.103125, 153.078045)\" x=\"23.103125\" y=\"153.078045\">1.0</text>\n",
" </g>\n",
" </g>\n",
" <g id=\"ytick_5\">\n",
" <g id=\"line2d_14\">\n",
" <g>\n",
" <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"30.103125\" xlink:href=\"#mc8fbdbf1ff\" y=\"47.661104\"/>\n",
" </g>\n",
" </g>\n",
" <g id=\"text_14\">\n",
" <text style=\"font-family:DejaVu Sans;font-size:10px;font-style:normal;font-weight:normal;text-anchor:end;\" transform=\"rotate(-0, 23.103125, 51.460323)\" x=\"23.103125\" y=\"51.460323\">1.1</text>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <g id=\"line2d_15\">\n",
" <path clip-path=\"url(#pa404d1ea81)\" d=\"M 60.539489 149.278826 \n",
"L 66.688249 125.061704 \n",
"L 72.837009 103.66299 \n",
"L 78.98577 85.18292 \n",
"L 85.13453 69.653017 \n",
"L 91.28329 57.039082 \n",
"L 97.432051 47.24786 \n",
"L 103.580811 40.136407 \n",
"L 109.729571 35.523037 \n",
"L 115.878332 33.198749 \n",
"L 122.027092 32.938182 \n",
"L 128.175852 34.50942 \n",
"L 134.324613 37.6822 \n",
"L 140.473373 42.234356 \n",
"L 146.622133 47.95653 \n",
"L 152.770894 54.655284 \n",
"L 158.919654 62.154873 \n",
"L 165.068414 70.297925 \n",
"L 171.217175 78.9453 \n",
"L 177.365935 87.975361 \n",
"L 183.514695 97.282849 \n",
"L 189.663456 106.777539 \n",
"L 195.812216 116.38278 \n",
"L 201.960976 126.034019 \n",
"L 208.109737 135.67737 \n",
"L 214.258497 145.268264 \n",
"L 220.407257 154.770209 \n",
"L 226.556018 164.153661 \n",
"L 232.704778 173.395024 \n",
"L 238.853538 182.475756 \n",
"L 245.002299 191.3816 \n",
"L 251.151059 200.101898 \n",
"L 257.299819 208.629018 \n",
"L 263.44858 216.957842 \n",
"L 269.59734 225.085344 \n",
"L 275.7461 233.01022 \n",
"L 281.894861 240.732577 \n",
"L 288.043621 248.253673 \n",
"L 294.192381 255.575689 \n",
"L 300.341142 262.701549 \n",
"L 306.489902 269.634754 \n",
"L 312.638662 276.37926 \n",
"L 318.787423 282.939358 \n",
"L 324.936183 289.319591 \n",
"L 331.084943 295.524675 \n",
"L 337.233704 301.559433 \n",
"L 343.382464 307.428749 \n",
"L 349.531224 313.137524 \n",
"L 355.679985 318.690638 \n",
"L 361.828745 324.092927 \n",
"L 367.977505 329.349159 \n",
"L 374.126265 334.464019 \n",
"L 380.275026 339.442089 \n",
"L 386.423786 344.287845 \n",
"L 392.572546 349.005645 \n",
"L 398.721307 353.599727 \n",
"L 404.870067 358.074201 \n",
"L 411.018827 362.433051 \n",
"L 417.167588 366.680131 \n",
"L 423.316348 370.81917 \n",
"L 429.465108 374.853766 \n",
"L 435.613869 378.787396 \n",
"L 441.762629 382.623409 \n",
"L 447.911389 386.365039 \n",
"L 454.06015 390.015399 \n",
"L 460.20891 393.577488 \n",
"L 466.35767 397.054195 \n",
"L 472.506431 400.448302 \n",
"L 478.655191 403.762485 \n",
"L 484.803951 406.999322 \n",
"L 490.952712 410.161293 \n",
"L 497.101472 413.250784 \n",
"L 503.250232 416.270091 \n",
"L 509.398993 419.221426 \n",
"L 515.547753 422.106915 \n",
"L 521.696513 424.928605 \n",
"L 527.845274 427.688466 \n",
"L 533.994034 430.388395 \n",
"L 540.142794 433.030217 \n",
"L 546.291555 435.615691 \n",
"L 552.440315 438.146509 \n",
"L 558.589075 440.624302 \n",
"L 564.737836 443.050639 \n",
"L 570.886596 445.427033 \n",
"L 577.035356 447.754943 \n",
"L 583.184117 450.035772 \n",
"L 589.332877 452.270875 \n",
"L 595.481637 454.461557 \n",
"L 601.630398 456.609078 \n",
"L 607.779158 458.714651 \n",
"L 613.927918 460.779447 \n",
"L 620.076679 462.804597 \n",
"L 626.225439 464.791191 \n",
"L 632.374199 466.740281 \n",
"L 638.52296 468.652886 \n",
"L 644.67172 470.529985 \n",
"L 650.82048 472.372527 \n",
"L 656.969241 474.181428 \n",
"L 663.118001 475.957574 \n",
"L 669.266761 477.701818 \n",
"\" style=\"fill:none;stroke:#1f77b4;stroke-linecap:square;stroke-width:1.5;\"/>\n",
" </g>\n",
" <g id=\"patch_3\">\n",
" <path d=\"M 30.103125 499.94 \n",
"L 30.103125 10.7 \n",
"\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
" </g>\n",
" <g id=\"patch_4\">\n",
" <path d=\"M 699.703125 499.94 \n",
"L 699.703125 10.7 \n",
"\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
" </g>\n",
" <g id=\"patch_5\">\n",
" <path d=\"M 30.103125 499.94 \n",
"L 699.703125 499.94 \n",
"\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
" </g>\n",
" <g id=\"patch_6\">\n",
" <path d=\"M 30.103125 10.7 \n",
"L 699.703125 10.7 \n",
"\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n",
" </g>\n",
" </g>\n",
" </g>\n",
" <defs>\n",
" <clipPath id=\"pa404d1ea81\">\n",
" <rect height=\"489.24\" width=\"669.6\" x=\"30.103125\" y=\"10.7\"/>\n",
" </clipPath>\n",
" </defs>\n",
"</svg>\n"
],
"text/plain": [
"<Figure size 864x648 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"from IPython.display import set_matplotlib_formats\n",
"set_matplotlib_formats('svg')\n",
"from matplotlib import pyplot as plt\n",
"plt.rcParams['svg.fonttype'] = 'none'\n",
"\n",
"import numpy as np\n",
"\n",
"def ssim_boost(svar):\n",
" return (4033. / 16384.) * (svar + svar + 16384) / np.sqrt(16265089 + svar * svar)\n",
"\n",
"x = np.linspace(0, 9*9*4*63, 100)\n",
"y = ssim_boost(x)\n",
"plt.figure(figsize=(12, 9))\n",
"plt.plot(x, y);"
]
},
{
"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.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment