diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml new file mode 100644 index 0000000..e16ba5e --- /dev/null +++ b/.github/workflows/examples.yml @@ -0,0 +1,39 @@ +name: run-examples + +on: + pull_request: + workflow_call: + inputs: + job: + required: true + type: string + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ${{ fromJSON(vars.PYTHON_VERSIONS) }} + + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + + - name: Ensure notebooks complete without errors with pytest and nbmake + run: | + pip install '.[tests]' + pytest --nbmake examples/*ipynb diff --git a/examples/customized_meteor_diffmap.ipynb b/examples/customized_meteor_diffmap.ipynb index 64ea732..d4f326b 100644 --- a/examples/customized_meteor_diffmap.ipynb +++ b/examples/customized_meteor_diffmap.ipynb @@ -149,7 +149,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# 3. TV denoise the map\n", + "### 3. TV denoise the map\n", "\n", "Finally, the main event, the entreƩ! Let's improve our _k_-weighted map by TV-denoising it." ] @@ -215,12 +215,25 @@ "plt.show()" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 4. Write out the results\n", + "\n", + "Awesome! Now we have a fancy new diffmap, which we probably want to save so we can do something with it. Like fire up Coot and check it out. If you are curious, the PDB ID corresponding to this dataset is `8a6g`, and you can find a copy of the structure as a PDB file in this repository:\n", + "\n", + "> `../test/data/8a6g.pdb`" + ] + }, { "cell_type": "code", - "execution_count": null, + "execution_count": 41, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "tv_denosied_map.write_mtz(\"my_denoised_diffmap.mtz\")" + ] } ], "metadata": { diff --git a/pyproject.toml b/pyproject.toml index bdd6fed..5cb4761 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,7 @@ tests = [ "pytest", "pytest-cov", "pytest-xdist", + "nbmake", ] [project.scripts]