Skip to content

Commit

Permalink
Merge pull request #76 from cadenmyers13/new-scikit
Browse files Browse the repository at this point in the history
fix: Update `.github/` and `.pre-commit-config.yaml`
  • Loading branch information
sbillinge authored Jan 6, 2025
2 parents e2a9438 + 4bc59e2 commit 1521c33
Show file tree
Hide file tree
Showing 14 changed files with 91 additions and 70 deletions.
8 changes: 4 additions & 4 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
coverage:
status:
project: # more options at https://docs.codecov.com/docs/commit-status
project: # more options at https://docs.codecov.com/docs/commit-status
default:
target: auto # use the coverage from the base commit, fail if coverage is lower
threshold: 0% # allow the coverage to drop by
threshold: 0% # allow the coverage to drop by

comment:
layout: " diff, flags, files"
behavior: default
require_changes: false
require_base: false # [true :: must have a base report to post]
require_head: false # [true :: must have a head report to post]
require_base: false # [true :: must have a base report to post]
require_head: false # [true :: must have a head report to post]
hide_project_coverage: false # [true :: only show coverage on the git diff aka patch coverage]
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/release_checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ assignees: ""
- [ ] All the badges on the README are passing.
- [ ] License information is verified as correct. If you are unsure, please comment below.
- [ ] Locally rendered documentation contains all appropriate pages, including API references (check no modules are
missing), tutorials, and other human-written text is up-to-date with any changes in the code.
missing), tutorials, and other human-written text is up-to-date with any changes in the code.
- [ ] Installation instructions in the README, documentation, and the website (e.g., diffpy.org) are updated.
- [ ] Successfully run any tutorial examples or do functional testing with the latest Python version.
- [ ] Grammar and writing quality are checked (no typos).
- [ ] Install `pip install build twine`, run `python -m build` and `twine check dist/*` to ensure that the package can be built and is correctly formatted for PyPI release.
- [ ] Install `pip install build twine`, run `python -m build` and `twine check dist/*` to ensure that the package can be built and is correctly formatted for PyPI release.

Please mention @sbillinge here when you are ready for PyPI/GitHub release. Include any additional comments necessary, such as version information and details about the pre-release here:

Expand All @@ -42,5 +42,5 @@ Please let @sbillinge know that all checks are done and the package is ready for

<!-- Before closing this issue, please complete the following: -->

- [ ] Run tutorial examples and conduct functional testing using the installation guide in the README. Attach screenshots/results as comments.
- [ ] Documentation (README, tutorials, API references, and websites) is deployed without broken links or missing figures.
- [ ] Run tutorial examples and conduct functional testing using the installation guide in the README. Attach screenshots/results as comments.
- [ ] Documentation (README, tutorials, API references, and websites) is deployed without broken links or missing figures.
4 changes: 3 additions & 1 deletion .github/workflows/build-wheel-release-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ on:
workflow_dispatch:
push:
tags:
- '*' # Trigger on all tags initially, but tag and release privilege are verified in _build-wheel-release-upload.yml
- "*" # Trigger on all tags initially, but tag and release privilege are verified in _build-wheel-release-upload.yml

jobs:
release:
uses: Billingegroup/release-scripts/.github/workflows/_build-wheel-release-upload.yml@v0
with:
project: diffpy.fourigui
c_extension: false
github_admin_username: sbillinge
secrets:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/check-news-item.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Check for News
on:
pull_request_target:
branches:
- main
- main

jobs:
build:
check-news-item:
uses: Billingegroup/release-scripts/.github/workflows/_check-news-item.yml@v0
with:
project: diffpy.fourigui
2 changes: 1 addition & 1 deletion .github/workflows/matrix-and-codecov-on-merge-to-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
workflow_dispatch:

jobs:
coverage:
matrix-coverage:
uses: Billingegroup/release-scripts/.github/workflows/_matrix-and-codecov-on-merge-to-main.yml@v0
with:
project: diffpy.fourigui
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/publish-docs-on-release.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
name: Deploy Documentation on Release

on:
release:
types: [published]
workflow_dispatch:

jobs:
docs:
permissions:
contents: write
uses: Billingegroup/release-scripts/.github/workflows/_publish-docs-on-release.yml@v0
with:
project: diffpy.fourigui
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
workflow_dispatch:

jobs:
validate:
tests-on-pr:
uses: Billingegroup/release-scripts/.github/workflows/_tests-on-pr.yml@v0
with:
project: diffpy.fourigui
Expand Down
38 changes: 26 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
default_language_version:
python: python3
python: python3
ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit hooks
autofix_prs: true
autoupdate_branch: 'pre-commit-autoupdate'
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: monthly
skip: [no-commit-to-branch]
submodules: false
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit hooks
autofix_prs: true
autoupdate_branch: "pre-commit-autoupdate"
autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate"
autoupdate_schedule: monthly
skip: [no-commit-to-branch]
submodules: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
Expand Down Expand Up @@ -47,6 +47,20 @@ repos:
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
additional_dependencies:
- tomli
- id: codespell
additional_dependencies:
- tomli
# prettier - multi formatter for .json, .yml, and .md files
- repo: https://github.com/pre-commit/mirrors-prettier
rev: f12edd9c7be1c20cfa42420fd0e6df71e42b51ea # frozen: v4.0.0-alpha.8
hooks:
- id: prettier
additional_dependencies:
- "prettier@^3.2.4"
# docformatter - PEP 257 compliant docstring formatter
- repo: https://github.com/s-weigand/docformatter
rev: 5757c5190d95e5449f102ace83df92e7d3b06c6c
hooks:
- id: docformatter
additional_dependencies: [tomli]
args: [--in-place, --config, ./pyproject.toml]
23 changes: 23 additions & 0 deletions news/workflows.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* <news item>

**Changed:**

* Modify `.github` directory and `.pre-commit-config.yaml` to comply with renaming of package maintainer.

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
1 change: 0 additions & 1 deletion src/diffpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See LICENSE.rst for license information.
#
##############################################################################

"""Blank namespace package for module diffpy."""


Expand Down
1 change: 0 additions & 1 deletion src/diffpy/fourigui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See LICENSE.rst for license information.
#
##############################################################################

"""Tool for visualizing 3D diffraction and PDF Images."""

# package version
Expand Down
59 changes: 24 additions & 35 deletions src/diffpy/fourigui/fourigui.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self):
self.initUI()

def initUI(self):
"""Initialize the GUI for fourigui"""
"""Initialize the GUI for fourigui."""

self.loaded = False # denotes whether a dataset is loaded
self.transformed = False # denotes whether dataset is Fourier transformed
Expand Down Expand Up @@ -254,11 +254,10 @@ def initUI(self):
frame11.place(x=WIDTH // 2, y=HEIGHT // 2) # , height=HEIGHT//2, width=WIDTH//2)

def load_cube(self):
"""
loads 3D array in h5py file format from the filename input panel
3D array is expected to be a reconstructed reciprocal scattering volume
when executed, one slide perpendicular to the selected axis will be plotted in the plot panel
"""
"""Loads 3D array in h5py file format from the filename input panel 3D
array is expected to be a reconstructed reciprocal scattering volume
when executed, one slide perpendicular to the selected axis will be
plotted in the plot panel."""

filename = self.filename_entry.get()
f = h5py.File(filename, "r")
Expand Down Expand Up @@ -327,7 +326,7 @@ def load_cube(self):
self.intensity_upd_global()

def plot_plane(self):
"""update plotted plane perpendicular to the selected axis"""
"""Update plotted plane perpendicular to the selected axis."""
if self.axis.get() == 0:
self.im.set_data(self.cube[self.plane_num.get(), :, :])
elif self.axis.get() == 1:
Expand All @@ -339,7 +338,7 @@ def plot_plane(self):
self.canvas.draw()

def colorrange_upd(self):
"""change color range in plot"""
"""Change color range in plot."""
try:
if self.colorbarmin.get() and self.colorbarmax.get():
vmin = float(self.colorbarmin.get())
Expand All @@ -359,7 +358,8 @@ def colorrange_upd(self):
self.plot_plane()

def intensity_upd_local(self):
"""show local intensity minimum, maximum and sum of current plotted plane"""
"""Show local intensity minimum, maximum and sum of current plotted
plane."""
if self.axis.get() == 0:
plane = self.cube[self.plane_num.get(), :, :]
elif self.axis.get() == 1:
Expand All @@ -373,7 +373,7 @@ def intensity_upd_local(self):
self.localnanratio["text"] = f"{round(nan_ratio, 2)}"

def intensity_upd_global(self):
"""Load global intensity minimum, maximum and sum of 3D array"""
"""Load global intensity minimum, maximum and sum of 3D array."""
self.intensity_upd_local()
nan_ratio = np.count_nonzero(np.isnan(self.cube)) / self.cube.size
self.globalmax["text"] = f"{np.format_float_scientific(np.nanmax(self.cube), 1)}"
Expand All @@ -382,10 +382,8 @@ def intensity_upd_global(self):
self.globalnanratio["text"] = "{}".format(round(nan_ratio, 2))

def fft(self):
"""
Fourier transform 3D array from reciprocal to real space
the origin of reciprocal and real space is expected to be the central voxel
"""
"""Fourier transform 3D array from reciprocal to real space the origin
of reciprocal and real space is expected to be the central voxel."""

def perform_fft(fftholder):
fftholder = np.nan_to_num(fftholder)
Expand Down Expand Up @@ -438,10 +436,9 @@ def perform_fft(fftholder):
self.intensity_upd_global()

def ifft(self):
"""
Inverse Fourier transform 3D array from real to reciprocal space
the origin of real and reciprocal space is expected to be the central voxel
"""
"""Inverse Fourier transform 3D array from real to reciprocal space the
origin of real and reciprocal space is expected to be the central
voxel."""
if not self.cutoff.get():
self.cube_real = self.cube
self.cube = self.cube_reci
Expand All @@ -455,8 +452,7 @@ def ifft(self):
self.intensity_upd_global()

def applycutoff(self):
"""
shape the reciprocal-space array
"""Shape the reciprocal-space array.
reassign all voxels with distance smaller than qmin and greater than qmax
to np.nan.
Expand Down Expand Up @@ -507,9 +503,8 @@ def applycutoff(self):
self.intensity_upd_global()

def redocutuff(self):
"""
Redo the cutoff operation depending on the current space (real or reciprocal).
"""
"""Redo the cutoff operation depending on the current space (real or
reciprocal)."""
if self.space.get(): # in real space
self.cube_realcut = self.cube
if not self.transformed:
Expand All @@ -522,9 +517,8 @@ def redocutuff(self):
self.intensity_upd_global()

def newcutoff(self):
"""
Apply a new cutoff based on the current space and cutoff settings.
"""
"""Apply a new cutoff based on the current space and cutoff
settings."""
if self.cutoff.get():
if self.space.get() and self.transformed:
self.cube = self.cube_real
Expand All @@ -535,9 +529,8 @@ def newcutoff(self):
self.applycutoff()

def plot_next_plane(self):
"""
Plot the next plane in the dataset, looping back to the first if at the end.
"""
"""Plot the next plane in the dataset, looping back to the first if at
the end."""
n = self.plane_num.get()
if n == len(self.cube[self.axis.get()]) - 1:
n = 0
Expand All @@ -547,9 +540,7 @@ def plot_next_plane(self):
self.plot_plane()

def animation(self):
"""
slices through the 3D array along the selected axis
"""
"""Slices through the 3D array along the selected axis."""
try:
if not self.anientry.get():
anispeed = 1
Expand All @@ -563,9 +554,7 @@ def animation(self):
self.plot_next_plane()

def multiple_funcs(*funcs):
"""
Executes multiple functions passed as arguments in sequence.
"""
"""Executes multiple functions passed as arguments in sequence."""
for func in funcs:
func

Expand Down
1 change: 0 additions & 1 deletion src/diffpy/fourigui/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See LICENSE.rst for license information.
#
##############################################################################

"""Definition of __version__."""

# We do not use the other three variables, but can be added back if needed.
Expand Down
6 changes: 3 additions & 3 deletions tests/test_version.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Unit tests for __version__.py
"""
"""Unit tests for __version__.py."""

import diffpy.fourigui


def test_package_version():
"""Ensure the package version is defined and not set to the initial placeholder."""
"""Ensure the package version is defined and not set to the initial
placeholder."""
assert hasattr(diffpy.fourigui, "__version__")
assert diffpy.fourigui.__version__ != "0.0.0"

0 comments on commit 1521c33

Please sign in to comment.