Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add codespell support (config, workflow to detect/not fix) and make it fix few typos #12

Merged
merged 7 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/test-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ jobs:
shell: bash
run: ruff check src

codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Annotate locations with typos
uses: codespell-project/codespell-problem-matcher@v1
- name: Codespell
uses: codespell-project/actions-codespell@v2

test-suite:
runs-on: ${{ matrix.os }}
needs: linter-check
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ It includes several local-low-rank based denoising methods (see the `documentati
4. Optimal Thresholding
5. Raw Singular Value Thresholding

A mathematical description of theses methods is available in the documentation.
A mathematical description of these methods is available in the documentation.



Expand All @@ -58,7 +58,7 @@ After installing you can use the ``patch-denoise`` command-line.

$ patch-denoise input_file.nii output_file.nii --mask="auto"

See ``patch-denoise --help`` for detailled options.
See ``patch-denoise --help`` for detailed options.

Documentation and Examples
==========================
Expand Down
2 changes: 1 addition & 1 deletion docs/denoisers.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
LLR Denoising Methods
=====================

Patch-denoise implemement several local-low-rank methods, based on singular values thresholding.
Patch-denoise implement several local-low-rank methods, based on singular values thresholding.


Singular Value Thresholding
Expand Down
11 changes: 10 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "patch-denoise"
description = "Denoising method for sequence of images or volumes. Primarly targeting fMRI data."
description = "Denoising method for sequence of images or volumes. Primarily targeting fMRI data."
authors = [{name="Pierre-antoine Comby", email="[email protected]"}]

readme = "README.rst"
Expand Down Expand Up @@ -29,12 +29,14 @@ classifiers = [
[project.optional-dependencies]
optional = ["modopt", "nipype", "numba"]
test = ["pytest", "pytest-cov", "pytest-xdist", "pytest-sugar"]

doc = [
"pydata-sphinx-theme",
"numpydoc",
"sphinx_gallery",
"sphinx",
]

dev = ["black", "isort", "ruff"]

[project.scripts]
Expand Down Expand Up @@ -80,3 +82,10 @@ addopts = [
"--cov-report=term-missing",
"--cov-report=xml"
]

[tool.codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
skip = '.git*'
check-hidden = true
ignore-regex = '\bND\b'
ignore-words-list = 'fro'
1 change: 1 addition & 0 deletions src/patch_denoise/bindings/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ def _get_parser():
),
default=None,
)

denoising_group.add_argument(
"--extra",
metavar="key=value",
Expand Down
2 changes: 1 addition & 1 deletion src/patch_denoise/bindings/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def __str__(self):


def load_as_array(input):
"""Load a file as a numpy array, and return affine matrix if avaiable."""
"""Load a file as a numpy array, and return affine matrix if available."""
import nibabel as nib

if input is None:
Expand Down
2 changes: 1 addition & 1 deletion src/patch_denoise/space_time/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def denoise(self, input_data, mask=None, mask_threshold=50, progbar=None):

# # Replace all nan by mean value of patch.
# # FIXME this behaviour should be documented
# # And ideally choosen by the user.
# # And ideally chosen by the user.

# patch[np.isnan(patch)] = np.mean(patch)
# p_denoise, maxidx, noise_var = self._patch_processing(
Expand Down
6 changes: 3 additions & 3 deletions src/patch_denoise/space_time/lowrank.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self, patch_shape, patch_overlap, threshold_scale, **kwargs):
self.input_denoising_kwargs["threshold_scale"] = threshold_scale

def _patch_processing(self, patch, patch_idx=None, threshold_scale=1.0):
"""Process a pach with the MP-PCA method."""
"""Process a patch with the MP-PCA method."""
p_center, eig_vals, eig_vec, p_tmean = eig_analysis(patch)
maxidx = 0
meanvar = np.mean(eig_vals)
Expand Down Expand Up @@ -102,7 +102,7 @@ def denoise(
return super().denoise(input_data, mask, mask_threshold, progbar=progbar)

def _patch_processing(self, patch, patch_idx=None, var_apriori=None):
"""Process a pach with the Hybrid-PCA method."""
"""Process a patch with the Hybrid-PCA method."""
varest = np.mean(var_apriori.get_patch(patch_idx))
p_center, eig_vals, eig_vec, p_tmean = eig_analysis(patch)
maxidx = 0
Expand Down Expand Up @@ -168,7 +168,7 @@ def denoise(
return super().denoise(input_data, mask, mask_threshold, progbar=progbar)

def _patch_processing(self, patch, patch_idx=None, **kwargs):
"""Process a pach with the simple SVT method."""
"""Process a patch with the simple SVT method."""
# Centering for better precision in SVD
u_vec, s_values, v_vec, p_tmean = svd_analysis(patch)

Expand Down
Loading