From d9dfa08569b5fb9acc7f34e68d9bb221a5793c0e Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 3 Oct 2024 21:26:20 -0400 Subject: [PATCH 1/5] Add github action to codespell master on push and PRs --- .github/workflows/codespell.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/codespell.yml diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 0000000..e21712e --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,25 @@ +# Codespell configuration is within pyproject.toml +--- +name: Codespell + +on: + push: + branches: [master] + pull_request: + branches: [master] + +permissions: + contents: read + +jobs: + 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 From a23e24fbd68b4354a9d0a358c0389d41cc36c94b Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 3 Oct 2024 21:26:20 -0400 Subject: [PATCH 2/5] Add rudimentary codespell config --- pyproject.toml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index d18bbde..58eb089 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,3 +77,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' From 2a0b26c4729150a2cc5fb1b8df03323cd8ff298f Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 3 Oct 2024 21:27:56 -0400 Subject: [PATCH 3/5] [DATALAD RUNCMD] run codespell throughout fixing typos automagically (but ignoring overall fail due to ambigous ones) === Do not change lines below === { "chain": [], "cmd": "codespell -w || :", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- README.rst | 2 +- docs/denoisers.rst | 2 +- pyproject.toml | 4 ++-- src/patch_denoise/bindings/cli.py | 2 +- src/patch_denoise/bindings/utils.py | 2 +- src/patch_denoise/space_time/base.py | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index 9436893..e4d8c5e 100644 --- a/README.rst +++ b/README.rst @@ -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 ========================== diff --git a/docs/denoisers.rst b/docs/denoisers.rst index 4b94898..a6c7fbb 100644 --- a/docs/denoisers.rst +++ b/docs/denoisers.rst @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 58eb089..37d16be 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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="pierre-antoine.comby@crans.org"}] readme = "README.rst" @@ -30,7 +30,7 @@ classifiers = [ [project.optional-dependencies] optional = ["modopt", "nipype", "numba"] test = ["pytest", "pytest-cov", "pytest-xdist", "pytest-sugar"] -# sphinx 6 failes with pydata, sphinx 5 with sphinx gallery... +# sphinx 6 fails with pydata, sphinx 5 with sphinx gallery... doc = ["pydata-sphinx-theme", "numpydoc", "sphinx_gallery", "sphinx<5"] dev = ["black", "isort", "ruff"] diff --git a/src/patch_denoise/bindings/cli.py b/src/patch_denoise/bindings/cli.py index 1ae23ed..3806d6d 100644 --- a/src/patch_denoise/bindings/cli.py +++ b/src/patch_denoise/bindings/cli.py @@ -49,7 +49,7 @@ def parse_args(): "Slice across time. \n" "If x the patch will be N times longer in space than in time \n" "If int, this is the size of the time dimension patch. \n" - "If not specified, the whole time serie is used. \n" + "If not specified, the whole time series is used. \n" "Note: setting a low aspect ratio will increase the number of patch to be" "processed, and will increase memory usage and computation times." ), diff --git a/src/patch_denoise/bindings/utils.py b/src/patch_denoise/bindings/utils.py index f5c9835..a89df69 100644 --- a/src/patch_denoise/bindings/utils.py +++ b/src/patch_denoise/bindings/utils.py @@ -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: diff --git a/src/patch_denoise/space_time/base.py b/src/patch_denoise/space_time/base.py index 0910509..a9b5b45 100644 --- a/src/patch_denoise/space_time/base.py +++ b/src/patch_denoise/space_time/base.py @@ -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( From 6a7ccb7a4ffe9dcdc0db42334248291e09e05c57 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 3 Oct 2024 21:28:09 -0400 Subject: [PATCH 4/5] [DATALAD RUNCMD] Do interactive fixing of some ambigous typos === Do not change lines below === { "chain": [], "cmd": "codespell -w -i 3 -C 2", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- README.rst | 2 +- src/patch_denoise/space_time/lowrank.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index e4d8c5e..dd514a6 100644 --- a/README.rst +++ b/README.rst @@ -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. diff --git a/src/patch_denoise/space_time/lowrank.py b/src/patch_denoise/space_time/lowrank.py index 923fab1..78b1110 100644 --- a/src/patch_denoise/space_time/lowrank.py +++ b/src/patch_denoise/space_time/lowrank.py @@ -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) @@ -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 @@ -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) From 87e23251ecefabbd35f6d72581f9d20345fdb8c3 Mon Sep 17 00:00:00 2001 From: Pierre-antoine Comby Date: Fri, 4 Oct 2024 10:05:11 +0200 Subject: [PATCH 5/5] refactor(ci): move codespell with the linters. --- .github/workflows/codespell.yml | 25 ------------------------- .github/workflows/test-ci.yml | 12 ++++++++++++ 2 files changed, 12 insertions(+), 25 deletions(-) delete mode 100644 .github/workflows/codespell.yml diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml deleted file mode 100644 index e21712e..0000000 --- a/.github/workflows/codespell.yml +++ /dev/null @@ -1,25 +0,0 @@ -# Codespell configuration is within pyproject.toml ---- -name: Codespell - -on: - push: - branches: [master] - pull_request: - branches: [master] - -permissions: - contents: read - -jobs: - 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 diff --git a/.github/workflows/test-ci.yml b/.github/workflows/test-ci.yml index ed84388..a62486f 100644 --- a/.github/workflows/test-ci.yml +++ b/.github/workflows/test-ci.yml @@ -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