Skip to content

Commit

Permalink
Merge pull request #151 from bobleesj/recut-cov
Browse files Browse the repository at this point in the history
Recut - codecov in PR, Codespell, release checklist
  • Loading branch information
sbillinge authored Nov 8, 2024
2 parents d7a9d30 + 46c0697 commit 134c810
Show file tree
Hide file tree
Showing 20 changed files with 104 additions and 94 deletions.
42 changes: 11 additions & 31 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -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]
2 changes: 2 additions & 0 deletions .codespell/ignore_lines.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; Please include filenames and explanations for each ignored line.
;; See https://docs.openverse.org/meta/codespell.html for docs.
14 changes: 14 additions & 0 deletions .codespell/ignore_words.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
;; Please include explanations for each ignored word (lowercase).
;; See https://docs.openverse.org/meta/codespell.html for docs.

;; abbreviation for "materials" often used in a journal title
mater

;; alternative use of socioeconomic
socio-economic

;; Frobenius norm used in np.linalg.norm
fro

;; library used for Python package release, no longer used
rever
13 changes: 0 additions & 13 deletions .coveragerc

This file was deleted.

1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

14 changes: 10 additions & 4 deletions .github/ISSUE_TEMPLATE/release_checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion .github/workflows/build-wheel-release-upload.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release (GitHub/PyPI)
name: Release (GitHub/PyPI) and Deploy Docs

on:
workflow_dispatch:
Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/publish-docs-on-release.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .github/workflows/tests-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ jobs:
project: diffpy.pdfmorph
c_extension: false
headless: false
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ trying to commit again.

Improvements and fixes are always appreciated.

Before contribuing, please read our `Code of Conduct <https://github.com/diffpy/diffpy.pdfmorph/blob/main/CODE_OF_CONDUCT.rst>`_.
Before contributing, please read our `Code of Conduct <https://github.com/diffpy/diffpy.pdfmorph/blob/main/CODE_OF_CONDUCT.rst>`_.

Contact
-------
Expand Down
4 changes: 2 additions & 2 deletions TUTORIAL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 [email protected]
2 changes: 1 addition & 1 deletion doc/manual/acknowledgements.texinfo
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
24 changes: 12 additions & 12 deletions doc/manual/pdfmorph.texinfo
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -619,15 +619,15 @@ 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
@example
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
Expand Down Expand Up @@ -792,24 +792,24 @@ 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,
S. A., & Sartbaeva, A. (2009). Uncovering the intrinsic geometry from the atomic pair distribution function of
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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions doc/source/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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,
Expand All @@ -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 [email protected].
24 changes: 24 additions & 0 deletions news/codecov.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
**Added:**

* Spelling check via Codespell in pre-commit
* Coverage report in each PR

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
12 changes: 8 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ authors = [
maintainers = [
{ name="Simon J.L. Billinge group", email="[email protected]" },
]
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',
Expand All @@ -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',
Expand All @@ -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,*agr"

[tool.black]
line-length = 115
include = '\.pyi?$'
Expand Down
8 changes: 4 additions & 4 deletions src/diffpy/pdfmorph/pdfmorph_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def pdfmorph(
verbose=False,
**kwargs,
):
"""function to perfom PDF morphing.
"""function to perform PDF morphing.
Parameters
----------
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
-------
Expand Down
Loading

0 comments on commit 134c810

Please sign in to comment.