From 9ad19af24ee9eed7d0167a43826cbb7368f3193e Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Thu, 7 Nov 2024 22:13:33 -0500 Subject: [PATCH 1/3] modify codecov.yml, remove .coveragerc, add news --- .codecov.yml | 42 +++++-------------- .codespell/ignore_lines.txt | 2 + .codespell/ignore_words.txt | 11 +++++ .coveragerc | 13 ------ .gitattributes | 1 - .github/ISSUE_TEMPLATE/release_checklist.md | 14 +++++-- .../workflows/build-wheel-release-upload.yml | 2 +- .github/workflows/publish-docs-on-release.yml | 14 ------- .github/workflows/tests-on-pr.yml | 2 + .pre-commit-config.yaml | 6 +++ news/codecov.rst | 24 +++++++++++ 11 files changed, 67 insertions(+), 64 deletions(-) create mode 100644 .codespell/ignore_lines.txt create mode 100644 .codespell/ignore_words.txt delete mode 100644 .coveragerc delete mode 100644 .gitattributes delete mode 100644 .github/workflows/publish-docs-on-release.yml create mode 100644 news/codecov.rst diff --git a/.codecov.yml b/.codecov.yml index 04dd6510..5a94096e 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,34 +1,14 @@ -# codecov can find this file anywhere in the repo, so we don't need to clutter -# the root folder. -#comment: false - -codecov: - notify: - require_ci_to_pass: no - coverage: status: - patch: + project: # more options at https://docs.codecov.com/docs/commit-status default: - target: '70' - if_no_uploads: error - if_not_found: success - if_ci_failed: failure - project: - default: false - library: - target: auto - if_no_uploads: error - if_not_found: success - if_ci_failed: error - paths: '!*/tests/.*' - - tests: - target: 97.9% - paths: '*/tests/.*' - if_not_found: success - -flags: - tests: - paths: - - tests/ + target: auto # use the coverage from the base commit, fail if coverage is lower + threshold: 0% # allow the coverage to drop by + +comment: + layout: " diff, flags, files" + behavior: default + require_changes: false + require_base: false # [true :: must have a base report to post] + require_head: false # [true :: must have a head report to post] + hide_project_coverage: false # [true :: only show coverage on the git diff aka patch coverage] diff --git a/.codespell/ignore_lines.txt b/.codespell/ignore_lines.txt new file mode 100644 index 00000000..07fa7c8c --- /dev/null +++ b/.codespell/ignore_lines.txt @@ -0,0 +1,2 @@ +;; Please include filenames and explanations for each ignored line. +;; See https://docs.openverse.org/meta/codespell.html for docs. diff --git a/.codespell/ignore_words.txt b/.codespell/ignore_words.txt new file mode 100644 index 00000000..9757d7c0 --- /dev/null +++ b/.codespell/ignore_words.txt @@ -0,0 +1,11 @@ +;; Please include explanations for each ignored word (lowercase). +;; See https://docs.openverse.org/meta/codespell.html for docs. + +;; abbreviation for "materials" often used in a journal title +mater + +;; alternative use of socioeconomic +socio-economic + +;; Frobenius norm used in np.linalg.norm +fro diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index c02bc861..00000000 --- a/.coveragerc +++ /dev/null @@ -1,13 +0,0 @@ -[run] -source = - diffpy.pdfmorph -[report] -omit = - */python?.?/* - */site-packages/nose/* - # ignore _version.py and versioneer.py - .*version.* - *_version.py - -exclude_lines = - if __name__ == '__main__': diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index cb43882a..00000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -diffpy.pdfmorph/_version.py export-subst diff --git a/.github/ISSUE_TEMPLATE/release_checklist.md b/.github/ISSUE_TEMPLATE/release_checklist.md index a87a44a8..b96c782d 100644 --- a/.github/ISSUE_TEMPLATE/release_checklist.md +++ b/.github/ISSUE_TEMPLATE/release_checklist.md @@ -13,10 +13,16 @@ assignees: "" - [ ] License information is verified as correct. If you are unsure, please comment below. - [ ] Locally rendered documentation contains all appropriate pages, including API references (check no modules are missing), tutorials, and other human written text is up-to-date with any changes in the code. -- [ ] Installation instructions in the README, documentation and on the website (e.g., diffpy.org) are updated and - tested -- [ ] Successfully run any tutorial examples or do functional testing in some other way. +- [ ] Installation instructions in the README, documentation and on the website (e.g., diffpy.org) updated. +- [ ] Successfully run any tutorial examples or do functional testing with the latest Python version - [ ] Grammar and writing quality have been checked (no typos). Please mention @sbillinge when you are ready for release. Include any additional comments necessary, such as -version information and details about the pre-release. +version information and details about the pre-release here: + +### Post-release checklist + +Before closing this issue, please complete the following: + +- [ ] Run tutorial examples and conduct functional testing using the installation guide in the README. +- [ ] Documentation (README, tutorials, API references, and websites) is deployed without broken links or missing figures. diff --git a/.github/workflows/build-wheel-release-upload.yml b/.github/workflows/build-wheel-release-upload.yml index 2d790422..8b2ffb5a 100644 --- a/.github/workflows/build-wheel-release-upload.yml +++ b/.github/workflows/build-wheel-release-upload.yml @@ -1,4 +1,4 @@ -name: Release (GitHub/PyPI) +name: Release (GitHub/PyPI) and Deploy Docs on: workflow_dispatch: diff --git a/.github/workflows/publish-docs-on-release.yml b/.github/workflows/publish-docs-on-release.yml deleted file mode 100644 index d358d16c..00000000 --- a/.github/workflows/publish-docs-on-release.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Build and Deploy Docs - -on: - release: - types: - - published - workflow_dispatch: - -jobs: - docs: - uses: Billingegroup/release-scripts/.github/workflows/_publish-docs-on-release.yml@v0 - with: - project: diffpy.pdfmorph - c_extension: false diff --git a/.github/workflows/tests-on-pr.yml b/.github/workflows/tests-on-pr.yml index b33f974c..186d6f11 100644 --- a/.github/workflows/tests-on-pr.yml +++ b/.github/workflows/tests-on-pr.yml @@ -14,3 +14,5 @@ jobs: project: diffpy.pdfmorph c_extension: false headless: false + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3070e199..9cf0556f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -44,3 +44,9 @@ repos: name: Prevent Commit to Main Branch args: ["--branch", "main"] stages: [pre-commit] + - repo: https://github.com/codespell-project/codespell + rev: v2.3.0 + hooks: + - id: codespell + additional_dependencies: + - tomli diff --git a/news/codecov.rst b/news/codecov.rst new file mode 100644 index 00000000..1c91077e --- /dev/null +++ b/news/codecov.rst @@ -0,0 +1,24 @@ +**Added:** + +* Spelling check via Codespell in pre-commit +* Coverage report in each PR + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* From 2acb52cb2dff62c1332df822642cb2ee7fcd957f Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Thu, 7 Nov 2024 22:15:49 -0500 Subject: [PATCH 2/3] Add pyproject.toml with codespell added --- pyproject.toml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 58e9bc73..26082b14 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,10 +11,10 @@ authors = [ maintainers = [ { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, ] -description = "Tools for manipulating and comparing PDF profiles" +description = "Python package for manipulating and comparing PDF profiles" keywords = ['diffpy', 'pdf', 'data interpretation'] readme = "README.rst" -requires-python = ">=3.10, <3.14" +requires-python = ">=3.11, <3.14" classifiers = [ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', @@ -25,7 +25,6 @@ classifiers = [ 'Operating System :: Microsoft :: Windows', 'Operating System :: POSIX', 'Operating System :: Unix', - 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: 3.13', @@ -49,12 +48,17 @@ dirty_template = "{tag}" [tool.setuptools.packages.find] where = ["src"] # list of folders that contain the packages (["."] by default) include = ["*"] # package names should match these glob patterns (["*"] by default) -exclude = ["tests"] # exclude packages matching these glob patterns (empty by default) +exclude = [] # exclude packages matching these glob patterns (empty by default) namespaces = false # to disable scanning PEP 420 namespaces (true by default) [tool.setuptools.dynamic] dependencies = {file = ["requirements/pip.txt"]} +[tool.codespell] +exclude-file = ".codespell/ignore_lines.txt" +ignore-words = ".codespell/ignore_words.txt" +skip = "*.cif,*.dat" + [tool.black] line-length = 115 include = '\.pyi?$' From 46c069701c19a8d8bacc80686eaa184c5d9f5ab2 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Thu, 7 Nov 2024 22:30:44 -0500 Subject: [PATCH 3/3] fix typos suggested by codespell --- .codespell/ignore_words.txt | 3 +++ README.rst | 2 +- TUTORIAL.rst | 4 ++-- doc/manual/acknowledgements.texinfo | 2 +- doc/manual/pdfmorph.texinfo | 24 ++++++++++++------------ doc/source/quickstart.rst | 8 ++++---- pyproject.toml | 2 +- src/diffpy/pdfmorph/pdfmorph_api.py | 8 ++++---- src/diffpy/pdfmorph/pdfmorph_io.py | 2 +- src/diffpy/pdfmorph/refine.py | 2 +- 10 files changed, 30 insertions(+), 27 deletions(-) diff --git a/.codespell/ignore_words.txt b/.codespell/ignore_words.txt index 9757d7c0..749b99e2 100644 --- a/.codespell/ignore_words.txt +++ b/.codespell/ignore_words.txt @@ -9,3 +9,6 @@ socio-economic ;; Frobenius norm used in np.linalg.norm fro + +;; library used for Python package release, no longer used +rever diff --git a/README.rst b/README.rst index 7abe1958..5f196b39 100644 --- a/README.rst +++ b/README.rst @@ -190,7 +190,7 @@ trying to commit again. Improvements and fixes are always appreciated. -Before contribuing, please read our `Code of Conduct `_. +Before contributing, please read our `Code of Conduct `_. Contact ------- diff --git a/TUTORIAL.rst b/TUTORIAL.rst index 114ebd2f..74e897c9 100644 --- a/TUTORIAL.rst +++ b/TUTORIAL.rst @@ -148,7 +148,7 @@ Basic PDFmorph Workflow We are getting closer to an acceptably close fit to our data! - 8. Finally, we will examine the stretch factor. Provide an intial + 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 @@ -183,5 +183,5 @@ Enjoy the software! Bug Reports ----------- -Please enjoy using our software! If you come accross any bugs in the +Please enjoy using our software! If you come across any bugs in the application, please report them to diffpy-dev@googlegroups.com diff --git a/doc/manual/acknowledgements.texinfo b/doc/manual/acknowledgements.texinfo index 3b5533c8..e45bf5f9 100644 --- a/doc/manual/acknowledgements.texinfo +++ b/doc/manual/acknowledgements.texinfo @@ -1,7 +1,7 @@ The PDFmorph app was developed by the Billinge group at Columbia University. The examples in the tutorial part of the manual were made possible by data collected by Soham Banerjee at Brookhaven National Laboratory, -Benjamin Frandsen during his PhD at Columbia Unversity, +Benjamin Frandsen during his PhD at Columbia University, and Long Yang from Tonji University. The DiffPy development team is the set of all contributors to DiffPy projects. diff --git a/doc/manual/pdfmorph.texinfo b/doc/manual/pdfmorph.texinfo index 96209141..e8d7b3a5 100644 --- a/doc/manual/pdfmorph.texinfo +++ b/doc/manual/pdfmorph.texinfo @@ -156,7 +156,7 @@ it has not been extensively tested beyond the PDF. It runs on Windows, Mac OS, Linux, and all major Unix systems. The source code is freely available at @url{https://github.com/diffpy/diffpy.pdfmorph}. -If you come accross any bugs in the application, please open an +If you come across any bugs in the application, please open an @url{https://github.com/diffpy/diffpy.pdfmorph/issues, issue} or email diffpy-dev@@googlegroups.com. @@ -440,8 +440,8 @@ extra tutorial data @code{additionalData.zip}} before proceeding. @cindex performing multiple morphs It may be useful to morph a PDF against multiple targets: for example, you may want -to morph a PDF against a sequence of PDFs measured at various temepratures to determine -whether a phase change has occured. PDFmorph currently allows users to morph a PDF +to morph a PDF against a sequence of 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 selected directory and plot resulting @math{R_W} values from each morph. It is advised that the lowest temperature PDF be that morphed and the higher temperature PDFs act as targets as the smear morph is only able to account for increases in thermal motion. @@ -619,7 +619,7 @@ Again, we can begin by plotting the bulk material against our nanoparticle. @example pdfmorph Ni_bulk.gr Ni_nano_spheroid.cgr @end example -@item The nanoparticle shape of the calculated PDF is an oblate spheroid with equitorial +@item The nanoparticle shape of the calculated PDF is an oblate spheroid with equatorial radius of about @math{12} and polar radius of about @math{6} (this information is contained within the @code{Ni_nano_spheroid.cgr} file). To apply the spheroidal shape effects onto the bulk, run @@ -627,7 +627,7 @@ bulk, run pdfmorph Ni_bulk.gr Ni_nano_spheroid.cgr --radius=12 --pradius=6 -a @end example @itemize -@item The @code{--radius} option corresponds to the equitorial radius. +@item The @code{--radius} option corresponds to the equatorial radius. @item The @code{--pradius} option corresponds to the polar radius. @end itemize @item Run the same command without @code{-a} to refine. Refining should give @@ -792,14 +792,14 @@ using atomic pair distribution function analysis. Phys. Rev. B, 76(11), 115413. The available shape morphs are listed below: @itemize @item @code{--radius=RADIUS} - Multiply the PDF by the nanoparticle form factor for a sphere of radius @code{RADIUS}. -If used with @code{--pradius}, multiply the PDF by the nanoparticle form factor for a spheroid of equitorial radius +If used with @code{--pradius}, multiply the PDF by the nanoparticle form factor for a spheroid of equatorial radius @code{RADIUS} and polar radius @code{PRADIUS}. @itemize @item The sphere form factor was computed by Kodama et al. @footnote{Kodama, K., Iikubo, S., Taguchi, T., & Shamoto, S. (2006). Finite size effects of nanoparticles on the atomic pair distribution functions. Acta Crystallographica Section A, 62(6), 444–453. @url{https://doi.org/10.1107/S0108767306034635}}. @end itemize -@item @code{--pradius=PRADIUS} - Multiply the PDF by the nanoparticle form factor for a spheroid of equitorial radius +@item @code{--pradius=PRADIUS} - Multiply the PDF by the nanoparticle form factor for a spheroid of equatorial radius @code{RADIUS} and polar radius @code{PRADIUS}. @itemize @item The spheroid form factor was computed by Lei et al. @footnote{Lei, M., de Graff, A. M. R., Thorpe, M. F., Wells, @@ -807,9 +807,9 @@ S. A., & Sartbaeva, A. (2009). Uncovering the intrinsic geometry from the atomic nanomaterials. Phys. Rev. B, 80(2), 024118. @url{https://doi.org/10.1103/PhysRevB.80.024118}}. @end itemize @item @code{--iradius=IRADIUS} - Divide the PDF by the nanoparticle form factor for a sphere of radius @code{IRADIUS}. -If used with @code{--ipradius}, divide the PDF by the nanoparticle form factor for a spheroid of equitorial radius +If used with @code{--ipradius}, divide the PDF by the nanoparticle form factor for a spheroid of equatorial radius @code{IRADIUS} and polar radius @code{IPRADIUS}. -@item @code{--ipradius=IPRADIUS} - Divide the PDF by the nanoparticle form factor for a spheroid of equitorial radius +@item @code{--ipradius=IPRADIUS} - Divide the PDF by the nanoparticle form factor for a spheroid of equatorial radius @code{IRADIUS} and polar radius @code{IPRADIUS}. @end itemize @@ -842,7 +842,7 @@ post-expansion. The volume of the nanoparticle also increases by a factor @math{ @displaymath \gamma'_0(\vec{r}) = {1 \over {\alpha^3 V}} \int \int \int s'(\vec{r}')s'(\vec{r}'+\vec{r})d\vec{r}'. @end displaymath -Aplying a change of variables @math{\vec{r}' \rightarrow \vec{r}' / \alpha} gives +Applying a change of variables @math{\vec{r}' \rightarrow \vec{r}' / \alpha} gives @displaymath \gamma'_0(\vec{r}) = {1 \over {\alpha^3 V}} \int \int \int s'(\alpha \vec{r}')s'(\alpha \vec{r}'+\vec{r})\alpha^3d\vec{r}', @end displaymath @@ -963,7 +963,7 @@ requires us to apply a Gaussian dampening envelope centered at @math{r=0} with w @noindent @code{--radius=RADIUS} @* @indent Apply the nanoparticle form factor @math{\gamma_0} for a sphere of radius @code{RADIUS}. If @code{PRADIUS} is also specified, instead apply the characteristic function of a spheroid with -equitorial radius @code{RADIUS} and polar radius @code{PRADIUS}. +equatorial radius @code{RADIUS} and polar radius @code{PRADIUS}. @noindent @code{--pradius=PRADIUS} @* @indent If @code{RADIUS} is also specified, see @code{--radius}. Otherwise, apply the characteristic @@ -972,7 +972,7 @@ function of a sphere with radius @code{PRADIUS}. @noindent @code{--iradius=IRADIUS} @* @indent Apply the inverse characteristic function @math{1/\gamma_0} of a sphere of radius @code{IRADIUS}/ If @code{IPRADIUS} is also specified, instead apply the characteristic function of a spheroid with -equitorial radius @code{IRADIUS} and polar radius @code{PRADIUS}. +equatorial radius @code{IRADIUS} and polar radius @code{PRADIUS}. @noindent @code{--ipradius=IPRADIUS} @* @indent If @code{IRADIUS} is also specified, see @code{--iradius}. Otherwise, apply the characteristic diff --git a/doc/source/quickstart.rst b/doc/source/quickstart.rst index cd3c6d93..dcf21c2a 100644 --- a/doc/source/quickstart.rst +++ b/doc/source/quickstart.rst @@ -150,7 +150,7 @@ Basic PDFmorph Workflow We are getting closer to an acceptably close fit to our data! - 8. Finally, we will examine the stretch factor. Provide an intial + 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 @@ -193,7 +193,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 temepratures to determine whether a phase change has occured. +at various temperatures to determine whether a phase change has occurred. PDFmorph currently allows users to morph a PDF against all files in a selected directory and plot resulting :math:`R_w` values from each morph. @@ -285,7 +285,7 @@ Currently, the supported nanoparticle shapes include: spheres and spheroids. pdfmorph Ni_bulk.gr Ni_nano_spheroid.cgr --radius=12 --pradius=6 -a - Note that the equitorial radius corresponds to the ``--radius`` parameter and polar radius to ``--pradius``. + Note that the equatorial radius corresponds to the ``--radius`` parameter and polar radius to ``--pradius``. 3. Remove the ``-a`` tag to refine. There is also support for morphing from a nanoparticle to a bulk. When applying the inverse morphs, @@ -294,5 +294,5 @@ it is recommended to set ``--rmax=psize`` where ``psize`` is the longest diamete Bug Reports =========== -Please enjoy using our software! If you come accross any bugs in the +Please enjoy using our software! If you come across any bugs in the application, please report them to diffpy-users@googlegroups.com. diff --git a/pyproject.toml b/pyproject.toml index 26082b14..18ae77f7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,7 @@ dependencies = {file = ["requirements/pip.txt"]} [tool.codespell] exclude-file = ".codespell/ignore_lines.txt" ignore-words = ".codespell/ignore_words.txt" -skip = "*.cif,*.dat" +skip = "*.cif,*.dat,*agr" [tool.black] line-length = 115 diff --git a/src/diffpy/pdfmorph/pdfmorph_api.py b/src/diffpy/pdfmorph/pdfmorph_api.py index cc9407a0..2aed055e 100644 --- a/src/diffpy/pdfmorph/pdfmorph_api.py +++ b/src/diffpy/pdfmorph/pdfmorph_api.py @@ -86,7 +86,7 @@ def pdfmorph( verbose=False, **kwargs, ): - """function to perfom PDF morphing. + """function to perform PDF morphing. Parameters ---------- @@ -142,7 +142,7 @@ def pdfmorph( - morph_chain: diffpy.pdfmorph.morphs.morphchain.MorphChain The instance of processed morph chain. Calling ``x_morph, y_morph, x_target, y_target = morph_chain.xyallout`` - will conviniently retrun morphed data and reference data + will conveniently return morphed data and reference data - morphed_cfg: dict A dictionary of refined morphing parameters - rw: float @@ -248,11 +248,11 @@ def plot_morph(chain, ax=None, **kwargs): ---------- chain: diffpy.pdfmorph.morphs.morphchain.MorphChain An instance of processed morph chain. - ax: matplotlib.axes.Axes, optinal + ax: matplotlib.axes.Axes, optional An instance of Axes class to plot the morphing result. If ax is None, instances of new Figure and Axes will be created. Default to None. kwargs: - Additional keyword arguements will be passed to ``ax.plot(...**kwargs)`` + Additional keyword arguments will be passed to ``ax.plot(...**kwargs)`` Returns ------- diff --git a/src/diffpy/pdfmorph/pdfmorph_io.py b/src/diffpy/pdfmorph/pdfmorph_io.py index c9b69d7c..375a8eae 100644 --- a/src/diffpy/pdfmorph/pdfmorph_io.py +++ b/src/diffpy/pdfmorph/pdfmorph_io.py @@ -44,7 +44,7 @@ def single_morph_output( morph_results: dict Resulting data after morphing. save_file - Name of file to print to. If None (defualt) print to terminal. + Name of file to print to. If None (default) print to terminal. morph_file Name of the morphed PDF file. Required when printing to a non-terminal file. param xy_out: list diff --git a/src/diffpy/pdfmorph/refine.py b/src/diffpy/pdfmorph/refine.py index e505d491..cecd50f3 100644 --- a/src/diffpy/pdfmorph/refine.py +++ b/src/diffpy/pdfmorph/refine.py @@ -71,7 +71,7 @@ def _pearson(self, pvals): """Pearson correlation function. This gives e**-p (vector), where p is the pearson correlation function. - We seek to minimize this, which occurrs when the correlation is the largest. + We seek to minimize this, which occurs when the correlation is the largest. """ self._update_chain(pvals) _x_morph, _y_morph, _x_target, _y_target = self.chain(