From 59bd537854c3a7fb64ee14c089584ee6607256b3 Mon Sep 17 00:00:00 2001 From: Sparks29032 Date: Tue, 18 Mar 2025 20:18:30 -0500 Subject: [PATCH 1/3] Refactor PDFmorph to diffpy.morph --- .../workflows/build-wheel-release-upload.yml | 2 +- .github/workflows/check-news-item.yml | 2 +- .../matrix-and-codecov-on-merge-to-main.yml | 2 +- .github/workflows/tests-on-pr.yml | 2 +- AUTHORS.rst | 2 +- README.rst | 100 +++++++++--------- TUTORIAL.rst | 58 +++++----- doc/Makefile | 2 +- doc/source/api/diffpy.morph.morph_helpers.rst | 28 +++++ doc/source/api/diffpy.morph.morphs.rst | 92 ++++++++++++++++ doc/source/api/diffpy.morph.rst | 77 ++++++++++++++ .../api/diffpy.pdfmorph.morph_helpers.rst | 28 ----- doc/source/api/diffpy.pdfmorph.morphs.rst | 92 ---------------- doc/source/api/diffpy.pdfmorph.rst | 77 -------------- doc/source/conf.py | 22 ++-- doc/source/index.rst | 24 ++--- doc/source/quickstart.rst | 84 +++++++-------- environment.yml | 2 +- news/diffpy_morph.rst | 23 ++++ pyproject.toml | 8 +- src/diffpy/__init__.py | 2 +- src/diffpy/{pdfmorph => morph}/__init__.py | 4 +- src/diffpy/{pdfmorph => morph}/log.py | 6 +- .../pdfmorph_api.py => morph/morph_api.py} | 18 ++-- .../morph_helpers/__init__.py | 6 +- .../morph_helpers/transformpdftordf.py | 4 +- .../morph_helpers/transformrdftopdf.py | 4 +- .../pdfmorph_io.py => morph/morph_io.py} | 16 +-- .../pdfmorphapp.py => morph/morphapp.py} | 26 ++--- .../{pdfmorph => morph}/morphs/__init__.py | 22 ++-- .../{pdfmorph => morph}/morphs/morph.py | 2 +- .../{pdfmorph => morph}/morphs/morphchain.py | 2 +- .../{pdfmorph => morph}/morphs/morphishape.py | 6 +- .../morphs/morphresolution.py | 4 +- .../{pdfmorph => morph}/morphs/morphrgrid.py | 4 +- .../{pdfmorph => morph}/morphs/morphscale.py | 4 +- .../{pdfmorph => morph}/morphs/morphshape.py | 4 +- .../{pdfmorph => morph}/morphs/morphshift.py | 4 +- .../{pdfmorph => morph}/morphs/morphsmear.py | 4 +- .../morphs/morphstretch.py | 4 +- src/diffpy/{pdfmorph => morph}/pdfplot.py | 2 +- src/diffpy/{pdfmorph => morph}/refine.py | 2 +- src/diffpy/{pdfmorph => morph}/tools.py | 2 +- src/diffpy/{pdfmorph => morph}/version.py | 2 +- tests/debug.py | 2 +- tests/run.py | 4 +- tests/test_morph_func.py | 12 +-- .../{test_pdfmorphapp.py => test_morphapp.py} | 2 +- tests/test_morphchain.py | 6 +- tests/{test_pdfmorphio.py => test_morphio.py} | 2 +- tests/test_morphpdftordf.py | 2 +- tests/test_morphrdftopdf.py | 2 +- tests/test_morphresolution.py | 2 +- tests/test_morphrgrid.py | 2 +- 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_pdfplot.py | 6 +- tests/test_refine.py | 14 +-- tests/test_tools.py | 2 +- tests/test_version.py | 6 +- .../succinct/Morph_Reference_Table.txt | 2 +- .../testsaving/succinct/Morphs/mwt_a.cgr | 2 +- .../testsaving/succinct/Morphs/mwt_b.cgr | 2 +- .../testsaving/succinct/Morphs/mwt_c.cgr | 2 +- .../testsaving/succinct/Morphs/mwt_d.cgr | 2 +- .../testsaving/succinct/Morphs/mwt_e.cgr | 2 +- .../testsaving/succinct/Morphs/mwt_f.cgr | 2 +- .../succinct/single_succinct_morph.cgr | 2 +- .../verbose/Morph_Reference_Table.txt | 2 +- .../testsaving/verbose/Morphs/mwt_a.cgr | 2 +- .../testsaving/verbose/Morphs/mwt_b.cgr | 2 +- .../testsaving/verbose/Morphs/mwt_c.cgr | 2 +- .../testsaving/verbose/Morphs/mwt_d.cgr | 2 +- .../testsaving/verbose/Morphs/mwt_e.cgr | 2 +- .../testsaving/verbose/Morphs/mwt_f.cgr | 2 +- .../verbose/single_verbose_morph.cgr | 2 +- ...rph_manual.pdf => diffpy.morph_manual.pdf} | Bin 80 files changed, 506 insertions(+), 483 deletions(-) create mode 100644 doc/source/api/diffpy.morph.morph_helpers.rst create mode 100644 doc/source/api/diffpy.morph.morphs.rst create mode 100644 doc/source/api/diffpy.morph.rst delete mode 100644 doc/source/api/diffpy.pdfmorph.morph_helpers.rst delete mode 100644 doc/source/api/diffpy.pdfmorph.morphs.rst delete mode 100644 doc/source/api/diffpy.pdfmorph.rst create mode 100644 news/diffpy_morph.rst rename src/diffpy/{pdfmorph => morph}/__init__.py (86%) rename src/diffpy/{pdfmorph => morph}/log.py (89%) rename src/diffpy/{pdfmorph/pdfmorph_api.py => morph/morph_api.py} (95%) rename src/diffpy/{pdfmorph => morph}/morph_helpers/__init__.py (80%) rename src/diffpy/{pdfmorph => morph}/morph_helpers/transformpdftordf.py (93%) rename src/diffpy/{pdfmorph => morph}/morph_helpers/transformrdftopdf.py (94%) rename src/diffpy/{pdfmorph/pdfmorph_io.py => morph/morph_io.py} (96%) rename src/diffpy/{pdfmorph/pdfmorphapp.py => morph/morphapp.py} (98%) rename src/diffpy/{pdfmorph => morph}/morphs/__init__.py (52%) rename src/diffpy/{pdfmorph => morph}/morphs/morph.py (99%) rename src/diffpy/{pdfmorph => morph}/morphs/morphchain.py (99%) rename src/diffpy/{pdfmorph => morph}/morphs/morphishape.py (92%) rename src/diffpy/{pdfmorph => morph}/morphs/morphresolution.py (92%) rename src/diffpy/{pdfmorph => morph}/morphs/morphrgrid.py (96%) rename src/diffpy/{pdfmorph => morph}/morphs/morphscale.py (91%) rename src/diffpy/{pdfmorph => morph}/morphs/morphshape.py (97%) rename src/diffpy/{pdfmorph => morph}/morphs/morphshift.py (93%) rename src/diffpy/{pdfmorph => morph}/morphs/morphsmear.py (95%) rename src/diffpy/{pdfmorph => morph}/morphs/morphstretch.py (92%) rename src/diffpy/{pdfmorph => morph}/pdfplot.py (99%) rename src/diffpy/{pdfmorph => morph}/refine.py (98%) rename src/diffpy/{pdfmorph => morph}/tools.py (99%) rename src/diffpy/{pdfmorph => morph}/version.py (95%) rename tests/{test_pdfmorphapp.py => test_morphapp.py} (99%) rename tests/{test_pdfmorphio.py => test_morphio.py} (99%) rename tutorial/{PDFmorph_manual.pdf => diffpy.morph_manual.pdf} (100%) diff --git a/.github/workflows/build-wheel-release-upload.yml b/.github/workflows/build-wheel-release-upload.yml index 8b2ffb5a..4da6379d 100644 --- a/.github/workflows/build-wheel-release-upload.yml +++ b/.github/workflows/build-wheel-release-upload.yml @@ -10,7 +10,7 @@ jobs: release: uses: Billingegroup/release-scripts/.github/workflows/_build-wheel-release-upload.yml@v0 with: - project: diffpy.pdfmorph + project: diffpy.morph 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..d672d34d 100644 --- a/.github/workflows/check-news-item.yml +++ b/.github/workflows/check-news-item.yml @@ -9,4 +9,4 @@ jobs: check-news-item: uses: Billingegroup/release-scripts/.github/workflows/_check-news-item.yml@v0 with: - project: diffpy.pdfmorph + project: diffpy.morph diff --git a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml index 59f0f59a..4a5af435 100644 --- a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml +++ b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml @@ -14,7 +14,7 @@ jobs: matrix-coverage: uses: Billingegroup/release-scripts/.github/workflows/_matrix-and-codecov-on-merge-to-main.yml@v0 with: - project: diffpy.pdfmorph + project: diffpy.morph c_extension: false headless: false secrets: diff --git a/.github/workflows/tests-on-pr.yml b/.github/workflows/tests-on-pr.yml index bcedfab8..8d0a909f 100644 --- a/.github/workflows/tests-on-pr.yml +++ b/.github/workflows/tests-on-pr.yml @@ -11,7 +11,7 @@ jobs: tests-on-pr: uses: Billingegroup/release-scripts/.github/workflows/_tests-on-pr.yml@v0 with: - project: diffpy.pdfmorph + project: diffpy.morph c_extension: false headless: false secrets: diff --git a/AUTHORS.rst b/AUTHORS.rst index dfff1afe..f7aca6d3 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -7,4 +7,4 @@ Contributors ------------ For a list of contributors, visit -https://github.com/diffpy/diffpy.pdfmorph/graphs/contributors +https://github.com/diffpy/diffpy.morph/graphs/contributors diff --git a/README.rst b/README.rst index 5f196b39..4c54d9b6 100644 --- a/README.rst +++ b/README.rst @@ -1,8 +1,8 @@ -|Icon| `diffpy.pdfmorph `_ -==================================================================== +|Icon| `diffpy.morph `_ +============================================================== .. |Icon| image:: https://avatars.githubusercontent.com/diffpy - :target: https://diffpy.github.io/diffpy.pdfmorph + :target: https://diffpy.github.io/diffpy.morph :height: 100px |PyPi| |Forge| |PythonVersion| |PR| @@ -12,29 +12,29 @@ .. |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 +.. |CI| image:: https://github.com/diffpy/diffpy.morph/actions/workflows/matrix-and-codecov-on-merge-to-main.yml/badge.svg + :target: https://github.com/diffpy/diffpy.morph/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 +.. |Codecov| image:: https://codecov.io/gh/diffpy/diffpy.morph/branch/main/graph/badge.svg + :target: https://codecov.io/gh/diffpy/diffpy.morph -.. |Forge| image:: https://img.shields.io/conda/vn/conda-forge/diffpy.pdfmorph - :target: https://anaconda.org/conda-forge/diffpy.pdfmorph +.. |Forge| image:: https://img.shields.io/conda/vn/conda-forge/diffpy.morph + :target: https://anaconda.org/conda-forge/diffpy.morph .. |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/ +.. |PyPi| image:: https://img.shields.io/pypi/v/diffpy.morph + :target: https://pypi.org/project/diffpy.morph/ -.. |PythonVersion| image:: https://img.shields.io/pypi/pyversions/diffpy.pdfmorph - :target: https://pypi.org/project/diffpy.pdfmorph/ +.. |PythonVersion| image:: https://img.shields.io/pypi/pyversions/diffpy.morph + :target: https://pypi.org/project/diffpy.morph/ .. |Tracking| image:: https://img.shields.io/badge/issue_tracking-github-blue - :target: https://github.com/diffpy/diffpy.pdfmorph/issues + :target: https://github.com/diffpy/diffpy.morph/issues Tools for manipulating and comparing PDF profiles -PDFmorph is a Python software package designed to increase the insight +``diffpy.morph`` 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 @@ -44,42 +44,42 @@ 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 +scale due to differences in incident flux, for example. ``diffpy.morph`` 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 +(self-explanatory). ``diffpy.morph`` 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 +Finally, we note that ``diffpy.morph`` 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 `_. +For more information about the diffpy.morph 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 +If you use diffpy.morph in a scientific publication, we would like you to cite this package as - diffpy.pdfmorph Package, https://github.com/diffpy/diffpy.pdfmorph + diffpy.morph Package, https://github.com/diffpy/diffpy.morph REQUIREMENTS ------------------------------------------------------------------------ -PDFmorph is currently run from the command line, which requires opening +``diffpy.morph`` 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. +familiar before using ``diffpy.morph``. -PDFmorph can be run with Python 3.10 or higher. It makes use of several third party +``diffpy.morph`` 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 @@ -102,29 +102,29 @@ 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`` :: +The following creates and activates a new environment named ``diffpy.morph_env`` :: - conda create -n diffpy.pdfmorph_env diffpy.pdfmorph - conda activate diffpy.pdfmorph_env + conda create -n diffpy.morph_env diffpy.morph + conda activate diffpy.morph_env To confirm that the installation was successful, type:: - python -c "import diffpy.pdfmorph; print(diffpy.pdfmorph.__version__)" + python -c "import diffpy.morph; print(diffpy.morph.__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 :: +To install using ``pip`` into your ``diffpy.morph_env`` environment, we will also have to install dependencies :: - pip install -r https://raw.githubusercontent.com/diffpy/diffpy.pdfmorph/main/requirements/pip.txt + pip install -r https://raw.githubusercontent.com/diffpy/diffpy.morph/main/requirements/pip.txt and then install the package :: - pip install diffpy.pdfmorph + pip install diffpy.morph 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 +`GitHub `_. Once installed, ``cd`` into your ``diffpy.morph`` directory and run the following :: pip install . @@ -132,32 +132,32 @@ and run the following :: Getting Started --------------- -You may consult our `online documentation `_ for tutorials and API references. +You may consult our `online documentation `_ for tutorials and API references. -USING PDFmorph ------------------------------------------------------------------------- +USING diffpy.morph +------------------ For detailed instructions and full tutorial, consult the user manual -on our `website `. +on our `website `. -Once the required software, including PDFmorph is all installed, open +Once the required software, including ``diffpy.morph`` 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 + source activate diffpy.morph_env #if the environment isn't already active + diffpy.morph -h #get some helpful information + diffpy.morph --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 :: +of ``diffpy.morph`` that you have installed on your system. To begin using +``diffpy.morph``, run a command like :: - pdfmorph + diffpy.morph 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. +``diffpy.morph``, it is recommended to stick with ``.gr`` files. Enjoy! @@ -165,16 +165,16 @@ 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! +`Diffpy user group `_ is the discussion forum for general questions and discussions about the use of diffpy.morph. Please join the diffpy.morph users community by joining the Google group. The diffpy.morph 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 `_. +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 +Feel free to fork the project and contribute. To install diffpy.morph 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 . + 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. @@ -190,9 +190,9 @@ trying to commit again. Improvements and fixes are always appreciated. -Before contributing, please read our `Code of Conduct `_. +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. +For more information on diffpy.morph please visit the project `web-page `_ or email Prof. Simon Billinge at sb2896@columbia.edu. diff --git a/TUTORIAL.rst b/TUTORIAL.rst index 74e897c9..433c301a 100644 --- a/TUTORIAL.rst +++ b/TUTORIAL.rst @@ -1,7 +1,7 @@ -PDFmorph Tutorial -################# +diffpy.morph Tutorial +##################### -Welcome! This will be a quick tutorial to accquaint users with PDFmorph +Welcome! This will be a quick tutorial to accquaint users with ``diffpy.morph`` and some of what it can do. As we described in the README and installation instructions, please make @@ -11,23 +11,23 @@ before using this application. Before you've started this tutorial, please ensure that you've installed all necessary software and dependencies. -Basic PDFmorph Workflow ------------------------ +Basic diffpy.morph Workflow +--------------------------- 1. Open your Terminal or Command Prompt. - 2. It it's not active already, activate your PDFmorph-equipped + 2. It it's not active already, activate your ``diffpy.morph``-equipped conda environment by typing in :: - source activate + source activate - on Linux or ``activate `` on Windows. + on Linux or ``activate `` on Windows. * If you need to list your available conda environments, run the command ``conda info --envs`` or ``conda env list`` - * Run the ``pdfmorph --help`` command and read over the + * Run the ``diffpy.morph --help`` command and read over the info on that page for a brief overview of some of what we will explore in this tutorial. @@ -52,31 +52,31 @@ Basic PDFmorph Workflow those generated by the `PDFgui `_ program. - 4. First, we will run the PDFmorph application without any morphing + 4. First, we will run the ``diffpy.morph`` application without any morphing and only using one PDF. Type the following command into your Command Line :: - pdfmorph darkSub_rh20_C_01.gr darkSub_rh20_C_01.gr + diffpy.morph darkSub_rh20_C_01.gr darkSub_rh20_C_01.gr This should produce two PDF curves which are congruent, resulting in a flat green line underneath them. - 5. Now, we will see PDFmorph run with two different PDFs and no + 5. Now, we will see ``diffpy.morph`` run with two different PDFs and no morphing. Type the following command into your command line :: - pdfmorph darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr + diffpy.morph darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr Without morphing, the difference Rw = 0.407. This indicates that the two PDFs vary drastically. - * While running the ``pdfmorph`` command, it is important + * While running the ``diffpy.morph`` command, it is important to remember that the first PDF file argument you provide (in this case, ``darkSub_rh20_C_01.gr``) is the PDF which will get morphed, while the second PDF file argument you provide (here, ``darkSub_rh20_C_44.gr``) is the PDF which acts as the model and does not get morphed. Hereinafter, we will refer to the first PDF argument as the "morph" - and the second as the "target", as the PDFmorph display + and the second as the "target", as the ``diffpy.morph`` display does. 6. Now, we will start the morphing process, which requires us to @@ -84,30 +84,30 @@ Basic PDFmorph Workflow and stretch, separately. We will start with the scaling factor. Begin by typing the command :: - pdfmorph --scale=2 -a darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr + diffpy.morph --scale=2 -a darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr Now, the difference Rw = 1.457, a significant increase from our value previously. We must modify our initial value for the scaling factor and do so until we see a reduction in the difference Rw from the unmorphed value. Type :: - pdfmorph --scale=0.9 -a darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr + diffpy.morph --scale=0.9 -a darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr The difference Rw is now 0.351, lower than our unmorphed - example's value. To see PDFmorph optimize the scale factor, + example's value. To see ``diffpy.morph`` optimize the scale factor, simply drop ``-a`` from the command and type :: - pdfmorph --scale=0.9 darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr + diffpy.morph --scale=0.9 darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr - PDFmorph, given a reasonable initial guess, will use find the + ``diffpy.morph``, given a reasonable initial guess, will use find the optimal value for each morphing feature. Here, we see that - PDFmorph displays ``scale = 0.799025`` in the command prompt, + ``diffpy.morph`` displays ``scale = 0.799025`` in the command prompt, meaning that it has found this to be the most optimal value for the scale factor. The difference Rw = 0.330, indicating a better fit than our reasonable initial guess. * It is the choice of the user whether or not to run values - before removing ``-a`` when analyzing data with PDFmorph. + before removing ``-a`` when analyzing data with ``diffpy.morph``. By including it, you allow the possibility to move towards convergence before allowing the program to optimize by removing it; when including it, you may reach a highly @@ -118,10 +118,10 @@ Basic PDFmorph Workflow 7. Now, we will examine the Gaussian smearing factor. We provide an initial guess by typing :: - pdfmorph --scale=0.8 --smear=0.5 -a darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr + diffpy.morph --scale=0.8 --smear=0.5 -a darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr And viewing the results. We've tailored our scale factor to be - close to the value given by PDFmorph, but see that the difference + close to the value given by ``diffpy.morph``, but see that the difference Rw has increased substantially due to our smear value. One approach, as described above, is to remove the ``-a`` from the above command and run it again. @@ -135,7 +135,7 @@ Basic PDFmorph Workflow an effect, we restrict the ``rmin`` and ``rmax`` values to reflect relevant data range by typing :: - pdfmorph --scale=0.8 --smear=0.5 --rmin=1.5 --rmax=30 darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr + diffpy.morph --scale=0.8 --smear=0.5 --rmin=1.5 --rmax=30 darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr Now, we see that the difference Rw = 0.204 and that the optimized ``smear=-0.084138``. @@ -151,7 +151,7 @@ Basic PDFmorph Workflow 8. Finally, we will examine the stretch factor. Provide an initial guess by typing :: - pdfmorph --scale=0.8 --smear=-0.08 --stretch=0.5 --rmin=1.5 --rmax=30 -a darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr + diffpy.morph --scale=0.8 --smear=-0.08 --stretch=0.5 --rmin=1.5 --rmax=30 -a darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr And noting that the difference has increased. Before continuing, see if you can see which direction (higher or lower) our initial @@ -160,7 +160,7 @@ Basic PDFmorph Workflow If you cannot, type :: - pdfmorph --scale=0.8 --smear=-0.08 --stretch=0.005 --rmin=1.5 --rmax=30 -a darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr + diffpy.morph --scale=0.8 --smear=-0.08 --stretch=0.005 --rmin=1.5 --rmax=30 -a darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr to observe decreased difference and then remove ``-a`` to see the optimized ``--stretch=0.001762``. We have now reached @@ -174,8 +174,8 @@ Basic PDFmorph Workflow Enjoy the software! -.. Additional PDFmorph Functionality/Exploration -.. --------------------------------------------- +.. Additional diffpy.morph Functionality/Exploration +.. ------------------------------------------------- .. TODO include undoped PDF example, phase changed PDFs, and nano/non-nano PDFs diff --git a/doc/Makefile b/doc/Makefile index cb041d35..4dac79b8 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -6,7 +6,7 @@ SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = build -BASENAME = $(subst .,,$(subst $() $(),,diffpy.pdfmorph)) +BASENAME = $(subst .,,$(subst $() $(),,diffpy.morph)) # User-friendly check for sphinx-build ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) diff --git a/doc/source/api/diffpy.morph.morph_helpers.rst b/doc/source/api/diffpy.morph.morph_helpers.rst new file mode 100644 index 00000000..e8889166 --- /dev/null +++ b/doc/source/api/diffpy.morph.morph_helpers.rst @@ -0,0 +1,28 @@ +:tocdepth: -1 + +diffpy.morph.morph_helpers package +================================== + +.. automodule:: diffpy.morph.morph_helpers + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +diffpy.morph.morph_helpers.transformpdftordf module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.morph.morph_helpers.transformpdftordf + :members: + :undoc-members: + :show-inheritance: + +diffpy.morph.morph_helpers.transformrdftopdf module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.morph.morph_helpers.transformrdftopdf + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/source/api/diffpy.morph.morphs.rst b/doc/source/api/diffpy.morph.morphs.rst new file mode 100644 index 00000000..c4b55150 --- /dev/null +++ b/doc/source/api/diffpy.morph.morphs.rst @@ -0,0 +1,92 @@ +:tocdepth: -1 + +diffpy.morph.morphs package +=========================== + +.. automodule:: diffpy.morph.morphs + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +diffpy.morph.morphs.morphishape module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.morph.morphs.morphishape + :members: + :undoc-members: + :show-inheritance: + +diffpy.morph.morphs.morphchain module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.morph.morphs.morphchain + :members: + :undoc-members: + :show-inheritance: + +diffpy.morph.morphs.morphresolution module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.morph.morphs.morphresolution + :members: + :undoc-members: + :show-inheritance: + +diffpy.morph.morphs.morphshape module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.morph.morphs.morphshape + :members: + :undoc-members: + :show-inheritance: + +diffpy.morph.morphs.morphshift module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.morph.morphs.morphshift + :members: + :undoc-members: + :show-inheritance: + +diffpy.morph.morphs.morph module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.morph.morphs.morph + :members: + :undoc-members: + :show-inheritance: + +diffpy.morph.morphs.morphrgrid module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.morph.morphs.morphrgrid + :members: + :undoc-members: + :show-inheritance: + +diffpy.morph.morphs.morphsmear module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.morph.morphs.morphsmear + :members: + :undoc-members: + :show-inheritance: + +diffpy.morph.morphs.morphstretch module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.morph.morphs.morphstretch + :members: + :undoc-members: + :show-inheritance: + +diffpy.morph.morphs.morphscale module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.morph.morphs.morphscale + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/source/api/diffpy.morph.rst b/doc/source/api/diffpy.morph.rst new file mode 100644 index 00000000..f29ebe1a --- /dev/null +++ b/doc/source/api/diffpy.morph.rst @@ -0,0 +1,77 @@ +:tocdepth: -1 + +diffpy.morph package +==================== + +.. automodule:: diffpy.morph + :members: + :undoc-members: + :show-inheritance: + +Subpackages +----------- + +.. toctree:: + :titlesonly: + + diffpy.morph.morphs + diffpy.morph.morph_helpers + +Submodules +---------- + +diffpy.morph.pdfplot module +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.morph.pdfplot + :members: + :undoc-members: + :show-inheritance: + +diffpy.morph.morph_api module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.morph.morph_api + :members: + :undoc-members: + :show-inheritance: + +diffpy.morph.refine module +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.morph.refine + :members: + :undoc-members: + :show-inheritance: + +diffpy.morph.tools module +^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.morph.tools + :members: + :undoc-members: + :show-inheritance: + +diffpy.morph.morph_io module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.morph.morph_io + :members: + :undoc-members: + :show-inheritance: + +diffpy.morph.log module +^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.morph.log + :members: + :undoc-members: + :show-inheritance: + +diffpy.morph.morphapp module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.morph.morphapp + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/source/api/diffpy.pdfmorph.morph_helpers.rst b/doc/source/api/diffpy.pdfmorph.morph_helpers.rst deleted file mode 100644 index ccc7f6b2..00000000 --- a/doc/source/api/diffpy.pdfmorph.morph_helpers.rst +++ /dev/null @@ -1,28 +0,0 @@ -:tocdepth: -1 - -diffpy.pdfmorph.morph_helpers package -===================================== - -.. automodule:: diffpy.pdfmorph.morph_helpers - :members: - :undoc-members: - :show-inheritance: - -Submodules ----------- - -diffpy.pdfmorph.morph_helpers.transformpdftordf module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.pdfmorph.morph_helpers.transformpdftordf - :members: - :undoc-members: - :show-inheritance: - -diffpy.pdfmorph.morph_helpers.transformrdftopdf module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.pdfmorph.morph_helpers.transformrdftopdf - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/source/api/diffpy.pdfmorph.morphs.rst b/doc/source/api/diffpy.pdfmorph.morphs.rst deleted file mode 100644 index a69f5eb7..00000000 --- a/doc/source/api/diffpy.pdfmorph.morphs.rst +++ /dev/null @@ -1,92 +0,0 @@ -:tocdepth: -1 - -diffpy.pdfmorph.morphs package -============================== - -.. automodule:: diffpy.pdfmorph.morphs - :members: - :undoc-members: - :show-inheritance: - -Submodules ----------- - -diffpy.pdfmorph.morphs.morphishape module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.pdfmorph.morphs.morphishape - :members: - :undoc-members: - :show-inheritance: - -diffpy.pdfmorph.morphs.morphchain module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.pdfmorph.morphs.morphchain - :members: - :undoc-members: - :show-inheritance: - -diffpy.pdfmorph.morphs.morphresolution module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.pdfmorph.morphs.morphresolution - :members: - :undoc-members: - :show-inheritance: - -diffpy.pdfmorph.morphs.morphshape module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.pdfmorph.morphs.morphshape - :members: - :undoc-members: - :show-inheritance: - -diffpy.pdfmorph.morphs.morphshift module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.pdfmorph.morphs.morphshift - :members: - :undoc-members: - :show-inheritance: - -diffpy.pdfmorph.morphs.morph module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.pdfmorph.morphs.morph - :members: - :undoc-members: - :show-inheritance: - -diffpy.pdfmorph.morphs.morphrgrid module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.pdfmorph.morphs.morphrgrid - :members: - :undoc-members: - :show-inheritance: - -diffpy.pdfmorph.morphs.morphsmear module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.pdfmorph.morphs.morphsmear - :members: - :undoc-members: - :show-inheritance: - -diffpy.pdfmorph.morphs.morphstretch module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.pdfmorph.morphs.morphstretch - :members: - :undoc-members: - :show-inheritance: - -diffpy.pdfmorph.morphs.morphscale module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.pdfmorph.morphs.morphscale - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/source/api/diffpy.pdfmorph.rst b/doc/source/api/diffpy.pdfmorph.rst deleted file mode 100644 index 57178852..00000000 --- a/doc/source/api/diffpy.pdfmorph.rst +++ /dev/null @@ -1,77 +0,0 @@ -: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..aad111d5 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# diffpy.pdfmorph documentation build configuration file, created by +# diffpy.morph 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 @@ -63,7 +63,7 @@ master_doc = "index" # General information about the project. -project = "diffpy.pdfmorph" +project = "diffpy.morph" 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 @@ -113,7 +113,7 @@ pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. -modindex_common_prefix = ["diffpy.pdfmorph"] +modindex_common_prefix = ["diffpy.morph"] # Display all warnings for missing links. nitpicky = True @@ -204,7 +204,7 @@ # html_file_suffix = None # Output file base name for HTML help builder. -basename = "diffpy.pdfmorph".replace(" ", "").replace(".", "") +basename = "diffpy.morph".replace(" ", "").replace(".", "") htmlhelp_basename = basename + "doc" @@ -225,8 +225,8 @@ latex_documents = [ ( "index", - "diffpy.pdfmorph.tex", - "diffpy.pdfmorph Documentation", + "diffpy.morph.tex", + "diffpy.morph Documentation", ab_authors, "manual", ), @@ -260,8 +260,8 @@ man_pages = [ ( "index", - "diffpy.pdfmorph", - "diffpy.pdfmorph Documentation", + "diffpy.morph", + "diffpy.morph Documentation", ab_authors, 1, ) @@ -279,10 +279,10 @@ texinfo_documents = [ ( "index", - "diffpy.pdfmorph", - "diffpy.pdfmorph Documentation", + "diffpy.morph", + "diffpy.morph Documentation", ab_authors, - "diffpy.pdfmorph", + "diffpy.morph", "One line description of project.", "Miscellaneous", ), diff --git a/doc/source/index.rst b/doc/source/index.rst index eebd5462..a01474da 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -1,8 +1,8 @@ ############################################# -diffpy.pdfmorph documentation +diffpy.morph documentation ############################################# -diffpy.pdfmorph - Tools for manipulating and comparing PDF profiles. +diffpy.morph - Tools for manipulating and comparing diffraction data. | Software version |release|. | Last updated |today|. @@ -10,7 +10,7 @@ diffpy.pdfmorph - Tools for manipulating and comparing PDF profiles. Introduction ++++++++++++ -``PDFmorph`` is a Python package that increases the insight +``diffpy.morph`` 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 @@ -20,45 +20,45 @@ 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 +scale due to differences in incident flux, for example. ``diffpy.morph`` 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 +"scaling" (self-explanatory). ``diffpy.morph`` 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 +If no morphing transformation is specified, ``diffpy.morph`` will return just the plotted PDFs. -Finally, we note that though ``PDFmorph`` should work on other spectra +Finally, we note that though ``diffpy.morph`` 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>` +To get started, please download our :download:`user manual <../manual/diffpy.morph.pdf>` or visit the :ref:`quick_start`. ======= Authors ======= -``PDFmorph`` is developed by members of the Billinge Group at +``diffpy.morph`` 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. +https://github.com/diffpy/diffpy.morph/graphs/contributors. ============ Installation ============ -See the `README `_ +See the `README `_ file included with the distribution. ================= @@ -70,7 +70,7 @@ Table of contents quickstart license release - Package API + Package API ======= Indices diff --git a/doc/source/quickstart.rst b/doc/source/quickstart.rst index dcf21c2a..146862c8 100644 --- a/doc/source/quickstart.rst +++ b/doc/source/quickstart.rst @@ -1,11 +1,11 @@ .. _quick_start: -PDFmorph Tutorial -################# +diffpy.morph Tutorial +##################### -Welcome! This will be a quick tutorial to accquaint users with PDFmorph +Welcome! This will be a quick tutorial to accquaint users with ``diffpy.morph`` and some of what it can do. For a more detailed tutorial, check out -our :download:`user manual <../manual/pdfmorph.pdf>`. +our :download:`user manual <../manual/diffpy.morph.pdf>`. As we described in the README and installation instructions, please make sure that you are familiar with working with your command line terminal @@ -14,22 +14,22 @@ before using this application. Before you've started this tutorial, please ensure that you've installed all necessary software and dependencies. -Basic PDFmorph Workflow -======================= +Basic diffpy.morph Workflow +=========================== 1. Open your Terminal or Command Prompt. - 2. If it's not active already, activate your PDFmorph-equipped + 2. If it's not active already, activate your diffpy.morph-equipped conda environment by typing in :: - conda activate + conda activate * If you need to list your available conda environments, run the command ``conda info --envs`` or ``conda env list`` - * Run the ``pdfmorph --help`` command and read over the + * Run the ``diffpy.morph --help`` command and read over the info on that page for a brief overview of some of what we will explore in this tutorial. @@ -54,31 +54,31 @@ Basic PDFmorph Workflow those generated by the `PDFgui `_ program. - 4. First, we will run the PDFmorph application without any morphing + 4. First, we will run the ``diffpy.morph`` application without any morphing and only using one PDF. Type the following command into your command line :: - pdfmorph darkSub_rh20_C_01.gr darkSub_rh20_C_01.gr + diffpy.morph darkSub_rh20_C_01.gr darkSub_rh20_C_01.gr This should produce two PDF curves which are congruent, resulting in a flat green line underneath them. - 5. Now, we will see PDFmorph run with two different PDFs and no + 5. Now, we will see ``diffpy.morph`` run with two different PDFs and no morphing. Type the following command into your command line :: - pdfmorph darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr + diffpy.morph darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr Without morphing, the difference Rw = 0.407. This indicates that the two PDFs vary drastically. - * While running the ``pdfmorph`` command, it is important + * While running the ``diffpy.morph`` command, it is important to remember that the first PDF file argument you provide (in this case, ``darkSub_rh20_C_01.gr``) is the PDF which will get morphed, while the second PDF file argument you provide (here, ``darkSub_rh20_C_44.gr``) is the PDF which acts as the model and does not get morphed. Hereinafter, we will refer to the first PDF argument as the "morph" - and the second as the "target", as the PDFmorph display + and the second as the "target", as the ``diffpy.morph`` display does. 6. Now, we will start the morphing process, which requires us to @@ -86,30 +86,30 @@ Basic PDFmorph Workflow and stretch, separately. We will start with the scaling factor. Begin by typing the command :: - pdfmorph --scale=2 -a darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr + diffpy.morph --scale=2 -a darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr Now, the difference Rw = 1.457, a significant increase from our value previously. We must modify our initial value for the scaling factor and do so until we see a reduction in the difference Rw from the unmorphed value. Type :: - pdfmorph --scale=0.9 -a darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr + diffpy.morph --scale=0.9 -a darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr The difference Rw is now 0.351, lower than our unmorphed - example's value. To see PDFmorph optimize the scale factor, + example's value. To see ``diffpy.morph`` optimize the scale factor, simply drop ``-a`` from the command and type :: - pdfmorph --scale=0.9 darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr + diffpy.morph --scale=0.9 darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr - PDFmorph, given a reasonable initial guess, will use find the + ``diffpy.morph``, given a reasonable initial guess, will use find the optimal value for each morphing feature. Here, we see that - PDFmorph displays ``scale = 0.799025`` in the command prompt, + ``diffpy.morph`` displays ``scale = 0.799025`` in the command prompt, meaning that it has found this to be the most optimal value for the scale factor. The difference Rw = 0.330, indicating a better fit than our reasonable initial guess. * It is the choice of the user whether or not to run values - before removing ``-a`` when analyzing data with PDFmorph. + before removing ``-a`` when analyzing data with ``diffpy.morph``. By including it, you allow the possibility to move towards convergence before allowing the program to optimize by removing it; when including it, you may reach a highly @@ -120,10 +120,10 @@ Basic PDFmorph Workflow 7. Now, we will examine the Gaussian smearing factor. We provide an initial guess by typing :: - pdfmorph --scale=0.8 --smear=0.5 -a darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr + diffpy.morph --scale=0.8 --smear=0.5 -a darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr And viewing the results. We've tailored our scale factor to be - close to the value given by PDFmorph, but see that the difference + close to the value given by ``diffpy.morph``, but see that the difference Rw has increased substantially due to our smear value. One approach, as described above, is to remove the ``-a`` from the above command and run it again. @@ -137,7 +137,7 @@ Basic PDFmorph Workflow an effect, we restrict the ``rmin`` and ``rmax`` values to reflect relevant data range by typing :: - pdfmorph --scale=0.8 --smear=0.5 --rmin=1.5 --rmax=30 darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr + diffpy.morph --scale=0.8 --smear=0.5 --rmin=1.5 --rmax=30 darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr Now, we see that the difference Rw = 0.204 and that the optimized ``smear=-0.084138``. @@ -153,7 +153,7 @@ Basic PDFmorph Workflow 8. Finally, we will examine the stretch factor. Provide an initial guess by typing :: - pdfmorph --scale=0.8 --smear=-0.08 --stretch=0.5 --rmin=1.5 --rmax=30 -a darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr + diffpy.morph --scale=0.8 --smear=-0.08 --stretch=0.5 --rmin=1.5 --rmax=30 -a darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr And noting that the difference has increased. Before continuing, see if you can see which direction (higher or lower) our initial @@ -162,7 +162,7 @@ Basic PDFmorph Workflow If you cannot, type :: - pdfmorph --scale=0.8 --smear=-0.08 --stretch=0.005 --rmin=1.5 --rmax=30 -a darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr + diffpy.morph --scale=0.8 --smear=-0.08 --stretch=0.005 --rmin=1.5 --rmax=30 -a darkSub_rh20_C_01.gr darkSub_rh20_C_44.gr to observe decreased difference and then remove ``-a`` to see the optimized ``--stretch=0.001762``. We have now reached @@ -176,14 +176,14 @@ Basic PDFmorph Workflow Enjoy the software! -.. Additional PDFmorph Functionality/Exploration -.. --------------------------------------------- +.. Additional diffpy.morph Functionality/Exploration +.. ------------------------------------------------- .. TODO include undoped PDF example Extra Tutorials =============== -PDFmorph has some more functionalities not showcased in the basic workflow above -(see `pdfmorph --help` for an overview of these functionalities). +``diffpy.morph`` has some more functionalities not showcased in the basic workflow above +(see `diffpy.morph --help` for an overview of these functionalities). Tutorials for these additional functionalities are included below. Additional files for these tutorials can be downloaded :download:`here <../../tutorial/additionalData.zip>`. @@ -194,7 +194,7 @@ Performing Multiple Morphs It may be useful to morph a PDF against multiple targets: for example, you may want to morph a PDF against multiple PDFs measured at various temperatures to determine whether a phase change has occurred. -PDFmorph currently allows users to morph a PDF against all files in a +``diffpy.morph`` currently allows users to morph a PDF against all files in a selected directory and plot resulting :math:`R_w` values from each morph. 1. Within the ``additionalData`` directory, ``cd`` into the ``morphMultiple`` directory. @@ -203,7 +203,7 @@ selected directory and plot resulting :math:`R_w` values from each morph. 2. Let us start by getting the Rw of ``SrFe2As2_150K.gr`` compared to all other files in the directory. Run :: - pdfmorph SrFe2As2_150K.gr . --multiple-targets + diffpy.morph SrFe2As2_150K.gr . --multiple-targets The multiple tag indicates we are comparing PDF file (first input) against all PDFs in a directory (second input). Our choice of file was ``SeFe2As2_150K.gr`` @@ -211,7 +211,7 @@ selected directory and plot resulting :math:`R_w` values from each morph. 3. After running this, we get chart of Rw values for each target file. However, this chart can be a bit confusing to interpret. To get a more understandable plot, run :: - pdfmorph SrFe2As2_150K.gr . --multiple-targets --sort-by=temperature + diffpy.morph SrFe2As2_150K.gr . --multiple-targets --sort-by=temperature This plots the Rw against the temperature parameter value provided at the top of each file. Parameters are entries of the form `` = `` and are located @@ -220,7 +220,7 @@ selected directory and plot resulting :math:`R_w` values from each morph. To confirm, let us now apply morphs onto ``SrFe2As2_150K.gr`` with all other files in ``morphMultiple`` as targets :: - pdfmorph --scale=1 --stretch=0 SrFe2As2_150K.gr . --multiple-targets --sort-by=temperature + diffpy.morph --scale=1 --stretch=0 SrFe2As2_150K.gr . --multiple-targets --sort-by=temperature Note that we are not applying a smear since it takes a long time to apply and does not significantly change the Rw values in this example. @@ -237,7 +237,7 @@ Nanoparticle Shape Effects -------------------------- A nanoparticle's finite size and shape can affect the shape of its PDF. -We can use PDFmorph to morph a bulk material PDF to simulate these shape effects. +We can use ``diffpy.morph`` to morph a bulk material PDF to simulate these shape effects. Currently, the supported nanoparticle shapes include: spheres and spheroids. * Within the ``additionalData`` directory, ``cd`` into the ``morphShape`` subdirectory. @@ -251,14 +251,14 @@ Currently, the supported nanoparticle shapes include: spheres and spheroids. 1. The ``Ni_nano_sphere.cgr`` file contains a generated spherical nanoparticle with unknown radius. First, let us plot ``Ni_blk.gr`` against ``Ni_nano_sphere.cgr`` :: - pdfmorph Ni_bulk.gr Ni_nano_sphere.cgr + diffpy.morph Ni_bulk.gr Ni_nano_sphere.cgr Despite the two being the same material, the Rw is quite large. To reduce the Rw, we will apply spherical shape effects onto the PDF. However, in order to do so, we first need the radius of the spherical nanoparticle. 2. To get the radius, we can first observe a plot of ``Ni_nano_sphere.cgr`` :: - pdfmorph Ni_nano_sphere.cgr Ni_nano_sphere.cgr + diffpy.morph Ni_nano_sphere.cgr Ni_nano_sphere.cgr 3. Nanoparticles tend to have broader peaks at r-values larger than the particle size, corresponding to the much weaker correlations between molecules. @@ -267,23 +267,23 @@ Currently, the supported nanoparticle shapes include: spheres and spheroids. The approximate radius of a sphere would be half of that, or 11.2. 4. Now, we are ready to perform a morph applying spherical effects. To do so, we use the ``--radius`` parameter :: - pdfmorph Ni_bulk.gr Ni_nano_sphere.cgr --radius=11.2 -a + diffpy.morph Ni_bulk.gr Ni_nano_sphere.cgr --radius=11.2 -a 5. We can see that the Rw value has significantly decreased from before. Run without the ``-a`` tag to refine :: - pdfmorph Ni_bulk.gr Ni_nano_sphere.cgr --radius=11.2 + diffpy.morph Ni_bulk.gr Ni_nano_sphere.cgr --radius=11.2 6. After refining, we see the actual radius of the nanoparticle was closer to 12. * Spheroidal Shape 1. The ``Ni_nano_spheroid.cgr`` file contains a calculated spheroidal Ni nanoparticle. Again, we can begin by plotting the bulk material against our nanoparticle :: - pdfmorph Ni_bulk.gr Ni_nano_spheroid.cgr + diffpy.morph Ni_bulk.gr Ni_nano_spheroid.cgr 2. Inside the ``Ni_nano_spheroid.cgr`` file, we are given that the equatorial radius is 12 and polar radius is 6. This is enough information to define our spheroid. To apply spheroid shape effects onto our bulk, run :: - pdfmorph Ni_bulk.gr Ni_nano_spheroid.cgr --radius=12 --pradius=6 -a + diffpy.morph Ni_bulk.gr Ni_nano_spheroid.cgr --radius=12 --pradius=6 -a Note that the equatorial radius corresponds to the ``--radius`` parameter and polar radius to ``--pradius``. 3. Remove the ``-a`` tag to refine. diff --git a/environment.yml b/environment.yml index a46b257d..582b2ccc 100644 --- a/environment.yml +++ b/environment.yml @@ -1,4 +1,4 @@ -name: diffpy.pdfmorph +name: diffpy.morph channels: - conda-forge dependencies: diff --git a/news/diffpy_morph.rst b/news/diffpy_morph.rst new file mode 100644 index 00000000..52beb663 --- /dev/null +++ b/news/diffpy_morph.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* Renamed PDFmorph to diffpy.morph + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* diff --git a/pyproject.toml b/pyproject.toml index 7618ba13..f007f315 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=62.0", "setuptools-git-versioning>=2.0"] build-backend = "setuptools.build_meta" [project] -name = "diffpy.pdfmorph" +name = "diffpy.morph" dynamic=['version', 'dependencies'] authors = [ { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, @@ -33,11 +33,11 @@ classifiers = [ ] [project.scripts] -pdfmorph = "diffpy.pdfmorph.pdfmorphapp:main" +"diffpy.morph" = "diffpy.morph.morphapp:main" [project.urls] -Homepage = "https://github.com/diffpy/diffpy.pdfmorph/" -Issues = "https://github.com/diffpy/diffpy.pdfmorph/issues/" +Homepage = "https://github.com/diffpy/diffpy.morph/" +Issues = "https://github.com/diffpy/diffpy.morph/issues/" [tool.setuptools-git-versioning] enabled = true diff --git a/src/diffpy/__init__.py b/src/diffpy/__init__.py index 5a43b52f..38fef756 100644 --- a/src/diffpy/__init__.py +++ b/src/diffpy/__init__.py @@ -13,7 +13,7 @@ # ############################################################################## -"""pdfmorph - tools for manipulating and comparing PDF data. +"""morph - tools for manipulating and comparing PDF data. """ diff --git a/src/diffpy/pdfmorph/__init__.py b/src/diffpy/morph/__init__.py similarity index 86% rename from src/diffpy/pdfmorph/__init__.py rename to src/diffpy/morph/__init__.py index db1b45ee..b1006e3c 100644 --- a/src/diffpy/pdfmorph/__init__.py +++ b/src/diffpy/morph/__init__.py @@ -7,7 +7,7 @@ # File coded by: Billinge Group members and community contributors. # # See GitHub contributions for a more detailed list of contributors. -# https://github.com/diffpy/diffpy.pdfmorph/graphs/contributors +# https://github.com/diffpy/diffpy.morph/graphs/contributors # # See LICENSE.rst for license information. # @@ -19,7 +19,7 @@ __save_morph_as__ = "save_morph_as" # package version -from diffpy.pdfmorph.version import __version__ +from diffpy.morph.version import __version__ # silence the pyflakes syntax checker assert __version__ or True diff --git a/src/diffpy/pdfmorph/log.py b/src/diffpy/morph/log.py similarity index 89% rename from src/diffpy/pdfmorph/log.py rename to src/diffpy/morph/log.py index 945f1a73..7e49af6b 100644 --- a/src/diffpy/pdfmorph/log.py +++ b/src/diffpy/morph/log.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfmorph by DANSE Diffraction group +# diffpy.morph by DANSE Diffraction group # Simon J. L. Billinge # (c) 2010 Trustees of the Columbia University # in the City of New York. All rights reserved. @@ -23,11 +23,11 @@ import logging # logging configuration -plog = logging.getLogger("diffpy.pdfmorph") +plog = logging.getLogger("diffpy.morph") def set_verbosity(vb): - """Set verbosity of the pdfmorph logger. + """Set verbosity of the diffpy.morph logger. Parameters ---------- diff --git a/src/diffpy/pdfmorph/pdfmorph_api.py b/src/diffpy/morph/morph_api.py similarity index 95% rename from src/diffpy/pdfmorph/pdfmorph_api.py rename to src/diffpy/morph/morph_api.py index d87249d7..65b0fa66 100644 --- a/src/diffpy/pdfmorph/pdfmorph_api.py +++ b/src/diffpy/morph/morph_api.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfmorph by DANSE Diffraction group +# diffpy.morph by DANSE Diffraction group # Simon J. L. Billinge # (c) 2018 Trustees of the Columbia University # in the City of New York. All rights reserved. @@ -24,9 +24,9 @@ import matplotlib.pyplot as plt -from diffpy.pdfmorph import morph_helpers, morphs -from diffpy.pdfmorph import refine as ref -from diffpy.pdfmorph import tools +from diffpy.morph import morph_helpers, morphs +from diffpy.morph import refine as ref +from diffpy.morph import tools # map of operation dict # TODO: include morphing on psize @@ -73,7 +73,7 @@ def morph_default_config(**kwargs): return rv -def pdfmorph( +def morph( x_morph, y_morph, x_target, @@ -141,7 +141,7 @@ def pdfmorph( morph_rv_dict: dict A dictionary contains following key-value pairs: - - morph_chain: diffpy.pdfmorph.morphs.morphchain.MorphChain + - morph_chain: diffpy.morph.morphs.morphchain.MorphChain The instance of processed morph chain. Calling ``x_morph, y_morph, x_target, y_target = morph_chain.xyallout`` @@ -158,11 +158,11 @@ def pdfmorph( Examples -------- # morphing (x_morph, y_morph) pair to (x_target, y_target) pair with - scaling from diffpy.pdfmorph.pdfmorph_api import pdfmorph, + scaling from diffpy.morph.morph_api import morph, morph_default_config, plot_morph morph_cfg = morph_default_config(scale=1.01) - morph_rv_dict = pdfmorph(x_morph, y_morph, x_target, y_target, **morph_cfg) + morph_rv_dict = morph(x_morph, y_morph, x_target, y_target, **morph_cfg) # plot morhing result plot_morph(morph_rv_dict['morph_chain']) @@ -256,7 +256,7 @@ def plot_morph(chain, ax=None, **kwargs): Parameters ---------- - chain: diffpy.pdfmorph.morphs.morphchain.MorphChain + chain: diffpy.morph.morphs.morphchain.MorphChain An instance of processed morph chain. ax: matplotlib.axes.Axes, optional An instance of Axes class to plot the morphing result. diff --git a/src/diffpy/pdfmorph/morph_helpers/__init__.py b/src/diffpy/morph/morph_helpers/__init__.py similarity index 80% rename from src/diffpy/pdfmorph/morph_helpers/__init__.py rename to src/diffpy/morph/morph_helpers/__init__.py index 271ba4f9..b0d8ccf6 100644 --- a/src/diffpy/pdfmorph/morph_helpers/__init__.py +++ b/src/diffpy/morph/morph_helpers/__init__.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfmorph by DANSE Diffraction group +# diffpy.morph by DANSE Diffraction group # Simon J. L. Billinge # (c) 2010 Trustees of the Columbia University # in the City of New York. All rights reserved. @@ -14,10 +14,10 @@ """List of helpers for certain morphing operations (currently only used for smear).""" -from diffpy.pdfmorph.morph_helpers.transformpdftordf import ( +from diffpy.morph.morph_helpers.transformpdftordf import ( TransformXtalPDFtoRDF, ) -from diffpy.pdfmorph.morph_helpers.transformrdftopdf import ( +from diffpy.morph.morph_helpers.transformrdftopdf import ( TransformXtalRDFtoPDF, ) diff --git a/src/diffpy/pdfmorph/morph_helpers/transformpdftordf.py b/src/diffpy/morph/morph_helpers/transformpdftordf.py similarity index 93% rename from src/diffpy/pdfmorph/morph_helpers/transformpdftordf.py rename to src/diffpy/morph/morph_helpers/transformpdftordf.py index 91acf26a..556edcbf 100644 --- a/src/diffpy/pdfmorph/morph_helpers/transformpdftordf.py +++ b/src/diffpy/morph/morph_helpers/transformpdftordf.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfmorph by DANSE Diffraction group +# diffpy.morph by DANSE Diffraction group # Simon J. L. Billinge # (c) 2010 Trustees of the Columbia University # in the City of New York. All rights reserved. @@ -18,7 +18,7 @@ """ -from diffpy.pdfmorph.morphs.morph import LABEL_GR, LABEL_RA, LABEL_RR, Morph +from diffpy.morph.morphs.morph import LABEL_GR, LABEL_RA, LABEL_RR, Morph class TransformXtalPDFtoRDF(Morph): diff --git a/src/diffpy/pdfmorph/morph_helpers/transformrdftopdf.py b/src/diffpy/morph/morph_helpers/transformrdftopdf.py similarity index 94% rename from src/diffpy/pdfmorph/morph_helpers/transformrdftopdf.py rename to src/diffpy/morph/morph_helpers/transformrdftopdf.py index 58bf958f..4dce9731 100644 --- a/src/diffpy/pdfmorph/morph_helpers/transformrdftopdf.py +++ b/src/diffpy/morph/morph_helpers/transformrdftopdf.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfmorph by DANSE Diffraction group +# diffpy.morph by DANSE Diffraction group # Simon J. L. Billinge # (c) 2010 Trustees of the Columbia University # in the City of New York. All rights reserved. @@ -20,7 +20,7 @@ import numpy -from diffpy.pdfmorph.morphs.morph import LABEL_GR, LABEL_RA, LABEL_RR, Morph +from diffpy.morph.morphs.morph import LABEL_GR, LABEL_RA, LABEL_RR, Morph class TransformXtalRDFtoPDF(Morph): diff --git a/src/diffpy/pdfmorph/pdfmorph_io.py b/src/diffpy/morph/morph_io.py similarity index 96% rename from src/diffpy/pdfmorph/pdfmorph_io.py rename to src/diffpy/morph/morph_io.py index e454b1dc..e488fe24 100644 --- a/src/diffpy/pdfmorph/pdfmorph_io.py +++ b/src/diffpy/morph/morph_io.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfmorph by DANSE Diffraction group +# diffpy.morph by DANSE Diffraction group # Simon J. L. Billinge # (c) 2010 Trustees of the Columbia University # in the City of New York. All rights reserved. @@ -21,8 +21,8 @@ import numpy -import diffpy.pdfmorph.tools as tools -from diffpy.pdfmorph import __save_morph_as__ +import diffpy.morph.tools as tools +from diffpy.morph import __save_morph_as__ def single_morph_output( @@ -78,7 +78,7 @@ def single_morph_output( # Saving to file if save_file is not None: path_name = str(Path(morph_file).resolve()) - header = "# PDF created by pdfmorph\n" + header = "# PDF created by diffpy.morph\n" header += f"# from {path_name}" header_verbose = f"{morphs_in}\n{morphs_out}" @@ -109,14 +109,14 @@ def create_morphs_directory(save_directory): """Create a directory for saving multiple morphed PDFs. Takes in a user-given path to a directory save_directory and create a - subdirectory named Morphs. PDFmorph will save all morphs into the Morphs + subdirectory named Morphs. diffpy.morph will save all morphs into the Morphs subdirectory while metadata about the morphs will be stored in save_directory outside Morphs. Parameters ---------- save_directory - Path to a directory. PDFmorph will save all generated files within + Path to a directory. diffpy.morph will save all generated files within this directory. Returns @@ -222,7 +222,7 @@ def multiple_morph_output( Otherwise, leave blank. field_list: list List of field values for each target PDF. - Generated by diffpy.pdfmorph.tools.field_sort(). + Generated by diffpy.morph.tools.field_sort(). morph_file Name of the morphed PDF file. Required to give summary data after saving to a directory. @@ -296,7 +296,7 @@ def multiple_morph_output( morph_path_name = str(Path(morph_file).resolve()) target_path_name = str(Path(target_directory).resolve()) - header = "# Data generated by pdfmorph\n" + header = "# Data generated by diffpy.morph\n" if not mm: header += f"# from morphing {morph_path_name}\n" header += f"# with target directory {target_path_name}" diff --git a/src/diffpy/pdfmorph/pdfmorphapp.py b/src/diffpy/morph/morphapp.py similarity index 98% rename from src/diffpy/pdfmorph/pdfmorphapp.py rename to src/diffpy/morph/morphapp.py index c8280897..4e238a28 100755 --- a/src/diffpy/pdfmorph/pdfmorphapp.py +++ b/src/diffpy/morph/morphapp.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfmorph by DANSE Diffraction group +# diffpy.morph by DANSE Diffraction group # Simon J. L. Billinge # (c) 2010 Trustees of the Columbia University # in the City of New York. All rights reserved. @@ -18,14 +18,14 @@ import sys from pathlib import Path -import diffpy.pdfmorph.morph_helpers as helpers -import diffpy.pdfmorph.morphs as morphs -import diffpy.pdfmorph.pdfmorph_io as io -import diffpy.pdfmorph.pdfplot as pdfplot -import diffpy.pdfmorph.refine as refine -import diffpy.pdfmorph.tools as tools -from diffpy.pdfmorph import __save_morph_as__ -from diffpy.pdfmorph.version import __version__ +import diffpy.morph.morph_helpers as helpers +import diffpy.morph.morphs as morphs +import diffpy.morph.morph_io as io +import diffpy.morph.pdfplot as pdfplot +import diffpy.morph.refine as refine +import diffpy.morph.tools as tools +from diffpy.morph import __save_morph_as__ +from diffpy.morph.version import __version__ def create_option_parser(): @@ -59,8 +59,8 @@ def custom_error(self, msg): [ "Please report bugs to diffpy-users@googlegroups.com.", ( - "For more information, see the PDFmorph website at " - "https://www.diffpy.org/diffpy.pdfmorph." + "For more information, see the diffpy.morph website at " + "https://www.diffpy.org/diffpy.morph." ), ] ), @@ -371,7 +371,7 @@ def custom_error(self, msg): "as follows: each target PDF is an entry in NAMESFILE. For each " "entry, there should be a key {__save_morph_as__} whose value " "specifies the name to save the manipulated PDF as. An example " - ".json serial file is shown in the PDFmorph manual." + ".json serial file is shown in the diffpy.morph manual." ), ) group.add_option( @@ -987,7 +987,7 @@ def multiple_morphs(parser, opts, pargs, stdout_flag=True): def getPDFFromFile(fn): - from diffpy.pdfmorph.tools import readPDF + from diffpy.morph.tools import readPDF try: r, gr = readPDF(fn) diff --git a/src/diffpy/pdfmorph/morphs/__init__.py b/src/diffpy/morph/morphs/__init__.py similarity index 52% rename from src/diffpy/pdfmorph/morphs/__init__.py rename to src/diffpy/morph/morphs/__init__.py index 37c5d4ef..3cc0fdc9 100644 --- a/src/diffpy/pdfmorph/morphs/__init__.py +++ b/src/diffpy/morph/morphs/__init__.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfmorph by DANSE Diffraction group +# diffpy.morph by DANSE Diffraction group # Simon J. L. Billinge # (c) 2010 Trustees of the Columbia University # in the City of New York. All rights reserved. @@ -17,16 +17,16 @@ """ -from diffpy.pdfmorph.morphs.morph import Morph # noqa: F401 -from diffpy.pdfmorph.morphs.morphchain import MorphChain # noqa: F401 -from diffpy.pdfmorph.morphs.morphishape import MorphISphere, MorphISpheroid -from diffpy.pdfmorph.morphs.morphresolution import MorphResolutionDamping -from diffpy.pdfmorph.morphs.morphrgrid import MorphRGrid -from diffpy.pdfmorph.morphs.morphscale import MorphScale -from diffpy.pdfmorph.morphs.morphshape import MorphSphere, MorphSpheroid -from diffpy.pdfmorph.morphs.morphshift import MorphShift -from diffpy.pdfmorph.morphs.morphsmear import MorphSmear -from diffpy.pdfmorph.morphs.morphstretch import MorphStretch +from diffpy.morph.morphs.morph import Morph # noqa: F401 +from diffpy.morph.morphs.morphchain import MorphChain # noqa: F401 +from diffpy.morph.morphs.morphishape import MorphISphere, MorphISpheroid +from diffpy.morph.morphs.morphresolution import MorphResolutionDamping +from diffpy.morph.morphs.morphrgrid import MorphRGrid +from diffpy.morph.morphs.morphscale import MorphScale +from diffpy.morph.morphs.morphshape import MorphSphere, MorphSpheroid +from diffpy.morph.morphs.morphshift import MorphShift +from diffpy.morph.morphs.morphsmear import MorphSmear +from diffpy.morph.morphs.morphstretch import MorphStretch # List of morphs morphs = [ diff --git a/src/diffpy/pdfmorph/morphs/morph.py b/src/diffpy/morph/morphs/morph.py similarity index 99% rename from src/diffpy/pdfmorph/morphs/morph.py rename to src/diffpy/morph/morphs/morph.py index 73a6f617..0b7cb543 100644 --- a/src/diffpy/pdfmorph/morphs/morph.py +++ b/src/diffpy/morph/morphs/morph.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfmorph by DANSE Diffraction group +# diffpy.morph by DANSE Diffraction group # Simon J. L. Billinge # (c) 2010 Trustees of the Columbia University # in the City of New York. All rights reserved. diff --git a/src/diffpy/pdfmorph/morphs/morphchain.py b/src/diffpy/morph/morphs/morphchain.py similarity index 99% rename from src/diffpy/pdfmorph/morphs/morphchain.py rename to src/diffpy/morph/morphs/morphchain.py index 4882c547..1dc05b41 100644 --- a/src/diffpy/pdfmorph/morphs/morphchain.py +++ b/src/diffpy/morph/morphs/morphchain.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfmorph by DANSE Diffraction group +# diffpy.morph by DANSE Diffraction group # Simon J. L. Billinge # (c) 2010 Trustees of the Columbia University # in the City of New York. All rights reserved. diff --git a/src/diffpy/pdfmorph/morphs/morphishape.py b/src/diffpy/morph/morphs/morphishape.py similarity index 92% rename from src/diffpy/pdfmorph/morphs/morphishape.py rename to src/diffpy/morph/morphs/morphishape.py index 91e24a2a..5cf3da91 100644 --- a/src/diffpy/pdfmorph/morphs/morphishape.py +++ b/src/diffpy/morph/morphs/morphishape.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfmorph by DANSE Diffraction group +# diffpy.morph by DANSE Diffraction group # Simon J. L. Billinge # (c) 2010 Trustees of the Columbia University # in the City of New York. All rights reserved. @@ -21,8 +21,8 @@ class MorphISpheroid -- apply inverse spheroidal shape function import numpy -from diffpy.pdfmorph.morphs.morph import LABEL_GR, LABEL_RA, Morph -from diffpy.pdfmorph.morphs.morphshape import _sphericalCF, _spheroidalCF +from diffpy.morph.morphs.morph import LABEL_GR, LABEL_RA, Morph +from diffpy.morph.morphs.morphshape import _sphericalCF, _spheroidalCF class MorphISphere(Morph): diff --git a/src/diffpy/pdfmorph/morphs/morphresolution.py b/src/diffpy/morph/morphs/morphresolution.py similarity index 92% rename from src/diffpy/pdfmorph/morphs/morphresolution.py rename to src/diffpy/morph/morphs/morphresolution.py index e0011590..a7246ad3 100644 --- a/src/diffpy/pdfmorph/morphs/morphresolution.py +++ b/src/diffpy/morph/morphs/morphresolution.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfmorph by DANSE Diffraction group +# diffpy.morph by DANSE Diffraction group # Simon J. L. Billinge # (c) 2010 Trustees of the Columbia University # in the City of New York. All rights reserved. @@ -20,7 +20,7 @@ import numpy -from diffpy.pdfmorph.morphs.morph import LABEL_RA, LABEL_RR, Morph +from diffpy.morph.morphs.morph import LABEL_RA, LABEL_RR, Morph class MorphResolutionDamping(Morph): diff --git a/src/diffpy/pdfmorph/morphs/morphrgrid.py b/src/diffpy/morph/morphs/morphrgrid.py similarity index 96% rename from src/diffpy/pdfmorph/morphs/morphrgrid.py rename to src/diffpy/morph/morphs/morphrgrid.py index 60808eaa..dc9b68d3 100644 --- a/src/diffpy/pdfmorph/morphs/morphrgrid.py +++ b/src/diffpy/morph/morphs/morphrgrid.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfmorph by DANSE Diffraction group +# diffpy.morph by DANSE Diffraction group # Simon J. L. Billinge # (c) 2010 Trustees of the Columbia University # in the City of New York. All rights reserved. @@ -20,7 +20,7 @@ import numpy -from diffpy.pdfmorph.morphs.morph import LABEL_GR, LABEL_RA, Morph +from diffpy.morph.morphs.morph import LABEL_GR, LABEL_RA, Morph # roundoff tolerance for selecting bounds on arrays. epsilon = 1e-8 diff --git a/src/diffpy/pdfmorph/morphs/morphscale.py b/src/diffpy/morph/morphs/morphscale.py similarity index 91% rename from src/diffpy/pdfmorph/morphs/morphscale.py rename to src/diffpy/morph/morphs/morphscale.py index 0251b776..2f5c6b4d 100644 --- a/src/diffpy/pdfmorph/morphs/morphscale.py +++ b/src/diffpy/morph/morphs/morphscale.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfmorph by DANSE Diffraction group +# diffpy.morph by DANSE Diffraction group # Simon J. L. Billinge # (c) 2010 Trustees of the Columbia University # in the City of New York. All rights reserved. @@ -18,7 +18,7 @@ """ -from diffpy.pdfmorph.morphs.morph import LABEL_GR, LABEL_RA, Morph +from diffpy.morph.morphs.morph import LABEL_GR, LABEL_RA, Morph class MorphScale(Morph): diff --git a/src/diffpy/pdfmorph/morphs/morphshape.py b/src/diffpy/morph/morphs/morphshape.py similarity index 97% rename from src/diffpy/pdfmorph/morphs/morphshape.py rename to src/diffpy/morph/morphs/morphshape.py index 382c3cb2..9aae3d78 100644 --- a/src/diffpy/pdfmorph/morphs/morphshape.py +++ b/src/diffpy/morph/morphs/morphshape.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfmorph by DANSE Diffraction group +# diffpy.morph by DANSE Diffraction group # Simon J. L. Billinge # (c) 2010 Trustees of the Columbia University # in the City of New York. All rights reserved. @@ -24,7 +24,7 @@ class MorphSpheroid -- apply a spheroidal shape function to the morph from numpy import arctanh as atanh from numpy import sqrt -from diffpy.pdfmorph.morphs.morph import LABEL_GR, LABEL_RA, Morph +from diffpy.morph.morphs.morph import LABEL_GR, LABEL_RA, Morph class MorphSphere(Morph): diff --git a/src/diffpy/pdfmorph/morphs/morphshift.py b/src/diffpy/morph/morphs/morphshift.py similarity index 93% rename from src/diffpy/pdfmorph/morphs/morphshift.py rename to src/diffpy/morph/morphs/morphshift.py index d6d2d2f5..b3ac8818 100644 --- a/src/diffpy/pdfmorph/morphs/morphshift.py +++ b/src/diffpy/morph/morphs/morphshift.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfmorph by DANSE Diffraction group +# diffpy.morph by DANSE Diffraction group # Simon J. L. Billinge # (c) 2010 Trustees of the Columbia University # in the City of New York. All rights reserved. @@ -20,7 +20,7 @@ import numpy -from diffpy.pdfmorph.morphs.morph import LABEL_GR, LABEL_RA, Morph +from diffpy.morph.morphs.morph import LABEL_GR, LABEL_RA, Morph class MorphShift(Morph): diff --git a/src/diffpy/pdfmorph/morphs/morphsmear.py b/src/diffpy/morph/morphs/morphsmear.py similarity index 95% rename from src/diffpy/pdfmorph/morphs/morphsmear.py rename to src/diffpy/morph/morphs/morphsmear.py index 8161e50d..2495ee38 100644 --- a/src/diffpy/pdfmorph/morphs/morphsmear.py +++ b/src/diffpy/morph/morphs/morphsmear.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfmorph by DANSE Diffraction group +# diffpy.morph by DANSE Diffraction group # Simon J. L. Billinge # (c) 2010 Trustees of the Columbia University # in the City of New York. All rights reserved. @@ -20,7 +20,7 @@ import numpy -from diffpy.pdfmorph.morphs.morph import LABEL_RA, LABEL_RR, Morph +from diffpy.morph.morphs.morph import LABEL_RA, LABEL_RR, Morph class MorphSmear(Morph): diff --git a/src/diffpy/pdfmorph/morphs/morphstretch.py b/src/diffpy/morph/morphs/morphstretch.py similarity index 92% rename from src/diffpy/pdfmorph/morphs/morphstretch.py rename to src/diffpy/morph/morphs/morphstretch.py index 88c494e1..6b99caea 100644 --- a/src/diffpy/pdfmorph/morphs/morphstretch.py +++ b/src/diffpy/morph/morphs/morphstretch.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfmorph by DANSE Diffraction group +# diffpy.morph by DANSE Diffraction group # Simon J. L. Billinge # (c) 2010 Trustees of the Columbia University # in the City of New York. All rights reserved. @@ -20,7 +20,7 @@ import numpy -from diffpy.pdfmorph.morphs.morph import LABEL_GR, LABEL_RA, Morph +from diffpy.morph.morphs.morph import LABEL_GR, LABEL_RA, Morph class MorphStretch(Morph): diff --git a/src/diffpy/pdfmorph/pdfplot.py b/src/diffpy/morph/pdfplot.py similarity index 99% rename from src/diffpy/pdfmorph/pdfplot.py rename to src/diffpy/morph/pdfplot.py index 5dd4d690..9d4dd06a 100644 --- a/src/diffpy/pdfmorph/pdfplot.py +++ b/src/diffpy/morph/pdfplot.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfmorph by DANSE Diffraction group +# diffpy.morph by DANSE Diffraction group # Simon J. L. Billinge # (c) 2008 Trustees of the Columbia University # in the City of New York. All rights reserved. diff --git a/src/diffpy/pdfmorph/refine.py b/src/diffpy/morph/refine.py similarity index 98% rename from src/diffpy/pdfmorph/refine.py rename to src/diffpy/morph/refine.py index 9519880b..e1f55ac3 100644 --- a/src/diffpy/pdfmorph/refine.py +++ b/src/diffpy/morph/refine.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfmorph by DANSE Diffraction group +# diffpy.morph by DANSE Diffraction group # Simon J. L. Billinge # (c) 2010 Trustees of the Columbia University # in the City of New York. All rights reserved. diff --git a/src/diffpy/pdfmorph/tools.py b/src/diffpy/morph/tools.py similarity index 99% rename from src/diffpy/pdfmorph/tools.py rename to src/diffpy/morph/tools.py index 09f96ec3..f9b024dd 100644 --- a/src/diffpy/pdfmorph/tools.py +++ b/src/diffpy/morph/tools.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfmorph by DANSE Diffraction group +# diffpy.morph by DANSE Diffraction group # Simon J. L. Billinge # (c) 2010 Trustees of the Columbia University # in the City of New York. All rights reserved. diff --git a/src/diffpy/pdfmorph/version.py b/src/diffpy/morph/version.py similarity index 95% rename from src/diffpy/pdfmorph/version.py rename to src/diffpy/morph/version.py index cf614327..1077d2ca 100644 --- a/src/diffpy/pdfmorph/version.py +++ b/src/diffpy/morph/version.py @@ -21,6 +21,6 @@ # obtain version information from importlib.metadata import version -__version__ = version("diffpy.pdfmorph") +__version__ = version("diffpy.morph") # End of file diff --git a/tests/debug.py b/tests/debug.py index 908a3940..0d3926c0 100644 --- a/tests/debug.py +++ b/tests/debug.py @@ -16,7 +16,7 @@ """ Convenience module for debugging the unit tests using -python -m diffpy.pdfmorph.tests.debug +python -m diffpy.morph.tests.debug Exceptions raised by failed tests or other errors are not caught. """ diff --git a/tests/run.py b/tests/run.py index 499f63bf..dc27a05b 100644 --- a/tests/run.py +++ b/tests/run.py @@ -7,13 +7,13 @@ # File coded by: Billinge Group members and community contributors. # # See GitHub contributions for a more detailed list of contributors. -# https://github.com/diffpy/diffpy.pdfmorph/graphs/contributors +# https://github.com/diffpy/diffpy.morph/graphs/contributors # # See LICENSE.rst for license information. # ############################################################################## """Convenience module for executing all unit tests with -python -m diffpy.pdfmorph.tests.run +python -m diffpy.morph.tests.run """ import sys diff --git a/tests/test_morph_func.py b/tests/test_morph_func.py index 30b1c54a..ae7bc36c 100644 --- a/tests/test_morph_func.py +++ b/tests/test_morph_func.py @@ -3,7 +3,7 @@ import numpy as np -from diffpy.pdfmorph.pdfmorph_api import morph_default_config, pdfmorph +from diffpy.morph.morph_api import morph_default_config, morph from tests.test_morphstretch import heaviside @@ -16,7 +16,7 @@ def test_morphfunc_verbose(): x_morph = x_target.copy() y_morph = heaviside(x_target, lb * (1 + stretch), ub * (1 + stretch)) cfg = morph_default_config(stretch=0.1) # off init - pdfmorph(x_morph, y_morph, x_target, y_target, verbose=True, **cfg) + morph(x_morph, y_morph, x_target, y_target, verbose=True, **cfg) def test_fixed_morph_with_morphfunc(): @@ -29,7 +29,7 @@ def test_fixed_morph_with_morphfunc(): y_morph = heaviside(x_target, lb * (1 + stretch), ub * (1 + stretch)) cfg = morph_default_config(stretch=0.1) # off init cfg["scale"] = 30 - pdfmorph( + morph( x_morph, y_morph, x_target, @@ -50,7 +50,7 @@ def test_stretch_with_morphfunc(): x_morph = x_target.copy() y_morph = heaviside(x_target, lb * (1 + stretch), ub * (1 + stretch)) cfg = morph_default_config(stretch=0.1) # off init - morph_rv = pdfmorph(x_morph, y_morph, x_target, y_target, **cfg) + morph_rv = morph(x_morph, y_morph, x_target, y_target, **cfg) morphed_cfg = morph_rv["morphed_config"] # verified they are morphable x1, y1, x0, y0 = morph_rv["morph_chain"].xyallout @@ -72,7 +72,7 @@ def test_scale_with_morphfunc(): y_morph = y_target.copy() y_morph *= scale cfg = morph_default_config(scale=1.5) # off init - morph_rv = pdfmorph(x_morph, y_morph, x_target, y_target, **cfg) + morph_rv = morph(x_morph, y_morph, x_target, y_target, **cfg) morphed_cfg = morph_rv["morphed_config"] # verified they are morphable x1, y1, x0, y0 = morph_rv["morph_chain"].xyallout @@ -93,7 +93,7 @@ def test_smear_with_morph_func(): x_morph = x_target.copy() y_morph = np.exp(-0.5 * ((x_morph - r0) / sigma0) ** 2) cfg = morph_default_config(smear=0.1, scale=1.1, stretch=0.1) # off init - morph_rv = pdfmorph(x_morph, y_morph, x_target, y_target, **cfg) + morph_rv = morph(x_morph, y_morph, x_target, y_target, **cfg) morphed_cfg = morph_rv["morphed_config"] # verified they are morphable x1, y1, x0, y0 = morph_rv["morph_chain"].xyallout diff --git a/tests/test_pdfmorphapp.py b/tests/test_morphapp.py similarity index 99% rename from tests/test_pdfmorphapp.py rename to tests/test_morphapp.py index c1d7cd5d..fa39a2e5 100644 --- a/tests/test_pdfmorphapp.py +++ b/tests/test_morphapp.py @@ -4,7 +4,7 @@ import pytest -from diffpy.pdfmorph.pdfmorphapp import ( +from diffpy.morph.morphapp import ( create_option_parser, multiple_targets, single_morph, diff --git a/tests/test_morphchain.py b/tests/test_morphchain.py index 8a9657b2..92ed0189 100644 --- a/tests/test_morphchain.py +++ b/tests/test_morphchain.py @@ -6,9 +6,9 @@ import numpy import pytest -from diffpy.pdfmorph.morphs.morphchain import MorphChain -from diffpy.pdfmorph.morphs.morphrgrid import MorphRGrid -from diffpy.pdfmorph.morphs.morphscale import MorphScale +from diffpy.morph.morphs.morphchain import MorphChain +from diffpy.morph.morphs.morphrgrid import MorphRGrid +from diffpy.morph.morphs.morphscale import MorphScale # useful variables thisfile = locals().get("__file__", "file.py") diff --git a/tests/test_pdfmorphio.py b/tests/test_morphio.py similarity index 99% rename from tests/test_pdfmorphio.py rename to tests/test_morphio.py index 9794a347..ed4059ff 100644 --- a/tests/test_pdfmorphio.py +++ b/tests/test_morphio.py @@ -4,7 +4,7 @@ import pytest -from diffpy.pdfmorph.pdfmorphapp import ( +from diffpy.morph.morphapp import ( create_option_parser, multiple_targets, single_morph, diff --git a/tests/test_morphpdftordf.py b/tests/test_morphpdftordf.py index 48cd035e..1c49f31f 100644 --- a/tests/test_morphpdftordf.py +++ b/tests/test_morphpdftordf.py @@ -6,7 +6,7 @@ import numpy import pytest -from diffpy.pdfmorph.morph_helpers.transformpdftordf import ( +from diffpy.morph.morph_helpers.transformpdftordf import ( TransformXtalPDFtoRDF, ) diff --git a/tests/test_morphrdftopdf.py b/tests/test_morphrdftopdf.py index f66cb8b1..5cd18594 100644 --- a/tests/test_morphrdftopdf.py +++ b/tests/test_morphrdftopdf.py @@ -6,7 +6,7 @@ import numpy import pytest -from diffpy.pdfmorph.morph_helpers.transformrdftopdf import ( +from diffpy.morph.morph_helpers.transformrdftopdf import ( TransformXtalRDFtoPDF, ) diff --git a/tests/test_morphresolution.py b/tests/test_morphresolution.py index a2226228..13a56d8d 100644 --- a/tests/test_morphresolution.py +++ b/tests/test_morphresolution.py @@ -6,7 +6,7 @@ import numpy import pytest -from diffpy.pdfmorph.morphs.morphresolution import MorphResolutionDamping +from diffpy.morph.morphs.morphresolution import MorphResolutionDamping # useful variables thisfile = locals().get("__file__", "file.py") diff --git a/tests/test_morphrgrid.py b/tests/test_morphrgrid.py index 43a957f4..d823dbad 100644 --- a/tests/test_morphrgrid.py +++ b/tests/test_morphrgrid.py @@ -6,7 +6,7 @@ import numpy import pytest -from diffpy.pdfmorph.morphs.morphrgrid import MorphRGrid +from diffpy.morph.morphs.morphrgrid import MorphRGrid # useful variables thisfile = locals().get("__file__", "file.py") diff --git a/tests/test_morphscale.py b/tests/test_morphscale.py index ae20025e..ccabb483 100644 --- a/tests/test_morphscale.py +++ b/tests/test_morphscale.py @@ -6,7 +6,7 @@ import numpy import pytest -from diffpy.pdfmorph.morphs.morphscale import MorphScale +from diffpy.morph.morphs.morphscale import MorphScale # useful variables thisfile = locals().get("__file__", "file.py") diff --git a/tests/test_morphshape.py b/tests/test_morphshape.py index 3d4e9a11..1905ebe8 100644 --- a/tests/test_morphshape.py +++ b/tests/test_morphshape.py @@ -6,8 +6,8 @@ import numpy import pytest -from diffpy.pdfmorph.morphs.morphishape import MorphISpheroid -from diffpy.pdfmorph.morphs.morphshape import MorphSphere, MorphSpheroid +from diffpy.morph.morphs.morphishape import MorphISpheroid +from diffpy.morph.morphs.morphshape import MorphSphere, MorphSpheroid # FIXME: add MorphISphere test diff --git a/tests/test_morphshift.py b/tests/test_morphshift.py index feda66a4..4f2e552b 100644 --- a/tests/test_morphshift.py +++ b/tests/test_morphshift.py @@ -6,7 +6,7 @@ import numpy import pytest -from diffpy.pdfmorph.morphs.morphshift import MorphShift +from diffpy.morph.morphs.morphshift import MorphShift # useful variables thisfile = locals().get("__file__", "file.py") diff --git a/tests/test_morphsmear.py b/tests/test_morphsmear.py index 430a569d..aa431c0e 100644 --- a/tests/test_morphsmear.py +++ b/tests/test_morphsmear.py @@ -6,7 +6,7 @@ import numpy import pytest -from diffpy.pdfmorph.morphs.morphsmear import MorphSmear +from diffpy.morph.morphs.morphsmear import MorphSmear # useful variables thisfile = locals().get("__file__", "file.py") diff --git a/tests/test_morphstretch.py b/tests/test_morphstretch.py index c87cb4a6..37b23a0c 100644 --- a/tests/test_morphstretch.py +++ b/tests/test_morphstretch.py @@ -6,7 +6,7 @@ import numpy import pytest -from diffpy.pdfmorph.morphs.morphstretch import MorphStretch +from diffpy.morph.morphs.morphstretch import MorphStretch # useful variables thisfile = locals().get("__file__", "file.py") diff --git a/tests/test_pdfplot.py b/tests/test_pdfplot.py index c5084f1b..dd3d4139 100644 --- a/tests/test_pdfplot.py +++ b/tests/test_pdfplot.py @@ -5,9 +5,9 @@ import matplotlib.pyplot as plt import numpy as np -from diffpy.pdfmorph.pdfmorph_api import ( +from diffpy.morph.morph_api import ( morph_default_config, - pdfmorph, + morph, plot_morph, ) from tests.test_morphstretch import heaviside @@ -23,7 +23,7 @@ def test_plot_morph(): x_morph = x_target.copy() y_morph = heaviside(x_target, lb * (1 + stretch), ub * (1 + stretch)) cfg = morph_default_config(stretch=0.1) # off init - morph_rv = pdfmorph( + morph_rv = morph( x_morph, y_morph, x_target, y_target, verbose=True, **cfg ) chain = morph_rv["morph_chain"] diff --git a/tests/test_refine.py b/tests/test_refine.py index e14ab257..c4c9231a 100644 --- a/tests/test_refine.py +++ b/tests/test_refine.py @@ -6,17 +6,17 @@ import numpy import pytest -from diffpy.pdfmorph.morph_helpers.transformpdftordf import ( +from diffpy.morph.morph_helpers.transformpdftordf import ( TransformXtalPDFtoRDF, ) -from diffpy.pdfmorph.morph_helpers.transformrdftopdf import ( +from diffpy.morph.morph_helpers.transformrdftopdf import ( TransformXtalRDFtoPDF, ) -from diffpy.pdfmorph.morphs.morphchain import MorphChain -from diffpy.pdfmorph.morphs.morphscale import MorphScale -from diffpy.pdfmorph.morphs.morphsmear import MorphSmear -from diffpy.pdfmorph.morphs.morphstretch import MorphStretch -from diffpy.pdfmorph.refine import Refiner +from diffpy.morph.morphs.morphchain import MorphChain +from diffpy.morph.morphs.morphscale import MorphScale +from diffpy.morph.morphs.morphsmear import MorphSmear +from diffpy.morph.morphs.morphstretch import MorphStretch +from diffpy.morph.refine import Refiner # useful variables thisfile = locals().get("__file__", "file.py") diff --git a/tests/test_tools.py b/tests/test_tools.py index 12d061d1..f0a5b497 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -10,7 +10,7 @@ import numpy import pytest -import diffpy.pdfmorph.tools as tools +import diffpy.morph.tools as tools # useful variables thisfile = locals().get("__file__", "file.py") diff --git a/tests/test_version.py b/tests/test_version.py index 21318422..230d27c2 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -1,11 +1,11 @@ """Unit tests for __version__.py """ -import diffpy.pdfmorph +import diffpy.morph def test_package_version(): """Ensure the package version is defined and not set to the initial placeholder.""" - assert hasattr(diffpy.pdfmorph, "__version__") - assert diffpy.pdfmorph.__version__ != "0.0.0" + assert hasattr(diffpy.morph, "__version__") + assert diffpy.morph.__version__ != "0.0.0" diff --git a/tests/testdata/testsaving/succinct/Morph_Reference_Table.txt b/tests/testdata/testsaving/succinct/Morph_Reference_Table.txt index d1b30b88..9759b83d 100644 --- a/tests/testdata/testsaving/succinct/Morph_Reference_Table.txt +++ b/tests/testdata/testsaving/succinct/Morph_Reference_Table.txt @@ -1,4 +1,4 @@ -# Data generated by pdfmorph +# Data generated by diffpy.morph # from morphing FILE # with target directory DIRECTORY diff --git a/tests/testdata/testsaving/succinct/Morphs/mwt_a.cgr b/tests/testdata/testsaving/succinct/Morphs/mwt_a.cgr index 6a17632f..c1b2cb4c 100644 --- a/tests/testdata/testsaving/succinct/Morphs/mwt_a.cgr +++ b/tests/testdata/testsaving/succinct/Morphs/mwt_a.cgr @@ -1,4 +1,4 @@ -# PDF created by pdfmorph +# PDF created by diffpy.morph # from PATH # Labels: [r] [gr] diff --git a/tests/testdata/testsaving/succinct/Morphs/mwt_b.cgr b/tests/testdata/testsaving/succinct/Morphs/mwt_b.cgr index 6a17632f..c1b2cb4c 100644 --- a/tests/testdata/testsaving/succinct/Morphs/mwt_b.cgr +++ b/tests/testdata/testsaving/succinct/Morphs/mwt_b.cgr @@ -1,4 +1,4 @@ -# PDF created by pdfmorph +# PDF created by diffpy.morph # from PATH # Labels: [r] [gr] diff --git a/tests/testdata/testsaving/succinct/Morphs/mwt_c.cgr b/tests/testdata/testsaving/succinct/Morphs/mwt_c.cgr index 6a17632f..c1b2cb4c 100644 --- a/tests/testdata/testsaving/succinct/Morphs/mwt_c.cgr +++ b/tests/testdata/testsaving/succinct/Morphs/mwt_c.cgr @@ -1,4 +1,4 @@ -# PDF created by pdfmorph +# PDF created by diffpy.morph # from PATH # Labels: [r] [gr] diff --git a/tests/testdata/testsaving/succinct/Morphs/mwt_d.cgr b/tests/testdata/testsaving/succinct/Morphs/mwt_d.cgr index 6a17632f..c1b2cb4c 100644 --- a/tests/testdata/testsaving/succinct/Morphs/mwt_d.cgr +++ b/tests/testdata/testsaving/succinct/Morphs/mwt_d.cgr @@ -1,4 +1,4 @@ -# PDF created by pdfmorph +# PDF created by diffpy.morph # from PATH # Labels: [r] [gr] diff --git a/tests/testdata/testsaving/succinct/Morphs/mwt_e.cgr b/tests/testdata/testsaving/succinct/Morphs/mwt_e.cgr index 6a17632f..c1b2cb4c 100644 --- a/tests/testdata/testsaving/succinct/Morphs/mwt_e.cgr +++ b/tests/testdata/testsaving/succinct/Morphs/mwt_e.cgr @@ -1,4 +1,4 @@ -# PDF created by pdfmorph +# PDF created by diffpy.morph # from PATH # Labels: [r] [gr] diff --git a/tests/testdata/testsaving/succinct/Morphs/mwt_f.cgr b/tests/testdata/testsaving/succinct/Morphs/mwt_f.cgr index 6a17632f..c1b2cb4c 100644 --- a/tests/testdata/testsaving/succinct/Morphs/mwt_f.cgr +++ b/tests/testdata/testsaving/succinct/Morphs/mwt_f.cgr @@ -1,4 +1,4 @@ -# PDF created by pdfmorph +# PDF created by diffpy.morph # from PATH # Labels: [r] [gr] diff --git a/tests/testdata/testsaving/succinct/single_succinct_morph.cgr b/tests/testdata/testsaving/succinct/single_succinct_morph.cgr index 6a17632f..c1b2cb4c 100644 --- a/tests/testdata/testsaving/succinct/single_succinct_morph.cgr +++ b/tests/testdata/testsaving/succinct/single_succinct_morph.cgr @@ -1,4 +1,4 @@ -# PDF created by pdfmorph +# PDF created by diffpy.morph # from PATH # Labels: [r] [gr] diff --git a/tests/testdata/testsaving/verbose/Morph_Reference_Table.txt b/tests/testdata/testsaving/verbose/Morph_Reference_Table.txt index 6fc523bc..c849e35f 100644 --- a/tests/testdata/testsaving/verbose/Morph_Reference_Table.txt +++ b/tests/testdata/testsaving/verbose/Morph_Reference_Table.txt @@ -1,4 +1,4 @@ -# Data generated by pdfmorph +# Data generated by diffpy.morph # from morphing FILE # with target directory DIRECTORY diff --git a/tests/testdata/testsaving/verbose/Morphs/mwt_a.cgr b/tests/testdata/testsaving/verbose/Morphs/mwt_a.cgr index f9335ccf..d4ab20ff 100644 --- a/tests/testdata/testsaving/verbose/Morphs/mwt_a.cgr +++ b/tests/testdata/testsaving/verbose/Morphs/mwt_a.cgr @@ -1,4 +1,4 @@ -# PDF created by pdfmorph +# PDF created by diffpy.morph # from PATH # Input morphing parameters: diff --git a/tests/testdata/testsaving/verbose/Morphs/mwt_b.cgr b/tests/testdata/testsaving/verbose/Morphs/mwt_b.cgr index 40186c4b..fd039d17 100644 --- a/tests/testdata/testsaving/verbose/Morphs/mwt_b.cgr +++ b/tests/testdata/testsaving/verbose/Morphs/mwt_b.cgr @@ -1,4 +1,4 @@ -# PDF created by pdfmorph +# PDF created by diffpy.morph # from PATH # Input morphing parameters: diff --git a/tests/testdata/testsaving/verbose/Morphs/mwt_c.cgr b/tests/testdata/testsaving/verbose/Morphs/mwt_c.cgr index 6bf1eb5f..0321f80e 100644 --- a/tests/testdata/testsaving/verbose/Morphs/mwt_c.cgr +++ b/tests/testdata/testsaving/verbose/Morphs/mwt_c.cgr @@ -1,4 +1,4 @@ -# PDF created by pdfmorph +# PDF created by diffpy.morph # from PATH # Input morphing parameters: diff --git a/tests/testdata/testsaving/verbose/Morphs/mwt_d.cgr b/tests/testdata/testsaving/verbose/Morphs/mwt_d.cgr index e5023b18..fa694073 100644 --- a/tests/testdata/testsaving/verbose/Morphs/mwt_d.cgr +++ b/tests/testdata/testsaving/verbose/Morphs/mwt_d.cgr @@ -1,4 +1,4 @@ -# PDF created by pdfmorph +# PDF created by diffpy.morph # from PATH # Input morphing parameters: diff --git a/tests/testdata/testsaving/verbose/Morphs/mwt_e.cgr b/tests/testdata/testsaving/verbose/Morphs/mwt_e.cgr index 1d06ae2e..5ea8d806 100644 --- a/tests/testdata/testsaving/verbose/Morphs/mwt_e.cgr +++ b/tests/testdata/testsaving/verbose/Morphs/mwt_e.cgr @@ -1,4 +1,4 @@ -# PDF created by pdfmorph +# PDF created by diffpy.morph # from PATH # Input morphing parameters: diff --git a/tests/testdata/testsaving/verbose/Morphs/mwt_f.cgr b/tests/testdata/testsaving/verbose/Morphs/mwt_f.cgr index afd8b039..1cf81646 100644 --- a/tests/testdata/testsaving/verbose/Morphs/mwt_f.cgr +++ b/tests/testdata/testsaving/verbose/Morphs/mwt_f.cgr @@ -1,4 +1,4 @@ -# PDF created by pdfmorph +# PDF created by diffpy.morph # from PATH # Input morphing parameters: diff --git a/tests/testdata/testsaving/verbose/single_verbose_morph.cgr b/tests/testdata/testsaving/verbose/single_verbose_morph.cgr index f9335ccf..d4ab20ff 100644 --- a/tests/testdata/testsaving/verbose/single_verbose_morph.cgr +++ b/tests/testdata/testsaving/verbose/single_verbose_morph.cgr @@ -1,4 +1,4 @@ -# PDF created by pdfmorph +# PDF created by diffpy.morph # from PATH # Input morphing parameters: diff --git a/tutorial/PDFmorph_manual.pdf b/tutorial/diffpy.morph_manual.pdf similarity index 100% rename from tutorial/PDFmorph_manual.pdf rename to tutorial/diffpy.morph_manual.pdf From 656b484185383f52b359adb78a1df6a0a8f11482 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 19 Mar 2025 01:19:40 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit hooks --- src/diffpy/morph/morph_helpers/__init__.py | 8 ++------ src/diffpy/morph/morphapp.py | 2 +- tests/test_morph_func.py | 2 +- tests/test_morphpdftordf.py | 4 +--- tests/test_morphrdftopdf.py | 4 +--- tests/test_pdfplot.py | 10 ++-------- tests/test_refine.py | 8 ++------ 7 files changed, 10 insertions(+), 28 deletions(-) diff --git a/src/diffpy/morph/morph_helpers/__init__.py b/src/diffpy/morph/morph_helpers/__init__.py index b0d8ccf6..46b8fe5b 100644 --- a/src/diffpy/morph/morph_helpers/__init__.py +++ b/src/diffpy/morph/morph_helpers/__init__.py @@ -14,12 +14,8 @@ """List of helpers for certain morphing operations (currently only used for smear).""" -from diffpy.morph.morph_helpers.transformpdftordf import ( - TransformXtalPDFtoRDF, -) -from diffpy.morph.morph_helpers.transformrdftopdf import ( - TransformXtalRDFtoPDF, -) +from diffpy.morph.morph_helpers.transformpdftordf import TransformXtalPDFtoRDF +from diffpy.morph.morph_helpers.transformrdftopdf import TransformXtalRDFtoPDF # List of helpers morph_helpers = [ diff --git a/src/diffpy/morph/morphapp.py b/src/diffpy/morph/morphapp.py index 4e238a28..b8418c70 100755 --- a/src/diffpy/morph/morphapp.py +++ b/src/diffpy/morph/morphapp.py @@ -19,8 +19,8 @@ from pathlib import Path import diffpy.morph.morph_helpers as helpers -import diffpy.morph.morphs as morphs import diffpy.morph.morph_io as io +import diffpy.morph.morphs as morphs import diffpy.morph.pdfplot as pdfplot import diffpy.morph.refine as refine import diffpy.morph.tools as tools diff --git a/tests/test_morph_func.py b/tests/test_morph_func.py index ae7bc36c..3f62f872 100644 --- a/tests/test_morph_func.py +++ b/tests/test_morph_func.py @@ -3,7 +3,7 @@ import numpy as np -from diffpy.morph.morph_api import morph_default_config, morph +from diffpy.morph.morph_api import morph, morph_default_config from tests.test_morphstretch import heaviside diff --git a/tests/test_morphpdftordf.py b/tests/test_morphpdftordf.py index 1c49f31f..1c39b534 100644 --- a/tests/test_morphpdftordf.py +++ b/tests/test_morphpdftordf.py @@ -6,9 +6,7 @@ import numpy import pytest -from diffpy.morph.morph_helpers.transformpdftordf import ( - TransformXtalPDFtoRDF, -) +from diffpy.morph.morph_helpers.transformpdftordf import TransformXtalPDFtoRDF # useful variables thisfile = locals().get("__file__", "file.py") diff --git a/tests/test_morphrdftopdf.py b/tests/test_morphrdftopdf.py index 5cd18594..ee139cc1 100644 --- a/tests/test_morphrdftopdf.py +++ b/tests/test_morphrdftopdf.py @@ -6,9 +6,7 @@ import numpy import pytest -from diffpy.morph.morph_helpers.transformrdftopdf import ( - TransformXtalRDFtoPDF, -) +from diffpy.morph.morph_helpers.transformrdftopdf import TransformXtalRDFtoPDF # useful variables thisfile = locals().get("__file__", "file.py") diff --git a/tests/test_pdfplot.py b/tests/test_pdfplot.py index dd3d4139..2b6d06af 100644 --- a/tests/test_pdfplot.py +++ b/tests/test_pdfplot.py @@ -5,11 +5,7 @@ import matplotlib.pyplot as plt import numpy as np -from diffpy.morph.morph_api import ( - morph_default_config, - morph, - plot_morph, -) +from diffpy.morph.morph_api import morph, morph_default_config, plot_morph from tests.test_morphstretch import heaviside @@ -23,9 +19,7 @@ def test_plot_morph(): x_morph = x_target.copy() y_morph = heaviside(x_target, lb * (1 + stretch), ub * (1 + stretch)) cfg = morph_default_config(stretch=0.1) # off init - morph_rv = morph( - x_morph, y_morph, x_target, y_target, verbose=True, **cfg - ) + morph_rv = morph(x_morph, y_morph, x_target, y_target, verbose=True, **cfg) chain = morph_rv["morph_chain"] fig, ax = plt.subplots() l_list = plot_morph(chain, ax) diff --git a/tests/test_refine.py b/tests/test_refine.py index c4c9231a..d9cbd6d4 100644 --- a/tests/test_refine.py +++ b/tests/test_refine.py @@ -6,12 +6,8 @@ import numpy import pytest -from diffpy.morph.morph_helpers.transformpdftordf import ( - TransformXtalPDFtoRDF, -) -from diffpy.morph.morph_helpers.transformrdftopdf import ( - TransformXtalRDFtoPDF, -) +from diffpy.morph.morph_helpers.transformpdftordf import TransformXtalPDFtoRDF +from diffpy.morph.morph_helpers.transformrdftopdf import TransformXtalRDFtoPDF from diffpy.morph.morphs.morphchain import MorphChain from diffpy.morph.morphs.morphscale import MorphScale from diffpy.morph.morphs.morphsmear import MorphSmear From c196bc3f8d83384bc59bccb1702df2df2ed80460 Mon Sep 17 00:00:00 2001 From: Sparks29032 Date: Tue, 18 Mar 2025 20:21:23 -0500 Subject: [PATCH 3/3] Fix flake8 --- src/diffpy/morph/morph_io.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/diffpy/morph/morph_io.py b/src/diffpy/morph/morph_io.py index e488fe24..722771c9 100644 --- a/src/diffpy/morph/morph_io.py +++ b/src/diffpy/morph/morph_io.py @@ -109,8 +109,8 @@ def create_morphs_directory(save_directory): """Create a directory for saving multiple morphed PDFs. Takes in a user-given path to a directory save_directory and create a - subdirectory named Morphs. diffpy.morph will save all morphs into the Morphs - subdirectory while metadata about the morphs will be stored in + subdirectory named Morphs. diffpy.morph will save all morphs into the + Morphs subdirectory while metadata about the morphs will be stored in save_directory outside Morphs. Parameters