Skip to content

Commit

Permalink
Merge branch 'feature/v0.2.4' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Aug 27, 2023
2 parents 95377bf + 1e4b4a4 commit 0204f72
Show file tree
Hide file tree
Showing 31 changed files with 378 additions and 513 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[run]
source = colour_demosaicing
sigterm = True
[report]
exclude_lines =
pragma: no cover
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/continuous-integration-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ jobs:
sudo apt-get update
sudo apt-get --yes install latexmk texlive-full
- name: Install Poetry
env:
POETRY_VERSION: 1.4.0
run: |
curl -sSL https://install.python-poetry.org | POETRY_HOME=$HOME/.poetry python3 -
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
shell: bash
- name: Install Package Dependencies
run: |
poetry run python -m pip install --upgrade pip
poetry install --extras "read-the-docs"
poetry install
poetry run python -c "import imageio;imageio.plugins.freeimage.download()"
shell: bash
- name: Build Documentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
env:
POETRY_VERSION: 1.4.0
run: |
curl -sSL https://install.python-poetry.org | POETRY_HOME=$HOME/.poetry python3 -
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
Expand All @@ -51,9 +53,10 @@ jobs:
shell: bash
- name: Test with Pytest
run: |
poetry run python -W ignore -m pytest --disable-warnings --doctest-modules --ignore=$CI_PACKAGE/examples --cov=$CI_PACKAGE $CI_PACKAGE
poetry run python -W ignore -m pytest --doctest-modules --ignore=$CI_PACKAGE/examples --cov=$CI_PACKAGE $CI_PACKAGE
shell: bash
- name: Upload Coverage to coveralls.io
if: matrix.os == 'macOS-latest' && matrix.python-version == '3.11'
run: |
if [ -z "$COVERALLS_REPO_TOKEN" ]; then echo \"COVERALLS_REPO_TOKEN\" secret is undefined!; else poetry run coveralls; fi
shell: bash
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*.pyc
*.pyo
.DS_Store
.coverage
.coverage*
.fleet
.idea
.ipynb_checkpoints
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
repos:
- repo: https://github.com/ikamensh/flynt/
rev: '0.77'
rev: '1.0.1'
hooks:
- id: flynt
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.239'
rev: 'v0.0.285'
hooks:
- id: ruff
- repo: https://github.com/psf/black
rev: 22.10.0
rev: 23.7.0
hooks:
- id: black
language_version: python3.9
Expand Down
7 changes: 2 additions & 5 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,5 @@ formats:
- pdf

python:
install:
- method: pip
path: .
extra_requirements:
- read-the-docs
install:
- requirements: docs/requirements.txt
2 changes: 1 addition & 1 deletion CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ About

| **Colour - Demosaicing** by Colour Developers
| Copyright 2015 Colour Developers – `colour-developers@colour-science.org <colour-developers@colour-science.org>`__
| This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause
| This software is released under terms of BSD-3-Clause: https://opensource.org/licenses/BSD-3-Clause
| `https://github.com/colour-science/colour-demosaicing <https://github.com/colour-science/colour-demosaicing>`__
29 changes: 8 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
Copyright 2015 Colour Developers
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Colour Developers nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL COLOUR DEVELOPERS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
20 changes: 10 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ Colour - Demosaicing

.. end-badges
A `Python <https://www.python.org/>`__ package implementing various
A `Python <https://www.python.org>`__ package implementing various
CFA (Colour Filter Array) demosaicing algorithms and related utilities.

It is open source and freely available under the
`New BSD License <https://opensource.org/licenses/BSD-3-Clause>`__ terms.
`BSD-3-Clause <https://opensource.org/licenses/BSD-3-Clause>`__ terms.

.. image:: https://raw.githubusercontent.com/colour-science/colour-demosaicing/master/docs/_static/Demosaicing_001.png

Expand Down Expand Up @@ -67,11 +67,11 @@ Primary Dependencies

**Colour - Demosaicing** requires various dependencies in order to run:

- `python >= 3.8, < 4 <https://www.python.org/download/releases/>`__
- `colour-science >= 4 <https://pypi.org/project/colour-science/>`__
- `imageio >= 2, < 3 <https://imageio.github.io/>`__
- `numpy >= 1.19, < 2 <https://pypi.org/project/numpy/>`__
- `scipy >= 1.5, < 2 <https://pypi.org/project/scipy/>`__
- `python >= 3.9, < 4 <https://www.python.org/download/releases>`__
- `colour-science >= 4.3 <https://pypi.org/project/colour-science>`__
- `imageio >= 2, < 3 <https://imageio.github.io>`__
- `numpy >= 1.22, < 2 <https://pypi.org/project/numpy>`__
- `scipy >= 1.8, < 2 <https://pypi.org/project/scipy>`__

Pypi
~~~~
Expand All @@ -90,7 +90,7 @@ Contributing
^^^^^^^^^^^^

If you would like to contribute to `Colour - Demosaicing <https://github.com/colour-science/colour-demosaicing>`__,
please refer to the following `Contributing <https://www.colour-science.org/contributing/>`__
please refer to the following `Contributing <https://www.colour-science.org/contributing>`__
guide for `Colour <https://github.com/colour-science/colour>`__.

Bibliography
Expand All @@ -110,7 +110,7 @@ Code of Conduct
---------------

The *Code of Conduct*, adapted from the `Contributor Covenant 1.4 <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>`__,
is available on the `Code of Conduct <https://www.colour-science.org/code-of-conduct/>`__ page.
is available on the `Code of Conduct <https://www.colour-science.org/code-of-conduct>`__ page.

Contact & Social
----------------
Expand All @@ -128,5 +128,5 @@ About

| **Colour - Demosaicing** by Colour Developers
| Copyright 2015 Colour Developers – `colour-developers@colour-science.org <colour-developers@colour-science.org>`__
| This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause
| This software is released under terms of BSD-3-Clause: https://opensource.org/licenses/BSD-3-Clause
| `https://github.com/colour-science/colour-demosaicing <https://github.com/colour-science/colour-demosaicing>`__
6 changes: 3 additions & 3 deletions TODO.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ TODO

- colour_demosaicing/__init__.py

- Line 81 : # TODO: Remove legacy printing support when deemed appropriate.
- Line 82 : # TODO: Remove legacy printing support when deemed appropriate.

About
-----

| **Colour - Demosaicing** by Colour Developers
| Copyright 2015 Colour Developers `colour-developers@colour-science.org <colour-developers@colour-science.org>`__
| This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause
| Copyright 2015 Colour Developers - `colour-developers@colour-science.org <colour-developers@colour-science.org>`__
| This software is released under terms of BSD-3-Clause: https://opensource.org/licenses/BSD-3-Clause
| `https://github.com/colour-science/colour-demosaicing <https://github.com/colour-science/colour-demosaicing>`__
8 changes: 4 additions & 4 deletions colour_demosaicing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import contextlib
import numpy as np
import os
import subprocess # nosec
import subprocess

import colour

Expand All @@ -29,7 +29,7 @@

__author__ = "Colour Developers"
__copyright__ = "Copyright 2015 Colour Developers"
__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause"
__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"
__maintainer__ = "Colour Developers"
__email__ = "colour-developers@colour-science.org"
__status__ = "Production"
Expand Down Expand Up @@ -62,8 +62,8 @@

try:
_version: str = (
subprocess.check_output( # nosec
["git", "describe"],
subprocess.check_output(
["git", "describe"], # noqa: S603, S607
cwd=os.path.dirname(__file__),
stderr=subprocess.STDOUT,
)
Expand Down
2 changes: 1 addition & 1 deletion colour_demosaicing/bayer/demosaicing/bilinear.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

__author__ = "Colour Developers"
__copyright__ = "Copyright 2015 Colour Developers"
__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause"
__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"
__maintainer__ = "Colour Developers"
__email__ = "colour-developers@colour-science.org"
__status__ = "Production"
Expand Down
2 changes: 1 addition & 1 deletion colour_demosaicing/bayer/demosaicing/malvar2004.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

__author__ = "Colour Developers"
__copyright__ = "Copyright 2015 Colour Developers"
__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause"
__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"
__maintainer__ = "Colour Developers"
__email__ = "colour-developers@colour-science.org"
__status__ = "Production"
Expand Down
9 changes: 2 additions & 7 deletions colour_demosaicing/bayer/demosaicing/menon2007.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

__author__ = "Colour Developers"
__copyright__ = "Copyright 2015 Colour Developers"
__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause"
__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"
__maintainer__ = "Colour Developers"
__email__ = "colour-developers@colour-science.org"
__status__ = "Production"
Expand Down Expand Up @@ -140,12 +140,7 @@ def demosaicing_CFA_Bayer_Menon2007(
C_V = np.where(B_m == 1, B - G_V, C_V)

D_H = np.abs(C_H - np.pad(C_H, ((0, 0), (0, 2)), mode="reflect")[:, 2:])
D_V = np.abs(
C_V
- np.pad(C_V, ((0, 2), (0, 0)), mode="reflect")[ # pyright: ignore
2:, :
]
)
D_V = np.abs(C_V - np.pad(C_V, ((0, 2), (0, 0)), mode="reflect")[2:, :])

del h_0, h_1, CFA, C_V, C_H

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

__author__ = "Colour Developers"
__copyright__ = "Copyright 2015 Colour Developers"
__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause"
__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"
__maintainer__ = "Colour Developers"
__email__ = "colour-developers@colour-science.org"
__status__ = "Production"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

__author__ = "Colour Developers"
__copyright__ = "Copyright 2015 Colour Developers"
__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause"
__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"
__maintainer__ = "Colour Developers"
__email__ = "colour-developers@colour-science.org"
__status__ = "Production"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

__author__ = "Colour Developers"
__copyright__ = "Copyright 2015 Colour Developers"
__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause"
__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"
__maintainer__ = "Colour Developers"
__email__ = "colour-developers@colour-science.org"
__status__ = "Production"
Expand Down
4 changes: 2 additions & 2 deletions colour_demosaicing/bayer/masks.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

__author__ = "Colour Developers"
__copyright__ = "Copyright 2015 Colour Developers"
__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause"
__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"
__maintainer__ = "Colour Developers"
__email__ = "colour-developers@colour-science.org"
__status__ = "Production"
Expand Down Expand Up @@ -71,7 +71,7 @@ def masks_CFA_Bayer(

pattern = validate_method(
pattern,
["RGGB", "BGGR", "GRBG", "GBRG"],
("RGGB", "BGGR", "GRBG", "GBRG"),
'"{0}" CFA pattern is invalid, it must be one of {1}!',
).upper()

Expand Down
2 changes: 1 addition & 1 deletion colour_demosaicing/bayer/mosaicing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

__author__ = "Colour Developers"
__copyright__ = "Copyright 2015 Colour Developers"
__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause"
__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"
__maintainer__ = "Colour Developers"
__email__ = "colour-developers@colour-science.org"
__status__ = "Production"
Expand Down
2 changes: 1 addition & 1 deletion colour_demosaicing/bayer/tests/test_masks.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

__author__ = "Colour Developers"
__copyright__ = "Copyright 2015 Colour Developers"
__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause"
__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"
__maintainer__ = "Colour Developers"
__email__ = "colour-developers@colour-science.org"
__status__ = "Production"
Expand Down
2 changes: 1 addition & 1 deletion colour_demosaicing/bayer/tests/test_mosaicing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

__author__ = "Colour Developers"
__copyright__ = "Copyright 2015 Colour Developers"
__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause"
__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"
__maintainer__ = "Colour Developers"
__email__ = "colour-developers@colour-science.org"
__status__ = "Production"
Expand Down
18 changes: 0 additions & 18 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,21 +183,3 @@
epub_publisher = package.__author__
epub_copyright = package.__copyright__.replace("Copyright (C)", "")
epub_exclude_files = ["search.html"]


def autodoc_process_docstring(
app, what, name, obj, options, lines # noqa: ARG001
):
"""Process the docstrings to remove the *# noqa* *flake8* pragma."""

for i, line in enumerate(lines):
lines[i] = line.replace("# noqa", "")


def setup(app):
"""
Prepare the extension and linking resources that Sphinx uses in the
build process.
"""

app.connect("autodoc-process-docstring", autodoc_process_docstring)
8 changes: 4 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Colour - Demosaicing
====================

A `Python <https://www.python.org/>`__ package implementing various
A `Python <https://www.python.org>`__ package implementing various
CFA (Colour Filter Array) demosaicing algorithms and related utilities.

It is open source and freely available under the
`New BSD License <https://opensource.org/licenses/BSD-3-Clause>`__ terms.
`BSD-3-Clause <https://opensource.org/licenses/BSD-3-Clause>`__ terms.

.. image:: https://raw.githubusercontent.com/colour-science/colour-demosaicing/master/docs/_static/Demosaicing_001.png

Expand Down Expand Up @@ -46,7 +46,7 @@ Code of Conduct
---------------

The *Code of Conduct*, adapted from the `Contributor Covenant 1.4 <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>`__,
is available on the `Code of Conduct <https://www.colour-science.org/code-of-conduct/>`__ page.
is available on the `Code of Conduct <https://www.colour-science.org/code-of-conduct>`__ page.

Contact & Social
----------------
Expand All @@ -64,5 +64,5 @@ About

| **Colour - Demosaicing** by Colour Developers
| Copyright 2015 Colour Developers – `colour-developers@colour-science.org <colour-developers@colour-science.org>`__
| This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause
| This software is released under terms of BSD-3-Clause: https://opensource.org/licenses/BSD-3-Clause
| `https://github.com/colour-science/colour-demosaicing <https://github.com/colour-science/colour-demosaicing>`__

0 comments on commit 0204f72

Please sign in to comment.