Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: colour-science/colour-datasets
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.2.6
Choose a base ref
...
head repository: colour-science/colour-datasets
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: develop
Choose a head ref
  • 12 commits
  • 59 files changed
  • 1 contributor

Commits on Oct 12, 2024

  1. Update README.rst file.

    KelSolaar committed Oct 12, 2024
    Copy the full SHA
    db6e32d View commit details
  2. Merge branch 'feature/v0.2.7' into develop

    KelSolaar committed Oct 12, 2024
    Copy the full SHA
    37c3e80 View commit details

Commits on Oct 13, 2024

  1. Copy the full SHA
    fcd9a81 View commit details
  2. Require *colour* 0.4.5.

    KelSolaar committed Oct 13, 2024
    Copy the full SHA
    50a419f View commit details

Commits on Nov 24, 2024

  1. Update various social links.

    KelSolaar committed Nov 24, 2024
    Copy the full SHA
    5d14c28 View commit details

Commits on Dec 14, 2024

  1. Ignore *RUF022*.

    KelSolaar committed Dec 14, 2024
    Copy the full SHA
    d01c74e View commit details
  2. Update .gitignore file.

    KelSolaar committed Dec 14, 2024
    Copy the full SHA
    d6b934b View commit details
  3. Copy the full SHA
    c811b56 View commit details
  4. Disable isort glob.

    KelSolaar committed Dec 14, 2024
    Copy the full SHA
    cf11200 View commit details

Commits on Dec 22, 2024

  1. Copy the full SHA
    91ac338 View commit details

Commits on Dec 23, 2024

  1. Use colour checks configuration.

    KelSolaar committed Dec 23, 2024
    Copy the full SHA
    06f43bb View commit details

Commits on Dec 24, 2024

  1. Merge branch 'feature/v0.2.8' into develop

    KelSolaar committed Dec 24, 2024
    Copy the full SHA
    aa4ae7b View commit details
Showing with 685 additions and 619 deletions.
  1. +1 −0 .coveragerc
  2. +17 −12 .gitignore
  3. +8 −11 .pre-commit-config.yaml
  4. +3 −2 README.rst
  5. +8 −4 colour_datasets/__init__.py
  6. +6 −1 colour_datasets/loaders/__init__.py
  7. +5 −3 colour_datasets/loaders/abstract.py
  8. +19 −27 colour_datasets/loaders/asano2015.py
  9. +5 −1 colour_datasets/loaders/brendel2020.py
  10. +123 −107 colour_datasets/loaders/dyer2017.py
  11. +29 −16 colour_datasets/loaders/ebner1998.py
  12. +22 −8 colour_datasets/loaders/hung1995.py
  13. +4 −1 colour_datasets/loaders/jakob2019.py
  14. +5 −1 colour_datasets/loaders/jiang2013.py
  15. +5 −1 colour_datasets/loaders/karge2015.py
  16. +15 −9 colour_datasets/loaders/kuopio.py
  17. +8 −2 colour_datasets/loaders/labsphere2019.py
  18. +25 −20 colour_datasets/loaders/luo1997.py
  19. +21 −20 colour_datasets/loaders/luo1999.py
  20. +5 −1 colour_datasets/loaders/solomotav2023.py
  21. +2 −2 colour_datasets/loaders/tests/test_abstract.py
  22. +4 −5 colour_datasets/loaders/tests/test_asano2015.py
  23. +4 −4 colour_datasets/loaders/tests/test_brendel2020.py
  24. +4 −5 colour_datasets/loaders/tests/test_dyer2017.py
  25. +4 −4 colour_datasets/loaders/tests/test_ebner1998.py
  26. +4 −5 colour_datasets/loaders/tests/test_hung1995.py
  27. +4 −5 colour_datasets/loaders/tests/test_jakob2019.py
  28. +4 −5 colour_datasets/loaders/tests/test_jiang2013.py
  29. +4 −5 colour_datasets/loaders/tests/test_karge2015.py
  30. +4 −4 colour_datasets/loaders/tests/test_kuopio.py
  31. +4 −5 colour_datasets/loaders/tests/test_labsphere2019.py
  32. +4 −5 colour_datasets/loaders/tests/test_luo1997.py
  33. +4 −5 colour_datasets/loaders/tests/test_luo1999.py
  34. +4 −5 colour_datasets/loaders/tests/test_solomotav2023.py
  35. +4 −5 colour_datasets/loaders/tests/test_winquist2022.py
  36. +4 −5 colour_datasets/loaders/tests/test_xrite2016.py
  37. +4 −5 colour_datasets/loaders/tests/test_zhao2009.py
  38. +3 −1 colour_datasets/loaders/winquist2022.py
  39. +7 −4 colour_datasets/loaders/xrite2016.py
  40. +4 −1 colour_datasets/loaders/zhao2009.py
  41. +2 −1 colour_datasets/records/__init__.py
  42. +8 −4 colour_datasets/records/configuration.py
  43. +3 −3 colour_datasets/records/tests/test_configuration.py
  44. +34 −34 colour_datasets/records/tests/test_zenodo.py
  45. +24 −21 colour_datasets/records/zenodo.py
  46. +2 −0 colour_datasets/utilities/__init__.py
  47. +24 −15 colour_datasets/utilities/common.py
  48. +5 −2 colour_datasets/utilities/spreadsheet.py
  49. +9 −9 colour_datasets/utilities/tests/test_common.py
  50. +5 −5 colour_datasets/utilities/tests/test_spreadsheet.py
  51. +1 −1 docs/conf.py
  52. +2 −1 docs/index.rst
  53. +1 −1 docs/installation.rst
  54. +19 −19 docs/requirements.txt
  55. +40 −82 pyproject.toml
  56. +65 −65 requirements.txt
  57. +25 −22 tasks.py
  58. +1 −1 utilities/export_todo.py
  59. +1 −1 utilities/unicode_to_ascii.py
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -5,4 +5,5 @@ sigterm = True
exclude_lines =
pragma: no cover
if __name__ == .__main__.:
if TYPE_CHECKING:
pass
29 changes: 17 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
# Common Files
*.egg-info
*.pyc
*.pyo
.DS_Store
.coverage*
.fleet
.idea
.ipynb_checkpoints
uv.lock

# Common Directories
.fleet/
.idea/
.ipynb_checkpoints/
.python-version
.sandbox
.vs
.vscode
.vs/
.vscode/
.sandbox/
build/
dist/
docs/_build/
docs/generated/
node_modules/
references/

__pycache__

build
dist
docs/_build
docs/generated
references
# Project Directories
zenodo
uv.lock
19 changes: 8 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.5.0"
rev: "v5.0.0"
hooks:
- id: check-added-large-files
- id: check-case-conflict
@@ -15,32 +15,29 @@ repos:
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
args: ["--ignore-words-list=exitance,seperately"]
args:
["--ignore-words-list=assertIn,exitance,seperately,socio-economic"]
exclude: "BIBLIOGRAPHY.bib|CONTRIBUTORS.rst"
- repo: https://github.com/ikamensh/flynt
rev: "1.0.1"
hooks:
- id: flynt
args: [--verbose]
- repo: https://github.com/PyCQA/isort
rev: "5.13.2"
hooks:
- id: isort
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.14"
rev: "v0.8.2"
hooks:
- id: ruff-format
- id: ruff
args: [--fix]
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
rev: 1.19.1
hooks:
- id: blacken-docs
language_version: python3.10
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.1.0"
rev: "v4.0.0-alpha.8"
hooks:
- id: prettier
- repo: https://github.com/pre-commit/pygrep-hooks
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -162,7 +162,7 @@ Primary Dependencies

- `python >= 3.10, < 3.14 <https://www.python.org/download/releases>`__
- `cachetools <https://pypi.org/project/cachetools>`__
- `colour-science >= 4.4 <https://pypi.org/project/colour-science>`__
- `colour-science >= 4.5 <https://pypi.org/project/colour-science>`__
- `imageio >= 2, < 3 <https://imageio.github.io>`__
- `numpy >= 1.24, < 3 <https://pypi.org/project/numpy>`__
- `scipy >= 1.10, < 2 <https://pypi.org/project/scipy>`__
@@ -217,7 +217,8 @@ The *Colour Developers* can be reached via different means:
- `Facebook <https://www.facebook.com/python.colour.science>`__
- `Github Discussions <https://github.com/colour-science/colour-datasets/discussions>`__
- `Gitter <https://gitter.im/colour-science/colour>`__
- `Twitter <https://twitter.com/colour_science>`__
- `X <https://x.com/colour_science>`__
- `Bluesky <https://bsky.app/profile/colour-science.bsky.social>`__

About
-----
12 changes: 8 additions & 4 deletions colour_datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -15,6 +15,10 @@
- utilities: Various utilities.
"""

# isort: skip_file

from __future__ import annotations

import contextlib
import os
import subprocess
@@ -52,19 +56,19 @@
__major_version__ = "0"
__minor_version__ = "2"
__change_version__ = "6"
__version__ = ".".join((__major_version__, __minor_version__, __change_version__))
__version__ = f"{__major_version__}.{__minor_version__}.{__change_version__}"

try:
_version = (
subprocess.check_output(
["git", "describe"], # noqa: S603, S607
subprocess.check_output( # noqa: S603
["git", "describe"], # noqa: S607
cwd=os.path.dirname(__file__),
stderr=subprocess.STDOUT,
)
.strip()
.decode("utf-8")
)
except Exception:
except Exception: # noqa: BLE001
_version = __version__

colour.utilities.ANCILLARY_COLOUR_SCIENCE_PACKAGES["colour-datasets"] = _version # pyright: ignore
7 changes: 6 additions & 1 deletion colour_datasets/loaders/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# isort: skip_file

from __future__ import annotations

import sys
import typing

if typing.TYPE_CHECKING:
from colour.hints import Any

from colour.hints import Any
from colour.utilities import CanonicalMapping, warning

from colour_datasets.records import datasets
8 changes: 5 additions & 3 deletions colour_datasets/loaders/abstract.py
Original file line number Diff line number Diff line change
@@ -9,11 +9,13 @@

from __future__ import annotations

import typing
from abc import ABC, abstractmethod

from colour.hints import Any
if typing.TYPE_CHECKING:
from colour.hints import Any

from colour_datasets.records import Record
from colour_datasets.records import Record

__author__ = "Colour Developers"
__copyright__ = "Copyright 2019 Colour Developers"
@@ -122,7 +124,7 @@ def load(self) -> Any:
when they implement it, e.g., ``super().sync()``.
"""

def sync(self):
def sync(self) -> None:
"""
Sync the dataset content, i.e., checks whether it is synced and pulls
it if required.
46 changes: 19 additions & 27 deletions colour_datasets/loaders/asano2015.py
Original file line number Diff line number Diff line change
@@ -17,7 +17,8 @@
from __future__ import annotations

import os
from collections import namedtuple
import typing
from dataclasses import dataclass, field

import numpy as np
import xlrd
@@ -26,7 +27,10 @@
LMS_ConeFundamentals,
XYZ_ColourMatchingFunctions,
)
from colour.hints import Dict, NDArrayFloat

if typing.TYPE_CHECKING:
from colour.hints import Dict

from colour.utilities import as_float_array, tstack

from colour_datasets.loaders import AbstractDatasetLoader
@@ -47,12 +51,8 @@
]


class Specification_Asano2015(
namedtuple(
"Specification_Asano2015",
("XYZ_2", "XYZ_10", "LMS_2", "LMS_10", "parameters", "others"),
)
):
@dataclass(frozen=True)
class Specification_Asano2015:
"""
Define the *Asano (2015)* specification for an observer.
@@ -74,24 +74,14 @@ class Specification_Asano2015(
References
----------
:cite:`Asano2015`
""" # noqa: D405, D407, D410, D411

def __new__(
cls,
XYZ_2: XYZ_ColourMatchingFunctions,
XYZ_10: XYZ_ColourMatchingFunctions,
LMS_2: LMS_ConeFundamentals,
LMS_10: LMS_ConeFundamentals,
parameters: NDArrayFloat,
others: Dict | None = None,
):
"""
Return a new instance of the
:class:`colour_datasets.loaders.asano2015.Specification_Asano2015`
class.
"""
"""

return super().__new__(cls, XYZ_2, XYZ_10, LMS_2, LMS_10, parameters, others)
XYZ_2: XYZ_ColourMatchingFunctions
XYZ_10: XYZ_ColourMatchingFunctions
LMS_2: LMS_ConeFundamentals
LMS_10: LMS_ConeFundamentals
parameters: Dict
others: Dict = field(default_factory=dict)


class DatasetLoader_Asano2015(AbstractDatasetLoader):
@@ -199,7 +189,7 @@ def load(self) -> Dict[str, Dict[int, Specification_Asano2015]]:
observer["LMS_2"],
observer["LMS_10"],
observer["parameters"],
dict(zip(header, values[i])),
dict(zip(header, values[i], strict=False)),
)

return self._content
@@ -284,7 +274,9 @@ def parse_workbook_Asano2015(

for i in range(observers[1]):
observer = i + 1
data[observer]["parameters"] = dict(zip(header, as_float_array(values[i])))
data[observer]["parameters"] = dict(
zip(header, as_float_array(values[i]), strict=False)
)

return data

6 changes: 5 additions & 1 deletion colour_datasets/loaders/brendel2020.py
Original file line number Diff line number Diff line change
@@ -18,10 +18,14 @@
from __future__ import annotations

import os
import typing

import numpy as np
from colour import LinearInterpolator, SpectralDistribution, SpectralShape
from colour.hints import Dict

if typing.TYPE_CHECKING:
from colour.hints import Dict

from colour.utilities import as_int

from colour_datasets.loaders import AbstractDatasetLoader
Loading