diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index e16ba5e..75764ec 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -35,5 +35,5 @@ jobs: - name: Ensure notebooks complete without errors with pytest and nbmake run: | - pip install '.[tests]' + pip install '.[all]' pytest --nbmake examples/*ipynb diff --git a/examples/customized_meteor_diffmap.ipynb b/examples/customized_meteor_diffmap.ipynb index d4f326b..f131097 100644 --- a/examples/customized_meteor_diffmap.ipynb +++ b/examples/customized_meteor_diffmap.ipynb @@ -15,15 +15,16 @@ "metadata": {}, "outputs": [], "source": [ + "# ruff: noqa: T201\n", + "\n", "import numpy as np\n", "import reciprocalspaceship as rs\n", + "from matplotlib import pyplot as plt\n", "\n", + "from meteor.diffmaps import compute_difference_map, max_negentropy_kweighted_difference_map\n", "from meteor.rsmap import Map\n", - "from meteor.diffmaps import max_negentropy_kweighted_difference_map, compute_difference_map\n", "from meteor.tv import tv_denoise_difference_map\n", - "from meteor.validate import map_negentropy\n", - "\n", - "from matplotlib import pyplot as plt" + "from meteor.validate import map_negentropy" ] }, { @@ -132,7 +133,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "optimal k-parameter: 0.01 / negentropy: 0.00127\n" + "optimal k-parameter: 0.01, negentropy: 0.00127\n" ] } ], @@ -142,7 +143,7 @@ ")\n", "kewighted_negentropy = map_negentropy(k_weighted_diffmap)\n", "\n", - "print(f\"optimal k-parameter: {kweight_parameter} / negentropy: {kewighted_negentropy:.5f}\")" + "print(f\"optimal k-parameter: {kweight_parameter}, negentropy: {kewighted_negentropy:.5f}\")" ] }, { @@ -172,7 +173,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -187,7 +188,7 @@ } ], "source": [ - "plt.figure(figsize=(8,3))\n", + "plt.figure(figsize=(8, 3))\n", "\n", "plt.xlabel(\"TV weight\")\n", "plt.ylabel(\"map negentropy\")\n", @@ -196,8 +197,8 @@ "# points are not sampled in order of increasing TV weight, so we have to order them\n", "sort_order = np.argsort(metadata.tv_weights_scanned)\n", "plt.plot(\n", - " np.array(metadata.tv_weights_scanned)[sort_order], \n", - " np.array(metadata.negentropy_at_weights)[sort_order]\n", + " np.array(metadata.tv_weights_scanned)[sort_order],\n", + " np.array(metadata.negentropy_at_weights)[sort_order],\n", ")\n", "\n", "plt.scatter(\n", @@ -228,7 +229,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ diff --git a/pyproject.toml b/pyproject.toml index 5cb4761..6416e50 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,9 @@ tests = [ "pytest-xdist", "nbmake", ] +notebooks = [ + "matplotlib", +] [project.scripts] "meteor.diffmap" = "meteor.scripts.compute_difference_map:main"