From a3facdedce24962696ef3b3033b0313f14f841f8 Mon Sep 17 00:00:00 2001 From: Yuchen Ethan Xiao Date: Mon, 10 Feb 2025 19:23:36 -0500 Subject: [PATCH] fix: re-cookie with `scikit-package` v0.1.0 --- .codecov.yml | 8 +- .codespell/ignore_words.txt | 28 +- .flake8 | 2 + .github/ISSUE_TEMPLATE/release_checklist.md | 29 +- .../workflows/build-wheel-release-upload.yml | 4 +- .github/workflows/check-news-item.yml | 2 +- .github/workflows/publish-docs-on-release.yml | 12 + .gitignore | 7 - .isort.cfg | 1 + .pre-commit-config.yaml | 38 +- AUTHORS.rst | 2 +- CHANGELOG.rst | 140 ++-- LICENSE.rst | 2 +- README.rst | 396 ++++++------ doc/{manual => source}/Makefile | 0 .../acknowledgements.texinfo | 0 .../api/diffpy.pdfmorph.example_package.rst | 31 + doc/source/api/diffpy.pdfmorph.rst | 154 ++--- doc/source/conf.py | 610 +++++++++--------- doc/{manual => source}/disclaimer.texinfo | 0 .../images/aspirin_smear.png | Bin .../images/aspirin_stretch.png | Bin .../images/ex_tutorial_bar.png | Bin .../images/ex_tutorial_download.png | Bin .../images/ex_tutorial_params.png | Bin .../images/ex_tutorial_shape_download.png | Bin .../ex_tutorial_shape_sphere_zoomed.png | Bin .../images/ex_tutorial_stretch.png | Bin .../images/ex_tutorial_temp.png | Bin doc/{manual => source}/images/morph_ex1.png | Bin doc/{manual => source}/images/morph_ex2.png | Bin .../images/nacl_example.agr | 0 .../images/nacl_example.xcf | Bin .../images/pdfmorph_example.agr | 0 .../images/pdfmorph_example.png | Bin .../images/pdfmorph_example.xcf | Bin .../images/pdfmorph_smear.png | Bin .../images/pdfmorph_smear2.png | Bin .../images/pdfmorph_stretch.png | Bin .../images/qs_tutorial_download.png | Bin .../images/qs_tutorial_morphed.png | Bin .../images/qs_tutorial_scaled.png | Bin .../images/qs_tutorial_unmorphed.png | Bin doc/source/index.rst | 160 ++--- doc/source/license.rst | 2 +- doc/{manual => source}/make.bat | 0 doc/{manual => source}/pdfmorph.pdf | Bin doc/{manual => source}/pdfmorph.texinfo | 0 doc/{manual => source}/redistribution.texinfo | 0 news/re-cookiecut.rst | 23 + requirements/README.txt | 10 + requirements/test.txt | 12 +- src/diffpy/__init__.py | 3 +- src/diffpy/pdfmorph/__init__.py | 3 +- src/diffpy/pdfmorph/log.py | 1 - src/diffpy/pdfmorph/morph_helpers/__init__.py | 5 +- .../morph_helpers/transformpdftordf.py | 6 +- .../morph_helpers/transformrdftopdf.py | 6 +- src/diffpy/pdfmorph/morphs/__init__.py | 4 +- src/diffpy/pdfmorph/morphs/morph.py | 6 +- src/diffpy/pdfmorph/morphs/morphchain.py | 1 - src/diffpy/pdfmorph/morphs/morphishape.py | 11 +- src/diffpy/pdfmorph/morphs/morphresolution.py | 5 +- src/diffpy/pdfmorph/morphs/morphrgrid.py | 5 +- src/diffpy/pdfmorph/morphs/morphscale.py | 5 +- src/diffpy/pdfmorph/morphs/morphshape.py | 12 +- src/diffpy/pdfmorph/morphs/morphshift.py | 5 +- src/diffpy/pdfmorph/morphs/morphsmear.py | 5 +- src/diffpy/pdfmorph/morphs/morphstretch.py | 5 +- src/diffpy/pdfmorph/pdfmorph_api.py | 4 +- src/diffpy/pdfmorph/pdfmorph_io.py | 10 +- src/diffpy/pdfmorph/pdfmorphapp.py | 4 +- src/diffpy/pdfmorph/pdfplot.py | 3 +- src/diffpy/pdfmorph/refine.py | 7 +- src/diffpy/pdfmorph/tools.py | 15 +- src/diffpy/pdfmorph/version.py | 3 +- tests/debug.py | 4 +- tests/run.py | 5 +- tests/test_morphchain.py | 2 +- tests/test_morphpdftordf.py | 2 +- tests/test_morphrdftopdf.py | 2 +- tests/test_morphresolution.py | 2 +- tests/test_morphrgrid.py | 8 +- tests/test_morphscale.py | 2 +- tests/test_morphshape.py | 4 +- tests/test_morphshift.py | 2 +- tests/test_morphsmear.py | 2 +- tests/test_morphstretch.py | 2 +- tests/test_refine.py | 4 +- tests/test_tools.py | 7 +- tests/test_version.py | 3 +- 91 files changed, 952 insertions(+), 906 deletions(-) create mode 100644 .github/workflows/publish-docs-on-release.yml rename doc/{manual => source}/Makefile (100%) rename doc/{manual => source}/acknowledgements.texinfo (100%) create mode 100644 doc/source/api/diffpy.pdfmorph.example_package.rst rename doc/{manual => source}/disclaimer.texinfo (100%) rename doc/{manual => source}/images/aspirin_smear.png (100%) rename doc/{manual => source}/images/aspirin_stretch.png (100%) rename doc/{manual => source}/images/ex_tutorial_bar.png (100%) rename doc/{manual => source}/images/ex_tutorial_download.png (100%) rename doc/{manual => source}/images/ex_tutorial_params.png (100%) rename doc/{manual => source}/images/ex_tutorial_shape_download.png (100%) rename doc/{manual => source}/images/ex_tutorial_shape_sphere_zoomed.png (100%) rename doc/{manual => source}/images/ex_tutorial_stretch.png (100%) rename doc/{manual => source}/images/ex_tutorial_temp.png (100%) rename doc/{manual => source}/images/morph_ex1.png (100%) rename doc/{manual => source}/images/morph_ex2.png (100%) rename doc/{manual => source}/images/nacl_example.agr (100%) rename doc/{manual => source}/images/nacl_example.xcf (100%) rename doc/{manual => source}/images/pdfmorph_example.agr (100%) rename doc/{manual => source}/images/pdfmorph_example.png (100%) rename doc/{manual => source}/images/pdfmorph_example.xcf (100%) rename doc/{manual => source}/images/pdfmorph_smear.png (100%) rename doc/{manual => source}/images/pdfmorph_smear2.png (100%) rename doc/{manual => source}/images/pdfmorph_stretch.png (100%) rename doc/{manual => source}/images/qs_tutorial_download.png (100%) rename doc/{manual => source}/images/qs_tutorial_morphed.png (100%) rename doc/{manual => source}/images/qs_tutorial_scaled.png (100%) rename doc/{manual => source}/images/qs_tutorial_unmorphed.png (100%) rename doc/{manual => source}/make.bat (100%) rename doc/{manual => source}/pdfmorph.pdf (100%) rename doc/{manual => source}/pdfmorph.texinfo (100%) rename doc/{manual => source}/redistribution.texinfo (100%) create mode 100644 news/re-cookiecut.rst create mode 100644 requirements/README.txt diff --git a/.codecov.yml b/.codecov.yml index 5a94096e..4af5eb24 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,14 +1,14 @@ coverage: status: - project: # more options at https://docs.codecov.com/docs/commit-status + project: # more options at https://docs.codecov.com/docs/commit-status default: target: auto # use the coverage from the base commit, fail if coverage is lower - threshold: 0% # allow the coverage to drop by + threshold: 0% # allow the coverage to drop by comment: layout: " diff, flags, files" behavior: default require_changes: false - require_base: false # [true :: must have a base report to post] - require_head: false # [true :: must have a head report to post] + require_base: false # [true :: must have a base report to post] + require_head: false # [true :: must have a head report to post] hide_project_coverage: false # [true :: only show coverage on the git diff aka patch coverage] diff --git a/.codespell/ignore_words.txt b/.codespell/ignore_words.txt index 749b99e2..f695b03a 100644 --- a/.codespell/ignore_words.txt +++ b/.codespell/ignore_words.txt @@ -1,14 +1,14 @@ -;; Please include explanations for each ignored word (lowercase). -;; See https://docs.openverse.org/meta/codespell.html for docs. - -;; abbreviation for "materials" often used in a journal title -mater - -;; alternative use of socioeconomic -socio-economic - -;; Frobenius norm used in np.linalg.norm -fro - -;; library used for Python package release, no longer used -rever +;; Please include explanations for each ignored word (lowercase). +;; See https://docs.openverse.org/meta/codespell.html for docs. + +;; abbreviation for "materials" often used in a journal title +mater + +;; alternative use of socioeconomic +socio-economic + +;; Frobenius norm used in np.linalg.norm +fro + +;; library used for Python package release, no longer used +rever diff --git a/.flake8 b/.flake8 index 5a56eddd..7b2865c1 100644 --- a/.flake8 +++ b/.flake8 @@ -1,3 +1,5 @@ +# As of now, flake8 does not natively support configuration via pyproject.toml +# https://github.com/microsoft/vscode-flake8/issues/135 [flake8] exclude = .git, diff --git a/.github/ISSUE_TEMPLATE/release_checklist.md b/.github/ISSUE_TEMPLATE/release_checklist.md index 0f560278..fa94779e 100644 --- a/.github/ISSUE_TEMPLATE/release_checklist.md +++ b/.github/ISSUE_TEMPLATE/release_checklist.md @@ -6,30 +6,41 @@ labels: "release" assignees: "" --- -### PyPI/GitHub release checklist: +### PyPI/GitHub rc-release preparation checklist: - [ ] All PRs/issues attached to the release are merged. - [ ] All the badges on the README are passing. - [ ] License information is verified as correct. If you are unsure, please comment below. - [ ] Locally rendered documentation contains all appropriate pages, including API references (check no modules are - missing), tutorials, and other human written text is up-to-date with any changes in the code. -- [ ] Installation instructions in the README, documentation and on the website (e.g., diffpy.org) are updated. + missing), tutorials, and other human-written text is up-to-date with any changes in the code. +- [ ] Installation instructions in the README, documentation, and the website (e.g., diffpy.org) are updated. - [ ] Successfully run any tutorial examples or do functional testing with the latest Python version. - [ ] Grammar and writing quality are checked (no typos). +- [ ] Install `pip install build twine`, run `python -m build` and `twine check dist/*` to ensure that the package can be built and is correctly formatted for PyPI release. -Please mention @sbillinge here when you are ready for PyPI/GitHub release. Include any additional comments necessary, such as -version information and details about the pre-release here: +Please mention @sbillinge here when you are ready for PyPI/GitHub release. Include any additional comments necessary, such as version information and details about the pre-release here: -### conda-forge release checklist: +### PyPI/GitHub full-release preparation checklist: + +- [ ] Create a new conda environment and install the rc from PyPI (`pip install ==??`) +- [ ] License information on PyPI is correct. +- [ ] Docs are deployed successfully to `https://www.diffpy.org/`. +- [ ] Successfully run all tests, tutorial examples or do functional testing. + +Please let @sbillinge know that all checks are done and the package is ready for full release. + +### conda-forge release preparation checklist: +- [ ] Ensure that the full release has appeared on PyPI successfully. - [ ] New package dependencies listed in `conda.txt` and `test.txt` are added to `meta.yaml` in the feedstock. -- [ ] All relevant issues in the feedstock are addressed in the release PR. +- [ ] Close any open issues on the feedstock. Reach out to @bobleesj if you have questions. +- [ ] Tag @sbillinge and @bobleesj for conda-forge release. ### Post-release checklist -- [ ] Run tutorial examples and conduct functional testing using the installation guide in the README. Attach screenshots/results as comments. -- [ ] Documentation (README, tutorials, API references, and websites) is deployed without broken links or missing figures. +- [ ] Run tutorial examples and conduct functional testing using the installation guide in the README. Attach screenshots/results as comments. +- [ ] Documentation (README, tutorials, API references, and websites) is deployed without broken links or missing figures. diff --git a/.github/workflows/build-wheel-release-upload.yml b/.github/workflows/build-wheel-release-upload.yml index 8b2ffb5a..543f194f 100644 --- a/.github/workflows/build-wheel-release-upload.yml +++ b/.github/workflows/build-wheel-release-upload.yml @@ -4,13 +4,15 @@ on: workflow_dispatch: push: tags: - - '*' # Trigger on all tags initially, but tag and release privilege are verified in _build-wheel-release-upload.yml + - "*" # Trigger on all tags initially, but tag and release privilege are verified in _build-wheel-release-upload.yml jobs: release: uses: Billingegroup/release-scripts/.github/workflows/_build-wheel-release-upload.yml@v0 with: project: diffpy.pdfmorph + c_extension: false + github_admin_username: sbillinge secrets: PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} PAT_TOKEN: ${{ secrets.PAT_TOKEN }} diff --git a/.github/workflows/check-news-item.yml b/.github/workflows/check-news-item.yml index dafd7755..861fdd14 100644 --- a/.github/workflows/check-news-item.yml +++ b/.github/workflows/check-news-item.yml @@ -3,7 +3,7 @@ name: Check for News on: pull_request_target: branches: - - main + - main jobs: check-news-item: diff --git a/.github/workflows/publish-docs-on-release.yml b/.github/workflows/publish-docs-on-release.yml new file mode 100644 index 00000000..19d477a4 --- /dev/null +++ b/.github/workflows/publish-docs-on-release.yml @@ -0,0 +1,12 @@ +name: Deploy Documentation on Release + +on: + workflow_dispatch: + +jobs: + docs: + uses: Billingegroup/release-scripts/.github/workflows/_publish-docs-on-release.yml@v0 + with: + project: diffpy.pdfmorph + c_extension: false + headless: false diff --git a/.gitignore b/.gitignore index a25212ea..d418364a 100644 --- a/.gitignore +++ b/.gitignore @@ -90,10 +90,3 @@ target/ # Ipython Notebook .ipynb_checkpoints - -# version information -setup.cfg -/src/diffpy/*/version.cfg - -# Rever -rever/ diff --git a/.isort.cfg b/.isort.cfg index 6d831957..86f162b8 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -1,4 +1,5 @@ [settings] +# Keep import statement below line_length character limit line_length = 79 multi_line_output = 3 include_trailing_comma = True diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9cf0556f..0e4a84d1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,14 +1,14 @@ default_language_version: - python: python3 + python: python3 ci: - autofix_commit_msg: | - [pre-commit.ci] auto fixes from pre-commit hooks - autofix_prs: true - autoupdate_branch: 'pre-commit-autoupdate' - autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' - autoupdate_schedule: monthly - skip: [no-commit-to-branch] - submodules: false + autofix_commit_msg: | + [pre-commit.ci] auto fixes from pre-commit hooks + autofix_prs: true + autoupdate_branch: "pre-commit-autoupdate" + autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate" + autoupdate_schedule: monthly + skip: [no-commit-to-branch] + submodules: false repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.6.0 @@ -47,6 +47,20 @@ repos: - repo: https://github.com/codespell-project/codespell rev: v2.3.0 hooks: - - id: codespell - additional_dependencies: - - tomli + - id: codespell + additional_dependencies: + - tomli + # prettier - multi formatter for .json, .yml, and .md files + - repo: https://github.com/pre-commit/mirrors-prettier + rev: f12edd9c7be1c20cfa42420fd0e6df71e42b51ea # frozen: v4.0.0-alpha.8 + hooks: + - id: prettier + additional_dependencies: + - "prettier@^3.2.4" + # docformatter - PEP 257 compliant docstring formatter + - repo: https://github.com/s-weigand/docformatter + rev: 5757c5190d95e5449f102ace83df92e7d3b06c6c + hooks: + - id: docformatter + additional_dependencies: [tomli] + args: [--in-place, --config, ./pyproject.toml] diff --git a/AUTHORS.rst b/AUTHORS.rst index dfff1afe..7a00327b 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -1,7 +1,7 @@ Authors ======= -Billinge Group and community contributors. +Billinge Group members and community contributors Contributors ------------ diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ab9d9273..ef3dc712 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,70 +1,70 @@ -============= -Release Notes -============= - -.. current developments - -0.1.3 -===== - -**Added:** - -* Add GitHub action to build wheel, release, upload. -* Add issue and bug report templates. - -**Changed:** - -* README file installation instructions updated. - -**Fixed:** - -* Mathematical error in manual - - -0.1.2 -===== - -**Changed:** - -* downgraded matplotlib requirement to matplotlib-base -* updated imports of bg-mpl-stylesheets for latest release of that code - - - -0.1.1 -===== - - - -0.1.1 -===== - -**Fixed:** - -* README title so that it is valid syntax for uploading to PyPi - - - -0.1.0 -===== - -**Added:** - -* Add ability to perform multiple morphs in one call using --multiple. - * A FILE is morphed against every file in a given DIRECTORY. - * Can sort PDFs by some field parameter in the header using --sort-by. - * Can also find the field from some serialized metadata file using --serial-file. -* pdfmorph python function call, which reproduce the application - -**Changed:** - -* Can now use --verbose tag to limit amount of header information - - - -v0.0.1 -==================== - -**Changed:** - -* Fixed rever GH address +============= +Release Notes +============= + +.. current developments + +0.1.3 +===== + +**Added:** + +* Add GitHub action to build wheel, release, upload. +* Add issue and bug report templates. + +**Changed:** + +* README file installation instructions updated. + +**Fixed:** + +* Mathematical error in manual + + +0.1.2 +===== + +**Changed:** + +* downgraded matplotlib requirement to matplotlib-base +* updated imports of bg-mpl-stylesheets for latest release of that code + + + +0.1.1 +===== + + + +0.1.1 +===== + +**Fixed:** + +* README title so that it is valid syntax for uploading to PyPi + + + +0.1.0 +===== + +**Added:** + +* Add ability to perform multiple morphs in one call using --multiple. + * A FILE is morphed against every file in a given DIRECTORY. + * Can sort PDFs by some field parameter in the header using --sort-by. + * Can also find the field from some serialized metadata file using --serial-file. +* pdfmorph python function call, which reproduce the application + +**Changed:** + +* Can now use --verbose tag to limit amount of header information + + + +v0.0.1 +==================== + +**Changed:** + +* Fixed rever GH address diff --git a/LICENSE.rst b/LICENSE.rst index 95a04ac9..9a14f50d 100644 --- a/LICENSE.rst +++ b/LICENSE.rst @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2024, The Trustees of Columbia University +Copyright (c) 2025, The Trustees of Columbia University in the City of New York. All rights reserved. diff --git a/README.rst b/README.rst index 5f196b39..20d978fe 100644 --- a/README.rst +++ b/README.rst @@ -1,198 +1,198 @@ -|Icon| `diffpy.pdfmorph `_ -==================================================================== - -.. |Icon| image:: https://avatars.githubusercontent.com/diffpy - :target: https://diffpy.github.io/diffpy.pdfmorph - :height: 100px - -|PyPi| |Forge| |PythonVersion| |PR| - -|CI| |Codecov| |Black| |Tracking| - -.. |Black| image:: https://img.shields.io/badge/code_style-black-black - :target: https://github.com/psf/black - -.. |CI| image:: https://github.com/diffpy/diffpy.pdfmorph/actions/workflows/matrix-and-codecov-on-merge-to-main.yml/badge.svg - :target: https://github.com/diffpy/diffpy.pdfmorph/actions/workflows/matrix-and-codecov-on-merge-to-main.yml - -.. |Codecov| image:: https://codecov.io/gh/diffpy/diffpy.pdfmorph/branch/main/graph/badge.svg - :target: https://codecov.io/gh/diffpy/diffpy.pdfmorph - -.. |Forge| image:: https://img.shields.io/conda/vn/conda-forge/diffpy.pdfmorph - :target: https://anaconda.org/conda-forge/diffpy.pdfmorph - -.. |PR| image:: https://img.shields.io/badge/PR-Welcome-29ab47ff - -.. |PyPi| image:: https://img.shields.io/pypi/v/diffpy.pdfmorph - :target: https://pypi.org/project/diffpy.pdfmorph/ - -.. |PythonVersion| image:: https://img.shields.io/pypi/pyversions/diffpy.pdfmorph - :target: https://pypi.org/project/diffpy.pdfmorph/ - -.. |Tracking| image:: https://img.shields.io/badge/issue_tracking-github-blue - :target: https://github.com/diffpy/diffpy.pdfmorph/issues - -Tools for manipulating and comparing PDF profiles - -PDFmorph is a Python software package designed to increase the insight -researchers can obtain from measured atomic pair distribution functions -(PDFs) in a model-independent way. The program was designed to help a -researcher answer the question: "Has my material undergone a phase -transition between these two measurements?" - -One approach is to compare the two PDFs in a plot and view the difference -curve underneath. However, significant signal can be seen in the -difference curve from benign effects such as thermal expansion (peak -shifts) and increased thermal motion (peak broadening) or a change in -scale due to differences in incident flux, for example. PDFmorph will -do its best to correct for these benign effects before computing and -plotting the difference curve. One measured PDF (typically that collected -at higher temperature) is identified as the target PDF and the second -PDF is then morphed by "stretching" (changing the r-axis to simulate a -uniform lattice expansion), "smearing" (broadening peaks through a -uniform convolution to simulate increased thermal motion), and "scaling" -(self-explanatory). PDFmorph will vary the amplitude of the morphing -transformations to obtain the best fit between the morphed and the target -PDFs, then plot them on top of each other with the difference plotted -below. - -There are also a few other morphing transformations in the program. - -Finally, we note that PDFmorph should work on other spectra that are not -PDFs, though it has not been extensively tested beyond the PDF. - - -For more information about the diffpy.pdfmorph library, please consult our `online documentation `_. - -Citation --------- - -If you use diffpy.pdfmorph in a scientific publication, we would like you to cite this package as - - diffpy.pdfmorph Package, https://github.com/diffpy/diffpy.pdfmorph - -REQUIREMENTS ------------------------------------------------------------------------- - -PDFmorph is currently run from the command line, which requires opening -and typing into a terminal window or Windows command prompt. It is -recommended that you consult online resources and become somewhat -familiar before using PDFmorph. - -PDFmorph can be run with Python 3.10 or higher. It makes use of several third party -libraries that you'll need to run the app and its components. - -* `NumPy` - library for scientific computing with Python -* `matplotlib` - Python 2D plotting library -* `SciPy` - library for highly technical Python computing -* `diffpy.utils` - `shared helper utilities `_ for wx GUI - -These dependencies will be installed automatically if you use the conda -installation procedure described below. - -Installation ------------- - -The preferred method is to use `Miniconda Python -`_ -and install from the "conda-forge" channel of Conda packages. - -To add "conda-forge" to the conda channels, run the following in a terminal. :: - - conda config --add channels conda-forge - -We want to install our packages in a suitable conda environment. -The following creates and activates a new environment named ``diffpy.pdfmorph_env`` :: - - conda create -n diffpy.pdfmorph_env diffpy.pdfmorph - conda activate diffpy.pdfmorph_env - -To confirm that the installation was successful, type:: - - python -c "import diffpy.pdfmorph; print(diffpy.pdfmorph.__version__)" - - The output should print the latest version displayed on the badges above. - -If the above does not work, you can use ``pip`` to download and install the latest release from -`Python Package Index `_. -To install using ``pip`` into your ``diffpy.pdfmorph_env`` environment, we will also have to install dependencies :: - - pip install -r https://raw.githubusercontent.com/diffpy/diffpy.pdfmorph/main/requirements/pip.txt - -and then install the package :: - - pip install diffpy.pdfmorph - -If you prefer to install from sources, after installing the dependencies, obtain the source archive from -`GitHub `_. Once installed, ``cd`` into your ``diffpy.pdfmorph`` directory -and run the following :: - - pip install . - -Getting Started ---------------- - -You may consult our `online documentation `_ for tutorials and API references. - -USING PDFmorph ------------------------------------------------------------------------- - -For detailed instructions and full tutorial, consult the user manual -on our `website `. - -Once the required software, including PDFmorph is all installed, open -up a terminal and check installation has worked properly by running :: - - source activate pdfmorph_env #if the environment isn't already active - pdfmorph -h #get some helpful information - pdfmorph --version - -If installed correctly, this last command should return the version -of PDFmorph that you have installed on your system. To begin using -PDFmorph, run a command like :: - - pdfmorph - -where both PDFs file are text files which contain PDF data, such as ``.gr`` -or ``.cgr`` files that are produced by ``PDFgetX2``, ``PDFgetX3``, -or ``PDFgui``. Though some file extensions other than ``.gr`` or ``.cgr``, -but with the same content structure, have been shown to work with -PDFmorph, it is recommended to stick with ``.gr`` files. - -Enjoy! - - -Support and Contribute ----------------------- - -`Diffpy user group `_ is the discussion forum for general questions and discussions about the use of diffpy.pdfmorph. Please join the diffpy.pdfmorph users community by joining the Google group. The diffpy.pdfmorph project welcomes your expertise and enthusiasm! - -If you see a bug or want to request a feature, please `report it as an issue `_ and/or `submit a fix as a PR `_. You can also post it to the `Diffpy user group `_. - -Feel free to fork the project and contribute. To install diffpy.pdfmorph -in a development mode, with its sources being directly used by Python -rather than copied to a package directory, use the following in the root -directory :: - - pip install -e . - -To ensure code quality and to prevent accidental commits into the default branch, please set up the use of our pre-commit -hooks. - -1. Install pre-commit in your working environment by running ``conda install pre-commit``. - -2. Initialize pre-commit (one time only) ``pre-commit install``. - -Thereafter your code will be linted by black and isort and checked against flake8 before you can commit. -If it fails by black or isort, just rerun and it should pass (black and isort will modify the files so should -pass after they are modified). If the flake8 test fails please see the error messages and fix them manually before -trying to commit again. - -Improvements and fixes are always appreciated. - -Before contributing, please read our `Code of Conduct `_. - -Contact -------- - -For more information on diffpy.pdfmorph please visit the project `web-page `_ or email Prof. Simon Billinge at sb2896@columbia.edu. +|Icon| `diffpy.pdfmorph `_ +==================================================================== + +.. |Icon| image:: https://avatars.githubusercontent.com/diffpy + :target: https://diffpy.github.io/diffpy.pdfmorph + :height: 100px + +|PyPi| |Forge| |PythonVersion| |PR| + +|CI| |Codecov| |Black| |Tracking| + +.. |Black| image:: https://img.shields.io/badge/code_style-black-black + :target: https://github.com/psf/black + +.. |CI| image:: https://github.com/diffpy/diffpy.pdfmorph/actions/workflows/matrix-and-codecov-on-merge-to-main.yml/badge.svg + :target: https://github.com/diffpy/diffpy.pdfmorph/actions/workflows/matrix-and-codecov-on-merge-to-main.yml + +.. |Codecov| image:: https://codecov.io/gh/diffpy/diffpy.pdfmorph/branch/main/graph/badge.svg + :target: https://codecov.io/gh/diffpy/diffpy.pdfmorph + +.. |Forge| image:: https://img.shields.io/conda/vn/conda-forge/diffpy.pdfmorph + :target: https://anaconda.org/conda-forge/diffpy.pdfmorph + +.. |PR| image:: https://img.shields.io/badge/PR-Welcome-29ab47ff + +.. |PyPi| image:: https://img.shields.io/pypi/v/diffpy.pdfmorph + :target: https://pypi.org/project/diffpy.pdfmorph/ + +.. |PythonVersion| image:: https://img.shields.io/pypi/pyversions/diffpy.pdfmorph + :target: https://pypi.org/project/diffpy.pdfmorph/ + +.. |Tracking| image:: https://img.shields.io/badge/issue_tracking-github-blue + :target: https://github.com/diffpy/diffpy.pdfmorph/issues + +Tools for manipulating and comparing PDF profiles + +PDFmorph is a Python software package designed to increase the insight +researchers can obtain from measured atomic pair distribution functions +(PDFs) in a model-independent way. The program was designed to help a +researcher answer the question: "Has my material undergone a phase +transition between these two measurements?" + +One approach is to compare the two PDFs in a plot and view the difference +curve underneath. However, significant signal can be seen in the +difference curve from benign effects such as thermal expansion (peak +shifts) and increased thermal motion (peak broadening) or a change in +scale due to differences in incident flux, for example. PDFmorph will +do its best to correct for these benign effects before computing and +plotting the difference curve. One measured PDF (typically that collected +at higher temperature) is identified as the target PDF and the second +PDF is then morphed by "stretching" (changing the r-axis to simulate a +uniform lattice expansion), "smearing" (broadening peaks through a +uniform convolution to simulate increased thermal motion), and "scaling" +(self-explanatory). PDFmorph will vary the amplitude of the morphing +transformations to obtain the best fit between the morphed and the target +PDFs, then plot them on top of each other with the difference plotted +below. + +There are also a few other morphing transformations in the program. + +Finally, we note that PDFmorph should work on other spectra that are not +PDFs, though it has not been extensively tested beyond the PDF. + + +For more information about the diffpy.pdfmorph library, please consult our `online documentation `_. + +Citation +-------- + +If you use diffpy.pdfmorph in a scientific publication, we would like you to cite this package as + + diffpy.pdfmorph Package, https://github.com/diffpy/diffpy.pdfmorph + +REQUIREMENTS +------------------------------------------------------------------------ + +PDFmorph is currently run from the command line, which requires opening +and typing into a terminal window or Windows command prompt. It is +recommended that you consult online resources and become somewhat +familiar before using PDFmorph. + +PDFmorph can be run with Python 3.10 or higher. It makes use of several third party +libraries that you'll need to run the app and its components. + +* `NumPy` - library for scientific computing with Python +* `matplotlib` - Python 2D plotting library +* `SciPy` - library for highly technical Python computing +* `diffpy.utils` - `shared helper utilities `_ for wx GUI + +These dependencies will be installed automatically if you use the conda +installation procedure described below. + +Installation +------------ + +The preferred method is to use `Miniconda Python +`_ +and install from the "conda-forge" channel of Conda packages. + +To add "conda-forge" to the conda channels, run the following in a terminal. :: + + conda config --add channels conda-forge + +We want to install our packages in a suitable conda environment. +The following creates and activates a new environment named ``diffpy.pdfmorph_env`` :: + + conda create -n diffpy.pdfmorph_env diffpy.pdfmorph + conda activate diffpy.pdfmorph_env + +To confirm that the installation was successful, type:: + + python -c "import diffpy.pdfmorph; print(diffpy.pdfmorph.__version__)" + + The output should print the latest version displayed on the badges above. + +If the above does not work, you can use ``pip`` to download and install the latest release from +`Python Package Index `_. +To install using ``pip`` into your ``diffpy.pdfmorph_env`` environment, we will also have to install dependencies :: + + pip install -r https://raw.githubusercontent.com/diffpy/diffpy.pdfmorph/main/requirements/pip.txt + +and then install the package :: + + pip install diffpy.pdfmorph + +If you prefer to install from sources, after installing the dependencies, obtain the source archive from +`GitHub `_. Once installed, ``cd`` into your ``diffpy.pdfmorph`` directory +and run the following :: + + pip install . + +Getting Started +--------------- + +You may consult our `online documentation `_ for tutorials and API references. + +USING PDFmorph +------------------------------------------------------------------------ + +For detailed instructions and full tutorial, consult the user manual +on our `website `. + +Once the required software, including PDFmorph is all installed, open +up a terminal and check installation has worked properly by running :: + + source activate pdfmorph_env #if the environment isn't already active + pdfmorph -h #get some helpful information + pdfmorph --version + +If installed correctly, this last command should return the version +of PDFmorph that you have installed on your system. To begin using +PDFmorph, run a command like :: + + pdfmorph + +where both PDFs file are text files which contain PDF data, such as ``.gr`` +or ``.cgr`` files that are produced by ``PDFgetX2``, ``PDFgetX3``, +or ``PDFgui``. Though some file extensions other than ``.gr`` or ``.cgr``, +but with the same content structure, have been shown to work with +PDFmorph, it is recommended to stick with ``.gr`` files. + +Enjoy! + + +Support and Contribute +---------------------- + +`Diffpy user group `_ is the discussion forum for general questions and discussions about the use of diffpy.pdfmorph. Please join the diffpy.pdfmorph users community by joining the Google group. The diffpy.pdfmorph project welcomes your expertise and enthusiasm! + +If you see a bug or want to request a feature, please `report it as an issue `_ and/or `submit a fix as a PR `_. You can also post it to the `Diffpy user group `_. + +Feel free to fork the project and contribute. To install diffpy.pdfmorph +in a development mode, with its sources being directly used by Python +rather than copied to a package directory, use the following in the root +directory :: + + pip install -e . + +To ensure code quality and to prevent accidental commits into the default branch, please set up the use of our pre-commit +hooks. + +1. Install pre-commit in your working environment by running ``conda install pre-commit``. + +2. Initialize pre-commit (one time only) ``pre-commit install``. + +Thereafter your code will be linted by black and isort and checked against flake8 before you can commit. +If it fails by black or isort, just rerun and it should pass (black and isort will modify the files so should +pass after they are modified). If the flake8 test fails please see the error messages and fix them manually before +trying to commit again. + +Improvements and fixes are always appreciated. + +Before contributing, please read our `Code of Conduct `_. + +Contact +------- + +For more information on diffpy.pdfmorph please visit the project `web-page `_ or email Prof. Simon Billinge at sb2896@columbia.edu. diff --git a/doc/manual/Makefile b/doc/source/Makefile similarity index 100% rename from doc/manual/Makefile rename to doc/source/Makefile diff --git a/doc/manual/acknowledgements.texinfo b/doc/source/acknowledgements.texinfo similarity index 100% rename from doc/manual/acknowledgements.texinfo rename to doc/source/acknowledgements.texinfo diff --git a/doc/source/api/diffpy.pdfmorph.example_package.rst b/doc/source/api/diffpy.pdfmorph.example_package.rst new file mode 100644 index 00000000..932e7596 --- /dev/null +++ b/doc/source/api/diffpy.pdfmorph.example_package.rst @@ -0,0 +1,31 @@ +.. _example_package documentation: + +|title| +======= + +.. |title| replace:: diffpy.pdfmorph.example_package package + +.. automodule:: diffpy.pdfmorph.example_package + :members: + :undoc-members: + :show-inheritance: + +|foo| +----- + +.. |foo| replace:: diffpy.pdfmorph.example_package.foo module + +.. automodule:: diffpy.pdfmorph.example_package.foo + :members: + :undoc-members: + :show-inheritance: + +|bar| +----- + +.. |bar| replace:: diffpy.pdfmorph.example_package.bar module + +.. automodule:: diffpy.pdfmorph.example_package.foo + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/source/api/diffpy.pdfmorph.rst b/doc/source/api/diffpy.pdfmorph.rst index 57178852..c44edc33 100644 --- a/doc/source/api/diffpy.pdfmorph.rst +++ b/doc/source/api/diffpy.pdfmorph.rst @@ -1,77 +1,77 @@ -:tocdepth: -1 - -diffpy.pdfmorph package -======================= - -.. automodule:: diffpy.pdfmorph - :members: - :undoc-members: - :show-inheritance: - -Subpackages ------------ - -.. toctree:: - :titlesonly: - - diffpy.pdfmorph.morphs - diffpy.pdfmorph.morph_helpers - -Submodules ----------- - -diffpy.pdfmorph.pdfplot module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.pdfmorph.pdfplot - :members: - :undoc-members: - :show-inheritance: - -diffpy.pdfmorph.pdfmorph_api module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.pdfmorph.pdfmorph_api - :members: - :undoc-members: - :show-inheritance: - -diffpy.pdfmorph.refine module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.pdfmorph.refine - :members: - :undoc-members: - :show-inheritance: - -diffpy.pdfmorph.tools module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.pdfmorph.tools - :members: - :undoc-members: - :show-inheritance: - -diffpy.pdfmorph.pdfmorph_io module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.pdfmorph.pdfmorph_io - :members: - :undoc-members: - :show-inheritance: - -diffpy.pdfmorph.log module -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.pdfmorph.log - :members: - :undoc-members: - :show-inheritance: - -diffpy.pdfmorph.pdfmorphapp module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.pdfmorph.pdfmorphapp - :members: - :undoc-members: - :show-inheritance: +:tocdepth: -1 + +diffpy.pdfmorph package +======================= + +.. automodule:: diffpy.pdfmorph + :members: + :undoc-members: + :show-inheritance: + +Subpackages +----------- + +.. toctree:: + :titlesonly: + + diffpy.pdfmorph.morphs + diffpy.pdfmorph.morph_helpers + +Submodules +---------- + +diffpy.pdfmorph.pdfplot module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfmorph.pdfplot + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfmorph.pdfmorph_api module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfmorph.pdfmorph_api + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfmorph.refine module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfmorph.refine + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfmorph.tools module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfmorph.tools + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfmorph.pdfmorph_io module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfmorph.pdfmorph_io + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfmorph.log module +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfmorph.log + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfmorph.pdfmorphapp module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfmorph.pdfmorphapp + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/source/conf.py b/doc/source/conf.py index 8a8fbee4..d190bf36 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,305 +1,305 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# diffpy.pdfmorph documentation build configuration file, created by -# sphinx-quickstart on Thu Jan 30 15:49:41 2014. -# -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -import sys -import time -from importlib.metadata import version -from pathlib import Path - -autodoc_mock_imports = [ - "diffpy.utils", -] - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use Path().resolve() to make it absolute, like shown here. -# sys.path.insert(0, str(Path(".").resolve())) -sys.path.insert(0, str(Path("../..").resolve())) -sys.path.insert(0, str(Path("../../src").resolve())) # abbreviations -ab_authors = "Billinge Group members and community contributors" - -# -- General configuration ------------------------------------------------ - -# If your documentation needs a minimal Sphinx version, state it here. -# needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - "sphinx.ext.autodoc", - "sphinx.ext.napoleon", - "sphinx.ext.todo", - "sphinx.ext.viewcode", - "sphinx.ext.intersphinx", - "sphinx_rtd_theme", - "m2r", -] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ["_templates"] - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -# -source_suffix = [".rst", ".md"] - -# The encoding of source files. -# source_encoding = 'utf-8-sig' - -# The master toctree document. -master_doc = "index" - -# General information about the project. -project = "diffpy.pdfmorph" -copyright = "%Y, The Trustees of Columbia University in the City of New York" - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. - -fullversion = version(project) -# The short X.Y version. -version = "".join(fullversion.split(".post")[:1]) -# The full version, including alpha/beta/rc tags. -release = fullversion - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# language = None - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -# today = '' -today = time.strftime("%B %d, %Y", time.localtime()) -year = today.split()[-1] -# Else, today_fmt is used as the format for a strftime call. -# today_fmt = '%B %d, %Y' -# substitute YEAR in the copyright string -copyright = copyright.replace("%Y", year) - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -exclude_patterns = ["build"] - -# The reST default role (used for this markup: `text`) to use for all -# documents. -# default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -# add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -# add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -# show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = "sphinx" - -# A list of ignored prefixes for module index sorting. -modindex_common_prefix = ["diffpy.pdfmorph"] - -# Display all warnings for missing links. -nitpicky = True - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = "sphinx_rtd_theme" - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -# -html_theme_options = { - "navigation_with_keys": "true", -} - -# Add any paths that contain custom themes here, relative to this directory. -# html_theme_path = [] - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -# html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -# html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -# html_logo = None - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -# html_favicon = None - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -# html_static_path = ['_static'] - -# Add any extra paths that contain custom files (such as robots.txt or -# .htaccess) here, relative to this directory. These files are copied -# directly to the root of the documentation. -# html_extra_path = [] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -# html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -# html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -# html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -# html_additional_pages = {} - -# If false, no module index is generated. -# html_domain_indices = True - -# If false, no index is generated. -# html_use_index = True - -# If true, the index is split into individual pages for each letter. -# html_split_index = False - -# If true, links to the reST sources are added to the pages. -# html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -# html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -# html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -# html_use_opensearch = '' - -# This is the file name suffix for HTML files (e.g. ".xhtml"). -# html_file_suffix = None - -# Output file base name for HTML help builder. -basename = "diffpy.pdfmorph".replace(" ", "").replace(".", "") -htmlhelp_basename = basename + "doc" - - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). - # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. - # 'preamble': '', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - ( - "index", - "diffpy.pdfmorph.tex", - "diffpy.pdfmorph Documentation", - ab_authors, - "manual", - ), -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -# latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -# latex_use_parts = False - -# If true, show page references after internal links. -# latex_show_pagerefs = False - -# If true, show URL addresses after external links. -# latex_show_urls = False - -# Documents to append as an appendix to all manuals. -# latex_appendices = [] - -# If false, no module index is generated. -# latex_domain_indices = True - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ( - "index", - "diffpy.pdfmorph", - "diffpy.pdfmorph Documentation", - ab_authors, - 1, - ) -] - -# If true, show URL addresses after external links. -# man_show_urls = False - - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - ( - "index", - "diffpy.pdfmorph", - "diffpy.pdfmorph Documentation", - ab_authors, - "diffpy.pdfmorph", - "One line description of project.", - "Miscellaneous", - ), -] - -# Documents to append as an appendix to all manuals. -# texinfo_appendices = [] - -# If false, no module index is generated. -# texinfo_domain_indices = True - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -# texinfo_show_urls = 'footnote' - -# If true, do not generate a @detailmenu in the "Top" node's menu. -# texinfo_no_detailmenu = False - - -# Example configuration for intersphinx: refer to the Python standard library. -# intersphinx_mapping = {'http://docs.python.org/': None} +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# diffpy.pdfmorph documentation build configuration file, created by +# sphinx-quickstart on Thu Jan 30 15:49:41 2014. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys +import time +from importlib.metadata import version +from pathlib import Path + +autodoc_mock_imports = [ + "diffpy.utils", +] + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use Path().resolve() to make it absolute, like shown here. +# sys.path.insert(0, str(Path(".").resolve())) +sys.path.insert(0, str(Path("../..").resolve())) +sys.path.insert(0, str(Path("../../src").resolve())) # abbreviations +ab_authors = "Billinge Group members and community contributors" + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.napoleon", + "sphinx.ext.todo", + "sphinx.ext.viewcode", + "sphinx.ext.intersphinx", + "sphinx_rtd_theme", + "m2r", +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +source_suffix = [".rst", ".md"] + +# The encoding of source files. +# source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = "index" + +# General information about the project. +project = "diffpy.pdfmorph" +copyright = "%Y, The Trustees of Columbia University in the City of New York" + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. + +fullversion = version(project) +# The short X.Y version. +version = "".join(fullversion.split(".post")[:1]) +# The full version, including alpha/beta/rc tags. +release = fullversion + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +# today = '' +today = time.strftime("%B %d, %Y", time.localtime()) +year = today.split()[-1] +# Else, today_fmt is used as the format for a strftime call. +# today_fmt = '%B %d, %Y' +# substitute YEAR in the copyright string +copyright = copyright.replace("%Y", year) + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ["build"] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +# default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +# add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +# add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +# show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = "sphinx" + +# A list of ignored prefixes for module index sorting. +modindex_common_prefix = ["diffpy.pdfmorph"] + +# Display all warnings for missing links. +nitpicky = True + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = "sphinx_rtd_theme" + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +html_theme_options = { + "navigation_with_keys": "true", +} + +# Add any paths that contain custom themes here, relative to this directory. +# html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +# html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +# html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +# html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +# html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +# html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +# html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +# html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +# html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +# html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +# html_additional_pages = {} + +# If false, no module index is generated. +# html_domain_indices = True + +# If false, no index is generated. +# html_use_index = True + +# If true, the index is split into individual pages for each letter. +# html_split_index = False + +# If true, links to the reST sources are added to the pages. +# html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +# html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +# html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +# html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +# html_file_suffix = None + +# Output file base name for HTML help builder. +basename = "diffpy.pdfmorph".replace(" ", "").replace(".", "") +htmlhelp_basename = basename + "doc" + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # 'papersize': 'letterpaper', + # The font size ('10pt', '11pt' or '12pt'). + # 'pointsize': '10pt', + # Additional stuff for the LaTeX preamble. + # 'preamble': '', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + ( + "index", + "diffpy.pdfmorph.tex", + "diffpy.pdfmorph Documentation", + ab_authors, + "manual", + ), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +# latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +# latex_use_parts = False + +# If true, show page references after internal links. +# latex_show_pagerefs = False + +# If true, show URL addresses after external links. +# latex_show_urls = False + +# Documents to append as an appendix to all manuals. +# latex_appendices = [] + +# If false, no module index is generated. +# latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ( + "index", + "diffpy.pdfmorph", + "diffpy.pdfmorph Documentation", + ab_authors, + 1, + ) +] + +# If true, show URL addresses after external links. +# man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ( + "index", + "diffpy.pdfmorph", + "diffpy.pdfmorph Documentation", + ab_authors, + "diffpy.pdfmorph", + "One line description of project.", + "Miscellaneous", + ), +] + +# Documents to append as an appendix to all manuals. +# texinfo_appendices = [] + +# If false, no module index is generated. +# texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +# texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +# texinfo_no_detailmenu = False + + +# Example configuration for intersphinx: refer to the Python standard library. +# intersphinx_mapping = {'http://docs.python.org/': None} diff --git a/doc/manual/disclaimer.texinfo b/doc/source/disclaimer.texinfo similarity index 100% rename from doc/manual/disclaimer.texinfo rename to doc/source/disclaimer.texinfo diff --git a/doc/manual/images/aspirin_smear.png b/doc/source/images/aspirin_smear.png similarity index 100% rename from doc/manual/images/aspirin_smear.png rename to doc/source/images/aspirin_smear.png diff --git a/doc/manual/images/aspirin_stretch.png b/doc/source/images/aspirin_stretch.png similarity index 100% rename from doc/manual/images/aspirin_stretch.png rename to doc/source/images/aspirin_stretch.png diff --git a/doc/manual/images/ex_tutorial_bar.png b/doc/source/images/ex_tutorial_bar.png similarity index 100% rename from doc/manual/images/ex_tutorial_bar.png rename to doc/source/images/ex_tutorial_bar.png diff --git a/doc/manual/images/ex_tutorial_download.png b/doc/source/images/ex_tutorial_download.png similarity index 100% rename from doc/manual/images/ex_tutorial_download.png rename to doc/source/images/ex_tutorial_download.png diff --git a/doc/manual/images/ex_tutorial_params.png b/doc/source/images/ex_tutorial_params.png similarity index 100% rename from doc/manual/images/ex_tutorial_params.png rename to doc/source/images/ex_tutorial_params.png diff --git a/doc/manual/images/ex_tutorial_shape_download.png b/doc/source/images/ex_tutorial_shape_download.png similarity index 100% rename from doc/manual/images/ex_tutorial_shape_download.png rename to doc/source/images/ex_tutorial_shape_download.png diff --git a/doc/manual/images/ex_tutorial_shape_sphere_zoomed.png b/doc/source/images/ex_tutorial_shape_sphere_zoomed.png similarity index 100% rename from doc/manual/images/ex_tutorial_shape_sphere_zoomed.png rename to doc/source/images/ex_tutorial_shape_sphere_zoomed.png diff --git a/doc/manual/images/ex_tutorial_stretch.png b/doc/source/images/ex_tutorial_stretch.png similarity index 100% rename from doc/manual/images/ex_tutorial_stretch.png rename to doc/source/images/ex_tutorial_stretch.png diff --git a/doc/manual/images/ex_tutorial_temp.png b/doc/source/images/ex_tutorial_temp.png similarity index 100% rename from doc/manual/images/ex_tutorial_temp.png rename to doc/source/images/ex_tutorial_temp.png diff --git a/doc/manual/images/morph_ex1.png b/doc/source/images/morph_ex1.png similarity index 100% rename from doc/manual/images/morph_ex1.png rename to doc/source/images/morph_ex1.png diff --git a/doc/manual/images/morph_ex2.png b/doc/source/images/morph_ex2.png similarity index 100% rename from doc/manual/images/morph_ex2.png rename to doc/source/images/morph_ex2.png diff --git a/doc/manual/images/nacl_example.agr b/doc/source/images/nacl_example.agr similarity index 100% rename from doc/manual/images/nacl_example.agr rename to doc/source/images/nacl_example.agr diff --git a/doc/manual/images/nacl_example.xcf b/doc/source/images/nacl_example.xcf similarity index 100% rename from doc/manual/images/nacl_example.xcf rename to doc/source/images/nacl_example.xcf diff --git a/doc/manual/images/pdfmorph_example.agr b/doc/source/images/pdfmorph_example.agr similarity index 100% rename from doc/manual/images/pdfmorph_example.agr rename to doc/source/images/pdfmorph_example.agr diff --git a/doc/manual/images/pdfmorph_example.png b/doc/source/images/pdfmorph_example.png similarity index 100% rename from doc/manual/images/pdfmorph_example.png rename to doc/source/images/pdfmorph_example.png diff --git a/doc/manual/images/pdfmorph_example.xcf b/doc/source/images/pdfmorph_example.xcf similarity index 100% rename from doc/manual/images/pdfmorph_example.xcf rename to doc/source/images/pdfmorph_example.xcf diff --git a/doc/manual/images/pdfmorph_smear.png b/doc/source/images/pdfmorph_smear.png similarity index 100% rename from doc/manual/images/pdfmorph_smear.png rename to doc/source/images/pdfmorph_smear.png diff --git a/doc/manual/images/pdfmorph_smear2.png b/doc/source/images/pdfmorph_smear2.png similarity index 100% rename from doc/manual/images/pdfmorph_smear2.png rename to doc/source/images/pdfmorph_smear2.png diff --git a/doc/manual/images/pdfmorph_stretch.png b/doc/source/images/pdfmorph_stretch.png similarity index 100% rename from doc/manual/images/pdfmorph_stretch.png rename to doc/source/images/pdfmorph_stretch.png diff --git a/doc/manual/images/qs_tutorial_download.png b/doc/source/images/qs_tutorial_download.png similarity index 100% rename from doc/manual/images/qs_tutorial_download.png rename to doc/source/images/qs_tutorial_download.png diff --git a/doc/manual/images/qs_tutorial_morphed.png b/doc/source/images/qs_tutorial_morphed.png similarity index 100% rename from doc/manual/images/qs_tutorial_morphed.png rename to doc/source/images/qs_tutorial_morphed.png diff --git a/doc/manual/images/qs_tutorial_scaled.png b/doc/source/images/qs_tutorial_scaled.png similarity index 100% rename from doc/manual/images/qs_tutorial_scaled.png rename to doc/source/images/qs_tutorial_scaled.png diff --git a/doc/manual/images/qs_tutorial_unmorphed.png b/doc/source/images/qs_tutorial_unmorphed.png similarity index 100% rename from doc/manual/images/qs_tutorial_unmorphed.png rename to doc/source/images/qs_tutorial_unmorphed.png diff --git a/doc/source/index.rst b/doc/source/index.rst index eebd5462..078e9b61 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -1,80 +1,80 @@ -############################################# -diffpy.pdfmorph documentation -############################################# - -diffpy.pdfmorph - Tools for manipulating and comparing PDF profiles. - -| Software version |release|. -| Last updated |today|. - -Introduction -++++++++++++ - -``PDFmorph`` is a Python package that increases the insight -researchers can obtain from measured atomic pair distribution functions -(PDFs) in a model-independent way. It was designed to help a -researcher answer the question: "Has my material undergone a phase -transition between these two measurements?" - -One approach is to compare the two PDFs in a plot and view the -difference curve underneath. However, significant signal can be seen in -the difference curve from benign effects such as thermal expansion (peak -shifts) and increased thermal motion (peak broadening) or a change in -scale due to differences in incident flux, for example. ``PDFmorph`` will -do its best to correct for these benign effects before computing and -plotting the difference curve. One measured PDF (typically that -collected under higher temperature) is identified as the target PDF and -the second PDF is then morphed by "stretching" (changing the r-axis to -simulate a uniform lattice expansion), "smearing" (broadening peaks -through a uniform convolution to simulate increased thermal motion), and -"scaling" (self-explanatory). PDFmorph will vary the amplitude of the -morphing transformations to obtain the best fit between the morphed and -the target PDFs, then plot them on top of each other with the difference -plotted below. - -There are also a few other morphing transformations in the program. -If no morphing transformation is specified, ``PDFmorph`` will return just -the plotted PDFs. - -Finally, we note that though ``PDFmorph`` should work on other spectra -that are not PDFs, it has not been extensively tested beyond the PDF. - -To get started, please download our :download:`user manual <../manual/pdfmorph.pdf>` -or visit the :ref:`quick_start`. - -======= -Authors -======= - -``PDFmorph`` is developed by members of the Billinge Group at -Columbia University and Brookhaven National Laboratory including -Christopher L. Farrow, Christopher J. Wright, Pavol Juhás, Chia-Hao -(Timothy) Liu, Andrew Yang, and Simon J. L. Billinge. - -For a detailed list of contributors see -https://github.com/diffpy/diffpy.pdfmorph/graphs/contributors. - -============ -Installation -============ - -See the `README `_ -file included with the distribution. - -================= -Table of contents -================= -.. toctree:: - :titlesonly: - - quickstart - license - release - Package API - -======= -Indices -======= - -* :ref:`genindex` -* :ref:`search` +############################################# +diffpy.pdfmorph documentation +############################################# + +diffpy.pdfmorph - Tools for manipulating and comparing PDF profiles. + +| Software version |release|. +| Last updated |today|. + +Introduction +++++++++++++ + +``PDFmorph`` is a Python package that increases the insight +researchers can obtain from measured atomic pair distribution functions +(PDFs) in a model-independent way. It was designed to help a +researcher answer the question: "Has my material undergone a phase +transition between these two measurements?" + +One approach is to compare the two PDFs in a plot and view the +difference curve underneath. However, significant signal can be seen in +the difference curve from benign effects such as thermal expansion (peak +shifts) and increased thermal motion (peak broadening) or a change in +scale due to differences in incident flux, for example. ``PDFmorph`` will +do its best to correct for these benign effects before computing and +plotting the difference curve. One measured PDF (typically that +collected under higher temperature) is identified as the target PDF and +the second PDF is then morphed by "stretching" (changing the r-axis to +simulate a uniform lattice expansion), "smearing" (broadening peaks +through a uniform convolution to simulate increased thermal motion), and +"scaling" (self-explanatory). PDFmorph will vary the amplitude of the +morphing transformations to obtain the best fit between the morphed and +the target PDFs, then plot them on top of each other with the difference +plotted below. + +There are also a few other morphing transformations in the program. +If no morphing transformation is specified, ``PDFmorph`` will return just +the plotted PDFs. + +Finally, we note that though ``PDFmorph`` should work on other spectra +that are not PDFs, it has not been extensively tested beyond the PDF. + +To get started, please download our :download:`user manual <../manual/pdfmorph.pdf>` +or visit the :ref:`quick_start`. + +======= +Authors +======= + +``PDFmorph`` is developed by members of the Billinge Group at +Columbia University and Brookhaven National Laboratory including +Christopher L. Farrow, Christopher J. Wright, Pavol Juhás, Chia-Hao +(Timothy) Liu, Andrew Yang, and Simon J. L. Billinge. + +For a detailed list of contributors see +https://github.com/diffpy/diffpy.pdfmorph/graphs/contributors. + +============ +Installation +============ + +See the `README `_ +file included with the distribution. + +================= +Table of contents +================= +.. toctree:: + :titlesonly: + + quickstart + license + release + Package API + +======= +Indices +======= + +* :ref:`genindex` +* :ref:`search` diff --git a/doc/source/license.rst b/doc/source/license.rst index 9ae52a98..ab6cc457 100644 --- a/doc/source/license.rst +++ b/doc/source/license.rst @@ -9,7 +9,7 @@ OPEN SOURCE LICENSE AGREEMENT ============================= BSD 3-Clause License -Copyright (c) 2024, The Trustees of Columbia University in +Copyright (c) 2025, The Trustees of Columbia University in the City of New York. All Rights Reserved. diff --git a/doc/manual/make.bat b/doc/source/make.bat similarity index 100% rename from doc/manual/make.bat rename to doc/source/make.bat diff --git a/doc/manual/pdfmorph.pdf b/doc/source/pdfmorph.pdf similarity index 100% rename from doc/manual/pdfmorph.pdf rename to doc/source/pdfmorph.pdf diff --git a/doc/manual/pdfmorph.texinfo b/doc/source/pdfmorph.texinfo similarity index 100% rename from doc/manual/pdfmorph.texinfo rename to doc/source/pdfmorph.texinfo diff --git a/doc/manual/redistribution.texinfo b/doc/source/redistribution.texinfo similarity index 100% rename from doc/manual/redistribution.texinfo rename to doc/source/redistribution.texinfo diff --git a/news/re-cookiecut.rst b/news/re-cookiecut.rst new file mode 100644 index 00000000..62d56586 --- /dev/null +++ b/news/re-cookiecut.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* re-cookiecut with `scikit-package` v0.1.0 + +**Security:** + +* diff --git a/requirements/README.txt b/requirements/README.txt new file mode 100644 index 00000000..3740a138 --- /dev/null +++ b/requirements/README.txt @@ -0,0 +1,10 @@ +# YOU MAY DELETE THIS FILE AFTER SETTING UP DEPENDENCIES! +# +# This directory is where you should place your project dependencies. +# build.txt should list all Conda packages required for building the package in GitHub CI, including those specified in the build section of meta.yaml (conda-recipe). +# conda.txt should list all Conda packages required (including optional) for running the package in GitHub CI, as well as those specified in the run section of meta.yaml (conda-recipe). +# pip.txt should list all PyPI packages (including optional) required to install the package via `pip install `. +# test.txt should list all Conda/PyPI packages required for the testing suite to ensure all tests pass. +# docs.txt should list all Conda/PyPI packages required for building the package documentation page. +# +# YOU MAY DELETE THIS FILE AFTER SETTING UP DEPENDENCIES! diff --git a/requirements/test.txt b/requirements/test.txt index f33bd0e3..f44480b4 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,6 +1,6 @@ -flake8 -pytest -codecov -coverage -pytest-env -pytest-cov +flake8 +pytest +codecov +coverage +pytest-env +pytest-cov diff --git a/src/diffpy/__init__.py b/src/diffpy/__init__.py index 5a43b52f..18aca598 100644 --- a/src/diffpy/__init__.py +++ b/src/diffpy/__init__.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# (c) 2024 The Trustees of Columbia University in the City of New York. +# (c) 2025 The Trustees of Columbia University in the City of New York. # All rights reserved. # # File coded by: Billinge Group members and community contributors. @@ -12,7 +12,6 @@ # See LICENSE.rst for license information. # ############################################################################## - """pdfmorph - tools for manipulating and comparing PDF data. """ diff --git a/src/diffpy/pdfmorph/__init__.py b/src/diffpy/pdfmorph/__init__.py index db1b45ee..2881ebb4 100644 --- a/src/diffpy/pdfmorph/__init__.py +++ b/src/diffpy/pdfmorph/__init__.py @@ -12,8 +12,7 @@ # See LICENSE.rst for license information. # ############################################################################## - -"""Tools for manipulating and comparing PDF profiles""" +"""Tools for manipulating and comparing PDF profiles.""" # key used when saving multiple morphs __save_morph_as__ = "save_morph_as" diff --git a/src/diffpy/pdfmorph/log.py b/src/diffpy/pdfmorph/log.py index 945f1a73..7e0e98f9 100644 --- a/src/diffpy/pdfmorph/log.py +++ b/src/diffpy/pdfmorph/log.py @@ -12,7 +12,6 @@ # See LICENSE.txt for license information. # ############################################################################## - """Configuration of loggers used in this package. Logger instances: diff --git a/src/diffpy/pdfmorph/morph_helpers/__init__.py b/src/diffpy/pdfmorph/morph_helpers/__init__.py index 271ba4f9..806cdde9 100644 --- a/src/diffpy/pdfmorph/morph_helpers/__init__.py +++ b/src/diffpy/pdfmorph/morph_helpers/__init__.py @@ -10,9 +10,8 @@ # See LICENSE.txt for license information. # ############################################################################## - -"""List of helpers for certain morphing operations -(currently only used for smear).""" +"""List of helpers for certain morphing operations (currently only used for +smear).""" from diffpy.pdfmorph.morph_helpers.transformpdftordf import ( TransformXtalPDFtoRDF, diff --git a/src/diffpy/pdfmorph/morph_helpers/transformpdftordf.py b/src/diffpy/pdfmorph/morph_helpers/transformpdftordf.py index 91acf26a..83e60785 100644 --- a/src/diffpy/pdfmorph/morph_helpers/transformpdftordf.py +++ b/src/diffpy/pdfmorph/morph_helpers/transformpdftordf.py @@ -12,10 +12,7 @@ # See LICENSE.txt for license information. # ############################################################################## - - -"""class TransformXtalPDFtoRDF -- Transform crystal PDFs to RDFs. -""" +"""Class TransformXtalPDFtoRDF -- Transform crystal PDFs to RDFs.""" from diffpy.pdfmorph.morphs.morph import LABEL_GR, LABEL_RA, LABEL_RR, Morph @@ -34,7 +31,6 @@ class TransformXtalPDFtoRDF(Morph): With s = baselineslope, R(r) = r * (G(r) - r * s) - """ # Define input output types diff --git a/src/diffpy/pdfmorph/morph_helpers/transformrdftopdf.py b/src/diffpy/pdfmorph/morph_helpers/transformrdftopdf.py index 58bf958f..af754e31 100644 --- a/src/diffpy/pdfmorph/morph_helpers/transformrdftopdf.py +++ b/src/diffpy/pdfmorph/morph_helpers/transformrdftopdf.py @@ -12,10 +12,7 @@ # See LICENSE.txt for license information. # ############################################################################## - - -"""class TransformXtalRDFtoPDF -- Transform crystal RDFs to PDFs. -""" +"""Class TransformXtalRDFtoPDF -- Transform crystal RDFs to PDFs.""" import numpy @@ -36,7 +33,6 @@ class TransformXtalRDFtoPDF(Morph): With s = baselineslope, G(r) = R(r) / r + r * s - """ # Define input output types diff --git a/src/diffpy/pdfmorph/morphs/__init__.py b/src/diffpy/pdfmorph/morphs/__init__.py index 37c5d4ef..607cce19 100644 --- a/src/diffpy/pdfmorph/morphs/__init__.py +++ b/src/diffpy/pdfmorph/morphs/__init__.py @@ -12,9 +12,7 @@ # See LICENSE.txt for license information. # ############################################################################## - -"""Definition of morphs. -""" +"""Definition of morphs.""" from diffpy.pdfmorph.morphs.morph import Morph # noqa: F401 diff --git a/src/diffpy/pdfmorph/morphs/morph.py b/src/diffpy/pdfmorph/morphs/morph.py index 73a6f617..4dd30abf 100644 --- a/src/diffpy/pdfmorph/morphs/morph.py +++ b/src/diffpy/pdfmorph/morphs/morph.py @@ -12,8 +12,6 @@ # See LICENSE.txt for license information. # ############################################################################## - - """Morph -- base class for defining a morph. """ @@ -198,7 +196,7 @@ def checkConfig(self): return def plotInputs(self, xylabels=True): - """Plot input arrays using matplotlib.pyplot + """Plot input arrays using matplotlib.pyplot. Parameters ---------- @@ -220,7 +218,7 @@ def plotInputs(self, xylabels=True): return rv def plotOutputs(self, xylabels=True, **plotargs): - """Plot output arrays using matplotlib.pyplot + """Plot output arrays using matplotlib.pyplot. Parameters ---------- diff --git a/src/diffpy/pdfmorph/morphs/morphchain.py b/src/diffpy/pdfmorph/morphs/morphchain.py index 4882c547..6b26f2e3 100644 --- a/src/diffpy/pdfmorph/morphs/morphchain.py +++ b/src/diffpy/pdfmorph/morphs/morphchain.py @@ -12,7 +12,6 @@ # See LICENSE.txt for license information. # ############################################################################## - """MorphChain -- Chain of morphs executed in order. """ diff --git a/src/diffpy/pdfmorph/morphs/morphishape.py b/src/diffpy/pdfmorph/morphs/morphishape.py index 91e24a2a..4686667f 100644 --- a/src/diffpy/pdfmorph/morphs/morphishape.py +++ b/src/diffpy/pdfmorph/morphs/morphishape.py @@ -12,11 +12,8 @@ # See LICENSE.txt for license information. # ############################################################################## - - -"""class MorphISphere -- apply inverse spherical shape function -class MorphISpheroid -- apply inverse spheroidal shape function -""" +"""Class MorphISphere -- apply inverse spherical shape function class +MorphISpheroid -- apply inverse spheroidal shape function.""" import numpy @@ -26,7 +23,7 @@ class MorphISpheroid -- apply inverse spheroidal shape function class MorphISphere(Morph): - """Apply inverse spherical characteristic function to the morph + """Apply inverse spherical characteristic function to the morph. Configuration Variables ----------------------- @@ -56,7 +53,7 @@ def morph(self, x_morph, y_morph, x_target, y_target): class MorphISpheroid(Morph): - """Apply inverse spherical characteristic function to the morph + """Apply inverse spherical characteristic function to the morph. Configuration Variables ----------------------- diff --git a/src/diffpy/pdfmorph/morphs/morphresolution.py b/src/diffpy/pdfmorph/morphs/morphresolution.py index e0011590..217876e4 100644 --- a/src/diffpy/pdfmorph/morphs/morphresolution.py +++ b/src/diffpy/pdfmorph/morphs/morphresolution.py @@ -12,10 +12,7 @@ # See LICENSE.txt for license information. # ############################################################################## - - -"""class MorphResolutionDamping -- apply resolution broadening to the morph -""" +"""Class MorphResolutionDamping -- apply resolution broadening to the morph.""" import numpy diff --git a/src/diffpy/pdfmorph/morphs/morphrgrid.py b/src/diffpy/pdfmorph/morphs/morphrgrid.py index 60808eaa..a33f2f64 100644 --- a/src/diffpy/pdfmorph/morphs/morphrgrid.py +++ b/src/diffpy/pdfmorph/morphs/morphrgrid.py @@ -12,10 +12,7 @@ # See LICENSE.txt for license information. # ############################################################################## - - -"""class MorphRGrid -- put morph and target on desired grid. -""" +"""Class MorphRGrid -- put morph and target on desired grid.""" import numpy diff --git a/src/diffpy/pdfmorph/morphs/morphscale.py b/src/diffpy/pdfmorph/morphs/morphscale.py index 0251b776..5c9ebb83 100644 --- a/src/diffpy/pdfmorph/morphs/morphscale.py +++ b/src/diffpy/pdfmorph/morphs/morphscale.py @@ -12,10 +12,7 @@ # See LICENSE.txt for license information. # ############################################################################## - - -"""class MorphScale -- scale the morph data -""" +"""Class MorphScale -- scale the morph data.""" from diffpy.pdfmorph.morphs.morph import LABEL_GR, LABEL_RA, Morph diff --git a/src/diffpy/pdfmorph/morphs/morphshape.py b/src/diffpy/pdfmorph/morphs/morphshape.py index 382c3cb2..237ed2a9 100644 --- a/src/diffpy/pdfmorph/morphs/morphshape.py +++ b/src/diffpy/pdfmorph/morphs/morphshape.py @@ -12,11 +12,8 @@ # See LICENSE.txt for license information. # ############################################################################## - - -"""class MorphSphere -- apply a spherical shape function to the morph -class MorphSpheroid -- apply a spheroidal shape function to the morph -""" +"""Class MorphSphere -- apply a spherical shape function to the morph class +MorphSpheroid -- apply a spheroidal shape function to the morph.""" import numpy @@ -28,7 +25,7 @@ class MorphSpheroid -- apply a spheroidal shape function to the morph class MorphSphere(Morph): - """Apply a spherical characteristic function to the morph + """Apply a spherical characteristic function to the morph. Configuration Variables ----------------------- @@ -56,7 +53,7 @@ def morph(self, x_morph, y_morph, x_target, y_target): class MorphSpheroid(Morph): - """Apply a spherical characteristic function to the morph + """Apply a spherical characteristic function to the morph. Configuration Variables ----------------------- @@ -143,7 +140,6 @@ def _spheroidalCF2(r, psize, axrat): axrat -- The ratio of axis lengths From Lei et al., Phys. Rev. B, 80, 024118 (2009) - """ pelpt = axrat diff --git a/src/diffpy/pdfmorph/morphs/morphshift.py b/src/diffpy/pdfmorph/morphs/morphshift.py index d6d2d2f5..1b12f7ef 100644 --- a/src/diffpy/pdfmorph/morphs/morphshift.py +++ b/src/diffpy/pdfmorph/morphs/morphshift.py @@ -12,10 +12,7 @@ # See LICENSE.txt for license information. # ############################################################################## - - -"""class MorphShift -- shift the morph -""" +"""Class MorphShift -- shift the morph.""" import numpy diff --git a/src/diffpy/pdfmorph/morphs/morphsmear.py b/src/diffpy/pdfmorph/morphs/morphsmear.py index 8161e50d..28ec9a8f 100644 --- a/src/diffpy/pdfmorph/morphs/morphsmear.py +++ b/src/diffpy/pdfmorph/morphs/morphsmear.py @@ -12,10 +12,7 @@ # See LICENSE.txt for license information. # ############################################################################## - - -"""class MorphSmear -- smear the morph. -""" +"""Class MorphSmear -- smear the morph.""" import numpy diff --git a/src/diffpy/pdfmorph/morphs/morphstretch.py b/src/diffpy/pdfmorph/morphs/morphstretch.py index 88c494e1..88bb4ec2 100644 --- a/src/diffpy/pdfmorph/morphs/morphstretch.py +++ b/src/diffpy/pdfmorph/morphs/morphstretch.py @@ -12,10 +12,7 @@ # See LICENSE.txt for license information. # ############################################################################## - - -"""class MorphStretch -- stretch the morph. -""" +"""Class MorphStretch -- stretch the morph.""" import numpy diff --git a/src/diffpy/pdfmorph/pdfmorph_api.py b/src/diffpy/pdfmorph/pdfmorph_api.py index d87249d7..0b83a5e6 100644 --- a/src/diffpy/pdfmorph/pdfmorph_api.py +++ b/src/diffpy/pdfmorph/pdfmorph_api.py @@ -46,7 +46,7 @@ def morph_default_config(**kwargs): - """function to generate default morph configuration + """Function to generate default morph configuration. Parameters ---------- @@ -88,7 +88,7 @@ def pdfmorph( verbose=False, **kwargs, ): - """function to perform PDF morphing. + """Function to perform PDF morphing. Parameters ---------- diff --git a/src/diffpy/pdfmorph/pdfmorph_io.py b/src/diffpy/pdfmorph/pdfmorph_io.py index e454b1dc..606773c8 100644 --- a/src/diffpy/pdfmorph/pdfmorph_io.py +++ b/src/diffpy/pdfmorph/pdfmorph_io.py @@ -34,8 +34,8 @@ def single_morph_output( verbose=False, stdout_flag=False, ): - """Helper function for printing details about a single morph. - Handles both printing to terminal and printing to a file. + """Helper function for printing details about a single morph. Handles both + printing to terminal and printing to a file. Parameters ---------- @@ -136,9 +136,9 @@ def create_morphs_directory(save_directory): def get_multisave_names(target_list: list, save_names_file=None, mm=False): """Create or import a dictionary that specifies names to save morphs as. - First attempt to import names from a specified file. - If names for certain morphs not found, use default naming scheme: - 'Morph_with_Target_.cgr'. + First attempt to import names from a specified file. If names for certain + morphs not found, use default naming scheme: 'Morph_with_Target_.cgr'. Used when saving multiple morphs. diff --git a/src/diffpy/pdfmorph/pdfmorphapp.py b/src/diffpy/pdfmorph/pdfmorphapp.py index c8280897..fb07cfad 100755 --- a/src/diffpy/pdfmorph/pdfmorphapp.py +++ b/src/diffpy/pdfmorph/pdfmorphapp.py @@ -42,8 +42,8 @@ def __init__(self, *args, **kwargs): def custom_error(self, msg): """custom_error(msg : string) - Print a message incorporating 'msg' to stderr and exit. - Does not print usage. + Print a message incorporating 'msg' to stderr and exit. Does + not print usage. """ self.exit(2, "%s: error: %s\n" % (self.get_prog_name(), msg)) diff --git a/src/diffpy/pdfmorph/pdfplot.py b/src/diffpy/pdfmorph/pdfplot.py index 5dd4d690..dd7e550f 100644 --- a/src/diffpy/pdfmorph/pdfplot.py +++ b/src/diffpy/pdfmorph/pdfplot.py @@ -227,8 +227,7 @@ def comparePDFs( def plot_param(target_labels, param_list, param_name=None, field=None): - """ - Plot Rw values for multiple morphs. + """Plot Rw values for multiple morphs. Parameters ---------- diff --git a/src/diffpy/pdfmorph/refine.py b/src/diffpy/pdfmorph/refine.py index 9519880b..e35a7426 100644 --- a/src/diffpy/pdfmorph/refine.py +++ b/src/diffpy/pdfmorph/refine.py @@ -12,7 +12,6 @@ # See LICENSE.txt for license information. # ############################################################################## - """refine -- Refine a morph or morph chain """ @@ -71,9 +70,9 @@ def _residual(self, pvals): def _pearson(self, pvals): """Pearson correlation function. - This gives e**-p (vector), where p is the pearson correlation function. - We seek to minimize this, which occurs when the correlation is the - largest. + This gives e**-p (vector), where p is the pearson correlation + function. We seek to minimize this, which occurs when the + correlation is the largest. """ self._update_chain(pvals) _x_morph, _y_morph, _x_target, _y_target = self.chain( diff --git a/src/diffpy/pdfmorph/tools.py b/src/diffpy/pdfmorph/tools.py index 09f96ec3..63a4f040 100644 --- a/src/diffpy/pdfmorph/tools.py +++ b/src/diffpy/pdfmorph/tools.py @@ -12,10 +12,7 @@ # See LICENSE.txt for license information. # ############################################################################## - - -"""Tools used in morphs and morph chains. -""" +"""Tools used in morphs and morph chains.""" import numpy @@ -180,8 +177,8 @@ def case_insensitive_dictionary_search(key: str, dictionary: dict): def field_sort( filepaths: list, field, reverse=False, serfile=None, get_field_values=False ): - """Sort a list of files by a field stored in header information. - All files must contain this header information. + """Sort a list of files by a field stored in header information. All files + must contain this header information. Parameters ---------- @@ -243,9 +240,9 @@ def field_sort( def get_values_from_dictionary_collection( dictionary_collection: iter, target_key ): - """In an (iterable) collection of dictionaries, search for a target key - in each dictionary. Return a list of all found values corresponding - to that key. + """In an (iterable) collection of dictionaries, search for a target key in + each dictionary. Return a list of all found values corresponding to that + key. Parameters ---------- diff --git a/src/diffpy/pdfmorph/version.py b/src/diffpy/pdfmorph/version.py index cf614327..6579a654 100644 --- a/src/diffpy/pdfmorph/version.py +++ b/src/diffpy/pdfmorph/version.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# (c) 2024 The Trustees of Columbia University in the City of New York. +# (c) 2025 The Trustees of Columbia University in the City of New York. # All rights reserved. # # File coded by: Billinge Group members and community contributors. @@ -12,7 +12,6 @@ # See LICENSE.rst for license information. # ############################################################################## - """Definition of __version__.""" # We do not use the other three variables, but can be added back if needed. diff --git a/tests/debug.py b/tests/debug.py index 908a3940..f5fb842e 100644 --- a/tests/debug.py +++ b/tests/debug.py @@ -12,9 +12,7 @@ # See LICENSE.rst for license information. # ############################################################################## - -""" -Convenience module for debugging the unit tests using +"""Convenience module for debugging the unit tests using. python -m diffpy.pdfmorph.tests.debug diff --git a/tests/run.py b/tests/run.py index 499f63bf..e7b0cc98 100644 --- a/tests/run.py +++ b/tests/run.py @@ -12,9 +12,8 @@ # See LICENSE.rst for license information. # ############################################################################## -"""Convenience module for executing all unit tests with -python -m diffpy.pdfmorph.tests.run -""" +"""Convenience module for executing all unit tests with python -m +diffpy.pdfmorph.tests.run.""" import sys diff --git a/tests/test_morphchain.py b/tests/test_morphchain.py index 8a9657b2..2f553213 100644 --- a/tests/test_morphchain.py +++ b/tests/test_morphchain.py @@ -27,7 +27,7 @@ def setup(self): return def test_morph(self, setup): - """check MorphChain.morph()""" + """Check MorphChain.morph()""" # Define the morphs config = { "rmin": 1, diff --git a/tests/test_morphpdftordf.py b/tests/test_morphpdftordf.py index 48cd035e..d5da7c45 100644 --- a/tests/test_morphpdftordf.py +++ b/tests/test_morphpdftordf.py @@ -32,7 +32,7 @@ def setup(self): return def test_transform(self, setup): - """check TransformXtalPDFtoRDF.morph()""" + """Check TransformXtalPDFtoRDF.morph()""" config = {"baselineslope": -1.0} transform = TransformXtalPDFtoRDF(config) diff --git a/tests/test_morphrdftopdf.py b/tests/test_morphrdftopdf.py index f66cb8b1..1296d1cb 100644 --- a/tests/test_morphrdftopdf.py +++ b/tests/test_morphrdftopdf.py @@ -26,7 +26,7 @@ def setup(self): return def test_transform(self, setup): - """check TransformXtalRDFtoPDF.morph()""" + """Check TransformXtalRDFtoPDF.morph()""" config = {"baselineslope": -1.0} transform = TransformXtalRDFtoPDF(config) diff --git a/tests/test_morphresolution.py b/tests/test_morphresolution.py index a2226228..b897e857 100644 --- a/tests/test_morphresolution.py +++ b/tests/test_morphresolution.py @@ -24,7 +24,7 @@ def setup(self): return def test_morph(self, setup): - """check MorphScale.morph()""" + """Check MorphScale.morph()""" config = {"qdamp": 0.01} morph = MorphResolutionDamping(config) diff --git a/tests/test_morphrgrid.py b/tests/test_morphrgrid.py index 43a957f4..8a5bbe34 100644 --- a/tests/test_morphrgrid.py +++ b/tests/test_morphrgrid.py @@ -34,7 +34,7 @@ def _runTests(self, xyallout, morph): return def testRangeInBounds(self, setup): - """Selected range is within input bounds""" + """Selected range is within input bounds.""" config = { "rmin": 1.0, @@ -52,7 +52,7 @@ def testRangeInBounds(self, setup): return def testRmaxOut(self, setup): - """Selected rmax is outside of input bounds""" + """Selected rmax is outside of input bounds.""" config = { "rmin": 1.0, @@ -70,7 +70,7 @@ def testRmaxOut(self, setup): return def testRminOut(self, setup): - """Selected rmin is outside of input bounds""" + """Selected rmin is outside of input bounds.""" config = { "rmin": 0.0, @@ -88,7 +88,7 @@ def testRminOut(self, setup): return def testRstepOut(self, setup): - """Selected rstep is outside of input bounds""" + """Selected rstep is outside of input bounds.""" config = { "rmin": 1.0, diff --git a/tests/test_morphscale.py b/tests/test_morphscale.py index ae20025e..788b0a3d 100644 --- a/tests/test_morphscale.py +++ b/tests/test_morphscale.py @@ -24,7 +24,7 @@ def setup(self): return def test_morph(self, setup): - """check MorphScale.morph()""" + """Check MorphScale.morph()""" config = {"scale": 2.0} morph = MorphScale(config) diff --git a/tests/test_morphshape.py b/tests/test_morphshape.py index 3d4e9a11..68a20520 100644 --- a/tests/test_morphshape.py +++ b/tests/test_morphshape.py @@ -27,7 +27,7 @@ def setup(self): return def test_morph(self, setup): - """check MorphSphere.morph()""" + """Check MorphSphere.morph()""" config = {"radius": 17.5} morph = MorphSphere(config) @@ -78,7 +78,7 @@ def reset(self): return def test_morph(self): - """check MorphSpheroid.morph() and MorphISpheroid.morph()""" + """Check MorphSpheroid.morph() and MorphISpheroid.morph()""" for idx in range(len(self.testfiles)): self.testfile = self.testfiles[idx] diff --git a/tests/test_morphshift.py b/tests/test_morphshift.py index feda66a4..8dc1e256 100644 --- a/tests/test_morphshift.py +++ b/tests/test_morphshift.py @@ -30,7 +30,7 @@ def setup(self): return def test_morph(self, setup): - """check MorphScale.morph()""" + """Check MorphScale.morph()""" config = {"hshift": self.hshift, "vshift": self.vshift} morph = MorphShift(config) diff --git a/tests/test_morphsmear.py b/tests/test_morphsmear.py index 430a569d..b839c03f 100644 --- a/tests/test_morphsmear.py +++ b/tests/test_morphsmear.py @@ -28,7 +28,7 @@ def setup(self): return def test_morph(self, setup): - """check MorphSmear.morph()""" + """Check MorphSmear.morph()""" morph = MorphSmear() morph.smear = 0.15 diff --git a/tests/test_morphstretch.py b/tests/test_morphstretch.py index c87cb4a6..096eda99 100644 --- a/tests/test_morphstretch.py +++ b/tests/test_morphstretch.py @@ -25,7 +25,7 @@ def setup(self): return def test_morph(self, setup): - """check MorphStretch.morph()""" + """Check MorphStretch.morph()""" morph = MorphStretch() # Stretch by 50% diff --git a/tests/test_refine.py b/tests/test_refine.py index e14ab257..199fc568 100644 --- a/tests/test_refine.py +++ b/tests/test_refine.py @@ -34,7 +34,7 @@ def setup(self): return def test_refine_morph(self, setup): - """refine a morph""" + """Refine a morph.""" # Define the morphs config = { "scale": 1.0, @@ -54,7 +54,7 @@ def test_refine_morph(self, setup): return def test_refine_chain(self, setup): - """refine a chain""" + """Refine a chain.""" # Give this some texture self.y_morph[30:] = 5 self.y_target[33:] = 15 diff --git a/tests/test_tools.py b/tests/test_tools.py index 12d061d1..35d09b78 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -1,7 +1,6 @@ #!/usr/bin/env python -"""Unit tests for tools.py -""" +"""Unit tests for tools.py.""" import os @@ -29,14 +28,14 @@ def setup(self): return def test_estimateBaselineSlope(self, setup): - """check estimateBaselineSlope() using calculated data""" + """Check estimateBaselineSlope() using calculated data.""" slope = tools.estimateBaselineSlope(self.x_morph, self.y_morph) slopecalc = -4 * numpy.pi * self.rho0 assert numpy.allclose(slopecalc, slope, 1e-2) return def test_estimateScale(self, setup): - """check estimateScale() using calculated data""" + """Check estimateScale() using calculated data.""" import random x = random.random() diff --git a/tests/test_version.py b/tests/test_version.py index 21318422..33f5ed87 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -1,5 +1,4 @@ -"""Unit tests for __version__.py -""" +"""Unit tests for __version__.py.""" import diffpy.pdfmorph