Skip to content

Commit

Permalink
more entries to fill
Browse files Browse the repository at this point in the history
  • Loading branch information
LovelyBuggies authored and henryiii committed Sep 24, 2021
1 parent 254c9e9 commit 1c251ad
Showing 1 changed file with 9 additions and 61 deletions.
70 changes: 9 additions & 61 deletions docs/examples/HistNumbaFill.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -33,47 +33,9 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<html>\n",
"<div style=\"display:flex; align-items:center;\">\n",
"<div style=\"width:290px;\">\n",
"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-10 -105 270 120\">\n",
"<line x1=\"-5\" y1=\"0\" x2=\"255\" y2=\"0\" style=\"fill:none;stroke-width:2;stroke:currentColor\"/>\n",
"<text text-anchor=\"middle\" x=\"0\" y=\"15\" style=\"fill:currentColor;\">\n",
"-3\n",
"</text>\n",
"<text text-anchor=\"middle\" x=\"250\" y=\"15\" style=\"fill:currentColor;\">\n",
"3\n",
"</text>\n",
"<text text-anchor=\"middle\" x=\"125.0\" y=\"15\" style=\"fill:currentColor;\">\n",
"x-axis\n",
"</text>\n",
"<polyline points=\" 0,0 0,-0.364 2.5,-0.364 2.5,-0.727 5,-0.727 5,-0.727 7.5,-0.727 7.5,-3.27 10,-3.27 10,-2.55 12.5,-2.55 12.5,-3.27 15,-3.27 15,-2.18 17.5,-2.18 17.5,-2.91 20,-2.91 20,-4 22.5,-4 22.5,-3.27 25,-3.27 25,-3.64 27.5,-3.64 27.5,-4.36 30,-4.36 30,-6.55 32.5,-6.55 32.5,-9.82 35,-9.82 35,-6.55 37.5,-6.55 37.5,-13.5 40,-13.5 40,-13.1 42.5,-13.1 42.5,-17.1 45,-17.1 45,-15.6 47.5,-15.6 47.5,-12.7 50,-12.7 50,-14.9 52.5,-14.9 52.5,-23.6 55,-23.6 55,-18.9 57.5,-18.9 57.5,-28.4 60,-28.4 60,-28.4 62.5,-28.4 62.5,-23.3 65,-23.3 65,-32 67.5,-32 67.5,-33.8 70,-33.8 70,-45.1 72.5,-45.1 72.5,-40 75,-40 75,-41.5 77.5,-41.5 77.5,-50.2 80,-50.2 80,-53.8 82.5,-53.8 82.5,-51.6 85,-51.6 85,-62.5 87.5,-62.5 87.5,-68.7 90,-68.7 90,-61.8 92.5,-61.8 92.5,-60.7 95,-60.7 95,-65.8 97.5,-65.8 97.5,-68.4 100,-68.4 100,-61.5 102.5,-61.5 102.5,-80 105,-80 105,-84 107.5,-84 107.5,-78.9 110,-78.9 110,-79.6 112.5,-79.6 112.5,-84 115,-84 115,-88.7 117.5,-88.7 117.5,-84 120,-84 120,-100 122.5,-100 122.5,-83.6 125,-83.6 125,-84.7 127.5,-84.7 127.5,-88.7 130,-88.7 130,-85.1 132.5,-85.1 132.5,-84 135,-84 135,-84.7 137.5,-84.7 137.5,-81.1 140,-81.1 140,-82.5 142.5,-82.5 142.5,-81.1 145,-81.1 145,-73.8 147.5,-73.8 147.5,-69.8 150,-69.8 150,-74.5 152.5,-74.5 152.5,-64.7 155,-64.7 155,-61.5 157.5,-61.5 157.5,-59.6 160,-59.6 160,-64.4 162.5,-64.4 162.5,-57.8 165,-57.8 165,-54.9 167.5,-54.9 167.5,-51.6 170,-51.6 170,-48.7 172.5,-48.7 172.5,-50.2 175,-50.2 175,-35.6 177.5,-35.6 177.5,-34.9 180,-34.9 180,-35.3 182.5,-35.3 182.5,-30.5 185,-30.5 185,-26.5 187.5,-26.5 187.5,-25.1 190,-25.1 190,-24.7 192.5,-24.7 192.5,-16 195,-16 195,-20 197.5,-20 197.5,-16 200,-16 200,-19.6 202.5,-19.6 202.5,-16.4 205,-16.4 205,-10.2 207.5,-10.2 207.5,-15.3 210,-15.3 210,-9.09 212.5,-9.09 212.5,-8 215,-8 215,-8.36 217.5,-8.36 217.5,-9.09 220,-9.09 220,-5.82 222.5,-5.82 222.5,-6.18 225,-6.18 225,-3.64 227.5,-3.64 227.5,-2.55 230,-2.55 230,-2.18 232.5,-2.18 232.5,-3.27 235,-3.27 235,-3.64 237.5,-3.64 237.5,-2.91 240,-2.91 240,-1.82 242.5,-1.82 242.5,-1.45 245,-1.45 245,-2.55 247.5,-2.55 247.5,-2.18 250,-2.18 250,0\" style=\"fill:none; stroke:currentColor;\"/>\n",
"</svg>\n",
"</div>\n",
"<div style=\"flex=grow:1;\">\n",
"Regular(100, -3, 3, name='x', label='x-axis')<br/>\n",
"<hr style=\"margin-top:.2em; margin-bottom:.2em;\"/>\n",
"Double() Σ=9973.0 <em>(10000.0 with flow)</em>\n",
"\n",
"</div>\n",
"</div>\n",
"</html>"
],
"text/plain": [
"Hist(Regular(100, -3, 3, name='x', label='x-axis'), storage=Double()) # Sum: 9973.0 (10000.0 with flow)"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"# python fill\n",
"h.fill(array)\n",
Expand All @@ -96,7 +58,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -142,7 +104,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -221,34 +183,20 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"@nb.njit\n",
"def nb_fill_hist(h):\n",
" h.fill(np.random.randn(10))"
" h.fill(np.random.randn(1000))"
]
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"metadata": {},
"outputs": [
{
"ename": "TypingError",
"evalue": "Failed in nopython mode pipeline (step: nopython frontend)\nUnknown attribute 'fill' of type Hist\n\nFile \"<ipython-input-8-49c26ac8b7f7>\", line 3:\ndef nb_fill_hist(h):\n h.fill(np.random.randn(10))\n ^\n\nDuring: typing of get attribute at <ipython-input-8-49c26ac8b7f7> (3)\n\nFile \"<ipython-input-8-49c26ac8b7f7>\", line 3:\ndef nb_fill_hist(h):\n h.fill(np.random.randn(10))\n ^\n",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mTypingError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-9-85667a001596>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0mh1\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mHist\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mreg_ax\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0mnb_fill_hist\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mh1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m~/anaconda3/envs/hist/lib/python3.9/site-packages/numba/core/dispatcher.py\u001b[0m in \u001b[0;36m_compile_for_args\u001b[0;34m(self, *args, **kws)\u001b[0m\n\u001b[1;32m 418\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpatch_message\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmsg\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 419\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 420\u001b[0;31m \u001b[0merror_rewrite\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'typing'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 421\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0merrors\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mUnsupportedError\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 422\u001b[0m \u001b[0;31m# Something unsupported is present in the user code, add help info\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/anaconda3/envs/hist/lib/python3.9/site-packages/numba/core/dispatcher.py\u001b[0m in \u001b[0;36merror_rewrite\u001b[0;34m(e, issue_type)\u001b[0m\n\u001b[1;32m 359\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 360\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 361\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwith_traceback\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 362\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 363\u001b[0m \u001b[0margtypes\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mTypingError\u001b[0m: Failed in nopython mode pipeline (step: nopython frontend)\nUnknown attribute 'fill' of type Hist\n\nFile \"<ipython-input-8-49c26ac8b7f7>\", line 3:\ndef nb_fill_hist(h):\n h.fill(np.random.randn(10))\n ^\n\nDuring: typing of get attribute at <ipython-input-8-49c26ac8b7f7> (3)\n\nFile \"<ipython-input-8-49c26ac8b7f7>\", line 3:\ndef nb_fill_hist(h):\n h.fill(np.random.randn(10))\n ^\n"
]
}
],
"outputs": [],
"source": [
"reg_ax = axis.Regular(10, -3, 3)\n",
"h1 = Hist(reg_ax)\n",
Expand Down

0 comments on commit 1c251ad

Please sign in to comment.