Skip to content

Commit

Permalink
Merge branch 'release/v0.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Jul 1, 2022
2 parents b798585 + 04b2991 commit c78eb63
Show file tree
Hide file tree
Showing 20 changed files with 151 additions and 151 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/continuous-integration-quality-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Continuous Integration - Quality & Unit Tests
on: [push, pull_request]

jobs:
continuous-integration-package:
continuous-integration-quality-unit-tests:
name: ${{ matrix.os }} - Python ${{ matrix.python-version }}
strategy:
matrix:
Expand All @@ -26,12 +26,6 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies (macOS)
if: matrix.os == 'macOS-latest'
run: |
brew install gnu-sed
ln -s /usr/local/bin/gsed /usr/local/bin/sed
shell: bash
- name: Install Poetry
run: |
curl -L https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py -o get-poetry.py
Expand All @@ -54,7 +48,7 @@ jobs:
shell: bash
- name: Test with Pytest
run: |
poetry run python -W ignore -m py.test --disable-warnings --doctest-modules --ignore=$CI_PACKAGE/examples --cov=$CI_PACKAGE $CI_PACKAGE
poetry run python -W ignore -m pytest --disable-warnings --doctest-modules --ignore=$CI_PACKAGE/examples --cov=$CI_PACKAGE $CI_PACKAGE
shell: bash
- name: Upload Coverage to coveralls.io
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Continuous Integration - Static Type Checking
on: [push, pull_request]

jobs:
continuous-integration-package:
continuous-integration-static-type-checking:
name: ${{ matrix.os }} - Python ${{ matrix.python-version }}
strategy:
matrix:
Expand All @@ -21,11 +21,6 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies (macOS)
run: |
brew install gnu-sed graphviz
ln -s /usr/local/bin/gsed /usr/local/bin/sed
shell: bash
- name: Static Type Checking
run: |
pip install -r requirements.txt
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
.idea
.ipynb_checkpoints/
.mypy_cache
.vscode
.sandbox

__pycache__

build
colour_demosaicing.egg-info
dist
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
rev: v2.34.0
hooks:
- id: pyupgrade
args: [--py38-plus]
Expand All @@ -9,7 +9,7 @@ repos:
hooks:
- id: flynt
- repo: https://github.com/psf/black
rev: 22.1.0
rev: 22.3.0
hooks:
- id: black
language_version: python3.8
Expand Down
9 changes: 6 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ Colour - Demosaicing
|actions| |coveralls| |codacy| |version|

.. |actions| image:: https://img.shields.io/github/workflow/status/colour-science/colour-demosaicing/Continuous%20Integration?label=actions&logo=github&style=flat-square
.. |actions| image:: https://img.shields.io/github/workflow/status/colour-science/colour-demosaicing/Continuous%20Integration%20-%20Quality%20&%20Unit%20Tests?label=actions&logo=github&style=flat-square
:target: https://github.com/colour-science/colour-demosaicing/actions
:alt: Develop Build Status
.. |coveralls| image:: http://img.shields.io/coveralls/colour-science/colour-demosaicing/develop.svg?style=flat-square
:target: https://coveralls.io/r/colour-science/colour-demosaicing
:alt: Coverage Status
.. |codacy| image:: https://img.shields.io/codacy/grade/984900e3a85e40239a0f8f633dd1ebcb/develop.svg?style=flat-square
.. |codacy| image:: https://img.shields.io/codacy/grade/2862b4f2217742ae83c972d7e3af44d7/develop.svg?style=flat-square
:target: https://www.codacy.com/app/colour-science/colour-demosaicing
:alt: Code Grade
.. |version| image:: https://img.shields.io/pypi/v/colour-demosaicing.svg?style=flat-square
Expand Down Expand Up @@ -68,7 +68,10 @@ Primary Dependencies
**Colour - Demosaicing** requires various dependencies in order to run:

- `python >= 3.8, < 4 <https://www.python.org/download/releases/>`__
- `colour-science <https://pypi.org/project/colour-science/>`__
- `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/>`__

Pypi
~~~~
Expand Down
2 changes: 1 addition & 1 deletion colour_demosaicing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

__major_version__ = "0"
__minor_version__ = "2"
__change_version__ = "1"
__change_version__ = "2"
__version__ = ".".join(
(__major_version__, __minor_version__, __change_version__)
)
Expand Down
10 changes: 5 additions & 5 deletions colour_demosaicing/bayer/demosaicing/malvar2004.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from scipy.ndimage.filters import convolve

from colour.hints import ArrayLike, Literal, NDArray, Union
from colour.utilities import as_float_array, tstack
from colour.utilities import as_float_array, ones, tstack

from colour_demosaicing.bayer import masks_CFA_Bayer

Expand Down Expand Up @@ -157,13 +157,13 @@ def demosaicing_CFA_Bayer_Malvar2004(
del GR_GB, Rg_RB_Bg_BR, Rg_BR_Bg_RB, Rb_BB_Br_RR

# Red rows.
R_r = np.transpose(np.any(R_m == 1, axis=1)[np.newaxis]) * np.ones(R.shape)
R_r = np.transpose(np.any(R_m == 1, axis=1)[np.newaxis]) * ones(R.shape)
# Red columns.
R_c = np.any(R_m == 1, axis=0)[np.newaxis] * np.ones(R.shape)
R_c = np.any(R_m == 1, axis=0)[np.newaxis] * ones(R.shape)
# Blue rows.
B_r = np.transpose(np.any(B_m == 1, axis=1)[np.newaxis]) * np.ones(B.shape)
B_r = np.transpose(np.any(B_m == 1, axis=1)[np.newaxis]) * ones(B.shape)
# Blue columns
B_c = np.any(B_m == 1, axis=0)[np.newaxis] * np.ones(B.shape)
B_c = np.any(B_m == 1, axis=0)[np.newaxis] * ones(B.shape)

del R_m, B_m

Expand Down
16 changes: 8 additions & 8 deletions colour_demosaicing/bayer/demosaicing/menon2007.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from scipy.ndimage.filters import convolve, convolve1d

from colour.hints import ArrayLike, Boolean, Literal, NDArray, Union
from colour.utilities import as_float_array, tsplit, tstack
from colour.utilities import as_float_array, ones, tsplit, tstack

from colour_demosaicing.bayer import masks_CFA_Bayer

Expand Down Expand Up @@ -160,9 +160,9 @@ def demosaicing_CFA_Bayer_Menon2007(
del d_H, d_V, G_H, G_V

# Red rows.
R_r = np.transpose(np.any(R_m == 1, axis=1)[np.newaxis]) * np.ones(R.shape)
R_r = np.transpose(np.any(R_m == 1, axis=1)[np.newaxis]) * ones(R.shape)
# Blue rows.
B_r = np.transpose(np.any(B_m == 1, axis=1)[np.newaxis]) * np.ones(B.shape)
B_r = np.transpose(np.any(B_m == 1, axis=1)[np.newaxis]) * ones(B.shape)

k_b = as_float_array([0.5, 0, 0.5])

Expand Down Expand Up @@ -290,7 +290,7 @@ def refining_step_Menon2007(
R_G = R - G
B_G = B - G

FIR = np.ones(3) / 3
FIR = ones(3) / 3

B_G_m = np.where(
B_m == 1,
Expand All @@ -310,13 +310,13 @@ def refining_step_Menon2007(

# Updating of the red and blue components in the green locations.
# Red rows.
R_r = np.transpose(np.any(R_m == 1, axis=1)[np.newaxis]) * np.ones(R.shape)
R_r = np.transpose(np.any(R_m == 1, axis=1)[np.newaxis]) * ones(R.shape)
# Red columns.
R_c = np.any(R_m == 1, axis=0)[np.newaxis] * np.ones(R.shape)
R_c = np.any(R_m == 1, axis=0)[np.newaxis] * ones(R.shape)
# Blue rows.
B_r = np.transpose(np.any(B_m == 1, axis=1)[np.newaxis]) * np.ones(B.shape)
B_r = np.transpose(np.any(B_m == 1, axis=1)[np.newaxis]) * ones(B.shape)
# Blue columns.
B_c = np.any(B_m == 1, axis=0)[np.newaxis] * np.ones(B.shape)
B_c = np.any(B_m == 1, axis=0)[np.newaxis] * ones(B.shape)

R_G = R - G
B_G = B - G
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# !/usr/bin/env python
"""
Defines the unit tests for the
Define the unit tests for the
:mod:`colour_demosaicing.bayer.demosaicing.bilinear` module.
"""

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# !/usr/bin/env python
"""
Defines the unit tests for the
Define the unit tests for the
:mod:`colour_demosaicing.bayer.demosaicing.malvar2004` module.
"""

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# !/usr/bin/env python
"""
Defines the unit tests for the
Define the unit tests for the
:mod:`colour_demosaicing.bayer.demosaicing.menon2007` module.
"""

Expand Down
8 changes: 3 additions & 5 deletions colour_demosaicing/bayer/masks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@

from __future__ import annotations

import numpy as np

from colour.hints import Literal, NDArray, Tuple, Union
from colour.utilities import validate_method
from colour.utilities import validate_method, zeros

__author__ = "Colour Developers"
__copyright__ = "Copyright 2015 Colour Developers"
Expand Down Expand Up @@ -75,8 +73,8 @@ def masks_CFA_Bayer(
'"{0}" CFA pattern is invalid, it must be one of {1}!',
).upper()

channels = {channel: np.zeros(shape) for channel in "RGB"}
channels = {channel: zeros(shape, dtype="bool") for channel in "RGB"}
for channel, (y, x) in zip(pattern, [(0, 0), (0, 1), (1, 0), (1, 1)]):
channels[channel][y::2, x::2] = 1

return tuple(channels[c].astype(bool) for c in "RGB")
return tuple(channels.values())
2 changes: 1 addition & 1 deletion colour_demosaicing/bayer/tests/test_masks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# !/usr/bin/env python
"""Defines the unit tests for the :mod:`colour_demosaicing.bayer.masks` module."""
"""Define the unit tests for the :mod:`colour_demosaicing.bayer.masks` module."""

from __future__ import annotations

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
@@ -1,6 +1,6 @@
# !/usr/bin/env python
"""
Defines the unit tests for the :mod:`colour_demosaicing.bayer.mosaicing`
Define the unit tests for the :mod:`colour_demosaicing.bayer.mosaicing`
module.
"""

Expand Down
40 changes: 16 additions & 24 deletions colour_demosaicing/examples/examples_bayer.ipynb

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ Primary Dependencies
**Colour - Demosaicing** requires various dependencies in order to run:

- `python >= 3.8, < 4 <https://www.python.org/download/releases/>`__
- `colour-science <https://pypi.org/project/colour-science/>`__
- `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/>`__

Pypi
----
Expand Down
9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "colour-demosaicing"
version = "0.2.1"
version = "0.2.2"
description = "CFA (Colour Filter Array) Demosaicing Algorithms for Python"
license = "BSD-3-Clause"
authors = [ "Colour Developers <[email protected]>" ]
Expand Down Expand Up @@ -71,6 +71,7 @@ pydata-sphinx-theme = { version = "*", optional = true } # Development dependen
pydocstyle = { version = "*", optional = true } # Development dependency.
pytest = { version = "*", optional = true } # Development dependency.
pytest-cov = { version = "*", optional = true } # Development dependency.
pytest-xdist = { version = "*", optional = true} #Development dependency
pyupgrade = { version = "*", optional = true } # Development dependency.
restructuredtext-lint = { version = "*", optional = true } # Development dependency.
sphinx = { version = ">= 4, < 5", optional = true } # Development dependency.
Expand All @@ -93,6 +94,7 @@ pydata-sphinx-theme = "*"
pydocstyle = "*"
pytest = "*"
pytest-cov = "*"
pytest-xdist = "*"
pyupgrade = "*"
restructuredtext-lint = "*"
sphinx = ">= 4, < 5"
Expand Down Expand Up @@ -148,6 +150,9 @@ ignore_missing_imports = true
convention = "numpy"
add-ignore = "D104,D200,D202,D205,D301,D400"

[tool.pytest.ini_options]
addopts = "-n auto --durations=5"

[build-system]
requires = ["poetry_core>=1.0.0"]
requires = [ "poetry_core>=1.0.0" ]
build-backend = "poetry.core.masonry.api"
Loading

0 comments on commit c78eb63

Please sign in to comment.