Skip to content

Commit

Permalink
Round of ruff format with Ruff 0.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriPapadopoulos committed Aug 26, 2024
1 parent 8fa3183 commit 5937c8c
Showing 1 changed file with 26 additions and 14 deletions.
40 changes: 26 additions & 14 deletions doc/getting_started/tutorials/04.reductions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
" t = time() - t0\n",
" meas[codec][clevel][\"time\"][axis] = t\n",
" # If interested, you can uncomment the following line to check the results\n",
" #np.testing.assert_allclose(meas[codec][clevel][\"sum\"][axis],\n",
" # np.testing.assert_allclose(meas[codec][clevel][\"sum\"][axis],\n",
" # meas_np[\"sum\"][axis])\n",
" return meas"
]
Expand All @@ -189,33 +189,45 @@
"source": [
"def plot_meas(meas_np, meas, chunks):\n",
" fig, ax = plt.subplots()\n",
" \n",
"\n",
" # Define the groups and bar width\n",
" groups = meas_np[\"time\"].keys()\n",
" bar_width = 0.2\n",
" indices = np.arange(len(groups))\n",
" \n",
"\n",
" # Plot NumPy times\n",
" ax.bar(indices - 1.5 * bar_width, [meas_np[\"time\"][g] for g in groups], bar_width, label=\"NumPy\")\n",
" \n",
"\n",
" # Plot Blosc2 times\n",
" ax.bar(indices - 0.5 * bar_width, [meas[blosc2.Codec.LZ4][0][\"time\"][g] for g in groups],\n",
" bar_width, label=\"Blosc2, no compression\")\n",
" ax.bar(indices + 0.5 * bar_width, [meas[blosc2.Codec.LZ4][5][\"time\"][g] for g in groups],\n",
" bar_width, label=\"Blosc2, LZ4 + SHUFFLE\")\n",
" ax.bar(indices + 1.5 * bar_width, [meas[blosc2.Codec.ZSTD][5][\"time\"][g] for g in groups],\n",
" bar_width, label=\"Blosc2, ZSTD + SHUFFLE\")\n",
" \n",
" ax.bar(\n",
" indices - 0.5 * bar_width,\n",
" [meas[blosc2.Codec.LZ4][0][\"time\"][g] for g in groups],\n",
" bar_width,\n",
" label=\"Blosc2, no compression\",\n",
" )\n",
" ax.bar(\n",
" indices + 0.5 * bar_width,\n",
" [meas[blosc2.Codec.LZ4][5][\"time\"][g] for g in groups],\n",
" bar_width,\n",
" label=\"Blosc2, LZ4 + SHUFFLE\",\n",
" )\n",
" ax.bar(\n",
" indices + 1.5 * bar_width,\n",
" [meas[blosc2.Codec.ZSTD][5][\"time\"][g] for g in groups],\n",
" bar_width,\n",
" label=\"Blosc2, ZSTD + SHUFFLE\",\n",
" )\n",
"\n",
" # Set the labels and title\n",
" ax.set_xlabel(\"Axis\")\n",
" ax.set_ylabel(\"Time (s)\")\n",
" ax.set_title(\"Reduction Times\")\n",
" ax.set_xticks(indices)\n",
" ax.set_xticklabels(groups)\n",
" if 0 and chunks:\n",
" ax.set_ylim(0, .6)\n",
" ax.set_ylim(0, 0.6)\n",
" ax.legend()\n",
" \n",
"\n",
" plt.tight_layout()\n",
" plt.show()"
]
Expand Down Expand Up @@ -252,7 +264,7 @@
],
"source": [
"# Automatic chunking: (1, 1000, 1000) for Intel 13900K\n",
"chunks = None \n",
"chunks = None\n",
"meas = measure_blosc2(chunks)\n",
"plot_meas(meas_np, meas, chunks)"
]
Expand Down

0 comments on commit 5937c8c

Please sign in to comment.