diff --git a/.coveragerc b/.coveragerc index 05701c1469..3bd127ec3f 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,4 +1,7 @@ [run] source = colour -omit = - */colour/plotting/* \ No newline at end of file +[report] +exclude_lines = + pragma: no cover + if __name__ == .__main__.: + pass diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 0000000000..4eefeb9fdd --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -0,0 +1,144 @@ +name: Continuous Integration + +on: [push, pull_request] + +jobs: + unix-build: + name: Unix Build + strategy: + matrix: + os: [ubuntu-18.04, macOS-10.14] + python-version: [2.7, 3.6, 3.7] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v1 + - name: Environment Variables + run: | + CI_PYTHON_VERSION=${{ matrix.python-version }} + CI_PACKAGE=colour + CI_SHA=${{ github.sha }} + CI_SLACK_WEBHOOK=${{ secrets.SLACK_WEBHOOK }} + CI_SLACK_SUCCESS_NOTIFICATION="payload={\"attachments\": [{\"color\": \"#4CAF50\", \"author_name\": \"Python ${{ matrix.python-version }} build on ${{ matrix.os }}\", \"text\": \"Build for commit *${CI_SHA:0:7}* succeeded!\", \"title\": \"${{ github.repository }}@${{ github.ref }}\", \"title_link\": \"https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks\", \"footer\": \"Triggered by ${{ github.actor }}\"}], \"username\":\"Github Actions @ ${{ github.repository }}\", \"channel\":\"#continuous-integration\", \"icon_url\":\"https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png\"}" + CI_SLACK_FAILURE_NOTIFICATION="${CI_SLACK_SUCCESS_NOTIFICATION/4CAF50/F44336}" + CI_SLACK_FAILURE_NOTIFICATION="${CI_SLACK_FAILURE_NOTIFICATION/succeeded/failed}" + COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }} + MPLBACKEND=AGG + echo ::set-env name=CI_PYTHON_VERSION::$CI_PYTHON_VERSION + echo ::set-env name=CI_PACKAGE::$CI_PACKAGE + echo ::set-env name=CI_SHA::$CI_SHA + echo ::set-env name=CI_SLACK_WEBHOOK::$CI_SLACK_WEBHOOK + echo ::set-env name=CI_SLACK_SUCCESS_NOTIFICATION::$CI_SLACK_SUCCESS_NOTIFICATION + echo ::set-env name=CI_SLACK_FAILURE_NOTIFICATION::$CI_SLACK_FAILURE_NOTIFICATION + echo ::set-env name=COVERALLS_REPO_TOKEN::$COVERALLS_REPO_TOKEN + echo ::set-env name=MPLBACKEND::$MPLBACKEND + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Ubuntu - Update OS & Install APT Dependencies + if: matrix.os == 'ubuntu-18.04' + run: | + sudo apt-get update + sudo apt-get --yes install libboost-all-dev libilmbase-dev libopenexr-dev libpng-dev libtiff5-dev + - name: Install Poetry + run: | + curl -L https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py -o get-poetry.py + python get-poetry.py --preview + PATH=$HOME/.poetry/bin:$PATH + echo ::set-env name=PATH::$PATH + - name: Install Package Dependencies + run: | + poetry install --extras "optional plotting" + poetry env use $CI_PYTHON_VERSION + source $(poetry env info -p)/bin/activate + python -c "import imageio;imageio.plugins.freeimage.download()" + - name: Ubuntu - Install OpenImageIO + if: matrix.os == 'ubuntu-18.04' && matrix.python-version == '3.6' + run: | + curl -L https://github.com/colour-science/artifacts/suites/233020849/artifacts/44967 -o OpenImageIO-Release-2.0.10.zip + unzip OpenImageIO-Release-2.0.10.zip + sudo cp OpenImageIO-Release-2.0.10/linux64/bin/* /usr/bin/ + sudo cp -r OpenImageIO-Release-2.0.10/linux64/lib/* /usr/lib/ + sudo rm -rf /usr/lib/python3.6 + cp OpenImageIO-Release-2.0.10/linux64/lib/python3.6/site-packages/OpenImageIO.so $(poetry env info -p)/lib/python3.6/site-packages/ + - name: Lint with flake8 + run: | + source $(poetry env info -p)/bin/activate + flake8 $CI_PACKAGE --count --show-source --statistics + - name: Test with nosetests + run: | + source $(poetry env info -p)/bin/activate + python -W ignore -m nose -v --nocapture --with-doctest --doctest-options=+ELLIPSIS --with-coverage --cover-package=$CI_PACKAGE $CI_PACKAGE + - name: Upload Coverage to coveralls.io + if: matrix.python-version == '3.6' || matrix.python-version == '3.7' + run: | + source $(poetry env info -p)/bin/activate + if [ -z "$COVERALLS_REPO_TOKEN" ]; then echo \"COVERALLS_REPO_TOKEN\" secret is undefined!; else coveralls; fi + - name: Notify Slack + if: always() + run: | + if [ "${{ job.status }}" == "Success" ]; then CI_SLACK_NOTIFICATION="$CI_SLACK_SUCCESS_NOTIFICATION"; else CI_SLACK_NOTIFICATION="$CI_SLACK_FAILURE_NOTIFICATION"; fi + if [ -z "$CI_SLACK_WEBHOOK" ]; then echo \"SLACK_WEBHOOK\" secret is undefined!; else curl -k -d "$CI_SLACK_NOTIFICATION" -X POST $CI_SLACK_WEBHOOK; fi + windows-build: + name: Windows Build + strategy: + matrix: + os: [windows-2019] + python-version: [2.7, 3.6, 3.7] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v1 + - name: Environment Variables + run: | + set CI_PYTHON_VERSION=${{ matrix.python-version }} + set CI_PACKAGE=colour + set CI_SHA=${{ github.sha }} + set CI_SLACK_WEBHOOK=${{ secrets.SLACK_WEBHOOK }} + set CI_SLACK_SUCCESS_NOTIFICATION="payload={\"attachments\": [{\"color\": \"#4CAF50\", \"author_name\": \"Python ${{ matrix.python-version }} build on ${{ matrix.os }}\", \"text\": \"Build for commit *"%CI_SHA:~0,7%"* succeeded!\", \"title\": \"${{ github.repository }}@${{ github.ref }}\", \"title_link\": \"https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks\", \"footer\": \"Triggered by ${{ github.actor }}\"}], \"username\":\"Github Actions @ ${{ github.repository }}\", \"channel\":\"#continuous-integration\", \"icon_url\":\"https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png\"}" + set CI_SLACK_FAILURE_NOTIFICATION=%CI_SLACK_SUCCESS_NOTIFICATION:4CAF50=F44336% + set CI_SLACK_FAILURE_NOTIFICATION=%CI_SLACK_FAILURE_NOTIFICATION:succeeded=failed% + set COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }} + set MPLBACKEND=AGG + echo ::set-env name=CI_PYTHON_VERSION::%CI_PYTHON_VERSION% + echo ::set-env name=CI_PACKAGE::%CI_PACKAGE% + echo ::set-env name=CI_SHA::%CI_SHA% + echo ::set-env name=CI_SLACK_WEBHOOK::%CI_SLACK_WEBHOOK% + echo ::set-env name=CI_SLACK_SUCCESS_NOTIFICATION::%CI_SLACK_SUCCESS_NOTIFICATION% + echo ::set-env name=CI_SLACK_FAILURE_NOTIFICATION::%CI_SLACK_FAILURE_NOTIFICATION% + echo ::set-env name=COVERALLS_REPO_TOKEN::%COVERALLS_REPO_TOKEN% + echo ::set-env name=MPLBACKEND::%MPLBACKEND% + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install Poetry + run: | + curl -L https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py -o get-poetry.py + python get-poetry.py --preview + set PATH=%USERPROFILE%\.poetry\bin;%PATH% + echo ::set-env name=PATH::%PATH% + - name: Install Package Dependencies + run: | + call poetry install --extras "optional plotting" + FOR /F %%a IN ('poetry env info -p') DO SET CI_VIRTUAL_ENVIRONMENT=%%a + echo ::set-env name=CI_VIRTUAL_ENVIRONMENT::%CI_VIRTUAL_ENVIRONMENT% + call %CI_VIRTUAL_ENVIRONMENT%\scripts\activate + python -c "import imageio;imageio.plugins.freeimage.download()" + - name: Lint with flake8 + run: | + call %CI_VIRTUAL_ENVIRONMENT%\scripts\activate + flake8 %CI_PACKAGE% --count --show-source --statistics + - name: Test with nosetests + run: | + call %CI_VIRTUAL_ENVIRONMENT%\scripts\activate + python -W ignore -m nose -v --nocapture --with-doctest --doctest-options=+ELLIPSIS --with-coverage --cover-package=%CI_PACKAGE% %CI_PACKAGE% + - name: Upload Coverage to coveralls.io + if: matrix.python-version == '3.6' || matrix.python-version == '3.7' + run: | + call %CI_VIRTUAL_ENVIRONMENT%\scripts\activate + IF "%COVERALLS_REPO_TOKEN%"=="" (echo "COVERALLS_REPO_TOKEN" secret is undefined!) ELSE (coveralls) + - name: Notify Slack + if: always() + run: | + IF "${{ job.status }}"=="Success" (set CI_SLACK_NOTIFICATION=%CI_SLACK_SUCCESS_NOTIFICATION%) ELSE (set CI_SLACK_NOTIFICATION=%CI_SLACK_FAILURE_NOTIFICATION%) + IF "%CI_SLACK_WEBHOOK%"=="" (echo "SLACK_WEBHOOK" secret is undefined!) ELSE (curl -k -d %CI_SLACK_NOTIFICATION% -X POST %CI_SLACK_WEBHOOK%) diff --git a/.gitignore b/.gitignore index 7359f2ba27..ac7d5ab546 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,10 @@ __pycache__ build dist docs/_build +docs/_static/Basics_*.png +docs/_static/Examples_*.png +docs/_static/Plotting_*.png +docs/_static/Tutorial_*.png +docs/generated +poetry.lock references diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000..95ecce1767 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,10 @@ +repos: +- repo: https://gitlab.com/pycqa/flake8 + rev: 3.7.8 + hooks: + - id: flake8 + exclude: examples +- repo: https://github.com/pre-commit/mirrors-yapf + rev: v0.23.0 + hooks: + - id: yapf diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000000..bbb41c1319 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,8 @@ +build: + image: latest + +python: + version: 3.6 + pip_install: true + extra_requirements: + - read-the-docs diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 746e07b5a6..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,44 +0,0 @@ -sudo: false -language: python - -matrix: - fast_finish: true - include: - - python: 3.6 - env: - - PYTHON_VERSION="3.6" - - python: 2.7 - env: - - PYTHON_VERSION="2.7" - -notifications: - slack: colour-science:Y6lPPcN7y53Js94geqUpqsAP - -before_install: - - if [ ${TRAVIS_PYTHON_VERSION:O:1} == "2" ]; then wget http://repo.continuum.io/miniconda/Miniconda2-3.19.0-Linux-x86_64.sh -O miniconda.sh; else wget http://repo.continuum.io/miniconda/Miniconda3-3.19.0-Linux-x86_64.sh -O miniconda.sh; fi - - chmod +x miniconda.sh - - ./miniconda.sh -b -p /home/travis/miniconda - - export PATH=/home/travis/miniconda/bin:$PATH - - conda update --yes --quiet conda - - "export DISPLAY=:99.0" - - "sh -e /etc/init.d/xvfb start" - - PACKAGES="python=${PYTHON_VERSION}" - - PACKAGES="${PACKAGES} matplotlib"; if [ ${MATPLOTLIB_VERSION} ]; then PACKAGES="${PACKAGES}=${MATPLOTLIB_VERSION}"; fi - - PACKAGES="${PACKAGES} numpy"; if [ ${NUMPY_VERSION} ]; then PACKAGES="${PACKAGES}=${NUMPY_VERSION}"; fi - - PACKAGES="${PACKAGES} pyqt"; if [ ${PYQT_VERSION} ]; then PACKAGES="${PACKAGES}=${PYQT_VERSION}"; fi - - PACKAGES="${PACKAGES} scipy"; if [ ${SCIPY_VERSION} ]; then PACKAGES="${PACKAGES}=${SCIPY_VERSION}"; fi - -install: - - conda create --yes --quiet -n colour-test ${PACKAGES} pip setuptools nose - - source activate colour-test - - pip install six coverage coveralls flake8 mock==1.0.1 - -before_script: - - export PYTHONWARNINGS=ignore - -script: - - flake8 colour - - nosetests --nocapture --with-doctest --doctest-options=+ELLIPSIS --with-coverage --cover-package=colour colour - -after_success: - - coveralls diff --git a/BIBLIOGRAPHY.bib b/BIBLIOGRAPHY.bib index b769b61be1..5f73aceefa 100644 --- a/BIBLIOGRAPHY.bib +++ b/BIBLIOGRAPHY.bib @@ -6,13 +6,6 @@ @misc{AdobeSystems2013 url = {https://www.adobe.com/support/downloads/dng/dng_sdk.html}, year = 2013, } -@misc{AdobeSystems2013b, - author = {{Adobe Systems}}, - keywords = {Iridas,look-up table,specification}, - title = {{Cube LUT Specification}}, - url = {https://drive.google.com/open?id=143Eh08ZYncCAMwJ1q4gWxVOqR_OSWYvs}, - year = 2013, -} @misc{AdobeSystems2005a, author = {{Adobe Systems}}, number = {May}, @@ -29,6 +22,13 @@ @misc{AdobeSystems2013a url = {https://www.adobe.com/support/downloads/dng/dng_sdk.html}, year = 2013, } +@misc{AdobeSystems2013b, + author = {{Adobe Systems}}, + keywords = {Iridas,look-up table,specification}, + title = {{Cube LUT Specification}}, + url = {https://drive.google.com/open?id=143Eh08ZYncCAMwJ1q4gWxVOqR_OSWYvs}, + year = 2013, +} @misc{ANSI2003a, author = {ANSI}, pages = {1--2}, @@ -51,20 +51,6 @@ @misc{AssociationofRadioIndustriesandBusinesses2015a url = {https://www.arib.or.jp/english/std_tr/broadcasting/desc/std-b67.html}, year = 2015, } -@misc{ASTMInternational2011a, - abstract = {This standard is issued under the fixed designation - E2022; the number immediately following the designation indicates - the year of original adoption or, in the case of revision, the - year of last revision. A number in parentheses indicates the year - of last reapproval. A superscript epsilon) indicates an editorial - change since the last revision or reapproval.}, - author = {{ASTM International}}, - doi = {10.1520/E2022-11}, - pages = {1--10}, - title = {{ASTM E2022-11 - Standard Practice for Calculation - of Weighting Factors for Tristimulus Integration}}, - year = 2011, -} @misc{ASTMInternational2008a, author = {{ASTM International}}, doi = {10.1520/D1535-08E01}, @@ -80,6 +66,20 @@ @misc{ASTMInternational2015b Colors of Objects by Using the CIE System}}, year = 2015, } +@misc{ASTMInternational2011a, + abstract = {This standard is issued under the fixed designation + E2022; the number immediately following the designation indicates + the year of original adoption or, in the case of revision, the + year of last revision. A number in parentheses indicates the year + of last reapproval. A superscript epsilon) indicates an editorial + change since the last revision or reapproval.}, + author = {{ASTM International}}, + doi = {10.1520/E2022-11}, + pages = {1--10}, + title = {{ASTM E2022-11 - Standard Practice for Calculation + of Weighting Factors for Tristimulus Integration}}, + year = 2011, +} @misc{ASTMInternational2007, author = {{ASTM International}}, pages = {1--10}, @@ -100,6 +100,12 @@ @misc{ASTMInternational1989a url = {http://www.astm.org/DATABASE.CART/HISTORICAL/D1535-89.htm}, year = 1989, } +@misc{BabelColor2012c, + author = {BabelColor}, + title = {{ColorChecker RGB and spectra}}, + url = {http://www.babelcolor.com/download/ColorChecker_RGB_and_spectra.xls}, + year = 2012, +} @misc{BabelColor2012b, author = {BabelColor}, title = {{The ColorChecker (since 1976!)}}, @@ -107,12 +113,6 @@ @misc{BabelColor2012b urldate = {2014-09-26}, year = 2012, } -@misc{BabelColor2012c, - author = {BabelColor}, - title = {{ColorChecker RGB and spectra}}, - url = {http://www.babelcolor.com/download/ColorChecker_RGB_and_spectra.xls}, - year = 2012, -} @book{Barten1999, author = {Barten, Peter G.}, doi = {10.1117/3.353254}, @@ -389,67 +389,83 @@ @misc{Castro2014a urldate = {2014-08-22}, year = 2014, } -@misc{Centore2014q, +@misc{Centore2014l, annote = {http://www.99main.com/$\sim$centore/MunsellAndKubelkaMunkToolbox/MunsellAndKubelkaMunkToolbox.html}, author = {Centore, Paul}, title = {{MunsellAndKubelkaMunkToolboxApr2014 - - MunsellRenotationRoutines/MunsellToxyForIntegerMunsellValue.m}}, + MunsellSystemRoutines/LinearVsRadialInterpOnRenotationOvoid.m}}, url = {https://github.com/colour-science/MunsellAndKubelkaMunkToolbox}, year = 2014, } -@misc{Centore2014p, +@misc{Centore2014r, annote = {http://www.99main.com/$\sim$centore/MunsellAndKubelkaMunkToolbox/MunsellAndKubelkaMunkToolbox.html}, author = {Centore, Paul}, title = {{MunsellAndKubelkaMunkToolboxApr2014 - - MunsellRenotationRoutines/xyYtoMunsell.m}}, + MunsellRenotationRoutines/MaxChromaForExtrapolatedRenotation.m}}, url = {https://github.com/colour-science/MunsellAndKubelkaMunkToolbox}, year = 2014, } -@misc{Centore2014k, +@misc{Centore2014s, annote = {http://www.99main.com/$\sim$centore/MunsellAndKubelkaMunkToolbox/MunsellAndKubelkaMunkToolbox.html}, author = {Centore, Paul}, title = {{MunsellAndKubelkaMunkToolboxApr2014 - - MunsellRenotationRoutines/MunsellHueToASTMHue.m}}, + MunsellRenotationRoutines/MunsellHueToChromDiagHueAngle.m}}, url = {https://github.com/colour-science/MunsellAndKubelkaMunkToolbox}, year = 2014, } -@misc{Centore2014r, +@misc{Centore2014u, annote = {http://www.99main.com/$\sim$centore/MunsellAndKubelkaMunkToolbox/MunsellAndKubelkaMunkToolbox.html}, author = {Centore, Paul}, title = {{MunsellAndKubelkaMunkToolboxApr2014 - - MunsellRenotationRoutines/MaxChromaForExtrapolatedRenotation.m}}, + GeneralRoutines/CIELABtoApproxMunsellSpec.m}}, url = {https://github.com/colour-science/MunsellAndKubelkaMunkToolbox}, year = 2014, } -@misc{Centore2014l, +@misc{Centore2014t, annote = {http://www.99main.com/$\sim$centore/MunsellAndKubelkaMunkToolbox/MunsellAndKubelkaMunkToolbox.html}, author = {Centore, Paul}, title = {{MunsellAndKubelkaMunkToolboxApr2014 - - MunsellSystemRoutines/LinearVsRadialInterpOnRenotationOvoid.m}}, + MunsellRenotationRoutines/ChromDiagHueAngleToMunsellHue.m}}, url = {https://github.com/colour-science/MunsellAndKubelkaMunkToolbox}, year = 2014, } -@misc{Centore2014t, +@misc{Centore2014p, annote = {http://www.99main.com/$\sim$centore/MunsellAndKubelkaMunkToolbox/MunsellAndKubelkaMunkToolbox.html}, author = {Centore, Paul}, title = {{MunsellAndKubelkaMunkToolboxApr2014 - - MunsellRenotationRoutines/ChromDiagHueAngleToMunsellHue.m}}, + MunsellRenotationRoutines/xyYtoMunsell.m}}, url = {https://github.com/colour-science/MunsellAndKubelkaMunkToolbox}, year = 2014, } -@misc{Centore2014s, +@misc{Centore2014k, annote = {http://www.99main.com/$\sim$centore/MunsellAndKubelkaMunkToolbox/MunsellAndKubelkaMunkToolbox.html}, author = {Centore, Paul}, title = {{MunsellAndKubelkaMunkToolboxApr2014 - - MunsellRenotationRoutines/MunsellHueToChromDiagHueAngle.m}}, + MunsellRenotationRoutines/MunsellHueToASTMHue.m}}, url = {https://github.com/colour-science/MunsellAndKubelkaMunkToolbox}, year = 2014, } -@misc{Centore2014u, +@misc{Centore2014m, annote = {http://www.99main.com/$\sim$centore/MunsellAndKubelkaMunkToolbox/MunsellAndKubelkaMunkToolbox.html}, author = {Centore, Paul}, title = {{MunsellAndKubelkaMunkToolboxApr2014 - - GeneralRoutines/CIELABtoApproxMunsellSpec.m}}, + MunsellRenotationRoutines/MunsellToxyY.m}}, + url = {https://github.com/colour-science/MunsellAndKubelkaMunkToolbox}, + year = 2014, +} +@misc{Centore2014n, + annote = {http://www.99main.com/$\sim$centore/MunsellAndKubelkaMunkToolbox/MunsellAndKubelkaMunkToolbox.html}, + author = {Centore, Paul}, + title = {{MunsellAndKubelkaMunkToolboxApr2014 - + MunsellRenotationRoutines/FindHueOnRenotationOvoid.m}}, + url = {https://github.com/colour-science/MunsellAndKubelkaMunkToolbox}, + year = 2014, +} +@misc{Centore2014q, + annote = {http://www.99main.com/$\sim$centore/MunsellAndKubelkaMunkToolbox/MunsellAndKubelkaMunkToolbox.html}, + author = {Centore, Paul}, + title = {{MunsellAndKubelkaMunkToolboxApr2014 - + MunsellRenotationRoutines/MunsellToxyForIntegerMunsellValue.m}}, url = {https://github.com/colour-science/MunsellAndKubelkaMunkToolbox}, year = 2014, } @@ -483,22 +499,6 @@ @misc{Centorea url = {http://www.munsellcolourscienceforpainters.com/MunsellAndKubelkaMunkToolbox/MunsellAndKubelkaMunkToolbox.html}, urldate = {2018-01-23}, } -@misc{Centore2014m, - annote = {http://www.99main.com/$\sim$centore/MunsellAndKubelkaMunkToolbox/MunsellAndKubelkaMunkToolbox.html}, - author = {Centore, Paul}, - title = {{MunsellAndKubelkaMunkToolboxApr2014 - - MunsellRenotationRoutines/MunsellToxyY.m}}, - url = {https://github.com/colour-science/MunsellAndKubelkaMunkToolbox}, - year = 2014, -} -@misc{Centore2014n, - annote = {http://www.99main.com/$\sim$centore/MunsellAndKubelkaMunkToolbox/MunsellAndKubelkaMunkToolbox.html}, - author = {Centore, Paul}, - title = {{MunsellAndKubelkaMunkToolboxApr2014 - - MunsellRenotationRoutines/FindHueOnRenotationOvoid.m}}, - url = {https://github.com/colour-science/MunsellAndKubelkaMunkToolbox}, - year = 2014, -} @misc{Chamberlain2015, author = {Chamberlain, Peter}, title = {{LUT documentation (to create from another program)}}, @@ -574,14 +574,15 @@ @incollection{CIETC1-382005h url = {http://div1.cie.co.at/?i_ca_id=551\&pubid=47}, year = 2005, } -@incollection{CIETC1-382005g, +@incollection{CIETC1-382005f, author = {{CIE TC 1-38}}, booktitle = {CIE 167:2005 Recommended Practice for Tabulating Spectral Data for Use in Colour Computations}, - chapter = 10, + chapter = {9.2.4}, isbn = {978-3-901-90641-1}, - pages = {19--20}, - title = {{EXTRAPOLATION}}, + pages = {1--27}, + title = {{9.2.4 Method of interpolation for uniformly spaced + independent variable}}, url = {http://div1.cie.co.at/?i_ca_id=551\&pubid=47}, year = 2005, } @@ -596,47 +597,43 @@ @incollection{CIETC1-382005e url = {http://div1.cie.co.at/?i_ca_id=551\&pubid=47}, year = 2005, } -@incollection{CIETC1-382005f, +@incollection{CIETC1-382005g, author = {{CIE TC 1-38}}, booktitle = {CIE 167:2005 Recommended Practice for Tabulating Spectral Data for Use in Colour Computations}, - chapter = {9.2.4}, + chapter = 10, isbn = {978-3-901-90641-1}, - pages = {1--27}, - title = {{9.2.4 Method of interpolation for uniformly spaced - independent variable}}, + pages = {19--20}, + title = {{EXTRAPOLATION}}, url = {http://div1.cie.co.at/?i_ca_id=551\&pubid=47}, year = 2005, } -@incollection{CIETC1-482004o, +@incollection{CIETC1-482004k, author = {{CIE TC 1-48}}, booktitle = {CIE 015:2004 Colorimetry, 3rd Edition}, - chapter = {9.1}, + chapter = {9.4}, isbn = {978-3-901-90633-6}, - pages = {32--33}, - title = {{9.1 Dominant wavelength and purity}}, + pages = 24, + title = {{The evaluation of whiteness}}, url = {http://www.cie.co.at/publications/colorimetry-3rd-edition}, year = 2004, } -@incollection{CIETC1-482004n, +@incollection{CIETC1-482004o, author = {{CIE TC 1-48}}, booktitle = {CIE 015:2004 Colorimetry, 3rd Edition}, - chapter = {3.1}, + chapter = {9.1}, isbn = {978-3-901-90633-6}, - pages = {12--13}, - title = {{3.1 Recommendations concerning standard physical - data of illuminants}}, + pages = {32--33}, + title = {{9.1 Dominant wavelength and purity}}, url = {http://www.cie.co.at/publications/colorimetry-3rd-edition}, year = 2004, } -@incollection{CIETC1-482004j, +@incollection{CIETC1-482004, author = {{CIE TC 1-48}}, booktitle = {CIE 015:2004 Colorimetry, 3rd Edition}, - chapter = {8.1}, isbn = {978-3-901-90633-6}, - pages = 24, - title = {{CIE 1976 uniform chromaticity scale diagram (UCS - diagram)}}, + pages = {68--68}, + title = {{EXPLANATORY COMMENTS - 5}}, url = {http://www.cie.co.at/publications/colorimetry-3rd-edition}, year = 2004, } @@ -650,23 +647,14 @@ @book{CIETC1-482004h url = {http://www.cie.co.at/publications/colorimetry-3rd-edition}, year = 2004, } -@incollection{CIETC1-482004i, - author = {{CIE TC 1-48}}, - booktitle = {CIE 015:2004 Colorimetry, 3rd Edition}, - chapter = {APPENDIX E}, - isbn = {978-3-901-90633-6}, - pages = {77--82}, - title = {{APPENDIX E. INFORMATION ON THE USE OF PLANCK'S - EQUATION FOR STANDARD AIR}}, - url = {http://www.cie.co.at/publications/colorimetry-3rd-edition}, - year = 2004, -} -@incollection{CIETC1-482004, +@incollection{CIETC1-482004n, author = {{CIE TC 1-48}}, booktitle = {CIE 015:2004 Colorimetry, 3rd Edition}, + chapter = {3.1}, isbn = {978-3-901-90633-6}, - pages = {68--68}, - title = {{EXPLANATORY COMMENTS - 5}}, + pages = {12--13}, + title = {{3.1 Recommendations concerning standard physical + data of illuminants}}, url = {http://www.cie.co.at/publications/colorimetry-3rd-edition}, year = 2004, } @@ -690,21 +678,27 @@ @incollection{CIETC1-482004l url = {http://www.cie.co.at/publications/colorimetry-3rd-edition}, year = 2004, } -@incollection{CIETC1-482004k, +@incollection{CIETC1-482004j, author = {{CIE TC 1-48}}, booktitle = {CIE 015:2004 Colorimetry, 3rd Edition}, - chapter = {9.4}, + chapter = {8.1}, isbn = {978-3-901-90633-6}, pages = 24, - title = {{The evaluation of whiteness}}, + title = {{CIE 1976 uniform chromaticity scale diagram (UCS + diagram)}}, url = {http://www.cie.co.at/publications/colorimetry-3rd-edition}, year = 2004, } -@misc{Colblindora, - author = {Colblindor}, - title = {{Deuteranopia - Red-Green Color Blindness}}, - url = {http://www.color-blindness.com/deuteranopia-red-green-color-blindness/}, - urldate = {2015-07-04}, +@incollection{CIETC1-482004i, + author = {{CIE TC 1-48}}, + booktitle = {CIE 015:2004 Colorimetry, 3rd Edition}, + chapter = {APPENDIX E}, + isbn = {978-3-901-90633-6}, + pages = {77--82}, + title = {{APPENDIX E. INFORMATION ON THE USE OF PLANCK'S + EQUATION FOR STANDARD AIR}}, + url = {http://www.cie.co.at/publications/colorimetry-3rd-edition}, + year = 2004, } @misc{Colblindorb, author = {Colblindor}, @@ -718,6 +712,12 @@ @misc{Colblindorc url = {http://www.color-blindness.com/tritanopia-blue-yellow-color-blindness/}, urldate = {2015-07-04}, } +@misc{Colblindora, + author = {Colblindor}, + title = {{Deuteranopia - Red-Green Color Blindness}}, + url = {http://www.color-blindness.com/deuteranopia-red-green-color-blindness/}, + urldate = {2015-07-04}, +} @misc{Cottrella, annote = {http://www.russellcottrell.com/photo/RussellRGB.htm}, author = {Cottrell, Russell}, @@ -735,12 +735,18 @@ @misc{Cowan2004 HD/HDTV/HDTV 2007 v35/SMPTE normes et confs/Contrastm.pdf}, year = 2004, } -@misc{CVRLv, +@misc{CVRLq, author = {CVRL}, - title = {{CIE (2012) 2-deg XYZ "physiologically-relevant" - colour matching functions}}, - url = {http://www.cvrl.org/database/text/cienewxyz/cie2012xyz2.htm}, - urldate = {2014-06-25}, + title = {{Luminous efficiency}}, + url = {http://www.cvrl.org/lumindex.htm}, + urldate = {2014-04-19}, +} +@misc{CVRLt, + author = {CVRL}, + title = {{Stiles \& Burch individual 10-deg colour matching + data}}, + url = {http://www.cvrl.org/stilesburch10_ind.htm}, + urldate = {2014-02-24}, } @misc{CVRLw, author = {CVRL}, @@ -749,18 +755,11 @@ @misc{CVRLw url = {http://www.cvrl.org/stilesburch2_ind.htm}, urldate = {2014-02-24}, } -@misc{CVRLp, - author = {CVRL}, - title = {{CIE (2012) 10-deg XYZ "physiologically-relevant" - colour matching functions}}, - url = {http://www.cvrl.org/database/text/cienewxyz/cie2012xyz10.htm}, - urldate = {2014-06-25}, -} -@misc{CVRLq, +@misc{CVRLs, author = {CVRL}, - title = {{Luminous efficiency}}, - url = {http://www.cvrl.org/lumindex.htm}, - urldate = {2014-04-19}, + title = {{Older CIE Standards}}, + url = {http://cvrl.ioo.ucl.ac.uk/cie.htm}, + urldate = {2014-02-24}, } @misc{CVRLr, author = {CVRL}, @@ -769,20 +768,21 @@ @misc{CVRLr url = {http://cvrl.ioo.ucl.ac.uk/ciexyzpr.htm}, urldate = {2014-02-24}, } -@misc{CVRLs, +@misc{CVRLp, author = {CVRL}, - title = {{Older CIE Standards}}, - url = {http://cvrl.ioo.ucl.ac.uk/cie.htm}, - urldate = {2014-02-24}, + title = {{CIE (2012) 10-deg XYZ "physiologically-relevant" + colour matching functions}}, + url = {http://www.cvrl.org/database/text/cienewxyz/cie2012xyz10.htm}, + urldate = {2014-06-25}, } -@misc{CVRLt, +@misc{CVRLv, author = {CVRL}, - title = {{Stiles \& Burch individual 10-deg colour matching - data}}, - url = {http://www.cvrl.org/stilesburch10_ind.htm}, - urldate = {2014-02-24}, -} -@article{Darrodi2015a, + title = {{CIE (2012) 2-deg XYZ "physiologically-relevant" + colour matching functions}}, + url = {http://www.cvrl.org/database/text/cienewxyz/cie2012xyz2.htm}, + urldate = {2014-06-25}, +} +@article{Darrodi2015a, author = {Darrodi, Maryam Mohammadzadeh and Finlayson, Graham and Goodman, Teresa and Mackiewicz, Michal}, doi = {10.1364/JOSAA.32.000381}, @@ -852,22 +852,22 @@ @misc{Dolby2016a url = {https://www.dolby.com/us/en/technologies/dolby-vision/ICtCp-white-paper.pdf}, year = 2016, } -@misc{EasyRGBm, +@misc{EasyRGBh, author = {EasyRGB}, - title = {{CMYK —> CMY}}, - url = {http://www.easyrgb.com/index.php?X=MATH\&H=14#text14}, + title = {{RGB —> CMY}}, + url = {http://www.easyrgb.com/index.php?X=MATH\&H=11#text11}, urldate = {2014-05-18}, } -@misc{EasyRGBk, +@misc{EasyRGBo, author = {EasyRGB}, - title = {{HSL —> RGB}}, - url = {http://www.easyrgb.com/index.php?X=MATH\&H=19#text19}, + title = {{CMY —> CMYK}}, + url = {http://www.easyrgb.com/index.php?X=MATH\&H=13#text13}, urldate = {2014-05-18}, } -@misc{EasyRGBh, +@misc{EasyRGBl, author = {EasyRGB}, - title = {{RGB —> CMY}}, - url = {http://www.easyrgb.com/index.php?X=MATH\&H=11#text11}, + title = {{RGB —> HSL}}, + url = {http://www.easyrgb.com/index.php?X=MATH\&H=18#text18}, urldate = {2014-05-18}, } @misc{EasyRGBn, @@ -876,22 +876,22 @@ @misc{EasyRGBn url = {http://www.easyrgb.com/index.php?X=MATH\&H=21#text21}, urldate = {2014-05-18}, } -@misc{EasyRGBi, +@misc{EasyRGBm, author = {EasyRGB}, - title = {{CMY —> RGB}}, - url = {http://www.easyrgb.com/index.php?X=MATH\&H=12#text12}, + title = {{CMYK —> CMY}}, + url = {http://www.easyrgb.com/index.php?X=MATH\&H=14#text14}, urldate = {2014-05-18}, } -@misc{EasyRGBo, +@misc{EasyRGBk, author = {EasyRGB}, - title = {{CMY —> CMYK}}, - url = {http://www.easyrgb.com/index.php?X=MATH\&H=13#text13}, + title = {{HSL —> RGB}}, + url = {http://www.easyrgb.com/index.php?X=MATH\&H=19#text19}, urldate = {2014-05-18}, } -@misc{EasyRGBl, +@misc{EasyRGBi, author = {EasyRGB}, - title = {{RGB —> HSL}}, - url = {http://www.easyrgb.com/index.php?X=MATH\&H=18#text18}, + title = {{CMY —> RGB}}, + url = {http://www.easyrgb.com/index.php?X=MATH\&H=12#text12}, urldate = {2014-05-18}, } @misc{EasyRGBj, @@ -900,6 +900,18 @@ @misc{EasyRGBj url = {http://www.easyrgb.com/index.php?X=MATH\&H=20#text20}, urldate = {2014-05-18}, } +@inproceedings{Ebner1998, + author = {Ebner, Fritz and Fairchild, Mark D.}, + booktitle = {Proc. SPIE 3300, Color Imaging: Device-Independent + Color, Color Hardcopy, and Graphic Arts III, (2 January 1998)}, + doi = {10.1117/12.298269}, + editor = {Beretta, Giordano B. and Eschbach, Reiner}, + month = jan, + pages = {107--117}, + title = {{Finding constant hue surfaces in color space}}, + url = {http://proceedings.spiedigitallibrary.org/proceeding.aspx?articleid=936964}, + year = 1998, +} @misc{Erdema, author = {Erdem, U. Murat}, title = {{Fast Line Segment Intersection}}, @@ -970,6 +982,63 @@ @inproceedings{Fairchild2011 url = {http://proceedings.spiedigitallibrary.org/proceeding.aspx?doi=10.1117/12.872075}, year = 2011, } +@incollection{Fairchild2013y, + author = {Fairchild, Mark D.}, + booktitle = {Color Appearance Models}, + chapter = {20.3}, + edition = 3, + isbn = {B00DAYO8E2}, + pages = {6197--6223}, + publisher = {Wiley}, + series = {The Wiley-IS\&T Series in Imaging Science and + Technology}, + title = {{IPT Colourspace}}, + year = 2013, +} +@incollection{Fairchild2013x, + author = {Fairchild, Mark D.}, + booktitle = {Color Appearance Models}, + chapter = {14.3}, + edition = 3, + isbn = {B00DAYO8E2}, + pages = {6025--6178}, + publisher = {Wiley}, + series = {The Wiley-IS\&T Series in Imaging Science and + Technology}, + title = {{LLAB Model}}, + year = 2013, +} +@incollection{Fairchild2013u, + author = {Fairchild, Mark D.}, + booktitle = {Color Appearance Models}, + chapter = 12, + edition = 3, + isbn = {B00DAYO8E2}, + pages = {5094--5556}, + publisher = {Wiley}, + series = {The Wiley-IS\&T Series in Imaging Science and + Technology}, + title = {{The Hunt Model}}, + year = 2013, +} +@misc{Fairchildb, + author = {Fairchild, Mark D.}, + title = {{Fairchild YSh}}, + url = {http://rit-mcsl.org/fairchild//files/FairchildYSh.zip}, +} +@incollection{Fairchild2013v, + author = {Fairchild, Mark D.}, + booktitle = {Color Appearance Models}, + chapter = {14.2}, + edition = 3, + isbn = {B00DAYO8E2}, + pages = {5852--5991}, + publisher = {Wiley}, + series = {The Wiley-IS\&T Series in Imaging Science and + Technology}, + title = {{ATD Model}}, + year = 2013, +} @article{Fairchild1996a, abstract = {The prediction of color appearance using the RLAB color space has been tested for a variety of viewing conditions @@ -994,35 +1063,30 @@ @article{Fairchild1996a volume = 21, year = 1996, } -@misc{Fairchildb, - author = {Fairchild, Mark D.}, - title = {{Fairchild YSh}}, - url = {http://rit-mcsl.org/fairchild//files/FairchildYSh.zip}, -} -@incollection{Fairchild2013v, +@incollection{Fairchild2013ba, author = {Fairchild, Mark D.}, booktitle = {Color Appearance Models}, - chapter = {14.2}, + chapter = 11, edition = 3, isbn = {B00DAYO8E2}, - pages = {5852--5991}, + pages = {4810--5085}, publisher = {Wiley}, series = {The Wiley-IS\&T Series in Imaging Science and Technology}, - title = {{ATD Model}}, + title = {{The Nayatani et al. Model}}, year = 2013, } -@incollection{Fairchild2013t, +@incollection{Fairchild2013w, author = {Fairchild, Mark D.}, booktitle = {Color Appearance Models}, - chapter = 11, + chapter = 13, edition = 3, isbn = {B00DAYO8E2}, - pages = {4179--4252}, + pages = {5563--5824}, publisher = {Wiley}, series = {The Wiley-IS\&T Series in Imaging Science and Technology}, - title = {{Chromatic Adaptation Models}}, + title = {{The RLAB Model}}, year = 2013, } @incollection{Fairchild2004c, @@ -1038,30 +1102,17 @@ @incollection{Fairchild2004c title = {{CIECAM02}}, year = 2004, } -@incollection{Fairchild2013x, - author = {Fairchild, Mark D.}, - booktitle = {Color Appearance Models}, - chapter = {14.3}, - edition = 3, - isbn = {B00DAYO8E2}, - pages = {6025--6178}, - publisher = {Wiley}, - series = {The Wiley-IS\&T Series in Imaging Science and - Technology}, - title = {{LLAB Model}}, - year = 2013, -} -@incollection{Fairchild2013w, +@incollection{Fairchild2013t, author = {Fairchild, Mark D.}, booktitle = {Color Appearance Models}, - chapter = 13, + chapter = 11, edition = 3, isbn = {B00DAYO8E2}, - pages = {5563--5824}, + pages = {4179--4252}, publisher = {Wiley}, series = {The Wiley-IS\&T Series in Imaging Science and Technology}, - title = {{The RLAB Model}}, + title = {{Chromatic Adaptation Models}}, year = 2013, } @incollection{Fairchild2013s, @@ -1077,45 +1128,6 @@ @incollection{Fairchild2013s title = {{FAIRCHILD'S 1990 MODEL}}, year = 2013, } -@incollection{Fairchild2013u, - author = {Fairchild, Mark D.}, - booktitle = {Color Appearance Models}, - chapter = 12, - edition = 3, - isbn = {B00DAYO8E2}, - pages = {5094--5556}, - publisher = {Wiley}, - series = {The Wiley-IS\&T Series in Imaging Science and - Technology}, - title = {{The Hunt Model}}, - year = 2013, -} -@incollection{Fairchild2013ba, - author = {Fairchild, Mark D.}, - booktitle = {Color Appearance Models}, - chapter = 11, - edition = 3, - isbn = {B00DAYO8E2}, - pages = {4810--5085}, - publisher = {Wiley}, - series = {The Wiley-IS\&T Series in Imaging Science and - Technology}, - title = {{The Nayatani et al. Model}}, - year = 2013, -} -@incollection{Fairchild2013y, - author = {Fairchild, Mark D.}, - booktitle = {Color Appearance Models}, - chapter = {20.3}, - edition = 3, - isbn = {B00DAYO8E2}, - pages = {6197--6223}, - publisher = {Wiley}, - series = {The Wiley-IS\&T Series in Imaging Science and - Technology}, - title = {{IPT Colourspace}}, - year = 2013, -} @article{Fairchild1991a, abstract = {A mathematical model of chromatic adaptation for calculating corresponding colors across changes of illumination @@ -1246,6 +1258,13 @@ @misc{Forsythe2018 title = {{Private Discussion with Mansencal, T}}, year = 2018, } +@misc{Fujifilm2016, + author = {Fujifilm}, + pages = {1--4}, + title = {{F-Log Data Sheet Ver.1.0}}, + url = {https://www.fujifilm.com/support/digital_cameras/software/lut/pdf/F-Log_DataSheet_E_Ver.1.0.pdf}, + year = 2016, +} @misc{Gaggioni, author = {Gaggioni, Hugo and Dhanendra, Patel and Yamashita, Jin and Kawada, N. and Endo, K. and Clark, Curtis}, @@ -1371,6 +1390,22 @@ @misc{Houston2015a title = {{Private Discussion with Mansencal, T.}}, year = 2015, } +@article{Hung1995, + author = {Hung, Po-Chieh and Berns, Roy S.}, + doi = {10.1002/col.5080200506}, + issn = 03612317, + journal = {Color Research \& Application}, + keywords = {color appearance spaces,experiments to evaluate + color space hue linearity,perceived hue}, + month = oct, + number = 5, + pages = {285--295}, + title = {{Determination of constant Hue Loci for a CRT gamut + and their predictions using color appearance spaces}}, + url = {http://doi.wiley.com/10.1002/col.5080200506}, + volume = 20, + year = 1995, +} @book{Hunt2004b, address = {Chichester, UK}, author = {Hunt, R.W.G.}, @@ -1396,15 +1431,6 @@ @misc{HunterLab2012a url = {https://hunterlabdotcom.files.wordpress.com/2012/07/an-1016-hunter-rd-a-b-color-scale-update-12-07-03.pdf}, year = 2012, } -@misc{HunterLab2008b, - author = {HunterLab}, - number = 9, - pages = {1--4}, - title = {{Hunter L,a,b Color Scale}}, - url = {http://www.hunterlab.se/wp-content/uploads/2012/11/Hunter-L-a-b.pdf}, - volume = 8, - year = 2008, -} @misc{HunterLab2008c, author = {HunterLab}, keywords = {ASTM illuminant}, @@ -1416,6 +1442,15 @@ @misc{HunterLab2008c volume = 14, year = 2008, } +@misc{HunterLab2008b, + author = {HunterLab}, + number = 9, + pages = {1--4}, + title = {{Hunter L,a,b Color Scale}}, + url = {http://www.hunterlab.se/wp-content/uploads/2012/11/Hunter-L-a-b.pdf}, + volume = 8, + year = 2008, +} @misc{HutchColorf, annote = {http://www.hutchcolor.com/profiles.html}, author = {HutchColor}, @@ -1428,18 +1463,18 @@ @misc{HutchColorg title = {{DonRGB4 (4 K)}}, url = {http://www.hutchcolor.com/profiles/DonRGB4.zip}, } -@misc{HutchColore, - annote = {http://www.hutchcolor.com/profiles.html}, - author = {HutchColor}, - title = {{XtremeRGB (4 K)}}, - url = {http://www.hutchcolor.com/profiles/XtremeRGB.zip}, -} @misc{HutchColord, annote = {http://www.hutchcolor.com/profiles.html}, author = {HutchColor}, title = {{BestRGB (4 K)}}, url = {http://www.hutchcolor.com/profiles/BestRGB.zip}, } +@misc{HutchColore, + annote = {http://www.hutchcolor.com/profiles.html}, + author = {HutchColor}, + title = {{XtremeRGB (4 K)}}, + url = {http://www.hutchcolor.com/profiles/XtremeRGB.zip}, +} @misc{IESComputerCommittee2014a, author = {{IES Computer Committee} and {TM-27-14 Working Group}}, @@ -1466,22 +1501,6 @@ @misc{InternationalTelecommunicationUnion2011e url = {https://www.itu.int/rec/dologin_pub.asp?lang=e\&id=T-REC-T.871-201105-I!!PDF-E\&type=items}, year = 2011, } -@misc{InternationalTelecommunicationUnion2016a, - author = {{International Telecommunication Union}}, - title = {{Recommendation ITU-R BT.2100-1 - Image parameter - values for high dynamic range television for use in production and - international programme exchange}}, - url = {https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.2100-1-201706-I!!PDF-E.pdf}, - year = 2016, -} -@misc{InternationalTelecommunicationUnion2011f, - author = {{International Telecommunication Union}}, - title = {{Recommendation ITU-R BT.601-7 - Studio encoding - parameters of digital television for standard 4:3 and wide-screen - 16:9 aspect ratios}}, - url = {http://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.601-7-201103-I!!PDF-E.pdf}, - year = 2011, -} @misc{InternationalTelecommunicationUnion2015, author = {{International Telecommunication Union}}, pages = {1--92}, @@ -1508,6 +1527,22 @@ @misc{InternationalTelecommunicationUnion2015h url = {https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.2020-2-201510-I!!PDF-E.pdf}, year = 2015, } +@misc{InternationalTelecommunicationUnion2011f, + author = {{International Telecommunication Union}}, + title = {{Recommendation ITU-R BT.601-7 - Studio encoding + parameters of digital television for standard 4:3 and wide-screen + 16:9 aspect ratios}}, + url = {http://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.601-7-201103-I!!PDF-E.pdf}, + year = 2011, +} +@misc{InternationalTelecommunicationUnion2018, + author = {{International Telecommunication Union}}, + title = {{Recommendation ITU-R BT.2100-2 - Image parameter + values for high dynamic range television for use in production and + international programme exchange}}, + url = {https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.2100-2-201807-I!!PDF-E.pdf}, + year = 2018, +} @misc{InternationalTelecommunicationUnion2011h, author = {{International Telecommunication Union}}, title = {{Recommendation ITU-R BT.1886 - Reference @@ -1533,11 +1568,19 @@ @misc{InternationalTelecommunicationUnion1998a url = {http://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.470-6-199811-S!!PDF-E.pdf}, year = 1998, } -@article{Kang2002a, - annote = {http://icpr.snu.ac.kr/resource/wop.pdf/J01/2002/041/R06/J012002041R060865.pdf}, - author = {Kang, Bongsoon and Moon, Ohak and Hong, Changhee and - Lee, Honam and Cho, Bonghwan and Kim, Youngsun}, - journal = {Journal of the Korean Physical Society}, +@misc{InternationalTelecommunicationUnion2017, + author = {{International Telecommunication Union}}, + title = {{Recommendation ITU-R BT.2100-1 - Image parameter + values for high dynamic range television for use in production and + international programme exchange}}, + url = {https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.2100-1-201706-I!!PDF-E.pdf}, + year = 2017, +} +@article{Kang2002a, + annote = {http://icpr.snu.ac.kr/resource/wop.pdf/J01/2002/041/R06/J012002041R060865.pdf}, + author = {Kang, Bongsoon and Moon, Ohak and Hong, Changhee and + Lee, Honam and Cho, Bonghwan and Kim, Youngsun}, + journal = {Journal of the Korean Physical Society}, keywords = {chromaticity,cie-xyz,color temperature,hdtv}, number = 6, pages = {865--871}, @@ -1646,13 +1689,6 @@ @misc{Li2007e url = {https://pdfs.semanticscholar.org/b5a9/0215ad9a1fb6b01f310b3d64305f7c9feb3a.pdf}, year = 2007, } -@misc{Lindbloom2009f, - author = {Lindbloom, Bruce}, - title = {{Delta E (CMC)}}, - url = {http://brucelindbloom.com/Eqn_DeltaE_CMC.html}, - urldate = {2014-02-24}, - year = 2009, -} @misc{Lindbloom2015, author = {Lindbloom, Bruce}, title = {{About the Lab Gamut}}, @@ -1660,13 +1696,6 @@ @misc{Lindbloom2015 urldate = {2018-08-20}, year = 2015, } -@misc{Lindbloom2009d, - author = {Lindbloom, Bruce}, - title = {{xyY to XYZ}}, - url = {http://www.brucelindbloom.com/Eqn_xyY_to_XYZ.html}, - urldate = {2014-02-24}, - year = 2009, -} @misc{Lindbloom2003e, author = {Lindbloom, Bruce}, title = {{XYZ to xyY}}, @@ -1674,20 +1703,13 @@ @misc{Lindbloom2003e urldate = {2014-02-24}, year = 2003, } -@misc{Lindbloom2009e, +@misc{Lindbloom2009f, author = {Lindbloom, Bruce}, - title = {{Delta E (CIE 2000)}}, - url = {http://brucelindbloom.com/Eqn_DeltaE_CIE2000.html}, + title = {{Delta E (CMC)}}, + url = {http://brucelindbloom.com/Eqn_DeltaE_CMC.html}, urldate = {2014-02-24}, year = 2009, } -@misc{Lindbloom2003c, - author = {Lindbloom, Bruce}, - title = {{Delta E (CIE 1976)}}, - url = {http://brucelindbloom.com/Eqn_DeltaE_CIE76.html}, - urldate = {2014-02-24}, - year = 2003, -} @misc{Lindbloom2011a, author = {Lindbloom, Bruce}, title = {{Delta E (CIE 1994)}}, @@ -1702,6 +1724,13 @@ @misc{Lindbloom2009g urldate = {2014-02-24}, year = 2009, } +@misc{Lindbloom2009e, + author = {Lindbloom, Bruce}, + title = {{Delta E (CIE 2000)}}, + url = {http://brucelindbloom.com/Eqn_DeltaE_CIE2000.html}, + urldate = {2014-02-24}, + year = 2009, +} @misc{Lindbloom2014a, author = {Lindbloom, Bruce}, title = {{RGB Working Space Information}}, @@ -1709,6 +1738,20 @@ @misc{Lindbloom2014a urldate = {2014-04-11}, year = 2014, } +@misc{Lindbloom2009d, + author = {Lindbloom, Bruce}, + title = {{xyY to XYZ}}, + url = {http://www.brucelindbloom.com/Eqn_xyY_to_XYZ.html}, + urldate = {2014-02-24}, + year = 2009, +} +@misc{Lindbloom2003c, + author = {Lindbloom, Bruce}, + title = {{Delta E (CIE 1976)}}, + url = {http://brucelindbloom.com/Eqn_DeltaE_CIE76.html}, + urldate = {2014-02-24}, + year = 2003, +} @article{Lu2016c, abstract = {High Dynamic Range (HDR) and Wider Colour Gamut (WCG) content represents a greater range of luminance levels and a @@ -1779,6 +1822,41 @@ @article{Luo2006b volume = 31, year = 2006, } +@article{Luo1999, + abstract = {Predicting the binding mode of flexible polypeptides + to proteins is an important task that falls outside the domain of + applicability of most small molecule and protein−protein docking + tools. Here, we test the small molecule flexible ligand docking + program Glide on a set of 19 non-$\alpha$-helical peptides and + systematically improve pose prediction accuracy by enhancing Glide + sampling for flexible polypeptides. In addition, scoring of the + poses was improved by post-processing with physics-based implicit + solvent MM- GBSA calculations. Using the best RMSD among the top + 10 scoring poses as a metric, the success rate (RMSD ≤ 2.0 {\AA} + for the interface backbone atoms) increased from 21% with default + Glide SP settings to 58% with the enhanced peptide sampling and + scoring protocol in the case of redocking to the native protein + structure. This approaches the accuracy of the recently developed + Rosetta FlexPepDock method (63% success for these 19 peptides) + while being over 100 times faster. Cross-docking was performed for + a subset of cases where an unbound receptor structure was + available, and in that case, 40% of peptides were docked + successfully. We analyze the results and find that the optimized + polypeptide protocol is most accurate for extended peptides of + limited size and number of formal charges, defining a domain of + applicability for this approach.}, + author = {Luo, M. Ronnier and Rhodes, Peter A.}, + doi = {10.1002/(SICI)1520-6378(199908)24:4<295::AID-COL10>3.0.CO;2-K}, + issn = {0361-2317}, + journal = {Color Research \& Application}, + month = aug, + number = 4, + pages = {295--296}, + title = {{Corresponding-colour datasets}}, + url = {http://doi.wiley.com/10.1002/%28SICI%291520-6378%28199908%2924%3A4%3C295%3A%3AAID-COL10%3E3.0.CO%3B2-K}, + volume = 24, + year = 1999, +} @incollection{Luo2013, address = {New York, NY}, annote = {http://link.springer.com/chapter/10.1007/978-1-4419-6190-7_2}, @@ -1844,6 +1922,30 @@ @inproceedings{Luo1996c url = {http://www.researchgate.net/publication/236348295_Two_Unsolved_Issues_in_Colour_Management__Colour_Appearance_and_Gamut_Mapping}, year = 1996, } +@article{MacAdam1935a, + abstract = {Tristimulus values have been computed for + hypothetical spectrophotometric curves of the type found to give + the maximum visual reflectance factor (or transmission factor) for + specified chromaticities. These computations have been based on + the I.C.I. 1931 data for the normal observer for colorimetry, and + on the I.C.I. Illuminants ``A'' and ``C.'' By plotting the results + on the I.C.I. color mixture diagram, the loci of points + characterized by equal maximum efficiencies have been established. + Tables have been prepared showing the maximum visual efficiency as + a function of excitation purity for twenty-four dominant + wave-lengths.}, + author = {MacAdam, David L.}, + doi = {10.1364/JOSA.25.000361}, + journal = {Journal of the Optical Society of America}, + month = nov, + number = 11, + pages = {361--367}, + publisher = {OSA}, + title = {{Maximum Visual Efficiency of Colored Materials}}, + url = {http://www.opticsinfobase.org/abstract.cfm?URI=josa-25-11-361}, + volume = 25, + year = 1935, +} @article{Macadam1942, abstract = {An apparatus is described which facilitates the presentation of pairs of variable colors without variation of @@ -1895,30 +1997,6 @@ @article{Macadam1942 volume = 32, year = 1942, } -@article{MacAdam1935a, - abstract = {Tristimulus values have been computed for - hypothetical spectrophotometric curves of the type found to give - the maximum visual reflectance factor (or transmission factor) for - specified chromaticities. These computations have been based on - the I.C.I. 1931 data for the normal observer for colorimetry, and - on the I.C.I. Illuminants ``A'' and ``C.'' By plotting the results - on the I.C.I. color mixture diagram, the loci of points - characterized by equal maximum efficiencies have been established. - Tables have been prepared showing the maximum visual efficiency as - a function of excitation purity for twenty-four dominant - wave-lengths.}, - author = {MacAdam, David L.}, - doi = {10.1364/JOSA.25.000361}, - journal = {Journal of the Optical Society of America}, - month = nov, - number = 11, - pages = {361--367}, - publisher = {OSA}, - title = {{Maximum Visual Efficiency of Colored Materials}}, - url = {http://www.opticsinfobase.org/abstract.cfm?URI=josa-25-11-361}, - volume = 25, - year = 1935, -} @article{Machado2009, abstract = {Color vision deficiency (CVD) affects approximately 200 million people worldwide, compromising the ability of these @@ -1975,6 +2053,23 @@ @misc{Malvar2003 url = {https://www.microsoft.com/en-us/research/wp-content/uploads/2016/06/Malvar_Sullivan_YCoCg-R_JVT-I014r3-2.pdf}, year = 2003, } +@misc{Mansencal2019, + author = {Mansencal, Thomas}, + doi = {10.5281/zenodo.3362520}, + title = {{Colour - Datasets}}, + url = {https://github.com/colour-science/colour-datasets}, + year = 2019, +} +@misc{Mansencalc, + author = {Mansencal, Thomas}, + title = {{Lookup}}, + url = {https://github.com/KelSolaar/Foundations/blob/develop/foundations/data_structures.py}, +} +@misc{Mansencald, + author = {Mansencal, Thomas}, + title = {{Structure}}, + url = {https://github.com/KelSolaar/Foundations/blob/develop/foundations/data_structures.py}, +} @misc{Mansencal2018, author = {Mansencal, Thomas}, title = {{How is the visible gamut bounded?}}, @@ -1989,16 +2084,6 @@ @misc{Mansencal2015d urldate = {2015-05-20}, year = 2015, } -@misc{Mansencald, - author = {Mansencal, Thomas}, - title = {{Structure}}, - url = {https://github.com/KelSolaar/Foundations/blob/develop/foundations/data_structures.py}, -} -@misc{Mansencalc, - author = {Mansencal, Thomas}, - title = {{Lookup}}, - url = {https://github.com/KelSolaar/Foundations/blob/develop/foundations/data_structures.py}, -} @misc{Melgosa2013b, author = {Melgosa, Manuel}, number = {July}, @@ -2061,18 +2146,18 @@ @article{Moroneya url = {http://www.ingentaconnect.com/content/ist/cic/2002/00002002/00000001/art00006}, year = 2002, } -@misc{MunsellColorScienceb, - annote = {http://www.cis.rit.edu/research/mcsl2/online/cie.php}, - author = {{Munsell Color Science}}, - title = {{Macbeth Colorchecker}}, - url = {http://www.rit-mcsl.org/UsefulData/MacbethColorChecker.xls}, -} @misc{MunsellColorSciencec, author = {{Munsell Color Science}}, title = {{Munsell Colours Data}}, url = {http://www.cis.rit.edu/research/mcsl2/online/munsell.php}, urldate = {2014-08-20}, } +@misc{MunsellColorScienceb, + annote = {http://www.cis.rit.edu/research/mcsl2/online/cie.php}, + author = {{Munsell Color Science}}, + title = {{Macbeth Colorchecker}}, + url = {http://www.rit-mcsl.org/UsefulData/MacbethColorChecker.xls}, +} @misc{NationalElectricalManufacturersAssociation2004b, annote = {http://www.ncbi.nlm.nih.gov/pubmed/2188123}, author = {{National Electrical Manufacturers Association}}, @@ -2366,33 +2451,6 @@ @article{Smits1999a volume = 4, year = 1999, } -@book{SocietyofMotionPictureandTelevisionEngineers1993a, - abstract = {color white whitepoint matrix Scope This practice is - intended to define the numerical procedures for deriving basic - color equations for color television and other systems using - additive display devices. These equations are first, the - normalized reference primary matrix which defines the relationship - between RGB signals and CIE tristimulus values XYZ; then, the - system luminance equation; and finally, the color primary - transformation matrix for transforming signals from one set of - reference primaries to another set of reference primaries or to a - set of display primaries.}, - annote = {http://car.france3.mars.free.fr/HD/INA- 26 jan - 06/SMPTE normes et confs/rp177.pdf}, - author = {{Society of Motion Picture and Television Engineers}}, - booktitle = {RP 177:1993}, - doi = {10.5594/S9781614821915}, - isbn = {978-1-61482-191-5}, - month = jan, - pages = {1--4}, - publisher = {The Society of Motion Picture and Television - Engineers}, - title = {{RP 177:1993 : Derivation of Basic Television Color - Equations}}, - url = {http://standards.smpte.org/lookup/doi/10.5594/S9781614821915}, - volume = {RP 177:199}, - year = 1993, -} @misc{SocietyofMotionPictureandTelevisionEngineers2014a, abstract = {This standard specifies an EOTF characterizing high-dynamic-range reference displays used primarily for mastering @@ -2425,6 +2483,33 @@ @book{SocietyofMotionPictureandTelevisionEngineers2004a volume = {RP 145:200}, year = 2004, } +@book{SocietyofMotionPictureandTelevisionEngineers1993a, + abstract = {color white whitepoint matrix Scope This practice is + intended to define the numerical procedures for deriving basic + color equations for color television and other systems using + additive display devices. These equations are first, the + normalized reference primary matrix which defines the relationship + between RGB signals and CIE tristimulus values XYZ; then, the + system luminance equation; and finally, the color primary + transformation matrix for transforming signals from one set of + reference primaries to another set of reference primaries or to a + set of display primaries.}, + annote = {http://car.france3.mars.free.fr/HD/INA- 26 jan + 06/SMPTE normes et confs/rp177.pdf}, + author = {{Society of Motion Picture and Television Engineers}}, + booktitle = {RP 177:1993}, + doi = {10.5594/S9781614821915}, + isbn = {978-1-61482-191-5}, + month = jan, + pages = {1--4}, + publisher = {The Society of Motion Picture and Television + Engineers}, + title = {{RP 177:1993 : Derivation of Basic Television Color + Equations}}, + url = {http://standards.smpte.org/lookup/doi/10.5594/S9781614821915}, + volume = {RP 177:199}, + year = 1993, +} @misc{SocietyofMotionPictureandTelevisionEngineers1999b, author = {{Society of Motion Picture and Television Engineers}}, pages = {1--7}, @@ -2448,11 +2533,6 @@ @misc{SonyCorporation url = {http://www.theodoropoulos.info/attachments/076_on S-Log.pdf}, } -@misc{SonyCorporatione, - author = {{Sony Corporation}}, - title = {{S-Gamut3_S-Gamut3Cine_Matrix.xlsx}}, - url = {https://community.sony.com/sony/attachments/sony/large-sensor-camera-F5-F55/12359/3/S-Gamut3_S-Gamut3Cine_Matrix.xlsx}, -} @misc{SonyCorporation2012a, author = {{Sony Corporation}}, pages = {1--9}, @@ -2460,6 +2540,11 @@ @misc{SonyCorporation2012a url = {https://pro.sony.com/bbsccms/assets/files/micro/dmpc/training/S-Log2_Technical_PaperV1_0.pdf}, year = 2012, } +@misc{SonyCorporatione, + author = {{Sony Corporation}}, + title = {{S-Gamut3_S-Gamut3Cine_Matrix.xlsx}}, + url = {https://community.sony.com/sony/attachments/sony/large-sensor-camera-F5-F55/12359/3/S-Gamut3_S-Gamut3Cine_Matrix.xlsx}, +} @misc{SonyImageworks2012a, author = {{Sony Imageworks}}, pages = 1, @@ -2622,23 +2707,13 @@ @misc{TheAcademyofMotionPictureArtsandSciences2014t url = {https://github.com/ampas/aces-dev/tree/master/documents}, year = 2014, } -@misc{TheAcademyofMotionPictureArtsandSciences2014r, - author = {{The Academy of Motion Picture Arts and Sciences} - and {Science and Technology Council} and {Academy Color Encoding - System (ACES) Project Subcommittee}}, - pages = {1--8}, - title = {{Technical Bulletin TB-2014-012 - Academy Color - Encoding System Version 1.0 Component Names}}, - url = {https://github.com/ampas/aces-dev/tree/master/documents}, - year = 2014, -} -@misc{TheAcademyofMotionPictureArtsandSciences2014s, +@misc{TheAcademyofMotionPictureArtsandSciences2014q, author = {{The Academy of Motion Picture Arts and Sciences} and {Science and Technology Council} and {Academy Color Encoding System (ACES) Project Subcommittee}}, - pages = {1--16}, - title = {{Specification S-2013-001 - ACESproxy, an Integer - Log Encoding of ACES Image Data}}, + pages = {1--40}, + title = {{Technical Bulletin TB-2014-004 - Informative Notes + on SMPTE ST 2065-1 – Academy Color Encoding Specification (ACES)}}, url = {https://github.com/ampas/aces-dev/tree/master/documents}, year = 2014, } @@ -2652,16 +2727,6 @@ @misc{TheAcademyofMotionPictureArtsandSciences2015b url = {https://github.com/ampas/aces-dev/tree/master/documents}, year = 2015, } -@misc{TheAcademyofMotionPictureArtsandSciences2014q, - author = {{The Academy of Motion Picture Arts and Sciences} - and {Science and Technology Council} and {Academy Color Encoding - System (ACES) Project Subcommittee}}, - pages = {1--40}, - title = {{Technical Bulletin TB-2014-004 - Informative Notes - on SMPTE ST 2065-1 – Academy Color Encoding Specification (ACES)}}, - url = {https://github.com/ampas/aces-dev/tree/master/documents}, - year = 2014, -} @misc{TheAcademyofMotionPictureArtsandSciencese, author = {{The Academy of Motion Picture Arts and Sciences} and {Science and Technology Council} and {Academy Color Encoding @@ -2670,13 +2735,33 @@ @misc{TheAcademyofMotionPictureArtsandSciencese url = {http://www.oscars.org/science-technology/council/projects/aces.html}, urldate = {2014-02-24}, } -@misc{Thorpe2012a, - author = {Thorpe, Larry}, - title = {{CANON-LOG TRANSFER CHARACTERISTIC}}, - url = {http://downloads.canon.com/CDLC/Canon-Log_Transfer_Characteristic_6-20-2012.pdf}, - year = 2012, +@misc{TheAcademyofMotionPictureArtsandSciences2014s, + author = {{The Academy of Motion Picture Arts and Sciences} + and {Science and Technology Council} and {Academy Color Encoding + System (ACES) Project Subcommittee}}, + pages = {1--16}, + title = {{Specification S-2013-001 - ACESproxy, an Integer + Log Encoding of ACES Image Data}}, + url = {https://github.com/ampas/aces-dev/tree/master/documents}, + year = 2014, } -@misc{Trieu2015a, +@misc{TheAcademyofMotionPictureArtsandSciences2014r, + author = {{The Academy of Motion Picture Arts and Sciences} + and {Science and Technology Council} and {Academy Color Encoding + System (ACES) Project Subcommittee}}, + pages = {1--8}, + title = {{Technical Bulletin TB-2014-012 - Academy Color + Encoding System Version 1.0 Component Names}}, + url = {https://github.com/ampas/aces-dev/tree/master/documents}, + year = 2014, +} +@misc{Thorpe2012a, + author = {Thorpe, Larry}, + title = {{CANON-LOG TRANSFER CHARACTERISTIC}}, + url = {http://downloads.canon.com/CDLC/Canon-Log_Transfer_Characteristic_6-20-2012.pdf}, + year = 2012, +} +@misc{Trieu2015a, author = {Trieu, Tashi}, title = {{Private Discussion with Mansencal, T.}}, year = 2015, @@ -2716,26 +2801,26 @@ @incollection{Westland2004 url = {http://doi.wiley.com/10.1002/0470020326}, year = 2004, } -@incollection{Westland2012i, +@incollection{Westland2012k, author = {Westland, Stephen and Ripamonti, Caterina and Cheung, Vien}, booktitle = {Computational Colour Science Using MATLAB}, - chapter = {4.4}, + chapter = {6.2.3}, edition = 2, isbn = {978-0-470-66569-5}, - pages = 38, - title = {{Extrapolation Methods}}, + pages = {83--86}, + title = {{CMCCAT2000}}, year = 2012, } -@incollection{Westland2012h, +@incollection{Westland2012g, author = {Westland, Stephen and Ripamonti, Caterina and Cheung, Vien}, booktitle = {Computational Colour Science Using MATLAB}, - chapter = {4.3}, + chapter = {6.2.2}, edition = 2, isbn = {978-0-470-66569-5}, - pages = {29--37}, - title = {{Interpolation Methods}}, + pages = 80, + title = {{CMCCAT97}}, year = 2012, } @incollection{Westland2012f, @@ -2749,55 +2834,34 @@ @incollection{Westland2012f title = {{Correction for Spectral Bandpass}}, year = 2012, } -@incollection{Westland2012g, +@incollection{Westland2012i, author = {Westland, Stephen and Ripamonti, Caterina and Cheung, Vien}, booktitle = {Computational Colour Science Using MATLAB}, - chapter = {6.2.2}, + chapter = {4.4}, edition = 2, isbn = {978-0-470-66569-5}, - pages = 80, - title = {{CMCCAT97}}, + pages = 38, + title = {{Extrapolation Methods}}, year = 2012, } -@incollection{Westland2012k, +@incollection{Westland2012h, author = {Westland, Stephen and Ripamonti, Caterina and Cheung, Vien}, booktitle = {Computational Colour Science Using MATLAB}, - chapter = {6.2.3}, + chapter = {4.3}, edition = 2, isbn = {978-0-470-66569-5}, - pages = {83--86}, - title = {{CMCCAT2000}}, + pages = {29--37}, + title = {{Interpolation Methods}}, year = 2012, } -@misc{Wikipedia2005, - author = {Wikipedia}, - title = {{CIE 1931 color space}}, - url = {http://en.wikipedia.org/wiki/CIE_1931_color_space}, - urldate = {2014-02-24}, - year = 2005, -} -@misc{Wikipedia2005c, - author = {Wikipedia}, - title = {{Luminous Efficacy}}, - url = {https://en.wikipedia.org/wiki/Luminous_efficacy}, - urldate = {2016-04-03}, - year = 2005, -} -@misc{Wikipedia2004, - author = {Wikipedia}, - title = {{Peak signal-to-noise ratio}}, - url = {https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio}, - urldate = {2018-03-05}, - year = 2004, -} -@misc{Wikipedia2003d, +@misc{Wikipedia2001a, author = {Wikipedia}, - title = {{Michaelis–Menten kinetics}}, - url = {https://en.wikipedia.org/wiki/Michaelis–Menten_kinetics}, - urldate = {2017-04-29}, - year = 2003, + title = {{Color temperature}}, + url = {http://en.wikipedia.org/wiki/Color_temperature}, + urldate = {2014-06-28}, + year = 2001, } @misc{Wikipedia2001, author = {Wikipedia}, @@ -2806,33 +2870,19 @@ @misc{Wikipedia2001 urldate = {2014-06-28}, year = 2001, } -@misc{Wikipedia2005b, - author = {Wikipedia}, - title = {{Lanczos resampling}}, - url = {https://en.wikipedia.org/wiki/Lanczos_resampling}, - urldate = {2017-10-14}, - year = 2005, -} -@misc{Wikipedia2007d, +@misc{Wikipedia2006a, author = {Wikipedia}, - title = {{The reverse transformation}}, - url = {http://en.wikipedia.org/wiki/CIELUV#The_reverse_transformation}, + title = {{White points of standard illuminants}}, + url = {http://en.wikipedia.org/wiki/Standard_illuminant#White_points_of_standard_illuminants}, urldate = {2014-02-24}, - year = 2007, -} -@misc{Wikipedia2004a, - author = {Wikipedia}, - title = {{Surfaces}}, - url = {http://en.wikipedia.org/wiki/Gamut#Surfaces}, - urldate = {2014-09-10}, - year = 2004, + year = 2006, } -@misc{Wikipedia2007c, +@misc{Wikipedia2008b, author = {Wikipedia}, - title = {{Lightness}}, - url = {http://en.wikipedia.org/wiki/Lightness}, - urldate = {2014-04-13}, - year = 2007, + title = {{Color difference}}, + url = {http://en.wikipedia.org/wiki/Color_difference}, + urldate = {2014-08-29}, + year = 2008, } @misc{Wikipedia2008c, author = {Wikipedia}, @@ -2841,19 +2891,25 @@ @misc{Wikipedia2008c urldate = {2014-02-24}, year = 2008, } -@misc{Wikipedia2004d, +@misc{Wikipedia2008a, author = {Wikipedia}, - title = {{YCbCr}}, - url = {https://en.wikipedia.org/wiki/YCbCr}, - urldate = {2016-02-29}, - year = 2004, + title = {{CIE 1964 color space}}, + url = {http://en.wikipedia.org/wiki/CIE_1964_color_space}, + urldate = {2014-06-10}, + year = 2008, } -@misc{Wikipedia2001a, +@misc{Wikipedia, author = {Wikipedia}, - title = {{Color temperature}}, - url = {http://en.wikipedia.org/wiki/Color_temperature}, - urldate = {2014-06-28}, - year = 2001, + title = {{Ellipse}}, + url = {https://en.wikipedia.org/wiki/Ellipse}, + urldate = {2018-11-24}, +} +@misc{Wikipedia2007d, + author = {Wikipedia}, + title = {{The reverse transformation}}, + url = {http://en.wikipedia.org/wiki/CIELUV#The_reverse_transformation}, + urldate = {2014-02-24}, + year = 2007, } @misc{Wikipedia2001b, author = {Wikipedia}, @@ -2862,6 +2918,20 @@ @misc{Wikipedia2001b urldate = {2018-02-10}, year = 2001, } +@misc{Wikipedia2007c, + author = {Wikipedia}, + title = {{Lightness}}, + url = {http://en.wikipedia.org/wiki/Lightness}, + urldate = {2014-04-13}, + year = 2007, +} +@misc{Wikipedia2003d, + author = {Wikipedia}, + title = {{Michaelis–Menten kinetics}}, + url = {https://en.wikipedia.org/wiki/Michaelis–Menten_kinetics}, + urldate = {2017-04-29}, + year = 2003, +} @misc{Wikipedia2003b, author = {Wikipedia}, title = {{Luminosity function}}, @@ -2869,39 +2939,33 @@ @misc{Wikipedia2003b urldate = {2014-10-20}, year = 2003, } -@misc{Wikipedia2007b, - author = {Wikipedia}, - title = {{CIELUV}}, - url = {http://en.wikipedia.org/wiki/CIELUV}, - urldate = {2014-02-24}, - year = 2007, -} -@misc{Wikipedia, +@misc{Wikipedia2005c, author = {Wikipedia}, - title = {{Ellipse}}, - url = {https://en.wikipedia.org/wiki/Ellipse}, - urldate = {2018-11-24}, + title = {{Luminous Efficacy}}, + url = {https://en.wikipedia.org/wiki/Luminous_efficacy}, + urldate = {2016-04-03}, + year = 2005, } -@misc{Wikipedia2008a, +@misc{Wikipedia2008, author = {Wikipedia}, - title = {{CIE 1964 color space}}, - url = {http://en.wikipedia.org/wiki/CIE_1964_color_space}, - urldate = {2014-06-10}, + title = {{CIE 1960 color space}}, + url = {http://en.wikipedia.org/wiki/CIE_1960_color_space}, + urldate = {2014-02-24}, year = 2008, } -@misc{Wikipedia2006, +@misc{Wikipedia2004c, author = {Wikipedia}, - title = {{List of common coordinate transformations}}, - url = {http://en.wikipedia.org/wiki/List_of_common_coordinate_transformations}, - urldate = {2014-07-18}, - year = 2006, + title = {{Wide-gamut RGB color space}}, + url = {http://en.wikipedia.org/wiki/Wide-gamut_RGB_color_space}, + urldate = {2014-04-13}, + year = 2004, } -@misc{Wikipedia2008b, +@misc{Wikipedia2001c, author = {Wikipedia}, - title = {{Color difference}}, - url = {http://en.wikipedia.org/wiki/Color_difference}, - urldate = {2014-08-29}, - year = 2008, + title = {{Rayleigh scattering}}, + url = {http://en.wikipedia.org/wiki/Rayleigh_scattering}, + urldate = {2014-09-23}, + year = 2001, } @misc{Wikipedia2003e, author = {Wikipedia}, @@ -2910,26 +2974,19 @@ @misc{Wikipedia2003e urldate = {2018-05-02}, year = 2003, } -@misc{Wikipedia2006a, +@misc{Wikipedia2007b, author = {Wikipedia}, - title = {{White points of standard illuminants}}, - url = {http://en.wikipedia.org/wiki/Standard_illuminant#White_points_of_standard_illuminants}, + title = {{CIELUV}}, + url = {http://en.wikipedia.org/wiki/CIELUV}, urldate = {2014-02-24}, - year = 2006, -} -@misc{Wikipedia2003a, - author = {Wikipedia}, - title = {{Lagrange polynomial - Definition}}, - url = {https://en.wikipedia.org/wiki/Lagrange_polynomial#Definition}, - urldate = {2016-01-20}, - year = 2003, + year = 2007, } -@misc{Wikipedia2008, +@misc{Wikipedia2007, author = {Wikipedia}, - title = {{CIE 1960 color space}}, - url = {http://en.wikipedia.org/wiki/CIE_1960_color_space}, + title = {{CAT02}}, + url = {http://en.wikipedia.org/wiki/CIECAM02#CAT02}, urldate = {2014-02-24}, - year = 2008, + year = 2007, } @misc{Wikipedia2003c, author = {Wikipedia}, @@ -2938,6 +2995,41 @@ @misc{Wikipedia2003c urldate = {2018-03-05}, year = 2003, } +@misc{Wikipedia2004a, + author = {Wikipedia}, + title = {{Surfaces}}, + url = {http://en.wikipedia.org/wiki/Gamut#Surfaces}, + urldate = {2014-09-10}, + year = 2004, +} +@misc{Wikipedia2004d, + author = {Wikipedia}, + title = {{YCbCr}}, + url = {https://en.wikipedia.org/wiki/YCbCr}, + urldate = {2016-02-29}, + year = 2004, +} +@misc{Wikipedia2005b, + author = {Wikipedia}, + title = {{Lanczos resampling}}, + url = {https://en.wikipedia.org/wiki/Lanczos_resampling}, + urldate = {2017-10-14}, + year = 2005, +} +@misc{Wikipedia2004, + author = {Wikipedia}, + title = {{Peak signal-to-noise ratio}}, + url = {https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio}, + urldate = {2018-03-05}, + year = 2004, +} +@misc{Wikipedia2006, + author = {Wikipedia}, + title = {{List of common coordinate transformations}}, + url = {http://en.wikipedia.org/wiki/List_of_common_coordinate_transformations}, + urldate = {2014-07-18}, + year = 2006, +} @misc{Wikipedia2005d, author = {Wikipedia}, title = {{Mesopic weighting function}}, @@ -2945,13 +3037,6 @@ @misc{Wikipedia2005d urldate = {2014-06-20}, year = 2005, } -@misc{Wikipedia2004c, - author = {Wikipedia}, - title = {{Wide-gamut RGB color space}}, - url = {http://en.wikipedia.org/wiki/Wide-gamut_RGB_color_space}, - urldate = {2014-04-13}, - year = 2004, -} @misc{Wikipedia2004b, author = {Wikipedia}, title = {{Whiteness}}, @@ -2959,19 +3044,19 @@ @misc{Wikipedia2004b urldate = {2014-09-17}, year = 2004, } -@misc{Wikipedia2001c, +@misc{Wikipedia2007a, author = {Wikipedia}, - title = {{Rayleigh scattering}}, - url = {http://en.wikipedia.org/wiki/Rayleigh_scattering}, - urldate = {2014-09-23}, - year = 2001, + title = {{CIECAM02}}, + url = {http://en.wikipedia.org/wiki/CIECAM02}, + urldate = {2014-08-14}, + year = 2007, } -@misc{Wikipedia2007, +@misc{Wikipedia2003a, author = {Wikipedia}, - title = {{CAT02}}, - url = {http://en.wikipedia.org/wiki/CIECAM02#CAT02}, - urldate = {2014-02-24}, - year = 2007, + title = {{Lagrange polynomial - Definition}}, + url = {https://en.wikipedia.org/wiki/Lagrange_polynomial#Definition}, + urldate = {2016-01-20}, + year = 2003, } @misc{Wikipedia2005a, author = {Wikipedia}, @@ -2980,6 +3065,13 @@ @misc{Wikipedia2005a urldate = {2016-07-31}, year = 2005, } +@misc{Wikipedia2005, + author = {Wikipedia}, + title = {{CIE 1931 color space}}, + url = {http://en.wikipedia.org/wiki/CIE_1931_color_space}, + urldate = {2014-02-24}, + year = 2005, +} @misc{Wikipedia2003, author = {Wikipedia}, title = {{HSL and HSV}}, @@ -2987,13 +3079,6 @@ @misc{Wikipedia2003 urldate = {2014-09-10}, year = 2003, } -@misc{Wikipedia2007a, - author = {Wikipedia}, - title = {{CIECAM02}}, - url = {http://en.wikipedia.org/wiki/CIECAM02}, - urldate = {2014-08-14}, - year = 2007, -} @article{Wyszecki1963b, annote = {http://www.opticsinfobase.org/abstract.cfm?URI=josa-53-11-1318}, author = {Wyszecki, G{\"{u}}nter}, @@ -3009,19 +3094,6 @@ @article{Wyszecki1963b volume = 53, year = 1963, } -@incollection{Wyszecki2000, - author = {Wyszecki, G{\"{u}}nther and Stiles, W S}, - booktitle = {Color Science: Concepts and Methods, Quantitative - Data and Formulae}, - isbn = {978-0471399186}, - pages = 309, - publisher = {Wiley}, - title = {{Table 2(5.4.1) MacAdam Ellipses (Observer PGN) - Observed and Calculated on the Basis of a Normal Distribution of - Color Matches about a Color Center (Silberstein and MacAdam, - 1945)}}, - year = 2000, -} @incollection{Wyszecki2000a, author = {Wyszecki, G{\"{u}}nther and Stiles, W S}, booktitle = {Color Science: Concepts and Methods, Quantitative @@ -3032,76 +3104,79 @@ @incollection{Wyszecki2000a title = {{Equation I(1.2.1)}}, year = 2000, } -@incollection{Wyszecki2000z, - author = {Wyszecki, G{\"{u}}nther and Stiles, W. S.}, +@incollection{Wyszecki2000, + author = {Wyszecki, G{\"{u}}nther and Stiles, W S}, booktitle = {Color Science: Concepts and Methods, Quantitative Data and Formulae}, isbn = {978-0471399186}, - pages = {145--146}, + pages = 309, publisher = {Wiley}, - title = {{CIE Method of Calculating D-Illuminants}}, + title = {{Table 2(5.4.1) MacAdam Ellipses (Observer PGN) + Observed and Calculated on the Basis of a Normal Distribution of + Color Matches about a Color Center (Silberstein and MacAdam, + 1945)}}, year = 2000, } -@incollection{Wyszecki2000y, +@incollection{Wyszecki2000bh, author = {Wyszecki, G{\"{u}}nther and Stiles, W. S.}, booktitle = {Color Science: Concepts and Methods, Quantitative Data and Formulae}, isbn = {978-0471399186}, - pages = {224--229}, + pages = {778--779}, publisher = {Wiley}, - title = {{DISTRIBUTION TEMPERATURE, COLOR TEMPERATURE, AND - CORRELATED COLOR TEMPERATURE}}, + title = {{Table II(3.7)}}, year = 2000, } -@incollection{Wyszecki2000ba, +@incollection{Wyszecki2000bd, author = {Wyszecki, G{\"{u}}nther and Stiles, W. S.}, booktitle = {Color Science: Concepts and Methods, Quantitative Data and Formulae}, isbn = {978-0471399186}, - pages = {837--839}, + pages = 167, publisher = {Wiley}, - title = {{Table I(6.5.3) Whiteness Formulae (Whiteness - Measure Denoted by W)}}, + title = {{CIE 1976 (L*u*v*)-Space and Color-Difference + Formula}}, year = 2000, } -@incollection{Wyszecki2000bh, +@incollection{Wyszecki2000be, author = {Wyszecki, G{\"{u}}nther and Stiles, W. S.}, booktitle = {Color Science: Concepts and Methods, Quantitative Data and Formulae}, isbn = {978-0471399186}, - pages = {778--779}, + pages = 141, publisher = {Wiley}, - title = {{Table II(3.7)}}, + title = {{The CIE 1964 Standard Observer}}, year = 2000, } -@incollection{Wyszecki2000bg, +@incollection{Wyszecki2000bb, author = {Wyszecki, G{\"{u}}nther and Stiles, W. S.}, booktitle = {Color Science: Concepts and Methods, Quantitative Data and Formulae}, isbn = {978-0471399186}, - pages = {138--139}, + pages = {776--777}, publisher = {Wiley}, - title = {{Table 1(3.3.3)}}, + title = {{Table I(3.7)}}, year = 2000, } -@incollection{Wyszecki2000bb, +@incollection{Wyszecki2000x, author = {Wyszecki, G{\"{u}}nther and Stiles, W. S.}, booktitle = {Color Science: Concepts and Methods, Quantitative Data and Formulae}, isbn = {978-0471399186}, - pages = {776--777}, + pages = 228, publisher = {Wiley}, - title = {{Table I(3.7)}}, + title = {{Table 1(3.11) Isotemperature Lines}}, year = 2000, } -@incollection{Wyszecki2000x, +@incollection{Wyszecki2000ba, author = {Wyszecki, G{\"{u}}nther and Stiles, W. S.}, booktitle = {Color Science: Concepts and Methods, Quantitative Data and Formulae}, isbn = {978-0471399186}, - pages = 228, + pages = {837--839}, publisher = {Wiley}, - title = {{Table 1(3.11) Isotemperature Lines}}, + title = {{Table I(6.5.3) Whiteness Formulae (Whiteness + Measure Denoted by W)}}, year = 2000, } @incollection{Wyszecki2000bf, @@ -3114,25 +3189,25 @@ @incollection{Wyszecki2000bf title = {{Integration Replaced by Summation}}, year = 2000, } -@incollection{Wyszecki2000bd, +@incollection{Wyszecki2000y, author = {Wyszecki, G{\"{u}}nther and Stiles, W. S.}, booktitle = {Color Science: Concepts and Methods, Quantitative Data and Formulae}, isbn = {978-0471399186}, - pages = 167, + pages = {224--229}, publisher = {Wiley}, - title = {{CIE 1976 (L*u*v*)-Space and Color-Difference - Formula}}, + title = {{DISTRIBUTION TEMPERATURE, COLOR TEMPERATURE, AND + CORRELATED COLOR TEMPERATURE}}, year = 2000, } -@incollection{Wyszecki2000be, +@incollection{Wyszecki2000z, author = {Wyszecki, G{\"{u}}nther and Stiles, W. S.}, booktitle = {Color Science: Concepts and Methods, Quantitative Data and Formulae}, isbn = {978-0471399186}, - pages = 141, + pages = {145--146}, publisher = {Wiley}, - title = {{The CIE 1964 Standard Observer}}, + title = {{CIE Method of Calculating D-Illuminants}}, year = 2000, } @incollection{Wyszecki2000s, @@ -3145,6 +3220,16 @@ @incollection{Wyszecki2000s title = {{Standard Photometric Observers}}, year = 2000, } +@incollection{Wyszecki2000bg, + author = {Wyszecki, G{\"{u}}nther and Stiles, W. S.}, + booktitle = {Color Science: Concepts and Methods, Quantitative + Data and Formulae}, + isbn = {978-0471399186}, + pages = {138--139}, + publisher = {Wiley}, + title = {{Table 1(3.3.3)}}, + year = 2000, +} @misc{X-Rite2015, author = {X-Rite}, title = {{New color specifications for ColorChecker SG and diff --git a/CHANGES.rst b/CHANGES.rst index 2847c275e9..5a173568c8 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -10,6 +10,6 @@ About ----- | **Colour** by Colour Developers - 2013-2019 -| Copyright © 2013-2019 – Colour Developers – `colour-science@googlegroups.com `_ +| Copyright © 2013-2019 – Colour Developers – `colour-science@googlegroups.com `__ | This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause -| `https://github.com/colour-science/colour `_ +| `https://github.com/colour-science/colour `__ diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000..20c11a6a50 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,51 @@ +# Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others’ private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting Thomas Mansencal and Michael Mauderer via email at thomas.mansencal@gmail.com and michael@mauderer.me respectively. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project’s leadership. + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at [https://www.contributor-covenant.org/version/1/4/code-of-conduct.html][homepage]. + +For answers to common questions about this code of conduct, see [https://www.contributor-covenant.org/faq][faq]. + + +[homepage]: https://www.contributor-covenant.org/version/1/4/code-of-conduct.html +[faq]: https://www.contributor-covenant.org/faq \ No newline at end of file diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 79c59d18b3..bde12f9466 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -10,6 +10,6 @@ About ----- | **Colour** by Colour Developers - 2013-2019 -| Copyright © 2013-2019 – Colour Developers – `colour-science@googlegroups.com `_ +| Copyright © 2013-2019 – Colour Developers – `colour-science@googlegroups.com `__ | This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause -| `https://github.com/colour-science/colour `_ +| `https://github.com/colour-science/colour `__ diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 5331227c46..1c7825c0c4 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -52,6 +52,38 @@ Development & Technical Support Technical support. +- **Troy James Sobotka**, *Motion Picture Technician* + + F-Gamut and Fuji F-Log support. + +- **Dominik Moritz**, *PhD in Computer Science @ University of Washington* + + Documentation improvements. + +- **Matt Pppp** + + *Hacktoberfest 2019* technical support. + +- **Chinmay Rane** + + *Hacktoberfest 2019* technical support. + +- **Pavithra Eswaramoorthy** + + *Hacktoberfest 2019* technical support. + +- **John Mertic** + + License discovery improvements. + +- **Ben Pearlstine** + + *Hacktoberfest 2019* technical support. + +- **Manuel Leonhardt**, *Software Engineer and Image Scientist @ ARRI* + + Documentation improvements. + Acknowledgements ---------------- - **Steve Agland**, *Supervising Lighting Technical Director @ Animal Logic* @@ -111,11 +143,13 @@ Issues & Discussions - Vishal Vashistha - Vlad Enache - @Ampersandme +- @Apoorva-13 - @awehring - @brandondube - @briend - @cclauss - @Chandler +- @chesschi - @codycuellar - @Edwardlin-zlt - @eyeforcolor @@ -134,19 +168,22 @@ Issues & Discussions - @lensz - @Myndex - @naavis +- @NoRoKr - @nschloe - @peteroupc - @Queuecumber - @Rob-Welch - @robbuckley - @Ron024 +- @senyai - @shanest -- @sobotka - @stakemura - @tashdor - @TFiFiE - @tingeman +- @thunders82 - @totyped +- @vidakDK - @Willingo - @zachlewis @@ -154,6 +191,6 @@ About ----- | **Colour** by Colour Developers - 2013-2019 -| Copyright © 2013-2019 – Colour Developers – `colour-science@googlegroups.com `_ +| Copyright © 2013-2019 – Colour Developers – `colour-science@googlegroups.com `__ | This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause -| `https://github.com/colour-science/colour `_ +| `https://github.com/colour-science/colour `__ diff --git a/LICENSE b/LICENSE index ede301d0f3..4adf23bbf7 100644 --- a/LICENSE +++ b/LICENSE @@ -22,16 +22,3 @@ 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. - -Copyright for portions of project Adobe DNG Software Development Kit (SDK) are -held by Adobe Systems, 2013 as part of project Adobe DNG SDK and are distributed -under the DNG SDK License Agreement. - -Copyright for portions of project The Munsell and Kubelka-Munk Toolbox are -held by Paul Centore, 2010-2018 as part of project The Munsell and Kubelka-Munk -Toolbox and are distributed under the New BSD License by explicit permission -of the author. - -Copyright for portions of project The ColorChecker (since 1976!) are -held by Danny Pascale, 2004-2012 as part of project The ColorChecker -(since 1976!) and are used by explicit permission of the author. diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100755 index e669c91364..0000000000 --- a/MANIFEST.in +++ /dev/null @@ -1,12 +0,0 @@ -include LICENSE -include *.bib -include *.rst -graft colour/appearance/tests/fixtures -graft colour/examples -graft colour/io -graft colour/plotting -global-exclude __pycache__ -global-exclude *.pyc -global-exclude *.pyo -global-exclude ._* -global-exclude .DS_Store diff --git a/README.rst b/README.rst index 01f648bb18..a5363c594f 100644 --- a/README.rst +++ b/README.rst @@ -1,20 +1,15 @@ - -`Colour Science for Python `_ -============================================================== +.. image:: https://raw.githubusercontent.com/colour-science/colour-branding/master/images/Colour_Logo_Medium_001.png .. start-badges -|gitter| |travis| |azure| |coveralls| |codacy| |version| |zenodo| +|NumFOCUS| |actions| |coveralls| |codacy| |version| |zenodo| -.. |gitter| image:: https://img.shields.io/gitter/room/colour-science/colour.svg?style=flat-square - :target: https://gitter.im/colour-science/colour/ - :alt: Gitter -.. |travis| image:: https://img.shields.io/travis/colour-science/colour/develop.svg?label=travis-ci+build&style=flat-square - :target: https://travis-ci.org/colour-science/colour +.. |NumFOCUS| image:: https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat-square&colorA=E1523D&colorB=007D8A + :target: http://numfocus.org + :alt: Powered by NumFOCUS +.. |actions| image:: https://github.com/colour-science/colour/workflows/Continuous%20Integration/badge.svg + :target: https://github.com/colour-science/colour/actions :alt: Develop Build Status -.. |azure| image:: https://img.shields.io/vso/build/colour-science/b0916647-91be-4025-951a-d791f64f3b96/1.svg?label=azure+build&style=flat-square - :target: https://dev.azure.com/colour-science/Colour/_build?definitionId=1 - :alt: Azure DevOps .. |coveralls| image:: http://img.shields.io/coveralls/colour-science/colour/develop.svg?style=flat-square :target: https://coveralls.io/r/colour-science/colour :alt: Coverage Status @@ -22,22 +17,23 @@ :target: https://www.codacy.com/app/colour-science/colour :alt: Code Grade .. |version| image:: https://img.shields.io/pypi/v/colour-science.svg?style=flat-square - :target: https://pypi.python.org/pypi/colour-science + :target: https://pypi.org/project/colour-science :alt: Package Version -.. |zenodo| image:: https://img.shields.io/badge/DOI-10.5281/zenodo.2647615-blue.svg?style=flat-square - :target: https://dx.doi.org/10.5281/zenodo.2647615 +.. |zenodo| image:: https://img.shields.io/badge/DOI-10.5281/zenodo.3519603-blue.svg?style=flat-square + :target: https://dx.doi.org/10.5281/zenodo.3519603 :alt: DOI .. end-badges -`Colour `_ is a -`Python `_ colour science package implementing a -comprehensive number of colour theory transformations and algorithms. +`Colour `__ is an open-source +`Python `__ package providing a comprehensive number of +algorithms and datasets for colour science. -It is open source and freely available under the -`New BSD License `_ terms. +It is freely available under the +`New BSD License `__ terms. -.. image:: https://raw.githubusercontent.com/colour-science/colour-branding/master/images/Colour_Logo_Medium_Tight_001.png +**Colour** is an affiliated project of `NumFOCUS `__, a +501(c)(3) nonprofit in the United States. .. contents:: **Table of Contents** :backlinks: none @@ -49,57 +45,67 @@ Draft Release Notes ------------------- The draft release notes of the -`develop `_ +`develop `__ branch are available at this -`url `_. +`url `__. Features -------- **Colour** features a rich dataset and collection of objects, please see the -`features `_ page for more +`features `__ page for more information. -Online ------- - -**Colour** can be used online with -`Google Colab `__. - Installation ------------ -`Anaconda `_ from *Continuum Analytics* -is the Python distribution we use to develop **Colour**: it ships all the -scientific dependencies we require and is easily deployed cross-platform: +**Colour** can be easily installed from the +`Python Package Index `__ +by issuing this command in a shell: .. code-block:: bash - $ conda create -y -n python-colour - $ source activate python-colour - $ conda install -y -c conda-forge colour-science + $ pip install colour-science -**Colour** can be easily installed from the -`Python Package Index `_ -by issuing this command in a shell: +**Colour** is also available for `Anaconda `__ +from *Continuum Analytics* via `conda-forge `__: .. code-block:: bash - $ pip install colour-science + $ conda install -c conda-forge colour-science The detailed installation procedure is described in the -`Installation Guide `_. +`Installation Guide `__. -Usage ------ +Documentation +------------- + +Tutorial +~~~~~~~~ -The two main references for **Colour** -usage are the `Colour Manual `_ -and the `Jupyter Notebooks `_ -with detailed historical and theoretical context and images: +The `static tutorial `__ +provides an introduction to **Colour**. An interactive version is available via +`Google Colab `__. + +How-To Guide +~~~~~~~~~~~~ + +The `How-To `__ +guide for **Colour** shows various techniques to solve specific problems and +highlights some interesting use cases. + +API Reference +~~~~~~~~~~~~~ -- `Colour Manual `_ -- `Jupyter Notebooks `_ +The main technical reference for **Colour** and its API is the +`Colour Manual `__. + +Jupyter Notebooks +~~~~~~~~~~~~~~~~~ + +`Jupyter Notebooks `__ +are available and designed to provide an historical perspective of colour +science via **Colour** usage. Examples ~~~~~~~~ @@ -110,6 +116,36 @@ Most of the objects are available from the ``colour`` namespace: >>> import colour +Automatic Colour Conversion Graph - ``colour.graph`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Starting with version *0.3.14*, **Colour** implements an automatic colour +conversion graph enabling easier colour conversions. + +.. image:: https://colour.readthedocs.io/en/develop/_images/Examples_Colour_Automatic_Conversion_Graph.png + +.. code-block:: python + + >>> sd = colour.COLOURCHECKERS_SDS['ColorChecker N Ohta']['dark skin'] + >>> convert(sd, 'Spectral Distribution', 'sRGB', verbose={'mode': 'Short'}) + +:: + + =============================================================================== + * * + * [ Conversion Path ] * + * * + * "sd_to_XYZ" --> "XYZ_to_sRGB" * + * * + =============================================================================== + array([ 0.45675795, 0.30986982, 0.24861924]) + +.. code-block:: python + + >>> illuminant = colour.ILLUMINANTS_SDS['FL2'] + >>> convert(sd, 'Spectral Distribution', 'sRGB', sd_to_XYZ={'illuminant': illuminant}) + array([ 0.47924575, 0.31676968, 0.17362725]) + Chromatic Adaptation - ``colour.adaptation`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -152,7 +188,7 @@ Colour Appearance Models - ``colour.appearance`` .. code-block:: python - >>> XYZ = [0.20654008 * 100, 0.12197225 * 100, 0.05136952* 100] + >>> XYZ = [0.20654008 * 100, 0.12197225 * 100, 0.05136952 * 100] >>> XYZ_w = [95.05, 100.00, 108.88] >>> L_A = 318.31 >>> Y_b = 20.0 @@ -200,7 +236,7 @@ Spectral Computations >>> colour.sd_to_XYZ(colour.LIGHT_SOURCES_SDS['Neodimium Incandescent']) array([ 36.94726204, 32.62076174, 13.0143849 ]) >>> sorted(colour.SPECTRAL_TO_XYZ_METHODS.keys()) - ['ASTM E308-15', 'Integration', 'astm2015'] + ['ASTM E308', 'Integration', 'astm2015'] Multi-Spectral Computations @@ -208,7 +244,7 @@ Multi-Spectral Computations .. code-block:: python - >>> msd = np.array([ + >>> msds = np.array([ ... [[0.01367208, 0.09127947, 0.01524376, 0.02810712, 0.19176012, 0.04299992], ... [0.00959792, 0.25822842, 0.41388571, 0.22275120, 0.00407416, 0.37439537], ... [0.01791409, 0.29707789, 0.56295109, 0.23752193, 0.00236515, 0.58190280]], @@ -222,8 +258,8 @@ Multi-Spectral Computations ... [0.06321812, 0.41898224, 0.15190357, 0.24591440, 0.55301750, 0.00657664], ... [0.00305180, 0.11288624, 0.11357290, 0.12924391, 0.00195315, 0.21771573]], ... ]) - >>> colour.multi_sds_to_XYZ(msd, colour.SpectralShape(400, 700, 60), - ... cmfs, illuminant)) + >>> colour.multi_sds_to_XYZ(msds, cmfs, illuminant, method='Integration', + ... shape=colour.SpectralShape(400, 700, 60))) [[[ 9.73192501 5.02105851 3.22790699] [ 16.08032168 24.47303359 10.28681006] [ 17.73513774 29.61865582 12.10713449]] @@ -237,7 +273,7 @@ Multi-Spectral Computations [ 38.64801062 26.70860262 15.08396538] [ 8.77151115 10.56330761 4.28940206]]] >>> sorted(colour.MULTI_SPECTRAL_TO_XYZ_METHODS.keys()) - ['Integration'] + ['ASTM E308', 'Integration', 'astm2015'] Blackbody Spectral Radiance Computation *************************************** @@ -292,7 +328,7 @@ Luminance Computation >>> colour.luminance(41.52787585) 12.197225353400775 >>> sorted(colour.LUMINANCE_METHODS.keys()) - ['ASTM D1535-08', + ['ASTM D1535', 'CIE 1976', 'Fairchild 2010', 'Fairchild 2011', @@ -399,6 +435,9 @@ Look Up Table (LUT) Data >>> LUT = colour.read_LUT('ACES_Proxy_10_to_ACES.cube') >>> print(LUT) + +:: + LUT3x1D - ACES Proxy 10 to ACES ------------------------------- Dimensions : 2 @@ -406,6 +445,8 @@ Look Up Table (LUT) Data [1 1 1]] Size : (32, 3) +.. code-block:: python + >>> RGB = [0.17224810, 0.09170660, 0.06416938] >>> LUT.apply(RGB) array([ 0.00575674, 0.00181493, 0.00121419]) @@ -657,13 +698,15 @@ RGB Colourspaces 'ECI RGB v2', 'ERIMM RGB', 'Ekta Space PS 5', + 'F-Gamut', 'FilmLight E-Gamut', 'ITU-R BT.2020', 'ITU-R BT.470 - 525', 'ITU-R BT.470 - 625', 'ITU-R BT.709', 'Max RGB', - 'NTSC', + 'NTSC (1953)', + 'NTSC (1987)', 'P3-D65', 'Pal/Secam', 'ProPhoto RGB', @@ -680,6 +723,7 @@ RGB Colourspaces 'S-Gamut3', 'S-Gamut3.Cine', 'SMPTE 240M', + 'SMPTE C', 'Sharp RGB', 'V-Gamut', 'Xtreme RGB', @@ -695,31 +739,24 @@ OETFs >>> sorted(colour.OETFS.keys()) ['ARIB STD-B67', - 'DICOM GSDF', 'ITU-R BT.2020', 'ITU-R BT.2100 HLG', 'ITU-R BT.2100 PQ', 'ITU-R BT.601', 'ITU-R BT.709', - 'ProPhoto RGB', - 'RIMM RGB', - 'ROMM RGB', - 'SMPTE 240M', - 'ST 2084', - 'sRGB'] + 'SMPTE 240M'] -OETFs Reverse +OETFs Inverse ************* .. code-block:: python - >>> sorted(colour.OETFS_REVERSE.keys()) + >>> sorted(colour.OETF_INVERSES.keys()) ['ARIB STD-B67', 'ITU-R BT.2100 HLD', 'ITU-R BT.2100 PQ', 'ITU-R BT.601', - 'ITU-R BT.709', - 'sRGB'] + 'ITU-R BT.709'] EOTFs ***** @@ -733,19 +770,23 @@ EOTFs 'ITU-R BT.2020', 'ITU-R BT.2100 HLG', 'ITU-R BT.2100 PQ', - 'ProPhoto RGB', - 'RIMM RGB', - 'ROMM RGB', 'SMPTE 240M', - 'ST 2084'] + 'ST 2084', + 'sRGB'] -EOTFs Reverse +EOTFs Inverse ************* .. code-block:: python - >>> sorted(colour.EOTFS_REVERSE.keys()) - ['DCDM', 'ITU-R BT.1886', 'ITU-R BT.2100 HLG', 'ITU-R BT.2100 PQ'] + >>> sorted(colour.EOTF_INVERSES.keys()) + ['DCDM', + 'DICOM GSDF', + 'ITU-R BT.1886', + 'ITU-R BT.2100 HLG', + 'ITU-R BT.2100 PQ', + 'ST 2084', + 'sRGB'] OOTFs ***** @@ -755,20 +796,20 @@ OOTFs >>> sorted(colour.OOTFS.keys()) ['ITU-R BT.2100 HLG', 'ITU-R BT.2100 PQ'] -OOTFs Reverse +OOTFs Inverse ************* .. code-block:: python - >>> sorted(colour.OOTFs_REVERSE.keys()) + >>> sorted(colour.OOTF_INVERSES.keys()) ['ITU-R BT.2100 HLG', 'ITU-R BT.2100 PQ'] -Log Encoding / Decoding Curves -****************************** +Log Encoding / Decoding +*********************** .. code-block:: python - >>> sorted(colour.LOG_ENCODING_CURVES.keys()) + >>> sorted(colour.LOG_ENCODINGS.keys()) ['ACEScc', 'ACEScct', 'ACESproxy', @@ -779,6 +820,7 @@ Log Encoding / Decoding Curves 'Cineon', 'D-Log', 'ERIMM RGB', + 'F-Log', 'Filmic Pro 6', 'Log3G10', 'Log3G12', @@ -794,6 +836,56 @@ Log Encoding / Decoding Curves 'V-Log', 'ViperLog'] +CCTFs Encoding / Decoding +************************* + +.. code-block:: python + + >>> sorted(colour.CCTF_ENCODINGS.keys()) + ['ACEScc', + 'ACEScct', + 'ACESproxy', + 'ALEXA Log C', + 'ARIB STD-B67', + 'Canon Log', + 'Canon Log 2', + 'Canon Log 3', + 'Cineon', + 'D-Log', + 'DCDM', + 'DICOM GSDF', + 'ERIMM RGB', + 'F-Log', + 'Filmic Pro 6', + 'Gamma 2.2', + 'Gamma 2.4', + 'Gamma 2.6', + 'ITU-R BT.1886', + 'ITU-R BT.2020', + 'ITU-R BT.2100 HLG', + 'ITU-R BT.2100 PQ', + 'ITU-R BT.601', + 'ITU-R BT.709', + 'Log3G10', + 'Log3G12', + 'PLog', + 'Panalog', + 'ProPhoto RGB', + 'Protune', + 'REDLog', + 'REDLogFilm', + 'RIMM RGB', + 'ROMM RGB', + 'S-Log', + 'S-Log2', + 'S-Log3', + 'SMPTE 240M', + 'ST 2084', + 'T-Log', + 'V-Log', + 'ViperLog', + 'sRGB'] + Colour Notation Systems - ``colour.notation`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -805,7 +897,7 @@ Munsell Value >>> colour.munsell_value(12.23634268) 4.0824437076525664 >>> sorted(colour.MUNSELL_VALUE_METHODS.keys()) - ['ASTM D1535-08', + ['ASTM D1535', 'Ladd 1955', 'McCamy 1987', 'Moon 1943', @@ -892,17 +984,9 @@ Correlated Colour Temperature Computation Methods - ``colour.temperature`` >>> colour.uv_to_CCT([0.1978, 0.3122]) array([ 6.50751282e+03, 3.22335875e-03]) >>> sorted(colour.UV_TO_CCT_METHODS.keys()) - ['Ohno 2013', 'Robertson 1968', 'ohno2013', 'robertson1968'] - >>> sorted(colour.UV_TO_CCT_METHODS.keys()) - ['Krystek 1985', - 'Ohno 2013', - 'Robertson 1968', - 'ohno2013', - 'robertson1968'] - >>> sorted(colour.XY_TO_CCT_METHODS.keys()) - ['Hernandez 1999', 'McCamy 1992', 'hernandez1999', 'mccamy1992'] - >>> sorted(colour.CCT_TO_XY_METHODS.keys()) - ['CIE Illuminant D Series', 'Kang 2002', 'cie_d', 'kang2002'] + ['Krystek 1985', 'Ohno 2013', 'Robertson 1968', 'ohno2013', 'robertson1968'] + >>> sorted(colour.XY_TO_CCT_METHODS.keys()) + ['CIE Illuminant D Series', 'Hernandez 1999', 'Kang 2002', 'McCamy 1992', 'daylight', 'hernandez1999', 'kang2002', 'mccamy1992'] Colour Volume - ``colour.volume`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -929,7 +1013,7 @@ Visible Spectrum >>> plot_visible_spectrum('CIE 1931 2 Degree Standard Observer') -.. image:: docs/_static/Examples_Plotting_Visible_Spectrum.png +.. image:: https://colour.readthedocs.io/en/develop/_images/Examples_Plotting_Visible_Spectrum.png Spectral Distribution ********************* @@ -938,7 +1022,7 @@ Spectral Distribution >>> plot_single_illuminant_sd('FL1') -.. image:: docs/_static/Examples_Plotting_Illuminant_F1_SD.png +.. image:: https://colour.readthedocs.io/en/develop/_images/Examples_Plotting_Illuminant_F1_SD.png Blackbody ********* @@ -957,7 +1041,7 @@ Blackbody ... legend_location='upper right', ... bounding_box=(0, 1250, 0, 2.5e15)) -.. image:: docs/_static/Examples_Plotting_Blackbodies.png +.. image:: https://colour.readthedocs.io/en/develop/_images/Examples_Plotting_Blackbodies.png Colour Matching Functions ************************* @@ -969,7 +1053,7 @@ Colour Matching Functions ... y_label='Sensitivity', ... bounding_box=(390, 870, 0, 1.1)) -.. image:: docs/_static/Examples_Plotting_Cone_Fundamentals.png +.. image:: https://colour.readthedocs.io/en/develop/_images/Examples_Plotting_Cone_Fundamentals.png Luminous Efficiency ******************* @@ -987,7 +1071,7 @@ Luminous Efficiency ... y_tighten=True, ... margins=(0, 0, 0, .1)) -.. image:: docs/_static/Examples_Plotting_Luminous_Efficiency.png +.. image:: https://colour.readthedocs.io/en/develop/_images/Examples_Plotting_Luminous_Efficiency.png Colour Checker ************** @@ -1006,13 +1090,13 @@ Colour Checker ... title=('BabelColor Average - ' ... 'Spectral Distributions')) -.. image:: docs/_static/Examples_Plotting_BabelColor_Average.png +.. image:: https://colour.readthedocs.io/en/develop/_images/Examples_Plotting_BabelColor_Average.png .. code-block:: python >>> plot_single_colour_checker('ColorChecker 2005', text_parameters={'visible': False}) -.. image:: docs/_static/Examples_Plotting_ColorChecker_2005.png +.. image:: https://colour.readthedocs.io/en/develop/_images/Examples_Plotting_ColorChecker_2005.png Chromaticities Prediction ************************* @@ -1021,7 +1105,7 @@ Chromaticities Prediction >>> plot_corresponding_chromaticities_prediction(2, 'Von Kries', 'Bianco') -.. image:: docs/_static/Examples_Plotting_Chromaticities_Prediction.png +.. image:: https://colour.readthedocs.io/en/develop/_images/Examples_Plotting_Chromaticities_Prediction.png Colour Temperature ****************** @@ -1030,7 +1114,7 @@ Colour Temperature >>> plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS(['A', 'B', 'C']) -.. image:: docs/_static/Examples_Plotting_CCT_CIE_1960_UCS_Chromaticity_Diagram.png +.. image:: https://colour.readthedocs.io/en/develop/_images/Examples_Plotting_CCT_CIE_1960_UCS_Chromaticity_Diagram.png Chromaticities @@ -1043,7 +1127,7 @@ Chromaticities >>> plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931( ... RGB, 'ITU-R BT.709', colourspaces=['ACEScg', 'S-Gamut', 'Pointer Gamut']) -.. image:: docs/_static/Examples_Plotting_Chromaticities_CIE_1931_Chromaticity_Diagram.png +.. image:: https://colour.readthedocs.io/en/develop/_images/Examples_Plotting_Chromaticities_CIE_1931_Chromaticity_Diagram.png Colour Rendering Index ********************** @@ -1053,26 +1137,26 @@ Colour Rendering Index >>> plot_single_sd_colour_rendering_index_bars( ... colour.ILLUMINANTS_SDS['FL2']) -.. image:: docs/_static/Examples_Plotting_CRI.png +.. image:: https://colour.readthedocs.io/en/develop/_images/Examples_Plotting_CRI.png Contributing ------------ If you would like to contribute to **Colour**, please refer to the following -`Contributing `_ guide. +`Contributing `__ guide. Changes ------- -The changes are viewable on the `Releases `_ page. +The changes are viewable on the `Releases `__ page. Bibliography ------------ -The bibliography is available on the `Bibliography `_ page. +The bibliography is available on the `Bibliography `__ page. It is also viewable directly from the repository in -`BibTeX `_ +`BibTeX `__ format. See Also @@ -1082,29 +1166,39 @@ Here is a list of notable colour science packages sorted by languages: **Python** -- `Colorio `_ by Schlömer, N. -- `ColorPy `_ by Kness, M. -- `Colorspacious `_ by Smith, N. J., et al. -- `python-colormath `_ by Taylor, G., et al. +- `Colorio `__ by Schlömer, N. +- `ColorPy `__ by Kness, M. +- `Colorspacious `__ by Smith, N. J., et al. +- `python-colormath `__ by Taylor, G., et al. + +**Go** + +- `go-colorful `__ by Beyer, L., et al. **.NET** -- `Colourful `_ by Pažourek, T., et al. +- `Colourful `__ by Pažourek, T., et al. **Julia** -- `Colors.jl `_ by Holy, T., et al. +- `Colors.jl `__ by Holy, T., et al. **Matlab & Octave** -- `COLORLAB `_ by Malo, J., et al. -- `Psychtoolbox `_ by Brainard, D., et al. -- `The Munsell and Kubelka-Munk Toolbox `_ by Centore, P. +- `COLORLAB `__ by Malo, J., et al. +- `Psychtoolbox `__ by Brainard, D., et al. +- `The Munsell and Kubelka-Munk Toolbox `__ by Centore, P. + +Code of Conduct +--------------- + +The *Code of Conduct*, adapted from the `Contributor Covenant 1.4 `__, +is available on the `Code of Conduct `__ page. About ----- | **Colour** by Colour Developers - 2013-2019 -| Copyright © 2013-2019 – Colour Developers – `colour-science@googlegroups.com `_ +| Copyright © 2013-2019 – Colour Developers – `colour-science@googlegroups.com `__ | This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause -| `https://github.com/colour-science/colour `_ +| `https://github.com/colour-science/colour `__ diff --git a/THIRD_PARTY b/THIRD_PARTY new file mode 100644 index 0000000000..875f1466d0 --- /dev/null +++ b/THIRD_PARTY @@ -0,0 +1,12 @@ +Copyright for portions of project Adobe DNG Software Development Kit (SDK) are +held by Adobe Systems, 2013 as part of project Adobe DNG SDK and are distributed +under the DNG SDK License Agreement. + +Copyright for portions of project The Munsell and Kubelka-Munk Toolbox are +held by Paul Centore, 2010-2018 as part of project The Munsell and Kubelka-Munk +Toolbox and are distributed under the New BSD License by explicit permission +of the author. + +Copyright for portions of project The ColorChecker (since 1976!) are +held by Danny Pascale, 2004-2012 as part of project The ColorChecker +(since 1976!) and are used by explicit permission of the author. diff --git a/TODO.rst b/TODO.rst index 07119ef56c..5b8da45724 100644 --- a/TODO.rst +++ b/TODO.rst @@ -6,7 +6,7 @@ TODO - colour/__init__.py - - Line 296 : # TODO: Remove legacy printing support when deemed appropriate. + - Line 306 : # TODO: Remove legacy printing support when deemed appropriate. - colour/colorimetry/spectrum.py @@ -16,23 +16,23 @@ TODO - colour/colorimetry/tristimulus.py - - Line 765 : # TODO: Investigate code vectorisation. + - Line 769 : # TODO: Investigate code vectorisation. - colour/colorimetry/tests/test_spectrum.py - - Line 1440 : # TODO: Remove statement whenever we make "Scipy" 0.19.0 the minimum version. Skipping tests because of "Scipy" 0.19.0 interpolation code changes. - - Line 1640 : # TODO: Remove statement whenever we make "Scipy" 0.19.0 the minimum version. Skipping tests because of "Scipy" 0.19.0 interpolation code changes. + - Line 1457 : # TODO: Remove statement whenever we make "Scipy" 0.19.0 the minimum version. Skipping tests because of "Scipy" 0.19.0 interpolation code changes. + - Line 1666 : # TODO: Remove statement whenever we make "Scipy" 0.19.0 the minimum version. Skipping tests because of "Scipy" 0.19.0 interpolation code changes. - colour/appearance/ciecam02.py - - Line 288 : # TODO: Compute hue composition. + - Line 298 : # TODO: Compute hue composition. - colour/appearance/cam16.py - - Line 282 : # TODO: Compute hue composition. + - Line 292 : # TODO: Compute hue composition. - colour/appearance/hunt.py @@ -62,9 +62,20 @@ TODO - Line 37 : # TODO: The current fixture data is generated from direct computations using our model implementation. We have asked ground truth data to Li et al. (2016) and will update the "cam16.csv" file accordingly whenever we receive it. +- colour/io/tests/test_image.py + + - Line 210 : # TODO: Investigate "OIIO" behaviour here: 1.0 != 15360.0 image = read_image_OpenImageIO( os.path.join(RESOURCES_DIRECTORY, 'Colour_Logo.png'), 'float16') self.assertIs(image.dtype, np.dtype('float16')) self.assertEqual(np.min(image), 0.0) self.assertEqual(np.max(image), 1.0) + + - colour/io/luts/lut.py - Line 126 : # TODO: Re-enable when dropping Python 2.7. pylint: disable=E1121 + - Line 2009 : # TODO: Implement support for non-uniform domain, e.g. "cinespace" LUTs. + + +- colour/graph/conversion.py + + - Line 927 : # TODO: Remove the following warning whenever the automatic colour conversion graph implementation is considered stable. - colour/models/rgb/derivation.py @@ -74,8 +85,8 @@ TODO - colour/models/rgb/rgb_colourspace.py - - Line 540 : # TODO: Revisit for potential behaviour / type checking. - - Line 573 : # TODO: Revisit for potential behaviour / type checking. + - Line 541 : # TODO: Revisit for potential behaviour / type checking. + - Line 574 : # TODO: Revisit for potential behaviour / type checking. - colour/models/rgb/tests/test_derivation.py @@ -83,9 +94,40 @@ TODO - Line 279 : # TODO: Simplify that monster. +- colour/models/rgb/transfer_functions/tests/test__init__.py + + - Line 38 : # TODO: Use "assertWarns" when dropping Python 2.7. + - Line 55 : # TODO: Use "assertWarns" when dropping Python 2.7. + + +- colour/utilities/verbose.py + + - Line 572 : # TODO: Implement support for "pyproject.toml" file whenever "TOML" is supported in the standard library. + + +- colour/utilities/common.py + + - Line 569 : # TODO: Remove when dropping Python 2.7. + + - colour/utilities/array.py - - Line 183 : # TODO: Change to "DEFAULT_INT_DTYPE" when and if https://github.com/numpy/numpy/issues/11956 is addressed. + - Line 186 : # TODO: Change to "DEFAULT_INT_DTYPE" when and if https://github.com/numpy/numpy/issues/11956 is addressed. + + +- colour/utilities/tests/test_deprecation.py + + - Line 317 : # TODO: Use "assertWarns" when dropping Python 2.7. + + +- colour/plotting/models.py + + - Line 1569 : # TODO: Filter appropriate colour models. + + +- colour/plotting/common.py + + - Line 821 : # TODO: Consider using "MutableMapping" here. - colour/characterisation/correction.py @@ -95,30 +137,43 @@ TODO - colour/notation/munsell.py - - Line 1062 : # TODO: Consider refactoring implementation. + - Line 1067 : # TODO: Consider refactoring implementation. - colour/continuous/signal.py - - Line 380 : # TODO: Check for interpolator capabilities. - - Line 445 : # TODO: Check for extrapolator capabilities. - - Line 586 : # TODO: Discuss what is the most suitable behaviour, either the following or __str__ one. + - Line 384 : # TODO: Check for interpolator capabilities. + - Line 449 : # TODO: Check for extrapolator capabilities. + +- colour/continuous/multi_signals.py -- colour/continuous/multi_signal.py + - Line 1322 : # TODO: Implement support for Signal class passing. - - Line 698 : # TODO: Discuss what is the most suitable behaviour, either the following or __str__ one. - - Line 1319 : # TODO: Implement support for Signal class passing. + +- colour/continuous/tests/test_multi_signal.py + + - Line 112 : # TODO: Use "assertWarns" when dropping Python 2.7. + + +- colour/continuous/tests/test_signal.py + + - Line 101 : # TODO: Use "assertWarns" when dropping Python 2.7. - colour/volume/rgb.py - - Line 305 : # TODO: Investigate for generator yielding directly a ndarray. + - Line 306 : # TODO: Investigate for generator yielding directly a ndarray. - colour/algebra/tests/test_interpolation.py - - Line 437 : # TODO: Revisit if the interpolator can be applied on non-uniform "x" independent variable. + - Line 532 : # TODO: Revisit if the interpolator can be applied on non-uniform "x" independent variable. + + +- colour/algebra/tests/test_random.py + + - Line 61 : # TODO: Use "assertWarns" when dropping Python 2.7. About ----- diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 44dec14024..0000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,75 +0,0 @@ -# Python package -# Create and test a Python package on multiple Python versions. -# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more: -# https://docs.microsoft.com/vsts/pipelines/languages/python - -jobs: -- job: 'Test_Windows' - strategy: - matrix: - Python27: - python.version: '2.7' - Python36: - python.version: '3.6' - Python37: - python.version: '3.7' - maxParallel: 3 - pool: - vmImage: 'vs2017-win2016' - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '$(python.version)' - architecture: 'x64' - - script: | - python -m pip install --upgrade pip - pip install matplotlib numpy scipy - pip install pyqt - pip install nose six coveralls flake8 mock==1.0.1 - displayName: 'Install dependencies' - - script: flake8 colour - displayName: 'flake8' - - script: nosetests --nocapture --with-doctest --doctest-options=+ELLIPSIS --with-coverage --cover-package=colour --with-xunit colour - displayName: 'nosetest' - - task: PublishTestResults@2 - inputs: - testResultsFiles: '**/nosetests.xml' - testRunTitle: 'Python $(python.version)' - condition: succeededOrFailed() -- job: 'Test_macOS' - strategy: - matrix: - Python27: - python.version: '2.7' - Python36: - python.version: '3.6' - Python37: - python.version: '3.7' - maxParallel: 3 - pool: - vmImage: 'xcode9-macos10.13' - steps: - - script: | - sudo chmod -R 777 /usr/local/miniconda/envs - displayName: 'Fix for conda error on macOS' - - task: CondaEnvironment@1 - inputs: - createCustomEnvironment: true - environmentName: 'colour_env' - packageSpecs: 'python=$(python.version)' - installOptions: -y - - script: | - conda activate colour_env - conda install -y matplotlib numpy scipy - conda install -y pyqt - conda install -y nose six coveralls flake8 mock==1.0.1 - displayName: 'Install dependencies' - - script: flake8 colour - displayName: 'flake8' - - script: nosetests --nocapture --with-doctest --doctest-options=+ELLIPSIS --with-coverage --cover-package=colour --with-xunit colour - displayName: 'nosetest' - - task: PublishTestResults@2 - inputs: - testResultsFiles: '**/nosetests.xml' - testRunTitle: 'Python $(python.version)' - condition: succeededOrFailed() diff --git a/colour/__init__.py b/colour/__init__.py index 3e47fd43a6..6be2e7a551 100644 --- a/colour/__init__.py +++ b/colour/__init__.py @@ -3,8 +3,12 @@ Colour ====== -*Colour* is a *Python* colour science package implementing a comprehensive -number of colour theory transformations and algorithms. +`Colour `_ is an open-source +`Python `_ package providing a comprehensive number of +algorithms and datasets for colour science. + +It is freely available under the +`New BSD License `_ terms. Sub-packages ------------ @@ -21,6 +25,7 @@ - corresponding: Corresponding colour chromaticities computations. - difference: Colour difference computations. - examples: Examples for the sub-packages. +- graph: Graph for automatic colour conversions. - io: Input / output objects for reading and writing data. - models: Colour models. - notation: Colour notation systems. @@ -39,8 +44,7 @@ import numpy as np import sys -from .utilities.deprecation import (FutureAccessChange, FutureAccessRemove, - ModuleAPI, Removed, Renamed) +from .utilities.deprecation import ModuleAPI, build_API_changes from .utilities.documentation import is_documentation_building from .utilities.common import (domain_range_scale, get_domain_range_scale, set_domain_range_scale) @@ -56,11 +60,11 @@ kernel_nearest_neighbour, kernel_sinc, table_interpolation, lagrange_coefficients) from .colorimetry import ( - ASTME30815_PRACTISE_SHAPE, BANDPASS_CORRECTION_METHODS, CMFS, + ASTME308_PRACTISE_SHAPE, BANDPASS_CORRECTION_METHODS, CMFS, DEFAULT_SPECTRAL_SHAPE, HUNTERLAB_ILLUMINANTS, ILLUMINANTS, ILLUMINANTS_SDS, LEFS, LIGHTNESS_METHODS, LIGHT_SOURCES, LIGHT_SOURCES_SDS, LMS_CMFS, LUMINANCE_METHODS, MULTI_SD_TO_XYZ_METHODS, - MultiSpectralDistribution, PHOTOPIC_LEFS, RGB_CMFS, SCOTOPIC_LEFS, + MultiSpectralDistributions, PHOTOPIC_LEFS, RGB_CMFS, SCOTOPIC_LEFS, SD_GAUSSIAN_METHODS, SD_MULTI_LEDS_METHODS, SD_SINGLE_LED_METHODS, SD_TO_XYZ_METHODS, STANDARD_OBSERVERS_CMFS, SpectralDistribution, SpectralShape, WHITENESS_METHODS, YELLOWNESS_METHODS, bandpass_correction, @@ -88,24 +92,24 @@ DISPLAYS_RGB_PRIMARIES, POLYNOMIAL_EXPANSION_METHODS, polynomial_expansion, COLOUR_CORRECTION_MATRIX_METHODS, colour_correction_matrix, COLOUR_CORRECTION_METHODS, colour_correction) -from .io import (LUT1D, LUT3x1D, LUT3D, LUTSequence, - SpectralDistribution_IESTM2714, read_image, read_LUT, - read_sds_from_csv_file, read_sds_from_xrite_file, - read_spectral_data_from_csv_file, write_image, write_LUT, - write_sds_to_csv_file) +from .io import (LUT1D, LUT3x1D, LUT3D, LUTSequence, READ_IMAGE_METHODS, + SpectralDistribution_IESTM2714, WRITE_IMAGE_METHODS, + read_image, read_LUT, read_sds_from_csv_file, + read_sds_from_xrite_file, read_spectral_data_from_csv_file, + write_image, write_LUT, write_sds_to_csv_file) from .models import ( CAM02LCD_to_JMh_CIECAM02, CAM02SCD_to_JMh_CIECAM02, CAM02UCS_to_JMh_CIECAM02, CAM16LCD_to_JMh_CAM16, CAM16SCD_to_JMh_CAM16, - CAM16UCS_to_JMh_CAM16, CMYK_to_CMY, CMY_to_CMYK, CMY_to_RGB, CV_range, - DECODING_CCTFS, DIN99_to_Lab, ENCODING_CCTFS, EOTFS, EOTFS_REVERSE, + CAM16UCS_to_JMh_CAM16, CCTF_DECODINGS, CCTF_ENCODINGS, CMYK_to_CMY, + CMY_to_CMYK, CMY_to_RGB, CV_range, DIN99_to_Lab, EOTFS, EOTF_INVERSES, HDR_CIELAB_METHODS, HDR_IPT_METHODS, HSL_to_RGB, HSV_to_RGB, Hunter_Lab_to_XYZ, Hunter_Rdab_to_XYZ, ICTCP_to_RGB, IPT_hue_angle, IPT_to_XYZ, JMh_CAM16_to_CAM16LCD, JMh_CAM16_to_CAM16SCD, JMh_CAM16_to_CAM16UCS, JMh_CIECAM02_to_CAM02LCD, JMh_CIECAM02_to_CAM02SCD, JMh_CIECAM02_to_CAM02UCS, JzAzBz_to_XYZ, LCHab_to_Lab, LCHuv_to_Luv, - LOG_DECODING_CURVES, LOG_ENCODING_CURVES, Lab_to_DIN99, Lab_to_LCHab, - Lab_to_XYZ, Luv_to_LCHuv, Luv_to_XYZ, Luv_to_uv, Luv_uv_to_xy, - MACADAM_1942_ELLIPSES_DATA, OETFS, OETFS_REVERSE, OOTFS, OOTFS_REVERSE, + LOG_DECODINGS, LOG_ENCODINGS, Lab_to_DIN99, Lab_to_LCHab, Lab_to_XYZ, + Luv_to_LCHuv, Luv_to_XYZ, Luv_to_uv, Luv_uv_to_xy, + MACADAM_1942_ELLIPSES_DATA, OETFS, OETF_INVERSES, OOTFS, OOTF_INVERSES, OSA_UCS_to_XYZ, POINTER_GAMUT_BOUNDARIES, POINTER_GAMUT_DATA, POINTER_GAMUT_ILLUMINANT, Prismatic_to_RGB, RGB_COLOURSPACES, RGB_Colourspace, RGB_luminance, RGB_luminance_equation, RGB_to_CMY, @@ -115,18 +119,19 @@ XYZ_to_Hunter_Rdab, XYZ_to_IPT, XYZ_to_JzAzBz, XYZ_to_K_ab_HunterLab1966, XYZ_to_Lab, XYZ_to_Luv, XYZ_to_OSA_UCS, XYZ_to_RGB, XYZ_to_UCS, XYZ_to_UVW, XYZ_to_hdr_CIELab, XYZ_to_hdr_IPT, XYZ_to_sRGB, XYZ_to_xy, XYZ_to_xyY, - YCBCR_WEIGHTS, YCbCr_to_RGB, YcCbcCrc_to_RGB, YCoCg_to_RGB, - chromatically_adapted_primaries, decoding_cctf, encoding_cctf, eotf, - eotf_reverse, full_to_legal, gamma_function, hdr_CIELab_to_XYZ, - hdr_IPT_to_XYZ, legal_to_full, linear_function, log_decoding_curve, - log_encoding_curve, normalised_primary_matrix, oetf, oetf_reverse, ootf, - ootf_reverse, primaries_whitepoint, sd_to_aces_relative_exposure_values, - sRGB_to_XYZ, uv_to_Luv, uv_to_UCS, xyY_to_XYZ, xyY_to_xy, xy_to_Luv_uv, - xy_to_UCS_uv, xy_to_XYZ, xy_to_xyY) -from .corresponding import (BRENEMAN_EXPERIMENTS, - BRENEMAN_EXPERIMENTS_PRIMARIES_CHROMATICITIES, - CORRESPONDING_CHROMATICITIES_PREDICTION_MODELS, - corresponding_chromaticities_prediction) + YCBCR_WEIGHTS, YCbCr_to_RGB, YcCbcCrc_to_RGB, YCoCg_to_RGB, cctf_decoding, + cctf_encoding, chromatically_adapted_primaries, eotf, eotf_inverse, + full_to_legal, gamma_function, hdr_CIELab_to_XYZ, hdr_IPT_to_XYZ, + legal_to_full, linear_function, log_decoding, log_encoding, + normalised_primary_matrix, oetf, oetf_inverse, ootf, ootf_inverse, + primaries_whitepoint, sd_to_aces_relative_exposure_values, sRGB_to_XYZ, + uv_to_Luv, uv_to_UCS, xyY_to_XYZ, xyY_to_xy, xy_to_Luv_uv, xy_to_UCS_uv, + xy_to_XYZ, xy_to_xyY) +from .corresponding import ( + BRENEMAN_EXPERIMENTS, BRENEMAN_EXPERIMENTS_PRIMARIES_CHROMATICITIES, + CORRESPONDING_CHROMATICITIES_PREDICTION_MODELS, CorrespondingColourDataset, + CorrespondingChromaticitiesPrediction, + corresponding_chromaticities_prediction) from .contrast import (CONTRAST_SENSITIVITY_METHODS, contrast_sensitivity_function) from .phenomena import (rayleigh_scattering, scattering_cross_section, @@ -147,6 +152,7 @@ RGB_colourspace_volume_MonteCarlo, RGB_colourspace_volume_coverage_MonteCarlo, is_within_macadam_limits, is_within_mesh_volume, is_within_pointer_gamut, is_within_visible_spectrum) +from .graph import describe_conversion_path, convert __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -171,11 +177,11 @@ 'lagrange_coefficients' ] __all__ += [ - 'ASTME30815_PRACTISE_SHAPE', 'BANDPASS_CORRECTION_METHODS', 'CMFS', + 'ASTME308_PRACTISE_SHAPE', 'BANDPASS_CORRECTION_METHODS', 'CMFS', 'DEFAULT_SPECTRAL_SHAPE', 'HUNTERLAB_ILLUMINANTS', 'ILLUMINANTS', 'ILLUMINANTS_SDS', 'LEFS', 'LIGHTNESS_METHODS', 'LIGHT_SOURCES', 'LIGHT_SOURCES_SDS', 'LMS_CMFS', 'LUMINANCE_METHODS', - 'MULTI_SD_TO_XYZ_METHODS', 'MultiSpectralDistribution', 'PHOTOPIC_LEFS', + 'MULTI_SD_TO_XYZ_METHODS', 'MultiSpectralDistributions', 'PHOTOPIC_LEFS', 'RGB_CMFS', 'SCOTOPIC_LEFS', 'SD_GAUSSIAN_METHODS', 'SD_MULTI_LEDS_METHODS', 'SD_SINGLE_LED_METHODS', 'SD_TO_XYZ_METHODS', 'STANDARD_OBSERVERS_CMFS', 'SpectralDistribution', 'SpectralShape', @@ -212,27 +218,27 @@ 'COLOUR_CORRECTION_METHODS', 'colour_correction' ] __all__ += [ - 'LUT1D', 'LUT3x1D', 'LUT3D', 'LUTSequence', - 'SpectralDistribution_IESTM2714', 'read_image', 'read_LUT', - 'read_sds_from_csv_file', 'read_sds_from_xrite_file', + 'LUT1D', 'LUT3x1D', 'LUT3D', 'LUTSequence', 'READ_IMAGE_METHODS', + 'SpectralDistribution_IESTM2714', 'WRITE_IMAGE_METHODS', 'read_image', + 'read_LUT', 'read_sds_from_csv_file', 'read_sds_from_xrite_file', 'read_spectral_data_from_csv_file', 'write_image', 'write_LUT', 'write_sds_to_csv_file' ] __all__ += [ 'CAM02LCD_to_JMh_CIECAM02', 'CAM02SCD_to_JMh_CIECAM02', 'CAM02UCS_to_JMh_CIECAM02', 'CAM16LCD_to_JMh_CAM16', - 'CAM16SCD_to_JMh_CAM16', 'CAM16UCS_to_JMh_CAM16', 'CMYK_to_CMY', - 'CMY_to_CMYK', 'CMY_to_RGB', 'CV_range', 'DECODING_CCTFS', 'DIN99_to_Lab', - 'ENCODING_CCTFS', 'EOTFS', 'EOTFS_REVERSE', 'HDR_CIELAB_METHODS', + 'CAM16SCD_to_JMh_CAM16', 'CAM16UCS_to_JMh_CAM16', 'CCTF_DECODINGS', + 'CCTF_ENCODINGS', 'CMYK_to_CMY', 'CMY_to_CMYK', 'CMY_to_RGB', 'CV_range', + 'DIN99_to_Lab', 'EOTFS', 'EOTF_INVERSES', 'HDR_CIELAB_METHODS', 'HDR_IPT_METHODS', 'HSL_to_RGB', 'HSV_to_RGB', 'Hunter_Lab_to_XYZ', 'Hunter_Rdab_to_XYZ', 'ICTCP_to_RGB', 'IPT_hue_angle', 'IPT_to_XYZ', 'JMh_CAM16_to_CAM16LCD', 'JMh_CAM16_to_CAM16SCD', 'JMh_CAM16_to_CAM16UCS', 'JMh_CIECAM02_to_CAM02LCD', 'JMh_CIECAM02_to_CAM02SCD', 'JMh_CIECAM02_to_CAM02UCS', 'JzAzBz_to_XYZ', 'LCHab_to_Lab', - 'LCHuv_to_Luv', 'LOG_DECODING_CURVES', 'LOG_ENCODING_CURVES', - 'Lab_to_DIN99', 'Lab_to_LCHab', 'Lab_to_XYZ', 'Luv_to_LCHuv', 'Luv_to_XYZ', - 'Luv_to_uv', 'Luv_uv_to_xy', 'OETFS', 'OETFS_REVERSE', 'OOTFS', - 'MACADAM_1942_ELLIPSES_DATA', 'OOTFS_REVERSE', 'OSA_UCS_to_XYZ', + 'LCHuv_to_Luv', 'LOG_DECODINGS', 'LOG_ENCODINGS', 'Lab_to_DIN99', + 'Lab_to_LCHab', 'Lab_to_XYZ', 'Luv_to_LCHuv', 'Luv_to_XYZ', 'Luv_to_uv', + 'Luv_uv_to_xy', 'OETFS', 'OETF_INVERSES', 'OOTFS', + 'MACADAM_1942_ELLIPSES_DATA', 'OOTF_INVERSES', 'OSA_UCS_to_XYZ', 'POINTER_GAMUT_BOUNDARIES', 'POINTER_GAMUT_DATA', 'POINTER_GAMUT_ILLUMINANT', 'Prismatic_to_RGB', 'RGB_COLOURSPACES', 'RGB_Colourspace', 'RGB_luminance', 'RGB_luminance_equation', 'RGB_to_CMY', @@ -244,11 +250,12 @@ 'XYZ_to_Luv', 'XYZ_to_OSA_UCS', 'XYZ_to_RGB', 'XYZ_to_UCS', 'XYZ_to_UVW', 'XYZ_to_hdr_CIELab', 'XYZ_to_hdr_IPT', 'XYZ_to_sRGB', 'XYZ_to_xy', 'XYZ_to_xyY', 'YCBCR_WEIGHTS', 'YCbCr_to_RGB', 'YcCbcCrc_to_RGB', - 'YCoCg_to_RGB', 'chromatically_adapted_primaries', 'decoding_cctf', - 'encoding_cctf', 'eotf', 'eotf_reverse', 'full_to_legal', 'gamma_function', - 'hdr_CIELab_to_XYZ', 'hdr_IPT_to_XYZ', 'legal_to_full', 'linear_function', - 'log_decoding_curve', 'log_encoding_curve', 'normalised_primary_matrix', - 'oetf', 'oetf_reverse', 'ootf', 'ootf_reverse', 'primaries_whitepoint', + 'YCoCg_to_RGB', 'cctf_decoding', 'cctf_encoding', + 'chromatically_adapted_primaries', 'eotf', 'eotf_inverse', 'full_to_legal', + 'gamma_function', 'hdr_CIELab_to_XYZ', 'hdr_IPT_to_XYZ', 'legal_to_full', + 'linear_function', 'log_decoding', 'log_encoding', + 'normalised_primary_matrix', 'oetf', 'oetf_inverse', 'ootf', + 'ootf_inverse', 'primaries_whitepoint', 'sd_to_aces_relative_exposure_values', 'sRGB_to_XYZ', 'uv_to_Luv', 'uv_to_UCS', 'xyY_to_XYZ', 'xyY_to_xy', 'xy_to_Luv_uv', 'xy_to_UCS_uv', 'xy_to_XYZ', 'xy_to_xyY' @@ -256,6 +263,7 @@ __all__ += [ 'BRENEMAN_EXPERIMENTS', 'BRENEMAN_EXPERIMENTS_PRIMARIES_CHROMATICITIES', 'CORRESPONDING_CHROMATICITIES_PREDICTION_MODELS', + 'CorrespondingColourDataset', 'CorrespondingChromaticitiesPrediction', 'corresponding_chromaticities_prediction' ] __all__ += ['CONTRAST_SENSITIVITY_METHODS', 'contrast_sensitivity_function'] @@ -284,11 +292,13 @@ 'is_within_mesh_volume', 'is_within_pointer_gamut', 'is_within_visible_spectrum' ] +__all__ += ['describe_conversion_path', 'convert'] + __application_name__ = 'Colour' __major_version__ = '0' __minor_version__ = '3' -__change_version__ = '13' +__change_version__ = '14' __version__ = '.'.join( (__major_version__, __minor_version__, @@ -297,7 +307,7 @@ # TODO: Remove legacy printing support when deemed appropriate. try: np.set_printoptions(legacy='1.13') -except TypeError: +except TypeError: # pragma: no cover pass @@ -318,19 +328,19 @@ def __getattr__(self, attribute): # v0.3.11 API_CHANGES = { - 'Future Access Change': [ + 'ObjectFutureAccessChange': [ [ 'colour.ACES_2065_1_COLOURSPACE', 'colour.models.ACES_2065_1_COLOURSPACE', ], - [ - 'colour.ACES_CC_COLOURSPACE', - 'colour.models.ACES_CC_COLOURSPACE', - ], [ 'colour.ACES_CCT_COLOURSPACE', 'colour.models.ACES_CCT_COLOURSPACE', ], + [ + 'colour.ACES_CC_COLOURSPACE', + 'colour.models.ACES_CC_COLOURSPACE', + ], [ 'colour.ACES_CG_COLOURSPACE', 'colour.models.ACES_CG_COLOURSPACE', @@ -359,25 +369,13 @@ def __getattr__(self, attribute): 'colour.APPLE_RGB_COLOURSPACE', 'colour.models.APPLE_RGB_COLOURSPACE', ], - [ - 'colour.as_namedtuple', - 'colour.utilities.as_namedtuple', - ], - [ - 'colour.as_numeric', - 'colour.utilities.as_numeric', - ], [ 'colour.AVOGADRO_CONSTANT', 'colour.constants.AVOGADRO_CONSTANT', ], [ - 'colour.bandpass_correction_Stearns1988', - 'colour.colorimetry.bandpass_correction_Stearns1988', - ], - [ - 'colour.batch', - 'colour.utilities.batch', + 'colour.AbstractContinuousFunction', + 'colour.continuous.AbstractContinuousFunction', ], [ 'colour.BEST_RGB_COLOURSPACE', @@ -387,10 +385,6 @@ def __getattr__(self, attribute): 'colour.BETA_RGB_COLOURSPACE', 'colour.models.BETA_RGB_COLOURSPACE', ], - [ - 'colour.blackbody_spectral_radiance', - 'colour.colorimetry.blackbody_spectral_radiance', - ], [ 'colour.BOLTZMANN_CONSTANT', 'colour.constants.BOLTZMANN_CONSTANT', @@ -424,20 +418,8 @@ def __getattr__(self, attribute): 'colour.models.BT709_COLOURSPACE', ], [ - 'colour.cartesian_to_cylindrical', - 'colour.algebra.cartesian_to_cylindrical', - ], - [ - 'colour.cartesian_to_polar', - 'colour.algebra.cartesian_to_polar', - ], - [ - 'colour.cartesian_to_spherical', - 'colour.algebra.cartesian_to_spherical', - ], - [ - 'colour.CaseInsensitiveMapping', - 'colour.utilities.CaseInsensitiveMapping', + 'colour.CAM16_InductionFactors', + 'colour.appearance.CAM16_InductionFactors', ], [ 'colour.CAT02_BRILL_CAT', @@ -468,28 +450,8 @@ def __getattr__(self, attribute): 'colour.temperature.CCT_to_xy_Kang2002', ], [ - 'colour.centroid', - 'colour.utilities.centroid', - ], - [ - 'colour.chromatic_adaptation_CIE1994', - 'colour.adaptation.chromatic_adaptation_CIE1994', - ], - [ - 'colour.chromatic_adaptation_CMCCAT2000', - 'colour.adaptation.chromatic_adaptation_CMCCAT2000', - ], - [ - 'colour.chromatic_adaptation_Fairchild1990', - 'colour.adaptation.chromatic_adaptation_Fairchild1990', - ], - [ - 'colour.chromatic_adaptation_matrix_VonKries', - 'colour.adaptation.chromatic_adaptation_matrix_VonKries', - ], - [ - 'colour.chromatic_adaptation_VonKries', - 'colour.adaptation.chromatic_adaptation_VonKries', + 'colour.CIECAM02_InductionFactors', + 'colour.appearance.CIECAM02_InductionFactors', ], [ 'colour.CIE_RGB_COLOURSPACE', @@ -499,18 +461,14 @@ def __getattr__(self, attribute): 'colour.CINEMA_GAMUT_COLOURSPACE', 'colour.models.CINEMA_GAMUT_COLOURSPACE', ], - [ - 'colour.closest', - 'colour.utilities.closest', - ], - [ - 'colour.closest_indexes', - 'colour.utilities.closest_indexes', - ], [ 'colour.CMCCAT2000_CAT', 'colour.adaptation.CMCCAT2000_CAT', ], + [ + 'colour.CMCCAT2000_InductionFactors', + 'colour.adaptation.CMCCAT2000_InductionFactors', + ], [ 'colour.CMCCAT97_CAT', 'colour.adaptation.CMCCAT97_CAT', @@ -529,35 +487,23 @@ def __getattr__(self, attribute): ], [ 'colour.COLOURSPACE_MODELS_LABELS', - 'colour.models.COLOURSPACE_MODELS_LABELS', - ], - [ - 'colour.corresponding_chromaticities_prediction_CIE1994', - 'colour.corresponding.' - 'corresponding_chromaticities_prediction_CIE1994', - ], - [ - 'colour.corresponding_chromaticities_prediction_CMCCAT2000', - 'colour.corresponding.' - 'corresponding_chromaticities_prediction_CMCCAT2000', + 'colour.models.COLOURSPACE_MODELS_AXIS_LABELS', ], [ - 'colour.corresponding_chromaticities_prediction_Fairchild1990', - 'colour.corresponding.' - 'corresponding_chromaticities_prediction_Fairchild1990', + 'colour.CQS_Specification', + 'colour.quality.CQS_Specification', ], [ - 'colour.corresponding_chromaticities_prediction_VonKries', - 'colour.corresponding.' - 'corresponding_chromaticities_prediction_VonKries', + 'colour.CRI_Specification', + 'colour.quality.CRI_Specification', ], [ - 'colour.cylindrical_to_cartesian', - 'colour.algebra.cylindrical_to_cartesian', + 'colour.CaseInsensitiveMapping', + 'colour.utilities.CaseInsensitiveMapping', ], [ - 'colour.D_ILLUMINANTS_S_SPDS', - 'colour.colorimetry.D_ILLUMINANTS_S_SDS', + 'colour.ColourWarning', + 'colour.utilities.ColourWarning', ], [ 'colour.DCI_P3_COLOURSPACE', @@ -572,177 +518,513 @@ def __getattr__(self, attribute): 'colour.constants.DEFAULT_FLOAT_DTYPE', ], [ - 'colour.delta_E_CAM02LCD', - 'colour.difference.delta_E_CAM02LCD', + 'colour.DON_RGB_4_COLOURSPACE', + 'colour.models.DON_RGB_4_COLOURSPACE', ], [ - 'colour.delta_E_CAM02SCD', - 'colour.difference.delta_E_CAM02SCD', + 'colour.DRAGON_COLOR_2_COLOURSPACE', + 'colour.models.DRAGON_COLOR_2_COLOURSPACE', ], [ - 'colour.delta_E_CAM02UCS', - 'colour.difference.delta_E_CAM02UCS', + 'colour.DRAGON_COLOR_COLOURSPACE', + 'colour.models.DRAGON_COLOR_COLOURSPACE', ], [ - 'colour.delta_E_CAM16LCD', - 'colour.difference.delta_E_CAM16LCD', + 'colour.D_ILLUMINANTS_S_SPDS', + 'colour.colorimetry.D_ILLUMINANTS_S_SDS', ], [ - 'colour.delta_E_CAM16SCD', - 'colour.difference.delta_E_CAM16SCD', + 'colour.ECI_RGB_V2_COLOURSPACE', + 'colour.models.ECI_RGB_V2_COLOURSPACE', ], [ - 'colour.delta_E_CAM16UCS', - 'colour.difference.delta_E_CAM16UCS', + 'colour.EKTA_SPACE_PS_5_COLOURSPACE', + 'colour.models.EKTA_SPACE_PS_5_COLOURSPACE', ], [ - 'colour.delta_E_CIE1976', - 'colour.difference.delta_E_CIE1976', + 'colour.EPSILON', + 'colour.constants.EPSILON', ], [ - 'colour.delta_E_CIE1994', - 'colour.difference.delta_E_CIE1994', + 'colour.ERIMM_RGB_COLOURSPACE', + 'colour.models.ERIMM_RGB_COLOURSPACE', ], [ - 'colour.delta_E_CIE2000', - 'colour.difference.delta_E_CIE2000', + 'colour.FAIRCHILD_CAT', + 'colour.adaptation.FAIRCHILD_CAT', ], [ - 'colour.delta_E_CMC', - 'colour.difference.delta_E_CMC', + 'colour.FLOATING_POINT_NUMBER_PATTERN', + 'colour.constants.FLOATING_POINT_NUMBER_PATTERN', ], [ - 'colour.DON_RGB_4_COLOURSPACE', - 'colour.models.DON_RGB_4_COLOURSPACE', + 'colour.Hunt_InductionFactors', + 'colour.appearance.Hunt_InductionFactors', ], [ - 'colour.dot_matrix', - 'colour.utilities.dot_matrix', + 'colour.INTEGER_THRESHOLD', + 'colour.constants.INTEGER_THRESHOLD', ], [ - 'colour.dot_vector', - 'colour.utilities.dot_vector', + 'colour.KP_M', + 'colour.constants.KP_M', ], [ - 'colour.DRAGON_COLOR_2_COLOURSPACE', - 'colour.models.DRAGON_COLOR_2_COLOURSPACE', + 'colour.K_M', + 'colour.constants.K_M', ], [ - 'colour.DRAGON_COLOR_COLOURSPACE', - 'colour.models.DRAGON_COLOR_COLOURSPACE', + 'colour.LIGHT_SPEED', + 'colour.constants.LIGHT_SPEED', ], [ - 'colour.ECI_RGB_V2_COLOURSPACE', - 'colour.models.ECI_RGB_V2_COLOURSPACE', + 'colour.LLAB_InductionFactors', + 'colour.appearance.LLAB_InductionFactors', ], [ - 'colour.EKTA_SPACE_PS_5_COLOURSPACE', - 'colour.models.EKTA_SPACE_PS_5_COLOURSPACE', + 'colour.LMS_10_degree_cmfs_to_XYZ_10_degree_cmfs', + 'colour.colorimetry.LMS_10_degree_cmfs_to_XYZ_10_degree_cmfs', ], [ - 'colour.eotf_BT1886', - 'colour.models.eotf_BT1886', + 'colour.LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs', + 'colour.colorimetry.LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs', ], [ - 'colour.eotf_BT2020', - 'colour.models.eotf_BT2020', + 'colour.LMS_ConeFundamentals', + 'colour.colorimetry.LMS_ConeFundamentals', ], [ - 'colour.eotf_BT2100_HLG', - 'colour.models.eotf_BT2100_HLG', + 'colour.LineSegmentsIntersections_Specification', + 'colour.algebra.LineSegmentsIntersections_Specification', ], [ - 'colour.eotf_BT2100_PQ', - 'colour.models.eotf_BT2100_PQ', + 'colour.Lookup', + 'colour.utilities.Lookup', ], [ - 'colour.eotf_DCIP3', - 'colour.models.eotf_DCDM', + 'colour.MAX_RGB_COLOURSPACE', + 'colour.models.MAX_RGB_COLOURSPACE', ], [ - 'colour.eotf_DICOMGSDF', - 'colour.models.eotf_DICOMGSDF', + 'colour.MUNSELL_COLOURS_1929', + 'colour.notation.MUNSELL_COLOURS_1929', ], [ - 'colour.eotf_ProPhotoRGB', - 'colour.models.eotf_ProPhotoRGB', + 'colour.MUNSELL_COLOURS_ALL', + 'colour.notation.MUNSELL_COLOURS_ALL', ], [ - 'colour.eotf_reverse_BT1886', - 'colour.models.eotf_reverse_BT1886', + 'colour.MUNSELL_COLOURS_REAL', + 'colour.notation.MUNSELL_COLOURS_REAL', ], [ - 'colour.eotf_reverse_BT2100_HLG', - 'colour.models.eotf_reverse_BT2100_HLG', + 'colour.MultiSignal', + 'colour.continuous.MultiSignals', ], [ - 'colour.eotf_reverse_BT2100_PQ', - 'colour.models.eotf_reverse_BT2100_PQ', + 'colour.NTSC_1953_COLOURSPACE', + 'colour.models.NTSC_1953_COLOURSPACE', ], [ - 'colour.eotf_RIMMRGB', - 'colour.models.eotf_RIMMRGB', + 'colour.PAL_SECAM_COLOURSPACE', + 'colour.models.PAL_SECAM_COLOURSPACE', ], [ - 'colour.eotf_ROMMRGB', - 'colour.models.eotf_ROMMRGB', + 'colour.PLANCK_CONSTANT', + 'colour.constants.PLANCK_CONSTANT', ], [ - 'colour.eotf_SMPTE240M', - 'colour.models.eotf_SMPTE240M', + 'colour.PROPHOTO_RGB_COLOURSPACE', + 'colour.models.PROPHOTO_RGB_COLOURSPACE', ], [ - 'colour.eotf_ST2084', - 'colour.models.eotf_ST2084', + 'colour.PROTUNE_NATIVE_COLOURSPACE', + 'colour.models.PROTUNE_NATIVE_COLOURSPACE', ], [ - 'colour.EPSILON', - 'colour.constants.EPSILON', + 'colour.RED_COLOR_2_COLOURSPACE', + 'colour.models.RED_COLOR_2_COLOURSPACE', ], [ - 'colour.ERIMM_RGB_COLOURSPACE', - 'colour.models.ERIMM_RGB_COLOURSPACE', + 'colour.RED_COLOR_3_COLOURSPACE', + 'colour.models.RED_COLOR_3_COLOURSPACE', ], [ - 'colour.euclidean_distance', - 'colour.algebra.euclidean_distance', + 'colour.RED_COLOR_4_COLOURSPACE', + 'colour.models.RED_COLOR_4_COLOURSPACE', ], [ - 'colour.FAIRCHILD_CAT', - 'colour.adaptation.FAIRCHILD_CAT', + 'colour.RED_COLOR_COLOURSPACE', + 'colour.models.RED_COLOR_COLOURSPACE', ], [ - 'colour.fill_nan', - 'colour.utilities.fill_nan', + 'colour.RED_WIDE_GAMUT_RGB_COLOURSPACE', + 'colour.models.RED_WIDE_GAMUT_RGB_COLOURSPACE', ], [ - 'colour.filter_kwargs', - 'colour.utilities.filter_kwargs', + 'colour.RGB_10_degree_cmfs_to_LMS_10_degree_cmfs', + 'colour.colorimetry.RGB_10_degree_cmfs_to_LMS_10_degree_cmfs', ], [ - 'colour.filter_warnings', - 'colour.utilities.filter_warnings', + 'colour.RGB_10_degree_cmfs_to_XYZ_10_degree_cmfs', + 'colour.colorimetry.RGB_10_degree_cmfs_to_XYZ_10_degree_cmfs', ], [ - 'colour.first_item', - 'colour.utilities.first_item', + 'colour.RGB_2_degree_cmfs_to_XYZ_2_degree_cmfs', + 'colour.colorimetry.RGB_2_degree_cmfs_to_XYZ_2_degree_cmfs', ], [ - 'colour.handle_numpy_errors', - 'colour.utilities.handle_numpy_errors', + 'colour.RGB_ColourMatchingFunctions', + 'colour.colorimetry.RGB_ColourMatchingFunctions', ], [ - 'colour.ignore_numpy_errors', - 'colour.utilities.ignore_numpy_errors', + 'colour.RGB_DisplayPrimaries', + 'colour.characterisation.RGB_DisplayPrimaries', ], [ - 'colour.ignore_python_warnings', - 'colour.utilities.ignore_python_warnings', + 'colour.RGB_SpectralSensitivities', + 'colour.characterisation.RGB_SpectralSensitivities', + ], + [ + 'colour.RGB_to_sd_Smits1999', + 'colour.recovery.RGB_to_sd_Smits1999', + ], + [ + 'colour.RIMM_RGB_COLOURSPACE', + 'colour.models.RIMM_RGB_COLOURSPACE', + ], + [ + 'colour.ROMM_RGB_COLOURSPACE', + 'colour.models.ROMM_RGB_COLOURSPACE', + ], + [ + 'colour.RUSSELL_RGB_COLOURSPACE', + 'colour.models.RUSSELL_RGB_COLOURSPACE', + ], + [ + 'colour.SHARP_CAT', + 'colour.adaptation.SHARP_CAT', + ], + [ + 'colour.SMITS_1999_SPDS', + 'colour.recovery.SMITS_1999_SDS', + ], + [ + 'colour.SMPTE_240M_COLOURSPACE', + 'colour.models.SMPTE_240M_COLOURSPACE', + ], + [ + 'colour.S_GAMUT3_CINE_COLOURSPACE', + 'colour.models.S_GAMUT3_CINE_COLOURSPACE', + ], + [ + 'colour.S_GAMUT3_COLOURSPACE', + 'colour.models.S_GAMUT3_COLOURSPACE', + ], + [ + 'colour.S_GAMUT_COLOURSPACE', + 'colour.models.S_GAMUT_COLOURSPACE', + ], + [ + 'colour.Signal', + 'colour.continuous.Signal', + ], + [ + 'colour.Structure', + 'colour.utilities.Structure', + ], + [ + 'colour.TCS_SPDS', + 'colour.quality.TCS_SDS', + ], + [ + 'colour.VON_KRIES_CAT', + 'colour.adaptation.VON_KRIES_CAT', + ], + [ + 'colour.VS_SPDS', + 'colour.quality.VS_SDS', + ], + [ + 'colour.V_GAMUT_COLOURSPACE', + 'colour.models.V_GAMUT_COLOURSPACE', + ], + [ + 'colour.XTREME_RGB_COLOURSPACE', + 'colour.models.XTREME_RGB_COLOURSPACE', + ], + [ + 'colour.XYZ_ColourMatchingFunctions', + 'colour.colorimetry.XYZ_ColourMatchingFunctions', + ], + [ + 'colour.XYZ_SCALING_CAT', + 'colour.adaptation.XYZ_SCALING_CAT', + ], + [ + 'colour.XYZ_to_colourspace_model', + 'colour.models.XYZ_to_colourspace_model', + ], + [ + 'colour.XYZ_to_sd_Meng2015', + 'colour.recovery.XYZ_to_sd_Meng2015', + ], + [ + 'colour.adjust_tristimulus_weighting_factors_ASTME30815', + 'colour.colorimetry.adjust_tristimulus_weighting_factors_ASTME308', + ], + [ + 'colour.as_namedtuple', + 'colour.utilities.as_namedtuple', + ], + [ + 'colour.as_numeric', + 'colour.utilities.as_numeric', + ], + [ + 'colour.bandpass_correction_Stearns1988', + 'colour.colorimetry.bandpass_correction_Stearns1988', + ], + [ + 'colour.batch', + 'colour.utilities.batch', + ], + [ + 'colour.blackbody_spectral_radiance', + 'colour.colorimetry.blackbody_spectral_radiance', + ], + [ + 'colour.cartesian_to_cylindrical', + 'colour.algebra.cartesian_to_cylindrical', + ], + [ + 'colour.cartesian_to_polar', + 'colour.algebra.cartesian_to_polar', + ], + [ + 'colour.cartesian_to_spherical', + 'colour.algebra.cartesian_to_spherical', + ], + [ + 'colour.centroid', + 'colour.utilities.centroid', + ], + [ + 'colour.chromatic_adaptation_CIE1994', + 'colour.adaptation.chromatic_adaptation_CIE1994', + ], + [ + 'colour.chromatic_adaptation_CMCCAT2000', + 'colour.adaptation.chromatic_adaptation_CMCCAT2000', + ], + [ + 'colour.chromatic_adaptation_Fairchild1990', + 'colour.adaptation.chromatic_adaptation_Fairchild1990', + ], + [ + 'colour.chromatic_adaptation_VonKries', + 'colour.adaptation.chromatic_adaptation_VonKries', + ], + [ + 'colour.chromatic_adaptation_forward_CMCCAT2000', + 'colour.adaptation.chromatic_adaptation_forward_CMCCAT2000', + ], + [ + 'colour.chromatic_adaptation_matrix_VonKries', + 'colour.adaptation.chromatic_adaptation_matrix_VonKries', + ], + [ + 'colour.chromatic_adaptation_reverse_CMCCAT2000', + 'colour.adaptation.chromatic_adaptation_inverse_CMCCAT2000', + ], + [ + 'colour.closest', + 'colour.utilities.closest', + ], + [ + 'colour.closest_indexes', + 'colour.utilities.closest_indexes', + ], + [ + 'colour.corresponding_chromaticities_prediction_CIE1994', + 'colour.corresponding.corresponding_chromaticities_prediction_CIE1994', # noqa + ], + [ + 'colour.corresponding_chromaticities_prediction_CMCCAT2000', + 'colour.corresponding.corresponding_chromaticities_prediction_CMCCAT2000', # noqa + ], + [ + 'colour.corresponding_chromaticities_prediction_Fairchild1990', + 'colour.corresponding.corresponding_chromaticities_prediction_Fairchild1990', # noqa + ], + [ + 'colour.corresponding_chromaticities_prediction_VonKries', + 'colour.corresponding.corresponding_chromaticities_prediction_VonKries', # noqa + ], + [ + 'colour.cylindrical_to_cartesian', + 'colour.algebra.cylindrical_to_cartesian', + ], + [ + 'colour.delta_E_CAM02LCD', + 'colour.difference.delta_E_CAM02LCD', + ], + [ + 'colour.delta_E_CAM02SCD', + 'colour.difference.delta_E_CAM02SCD', + ], + [ + 'colour.delta_E_CAM02UCS', + 'colour.difference.delta_E_CAM02UCS', + ], + [ + 'colour.delta_E_CAM16LCD', + 'colour.difference.delta_E_CAM16LCD', + ], + [ + 'colour.delta_E_CAM16SCD', + 'colour.difference.delta_E_CAM16SCD', + ], + [ + 'colour.delta_E_CAM16UCS', + 'colour.difference.delta_E_CAM16UCS', + ], + [ + 'colour.delta_E_CIE1976', + 'colour.difference.delta_E_CIE1976', + ], + [ + 'colour.delta_E_CIE1994', + 'colour.difference.delta_E_CIE1994', + ], + [ + 'colour.delta_E_CIE2000', + 'colour.difference.delta_E_CIE2000', + ], + [ + 'colour.delta_E_CMC', + 'colour.difference.delta_E_CMC', + ], + [ + 'colour.dot_matrix', + 'colour.utilities.dot_matrix', + ], + [ + 'colour.dot_vector', + 'colour.utilities.dot_vector', + ], + [ + 'colour.eotf_BT1886', + 'colour.models.eotf_BT1886', + ], + [ + 'colour.eotf_BT2020', + 'colour.models.eotf_BT2020', + ], + [ + 'colour.eotf_BT2100_HLG', + 'colour.models.eotf_HLG_BT2100', + ], + [ + 'colour.eotf_BT2100_PQ', + 'colour.models.eotf_PQ_BT2100', + ], + [ + 'colour.eotf_DCIP3', + 'colour.models.eotf_DCDM', + ], + [ + 'colour.eotf_DICOMGSDF', + 'colour.models.eotf_DICOMGSDF', + ], + [ + 'colour.cctf_decoding_ProPhotoRGB', + 'colour.models.cctf_decoding_ProPhotoRGB', + ], + [ + 'colour.cctf_decoding_RIMMRGB', + 'colour.models.cctf_decoding_RIMMRGB', + ], + [ + 'colour.cctf_decoding_ROMMRGB', + 'colour.models.cctf_decoding_ROMMRGB', + ], + [ + 'colour.eotf_SMPTE240M', + 'colour.models.eotf_SMPTE240M', + ], + [ + 'colour.eotf_ST2084', + 'colour.models.eotf_ST2084', + ], + [ + 'colour.eotf_reverse_BT1886', + 'colour.models.eotf_inverse_BT1886', + ], + [ + 'colour.eotf_reverse_BT2100_HLG', + 'colour.models.eotf_inverse_HLG_BT2100', + ], + [ + 'colour.eotf_reverse_BT2100_PQ', + 'colour.models.eotf_inverse_PQ_BT2100', + ], + [ + 'colour.eotf_reverse_ST2084', + 'colour.models.eotf_inverse_ST2084', + ], + [ + 'colour.eotf_reverse_sRGB', + 'colour.models.eotf_inverse_sRGB', + ], + [ + 'colour.eotf_sRGB', + 'colour.models.eotf_sRGB', + ], + [ + 'colour.euclidean_distance', + 'colour.algebra.euclidean_distance', + ], + [ + 'colour.extend_line_segment', + 'colour.algebra.extend_line_segment', + ], + [ + 'colour.fill_nan', + 'colour.utilities.fill_nan', + ], + [ + 'colour.filter_kwargs', + 'colour.utilities.filter_kwargs', + ], + [ + 'colour.filter_warnings', + 'colour.utilities.filter_warnings', + ], + [ + 'colour.first_item', + 'colour.utilities.first_item', + ], + [ + 'colour.handle_numpy_errors', + 'colour.utilities.handle_numpy_errors', + ], + [ + 'colour.ignore_numpy_errors', + 'colour.utilities.ignore_numpy_errors', + ], + [ + 'colour.ignore_python_warnings', + 'colour.utilities.ignore_python_warnings', ], [ 'colour.in_array', 'colour.utilities.in_array', ], + [ + 'colour.intersect_line_segments', + 'colour.algebra.intersect_line_segments', + ], [ 'colour.interval', 'colour.utilities.interval', @@ -780,16 +1062,8 @@ def __getattr__(self, attribute): 'colour.utilities.is_uniform', ], [ - 'colour.K_M', - 'colour.constants.K_M', - ], - [ - 'colour.KP_M', - 'colour.constants.KP_M', - ], - [ - 'colour.LIGHT_SPEED', - 'colour.constants.LIGHT_SPEED', + 'colour.lagrange_coefficients_ASTME2022', + 'colour.colorimetry.lagrange_coefficients_ASTME2022', ], [ 'colour.lightness_CIE1976', @@ -815,18 +1089,6 @@ def __getattr__(self, attribute): 'colour.linear_conversion', 'colour.utilities.linear_conversion', ], - [ - 'colour.LMS_10_degree_cmfs_to_XYZ_10_degree_cmfs', - 'colour.colorimetry.LMS_10_degree_cmfs_to_XYZ_10_degree_cmfs', - ], - [ - 'colour.LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs', - 'colour.colorimetry.LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs', - ], - [ - 'colour.LMS_ConeFundamentals', - 'colour.colorimetry.LMS_ConeFundamentals', - ], [ 'colour.log_decoding_ACEScc', 'colour.models.log_decoding_ACEScc', @@ -903,14 +1165,14 @@ def __getattr__(self, attribute): 'colour.log_decoding_SLog3', 'colour.models.log_decoding_SLog3', ], - [ - 'colour.log_decoding_ViperLog', - 'colour.models.log_decoding_ViperLog', - ], [ 'colour.log_decoding_VLog', 'colour.models.log_decoding_VLog', ], + [ + 'colour.log_decoding_ViperLog', + 'colour.models.log_decoding_ViperLog', + ], [ 'colour.log_encoding_ACEScc', 'colour.models.log_encoding_ACEScc', @@ -991,13 +1253,9 @@ def __getattr__(self, attribute): 'colour.log_encoding_VLog', 'colour.models.log_encoding_VLog', ], - [ - 'colour.Lookup', - 'colour.utilities.Lookup', - ], [ 'colour.luminance_ASTMD153508', - 'colour.colorimetry.luminance_ASTMD153508', + 'colour.colorimetry.luminance_ASTMD1535', ], [ 'colour.luminance_CIE1976', @@ -1015,10 +1273,6 @@ def __getattr__(self, attribute): 'colour.luminance_Newhall1943', 'colour.colorimetry.luminance_Newhall1943', ], - [ - 'colour.MAX_RGB_COLOURSPACE', - 'colour.models.MAX_RGB_COLOURSPACE', - ], [ 'colour.mesopic_weighting_function', 'colour.colorimetry.mesopic_weighting_function', @@ -1027,25 +1281,9 @@ def __getattr__(self, attribute): 'colour.message_box', 'colour.utilities.message_box', ], - [ - 'colour.MultiSignal', - 'colour.continuous.MultiSignal', - ], - [ - 'colour.MUNSELL_COLOURS_1929', - 'colour.notation.MUNSELL_COLOURS_1929', - ], - [ - 'colour.MUNSELL_COLOURS_ALL', - 'colour.notation.MUNSELL_COLOURS_ALL', - ], - [ - 'colour.MUNSELL_COLOURS_REAL', - 'colour.notation.MUNSELL_COLOURS_REAL', - ], [ 'colour.munsell_value_ASTMD153508', - 'colour.notation.munsell_value_ASTMD153508', + 'colour.notation.munsell_value_ASTMD1535', ], [ 'colour.munsell_value_Ladd1955', @@ -1083,10 +1321,6 @@ def __getattr__(self, attribute): 'colour.normalise_vector', 'colour.algebra.normalise_vector', ], - [ - 'colour.NTSC_COLOURSPACE', - 'colour.models.NTSC_COLOURSPACE', - ], [ 'colour.numpy_print_options', 'colour.utilities.numpy_print_options', @@ -1101,259 +1335,143 @@ def __getattr__(self, attribute): ], [ 'colour.oetf_BT2100_HLG', - 'colour.models.oetf_BT2100_HLG', - ], - [ - 'colour.oetf_BT2100_PQ', - 'colour.models.oetf_BT2100_PQ', - ], - [ - 'colour.oetf_BT601', - 'colour.models.oetf_BT601', - ], - [ - 'colour.oetf_BT709', - 'colour.models.oetf_BT709', - ], - [ - 'colour.oetf_DCIP3', - 'colour.models.eotf_reverse_DCIP3', - ], - [ - 'colour.oetf_DICOMGSDF', - 'colour.models.oetf_DICOMGSDF', - ], - [ - 'colour.oetf_ProPhotoRGB', - 'colour.models.oetf_ProPhotoRGB', - ], - [ - 'colour.oetf_reverse_ARIBSTDB67', - 'colour.models.oetf_reverse_ARIBSTDB67', - ], - [ - 'colour.oetf_reverse_BT2100_HLG', - 'colour.models.oetf_reverse_BT2100_HLG', - ], - [ - 'colour.oetf_reverse_BT2100_PQ', - 'colour.models.oetf_reverse_BT2100_PQ', - ], - [ - 'colour.oetf_reverse_BT601', - 'colour.models.oetf_reverse_BT601', - ], - [ - 'colour.oetf_reverse_BT709', - 'colour.models.oetf_reverse_BT709', + 'colour.models.oetf_HLG_BT2100', ], - [ - 'colour.oetf_reverse_sRGB', - 'colour.models.oetf_reverse_sRGB', - ], - [ - 'colour.oetf_RIMMRGB', - 'colour.models.oetf_RIMMRGB', - ], - [ - 'colour.oetf_ROMMRGB', - 'colour.models.oetf_ROMMRGB', - ], - [ - 'colour.oetf_SMPTE240M', - 'colour.models.oetf_SMPTE240M', - ], - [ - 'colour.oetf_sRGB', - 'colour.models.oetf_sRGB', - ], - [ - 'colour.oetf_ST2084', - 'colour.models.oetf_ST2084', - ], - [ - 'colour.ootf_BT2100_HLG', - 'colour.models.ootf_BT2100_HLG', - ], - [ - 'colour.ootf_BT2100_PQ', - 'colour.models.ootf_BT2100_PQ', - ], - [ - 'colour.ootf_reverse_BT2100_HLG', - 'colour.models.ootf_reverse_BT2100_HLG', - ], - [ - 'colour.ootf_reverse_BT2100_PQ', - 'colour.models.ootf_reverse_BT2100_PQ', - ], - [ - 'colour.orient', - 'colour.utilities.orient', - ], - [ - 'colour.PAL_SECAM_COLOURSPACE', - 'colour.models.PAL_SECAM_COLOURSPACE', - ], - [ - 'colour.PLANCK_CONSTANT', - 'colour.constants.PLANCK_CONSTANT', - ], - [ - 'colour.planck_law', - 'colour.colorimetry.planck_law', - ], - [ - 'colour.polar_to_cartesian', - 'colour.algebra.polar_to_cartesian', - ], - [ - 'colour.print_numpy_errors', - 'colour.utilities.print_numpy_errors', - ], - [ - 'colour.PROPHOTO_RGB_COLOURSPACE', - 'colour.models.PROPHOTO_RGB_COLOURSPACE', - ], - [ - 'colour.PROTUNE_NATIVE_COLOURSPACE', - 'colour.models.PROTUNE_NATIVE_COLOURSPACE', + [ + 'colour.oetf_BT2100_PQ', + 'colour.models.oetf_PQ_BT2100', ], [ - 'colour.raise_numpy_errors', - 'colour.utilities.raise_numpy_errors', + 'colour.oetf_BT601', + 'colour.models.oetf_BT601', ], [ - 'colour.random_triplet_generator', - 'colour.algebra.random_triplet_generator', + 'colour.oetf_BT709', + 'colour.models.oetf_BT709', ], [ - 'colour.rayleigh_optical_depth', - 'colour.phenomena.rayleigh_optical_depth', + 'colour.oetf_DCIP3', + 'colour.models.eotf_inverse_DCIP3', ], [ - 'colour.reaction_rate_MichealisMenten', - 'colour.biochemistry.reaction_rate_MichealisMenten', + 'colour.oetf_DICOMGSDF', + 'colour.models.eotf_inverse_DICOMGSDF', ], [ - 'colour.RED_COLOR_2_COLOURSPACE', - 'colour.models.RED_COLOR_2_COLOURSPACE', + 'colour.cctf_encoding_ProPhotoRGB', + 'colour.models.cctf_encoding_ProPhotoRGB', ], [ - 'colour.RED_COLOR_3_COLOURSPACE', - 'colour.models.RED_COLOR_3_COLOURSPACE', + 'colour.cctf_encoding_RIMMRGB', + 'colour.models.cctf_encoding_RIMMRGB', ], [ - 'colour.RED_COLOR_4_COLOURSPACE', - 'colour.models.RED_COLOR_4_COLOURSPACE', + 'colour.cctf_encoding_ROMMRGB', + 'colour.models.cctf_encoding_ROMMRGB', ], [ - 'colour.RED_COLOR_COLOURSPACE', - 'colour.models.RED_COLOR_COLOURSPACE', + 'colour.oetf_SMPTE240M', + 'colour.models.oetf_SMPTE240M', ], [ - 'colour.RED_WIDE_GAMUT_RGB_COLOURSPACE', - 'colour.models.RED_WIDE_GAMUT_RGB_COLOURSPACE', + 'colour.oetf_reverse_ARIBSTDB67', + 'colour.models.oetf_inverse_ARIBSTDB67', ], [ - 'colour.RGB_10_degree_cmfs_to_LMS_10_degree_cmfs', - 'colour.colorimetry.RGB_10_degree_cmfs_to_LMS_10_degree_cmfs', + 'colour.oetf_reverse_BT2100_HLG', + 'colour.models.oetf_inverse_HLG_BT2100', ], [ - 'colour.RGB_10_degree_cmfs_to_XYZ_10_degree_cmfs', - 'colour.colorimetry.RGB_10_degree_cmfs_to_XYZ_10_degree_cmfs', + 'colour.oetf_reverse_BT2100_PQ', + 'colour.models.oetf_inverse_PQ_BT2100', ], [ - 'colour.RGB_2_degree_cmfs_to_XYZ_2_degree_cmfs', - 'colour.colorimetry.RGB_2_degree_cmfs_to_XYZ_2_degree_cmfs', + 'colour.oetf_reverse_BT601', + 'colour.models.oetf_inverse_BT601', ], [ - 'colour.RGB_ColourMatchingFunctions', - 'colour.colorimetry.RGB_ColourMatchingFunctions', + 'colour.oetf_reverse_BT709', + 'colour.models.oetf_inverse_BT709', ], [ - 'colour.RGB_DisplayPrimaries', - 'colour.characterisation.RGB_DisplayPrimaries', + 'colour.ootf_BT2100_HLG', + 'colour.models.ootf_HLG_BT2100', ], [ - 'colour.RGB_SpectralSensitivities', - 'colour.characterisation.RGB_SpectralSensitivities', + 'colour.ootf_BT2100_PQ', + 'colour.models.ootf_PQ_BT2100', ], [ - 'colour.RGB_to_sd_Smits1999', - 'colour.recovery.RGB_to_sd_Smits1999', + 'colour.ootf_reverse_BT2100_HLG', + 'colour.models.ootf_inverse_HLG_BT2100', ], [ - 'colour.RIMM_RGB_COLOURSPACE', - 'colour.models.RIMM_RGB_COLOURSPACE', + 'colour.ootf_reverse_BT2100_PQ', + 'colour.models.ootf_inverse_PQ_BT2100', ], [ - 'colour.ROMM_RGB_COLOURSPACE', - 'colour.models.ROMM_RGB_COLOURSPACE', + 'colour.orient', + 'colour.utilities.orient', ], [ - 'colour.row_as_diagonal', - 'colour.utilities.row_as_diagonal', + 'colour.planck_law', + 'colour.colorimetry.planck_law', ], [ - 'colour.RUSSELL_RGB_COLOURSPACE', - 'colour.models.RUSSELL_RGB_COLOURSPACE', + 'colour.polar_to_cartesian', + 'colour.algebra.polar_to_cartesian', ], [ - 'colour.S_GAMUT_COLOURSPACE', - 'colour.models.S_GAMUT_COLOURSPACE', + 'colour.print_numpy_errors', + 'colour.utilities.print_numpy_errors', ], [ - 'colour.S_GAMUT3_CINE_COLOURSPACE', - 'colour.models.S_GAMUT3_CINE_COLOURSPACE', + 'colour.raise_numpy_errors', + 'colour.utilities.raise_numpy_errors', ], [ - 'colour.S_GAMUT3_COLOURSPACE', - 'colour.models.S_GAMUT3_COLOURSPACE', + 'colour.random_triplet_generator', + 'colour.algebra.random_triplet_generator', ], [ - 'colour.SHARP_CAT', - 'colour.adaptation.SHARP_CAT', + 'colour.rayleigh_optical_depth', + 'colour.phenomena.rayleigh_optical_depth', ], [ - 'colour.Signal', - 'colour.continuous.Signal', + 'colour.reaction_rate_MichealisMenten', + 'colour.biochemistry.reaction_rate_MichealisMenten', ], [ - 'colour.SMITS_1999_SPDS', - 'colour.recovery.SMITS_1999_SDS', + 'colour.row_as_diagonal', + 'colour.utilities.row_as_diagonal', ], [ - 'colour.SMPTE_240M_COLOURSPACE', - 'colour.models.SMPTE_240M_COLOURSPACE', + 'colour.sRGB_COLOURSPACE', + 'colour.models.sRGB_COLOURSPACE', ], [ 'colour.sd_to_XYZ_ASTME30815', - 'colour.colorimetry.sd_to_XYZ_ASTME30815', + 'colour.colorimetry.sd_to_XYZ_ASTME308', ], [ 'colour.sd_to_XYZ_integration', 'colour.colorimetry.sd_to_XYZ_integration', ], [ - 'colour.spherical_to_cartesian', - 'colour.algebra.spherical_to_cartesian', - ], - [ - 'colour.sRGB_COLOURSPACE', - 'colour.models.sRGB_COLOURSPACE', + 'colour.sd_to_XYZ_tristimulus_weighting_factors_ASTME30815', + 'colour.colorimetry.sd_to_XYZ_tristimulus_weighting_factors_ASTME308', # noqa ], [ - 'colour.Structure', - 'colour.utilities.Structure', + 'colour.spherical_to_cartesian', + 'colour.algebra.spherical_to_cartesian', ], [ 'colour.substrate_concentration_MichealisMenten', 'colour.biochemistry.substrate_concentration_MichealisMenten', ], [ - 'colour.TCS_SPDS', - 'colour.quality.TCS_SDS', + 'colour.tristimulus_weighting_factors_ASTME2022', + 'colour.colorimetry.tristimulus_weighting_factors_ASTME2022', ], [ 'colour.tsplit', @@ -1371,18 +1489,6 @@ def __getattr__(self, attribute): 'colour.uv_to_CCT_Robertson1968', 'colour.temperature.uv_to_CCT_Robertson1968', ], - [ - 'colour.V_GAMUT_COLOURSPACE', - 'colour.models.V_GAMUT_COLOURSPACE', - ], - [ - 'colour.VON_KRIES_CAT', - 'colour.adaptation.VON_KRIES_CAT', - ], - [ - 'colour.VS_SPDS', - 'colour.quality.VS_SDS', - ], [ 'colour.warn_numpy_errors', 'colour.utilities.warn_numpy_errors', @@ -1415,10 +1521,6 @@ def __getattr__(self, attribute): 'colour.whiteness_Taube1960', 'colour.colorimetry.whiteness_Taube1960', ], - [ - 'colour.XTREME_RGB_COLOURSPACE', - 'colour.models.XTREME_RGB_COLOURSPACE', - ], [ 'colour.xy_to_CCT_Hernandez1999', 'colour.temperature.xy_to_CCT_Hernandez1999', @@ -1427,113 +1529,13 @@ def __getattr__(self, attribute): 'colour.xy_to_CCT_McCamy1992', 'colour.temperature.xy_to_CCT_McCamy1992', ], - [ - 'colour.XYZ_ColourMatchingFunctions', - 'colour.colorimetry.XYZ_ColourMatchingFunctions', - ], - [ - 'colour.XYZ_SCALING_CAT', - 'colour.adaptation.XYZ_SCALING_CAT', - ], - [ - 'colour.XYZ_to_sd_Meng2015', - 'colour.recovery.XYZ_to_sd_Meng2015', - ], [ 'colour.yellowness_ASTMD1925', 'colour.colorimetry.yellowness_ASTMD1925', ], [ 'colour.yellowness_ASTME313', - 'colour.colorimetry.yellowness_ASTME313' - ], - ], - 'Future Access Remove': [ - [ - 'colour.AbstractContinuousFunction', - 'colour.continuous.AbstractContinuousFunction', - ], - [ - 'colour.CAM16_InductionFactors', - 'colour.appearance.CAM16_InductionFactors', - ], - [ - 'colour.CIECAM02_InductionFactors', - 'colour.appearance.CIECAM02_InductionFactors', - ], - [ - 'colour.CMCCAT2000_InductionFactors', - 'colour.adaptation.CMCCAT2000_InductionFactors', - ], - [ - 'colour.CQS_Specification', - 'colour.quality.CQS_Specification', - ], - [ - 'colour.CRI_Specification', - 'colour.quality.CRI_Specification', - ], - [ - 'colour.ColourWarning', - 'colour.utilities.ColourWarning', - ], - [ - 'colour.FLOATING_POINT_NUMBER_PATTERN', - 'colour.constants.FLOATING_POINT_NUMBER_PATTERN', - ], - [ - 'colour.Hunt_InductionFactors', - 'colour.appearance.Hunt_InductionFactors', - ], - [ - 'colour.INTEGER_THRESHOLD', - 'colour.constants.INTEGER_THRESHOLD', - ], - [ - 'colour.LLAB_InductionFactors', - 'colour.appearance.LLAB_InductionFactors', - ], - [ - 'colour.LineSegmentsIntersections_Specification', - 'colour.algebra.LineSegmentsIntersections_Specification', - ], - [ - 'colour.XYZ_to_colourspace_model', - 'colour.models.XYZ_to_colourspace_model', - ], - [ - 'colour.adjust_tristimulus_weighting_factors_ASTME30815', - 'colour.colorimetry.' - 'adjust_tristimulus_weighting_factors_ASTME30815', - ], - [ - 'colour.chromatic_adaptation_forward_CMCCAT2000', - 'colour.adaptation.chromatic_adaptation_forward_CMCCAT2000', - ], - [ - 'colour.chromatic_adaptation_reverse_CMCCAT2000', - 'colour.adaptation.chromatic_adaptation_reverse_CMCCAT2000', - ], - [ - 'colour.extend_line_segment', - 'colour.algebra.extend_line_segment', - ], - [ - 'colour.intersect_line_segments', - 'colour.algebra.intersect_line_segments', - ], - [ - 'colour.lagrange_coefficients_ASTME202211', - 'colour.colorimetry.lagrange_coefficients_ASTME202211', - ], - [ - 'colour.sd_to_XYZ_tristimulus_weighting_factors_ASTME30815', - 'colour.colorimetry.' - 'sd_to_XYZ_tristimulus_weighting_factors_ASTME30815', - ], - [ - 'colour.tristimulus_weighting_factors_ASTME202211', - 'colour.colorimetry.tristimulus_weighting_factors_ASTME202211' + 'colour.colorimetry.yellowness_ASTME313', ], ] } @@ -1544,35 +1546,35 @@ def __getattr__(self, attribute): """ API_CHANGES.update({ - 'Removed': [ + 'ObjectRemoved': [ 'colour.DEFAULT_WAVELENGTH_DECIMALS', 'colour.ArbitraryPrecisionMapping', 'colour.SpectralMapping', ], - 'Renamed': [ + 'ObjectRenamed': [ [ 'colour.eotf_ARIBSTDB67', - 'colour.models.oetf_reverse_ARIBSTDB67', + 'colour.models.oetf_inverse_ARIBSTDB67', ], [ 'colour.eotf_BT709', - 'colour.models.oetf_reverse_BT709', + 'colour.models.oetf_inverse_BT709', ], [ 'colour.oetf_BT1886', - 'colour.models.eotf_reverse_BT1886', + 'colour.models.eotf_inverse_BT1886', ], [ 'colour.eotf_sRGB', - 'colour.models.oetf_reverse_sRGB', + 'colour.models.eotf_sRGB', ], [ 'colour.ALEXA_WIDE_GAMUT_RGB_COLOURSPACE', 'colour.models.ALEXA_WIDE_GAMUT_COLOURSPACE', ], [ - 'colour.NTSC_RGB_COLOURSPACE', - 'colour.models.NTSC_COLOURSPACE', + 'colour.NTSC_1953_RGB_COLOURSPACE', + 'colour.models.NTSC_1953_COLOURSPACE', ], [ 'colour.PAL_SECAM_RGB_COLOURSPACE', @@ -1592,13 +1594,13 @@ def __getattr__(self, attribute): ], [ 'colour.TriSpectralPowerDistribution', - 'colour.MultiSpectralDistribution', + 'colour.MultiSpectralDistributions', ], ] }) # v0.3.12 -API_CHANGES['Renamed'] = API_CHANGES['Renamed'] + [ +API_CHANGES['ObjectRenamed'] = API_CHANGES['ObjectRenamed'] + [ [ 'colour.CIE_standard_illuminant_A_function', 'colour.sd_CIE_standard_illuminant_A', @@ -1621,7 +1623,7 @@ def __getattr__(self, attribute): ], [ 'colour.MultiSpectralPowerDistribution', - 'colour.MultiSpectralDistribution', + 'colour.MultiSpectralDistributions', ], [ 'colour.REFLECTANCE_RECOVERY_METHODS', @@ -1701,49 +1703,76 @@ def __getattr__(self, attribute): ], ] - -def _setup_api_changes(): - """ - Setups *Colour* API changes. - """ - - global API_CHANGES - - for access_change in API_CHANGES['Future Access Change']: - old_access, new_access = access_change - API_CHANGES[old_access.split('.')[-1]] = ( - FutureAccessChange( # noqa - old_access, new_access)) - API_CHANGES.pop('Future Access Change') - - for access_remove in API_CHANGES['Future Access Remove']: - name, access = access_remove - API_CHANGES[name.split('.')[-1]] = ( - FutureAccessRemove( # noqa - name, access)) - API_CHANGES.pop('Future Access Remove') - - for removed in API_CHANGES['Removed']: - API_CHANGES[removed.split('.')[-1]] = Removed(removed) # noqa - API_CHANGES.pop('Removed') - - for renamed in API_CHANGES['Renamed']: - name, access = renamed - API_CHANGES[name.split('.')[-1]] = Renamed(name, access) # noqa - API_CHANGES.pop('Renamed') - +# v0.3.14 +API_CHANGES['ObjectRenamed'] = API_CHANGES['ObjectRenamed'] + [ + [ + 'colour.ASTME30815_PRACTISE_SHAPE', + 'colour.ASTME308_PRACTISE_SHAPE', + ], + [ + 'colour.decoding_cctf', + 'colour.cctf_decoding', + ], + [ + 'colour.DECODING_CCTFS', + 'colour.CCTF_DECODINGS', + ], + [ + 'colour.encoding_cctf', + 'colour.cctf_encoding', + ], + [ + 'colour.ENCODING_CCTFS', + 'colour.CCTF_ENCODINGS', + ], + [ + 'colour.EOTFS_REVERSE', + 'colour.EOTF_INVERSES', + ], + [ + 'colour.eotf_reverse', + 'colour.eotf_inverse', + ], + [ + 'colour.log_decoding_curve', + 'colour.log_decoding', + ], + [ + 'colour.LOG_DECODING_CURVES', + 'colour.LOG_DECODINGS', + ], + [ + 'colour.log_encoding_curve', + 'colour.log_encoding', + ], + [ + 'colour.LOG_ENCODING_CURVES', + 'colour.LOG_ENCODINGS', + ], + [ + 'colour.OETFS_REVERSE', + 'colour.OETF_INVERSES', + ], + [ + 'colour.oetf_reverse', + 'colour.oetf_inverse', + ], + [ + 'colour.OOTFS_REVERSE', + 'colour.OOTF_INVERSES', + ], + [ + 'colour.ootf_reverse', + 'colour.ootf_inverse', + ], + [ + 'colour.MultiSpectralDistribution', + 'colour.MultiSpectralDistributions', + ], +] if not is_documentation_building(): - _setup_api_changes() - - del FutureAccessChange - del FutureAccessRemove - del ModuleAPI - del Removed - del Renamed - del is_documentation_building - del _setup_api_changes - - sys.modules['colour'] = colour(sys.modules['colour'], API_CHANGES) + sys.modules['colour'] = colour(sys.modules['colour'], + build_API_changes(API_CHANGES)) - del sys + del ModuleAPI, is_documentation_building, build_API_changes, sys diff --git a/colour/adaptation/__init__.py b/colour/adaptation/__init__.py index b134b98c89..c0e9f241bd 100644 --- a/colour/adaptation/__init__.py +++ b/colour/adaptation/__init__.py @@ -23,22 +23,27 @@ from __future__ import absolute_import +import sys + +from colour.utilities.deprecation import ModuleAPI, build_API_changes +from colour.utilities.documentation import is_documentation_building + from colour.utilities import (CaseInsensitiveMapping, filter_kwargs, get_domain_range_scale, as_float_array) -from .dataset import * # noqa -from . import dataset +from .datasets import * # noqa +from . import datasets from .vonkries import (chromatic_adaptation_matrix_VonKries, chromatic_adaptation_VonKries) from .fairchild1990 import chromatic_adaptation_Fairchild1990 from .cmccat2000 import ( CMCCAT2000_InductionFactors, CMCCAT2000_VIEWING_CONDITIONS, chromatic_adaptation_forward_CMCCAT2000, - chromatic_adaptation_reverse_CMCCAT2000, chromatic_adaptation_CMCCAT2000) + chromatic_adaptation_inverse_CMCCAT2000, chromatic_adaptation_CMCCAT2000) from .cie1994 import chromatic_adaptation_CIE1994 __all__ = [] -__all__ += dataset.__all__ +__all__ += datasets.__all__ __all__ += [ 'chromatic_adaptation_matrix_VonKries', 'chromatic_adaptation_VonKries' ] @@ -46,7 +51,7 @@ __all__ += [ 'CMCCAT2000_InductionFactors', 'CMCCAT2000_VIEWING_CONDITIONS', 'chromatic_adaptation_forward_CMCCAT2000', - 'chromatic_adaptation_reverse_CMCCAT2000', + 'chromatic_adaptation_inverse_CMCCAT2000', 'chromatic_adaptation_CMCCAT2000' ] __all__ += ['chromatic_adaptation_CIE1994'] @@ -111,7 +116,7 @@ def chromatic_adaptation(XYZ, XYZ_w, XYZ_wr, method='Von Kries', **kwargs): domain [0.18, 1] in **'Reference'** domain-range scale. direction : unicode, optional {:func:`colour.adaptation.chromatic_adaptation_CMCCAT2000`}, - **{'Forward', 'Reverse'}**, + **{'Forward', 'Inverse'}**, Chromatic adaptation direction. discount_illuminant : bool, optional {:func:`colour.adaptation.chromatic_adaptation_Fairchild1990`}, @@ -239,3 +244,31 @@ def chromatic_adaptation(XYZ, XYZ_w, XYZ_wr, method='Von Kries', **kwargs): __all__ += ['CHROMATIC_ADAPTATION_METHODS', 'chromatic_adaptation'] + + +# ----------------------------------------------------------------------------# +# --- API Changes and Deprecation Management ---# +# ----------------------------------------------------------------------------# +class adaptation(ModuleAPI): + def __getattr__(self, attribute): + return super(adaptation, self).__getattr__(attribute) + + +# v0.3.14 +API_CHANGES = { + 'ObjectRenamed': [[ + 'colour.adaptation.chromatic_adaptation_reverse_CMCCAT2000', + 'colour.adaptation.chromatic_adaptation_inverse_CMCCAT2000', + ], ] +} +""" +Defines *colour.adaptation* sub-package API changes. + +API_CHANGES : dict +""" + +if not is_documentation_building(): + sys.modules['colour.adaptation'] = adaptation( + sys.modules['colour.adaptation'], build_API_changes(API_CHANGES)) + + del ModuleAPI, is_documentation_building, build_API_changes, sys diff --git a/colour/adaptation/cmccat2000.py b/colour/adaptation/cmccat2000.py index 16a66c16d1..fbab34f3c1 100644 --- a/colour/adaptation/cmccat2000.py +++ b/colour/adaptation/cmccat2000.py @@ -8,7 +8,7 @@ - :class:`colour.adaptation.CMCCAT2000_InductionFactors` - :class:`colour.CMCCAT2000_VIEWING_CONDITIONS` - :func:`colour.adaptation.chromatic_adaptation_forward_CMCCAT2000` -- :func:`colour.adaptation.chromatic_adaptation_reverse_CMCCAT2000` +- :func:`colour.adaptation.chromatic_adaptation_inverse_CMCCAT2000` - :func:`colour.adaptation.chromatic_adaptation_CMCCAT2000` See Also @@ -46,7 +46,7 @@ __all__ = [ 'CMCCAT2000_INVERSE_CAT', 'CMCCAT2000_InductionFactors', 'CMCCAT2000_VIEWING_CONDITIONS', 'chromatic_adaptation_forward_CMCCAT2000', - 'chromatic_adaptation_reverse_CMCCAT2000', + 'chromatic_adaptation_inverse_CMCCAT2000', 'chromatic_adaptation_CMCCAT2000' ] @@ -182,7 +182,7 @@ def chromatic_adaptation_forward_CMCCAT2000( return from_range_100(XYZ_c) -def chromatic_adaptation_reverse_CMCCAT2000( +def chromatic_adaptation_inverse_CMCCAT2000( XYZ_c, XYZ_w, XYZ_wr, @@ -192,7 +192,7 @@ def chromatic_adaptation_reverse_CMCCAT2000( """ Adapts given stimulus corresponding colour *CIE XYZ* tristimulus values from reference viewing conditions to test viewing conditions using - *CMCCAT2000* reverse chromatic adaptation model. + *CMCCAT2000* inverse chromatic adaptation model. Parameters ---------- @@ -245,7 +245,7 @@ def chromatic_adaptation_reverse_CMCCAT2000( >>> XYZ_wr = np.array([94.81, 100.00, 107.30]) >>> L_A1 = 200 >>> L_A2 = 200 - >>> chromatic_adaptation_reverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, L_A1, + >>> chromatic_adaptation_inverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, L_A1, ... L_A2) ... # doctest: +ELLIPSIS array([ 22.4839876..., 22.7419485..., 8.5393392...]) @@ -288,7 +288,7 @@ def chromatic_adaptation_CMCCAT2000( This definition is a convenient wrapper around :func:`colour.adaptation.chromatic_adaptation_forward_CMCCAT2000` and - :func:`colour.adaptation.chromatic_adaptation_reverse_CMCCAT2000`. + :func:`colour.adaptation.chromatic_adaptation_inverse_CMCCAT2000`. Parameters ---------- @@ -307,7 +307,7 @@ def chromatic_adaptation_CMCCAT2000( surround : CMCCAT2000_InductionFactors, optional Surround viewing conditions induction factors. direction : unicode, optional - **{'Forward', 'Reverse'}**, + **{'Forward', 'Inverse'}**, Chromatic adaptation direction. Returns @@ -350,7 +350,7 @@ def chromatic_adaptation_CMCCAT2000( ... # doctest: +ELLIPSIS array([ 19.5269832..., 23.0683396..., 24.9717522...]) - Using the *CMCCAT2000* reverse model: + Using the *CMCCAT2000* inverse model: >>> XYZ = np.array([19.52698326, 23.06833960, 24.97175229]) >>> XYZ_w = np.array([111.15, 100.00, 35.20]) @@ -358,7 +358,7 @@ def chromatic_adaptation_CMCCAT2000( >>> L_A1 = 200 >>> L_A2 = 200 >>> chromatic_adaptation_CMCCAT2000( - ... XYZ, XYZ_w, XYZ_wr, L_A1, L_A2, direction='Reverse') + ... XYZ, XYZ_w, XYZ_wr, L_A1, L_A2, direction='Inverse') ... # doctest: +ELLIPSIS array([ 22.48, 22.74, 8.54]) """ @@ -367,5 +367,5 @@ def chromatic_adaptation_CMCCAT2000( return chromatic_adaptation_forward_CMCCAT2000(XYZ, XYZ_w, XYZ_wr, L_A1, L_A2, surround) else: - return chromatic_adaptation_reverse_CMCCAT2000(XYZ, XYZ_w, XYZ_wr, + return chromatic_adaptation_inverse_CMCCAT2000(XYZ, XYZ_w, XYZ_wr, L_A1, L_A2, surround) diff --git a/colour/adaptation/dataset/__init__.py b/colour/adaptation/datasets/__init__.py similarity index 100% rename from colour/adaptation/dataset/__init__.py rename to colour/adaptation/datasets/__init__.py diff --git a/colour/adaptation/dataset/cat.py b/colour/adaptation/datasets/cat.py similarity index 100% rename from colour/adaptation/dataset/cat.py rename to colour/adaptation/datasets/cat.py diff --git a/colour/adaptation/tests/test_cmccat2000.py b/colour/adaptation/tests/test_cmccat2000.py index 84286898a1..ae977e1682 100644 --- a/colour/adaptation/tests/test_cmccat2000.py +++ b/colour/adaptation/tests/test_cmccat2000.py @@ -12,7 +12,7 @@ from colour.adaptation.cmccat2000 import ( chromatic_adaptation_forward_CMCCAT2000, - chromatic_adaptation_reverse_CMCCAT2000) + chromatic_adaptation_inverse_CMCCAT2000) from colour.utilities import domain_range_scale, ignore_numpy_errors @@ -25,7 +25,7 @@ __all__ = [ 'TestChromaticAdaptationForwardCMCCAT2000', - 'TestChromaticAdaptationReverseCMCCAT2000' + 'TestChromaticAdaptationInverseCMCCAT2000' ] @@ -156,20 +156,20 @@ def test_nan_chromatic_adaptation_forward_CMCCAT2000(self): L_A2) -class TestChromaticAdaptationReverseCMCCAT2000(unittest.TestCase): +class TestChromaticAdaptationInverseCMCCAT2000(unittest.TestCase): """ Defines :func:`colour.adaptation.cmccat2000.\ -chromatic_adaptation_reverse_CMCCAT2000` definition unit tests methods. +chromatic_adaptation_inverse_CMCCAT2000` definition unit tests methods. """ - def test_chromatic_adaptation_reverse_CMCCAT2000(self): + def test_chromatic_adaptation_inverse_CMCCAT2000(self): """ Tests :func:`colour.adaptation.cmccat2000.\ -chromatic_adaptation_reverse_CMCCAT2000` definition. +chromatic_adaptation_inverse_CMCCAT2000` definition. """ np.testing.assert_almost_equal( - chromatic_adaptation_reverse_CMCCAT2000( + chromatic_adaptation_inverse_CMCCAT2000( np.array([19.52698326, 23.06833960, 24.97175229]), np.array([111.15, 100.00, 35.20]), np.array([94.81, 100.00, 107.30]), 200, 200), @@ -177,7 +177,7 @@ def test_chromatic_adaptation_reverse_CMCCAT2000(self): decimal=7) np.testing.assert_almost_equal( - chromatic_adaptation_reverse_CMCCAT2000( + chromatic_adaptation_inverse_CMCCAT2000( np.array([17.90511171, 22.75299363, 3.79837384]), np.array([0.95045593, 1.00000000, 1.08905775]) * 100, np.array([1.09846607, 1.00000000, 0.35582280]) * 100, 100, @@ -186,7 +186,7 @@ def test_chromatic_adaptation_reverse_CMCCAT2000(self): decimal=7) np.testing.assert_almost_equal( - chromatic_adaptation_reverse_CMCCAT2000( + chromatic_adaptation_inverse_CMCCAT2000( np.array([6.76564344, 5.86585763, 18.40577315]), np.array([0.95045593, 1.00000000, 1.08905775]) * 100, np.array([0.99144661, 1.00000000, 0.67315942]) * 100, 100, @@ -194,10 +194,10 @@ def test_chromatic_adaptation_reverse_CMCCAT2000(self): np.array([0.07818780, 0.06157201, 0.28099326]) * 100, decimal=7) - def test_n_dimensional_chromatic_adaptation_reverse_CMCCAT2000(self): + def test_n_dimensional_chromatic_adaptation_inverse_CMCCAT2000(self): """ Tests :func:`colour.adaptation.cmccat2000.\ -chromatic_adaptation_reverse_CMCCAT2000` definition n-dimensional arrays +chromatic_adaptation_inverse_CMCCAT2000` definition n-dimensional arrays support. """ @@ -206,13 +206,13 @@ def test_n_dimensional_chromatic_adaptation_reverse_CMCCAT2000(self): XYZ_wr = np.array([94.81, 100.00, 107.30]) L_A1 = 200 L_A2 = 200 - XYZ = chromatic_adaptation_reverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, + XYZ = chromatic_adaptation_inverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, L_A1, L_A2) XYZ_c = np.tile(XYZ_c, (6, 1)) XYZ = np.tile(XYZ, (6, 1)) np.testing.assert_almost_equal( - chromatic_adaptation_reverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, L_A1, + chromatic_adaptation_inverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, L_A1, L_A2), XYZ, decimal=7) @@ -222,7 +222,7 @@ def test_n_dimensional_chromatic_adaptation_reverse_CMCCAT2000(self): L_A1 = np.tile(L_A1, 6) L_A2 = np.tile(L_A2, 6) np.testing.assert_almost_equal( - chromatic_adaptation_reverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, L_A1, + chromatic_adaptation_inverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, L_A1, L_A2), XYZ, decimal=7) @@ -234,7 +234,7 @@ def test_n_dimensional_chromatic_adaptation_reverse_CMCCAT2000(self): L_A2 = np.reshape(L_A2, (2, 3)) XYZ = np.reshape(XYZ, (2, 3, 3)) np.testing.assert_almost_equal( - chromatic_adaptation_reverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, L_A1, + chromatic_adaptation_inverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, L_A1, L_A2), XYZ, decimal=7) @@ -242,7 +242,7 @@ def test_n_dimensional_chromatic_adaptation_reverse_CMCCAT2000(self): def test_domain_range_scale_chromatic_adaptation_CMCCAT2000(self): """ Tests :func:`colour.adaptation.cmccat2000.\ -chromatic_adaptation_reverse_CMCCAT2000` definition domain and range scale +chromatic_adaptation_inverse_CMCCAT2000` definition domain and range scale support. """ @@ -251,24 +251,24 @@ def test_domain_range_scale_chromatic_adaptation_CMCCAT2000(self): XYZ_wr = np.array([94.81, 100.00, 107.30]) L_A1 = 200 L_A2 = 200 - XYZ = chromatic_adaptation_reverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, + XYZ = chromatic_adaptation_inverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, L_A1, L_A2) d_r = (('reference', 1), (1, 0.01), (100, 1)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - chromatic_adaptation_reverse_CMCCAT2000( + chromatic_adaptation_inverse_CMCCAT2000( XYZ_c * factor, XYZ_w * factor, XYZ_wr * factor, L_A1, L_A2), XYZ * factor, decimal=7) @ignore_numpy_errors - def test_nan_chromatic_adaptation_reverse_CMCCAT2000(self): + def test_nan_chromatic_adaptation_inverse_CMCCAT2000(self): """ Tests :func:`colour.adaptation.cmccat2000.\ -chromatic_adaptation_reverse_CMCCAT2000` definition nan support. +chromatic_adaptation_inverse_CMCCAT2000` definition nan support. """ cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -279,7 +279,7 @@ def test_nan_chromatic_adaptation_reverse_CMCCAT2000(self): XYZ_wr = np.array(case) L_A1 = case[0] L_A2 = case[0] - chromatic_adaptation_reverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, L_A1, + chromatic_adaptation_inverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, L_A1, L_A2) diff --git a/colour/adaptation/tests/test_fairchild1990.py b/colour/adaptation/tests/test_fairchild1990.py index 5bfd988c35..6c28352c60 100644 --- a/colour/adaptation/tests/test_fairchild1990.py +++ b/colour/adaptation/tests/test_fairchild1990.py @@ -131,10 +131,7 @@ def test_nan_chromatic_adaptation_Fairchild1990(self): XYZ_n = np.array(case) XYZ_r = np.array(case) Y_n = case[0] - try: - chromatic_adaptation_Fairchild1990(XYZ_1, XYZ_n, XYZ_r, Y_n) - except np.linalg.linalg.LinAlgError: - pass + chromatic_adaptation_Fairchild1990(XYZ_1, XYZ_n, XYZ_r, Y_n) if __name__ == '__main__': diff --git a/colour/adaptation/tests/test_vonkries.py b/colour/adaptation/tests/test_vonkries.py index 4db203f22d..d8645d3e71 100644 --- a/colour/adaptation/tests/test_vonkries.py +++ b/colour/adaptation/tests/test_vonkries.py @@ -9,6 +9,7 @@ import numpy as np import unittest from itertools import permutations +from functools import partial from colour.adaptation import (chromatic_adaptation_matrix_VonKries, chromatic_adaptation_VonKries) @@ -106,6 +107,19 @@ def test_chromatic_adaptation_matrix_VonKries(self): ]), decimal=7) + def test_raise_exception_chromatic_adaptation_matrix_VonKries(self): + """ + Tests :func:`colour.adaptation.vonkries.\ +chromatic_adaptation_matrix_VonKries` definition raised exception. + """ + + self.assertRaises( + KeyError, + partial(chromatic_adaptation_matrix_VonKries, + np.array([0.95045593, 1.00000000, 1.08905775]), + np.array([0.96429568, 1.00000000, 0.82510460]), + 'Undefined')) + def test_n_dimensional_chromatic_adaptation_matrix_VonKries(self): """ Tests :func:`colour.adaptation.vonkries.\ diff --git a/colour/algebra/common.py b/colour/algebra/common.py index 98231fd76f..2fc5bd141a 100644 --- a/colour/algebra/common.py +++ b/colour/algebra/common.py @@ -130,8 +130,10 @@ def spow(a, p): Raises given array :math:`a` to the power :math:`p` as follows: :math:`sign(a) * |a|^p`. - This avoids NaNs generation when array :math:`a` is negative and the power - :math:`p` is fractional. + This definition avoids NaNs generation when array :math:`a` is negative and + the power :math:`p` is fractional. This behaviour can be enabled or + disabled with the :func:`colour.algebra.set_spow_enable` definition or with + the :func:`spow_enable` context manager. Parameters ---------------- diff --git a/colour/algebra/interpolation.py b/colour/algebra/interpolation.py index a6ec690b17..4dd39fc78a 100644 --- a/colour/algebra/interpolation.py +++ b/colour/algebra/interpolation.py @@ -64,8 +64,12 @@ import itertools import numpy as np import scipy.interpolate -from collections import OrderedDict, Mapping from six.moves import reduce +from collections import OrderedDict +try: # pragma: no cover + from collections import Mapping +except ImportError: # pragma: no cover + from collections.abc import Mapping from colour.constants import DEFAULT_FLOAT_DTYPE, DEFAULT_INT_DTYPE from colour.utilities import (CaseInsensitiveMapping, as_float_array, as_float, @@ -1581,7 +1585,7 @@ def vertices_and_relative_coordinates(V_xyz, table): >>> import colour >>> path = os.path.join( ... os.path.dirname(__file__),'..', 'io', 'luts', 'tests', 'resources', - ... 'iridas_cube', 'ColourCorrect.cube') + ... 'iridas_cube', 'Colour_Correct.cube') >>> LUT = colour.read_LUT(path) >>> table = LUT.table >>> prng = np.random.RandomState(4) @@ -1684,7 +1688,7 @@ def table_interpolation_trilinear(V_xyz, table): >>> import colour >>> path = os.path.join( ... os.path.dirname(__file__),'..', 'io', 'luts', 'tests', 'resources', - ... 'iridas_cube', 'ColourCorrect.cube') + ... 'iridas_cube', 'Colour_Correct.cube') >>> LUT = colour.read_LUT(path) >>> table = LUT.table >>> prng = np.random.RandomState(4) @@ -1744,7 +1748,7 @@ def table_interpolation_tetrahedral(V_xyz, table): >>> import colour >>> path = os.path.join( ... os.path.dirname(__file__),'..', 'io', 'luts', 'tests', 'resources', - ... 'iridas_cube', 'ColourCorrect.cube') + ... 'iridas_cube', 'Colour_Correct.cube') >>> LUT = colour.read_LUT(path) >>> table = LUT.table >>> prng = np.random.RandomState(4) @@ -1834,7 +1838,7 @@ def table_interpolation(V_xyz, table, method='Trilinear'): >>> import colour >>> path = os.path.join( ... os.path.dirname(__file__),'..', 'io', 'luts', 'tests', 'resources', - ... 'iridas_cube', 'ColourCorrect.cube') + ... 'iridas_cube', 'Colour_Correct.cube') >>> LUT = colour.read_LUT(path) >>> table = LUT.table >>> prng = np.random.RandomState(4) diff --git a/colour/algebra/tests/test_common.py b/colour/algebra/tests/test_common.py index c5f62ec547..5971de09f4 100644 --- a/colour/algebra/tests/test_common.py +++ b/colour/algebra/tests/test_common.py @@ -75,6 +75,26 @@ def test_spow_enable(self): with spow_enable(False): self.assertFalse(is_spow_enabled()) + @spow_enable(True) + def fn_a(): + """ + :func:`spow_enable` unit tests :func:`fn_a` definition. + """ + + self.assertTrue(is_spow_enabled()) + + fn_a() + + @spow_enable(False) + def fn_b(): + """ + :func:`spow_enable` unit tests :func:`fn_b` definition. + """ + + self.assertFalse(is_spow_enabled()) + + fn_b() + class TestSpow(unittest.TestCase): """ diff --git a/colour/algebra/tests/test_extrapolation.py b/colour/algebra/tests/test_extrapolation.py index 75ed988296..392001d0fb 100644 --- a/colour/algebra/tests/test_extrapolation.py +++ b/colour/algebra/tests/test_extrapolation.py @@ -46,10 +46,57 @@ def test_required_methods(self): required_methods = () - for method in required_methods: + for method in required_methods: # pragma: no cover self.assertIn(method, dir(Extrapolator)) - def test___call__(self): + def test_interpolator(self): + """ + Tests :func:`colour.algebra.extrapolation.Extrapolator.interpolator` + property. + """ + + extrapolator = Extrapolator( + LinearInterpolator(np.array([5, 6, 7]), np.array([5, 6, 7]))) + self.assertIsInstance(extrapolator.interpolator, LinearInterpolator) + + def test_method(self): + """ + Tests :func:`colour.algebra.extrapolation.Extrapolator.method` + property. + """ + + extrapolator = Extrapolator( + LinearInterpolator(np.array([5, 6, 7]), np.array([5, 6, 7]))) + self.assertEqual(extrapolator.method, 'linear') + + extrapolator = Extrapolator( + LinearInterpolator(np.array([5, 6, 7]), np.array([5, 6, 7])), + method='Constant') + self.assertEqual(extrapolator.method, 'constant') + + def test_left(self): + """ + Tests :func:`colour.algebra.extrapolation.Extrapolator.left` + property. + """ + + extrapolator = Extrapolator( + LinearInterpolator(np.array([5, 6, 7]), np.array([5, 6, 7])), + left=0) + self.assertEqual(extrapolator.left, 0) + + def test_right(self): + """ + Tests :func:`colour.algebra.extrapolation.Extrapolator.right` + property. + """ + + extrapolator = Extrapolator( + LinearInterpolator(np.array([5, 6, 7]), np.array([5, 6, 7])), + right=0) + self.assertEqual(extrapolator.right, 0) + + def test__call__(self): """ Tests :func:`colour.algebra.extrapolation.Extrapolator.__call__` method. diff --git a/colour/algebra/tests/test_interpolation.py b/colour/algebra/tests/test_interpolation.py index 9c8c4a5f57..82b6b7c489 100644 --- a/colour/algebra/tests/test_interpolation.py +++ b/colour/algebra/tests/test_interpolation.py @@ -19,10 +19,10 @@ from colour.algebra.interpolation import vertices_and_relative_coordinates from colour.algebra import ( kernel_nearest_neighbour, kernel_linear, kernel_sinc, kernel_lanczos, - kernel_cardinal_spline, KernelInterpolator, LinearInterpolator, - SpragueInterpolator, CubicSplineInterpolator, PchipInterpolator, - NullInterpolator, lagrange_coefficients, table_interpolation_trilinear, - table_interpolation_tetrahedral) + kernel_cardinal_spline, KernelInterpolator, NearestNeighbourInterpolator, + LinearInterpolator, SpragueInterpolator, CubicSplineInterpolator, + PchipInterpolator, NullInterpolator, lagrange_coefficients, + table_interpolation_trilinear, table_interpolation_tetrahedral) from colour.algebra import random_triplet_generator from colour.io import read_LUT from colour.utilities import ignore_numpy_errors @@ -156,7 +156,7 @@ LUT_TABLE = read_LUT( os.path.join( os.path.dirname(__file__), '..', '..', 'io', 'luts', 'tests', - 'resources', 'iridas_cube', 'ColourCorrect.cube')).table + 'resources', 'iridas_cube', 'Colour_Correct.cube')).table class TestKernelNearestNeighbour(unittest.TestCase): @@ -332,10 +332,92 @@ def test_required_methods(self): required_methods = () - for method in required_methods: + for method in required_methods: # pragma: no cover self.assertIn(method, dir(KernelInterpolator)) - def test___call__(self): + def test_x(self): + """ + Tests :func:`colour.algebra.interpolation.KernelInterpolator.x` + property. + """ + + x = y = np.linspace(0, 1, 10) + kernel_interpolator = KernelInterpolator(x, y) + + np.testing.assert_equal(kernel_interpolator.x, x) + + def test_y(self): + """ + Tests :func:`colour.algebra.interpolation.KernelInterpolator.y` + property. + """ + + x = y = np.linspace(0, 1, 10) + kernel_interpolator = KernelInterpolator(x, y) + + np.testing.assert_equal(kernel_interpolator.y, y) + + def test_window(self): + """ + Tests :func:`colour.algebra.interpolation.KernelInterpolator.window` + property. + """ + + x = y = np.linspace(0, 1, 10) + kernel_interpolator = KernelInterpolator(x, y, window=3) + + self.assertEqual(kernel_interpolator.window, 3) + + def test_kernel(self): + """ + Tests :func:`colour.algebra.interpolation.KernelInterpolator.kernel` + property. + """ + + x = y = np.linspace(0, 1, 10) + kernel_interpolator = KernelInterpolator(x, y, kernel=kernel_linear) + + self.assertIs(kernel_interpolator.kernel, kernel_linear) + + def test_kernel_args(self): + """ + Tests :func:`colour.algebra.interpolation.KernelInterpolator.\ +kernel_args` property. + """ + + x = y = np.linspace(0, 1, 10) + kernel_args = {'a': 1} + kernel_interpolator = KernelInterpolator(x, y, kernel_args=kernel_args) + + self.assertDictEqual(kernel_interpolator.kernel_args, kernel_args) + + def test_padding_args(self): + """ + Tests :func:`colour.algebra.interpolation.KernelInterpolator.\ +padding_args` property. + """ + + x = y = np.linspace(0, 1, 10) + padding_args = {'pad_width': (3, 3), 'mode': 'mean'} + kernel_interpolator = KernelInterpolator( + x, y, padding_args=padding_args) + + self.assertDictEqual(kernel_interpolator.padding_args, padding_args) + + def test_raise_exception___init__(self): + """ + Tests :func:`colour.algebra.interpolation.KernelInterpolator.__init__` + method raised exception. + """ + + self.assertRaises( + ValueError, + KernelInterpolator, + np.linspace(0, 1, 10), + np.linspace(0, 1, 15), + ) + + def test__call__(self): """ Tests :func:`colour.algebra.interpolation.KernelInterpolator.__call__` method. @@ -426,6 +508,19 @@ def test___call__(self): KernelInterpolator(x_3, y)(x_i / 10), decimal=7) + def test_raise_exception___call__(self): + """ + Tests :func:`colour.algebra.interpolation.KernelInterpolator.__call__` + method raised exception. + """ + + x = y = np.linspace(0, 1, 10) + kernel_interpolator = KernelInterpolator(x, y) + + self.assertRaises(ValueError, kernel_interpolator, -1) + + self.assertRaises(ValueError, kernel_interpolator, 11) + @ignore_numpy_errors def test_nan__call__(self): """ @@ -441,6 +536,45 @@ def test_nan__call__(self): pass +class TestNearestNeighbourInterpolator(unittest.TestCase): + """ + Defines :func:`colour.algebra.interpolation.NearestNeighbourInterpolator` + class units tests methods. + """ + + def test_required_attributes(self): + """ + Tests presence of required attributes. + """ + + required_attributes = () + + for attribute in required_attributes: # pragma: no cover + self.assertIn(attribute, dir(NearestNeighbourInterpolator)) + + def test_required_methods(self): + """ + Tests presence of required methods. + """ + + required_methods = () + + for method in required_methods: # pragma: no cover + self.assertIn(method, dir(NearestNeighbourInterpolator)) + + def test___init__(self): + """ + Tests :func:`colour.algebra.interpolation.KernelInterpolator.__init__` + method. + """ + + x = y = np.linspace(0, 1, 10) + nearest_neighbour_interpolator = NearestNeighbourInterpolator( + x, y, kernel_args={'a': 1}) + + self.assertDictEqual(nearest_neighbour_interpolator.kernel_args, {}) + + class TestLinearInterpolator(unittest.TestCase): """ Defines :func:`colour.algebra.interpolation.LinearInterpolator` class units @@ -464,10 +598,19 @@ def test_required_methods(self): required_methods = () - for method in required_methods: + for method in required_methods: # pragma: no cover self.assertIn(method, dir(LinearInterpolator)) - def test___call__(self): + def test_raise_exception___init__(self): + """ + Tests :func:`colour.algebra.interpolation.LinearInterpolator.__init__` + method raised exception. + """ + + x, y = np.linspace(0, 1, 10), np.linspace(0, 1, 15) + self.assertRaises(ValueError, LinearInterpolator, x, y) + + def test__call__(self): """ Tests :func:`colour.algebra.interpolation.LinearInterpolator.__call__` method. @@ -491,6 +634,19 @@ def test___call__(self): len(POINTS_DATA_A) - 1 + interval, interval)), LINEAR_INTERPOLATED_POINTS_DATA_A_10_SAMPLES) + def test_raise_exception___call__(self): + """ + Tests :func:`colour.algebra.interpolation.LinearInterpolator.__call__` + method raised exception. + """ + + x = y = np.linspace(0, 1, 10) + linear_interpolator = LinearInterpolator(x, y) + + self.assertRaises(ValueError, linear_interpolator, -1) + + self.assertRaises(ValueError, linear_interpolator, 11) + @ignore_numpy_errors def test_nan__call__(self): """ @@ -532,10 +688,19 @@ def test_required_methods(self): required_methods = () - for method in required_methods: + for method in required_methods: # pragma: no cover self.assertIn(method, dir(SpragueInterpolator)) - def test___call__(self): + def test_raise_exception___init__(self): + """ + Tests :func:`colour.algebra.interpolation.SpragueInterpolator.__init__` + method raised exception. + """ + + x, y = np.linspace(0, 1, 10), np.linspace(0, 1, 15) + self.assertRaises(ValueError, SpragueInterpolator, x, y) + + def test__call__(self): """ Tests :func:`colour.algebra.interpolation.SpragueInterpolator.__call__` method. @@ -559,6 +724,19 @@ def test___call__(self): len(POINTS_DATA_A) - 1 + interval, interval)), SPRAGUE_INTERPOLATED_POINTS_DATA_A_10_SAMPLES) + def test_raise_exception___call__(self): + """ + Tests :func:`colour.algebra.interpolation.SpragueInterpolator.__call__` + method raised exception. + """ + + x = y = np.linspace(0, 1, 10) + sprague_interpolator = SpragueInterpolator(x, y) + + self.assertRaises(ValueError, sprague_interpolator, -1) + + self.assertRaises(ValueError, sprague_interpolator, 11) + @ignore_numpy_errors def test_nan__call__(self): """ @@ -572,7 +750,7 @@ def test_nan__call__(self): try: sprague_interpolator = SpragueInterpolator( np.array(case), np.array(case)) - sprague_interpolator(case[0]) + sprague_interpolator(case[0]) # pragma: no cover except AssertionError: pass @@ -583,7 +761,7 @@ class TestCubicSplineInterpolator(unittest.TestCase): unit tests methods. """ - def test___call__(self): + def test__call__(self): """ Tests :func:`colour.algebra.interpolation.\ CubicSplineInterpolator.__call__` method. @@ -625,7 +803,7 @@ def test_required_methods(self): required_methods = () - for method in required_methods: + for method in required_methods: # pragma: no cover self.assertIn(method, dir(PchipInterpolator)) @@ -652,10 +830,74 @@ def test_required_methods(self): required_methods = () - for method in required_methods: + for method in required_methods: # pragma: no cover self.assertIn(method, dir(NullInterpolator)) - def test___call__(self): + def test_x(self): + """ + Tests :func:`colour.algebra.interpolation.NullInterpolator.x` + property. + """ + + x = y = np.linspace(0, 1, 10) + null_interpolator = NullInterpolator(x, y) + + np.testing.assert_equal(null_interpolator.x, x) + + def test_y(self): + """ + Tests :func:`colour.algebra.interpolation.NullInterpolator.y` + property. + """ + + x = y = np.linspace(0, 1, 10) + null_interpolator = NullInterpolator(x, y) + + np.testing.assert_equal(null_interpolator.y, y) + + def test_absolute_tolerance(self): + """ + Tests :func:`colour.algebra.interpolation.NullInterpolator.\ + absolute_tolerance` property. + """ + + x = y = np.linspace(0, 1, 10) + null_interpolator = NullInterpolator(x, y, absolute_tolerance=0.1) + + np.testing.assert_equal(null_interpolator.absolute_tolerance, 0.1) + + def test_relative_tolerance(self): + """ + Tests :func:`colour.algebra.interpolation.NullInterpolator.\ + relative_tolerance` property. + """ + + x = y = np.linspace(0, 1, 10) + null_interpolator = NullInterpolator(x, y, relative_tolerance=0.1) + + np.testing.assert_equal(null_interpolator.relative_tolerance, 0.1) + + def test_default(self): + """ + Tests :func:`colour.algebra.interpolation.NullInterpolator.\ + default` property. + """ + + x = y = np.linspace(0, 1, 10) + null_interpolator = NullInterpolator(x, y, default=0) + + np.testing.assert_equal(null_interpolator.default, 0) + + def test_raise_exception___init__(self): + """ + Tests :func:`colour.algebra.interpolation.NullInterpolator.__init__` + method raised exception. + """ + + x, y = np.linspace(0, 1, 10), np.linspace(0, 1, 15) + self.assertRaises(ValueError, NullInterpolator, x, y) + + def test__call__(self): """ Tests :func:`colour.algebra.interpolation.NullInterpolator.__call__` method. @@ -672,6 +914,19 @@ def test___call__(self): null_interpolator(np.array([0.75, 2.0, 3.0, 4.75])), np.array([12.32, 12.46, 9.51, 4.33])) + def test_raise_exception___call__(self): + """ + Tests :func:`colour.algebra.interpolation.NullInterpolator.__call__` + method raised exception. + """ + + x = y = np.linspace(0, 1, 10) + null_interpolator = NullInterpolator(x, y) + + self.assertRaises(ValueError, null_interpolator, -1) + + self.assertRaises(ValueError, null_interpolator, 11) + @ignore_numpy_errors def test_nan__call__(self): """ diff --git a/colour/algebra/tests/test_random.py b/colour/algebra/tests/test_random.py index 009e4ca5bf..8e6cdcd9ec 100644 --- a/colour/algebra/tests/test_random.py +++ b/colour/algebra/tests/test_random.py @@ -59,6 +59,9 @@ def test_random_triplet_generator(self): random_triplet_generator(10, random_state=prng), decimal=7) + # TODO: Use "assertWarns" when dropping Python 2.7. + random_triplet_generator(5.5, random_state=prng) + if __name__ == '__main__': unittest.main() diff --git a/colour/appearance/cam16.py b/colour/appearance/cam16.py index 711d431837..0ccb06d8cd 100644 --- a/colour/appearance/cam16.py +++ b/colour/appearance/cam16.py @@ -33,14 +33,14 @@ from colour.algebra import spow from colour.appearance.ciecam02 import ( CIECAM02_VIEWING_CONDITIONS, P, achromatic_response_forward, - achromatic_response_reverse, brightness_correlate, chroma_correlate, + achromatic_response_inverse, brightness_correlate, chroma_correlate, colourfulness_correlate, degree_of_adaptation, eccentricity_factor, hue_angle, hue_quadrature, lightness_correlate, - opponent_colour_dimensions_forward, opponent_colour_dimensions_reverse, + opponent_colour_dimensions_forward, opponent_colour_dimensions_inverse, post_adaptation_non_linear_response_compression_forward, - post_adaptation_non_linear_response_compression_reverse, + post_adaptation_non_linear_response_compression_inverse, post_adaptation_non_linear_response_compression_matrix, - saturation_correlate, temporary_magnitude_quantity_reverse, + saturation_correlate, temporary_magnitude_quantity_inverse, viewing_condition_dependent_parameters) from colour.utilities import (CaseInsensitiveMapping, as_float_array, as_namedtuple, dot_vector, from_range_100, @@ -207,9 +207,19 @@ def XYZ_to_CAM16(XYZ, +---------------------------+-----------------------+---------------+ | **Range** | **Scale - Reference** | **Scale - 1** | +===========================+=======================+===============+ - | ``CAM16_Specification.h`` | [0, 360] | [0, 1] | + | ``CAM16_specification.J`` | [0, 100] | [0, 1] | +---------------------------+-----------------------+---------------+ - | ``CAM16_Specification.H`` | [0, 360] | [0, 1] | + | ``CAM16_specification.C`` | [0, 100] | [0, 1] | + +---------------------------+-----------------------+---------------+ + | ``CAM16_specification.h`` | [0, 360] | [0, 1] | + +---------------------------+-----------------------+---------------+ + | ``CAM16_specification.s`` | [0, 100] | [0, 1] | + +---------------------------+-----------------------+---------------+ + | ``CAM16_specification.Q`` | [0, 100] | [0, 1] | + +---------------------------+-----------------------+---------------+ + | ``CAM16_specification.M`` | [0, 100] | [0, 1] | + +---------------------------+-----------------------+---------------+ + | ``CAM16_specification.H`` | [0, 360] | [0, 1] | +---------------------------+-----------------------+---------------+ References @@ -304,8 +314,10 @@ def XYZ_to_CAM16(XYZ, # Computing the correlate of *saturation* :math:`s`. s = saturation_correlate(M, Q) - return CAM16_Specification(J, C, from_range_degrees(h), s, Q, M, - from_range_degrees(H), None) + return CAM16_Specification( + from_range_100(J), from_range_100(C), from_range_degrees(h), + from_range_100(s), from_range_100(Q), from_range_100(M), + from_range_degrees(H), None) def CAM16_to_XYZ(CAM16_specification, @@ -315,9 +327,9 @@ def CAM16_to_XYZ(CAM16_specification, surround=CAM16_VIEWING_CONDITIONS['Average'], discount_illuminant=False): """ - Converts *CAM16* specification to *CIE XYZ* tristimulus values. + Converts from *CAM16* specification to *CIE XYZ* tristimulus values. - This is the *reverse* implementation. + This is the *inverse* implementation. Parameters ---------- @@ -355,8 +367,18 @@ def CAM16_to_XYZ(CAM16_specification, +---------------------------+-----------------------+---------------+ | **Domain** | **Scale - Reference** | **Scale - 1** | +===========================+=======================+===============+ + | ``CAM16_specification.J`` | [0, 100] | [0, 1] | + +---------------------------+-----------------------+---------------+ + | ``CAM16_specification.C`` | [0, 100] | [0, 1] | + +---------------------------+-----------------------+---------------+ | ``CAM16_specification.h`` | [0, 360] | [0, 1] | +---------------------------+-----------------------+---------------+ + | ``CAM16_specification.s`` | [0, 100] | [0, 1] | + +---------------------------+-----------------------+---------------+ + | ``CAM16_specification.Q`` | [0, 100] | [0, 1] | + +---------------------------+-----------------------+---------------+ + | ``CAM16_specification.M`` | [0, 100] | [0, 1] | + +---------------------------+-----------------------+---------------+ | ``CAM16_specification.H`` | [0, 360] | [0, 1] | +---------------------------+-----------------------+---------------+ | ``XYZ_w`` | [0, 100] | [0, 1] | @@ -389,9 +411,11 @@ def CAM16_to_XYZ(CAM16_specification, J, C, h, _s, _Q, M, _H, _HC = as_namedtuple(CAM16_specification, CAM16_Specification) - L_A = as_float_array(L_A) - + J = to_domain_100(J) + C = to_domain_100(C) if C is not None else C h = to_domain_degrees(h) + M = to_domain_100(M) if M is not None else M + L_A = as_float_array(L_A) XYZ_w = to_domain_100(XYZ_w) _X_w, Y_w, _Z_w = tsplit(XYZ_w) @@ -426,13 +450,13 @@ def CAM16_to_XYZ(CAM16_specification, # Step 2 # Computing temporary magnitude quantity :math:`t`. - t = temporary_magnitude_quantity_reverse(C, J, n) + t = temporary_magnitude_quantity_inverse(C, J, n) # Computing eccentricity factor *e_t*. e_t = eccentricity_factor(h) # Computing achromatic response :math:`A` for the stimulus. - A = achromatic_response_reverse(A_w, J, surround.c, z) + A = achromatic_response_inverse(A_w, J, surround.c, z) # Computing *P_1* to *P_3*. P_n = P(surround.N_c, N_cb, e_t, t, A, N_bb) @@ -440,15 +464,15 @@ def CAM16_to_XYZ(CAM16_specification, # Step 3 # Computing opponent colour dimensions :math:`a` and :math:`b`. - a, b = tsplit(opponent_colour_dimensions_reverse(P_n, h)) + a, b = tsplit(opponent_colour_dimensions_inverse(P_n, h)) # Step 4 # Computing post-adaptation non linear response compression matrix. RGB_a = post_adaptation_non_linear_response_compression_matrix(P_2, a, b) # Step 5 - # Applying reverse post-adaptation non linear response compression. - RGB_c = post_adaptation_non_linear_response_compression_reverse(RGB_a, F_L) + # Applying inverse post-adaptation non linear response compression. + RGB_c = post_adaptation_non_linear_response_compression_inverse(RGB_a, F_L) # Step 6 RGB = RGB_c / D_RGB diff --git a/colour/appearance/ciecam02.py b/colour/appearance/ciecam02.py index 2e36986e2e..0eb7e10f7b 100644 --- a/colour/appearance/ciecam02.py +++ b/colour/appearance/ciecam02.py @@ -62,16 +62,16 @@ 'CIECAM02_Specification', 'XYZ_to_CIECAM02', 'CIECAM02_to_XYZ', 'chromatic_induction_factors', 'base_exponential_non_linearity', 'viewing_condition_dependent_parameters', 'degree_of_adaptation', - 'full_chromatic_adaptation_forward', 'full_chromatic_adaptation_reverse', + 'full_chromatic_adaptation_forward', 'full_chromatic_adaptation_inverse', 'RGB_to_rgb', 'rgb_to_RGB', 'post_adaptation_non_linear_response_compression_forward', - 'post_adaptation_non_linear_response_compression_reverse', - 'opponent_colour_dimensions_forward', 'opponent_colour_dimensions_reverse', + 'post_adaptation_non_linear_response_compression_inverse', + 'opponent_colour_dimensions_forward', 'opponent_colour_dimensions_inverse', 'hue_angle', 'hue_quadrature', 'eccentricity_factor', - 'achromatic_response_forward', 'achromatic_response_reverse', + 'achromatic_response_forward', 'achromatic_response_inverse', 'lightness_correlate', 'brightness_correlate', 'temporary_magnitude_quantity_forward', - 'temporary_magnitude_quantity_reverse', 'chroma_correlate', + 'temporary_magnitude_quantity_inverse', 'chroma_correlate', 'colourfulness_correlate', 'saturation_correlate', 'P', 'post_adaptation_non_linear_response_compression_matrix' ] @@ -225,8 +225,18 @@ def XYZ_to_CIECAM02(XYZ, +------------------------------+-----------------------+---------------+ | **Range** | **Scale - Reference** | **Scale - 1** | +==============================+=======================+===============+ + | ``CIECAM02_specification.J`` | [0, 100] | [0, 1] | + +------------------------------+-----------------------+---------------+ + | ``CIECAM02_specification.C`` | [0, 100] | [0, 1] | + +------------------------------+-----------------------+---------------+ | ``CIECAM02_specification.h`` | [0, 360] | [0, 1] | +------------------------------+-----------------------+---------------+ + | ``CIECAM02_specification.s`` | [0, 100] | [0, 1] | + +------------------------------+-----------------------+---------------+ + | ``CIECAM02_specification.Q`` | [0, 100] | [0, 1] | + +------------------------------+-----------------------+---------------+ + | ``CIECAM02_specification.M`` | [0, 100] | [0, 1] | + +------------------------------+-----------------------+---------------+ | ``CIECAM02_specification.H`` | [0, 360] | [0, 1] | +------------------------------+-----------------------+---------------+ @@ -310,8 +320,10 @@ def XYZ_to_CIECAM02(XYZ, # Computing the correlate of *saturation* :math:`s`. s = saturation_correlate(M, Q) - return CIECAM02_Specification(J, C, from_range_degrees(h), s, Q, M, - from_range_degrees(H), None) + return CIECAM02_Specification( + from_range_100(J), from_range_100(C), from_range_degrees(h), + from_range_100(s), from_range_100(Q), from_range_100(M), + from_range_degrees(H), None) def CIECAM02_to_XYZ(CIECAM02_specification, @@ -321,9 +333,9 @@ def CIECAM02_to_XYZ(CIECAM02_specification, surround=CIECAM02_VIEWING_CONDITIONS['Average'], discount_illuminant=False): """ - Converts *CIECAM02* specification to *CIE XYZ* tristimulus values. + Converts from *CIECAM02* specification to *CIE XYZ* tristimulus values. - This is the *reverse* implementation. + This is the *inverse* implementation. Parameters ---------- @@ -365,8 +377,18 @@ def CIECAM02_to_XYZ(CIECAM02_specification, +------------------------------+-----------------------+---------------+ | **Domain** | **Scale - Reference** | **Scale - 1** | +==============================+=======================+===============+ + | ``CIECAM02_specification.J`` | [0, 100] | [0, 1] | + +------------------------------+-----------------------+---------------+ + | ``CIECAM02_specification.C`` | [0, 100] | [0, 1] | + +------------------------------+-----------------------+---------------+ | ``CIECAM02_specification.h`` | [0, 360] | [0, 1] | +------------------------------+-----------------------+---------------+ + | ``CIECAM02_specification.s`` | [0, 100] | [0, 1] | + +------------------------------+-----------------------+---------------+ + | ``CIECAM02_specification.Q`` | [0, 100] | [0, 1] | + +------------------------------+-----------------------+---------------+ + | ``CIECAM02_specification.M`` | [0, 100] | [0, 1] | + +------------------------------+-----------------------+---------------+ | ``CIECAM02_specification.H`` | [0, 360] | [0, 1] | +------------------------------+-----------------------+---------------+ | ``XYZ_w`` | [0, 100] | [0, 1] | @@ -400,9 +422,11 @@ def CIECAM02_to_XYZ(CIECAM02_specification, J, C, h, _s, _Q, M, _H, _HC = as_namedtuple(CIECAM02_specification, CIECAM02_Specification) - L_A = as_float_array(L_A) - + J = to_domain_100(J) + C = to_domain_100(C) if C is not None else C h = to_domain_degrees(h) + M = to_domain_100(M) if M is not None else M + L_A = as_float_array(L_A) XYZ_w = to_domain_100(XYZ_w) _X_w, Y_w, _Z_w = tsplit(XYZ_w) @@ -437,32 +461,32 @@ def CIECAM02_to_XYZ(CIECAM02_specification, A_w = achromatic_response_forward(RGB_aw, N_bb) # Computing temporary magnitude quantity :math:`t`. - t = temporary_magnitude_quantity_reverse(C, J, n) + t = temporary_magnitude_quantity_inverse(C, J, n) # Computing eccentricity factor *e_t*. e_t = eccentricity_factor(h) # Computing achromatic response :math:`A` for the stimulus. - A = achromatic_response_reverse(A_w, J, surround.c, z) + A = achromatic_response_inverse(A_w, J, surround.c, z) # Computing *P_1* to *P_3*. P_n = P(surround.N_c, N_cb, e_t, t, A, N_bb) _P_1, P_2, _P_3 = tsplit(P_n) # Computing opponent colour dimensions :math:`a` and :math:`b`. - a, b = tsplit(opponent_colour_dimensions_reverse(P_n, h)) + a, b = tsplit(opponent_colour_dimensions_inverse(P_n, h)) # Computing post-adaptation non linear response compression matrix. RGB_a = post_adaptation_non_linear_response_compression_matrix(P_2, a, b) - # Applying reverse post-adaptation non linear response compression. - RGB_p = post_adaptation_non_linear_response_compression_reverse(RGB_a, F_L) + # Applying inverse post-adaptation non linear response compression. + RGB_p = post_adaptation_non_linear_response_compression_inverse(RGB_a, F_L) # Converting to *Hunt-Pointer-Estevez* colourspace. RGB_c = rgb_to_RGB(RGB_p) - # Applying reverse full chromatic adaptation. - RGB = full_chromatic_adaptation_reverse(RGB_c, RGB_w, Y_w, D) + # Applying inverse full chromatic adaptation. + RGB = full_chromatic_adaptation_inverse(RGB_c, RGB_w, Y_w, D) # Converting *CMCCAT2000* transform sharpened *RGB* values to *CIE XYZ* # tristimulus values. @@ -639,7 +663,7 @@ def full_chromatic_adaptation_forward(RGB, RGB_w, Y_w, D): return RGB_c -def full_chromatic_adaptation_reverse(RGB, RGB_w, Y_w, D): +def full_chromatic_adaptation_inverse(RGB, RGB_w, Y_w, D): """ Reverts full chromatic adaptation of given *CMCCAT2000* transform sharpened *RGB* array using given *CMCCAT2000* transform sharpened whitepoint @@ -667,7 +691,7 @@ def full_chromatic_adaptation_reverse(RGB, RGB_w, Y_w, D): >>> RGB_w = np.array([94.930528, 103.536988, 108.717742]) >>> Y_w = 100.0 >>> D = 0.994468780088 - >>> full_chromatic_adaptation_reverse(RGB, RGB_w, Y_w, D) + >>> full_chromatic_adaptation_inverse(RGB, RGB_w, Y_w, D) array([ 18.985456, 20.707422, 21.747482]) """ @@ -776,7 +800,7 @@ def post_adaptation_non_linear_response_compression_forward(RGB, F_L): return RGB_c -def post_adaptation_non_linear_response_compression_reverse(RGB, F_L): +def post_adaptation_non_linear_response_compression_inverse(RGB, F_L): """ Returns given *CMCCAT2000* transform sharpened *RGB* array without post adaptation non linear response compression. @@ -797,7 +821,7 @@ def post_adaptation_non_linear_response_compression_reverse(RGB, F_L): -------- >>> RGB = np.array([7.94632020, 7.94711528, 7.94899595]) >>> F_L = 1.16754446415 - >>> post_adaptation_non_linear_response_compression_reverse(RGB, F_L) + >>> post_adaptation_non_linear_response_compression_inverse(RGB, F_L) ... # doctest: +ELLIPSIS array([ 19.9969397..., 20.0018612..., 20.0135052...]) """ @@ -844,10 +868,10 @@ def opponent_colour_dimensions_forward(RGB): return ab -def opponent_colour_dimensions_reverse(P_n, h): +def opponent_colour_dimensions_inverse(P_n, h): """ Returns opponent colour dimensions from given points :math:`P_n` and hue - :math:`h` in degrees for reverse *CIECAM02* implementation. + :math:`h` in degrees for inverse *CIECAM02* implementation. Parameters ---------- @@ -870,7 +894,7 @@ def opponent_colour_dimensions_reverse(P_n, h): -------- >>> P_n = np.array([30162.89081534, 24.23720547, 1.05000000]) >>> h = -140.95156734 - >>> opponent_colour_dimensions_reverse(P_n, h) # doctest: +ELLIPSIS + >>> opponent_colour_dimensions_inverse(P_n, h) # doctest: +ELLIPSIS array([-0.0006241..., -0.0005062...]) """ @@ -1063,12 +1087,12 @@ def achromatic_response_forward(RGB, N_bb): return A -def achromatic_response_reverse(A_w, J, c, z): +def achromatic_response_inverse(A_w, J, c, z): """ Returns the achromatic response :math:`A` from given achromatic response :math:`A_w` for the whitepoint, *Lightness* correlate :math:`J`, surround exponential non linearity :math:`c` and base exponential non linearity - :math:`z` for reverse *CIECAM02* implementation. + :math:`z` for inverse *CIECAM02* implementation. Parameters ---------- @@ -1092,7 +1116,7 @@ def achromatic_response_reverse(A_w, J, c, z): >>> J = 41.73109113251392 >>> c = 0.69 >>> z = 1.927213595499958 - >>> achromatic_response_reverse(A_w, J, c, z) # doctest: +ELLIPSIS + >>> achromatic_response_inverse(A_w, J, c, z) # doctest: +ELLIPSIS 23.9394809... """ @@ -1237,9 +1261,9 @@ def temporary_magnitude_quantity_forward(N_c, N_cb, e_t, a, b, RGB_a): return t -def temporary_magnitude_quantity_reverse(C, J, n): +def temporary_magnitude_quantity_inverse(C, J, n): """ - Returns the temporary magnitude quantity :math:`t`. for reverse *CIECAM02* + Returns the temporary magnitude quantity :math:`t`. for inverse *CIECAM02* implementation. Parameters @@ -1266,7 +1290,7 @@ def temporary_magnitude_quantity_reverse(C, J, n): >>> C = 68.8364136888275 >>> J = 41.749268505999 >>> n = 0.2 - >>> temporary_magnitude_quantity_reverse(C, J, n) # doctest: +ELLIPSIS + >>> temporary_magnitude_quantity_inverse(C, J, n) # doctest: +ELLIPSIS 202.3873619... """ diff --git a/colour/appearance/hunt.py b/colour/appearance/hunt.py index 7d31e5bb28..6f0d98038e 100644 --- a/colour/appearance/hunt.py +++ b/colour/appearance/hunt.py @@ -637,6 +637,18 @@ def chromatic_adaptation(XYZ, >>> F_L = 1.16754446415 >>> chromatic_adaptation(XYZ, XYZ_w, XYZ_b, L_A, F_L) # doctest: +ELLIPSIS array([ 6.8959454..., 6.8959991..., 6.8965708...]) + + # Coverage Doctests + + >>> chromatic_adaptation(XYZ, XYZ_w, XYZ_b, L_A, F_L, + ... discount_illuminant=False) # doctest: +ELLIPSIS + array([ 6.8525880..., 6.8874417..., 6.9461478...]) + >>> chromatic_adaptation(XYZ, XYZ_w, XYZ_b, L_A, F_L, + ... helson_judd_effect=True) # doctest: +ELLIPSIS + array([ 6.8959454..., 6.8959991..., 6.8965708...]) + >>> chromatic_adaptation(XYZ, XYZ_w, XYZ_b, L_A, F_L, + ... XYZ_p=XYZ_b, p=0.5) # doctest: +ELLIPSIS + array([ 9.2069020..., 9.2070219..., 9.2078373...]) """ XYZ_w = as_float_array(XYZ_w) diff --git a/colour/appearance/tests/common.py b/colour/appearance/tests/common.py index eeaad5c295..cb3c6d2224 100644 --- a/colour/appearance/tests/common.py +++ b/colour/appearance/tests/common.py @@ -49,11 +49,6 @@ class ColourAppearanceModelTest(object): must be reimplemented by each colour appearance model test sub-class. """ - LIMITED_FIXTURES = None - """ - Limited list of fixtures to test the colour appearance model against. - """ - OUTPUT_ATTRIBUTES = None """ Binding the fixture attributes to the colour appearance model @@ -170,14 +165,12 @@ def check_model_consistency(self, data, output_attributes): """ for data_attr, specification_attr in sorted(output_attributes.items()): - yield (self.check_specification_attribute, data.get('Case'), data, - specification_attr, data[data_attr]) + self.check_specification_attribute( + data.get('Case'), data, specification_attr, data[data_attr]) def fixtures(self): """ - Returns the fixtures case for tested colour appearance model and - filter them accordingly with :attr:`colour.appearance.tests.common.\ -ColourAppearanceModelTest.LIMITED_FIXTURES` value. + Returns the fixtures case for tested colour appearance model.. Returns ------- @@ -185,10 +178,7 @@ def fixtures(self): Filtered fixtures case data. """ - fixtures = self.load_fixtures(self.FIXTURE_BASENAME) - if self.LIMITED_FIXTURES is not None: - fixtures = [fixtures[index] for index in self.LIMITED_FIXTURES] - return fixtures + return self.load_fixtures(self.FIXTURE_BASENAME) def test_examples(self): """ @@ -200,9 +190,7 @@ def test_examples(self): """ for data in self.fixtures(): - for test in self.check_model_consistency(data, - self.OUTPUT_ATTRIBUTES): - yield test + self.check_model_consistency(data, self.OUTPUT_ATTRIBUTES) def test_n_dimensional_examples(self): """ @@ -222,5 +210,4 @@ def test_n_dimensional_examples(self): for key in data: data[key] = np.array(data[key]) - for test in self.check_model_consistency(data, self.OUTPUT_ATTRIBUTES): - yield test + self.check_model_consistency(data, self.OUTPUT_ATTRIBUTES) diff --git a/colour/appearance/tests/test_cam16.py b/colour/appearance/tests/test_cam16.py index 5b55d4fc8a..a799860c4e 100644 --- a/colour/appearance/tests/test_cam16.py +++ b/colour/appearance/tests/test_cam16.py @@ -25,7 +25,7 @@ __all__ = [ 'TestCAM16ColourAppearanceModelForward', - 'TestCAM16ColourAppearanceModelReverse' + 'TestCAM16ColourAppearanceModelInverse' ] @@ -92,7 +92,10 @@ def test_domain_range_scale_XYZ_to_CAM16(self): d_r = ( ('reference', 1, 1), - (1, 0.01, np.array([1, 1, 1 / 360, 1, 1, 1, 1 / 360])), + (1, 0.01, + np.array([ + 1 / 100, 1 / 100, 1 / 360, 1 / 100, 1 / 100, 1 / 100, 1 / 360 + ])), (100, 1, np.array([1, 1, 100 / 360, 1, 1, 1, 100 / 360])), ) for scale, factor_a, factor_b in d_r: @@ -121,10 +124,10 @@ def test_nan_XYZ_to_CAM16(self): XYZ_to_CAM16(XYZ, XYZ_w, L_A, Y_b, surround) -class TestCAM16ColourAppearanceModelReverse(ColourAppearanceModelTest): +class TestCAM16ColourAppearanceModelInverse(ColourAppearanceModelTest): """ Defines :mod:`colour.appearance.cam16` module units tests methods for - *CAM16* colour appearance model reverse implementation. + *CAM16* colour appearance model inverse implementation. """ FIXTURE_BASENAME = 'cam16.csv' @@ -241,7 +244,10 @@ def test_domain_range_scale_CAM16_to_XYZ(self): d_r = ( ('reference', 1, 1, 1), - (1, np.array([1, 1, 1 / 360, 1, 1, 1, 1 / 360]), 0.01, 0.01), + (1, + np.array([ + 1 / 100, 1 / 100, 1 / 360, 1 / 100, 1 / 100, 1 / 100, 1 / 360 + ]), 0.01, 0.01), (100, np.array([1, 1, 100 / 360, 1, 1, 1, 100 / 360]), 1, 1), ) for scale, factor_a, factor_b, factor_c in d_r: @@ -252,11 +258,33 @@ def test_domain_range_scale_CAM16_to_XYZ(self): XYZ * factor_c, decimal=7) + @ignore_numpy_errors + def test_raise_exception_CAM16_to_XYZ(self): + """ + Tests :func:`colour.appearance.cam16.CAM16_to_XYZ` definition raised + exception. + """ + + try: + CAM16_to_XYZ( + CAM16_Specification( + 41.731207905126638, + None, + 217.06795976739301, + ), + np.array([95.05, 100.00, 108.88]), + 318.31, + 20.0, + CAM16_VIEWING_CONDITIONS['Average'], + ) + except ValueError: + pass + @ignore_numpy_errors def test_nan_CAM16_to_XYZ(self): """ - Tests :func:`colour.appearance.cam16.CAM16_to_XYZ` definition - nan support. + Tests :func:`colour.appearance.cam16.CAM16_to_XYZ` definition nan + support. """ cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] diff --git a/colour/appearance/tests/test_ciecam02.py b/colour/appearance/tests/test_ciecam02.py index 78331c027d..5cf58a87c3 100644 --- a/colour/appearance/tests/test_ciecam02.py +++ b/colour/appearance/tests/test_ciecam02.py @@ -25,7 +25,7 @@ __all__ = [ 'TestCIECAM02ColourAppearanceModelForward', - 'TestCIECAM02ColourAppearanceModelReverse' + 'TestCIECAM02ColourAppearanceModelInverse' ] @@ -88,7 +88,10 @@ def test_domain_range_scale_XYZ_to_CIECAM02(self): d_r = ( ('reference', 1, 1), - (1, 0.01, np.array([1, 1, 1 / 360, 1, 1, 1, 1 / 360])), + (1, 0.01, + np.array([ + 1 / 100, 1 / 100, 1 / 360, 1 / 100, 1 / 100, 1 / 100, 1 / 360 + ])), (100, 1, np.array([1, 1, 100 / 360, 1, 1, 1, 100 / 360])), ) for scale, factor_a, factor_b in d_r: @@ -117,10 +120,10 @@ def test_nan_XYZ_to_CIECAM02(self): XYZ_to_CIECAM02(XYZ, XYZ_w, L_A, Y_b, surround) -class TestCIECAM02ColourAppearanceModelReverse(ColourAppearanceModelTest): +class TestCIECAM02ColourAppearanceModelInverse(ColourAppearanceModelTest): """ Defines :mod:`colour.appearance.ciecam02` module units tests methods for - *CIECAM02* colour appearance model reverse implementation. + *CIECAM02* colour appearance model inverse implementation. """ FIXTURE_BASENAME = 'ciecam02.csv' @@ -237,7 +240,10 @@ def test_domain_range_scale_CIECAM02_to_XYZ(self): d_r = ( ('reference', 1, 1, 1), - (1, np.array([1, 1, 1 / 360, 1, 1, 1, 1 / 360]), 0.01, 0.01), + (1, + np.array([ + 1 / 100, 1 / 100, 1 / 360, 1 / 100, 1 / 100, 1 / 100, 1 / 360 + ]), 0.01, 0.01), (100, np.array([1, 1, 100 / 360, 1, 1, 1, 100 / 360]), 1, 1), ) for scale, factor_a, factor_b, factor_c in d_r: @@ -248,6 +254,28 @@ def test_domain_range_scale_CIECAM02_to_XYZ(self): XYZ * factor_c, decimal=7) + @ignore_numpy_errors + def test_raise_exception_CIECAM02_to_XYZ(self): + """ + Tests :func:`colour.appearance.cam16.CIECAM02_to_XYZ` definition raised + exception. + """ + + try: + CIECAM02_to_XYZ( + CIECAM02_Specification( + 41.731091132513917, + None, + 219.04843265831178, + ), + np.array([95.05, 100.00, 108.88]), + 318.31, + 20.0, + CIECAM02_VIEWING_CONDITIONS['Average'], + ) + except ValueError: + pass + @ignore_numpy_errors def test_nan_CIECAM02_to_XYZ(self): """ diff --git a/colour/appearance/tests/test_hunt.py b/colour/appearance/tests/test_hunt.py index c96519b5e2..a30839ea98 100644 --- a/colour/appearance/tests/test_hunt.py +++ b/colour/appearance/tests/test_hunt.py @@ -104,6 +104,70 @@ def test_domain_range_scale_XYZ_to_Hunt(self): specification * factor_b, decimal=7) + @ignore_numpy_errors + def test_raise_exception_CIECAM02_to_XYZ(self): + """ + Tests :func:`colour.appearance.hunt.XYZ_to_Hunt` definition raised + exception. + """ + + XYZ = np.array([19.01, 20.00, 21.78]) + XYZ_w = np.array([95.05, 100.00, 108.88]) + XYZ_b = np.array([95.05, 100.00, 108.88]) + L_A = 318.31 + surround = HUNT_VIEWING_CONDITIONS['Normal Scenes'] + CCT_w = 6504.0 + S = S_w = 0.5 + + try: + XYZ_to_Hunt(XYZ, XYZ_w, XYZ_b, L_A, surround) + except ValueError: + pass + + try: + XYZ_to_Hunt(XYZ, XYZ_w, XYZ_b, L_A, surround, CCT_w=CCT_w, S=S) + except ValueError: + pass + + try: + XYZ_to_Hunt(XYZ, XYZ_w, XYZ_b, L_A, surround, CCT_w=CCT_w, S_w=S_w) + except ValueError: + pass + + @ignore_numpy_errors + def test_XYZ_p_CIECAM02_to_XYZ(self): + """ + Tests :func:`colour.appearance.hunt.XYZ_to_Hunt` definition *XYZ_p* + argument handling. + """ + + XYZ = np.array([19.01, 20.00, 21.78]) + XYZ_w = np.array([95.05, 100.00, 108.88]) + XYZ_b = XYZ_p = np.array([95.05, 100.00, 108.88]) + L_A = 318.31 + surround = HUNT_VIEWING_CONDITIONS['Normal Scenes'] + CCT_w = 6504.0 + + np.testing.assert_almost_equal( + XYZ_to_Hunt( + XYZ, + XYZ_w, + XYZ_b, + L_A, + surround, + XYZ_p=XYZ_p, + CCT_w=CCT_w, + )[:-2], + np.array([ + 30.046267861960700, + 0.121050839936350, + 269.273759446144600, + 0.019909320692942, + 22.209765491265024, + 0.123896438259997, + ]), + decimal=7) + @ignore_numpy_errors def test_nan_XYZ_to_Hunt(self): """ diff --git a/colour/appearance/tests/test_llab.py b/colour/appearance/tests/test_llab.py index 0be4e0d3b2..5fcb105a92 100644 --- a/colour/appearance/tests/test_llab.py +++ b/colour/appearance/tests/test_llab.py @@ -11,7 +11,7 @@ try: from unittest import mock -except ImportError: +except ImportError: # pragma: no cover import mock from itertools import permutations @@ -92,9 +92,7 @@ def test_examples(self): 'colour.appearance.llab.LLAB_RGB_TO_XYZ_MATRIX', np.around( np.linalg.inv(llab.LLAB_XYZ_TO_RGB_MATRIX), decimals=4)): - for test in super(TestLLABColourAppearanceModel, - self).test_examples(): - yield test + super(TestLLABColourAppearanceModel, self).test_examples() def test_n_dimensional_examples(self): """ @@ -116,9 +114,8 @@ def test_n_dimensional_examples(self): 'colour.appearance.llab.LLAB_RGB_TO_XYZ_MATRIX', np.around( np.linalg.inv(llab.LLAB_XYZ_TO_RGB_MATRIX), decimals=4)): - for test in super(TestLLABColourAppearanceModel, - self).test_n_dimensional_examples(): - yield test + super(TestLLABColourAppearanceModel, + self).test_n_dimensional_examples() def test_colourspace_conversion_matrices_precision(self): """ diff --git a/colour/blindness/__init__.py b/colour/blindness/__init__.py index 7d69f7d0df..659218c805 100644 --- a/colour/blindness/__init__.py +++ b/colour/blindness/__init__.py @@ -3,14 +3,14 @@ from __future__ import absolute_import -from .dataset import * # noqa -from . import dataset +from .datasets import * # noqa +from . import datasets from .machado2009 import (anomalous_trichromacy_cmfs_Machado2009, anomalous_trichromacy_matrix_Machado2009, cvd_matrix_Machado2009) __all__ = [] -__all__ += dataset.__all__ +__all__ += datasets.__all__ __all__ += [ 'anomalous_trichromacy_cmfs_Machado2009', 'anomalous_trichromacy_matrix_Machado2009', 'cvd_matrix_Machado2009' diff --git a/colour/blindness/dataset/__init__.py b/colour/blindness/datasets/__init__.py similarity index 100% rename from colour/blindness/dataset/__init__.py rename to colour/blindness/datasets/__init__.py diff --git a/colour/blindness/dataset/machado2010.py b/colour/blindness/datasets/machado2010.py similarity index 100% rename from colour/blindness/dataset/machado2010.py rename to colour/blindness/datasets/machado2010.py diff --git a/colour/characterisation/__init__.py b/colour/characterisation/__init__.py index bcd1481512..31dcd64c97 100644 --- a/colour/characterisation/__init__.py +++ b/colour/characterisation/__init__.py @@ -4,8 +4,8 @@ from .cameras import RGB_SpectralSensitivities from .displays import RGB_DisplayPrimaries -from .dataset import * # noqa -from . import dataset +from .datasets import * # noqa +from . import datasets from .correction import ( augmented_matrix_Cheung2004, polynomial_expansion_Finlayson2015, polynomial_expansion_Vandermonde, POLYNOMIAL_EXPANSION_METHODS, @@ -19,7 +19,7 @@ __all__ = [] __all__ += ['RGB_SpectralSensitivities'] __all__ += ['RGB_DisplayPrimaries'] -__all__ += dataset.__all__ +__all__ += datasets.__all__ __all__ += [ 'augmented_matrix_Cheung2004', 'polynomial_expansion_Finlayson2015', 'polynomial_expansion_Vandermonde', 'POLYNOMIAL_EXPANSION_METHODS', diff --git a/colour/characterisation/cameras.py b/colour/characterisation/cameras.py index 8b523da1ef..3ac7db58b2 100644 --- a/colour/characterisation/cameras.py +++ b/colour/characterisation/cameras.py @@ -3,8 +3,8 @@ Cameras Spectral Sensitivities ============================== -Defines spectral distributions classes for the dataset from -:mod:`colour.characterisation.dataset.cameras` module: +Defines spectral distributions classes for the datasets from +:mod:`colour.characterisation.datasets.cameras` module: - :class:`colour.characterisation.RGB_SpectralSensitivities`: Implements support for a camera *RGB* spectral sensitivities. @@ -18,7 +18,7 @@ from __future__ import division, unicode_literals -from colour.colorimetry import MultiSpectralDistribution +from colour.colorimetry import MultiSpectralDistributions __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -30,15 +30,15 @@ __all__ = ['RGB_SpectralSensitivities'] -class RGB_SpectralSensitivities(MultiSpectralDistribution): +class RGB_SpectralSensitivities(MultiSpectralDistributions): """ Implements support for a camera *RGB* spectral sensitivities. Parameters ---------- - data : Series or Dataframe or Signal or MultiSignal or \ -MultiSpectralDistribution or array_like or dict_like, optional - Data to be stored in the multi-spectral distribution. + data : Series or Dataframe or Signal or MultiSignals or \ +MultiSpectralDistributions or array_like or dict_like, optional + Data to be stored in the multi-spectral distributions. domain : array_like, optional Values to initialise the multiple :class:`colour.SpectralDistribution` class instances :attr:`colour.continuous.Signal.wavelengths` attribute @@ -52,7 +52,7 @@ class instances :attr:`colour.continuous.Signal.wavelengths` attribute Other Parameters ---------------- name : unicode, optional - Multi-spectral distribution name. + Multi-spectral distributions name. interpolator : object, optional Interpolator class type to use as interpolating function for the :class:`colour.SpectralDistribution` class instances. @@ -66,7 +66,7 @@ class instances :attr:`colour.continuous.Signal.wavelengths` attribute Arguments to use when instantiating the extrapolating function of the :class:`colour.SpectralDistribution` class instances. strict_labels : array_like, optional - Multi-spectral distribution labels for figures, default to + Multi-spectral distributions labels for figures, default to :attr:`colour.characterisation.RGB_SpectralSensitivities.labels` attribute value. """ diff --git a/colour/characterisation/dataset/__init__.py b/colour/characterisation/datasets/__init__.py similarity index 100% rename from colour/characterisation/dataset/__init__.py rename to colour/characterisation/datasets/__init__.py diff --git a/colour/characterisation/dataset/cameras/__init__.py b/colour/characterisation/datasets/cameras/__init__.py similarity index 100% rename from colour/characterisation/dataset/cameras/__init__.py rename to colour/characterisation/datasets/cameras/__init__.py diff --git a/colour/characterisation/dataset/cameras/dslr/__init__.py b/colour/characterisation/datasets/cameras/dslr/__init__.py similarity index 100% rename from colour/characterisation/dataset/cameras/dslr/__init__.py rename to colour/characterisation/datasets/cameras/dslr/__init__.py diff --git a/colour/characterisation/dataset/cameras/dslr/spectral_sensitivities.py b/colour/characterisation/datasets/cameras/dslr/spectral_sensitivities.py similarity index 100% rename from colour/characterisation/dataset/cameras/dslr/spectral_sensitivities.py rename to colour/characterisation/datasets/cameras/dslr/spectral_sensitivities.py diff --git a/colour/characterisation/dataset/colour_checkers/__init__.py b/colour/characterisation/datasets/colour_checkers/__init__.py similarity index 100% rename from colour/characterisation/dataset/colour_checkers/__init__.py rename to colour/characterisation/datasets/colour_checkers/__init__.py diff --git a/colour/characterisation/dataset/colour_checkers/chromaticity_coordinates.py b/colour/characterisation/datasets/colour_checkers/chromaticity_coordinates.py similarity index 54% rename from colour/characterisation/dataset/colour_checkers/chromaticity_coordinates.py rename to colour/characterisation/datasets/colour_checkers/chromaticity_coordinates.py index 3a286d103a..0091a28174 100644 --- a/colour/characterisation/dataset/colour_checkers/chromaticity_coordinates.py +++ b/colour/characterisation/datasets/colour_checkers/chromaticity_coordinates.py @@ -1,33 +1,33 @@ # -*- coding: utf-8 -*- """ -ColourCheckers Chromaticity Coordinates -======================================= +Colour Checkers Chromaticity Coordinates +======================================== -Defines *ColourCheckers* chromaticity coordinates in *CIE xyY* colourspace. +Defines *Colour Checkers* chromaticity coordinates in *CIE xyY* colourspace. -Each *ColourChecker* data is in the form of a list of an :class:`OrderedDict` +Each *Colour Checker* data is in the form of a list of an :class:`OrderedDict` class instance of 24 samples as follows:: {'name': 'xyY', ..., 'name': 'xyY'} -The following *ColourCheckers* data is available: +The following *Colour Checkers* data is available: -- :attr:`colour.characterisation.dataset.colour_checkers.\ -chromaticity_coordinates.COLORCHECKER_1976`: *ColourChecker* developed by +- :attr:`colour.characterisation.datasets.colour_checkers.\ +chromaticity_coordinates.COLORCHECKER_1976`: *Colour Checker* developed by *McCamy et al.* at Macbeth, a Division of Kollmorgen. -- :attr:`colour.characterisation.dataset.colour_checkers.\ +- :attr:`colour.characterisation.datasets.colour_checkers.\ chromaticity_coordinates.COLORCHECKER_2005`: Reference data from *GretagMacbeth* published in 2005. -- :attr:`colour.characterisation.dataset.colour_checkers.\ +- :attr:`colour.characterisation.datasets.colour_checkers.\ chromaticity_coordinates.BABELCOLOR_AVERAGE`: Average data derived from - measurements of 30 *ColourChecker* charts. -- :attr:`colour.characterisation.dataset.colour_checkers.\ + measurements of 30 *Colour Checker* charts. +- :attr:`colour.characterisation.datasets.colour_checkers.\ chromaticity_coordinates.COLORCHECKER24_BEFORE_NOV2014`: Reference data from *X-Rite* published in 2015 and matching the data from *GretagMacbeth* published in 2005. -- :attr:`colour.characterisation.dataset.colour_checkers.\ +- :attr:`colour.characterisation.datasets.colour_checkers.\ chromaticity_coordinates.COLORCHECKER24_AFTER_NOV2014`: Reference data from - *X-Rite* published in 2015 and matching the *ColourChecker* edition after + *X-Rite* published in 2015 and matching the *Colour Checker* edition after November 2014. See Also @@ -71,7 +71,8 @@ class instance of 24 samples as follows:: __status__ = 'Production' __all__ = [ - 'ColourChecker', 'COLORCHECKER_1976_DATA', 'COLORCHECKER_1976_ILLUMINANT', + 'ColourChecker', 'COLORCHECKER_CLASSIC_SAMPLE_LABELS', + 'COLORCHECKER_1976_DATA', 'COLORCHECKER_1976_ILLUMINANT', 'COLORCHECKER_1976', 'COLORCHECKER_2005_DATA', 'COLORCHECKER_2005_ILLUMINANT', 'COLORCHECKER_2005', 'BABELCOLOR_AVERAGE_DATA', 'BABELCOLOR_AVERAGE_ILLUMINANT', @@ -88,45 +89,78 @@ class instance of 24 samples as follows:: class ColourChecker( namedtuple('ColourChecker', ('name', 'data', 'illuminant'))): """ - *ColourChecker* data. + *Colour Checker* data. Parameters ---------- name : unicode - *ColourChecker* name. + *Colour Checker* name. data : OrderedDict chromaticity coordinates in *CIE xyY* colourspace. illuminant : array_like - *ColourChecker* illuminant chromaticity coordinates. + *Colour Checker* illuminant chromaticity coordinates. """ -COLORCHECKER_1976_DATA = OrderedDict(( - ('dark skin', np.array([0.4002, 0.3504, 0.1005])), - ('light skin', np.array([0.3773, 0.3446, 0.3582])), - ('blue sky', np.array([0.2470, 0.2514, 0.1933])), - ('foliage', np.array([0.3372, 0.4220, 0.1329])), - ('blue flower', np.array([0.2651, 0.2400, 0.2427])), - ('bluish green', np.array([0.2608, 0.3430, 0.4306])), - ('orange', np.array([0.5060, 0.4070, 0.3005])), - ('purplish blue', np.array([0.2110, 0.1750, 0.1200])), - ('moderate red', np.array([0.4533, 0.3058, 0.1977])), - ('purple', np.array([0.2845, 0.2020, 0.0656])), - ('yellow green', np.array([0.3800, 0.4887, 0.4429])), - ('orange yellow', np.array([0.4729, 0.4375, 0.4306])), - ('blue', np.array([0.1866, 0.1285, 0.0611])), - ('green', np.array([0.3046, 0.4782, 0.2339])), - ('red', np.array([0.5385, 0.3129, 0.1200])), - ('yellow', np.array([0.4480, 0.4703, 0.5910])), - ('magenta', np.array([0.3635, 0.2325, 0.1977])), - ('cyan', np.array([0.1958, 0.2519, 0.1977])), - ('white 9.5 (.05 D)', np.array([0.3101, 0.3163, 0.9001])), - ('neutral 8 (.23 D)', np.array([0.3101, 0.3163, 0.5910])), - ('neutral 6.5 (.44 D)', np.array([0.3101, 0.3163, 0.3620])), - ('neutral 5 (.70 D)', np.array([0.3101, 0.3163, 0.1977])), - ('neutral 3.5 (1.05 D)', np.array([0.3101, 0.3163, 0.0900])), - ('black 2 (1.5 D)', np.array([0.3101, 0.3163, 0.0313])), -)) +COLORCHECKER_CLASSIC_SAMPLE_LABELS = ( + 'dark skin', + 'light skin', + 'blue sky', + 'foliage', + 'blue flower', + 'bluish green', + 'orange', + 'purplish blue', + 'moderate red', + 'purple', + 'yellow green', + 'orange yellow', + 'blue', + 'green', + 'red', + 'yellow', + 'magenta', + 'cyan', + 'white 9.5 (.05 D)', + 'neutral 8 (.23 D)', + 'neutral 6.5 (.44 D)', + 'neutral 5 (.70 D)', + 'neutral 3.5 (1.05 D)', + 'black 2 (1.5 D)', +) +""" +*ColorChecker Classic* illuminant. + +COLORCHECKER_CLASSIC_SAMPLE_LABELS : tuple +""" + +COLORCHECKER_1976_DATA = OrderedDict( + zip(COLORCHECKER_CLASSIC_SAMPLE_LABELS, [ + np.array([0.4002, 0.3504, 0.1005]), + np.array([0.3773, 0.3446, 0.3582]), + np.array([0.2470, 0.2514, 0.1933]), + np.array([0.3372, 0.4220, 0.1329]), + np.array([0.2651, 0.2400, 0.2427]), + np.array([0.2608, 0.3430, 0.4306]), + np.array([0.5060, 0.4070, 0.3005]), + np.array([0.2110, 0.1750, 0.1200]), + np.array([0.4533, 0.3058, 0.1977]), + np.array([0.2845, 0.2020, 0.0656]), + np.array([0.3800, 0.4887, 0.4429]), + np.array([0.4729, 0.4375, 0.4306]), + np.array([0.1866, 0.1285, 0.0611]), + np.array([0.3046, 0.4782, 0.2339]), + np.array([0.5385, 0.3129, 0.1200]), + np.array([0.4480, 0.4703, 0.5910]), + np.array([0.3635, 0.2325, 0.1977]), + np.array([0.1958, 0.2519, 0.1977]), + np.array([0.3101, 0.3163, 0.9001]), + np.array([0.3101, 0.3163, 0.5910]), + np.array([0.3101, 0.3163, 0.3620]), + np.array([0.3101, 0.3163, 0.1977]), + np.array([0.3101, 0.3163, 0.0900]), + np.array([0.3101, 0.3163, 0.0313]), + ])) COLORCHECKER_1976_ILLUMINANT = ( ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['C']) @@ -139,41 +173,42 @@ class ColourChecker( COLORCHECKER_1976 = ColourChecker('ColorChecker 1976', COLORCHECKER_1976_DATA, COLORCHECKER_1976_ILLUMINANT) """ -*ColourChecker* developed by *McCamy et al.* at Macbeth, a Division of +*Colour Checker* developed by *McCamy et al.* at Macbeth, a Division of Kollmorgen. COLORCHECKER_1976 : ColourChecker """ -COLORCHECKER_2005_DATA = OrderedDict(( - ('dark skin', np.array([0.4316, 0.3777, 0.1008])), - ('light skin', np.array([0.4197, 0.3744, 0.3495])), - ('blue sky', np.array([0.2760, 0.3016, 0.1836])), - ('foliage', np.array([0.3703, 0.4499, 0.1325])), - ('blue flower', np.array([0.2999, 0.2856, 0.2304])), - ('bluish green', np.array([0.2848, 0.3911, 0.4178])), - ('orange', np.array([0.5295, 0.4055, 0.3118])), - ('purplish blue', np.array([0.2305, 0.2106, 0.1126])), - ('moderate red', np.array([0.5012, 0.3273, 0.1938])), - ('purple', np.array([0.3319, 0.2482, 0.0637])), - ('yellow green', np.array([0.3984, 0.5008, 0.4446])), - ('orange yellow', np.array([0.4957, 0.4427, 0.4357])), - ('blue', np.array([0.2018, 0.1692, 0.0575])), - ('green', np.array([0.3253, 0.5032, 0.2318])), - ('red', np.array([0.5686, 0.3303, 0.1257])), - ('yellow', np.array([0.4697, 0.4734, 0.5981])), - ('magenta', np.array([0.4159, 0.2688, 0.2009])), - ('cyan', np.array([0.2131, 0.3023, 0.1930])), - ('white 9.5 (.05 D)', np.array([0.3469, 0.3608, 0.9131])), - ('neutral 8 (.23 D)', np.array([0.3440, 0.3584, 0.5894])), - ('neutral 6.5 (.44 D)', np.array([0.3432, 0.3581, 0.3632])), - ('neutral 5 (.70 D)', np.array([0.3446, 0.3579, 0.1915])), - ('neutral 3.5 (1.05 D)', np.array([0.3401, 0.3548, 0.0883])), - ('black 2 (1.5 D)', np.array([0.3406, 0.3537, 0.0311])), -)) +COLORCHECKER_2005_DATA = OrderedDict( + zip(COLORCHECKER_CLASSIC_SAMPLE_LABELS, [ + np.array([0.4316, 0.3777, 0.1008]), + np.array([0.4197, 0.3744, 0.3495]), + np.array([0.2760, 0.3016, 0.1836]), + np.array([0.3703, 0.4499, 0.1325]), + np.array([0.2999, 0.2856, 0.2304]), + np.array([0.2848, 0.3911, 0.4178]), + np.array([0.5295, 0.4055, 0.3118]), + np.array([0.2305, 0.2106, 0.1126]), + np.array([0.5012, 0.3273, 0.1938]), + np.array([0.3319, 0.2482, 0.0637]), + np.array([0.3984, 0.5008, 0.4446]), + np.array([0.4957, 0.4427, 0.4357]), + np.array([0.2018, 0.1692, 0.0575]), + np.array([0.3253, 0.5032, 0.2318]), + np.array([0.5686, 0.3303, 0.1257]), + np.array([0.4697, 0.4734, 0.5981]), + np.array([0.4159, 0.2688, 0.2009]), + np.array([0.2131, 0.3023, 0.1930]), + np.array([0.3469, 0.3608, 0.9131]), + np.array([0.3440, 0.3584, 0.5894]), + np.array([0.3432, 0.3581, 0.3632]), + np.array([0.3446, 0.3579, 0.1915]), + np.array([0.3401, 0.3548, 0.0883]), + np.array([0.3406, 0.3537, 0.0311]), + ])) COLORCHECKER_2005_ILLUMINANT = ( - ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D50']) + ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['ICC D50']) """ *ColorChecker 2005* illuminant. @@ -187,35 +222,36 @@ class ColourChecker( COLORCHECKER_2005 : ColourChecker """ -BABELCOLOR_AVERAGE_DATA = OrderedDict(( - ('dark skin', np.array([0.4325, 0.3788, 0.1034])), - ('light skin', np.array([0.4191, 0.3748, 0.3525])), - ('blue sky', np.array([0.2761, 0.3004, 0.1847])), - ('foliage', np.array([0.3700, 0.4501, 0.1335])), - ('blue flower', np.array([0.3020, 0.2877, 0.2324])), - ('bluish green', np.array([0.2856, 0.3910, 0.4174])), - ('orange', np.array([0.5291, 0.4075, 0.3117])), - ('purplish blue', np.array([0.2339, 0.2155, 0.1140])), - ('moderate red', np.array([0.5008, 0.3293, 0.1979])), - ('purple', np.array([0.3326, 0.2556, 0.0644])), - ('yellow green', np.array([0.3989, 0.4998, 0.4435])), - ('orange yellow', np.array([0.4962, 0.4428, 0.4358])), - ('blue', np.array([0.2040, 0.1696, 0.0579])), - ('green', np.array([0.3270, 0.5033, 0.2307])), - ('red', np.array([0.5709, 0.3298, 0.1268])), - ('yellow', np.array([0.4694, 0.4732, 0.6081])), - ('magenta', np.array([0.4177, 0.2704, 0.2007])), - ('cyan', np.array([0.2151, 0.3037, 0.1903])), - ('white 9.5 (.05 D)', np.array([0.3488, 0.3628, 0.9129])), - ('neutral 8 (.23 D)', np.array([0.3451, 0.3596, 0.5885])), - ('neutral 6.5 (.44 D)', np.array([0.3446, 0.3590, 0.3595])), - ('neutral 5 (.70 D)', np.array([0.3438, 0.3589, 0.1912])), - ('neutral 3.5 (1.05 D)', np.array([0.3423, 0.3576, 0.0893])), - ('black 2 (1.5 D)', np.array([0.3439, 0.3565, 0.0320])), -)) +BABELCOLOR_AVERAGE_DATA = OrderedDict( + zip(COLORCHECKER_CLASSIC_SAMPLE_LABELS, [ + np.array([0.4325, 0.3788, 0.1034]), + np.array([0.4191, 0.3748, 0.3525]), + np.array([0.2761, 0.3004, 0.1847]), + np.array([0.3700, 0.4501, 0.1335]), + np.array([0.3020, 0.2877, 0.2324]), + np.array([0.2856, 0.3910, 0.4174]), + np.array([0.5291, 0.4075, 0.3117]), + np.array([0.2339, 0.2155, 0.1140]), + np.array([0.5008, 0.3293, 0.1979]), + np.array([0.3326, 0.2556, 0.0644]), + np.array([0.3989, 0.4998, 0.4435]), + np.array([0.4962, 0.4428, 0.4358]), + np.array([0.2040, 0.1696, 0.0579]), + np.array([0.3270, 0.5033, 0.2307]), + np.array([0.5709, 0.3298, 0.1268]), + np.array([0.4694, 0.4732, 0.6081]), + np.array([0.4177, 0.2704, 0.2007]), + np.array([0.2151, 0.3037, 0.1903]), + np.array([0.3488, 0.3628, 0.9129]), + np.array([0.3451, 0.3596, 0.5885]), + np.array([0.3446, 0.3590, 0.3595]), + np.array([0.3438, 0.3589, 0.1912]), + np.array([0.3423, 0.3576, 0.0893]), + np.array([0.3439, 0.3565, 0.0320]), + ])) BABELCOLOR_AVERAGE_ILLUMINANT = ( - ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D50']) + ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['ICC D50']) """ *BabelColor Average* illuminant. @@ -226,37 +262,38 @@ class ColourChecker( BABELCOLOR_AVERAGE_DATA, BABELCOLOR_AVERAGE_ILLUMINANT) """ -Average data derived from measurements of 30 *ColourChecker* charts. +Average data derived from measurements of 30 *Colour Checker* charts. BABELCOLOR_AVERAGE : ColourChecker """ -COLORCHECKER24_BEFORE_NOV2014_LAB_DATA = OrderedDict(( - ('dark skin', np.array([37.986, 13.555, 14.059])), - ('light skin', np.array([65.711, 18.13, 17.81])), - ('blue sky', np.array([49.927, -4.88, -21.905])), - ('foliage', np.array([43.139, -13.095, 21.905])), - ('blue flower', np.array([55.112, 8.844, -25.399])), - ('bluish green', np.array([70.719, -33.397, -0.199])), - ('orange', np.array([62.661, 36.067, 57.096])), - ('purplish blue', np.array([40.02, 10.41, -45.964])), - ('moderate red', np.array([51.124, 48.239, 16.248])), - ('purple', np.array([30.325, 22.976, -21.587])), - ('yellow green', np.array([72.532, -23.709, 57.255])), - ('orange yellow', np.array([71.941, 19.363, 67.857])), - ('blue', np.array([28.778, 14.179, -50.297])), - ('green', np.array([55.261, -38.342, 31.37])), - ('red', np.array([42.101, 53.378, 28.19])), - ('yellow', np.array([81.733, 4.039, 79.819])), - ('magenta', np.array([51.935, 49.986, -14.574])), - ('cyan', np.array([51.038, -28.631, -28.638])), - ('white 9.5 (.05 D)', np.array([96.539, -0.425, 1.186])), - ('neutral 8 (.23 D)', np.array([81.257, -0.638, -0.335])), - ('neutral 6.5 (.44 D)', np.array([66.766, -0.734, -0.504])), - ('neutral 5 (.70 D)', np.array([50.867, -0.153, -0.27])), - ('neutral 3.5 (1.05 D)', np.array([35.656, -0.421, -1.231])), - ('black 2 (1.5 D)', np.array([20.461, -0.079, -0.973])), -)) +COLORCHECKER24_BEFORE_NOV2014_LAB_DATA = OrderedDict( + zip(COLORCHECKER_CLASSIC_SAMPLE_LABELS, [ + np.array([37.986, 13.555, 14.059]), + np.array([65.711, 18.13, 17.81]), + np.array([49.927, -4.88, -21.905]), + np.array([43.139, -13.095, 21.905]), + np.array([55.112, 8.844, -25.399]), + np.array([70.719, -33.397, -0.199]), + np.array([62.661, 36.067, 57.096]), + np.array([40.02, 10.41, -45.964]), + np.array([51.124, 48.239, 16.248]), + np.array([30.325, 22.976, -21.587]), + np.array([72.532, -23.709, 57.255]), + np.array([71.941, 19.363, 67.857]), + np.array([28.778, 14.179, -50.297]), + np.array([55.261, -38.342, 31.37]), + np.array([42.101, 53.378, 28.19]), + np.array([81.733, 4.039, 79.819]), + np.array([51.935, 49.986, -14.574]), + np.array([51.038, -28.631, -28.638]), + np.array([96.539, -0.425, 1.186]), + np.array([81.257, -0.638, -0.335]), + np.array([66.766, -0.734, -0.504]), + np.array([50.867, -0.153, -0.27]), + np.array([35.656, -0.421, -1.231]), + np.array([20.461, -0.079, -0.973]), + ])) """ *ColorChecker24 - Before November 2014* illuminant. @@ -271,14 +308,15 @@ class ColourChecker( COLORCHECKER24_BEFORE_NOV2014_DATA = OrderedDict( zip( - COLORCHECKER24_BEFORE_NOV2014_LAB_DATA.keys(), + COLORCHECKER_CLASSIC_SAMPLE_LABELS, XYZ_to_xyY( Lab_to_XYZ( list(COLORCHECKER24_BEFORE_NOV2014_LAB_DATA.values()), - ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D50'])))) + ILLUMINANTS['CIE 1931 2 Degree Standard Observer'][ + 'ICC D50'])))) COLORCHECKER24_BEFORE_NOV2014_ILLUMINANT = ( - ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D50']) + ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['ICC D50']) """ *ColorChecker24 - Before November 2014* illuminant. @@ -290,7 +328,7 @@ class ColourChecker( COLORCHECKER24_BEFORE_NOV2014_DATA, COLORCHECKER24_BEFORE_NOV2014_ILLUMINANT) """ -Reference *ColourChecker* data from *X-Rite (2015)*. +Reference *Colour Checker* data from *X-Rite (2015)*. Notes ----- @@ -345,10 +383,11 @@ class ColourChecker( XYZ_to_xyY( Lab_to_XYZ( list(COLORCHECKER24_AFTER_NOV2014_LAB_DATA.values()), - ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D50'])))) + ILLUMINANTS['CIE 1931 2 Degree Standard Observer'][ + 'ICC D50'])))) COLORCHECKER24_AFTER_NOV2014_ILLUMINANT = ( - ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D50']) + ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['ICC D50']) """ *ColorChecker24 - After November 2014* illuminant. @@ -359,8 +398,8 @@ class ColourChecker( 'ColorChecker24 - After November 2014', COLORCHECKER24_AFTER_NOV2014_DATA, COLORCHECKER24_AFTER_NOV2014_ILLUMINANT) """ -Reference *ColourChecker* data from *X-Rite (2015)* and matching the -*ColourChecker* edition after November 2014. +Reference *Colour Checker* data from *X-Rite (2015)* and matching the +*Colour Checker* edition after November 2014. COLORCHECKER24_AFTER_NOV2014 : ColourChecker """ @@ -373,7 +412,7 @@ class ColourChecker( 'ColorChecker24 - After November 2014': COLORCHECKER24_AFTER_NOV2014, }) COLOURCHECKERS.__doc__ = """ -Aggregated *ColourCheckers* chromaticity coordinates. +Aggregated *Colour Checkers* chromaticity coordinates. References ---------- diff --git a/colour/characterisation/dataset/colour_checkers/sds.py b/colour/characterisation/datasets/colour_checkers/sds.py similarity index 99% rename from colour/characterisation/dataset/colour_checkers/sds.py rename to colour/characterisation/datasets/colour_checkers/sds.py index 9fb30e71ea..ee012dd75d 100644 --- a/colour/characterisation/dataset/colour_checkers/sds.py +++ b/colour/characterisation/datasets/colour_checkers/sds.py @@ -1,23 +1,23 @@ # -*- coding: utf-8 -*- """ -ColourCheckers Spectral Distributions -===================================== +Colour Checkers Spectral Distributions +====================================== -Defines *ColourCheckers* spectral distributions. +Defines *Colour Checkers* spectral distributions. -Each *ColourChecker* data is in the form of :class:`OrderedDict` +Each *Colour Checker* data is in the form of :class:`OrderedDict` class instance of :class:`colour.SpectralDistribution` classes as follows:: {'name': SpectralDistribution, ..., 'name': SpectralDistribution} -The following *ColourCheckers* data is available: +The following *Colour Checkers* data is available: -- :attr:`colour.characterisation.dataset.colour_checkers.sds.\ +- :attr:`colour.characterisation.datasets.colour_checkers.sds.\ COLORCHECKER_N_OHTA_SDS`: Measured by Ohta (1997). -- :attr:`colour.characterisation.dataset.colour_checkers.sds.\ +- :attr:`colour.characterisation.datasets.colour_checkers.sds.\ BABELCOLOR_AVERAGE_SDS`: Average data derived from measurements of - 30 *ColourChecker* charts. + 30 *Colour Checker* charts. See Also -------- @@ -2987,7 +2987,7 @@ class instance of :class:`colour.SpectralDistribution` classes as (key, SpectralDistribution(value, name=key)) for key, value in BABELCOLOR_AVERAGE_SDS_DATA.items()) """ -Average data derived from measurements of 30 *ColourChecker* charts. +Average data derived from measurements of 30 *Colour Checker* charts. BABELCOLOR_AVERAGE_SDS : dict """ @@ -2997,7 +2997,7 @@ class instance of :class:`colour.SpectralDistribution` classes as 'ColorChecker N Ohta': COLORCHECKER_N_OHTA_SDS }) COLOURCHECKERS_SDS.__doc__ = """ -Aggregated *ColourCheckers* spectral distributions. +Aggregated *Colour Checkers* spectral distributions. References ---------- diff --git a/colour/characterisation/dataset/displays/__init__.py b/colour/characterisation/datasets/displays/__init__.py similarity index 100% rename from colour/characterisation/dataset/displays/__init__.py rename to colour/characterisation/datasets/displays/__init__.py diff --git a/colour/characterisation/dataset/displays/crt/__init__.py b/colour/characterisation/datasets/displays/crt/__init__.py similarity index 100% rename from colour/characterisation/dataset/displays/crt/__init__.py rename to colour/characterisation/datasets/displays/crt/__init__.py diff --git a/colour/characterisation/dataset/displays/crt/rgb_primaries.py b/colour/characterisation/datasets/displays/crt/rgb_primaries.py similarity index 100% rename from colour/characterisation/dataset/displays/crt/rgb_primaries.py rename to colour/characterisation/datasets/displays/crt/rgb_primaries.py diff --git a/colour/characterisation/dataset/displays/lcd/__init__.py b/colour/characterisation/datasets/displays/lcd/__init__.py similarity index 100% rename from colour/characterisation/dataset/displays/lcd/__init__.py rename to colour/characterisation/datasets/displays/lcd/__init__.py diff --git a/colour/characterisation/dataset/displays/lcd/rgb_primaries.py b/colour/characterisation/datasets/displays/lcd/rgb_primaries.py similarity index 100% rename from colour/characterisation/dataset/displays/lcd/rgb_primaries.py rename to colour/characterisation/datasets/displays/lcd/rgb_primaries.py diff --git a/colour/characterisation/displays.py b/colour/characterisation/displays.py index 3082c26728..29d624d1c3 100644 --- a/colour/characterisation/displays.py +++ b/colour/characterisation/displays.py @@ -3,8 +3,8 @@ RGB Displays ============ -Defines spectral distributions classes for the dataset from -:mod:`colour.characterisation.dataset.displays` module: +Defines spectral distributions classes for the datasets from +:mod:`colour.characterisation.datasets.displays` module: - :class:`colour.characterisation.RGB_DisplayPrimaries`: Implements support for a *RGB* display (such as a *CRT* or *LCD*) primaries multi-spectral @@ -19,7 +19,7 @@ from __future__ import division, unicode_literals -from colour.colorimetry import MultiSpectralDistribution +from colour.colorimetry import MultiSpectralDistributions __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -31,16 +31,16 @@ __all__ = ['RGB_DisplayPrimaries'] -class RGB_DisplayPrimaries(MultiSpectralDistribution): +class RGB_DisplayPrimaries(MultiSpectralDistributions): """ Implements support for a *RGB* display (such as a *CRT* or *LCD*) primaries multi-spectral distributions. Parameters ---------- - data : Series or Dataframe or Signal or MultiSignal or \ -MultiSpectralDistribution or array_like or dict_like, optional - Data to be stored in the multi-spectral distribution. + data : Series or Dataframe or Signal or MultiSignals or \ +MultiSpectralDistributions or array_like or dict_like, optional + Data to be stored in the multi-spectral distributions. domain : array_like, optional Values to initialise the multiple :class:`colour.SpectralDistribution` class instances :attr:`colour.continuous.Signal.wavelengths` attribute @@ -54,7 +54,7 @@ class instances :attr:`colour.continuous.Signal.wavelengths` attribute Other Parameters ---------------- name : unicode, optional - Multi-spectral distribution name. + Multi-spectral distributions name. interpolator : object, optional Interpolator class type to use as interpolating function for the :class:`colour.SpectralDistribution` class instances. @@ -68,7 +68,7 @@ class instances :attr:`colour.continuous.Signal.wavelengths` attribute Arguments to use when instantiating the extrapolating function of the :class:`colour.SpectralDistribution` class instances. strict_labels : array_like, optional - Multi-spectral distribution labels for figures, default to + Multi-spectral distributions labels for figures, default to :attr:`colour.characterisation.RGB_DisplayPrimaries.labels` attribute value. """ diff --git a/colour/characterisation/tests/test_correction.py b/colour/characterisation/tests/test_correction.py index cf902c3493..8011090622 100644 --- a/colour/characterisation/tests/test_correction.py +++ b/colour/characterisation/tests/test_correction.py @@ -9,7 +9,6 @@ import unittest from itertools import permutations from numpy.linalg import LinAlgError -from six import PY3 from colour.characterisation.correction import ( augmented_matrix_Cheung2004, polynomial_expansion_Finlayson2015, @@ -100,7 +99,7 @@ class TestAugmentedMatrixCheung2004(unittest.TestCase): def test_augmented_matrix_Cheung2004(self): """ Tests :func:`colour.characterisation.correction.\ - augmented_matrix_Cheung2004` definition. +augmented_matrix_Cheung2004` definition. """ RGB = np.array([0.17224810, 0.09170660, 0.06416938]) @@ -171,6 +170,15 @@ def test_augmented_matrix_Cheung2004(self): polynomials[i], decimal=7) + def test_raise_exception_augmented_matrix_Cheung2004(self): + """ + Tests :func:`colour.characterisation.correction.\ +augmented_matrix_Cheung2004` definition raised exception. + """ + + self.assertRaises(ValueError, augmented_matrix_Cheung2004, + np.array([0.17224810, 0.09170660, 0.06416938]), 4) + @ignore_numpy_errors def test_nan_augmented_matrix_Cheung2004(self): """ @@ -178,10 +186,6 @@ def test_nan_augmented_matrix_Cheung2004(self): augmented_matrix_Cheung2004` definition nan support. """ - # This unit test hangs on Python 3, it is thus skipped. - if PY3: - return - cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] cases = set(permutations(cases * 3, r=3)) for case in cases: @@ -197,7 +201,7 @@ class TestPolynomialExpansionFinlayson2015(unittest.TestCase): def test_polynomial_expansion_Finlayson2015(self): """ Tests :func:`colour.characterisation.correction.\ - polynomial_expansion_Finlayson2015` definition. +polynomial_expansion_Finlayson2015` definition. """ RGB = np.array([0.17224810, 0.09170660, 0.06416938]) @@ -260,17 +264,22 @@ def test_polynomial_expansion_Finlayson2015(self): polynomials[i][1], decimal=7) + def test_raise_exception_polynomial_expansion_Finlayson2015(self): + """ + Tests :func:`colour.characterisation.correction.\ +polynomial_expansion_Finlayson2015` definition raised exception. + """ + + self.assertRaises(ValueError, polynomial_expansion_Finlayson2015, + np.array([0.17224810, 0.09170660, 0.06416938]), 5) + @ignore_numpy_errors def test_nan_polynomial_expansion_Finlayson2015(self): """ Tests :func:`colour.characterisation.correction.\ - polynomial_expansion_Finlayson2015` definition nan support. +polynomial_expansion_Finlayson2015` definition nan support. """ - # This unit test hangs on Python 3, it is thus skipped. - if PY3: - return - cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] cases = set(permutations(cases * 3, r=3)) for case in cases: @@ -286,7 +295,7 @@ class TestPolynomialExpansionVandermonde(unittest.TestCase): def test_polynomial_expansion_Vandermonde(self): """ Tests :func:`colour.characterisation.correction.\ - polynomial_expansion_Vandermonde` definition. +polynomial_expansion_Vandermonde` definition. """ RGB = np.array([0.17224810, 0.09170660, 0.06416938]) @@ -318,13 +327,9 @@ def test_polynomial_expansion_Vandermonde(self): def test_nan_polynomial_expansion_Vandermonde(self): """ Tests :func:`colour.characterisation.correction.\ - polynomial_expansion_Vandermonde` definition nan support. +polynomial_expansion_Vandermonde` definition nan support. """ - # This unit test hangs on Python 3, it is thus skipped. - if PY3: - return - cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] cases = set(permutations(cases * 3, r=3)) for case in cases: @@ -340,7 +345,7 @@ class TestColourCorrectionMatrixCheung2004(unittest.TestCase): def test_colour_correction_matrix_Cheung2004(self): """ Tests :func:`colour.characterisation.correction.\ - colour_correction_matrix_Cheung2004` definition. +colour_correction_matrix_Cheung2004` definition. """ np.testing.assert_almost_equal( @@ -377,10 +382,6 @@ def test_nan_colour_correction_matrix_Cheung2004(self): colour_correction_matrix_Cheung2004` definition nan support. """ - # This unit test hangs on Python 3, it is thus skipped. - if PY3: - return - cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] cases = list(set(permutations(cases * 3, r=3)))[0:4] for case in cases: @@ -401,7 +402,7 @@ class TestColourCorrectionMatrixFinlayson2015(unittest.TestCase): def test_colour_correction_matrix_Finlayson2015(self): """ Tests :func:`colour.characterisation.correction.\ - colour_correction_matrix_Finlayson2015` definition. +colour_correction_matrix_Finlayson2015` definition. """ np.testing.assert_almost_equal( @@ -443,10 +444,6 @@ def test_nan_colour_correction_matrix_Finlayson2015(self): colour_correction_matrix_Finlayson2015` definition nan support. """ - # This unit test hangs on Python 3, it is thus skipped. - if PY3: - return - cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] cases = list(set(permutations(cases * 3, r=3)))[0:4] for case in cases: @@ -467,7 +464,7 @@ class TestColourCorrectionMatrixVandermonde(unittest.TestCase): def test_colour_correction_matrix_Vandermonde(self): """ Tests :func:`colour.characterisation.correction.\ - colour_correction_matrix_Vandermonde` definition. +colour_correction_matrix_Vandermonde` definition. """ np.testing.assert_almost_equal( @@ -507,10 +504,6 @@ def test_nan_colour_correction_matrix_Vandermonde(self): colour_correction_matrix_Vandermonde` definition nan support. """ - # This unit test hangs on Python 3, it is thus skipped. - if PY3: - return - cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] cases = list(set(permutations(cases * 3, r=3)))[0:4] for case in cases: @@ -572,10 +565,6 @@ def test_nan_colour_correction_Cheung2004(self): colour_correction_Cheung2004` definition nan support. """ - # This unit test hangs on Python 3, it is thus skipped. - if PY3: - return - cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] cases = list(set(permutations(cases * 3, r=3)))[0:4] for case in cases: @@ -637,10 +626,6 @@ def test_nan_colour_correction_Finlayson2015(self): colour_correction_Finlayson2015` definition nan support. """ - # This unit test hangs on Python 3, it is thus skipped. - if PY3: - return - cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] cases = list(set(permutations(cases * 3, r=3)))[0:4] for case in cases: @@ -702,10 +687,6 @@ def test_nan_colour_correction_Vandermonde(self): colour_correction_Vandermonde` definition nan support. """ - # This unit test hangs on Python 3, it is thus skipped. - if PY3: - return - cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] cases = list(set(permutations(cases * 3, r=3)))[0:4] for case in cases: diff --git a/colour/colorimetry/__init__.py b/colour/colorimetry/__init__.py index b42e6088ba..27a57b504a 100644 --- a/colour/colorimetry/__init__.py +++ b/colour/colorimetry/__init__.py @@ -4,16 +4,17 @@ import sys -from colour.utilities.deprecation import ModuleAPI, Renamed +from colour.utilities.deprecation import ModuleAPI, build_API_changes from colour.utilities.documentation import is_documentation_building from .spectrum import (SpectralShape, DEFAULT_SPECTRAL_SHAPE, - SpectralDistribution, MultiSpectralDistribution) + SpectralDistribution, MultiSpectralDistributions, + sds_and_multi_sds_to_sds) from .blackbody import sd_blackbody, blackbody_spectral_radiance, planck_law from .cmfs import (LMS_ConeFundamentals, RGB_ColourMatchingFunctions, XYZ_ColourMatchingFunctions) -from .dataset import * # noqa -from . import dataset +from .datasets import * # noqa +from . import datasets from .generation import sd_constant, sd_zeros, sd_ones from .generation import SD_GAUSSIAN_METHODS from .generation import sd_gaussian, sd_gaussian_normal, sd_gaussian_fwhm @@ -24,11 +25,11 @@ from .tristimulus import SD_TO_XYZ_METHODS, MULTI_SD_TO_XYZ_METHODS from .tristimulus import sd_to_XYZ, multi_sds_to_XYZ from .tristimulus import ( - ASTME30815_PRACTISE_SHAPE, lagrange_coefficients_ASTME202211, - tristimulus_weighting_factors_ASTME202211, - adjust_tristimulus_weighting_factors_ASTME30815, sd_to_XYZ_integration, - sd_to_XYZ_tristimulus_weighting_factors_ASTME30815, sd_to_XYZ_ASTME30815, - multi_sds_to_XYZ_integration, wavelength_to_XYZ) + ASTME308_PRACTISE_SHAPE, lagrange_coefficients_ASTME2022, + tristimulus_weighting_factors_ASTME2022, + adjust_tristimulus_weighting_factors_ASTME308, sd_to_XYZ_integration, + sd_to_XYZ_tristimulus_weighting_factors_ASTME308, sd_to_XYZ_ASTME308, + multi_sds_to_XYZ_integration, multi_sds_to_XYZ_ASTME308, wavelength_to_XYZ) from .correction import BANDPASS_CORRECTION_METHODS from .correction import bandpass_correction from .correction import bandpass_correction_Stearns1988 @@ -44,7 +45,7 @@ from .lightness import intermediate_lightness_function_CIE1976 from .luminance import LUMINANCE_METHODS from .luminance import luminance -from .luminance import (luminance_Newhall1943, luminance_ASTMD153508, +from .luminance import (luminance_Newhall1943, luminance_ASTMD1535, luminance_CIE1976, luminance_Fairchild2010, luminance_Fairchild2011) from .luminance import intermediate_luminance_function_CIE1976 @@ -67,14 +68,14 @@ __all__ = [ 'SpectralShape', 'DEFAULT_SPECTRAL_SHAPE', 'SpectralDistribution', - 'MultiSpectralDistribution' + 'MultiSpectralDistributions', 'sds_and_multi_sds_to_sds' ] __all__ += ['sd_blackbody', 'blackbody_spectral_radiance', 'planck_law'] __all__ += [ 'LMS_ConeFundamentals', 'RGB_ColourMatchingFunctions', 'XYZ_ColourMatchingFunctions' ] -__all__ += dataset.__all__ +__all__ += datasets.__all__ __all__ += ['sd_constant', 'sd_zeros', 'sd_ones'] __all__ += ['SD_GAUSSIAN_METHODS'] __all__ += ['sd_gaussian', 'sd_gaussian_normal', 'sd_gaussian_fwhm'] @@ -85,11 +86,12 @@ __all__ += ['SD_TO_XYZ_METHODS', 'MULTI_SD_TO_XYZ_METHODS'] __all__ += ['sd_to_XYZ', 'multi_sds_to_XYZ'] __all__ += [ - 'ASTME30815_PRACTISE_SHAPE', 'lagrange_coefficients_ASTME202211', - 'tristimulus_weighting_factors_ASTME202211', - 'adjust_tristimulus_weighting_factors_ASTME30815', 'sd_to_XYZ_integration', - 'sd_to_XYZ_tristimulus_weighting_factors_ASTME30815', - 'sd_to_XYZ_ASTME30815', 'multi_sds_to_XYZ_integration', 'wavelength_to_XYZ' + 'ASTME308_PRACTISE_SHAPE', 'lagrange_coefficients_ASTME2022', + 'tristimulus_weighting_factors_ASTME2022', + 'adjust_tristimulus_weighting_factors_ASTME308', 'sd_to_XYZ_integration', + 'sd_to_XYZ_tristimulus_weighting_factors_ASTME308', 'sd_to_XYZ_ASTME308', + 'multi_sds_to_XYZ_integration', 'multi_sds_to_XYZ_ASTME308', + 'wavelength_to_XYZ' ] __all__ += ['BANDPASS_CORRECTION_METHODS'] __all__ += ['bandpass_correction'] @@ -111,7 +113,7 @@ __all__ += ['LUMINANCE_METHODS'] __all__ += ['luminance'] __all__ += [ - 'luminance_Newhall1943', 'luminance_ASTMD153508', 'luminance_CIE1976', + 'luminance_Newhall1943', 'luminance_ASTMD1535', 'luminance_CIE1976', 'luminance_Fairchild2010', 'luminance_Fairchild2011' ] __all__ += ['intermediate_luminance_function_CIE1976'] @@ -146,10 +148,10 @@ def __getattr__(self, attribute): # v0.3.12 API_CHANGES = { - 'Renamed': [ + 'ObjectRenamed': [ [ 'colour.colorimetry.spectral_to_XYZ_ASTME30815', - 'colour.colorimetry.sd_to_XYZ_ASTME30815', + 'colour.colorimetry.sd_to_XYZ_ASTME308', ], [ 'colour.colorimetry.spectral_to_XYZ_integration', @@ -157,39 +159,46 @@ def __getattr__(self, attribute): ], [ 'colour.colorimetry.spectral_to_XYZ_tristimulus_weighting_factors_ASTME30815', # noqa - 'colour.colorimetry.sd_to_XYZ_tristimulus_weighting_factors_ASTME30815', # noqa + 'colour.colorimetry.sd_to_XYZ_tristimulus_weighting_factors_ASTME308', # noqa ], ] } """ -Defines *colour.plotting* sub-package API changes. +Defines *colour.colorimetry* sub-package API changes. API_CHANGES : dict """ - -def _setup_api_changes(): - """ - Setups *Colour* API changes. - """ - - global API_CHANGES - - for renamed in API_CHANGES['Renamed']: - name, access = renamed - API_CHANGES[name.split('.')[-1]] = Renamed(name, access) # noqa - API_CHANGES.pop('Renamed') - +# v0.3.14 +API_CHANGES['ObjectRenamed'] = API_CHANGES['ObjectRenamed'] + [ + [ + 'colour.colorimetry.adjust_tristimulus_weighting_factors_ASTME30815', # noqa + 'colour.colorimetry.adjust_tristimulus_weighting_factors_ASTME308', # noqa + ], + [ + 'colour.colorimetry.lagrange_coefficients_ASTME202211', + 'colour.colorimetry.lagrange_coefficients_ASTME2022', + ], + [ + 'colour.colorimetry.luminance_ASTMD153508', + 'colour.colorimetry.luminance_ASTMD1535', + ], + [ + 'colour.colorimetry.sd_to_XYZ_ASTME30815', + 'colour.colorimetry.sd_to_XYZ_ASTME308', + ], + [ + 'colour.colorimetry.sd_to_XYZ_tristimulus_weighting_factors_ASTME30815', # noqa + 'colour.colorimetry.sd_to_XYZ_tristimulus_weighting_factors_ASTME308', # noqa + ], + [ + 'colour.colorimetry.tristimulus_weighting_factors_ASTME202211', + 'colour.colorimetry.tristimulus_weighting_factors_ASTME2022', + ], +] if not is_documentation_building(): - _setup_api_changes() - - del ModuleAPI - del Renamed - del is_documentation_building - del _setup_api_changes - sys.modules['colour.colorimetry'] = colorimetry( - sys.modules['colour.colorimetry'], API_CHANGES) + sys.modules['colour.colorimetry'], build_API_changes(API_CHANGES)) - del sys + del ModuleAPI, is_documentation_building, build_API_changes, sys diff --git a/colour/colorimetry/blackbody.py b/colour/colorimetry/blackbody.py index 3e50fa30a2..a5c61c0517 100644 --- a/colour/colorimetry/blackbody.py +++ b/colour/colorimetry/blackbody.py @@ -138,11 +138,9 @@ def sd_blackbody(temperature, shape=DEFAULT_SPECTRAL_SHAPE, c1=C1, c2=C2, n=N): Examples -------- - >>> from colour import STANDARD_OBSERVERS_CMFS >>> from colour.utilities import numpy_print_options - >>> cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] >>> with numpy_print_options(suppress=True): - ... sd_blackbody(5000, cmfs.shape) # doctest: +ELLIPSIS + ... sd_blackbody(5000) # doctest: +ELLIPSIS SpectralDistribution([[ 3.60000000e+02, 6.65427827e+12], [ 3.61000000e+02, 6.70960528e+12], [ 3.62000000e+02, 6.76482512e+12], @@ -563,57 +561,7 @@ def sd_blackbody(temperature, shape=DEFAULT_SPECTRAL_SHAPE, c1=C1, c2=C2, n=N): [ 7.77000000e+02, 1.06232545e+13], [ 7.78000000e+02, 1.06068004e+13], [ 7.79000000e+02, 1.05903327e+13], - [ 7.80000000e+02, 1.05738520e+13], - [ 7.81000000e+02, 1.05573585e+13], - [ 7.82000000e+02, 1.05408527e+13], - [ 7.83000000e+02, 1.05243351e+13], - [ 7.84000000e+02, 1.05078060e+13], - [ 7.85000000e+02, 1.04912657e+13], - [ 7.86000000e+02, 1.04747147e+13], - [ 7.87000000e+02, 1.04581535e+13], - [ 7.88000000e+02, 1.04415822e+13], - [ 7.89000000e+02, 1.04250014e+13], - [ 7.90000000e+02, 1.04084115e+13], - [ 7.91000000e+02, 1.03918127e+13], - [ 7.92000000e+02, 1.03752055e+13], - [ 7.93000000e+02, 1.03585902e+13], - [ 7.94000000e+02, 1.03419672e+13], - [ 7.95000000e+02, 1.03253369e+13], - [ 7.96000000e+02, 1.03086995e+13], - [ 7.97000000e+02, 1.02920556e+13], - [ 7.98000000e+02, 1.02754053e+13], - [ 7.99000000e+02, 1.02587492e+13], - [ 8.00000000e+02, 1.02420874e+13], - [ 8.01000000e+02, 1.02254204e+13], - [ 8.02000000e+02, 1.02087485e+13], - [ 8.03000000e+02, 1.01920720e+13], - [ 8.04000000e+02, 1.01753913e+13], - [ 8.05000000e+02, 1.01587067e+13], - [ 8.06000000e+02, 1.01420186e+13], - [ 8.07000000e+02, 1.01253271e+13], - [ 8.08000000e+02, 1.01086328e+13], - [ 8.09000000e+02, 1.00919358e+13], - [ 8.10000000e+02, 1.00752366e+13], - [ 8.11000000e+02, 1.00585353e+13], - [ 8.12000000e+02, 1.00418324e+13], - [ 8.13000000e+02, 1.00251282e+13], - [ 8.14000000e+02, 1.00084228e+13], - [ 8.15000000e+02, 9.99171677e+12], - [ 8.16000000e+02, 9.97501023e+12], - [ 8.17000000e+02, 9.95830354e+12], - [ 8.18000000e+02, 9.94159699e+12], - [ 8.19000000e+02, 9.92489086e+12], - [ 8.20000000e+02, 9.90818544e+12], - [ 8.21000000e+02, 9.89148102e+12], - [ 8.22000000e+02, 9.87477789e+12], - [ 8.23000000e+02, 9.85807631e+12], - [ 8.24000000e+02, 9.84137658e+12], - [ 8.25000000e+02, 9.82467896e+12], - [ 8.26000000e+02, 9.80798374e+12], - [ 8.27000000e+02, 9.79129116e+12], - [ 8.28000000e+02, 9.77460152e+12], - [ 8.29000000e+02, 9.75791506e+12], - [ 8.30000000e+02, 9.74123205e+12]], + [ 7.80000000e+02, 1.05738520e+13]], interpolator=SpragueInterpolator, interpolator_args={}, extrapolator=Extrapolator, diff --git a/colour/colorimetry/cmfs.py b/colour/colorimetry/cmfs.py index 50d8ef790c..a552685abf 100644 --- a/colour/colorimetry/cmfs.py +++ b/colour/colorimetry/cmfs.py @@ -3,8 +3,8 @@ Colour Matching Functions ========================= -Defines colour matching functions classes for the dataset from -:mod:`colour.colorimetry.dataset.cmfs` module: +Defines colour matching functions classes for the datasets from +:mod:`colour.colorimetry.datasets.cmfs` module: - :class:`colour.colorimetry.LMS_ConeFundamentals`: Implements support for the *Stockman and Sharpe* *LMS* cone fundamentals colour matching @@ -23,7 +23,7 @@ from __future__ import division, unicode_literals -from colour.colorimetry import MultiSpectralDistribution +from colour.colorimetry import MultiSpectralDistributions __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -38,16 +38,16 @@ ] -class LMS_ConeFundamentals(MultiSpectralDistribution): +class LMS_ConeFundamentals(MultiSpectralDistributions): """ Implements support for the Stockman and Sharpe *LMS* cone fundamentals colour matching functions. Parameters ---------- - data : Series or Dataframe or Signal or MultiSignal or \ -MultiSpectralDistribution or array_like or dict_like, optional - Data to be stored in the multi-spectral distribution. + data : Series or Dataframe or Signal or MultiSignals or \ +MultiSpectralDistributions or array_like or dict_like, optional + Data to be stored in the multi-spectral distributions. domain : array_like, optional class instances :attr:`colour.continuous.Signal.wavelengths` attribute with. If both ``data`` and ``domain`` arguments are defined, the latter @@ -61,7 +61,7 @@ class instances :attr:`colour.continuous.Signal.wavelengths` attribute Other Parameters ---------------- name : unicode, optional - Multi-spectral distribution name. + Multi-spectral distributions name. interpolator : object, optional Interpolator class type to use as interpolating function for the :class:`colour.SpectralDistribution` class instances. @@ -75,7 +75,7 @@ class instances :attr:`colour.continuous.Signal.wavelengths` attribute Arguments to use when instantiating the extrapolating function of the :class:`colour.SpectralDistribution` class instances. strict_labels : array_like, optional - Multi-spectral distribution labels for figures, default to + Multi-spectral distributions labels for figures, default to :attr:`colour.colorimetry.LMS_ConeFundamentals.labels` attribute value. """ @@ -88,15 +88,15 @@ def __init__(self, data=None, domain=None, labels=None, **kwargs): **kwargs) -class RGB_ColourMatchingFunctions(MultiSpectralDistribution): +class RGB_ColourMatchingFunctions(MultiSpectralDistributions): """ Implements support for the *CIE RGB* colour matching functions. Parameters ---------- - data : Series or Dataframe or Signal or MultiSignal or \ -MultiSpectralDistribution or array_like or dict_like, optional - Data to be stored in the multi-spectral distribution. + data : Series or Dataframe or Signal or MultiSignals or \ +MultiSpectralDistributions or array_like or dict_like, optional + Data to be stored in the multi-spectral distributions. domain : array_like, optional Values to initialise the multiple :class:`colour.SpectralDistribution` class instances :attr:`colour.continuous.Signal.wavelengths` attribute @@ -110,7 +110,7 @@ class instances :attr:`colour.continuous.Signal.wavelengths` attribute Other Parameters ---------------- name : unicode, optional - Multi-spectral distribution name. + Multi-spectral distributions name. interpolator : object, optional Interpolator class type to use as interpolating function for the :class:`colour.SpectralDistribution` class instances. @@ -124,7 +124,7 @@ class instances :attr:`colour.continuous.Signal.wavelengths` attribute Arguments to use when instantiating the extrapolating function of the :class:`colour.SpectralDistribution` class instances. strict_labels : array_like, optional - Multi-spectral distribution labels for figures, default to + Multi-spectral distributions labels for figures, default to :attr:`colour.colorimetry.RGB_ColourMatchingFunctions.labels` attribute value. """ @@ -138,16 +138,16 @@ def __init__(self, data=None, domain=None, labels=None, **kwargs): **kwargs) -class XYZ_ColourMatchingFunctions(MultiSpectralDistribution): +class XYZ_ColourMatchingFunctions(MultiSpectralDistributions): """ Implements support for the *CIE* Standard Observers *XYZ* colour matching functions. Parameters ---------- - data : Series or Dataframe or Signal or MultiSignal or \ -MultiSpectralDistribution or array_like or dict_like, optional - Data to be stored in the multi-spectral distribution. + data : Series or Dataframe or Signal or MultiSignals or \ +MultiSpectralDistributions or array_like or dict_like, optional + Data to be stored in the multi-spectral distributions. domain : array_like, optional Values to initialise the multiple :class:`colour.SpectralDistribution` class instances :attr:`colour.continuous.Signal.wavelengths` attribute @@ -161,7 +161,7 @@ class instances :attr:`colour.continuous.Signal.wavelengths` attribute Other Parameters ---------------- name : unicode, optional - Multi-spectral distribution name. + Multi-spectral distributions name. interpolator : object, optional Interpolator class type to use as interpolating function for the :class:`colour.SpectralDistribution` class instances. @@ -175,7 +175,7 @@ class instances :attr:`colour.continuous.Signal.wavelengths` attribute Arguments to use when instantiating the extrapolating function of the :class:`colour.SpectralDistribution` class instances. strict_labels : array_like, optional - Multi-spectral distribution labels for figures, default to + Multi-spectral distributions labels for figures, default to :attr:`colour.colorimetry.XYZ_ColourMatchingFunctions.labels` attribute value. """ diff --git a/colour/colorimetry/correction.py b/colour/colorimetry/correction.py index 71fe40e194..e6161c3376 100644 --- a/colour/colorimetry/correction.py +++ b/colour/colorimetry/correction.py @@ -84,8 +84,7 @@ def bandpass_correction_Stearns1988(sd): ... 600: 0.1360 ... } >>> with numpy_print_options(suppress=True): - ... bandpass_correction_Stearns1988( - ... SpectralDistribution(data)) + ... bandpass_correction_Stearns1988(SpectralDistribution(data)) ... # doctest: +ELLIPSIS SpectralDistribution([[ 500. , 0.0646518...], [ 520. , 0.0704293...], @@ -133,13 +132,43 @@ def bandpass_correction(sd, method='Stearns 1988'): sd : SpectralDistribution Spectral distribution. method : unicode, optional - ('Stearns 1988', ) + {'Stearns 1988', } Correction method. Returns ------- SpectralDistribution Spectral bandpass dependence corrected spectral distribution. + + References + ---------- + :cite:`Stearns1988a`, :cite:`Westland2012f` + + Examples + -------- + >>> from colour import SpectralDistribution + >>> from colour.utilities import numpy_print_options + >>> data = { + ... 500: 0.0651, + ... 520: 0.0705, + ... 540: 0.0772, + ... 560: 0.0870, + ... 580: 0.1128, + ... 600: 0.1360 + ... } + >>> with numpy_print_options(suppress=True): + ... bandpass_correction(SpectralDistribution(data)) + ... # doctest: +ELLIPSIS + SpectralDistribution([[ 500. , 0.0646518...], + [ 520. , 0.0704293...], + [ 540. , 0.0769485...], + [ 560. , 0.0856928...], + [ 580. , 0.1129644...], + [ 600. , 0.1379256...]], + interpolator=SpragueInterpolator, + interpolator_args={}, + extrapolator=Extrapolator, + extrapolator_args={...}) """ return BANDPASS_CORRECTION_METHODS.get(method)(sd) diff --git a/colour/colorimetry/dataset/__init__.py b/colour/colorimetry/datasets/__init__.py similarity index 100% rename from colour/colorimetry/dataset/__init__.py rename to colour/colorimetry/datasets/__init__.py diff --git a/colour/colorimetry/dataset/cmfs.py b/colour/colorimetry/datasets/cmfs.py similarity index 99% rename from colour/colorimetry/dataset/cmfs.py rename to colour/colorimetry/datasets/cmfs.py index aafea4d449..49d9929f36 100644 --- a/colour/colorimetry/dataset/cmfs.py +++ b/colour/colorimetry/datasets/cmfs.py @@ -6,11 +6,11 @@ Defines various colour matching functions involved in spectral computations. The colour matching functions data is in the form of a *dict* of -:class:`colour.colorimetry.MultiSpectralDistribution` classes as follows:: +:class:`colour.colorimetry.MultiSpectralDistributions` classes as follows:: - {'name': MultiSpectralDistribution, + {'name': MultiSpectralDistributions, ..., - 'name': MultiSpectralDistribution} + 'name': MultiSpectralDistributions} The following colour matching functions are available: diff --git a/colour/colorimetry/dataset/illuminants/__init__.py b/colour/colorimetry/datasets/illuminants/__init__.py similarity index 100% rename from colour/colorimetry/dataset/illuminants/__init__.py rename to colour/colorimetry/datasets/illuminants/__init__.py diff --git a/colour/colorimetry/dataset/illuminants/chromaticity_coordinates.py b/colour/colorimetry/datasets/illuminants/chromaticity_coordinates.py similarity index 90% rename from colour/colorimetry/dataset/illuminants/chromaticity_coordinates.py rename to colour/colorimetry/datasets/illuminants/chromaticity_coordinates.py index 920e4d0af2..96c62e81fe 100644 --- a/colour/colorimetry/dataset/illuminants/chromaticity_coordinates.py +++ b/colour/colorimetry/datasets/illuminants/chromaticity_coordinates.py @@ -19,10 +19,12 @@ FL3.3, FL3.4, FL3.5, FL3.6, FL3.7, FL3.8, FL3.9) - High Pressure Discharge Lamps (HP1, HP2, HP3, HP4, HP5) -The following other illuminants are available: +The following other illuminants are available for the +*CIE 1931 2 Degree Standard Observer* only: -- DCI-P3 (*CIE 1931 2 Degree Standard Observer* only) -- ACES (*CIE 1931 2 Degree Standard Observer* only) +- ACES +- DCI-P3 +- ICC D50 See Also -------- @@ -30,21 +32,6 @@ `_ -Warning -------- -DCI-P3 illuminant has no associated spectral distribution. DCI has no -official reference spectral measurement for this whitepoint. The closest -matching spectral distribution is Kinoton 75P projector. - -Notes ------ -- *CIE* illuminants with chromaticity coordinates not defined in the - reference :cite:`Wikipedia2006a` have been calculated using their - correlated colour temperature and - :func:`colour.temperature.CCT_to_xy_CIE_D` - :func:`colour.sd_CIE_illuminant_D_series` and / or - :func:`colour.sd_to_XYZ` definitions. - References ---------- - :cite:`CIETC1-482004h` : CIE TC 1-48. (2004). CIE 015:2004 Colorimetry, @@ -114,8 +101,9 @@ """ ILLUMINANTS_CIE_1931_2_DEGREE_STANDARD_OBSERVER.update({ + 'ACES': np.array([0.32168, 0.33767]), 'DCI-P3': np.array([0.31400, 0.35100]), - 'ACES': np.array([0.32168, 0.33767]) + 'ICC D50': np.array([0.345702914918791, 0.358538596679933]) }) ILLUMINANTS_CIE_1931_2_DEGREE_STANDARD_OBSERVER.update({ @@ -203,6 +191,12 @@ ILLUMINANTS.__doc__ = """ Aggregated *CIE* illuminants chromaticity coordinates. +Warning +------- +*DCI-P3* illuminant has no associated spectral distribution. *DCI* has no +official reference spectral measurement for this whitepoint. The closest +matching spectral distribution is *Kinoton 75P* projector. + Notes ----- @@ -218,11 +212,20 @@ colour.sd_to_XYZ( sd, colour.CMFS['CIE 1964 10 Degree Standard Observer']) / 100.0) -*CIE Illuminant D Series D50* illuminant and -*CIE Standard Illuminant D Series D65* chromaticity coordinates are rounded to -4 decimals as given in the typical RGB colourspaces litterature. Their -chromaticity coordinates as given in :cite:`CIETC1-482004h` are -(0.34567, 0.35851) and (0.31272, 0.32903) respectively. +- *CIE Illuminant D Series D50* illuminant and + *CIE Standard Illuminant D Series D65* chromaticity coordinates are rounded + to 4 decimals as given in the typical RGB colourspaces litterature. Their + chromaticity coordinates as given in :cite:`CIETC1-482004h` are + (0.34567, 0.35851) and (0.31272, 0.32903) respectively. +- *CIE* illuminants with chromaticity coordinates not defined in the + reference :cite:`Wikipedia2006a` have been calculated using their + correlated colour temperature and + :func:`colour.temperature.CCT_to_xy_CIE_D` + :func:`colour.sd_CIE_illuminant_D_series` and / or + :func:`colour.sd_to_XYZ` definitions. +- *ICC D50* chromaticity coordinates were computed with + :func:`colour.XYZ_to_xy` definition from the *CIE XYZ* tristimulus values + as given by *ICC*: [96.42, 100.00, 82.49]. References ---------- diff --git a/colour/colorimetry/dataset/illuminants/d_illuminants_s_sds.py b/colour/colorimetry/datasets/illuminants/d_illuminants_s_sds.py similarity index 100% rename from colour/colorimetry/dataset/illuminants/d_illuminants_s_sds.py rename to colour/colorimetry/datasets/illuminants/d_illuminants_s_sds.py diff --git a/colour/colorimetry/dataset/illuminants/hunterlab.py b/colour/colorimetry/datasets/illuminants/hunterlab.py similarity index 95% rename from colour/colorimetry/dataset/illuminants/hunterlab.py rename to colour/colorimetry/datasets/illuminants/hunterlab.py index 1caea1ec46..8151e2c038 100644 --- a/colour/colorimetry/dataset/illuminants/hunterlab.py +++ b/colour/colorimetry/datasets/illuminants/hunterlab.py @@ -3,7 +3,7 @@ HunterLab Dataset ================= -Defines the *HunterLab* illuminants dataset for the +Defines the *HunterLab* illuminants datasets for the *CIE 1931 2 Degree Standard Observer* and *CIE 1964 10 Degree Standard Observer*. @@ -73,7 +73,7 @@ for x in HUNTERLAB_ILLUMINANTS_CIE_1931_2_DEGREE_STANDARD_OBSERVER_DATA })) """ -*Hunter L,a,b* illuminant dataset for *CIE 1931 2 Degree Standard Observer*. +*Hunter L,a,b* illuminant datasets for *CIE 1931 2 Degree Standard Observer*. References ---------- @@ -103,7 +103,7 @@ HUNTERLAB_ILLUMINANTS_CIE_1964_10_DEGREE_STANDARD_OBSERVER_DATA })) """ -*Hunter L,a,b* illuminant dataset for *CIE 1964 10 Degree Standard Observer*. +*Hunter L,a,b* illuminant datasets for *CIE 1964 10 Degree Standard Observer*. References ---------- @@ -120,7 +120,7 @@ HUNTERLAB_ILLUMINANTS_CIE_1964_10_DEGREE_STANDARD_OBSERVER }) HUNTERLAB_ILLUMINANTS.__doc__ = """ -Aggregated *Hunter L,a,b* illuminant dataset. +Aggregated *Hunter L,a,b* illuminant datasets. References ---------- diff --git a/colour/colorimetry/dataset/illuminants/sds.py b/colour/colorimetry/datasets/illuminants/sds.py similarity index 100% rename from colour/colorimetry/dataset/illuminants/sds.py rename to colour/colorimetry/datasets/illuminants/sds.py diff --git a/colour/colorimetry/dataset/lefs.py b/colour/colorimetry/datasets/lefs.py similarity index 99% rename from colour/colorimetry/dataset/lefs.py rename to colour/colorimetry/datasets/lefs.py index 3b8d7c8783..5e1d3334b4 100644 --- a/colour/colorimetry/dataset/lefs.py +++ b/colour/colorimetry/datasets/lefs.py @@ -34,7 +34,7 @@ *CIE 1924 Photopic Standard Observer* and *CIE 1951 Scotopic Standard Observer* luminous efficiency functions with the :func:`colour.sd_mesopic_luminous_efficiency_function` definition and - the data from :attr:`colour.colorimetry.dataset.lefs.MESOPIC_X_DATA` + the data from :attr:`colour.colorimetry.datasets.lefs.MESOPIC_X_DATA` attribute that defines weighting factors dependent on the photopic luminance :math:`L_p`. diff --git a/colour/colorimetry/dataset/light_sources/__init__.py b/colour/colorimetry/datasets/light_sources/__init__.py similarity index 100% rename from colour/colorimetry/dataset/light_sources/__init__.py rename to colour/colorimetry/datasets/light_sources/__init__.py diff --git a/colour/colorimetry/dataset/light_sources/chromaticity_coordinates.py b/colour/colorimetry/datasets/light_sources/chromaticity_coordinates.py similarity index 100% rename from colour/colorimetry/dataset/light_sources/chromaticity_coordinates.py rename to colour/colorimetry/datasets/light_sources/chromaticity_coordinates.py diff --git a/colour/colorimetry/dataset/light_sources/sds.py b/colour/colorimetry/datasets/light_sources/sds.py similarity index 100% rename from colour/colorimetry/dataset/light_sources/sds.py rename to colour/colorimetry/datasets/light_sources/sds.py diff --git a/colour/colorimetry/dominant.py b/colour/colorimetry/dominant.py index 32fc7ffd7d..d8834a94d6 100644 --- a/colour/colorimetry/dominant.py +++ b/colour/colorimetry/dominant.py @@ -52,29 +52,29 @@ ] -def closest_spectral_locus_wavelength(xy, xy_n, xy_s, reverse=False): +def closest_spectral_locus_wavelength(xy, xy_n, xy_s, inverse=False): """ Returns the coordinates and closest spectral locus wavelength index to the point where the line defined by the given achromatic stimulus :math:`xy_n` - to colour stimulus :math:`xy_n` *xy* chromaticity coordinates intersects - the spectral locus. + to colour stimulus :math:`xy_n` *CIE xy* chromaticity coordinates + intersects the spectral locus. Parameters ---------- xy : array_like - Colour stimulus *xy* chromaticity coordinates. + Colour stimulus *CIE xy* chromaticity coordinates. xy_n : array_like - Achromatic stimulus *xy* chromaticity coordinates. + Achromatic stimulus *CIE xy* chromaticity coordinates. xy_s : array_like - Spectral locus *xy* chromaticity coordinates. - reverse : bool, optional + Spectral locus *CIE xy* chromaticity coordinates. + inverse : bool, optional The intersection will be computed using the colour stimulus :math:`xy` - to achromatic stimulus :math:`xy_n` reverse direction. + to achromatic stimulus :math:`xy_n` inverse direction. Returns ------- tuple - Closest wavelength index, intersection point *xy* chromaticity + Closest wavelength index, intersection point *CIE xy* chromaticity coordinates. Raises @@ -99,7 +99,7 @@ def closest_spectral_locus_wavelength(xy, xy_n, xy_s, reverse=False): xy_s = as_float_array(xy_s) xy_e = (extend_line_segment(xy, xy_n) - if reverse else extend_line_segment(xy_n, xy)) + if inverse else extend_line_segment(xy_n, xy)) # Closing horse-shoe shape to handle line of purples intersections. xy_s = np.vstack([xy_s, xy_s[0, :]]) @@ -125,7 +125,7 @@ def closest_spectral_locus_wavelength(xy, xy_n, xy_s, reverse=False): def dominant_wavelength(xy, xy_n, cmfs=CMFS['CIE 1931 2 Degree Standard Observer'], - reverse=False): + inverse=False): """ Returns the *dominant wavelength* :math:`\\lambda_d` for given colour stimulus :math:`xy` and the related :math:`xy_wl` first and :math:`xy_{cw}` @@ -144,20 +144,21 @@ def dominant_wavelength(xy, Parameters ---------- xy : array_like - Colour stimulus *xy* chromaticity coordinates. + Colour stimulus *CIE xy* chromaticity coordinates. xy_n : array_like - Achromatic stimulus *xy* chromaticity coordinates. + Achromatic stimulus *CIE xy* chromaticity coordinates. cmfs : XYZ_ColourMatchingFunctions, optional Standard observer colour matching functions. - reverse : bool, optional - Reverse the computation direction to retrieve the + inverse : bool, optional + Inverse the computation direction to retrieve the *complementary wavelength*. Returns ------- tuple - *Dominant wavelength*, first intersection point *xy* chromaticity - coordinates, second intersection point *xy* chromaticity coordinates. + *Dominant wavelength*, first intersection point *CIE xy* chromaticity + coordinates, second intersection point *CIE xy* chromaticity + coordinates. References ---------- @@ -191,19 +192,19 @@ def dominant_wavelength(xy, xy_s = XYZ_to_xy(cmfs.values) - i_wl, xy_wl = closest_spectral_locus_wavelength(xy, xy_n, xy_s, reverse) + i_wl, xy_wl = closest_spectral_locus_wavelength(xy, xy_n, xy_s, inverse) xy_cwl = xy_wl wl = cmfs.wavelengths[i_wl] xy_e = (extend_line_segment(xy, xy_n) - if reverse else extend_line_segment(xy_n, xy)) + if inverse else extend_line_segment(xy_n, xy)) intersect = intersect_line_segments( np.concatenate((xy_n, xy_e), -1), np.hstack([xy_s[0], xy_s[-1]])).intersect intersect = np.reshape(intersect, wl.shape) i_wl_r, xy_cwl_r = closest_spectral_locus_wavelength( - xy, xy_n, xy_s, not reverse) + xy, xy_n, xy_s, not inverse) wl_r = -cmfs.wavelengths[i_wl_r] wl = np.where(intersect, wl_r, wl) @@ -233,17 +234,18 @@ def complementary_wavelength(xy, Parameters ---------- xy : array_like - Colour stimulus *xy* chromaticity coordinates. + Colour stimulus *CIE xy* chromaticity coordinates. xy_n : array_like - Achromatic stimulus *xy* chromaticity coordinates. + Achromatic stimulus *CIE xy* chromaticity coordinates. cmfs : XYZ_ColourMatchingFunctions, optional Standard observer colour matching functions. Returns ------- tuple - *Complementary wavelength*, first intersection point *xy* chromaticity - coordinates, second intersection point *xy* chromaticity coordinates. + *Complementary wavelength*, first intersection point *CIE xy* + chromaticity coordinates, second intersection point *CIE xy* + chromaticity coordinates. References ---------- @@ -285,9 +287,9 @@ def excitation_purity(xy, Parameters ---------- xy : array_like - Colour stimulus *xy* chromaticity coordinates. + Colour stimulus *CIE xy* chromaticity coordinates. xy_n : array_like - Achromatic stimulus *xy* chromaticity coordinates. + Achromatic stimulus *CIE xy* chromaticity coordinates. cmfs : XYZ_ColourMatchingFunctions, optional Standard observer colour matching functions. @@ -326,9 +328,9 @@ def colorimetric_purity(xy, Parameters ---------- xy : array_like - Colour stimulus *xy* chromaticity coordinates. + Colour stimulus *CIE xy* chromaticity coordinates. xy_n : array_like - Achromatic stimulus *xy* chromaticity coordinates. + Achromatic stimulus *CIE xy* chromaticity coordinates. cmfs : XYZ_ColourMatchingFunctions, optional Standard observer colour matching functions. diff --git a/colour/colorimetry/illuminants.py b/colour/colorimetry/illuminants.py index 60517fcef8..e34ba897ce 100644 --- a/colour/colorimetry/illuminants.py +++ b/colour/colorimetry/illuminants.py @@ -129,13 +129,13 @@ def sd_CIE_standard_illuminant_A(shape=DEFAULT_SPECTRAL_SHAPE): def sd_CIE_illuminant_D_series(xy, M1_M2_rounding=True): """ - Returns the spectral distribution of given - *CIE Illuminant D Series* using given *xy* chromaticity coordinates. + Returns the spectral distribution of given *CIE Illuminant D Series* using + given *CIE xy* chromaticity coordinates. Parameters ---------- xy : array_like - *xy* chromaticity coordinates. + *CIE xy* chromaticity coordinates. M1_M2_rounding : bool, optional Whether to round :math:`M1` and :math:`M2` variables to 3 decimal places in order to yield the internationally agreed values. @@ -148,9 +148,10 @@ def sd_CIE_illuminant_D_series(xy, M1_M2_rounding=True): Notes ----- - - The nominal *xy* chromaticity coordinates which have been computed with - :func:`colour.temperature.CCT_to_xy_CIE_D` must be given according to - *CIE 015:2004* recommendation and thus multiplied by 1.4388 / 1.4380. + - The nominal *CIE xy* chromaticity coordinates which have been computed + with :func:`colour.temperature.CCT_to_xy_CIE_D` must be given according + to *CIE 015:2004* recommendation and thus multiplied by + 1.4388 / 1.4380. - :math:`M1` and :math:`M2` variables are rounded to 3 decimal places according to *CIE 015:2004* recommendation. @@ -301,7 +302,7 @@ def sd_CIE_illuminant_D_series(xy, M1_M2_rounding=True): def daylight_locus_function(x_D): """ - Returns the daylight locus as *xy* chromaticity coordinates. + Returns the daylight locus as *CIE xy* chromaticity coordinates. Parameters ---------- @@ -311,7 +312,7 @@ def daylight_locus_function(x_D): Returns ------- numeric or array_like - Daylight locus as *xy* chromaticity coordinates. + Daylight locus as *CIE xy* chromaticity coordinates. References ---------- diff --git a/colour/colorimetry/lefs.py b/colour/colorimetry/lefs.py index fca2e3124f..1164115871 100644 --- a/colour/colorimetry/lefs.py +++ b/colour/colorimetry/lefs.py @@ -22,7 +22,7 @@ from colour.colorimetry import (PHOTOPIC_LEFS, SCOTOPIC_LEFS, SpectralDistribution, SpectralShape) -from colour.colorimetry.dataset.lefs import MESOPIC_X_DATA +from colour.colorimetry.datasets.lefs import MESOPIC_X_DATA from colour.utilities import closest __author__ = 'Colour Developers' diff --git a/colour/colorimetry/luminance.py b/colour/colorimetry/luminance.py index 45af2b1e88..972992f624 100644 --- a/colour/colorimetry/luminance.py +++ b/colour/colorimetry/luminance.py @@ -10,7 +10,7 @@ - :func:`colour.colorimetry.luminance_Newhall1943`: *luminance* :math:`Y` computation of given *Munsell* value :math:`V` using *Newhall, Nickerson and Judd (1943)* method. -- :func:`colour.colorimetry.luminance_ASTMD153508`: *luminance* :math:`Y` +- :func:`colour.colorimetry.luminance_ASTMD1535`: *luminance* :math:`Y` computation of given *Munsell* value :math:`V` using *ASTM D1535-08e1* method. - :func:`colour.colorimetry.luminance_CIE1976`: *luminance* :math:`Y` @@ -80,7 +80,7 @@ __status__ = 'Production' __all__ = [ - 'luminance_Newhall1943', 'luminance_ASTMD153508', + 'luminance_Newhall1943', 'luminance_ASTMD1535', 'intermediate_luminance_function_CIE1976', 'luminance_CIE1976', 'luminance_Fairchild2010', 'luminance_Fairchild2011', 'LUMINANCE_METHODS', 'luminance' @@ -135,7 +135,7 @@ def luminance_Newhall1943(V): return from_range_100(R_Y) -def luminance_ASTMD153508(V): +def luminance_ASTMD1535(V): """ Returns the *luminance* :math:`Y` of given *Munsell* value :math:`V` using *ASTM D1535-08e1* method. @@ -171,7 +171,7 @@ def luminance_ASTMD153508(V): Examples -------- - >>> luminance_ASTMD153508(4.08244375) # doctest: +ELLIPSIS + >>> luminance_ASTMD1535(4.08244375) # doctest: +ELLIPSIS 12.2363426... """ @@ -421,7 +421,7 @@ def luminance_Fairchild2011(L_hdr, epsilon=0.474, method='hdr-CIELAB'): LUMINANCE_METHODS = CaseInsensitiveMapping({ 'Newhall 1943': luminance_Newhall1943, - 'ASTM D1535-08': luminance_ASTMD153508, + 'ASTM D1535': luminance_ASTMD1535, 'CIE 1976': luminance_CIE1976, 'Fairchild 2010': luminance_Fairchild2010, 'Fairchild 2011': luminance_Fairchild2011 @@ -435,14 +435,14 @@ def luminance_Fairchild2011(L_hdr, epsilon=0.474, method='hdr-CIELAB'): :cite:`Fairchild2011`, :cite:`Newhall1943a`, :cite:`Wyszecki2000bd` LUMINANCE_METHODS : CaseInsensitiveMapping - **{'Newhall 1943', 'ASTM D1535-08', 'CIE 1976', 'Fairchild 2010'}** + **{'Newhall 1943', 'ASTM D1535', 'CIE 1976', 'Fairchild 2010'}** Aliases: -- 'astm2008': 'ASTM D1535-08' +- 'astm2008': 'ASTM D1535' - 'cie1976': 'CIE 1976' """ -LUMINANCE_METHODS['astm2008'] = (LUMINANCE_METHODS['ASTM D1535-08']) +LUMINANCE_METHODS['astm2008'] = (LUMINANCE_METHODS['ASTM D1535']) LUMINANCE_METHODS['cie1976'] = (LUMINANCE_METHODS['CIE 1976']) @@ -456,7 +456,7 @@ def luminance(LV, method='CIE 1976', **kwargs): LV : numeric or array_like *Lightness* :math:`L^*` or *Munsell* value :math:`V`. method : unicode, optional - **{'CIE 1976', 'Newhall 1943', 'ASTM D1535-08', 'Fairchild 2010', + **{'CIE 1976', 'Newhall 1943', 'ASTM D1535', 'Fairchild 2010', 'Fairchild 2011'}**, Computation method. @@ -507,7 +507,7 @@ def luminance(LV, method='CIE 1976', **kwargs): >>> luminance(4.08244375 * 10, method='Newhall 1943') ... # doctest: +ELLIPSIS 12.5500788... - >>> luminance(4.08244375 * 10, method='ASTM D1535-08') + >>> luminance(4.08244375 * 10, method='ASTM D1535') ... # doctest: +ELLIPSIS 12.2363426... >>> luminance(29.829510892279330, epsilon=0.710, method='Fairchild 2011') @@ -519,7 +519,7 @@ def luminance(LV, method='CIE 1976', **kwargs): domain_range_reference = get_domain_range_scale() == 'reference' domain_1 = (luminance_Fairchild2010, luminance_Fairchild2011) - domain_10 = (luminance_Newhall1943, luminance_ASTMD153508) + domain_10 = (luminance_Newhall1943, luminance_ASTMD1535) if function in domain_10 and domain_range_reference: LV /= 10 diff --git a/colour/colorimetry/spectrum.py b/colour/colorimetry/spectrum.py index ab8c915a2a..ac8ca27036 100644 --- a/colour/colorimetry/spectrum.py +++ b/colour/colorimetry/spectrum.py @@ -7,7 +7,7 @@ - :class:`colour.SpectralShape` - :class:`colour.SpectralDistribution` -- :class:`colour.MultiSpectralDistribution` +- :class:`colour.MultiSpectralDistributions` See Also -------- @@ -35,10 +35,10 @@ from colour.algebra import (Extrapolator, CubicSplineInterpolator, SpragueInterpolator) from colour.constants import DEFAULT_FLOAT_DTYPE -from colour.continuous import Signal, MultiSignal +from colour.continuous import Signal, MultiSignals from colour.utilities import (as_float, first_item, is_iterable, is_numeric, is_string, is_uniform, interval, runtime_warning) -from colour.utilities.deprecation import Removed, Renamed +from colour.utilities.deprecation import ObjectRemoved, ObjectRenamed __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -49,7 +49,7 @@ __all__ = [ 'SpectralShape', 'DEFAULT_SPECTRAL_SHAPE', 'SpectralDistribution', - 'MultiSpectralDistribution' + 'MultiSpectralDistributions', 'sds_and_multi_sds_to_sds' ] @@ -1398,73 +1398,74 @@ def normalise(self, factor=1): # --- API Changes and Deprecation Management ---# # ------------------------------------------------------------------------# @property - def title(self): + def title(self): # pragma: no cover # Docstrings are omitted for documentation purposes. runtime_warning( str( - Renamed('SpectralPowerDistribution.title', - 'SpectralDistribution.strict_name'))) + ObjectRenamed('SpectralPowerDistribution.title', + 'SpectralDistribution.strict_name'))) return self.strict_name @title.setter - def title(self, value): + def title(self, value): # pragma: no cover # Docstrings are omitted for documentation purposes. runtime_warning( str( - Renamed('SpectralPowerDistribution.title', - 'SpectralDistribution.strict_name'))) + ObjectRenamed('SpectralPowerDistribution.title', + 'SpectralDistribution.strict_name'))) self.strict_name = value @property - def data(self): + def data(self): # pragma: no cover # Docstrings are omitted for documentation purposes. - raise AttributeError(str(Removed('SpectralDistribution.data'))) + raise AttributeError(str(ObjectRemoved('SpectralDistribution.data'))) @property - def items(self): + def items(self): # pragma: no cover # Docstrings are omitted for documentation purposes. - raise AttributeError(str(Removed('SpectralDistribution.items'))) + raise AttributeError(str(ObjectRemoved('SpectralDistribution.items'))) - def __iter__(self): + def __iter__(self): # pragma: no cover # Docstrings are omitted for documentation purposes. - raise AttributeError(str(Removed('SpectralDistribution.__iter__'))) + raise AttributeError( + str(ObjectRemoved('SpectralDistribution.__iter__'))) - def get(self): + def get(self): # pragma: no cover # Docstrings are omitted for documentation purposes. - raise AttributeError(str(Removed('SpectralDistribution.get'))) + raise AttributeError(str(ObjectRemoved('SpectralDistribution.get'))) - def zeros(self): + def zeros(self): # pragma: no cover # Docstrings are omitted for documentation purposes. - raise AttributeError(str(Removed('SpectralDistribution.zeros'))) + raise AttributeError(str(ObjectRemoved('SpectralDistribution.zeros'))) - def trim_wavelengths(self, shape): + def trim_wavelengths(self, shape): # pragma: no cover # Docstrings are omitted for documentation purposes. runtime_warning( str( - Renamed('SpectralPowerDistribution.trim_wavelengths', - 'SpectralDistribution.trim'))) + ObjectRenamed('SpectralPowerDistribution.trim_wavelengths', + 'SpectralDistribution.trim'))) return self.trim(shape) - def clone(self): + def clone(self): # pragma: no cover # Docstrings are omitted for documentation purposes. runtime_warning( str( - Renamed('SpectralPowerDistribution.clone', - 'SpectralDistribution.copy'))) + ObjectRenamed('SpectralPowerDistribution.clone', + 'SpectralDistribution.copy'))) return self.copy() -class MultiSpectralDistribution(MultiSignal): +class MultiSpectralDistributions(MultiSignals): """ - Defines multi-spectral distribution: the base object for multi spectral - computations. It is used to model colour matching functions, display - primaries, camera sensitivities, etc... + Defines the multi-spectral distributions: the base object for multi + spectral computations. It is used to model colour matching functions, + display primaries, camera sensitivities, etc... - The multi-spectral distribution will be initialised according to + The multi-spectral distributions will be initialised according to *CIE 15:2004* recommendation: the method developed by *Sprague (1880)* will be used for interpolating functions having a uniformly spaced independent variable and the *Cubic Spline* method for non-uniformly spaced independent @@ -1473,9 +1474,9 @@ class MultiSpectralDistribution(MultiSignal): Parameters ---------- - data : Series or Dataframe or Signal or MultiSignal or \ -MultiSpectralDistribution or array_like or dict_like, optional - Data to be stored in the multi-spectral distribution. + data : Series or Dataframe or Signal or MultiSignals or \ +MultiSpectralDistributions or array_like or dict_like, optional + Data to be stored in the multi-spectral distributions. domain : array_like, optional Values to initialise the multiple :class:`colour.SpectralDistribution` class instances :attr:`colour.continuous.Signal.wavelengths` attribute @@ -1489,7 +1490,7 @@ class instances :attr:`colour.continuous.Signal.wavelengths` attribute Other Parameters ---------------- name : unicode, optional - Multi-spectral distribution name. + Multi-spectral distributions name. interpolator : object, optional Interpolator class type to use as interpolating function for the :class:`colour.SpectralDistribution` class instances. @@ -1503,8 +1504,8 @@ class instances :attr:`colour.continuous.Signal.wavelengths` attribute Arguments to use when instantiating the extrapolating function of the :class:`colour.SpectralDistribution` class instances. strict_labels : array_like, optional - Multi-spectral distribution labels for figures, default to - :attr:`colour.MultiSpectralDistribution.labels` attribute value. + Multi-spectral distributions labels for figures, default to + :attr:`colour.MultiSpectralDistributions.labels` attribute value. Attributes ---------- @@ -1529,7 +1530,7 @@ class instances :attr:`colour.continuous.Signal.wavelengths` attribute Examples -------- - Instantiating a multi-spectral distribution with a uniformly spaced + Instantiating the multi-spectral distributions with a uniformly spaced independent variable: >>> from colour.utilities import numpy_print_options @@ -1544,7 +1545,7 @@ class instances :attr:`colour.continuous.Signal.wavelengths` attribute ... } >>> labels = ('x_bar', 'y_bar', 'z_bar') >>> with numpy_print_options(suppress=True): - ... MultiSpectralDistribution(data, labels=labels) + ... MultiSpectralDistributions(data, labels=labels) ... # doctest: +ELLIPSIS MultiSpectral...([[ 500. , 0.0049 , 0.323 , 0.272 ], ... [ 510. , 0.0093 , 0.503 , 0.1582 ], @@ -1564,7 +1565,7 @@ class instances :attr:`colour.continuous.Signal.wavelengths` attribute >>> data[511] = (0.00314, 0.31416, 0.03142) >>> with numpy_print_options(suppress=True): - ... MultiSpectralDistribution(data, labels=labels) + ... MultiSpectralDistributions(data, labels=labels) ... # doctest: +ELLIPSIS MultiSpectral...([[ 500. , 0.0049 , 0.323 , 0.272 ], ... [ 510. , 0.0093 , 0.503 , 0.1582 ], @@ -1582,7 +1583,7 @@ class instances :attr:`colour.continuous.Signal.wavelengths` attribute """ def __init__(self, data=None, domain=None, labels=None, **kwargs): - signals = self.multi_signal_unpack_data(data, domain, labels) + signals = self.multi_signals_unpack_data(data, domain, labels) domain = signals[list(signals.keys())[0]].domain if signals else None uniform = is_uniform(domain) if domain is not None else True @@ -1601,7 +1602,7 @@ def __init__(self, data=None, domain=None, labels=None, **kwargs): 'right': None }) - super(MultiSpectralDistribution, self).__init__( + super(MultiSpectralDistributions, self).__init__( signals, domain, signal_type=SpectralDistribution, **kwargs) self._strict_name = None @@ -1612,18 +1613,18 @@ def __init__(self, data=None, domain=None, labels=None, **kwargs): @property def strict_name(self): """ - Getter and setter property for the multi-spectral distribution strict + Getter and setter property for the multi-spectral distributions strict name. Parameters ---------- value : unicode - Value to set the multi-spectral distribution strict name with. + Value to set the multi-spectral distributions strict name with. Returns ------- unicode - Multi-spectral distribution strict name. + Multi-spectral distributions strict name. """ if self._strict_name is not None: @@ -1646,18 +1647,18 @@ def strict_name(self, value): @property def strict_labels(self): """ - Getter and setter property for the multi-spectral distribution strict + Getter and setter property for the multi-spectral distributions strict labels. Parameters ---------- value : array_like - Value to set the multi-spectral distribution strict labels with. + Value to set the multi-spectral distributions strict labels with. Returns ------- array_like - Multi-spectral distribution strict labels. + Multi-spectral distributions strict labels. """ if self._strict_labels is not None: @@ -1684,19 +1685,19 @@ def strict_labels(self, value): @property def wavelengths(self): """ - Getter and setter property for the multi-spectral distribution + Getter and setter property for the multi-spectral distributions wavelengths :math:`\\lambda_n`. Parameters ---------- value : array_like - Value to set the multi-spectral distribution wavelengths + Value to set the multi-spectral distributions wavelengths :math:`\\lambda_n` with. Returns ------- ndarray - Multi-spectral distribution wavelengths :math:`\\lambda_n`. + Multi-spectral distributions wavelengths :math:`\\lambda_n`. """ return self.domain @@ -1712,18 +1713,18 @@ def wavelengths(self, value): @property def values(self): """ - Getter and setter property for the multi-spectral distribution values. + Getter and setter property for the multi-spectral distributions values. Parameters ---------- value : array_like - Value to set the multi-spectral distribution wavelengths values + Value to set the multi-spectral distributions wavelengths values with. Returns ------- ndarray - Multi-spectral distribution values. + Multi-spectral distributions values. """ return self.range @@ -1739,27 +1740,27 @@ def values(self, value): @property def shape(self): """ - Getter and setter property for the multi-spectral distribution shape. + Getter and setter property for the multi-spectral distributions shape. Returns ------- SpectralShape - Multi-spectral distribution shape. + Multi-spectral distributions shape. Notes ----- - - A multi-spectral distribution with a non-uniformly spaced + - Multi-spectral distributions with a non-uniformly spaced independent variable have multiple intervals, in that case - :attr:`colour.MultiSpectralDistribution.shape` attribute returns + :attr:`colour.MultiSpectralDistributions.shape` attribute returns the *minimum* interval size. Warning ------- - :attr:`colour.MultiSpectralDistribution.shape` attribute is read only. + :attr:`colour.MultiSpectralDistributions.shape` attribute is read only. Examples -------- - Shape of a multi-spectral distribution with a uniformly spaced + Shape of the multi-spectral distributions with a uniformly spaced independent variable: >>> from colour.utilities import numpy_print_options @@ -1772,14 +1773,14 @@ def shape(self): ... 550: (0.433450, 0.994950, 0.008750), ... 560: (0.594500, 0.995000, 0.003900) ... } - >>> MultiSpectralDistribution(data).shape + >>> MultiSpectralDistributions(data).shape SpectralShape(500.0, 560.0, 10.0) - Shape of a multi-spectral distribution with a non-uniformly spaced + Shape of the multi-spectral distributions with a non-uniformly spaced independent variable: >>> data[511] = (0.00314, 0.31416, 0.03142) - >>> MultiSpectralDistribution(data).shape + >>> MultiSpectralDistributions(data).shape SpectralShape(500.0, 560.0, 1.0) """ @@ -1788,7 +1789,7 @@ def shape(self): def extrapolate(self, shape, extrapolator=None, extrapolator_args=None): """ - Extrapolates the multi-spectral distribution in-place according to + Extrapolates the multi-spectral distributions in-place according to *CIE 15:2004* and *CIE 167:2005* recommendations or given extrapolation arguments. @@ -1803,8 +1804,8 @@ def extrapolate(self, shape, extrapolator=None, extrapolator_args=None): Returns ------- - MultiSpectralDistribution - Extrapolated multi-spectral distribution. + MultiSpectralDistributions + Extrapolated multi-spectral distributions. References ---------- @@ -1822,11 +1823,11 @@ def extrapolate(self, shape, extrapolator=None, extrapolator_args=None): ... 550: (0.433450, 0.994950, 0.008750), ... 560: (0.594500, 0.995000, 0.003900) ... } - >>> multi_sd = MultiSpectralDistribution(data) - >>> multi_sd.extrapolate(SpectralShape(400, 700)).shape + >>> msds = MultiSpectralDistributions(data) + >>> msds.extrapolate(SpectralShape(400, 700)).shape SpectralShape(400.0, 700.0, 10.0) >>> with numpy_print_options(suppress=True): - ... print(multi_sd) + ... print(msds) [[ 400. 0.0049 0.323 0.272 ] [ 410. 0.0049 0.323 0.272 ] [ 420. 0.0049 0.323 0.272 ] @@ -1867,7 +1868,7 @@ def extrapolate(self, shape, extrapolator=None, extrapolator_args=None): def interpolate(self, shape, interpolator=None, interpolator_args=None): """ - Interpolates the multi-spectral distribution in-place according to + Interpolates the multi-spectral distributions in-place according to *CIE 167:2005* recommendation or given interpolation arguments. Parameters @@ -1881,8 +1882,8 @@ def interpolate(self, shape, interpolator=None, interpolator_args=None): Returns ------- - MultiSpectralDistribution - Interpolated multi-spectral distribution. + MultiSpectralDistributions + Interpolated multi-spectral distributions. Notes ----- @@ -1900,7 +1901,7 @@ def interpolate(self, shape, interpolator=None, interpolator_args=None): Examples -------- - Multi-spectral distribution with a uniformly spaced independent + Multi-spectral distributions with a uniformly spaced independent variable uses *Sprague (1880)* interpolation: >>> from colour.utilities import numpy_print_options @@ -1913,9 +1914,9 @@ def interpolate(self, shape, interpolator=None, interpolator_args=None): ... 550: (0.433450, 0.994950, 0.008750), ... 560: (0.594500, 0.995000, 0.003900) ... } - >>> multi_sd = MultiSpectralDistribution(data) + >>> msds = MultiSpectralDistributions(data) >>> with numpy_print_options(suppress=True): - ... print(multi_sd.interpolate(SpectralShape(interval=1))) + ... print(msds.interpolate(SpectralShape(interval=1))) ... # doctest: +ELLIPSIS [[ 500. 0.0049 ... 0.323 ... 0.272 ...] [ 501. 0.0043252... 0.3400642... 0.2599848...] @@ -1979,13 +1980,13 @@ def interpolate(self, shape, interpolator=None, interpolator_args=None): [ 559. 0.5780267... 0.9957974... 0.0042671...] [ 560. 0.5945 ... 0.995 ... 0.0039 ...]] - Multi-spectral distribution with a non-uniformly spaced independent + Multi-spectral distributions with a non-uniformly spaced independent variable uses *Cubic Spline* interpolation: >>> data[511] = (0.00314, 0.31416, 0.03142) - >>> multi_sd = MultiSpectralDistribution(data) + >>> msds = MultiSpectralDistributions(data) >>> with numpy_print_options(suppress=True): - ... print(multi_sd.interpolate(SpectralShape(interval=1))) + ... print(msds.interpolate(SpectralShape(interval=1))) ... # doctest: +ELLIPSIS [[ 500. 0.0049 ... 0.323 ... 0.272 ...] [ 501. 0.0300110... 0.9455153... 0.5985102...] @@ -2062,7 +2063,7 @@ def align(self, extrapolator=None, extrapolator_args=None): """ - Aligns the multi-spectral distribution in-place to given spectral + Aligns the multi-spectral distributions in-place to given spectral shape: Interpolates first then extrapolates to fit the given range. Parameters @@ -2080,8 +2081,8 @@ def align(self, Returns ------- - MultiSpectralDistribution - Aligned multi-spectral distribution. + MultiSpectralDistributions + Aligned multi-spectral distributions. Examples -------- @@ -2095,9 +2096,9 @@ def align(self, ... 550: (0.433450, 0.994950, 0.008750), ... 560: (0.594500, 0.995000, 0.003900) ... } - >>> multi_sd = MultiSpectralDistribution(data) + >>> msds = MultiSpectralDistributions(data) >>> with numpy_print_options(suppress=True): - ... print(multi_sd.align(SpectralShape(505, 565, 1))) + ... print(msds.align(SpectralShape(505, 565, 1))) ... # doctest: +ELLIPSIS [[ 505. 0.0031582... 0.4091067... 0.2126801...] [ 506. 0.0035019... 0.4268629... 0.2012748...] @@ -2170,7 +2171,7 @@ def align(self, def trim(self, shape): """ - Trims the multi-spectral distribution wavelengths to given shape. + Trims the multi-spectral distributions wavelengths to given shape. Parameters ---------- @@ -2179,8 +2180,8 @@ def trim(self, shape): Returns ------- - MultiSpectralDistribution - Trimmed multi-spectral distribution. + MultiSpectralDistributions + Trimmed multi-spectral distributions. Examples -------- @@ -2194,10 +2195,10 @@ def trim(self, shape): ... 550: (0.433450, 0.994950, 0.008750), ... 560: (0.594500, 0.995000, 0.003900) ... } - >>> multi_sd = MultiSpectralDistribution(data) - >>> multi_sd = multi_sd.interpolate(SpectralShape(interval=1)) + >>> msds = MultiSpectralDistributions(data) + >>> msds = msds.interpolate(SpectralShape(interval=1)) >>> with numpy_print_options(suppress=True): - ... print(multi_sd.trim(SpectralShape(520, 580, 5))) + ... print(msds.trim(SpectralShape(520, 580, 5))) ... # doctest: +ELLIPSIS [[ 520. 0.06327 ... 0.71 ... 0.07825 ...] [ 521. 0.0715642... 0.7283456... 0.0728614...] @@ -2249,7 +2250,7 @@ def trim(self, shape): def normalise(self, factor=1): """ - Normalises the multi-spectral distribution with given normalization + Normalises the multi-spectral distributions with given normalization factor. Parameters @@ -2259,7 +2260,7 @@ def normalise(self, factor=1): Returns ------- - MultiSpectralDistribution + MultiSpectralDistributions Normalised multi- spectral distribution. Notes @@ -2279,9 +2280,9 @@ def normalise(self, factor=1): ... 550: (0.433450, 0.994950, 0.008750), ... 560: (0.594500, 0.995000, 0.003900) ... } - >>> multi_sd = MultiSpectralDistribution(data) + >>> msds = MultiSpectralDistributions(data) >>> with numpy_print_options(suppress=True): - ... print(multi_sd.normalise()) # doctest: +ELLIPSIS + ... print(msds.normalise()) # doctest: +ELLIPSIS [[ 500. 0.0082422... 0.3246231... 1. ...] [ 510. 0.0156434... 0.5055276... 0.5816176...] [ 520. 0.1064255... 0.7135678... 0.2876838...] @@ -2319,9 +2320,9 @@ def to_sds(self): ... 550: (0.433450, 0.994950, 0.008750), ... 560: (0.594500, 0.995000, 0.003900) ... } - >>> multi_sd = MultiSpectralDistribution(data) + >>> msds = MultiSpectralDistributions(data) >>> with numpy_print_options(suppress=True): - ... for sd in multi_sd.to_sds(): + ... for sd in msds.to_sds(): ... print(sd) # doctest: +ELLIPSIS [[ 500. 0.0049 ...] [ 510. 0.0093 ...] @@ -2361,82 +2362,145 @@ def to_sds(self): # --- API Changes and Deprecation Management ---# # ------------------------------------------------------------------------# @property - def title(self): + def title(self): # pragma: no cover # Docstrings are omitted for documentation purposes. runtime_warning( str( - Renamed('TriSpectralPowerDistribution.title', - 'SpectralDistribution.strict_name'))) + ObjectRenamed('TriSpectralPowerDistribution.title', + 'SpectralDistribution.strict_name'))) return self.strict_name @title.setter - def title(self, value): + def title(self, value): # pragma: no cover # Docstrings are omitted for documentation purposes. runtime_warning( str( - Renamed('TriSpectralPowerDistribution.title', - 'SpectralDistribution.strict_name'))) + ObjectRenamed('TriSpectralPowerDistribution.title', + 'SpectralDistribution.strict_name'))) self.strict_name = value @property - def data(self): + def data(self): # pragma: no cover # Docstrings are omitted for documentation purposes. - raise AttributeError(str(Removed('MultiSpectralDistribution.data'))) + raise AttributeError( + str(ObjectRemoved('MultiSpectralDistributions.data'))) @property - def items(self): + def items(self): # pragma: no cover # Docstrings are omitted for documentation purposes. - raise AttributeError(str(Removed('MultiSpectralDistribution.items'))) + raise AttributeError( + str(ObjectRemoved('MultiSpectralDistributions.items'))) @property - def mapping(self): + def mapping(self): # pragma: no cover # Docstrings are omitted for documentation purposes. - raise AttributeError(str(Removed('MultiSpectralDistribution.mapping'))) + raise AttributeError( + str(ObjectRemoved('MultiSpectralDistributions.mapping'))) @property - def x(self): + def x(self): # pragma: no cover # Docstrings are omitted for documentation purposes. - raise AttributeError(str(Removed('MultiSpectralDistribution.x'))) + raise AttributeError( + str(ObjectRemoved('MultiSpectralDistributions.x'))) @property - def y(self): + def y(self): # pragma: no cover # Docstrings are omitted for documentation purposes. - raise AttributeError(str(Removed('MultiSpectralDistribution.y'))) + raise AttributeError( + str(ObjectRemoved('MultiSpectralDistributions.y'))) @property - def z(self): + def z(self): # pragma: no cover # Docstrings are omitted for documentation purposes. - raise AttributeError(str(Removed('MultiSpectralDistribution.z'))) + raise AttributeError( + str(ObjectRemoved('MultiSpectralDistributions.z'))) - def __iter__(self): + def __iter__(self): # pragma: no cover # Docstrings are omitted for documentation purposes. raise AttributeError( - str(Removed('MultiSpectralDistribution.__iter__'))) + str(ObjectRemoved('MultiSpectralDistributions.__iter__'))) - def get(self): + def get(self): # pragma: no cover # Docstrings are omitted for documentation purposes. - raise AttributeError(str(Removed('MultiSpectralDistribution.get'))) + raise AttributeError( + str(ObjectRemoved('MultiSpectralDistributions.get'))) - def zeros(self): + def zeros(self): # pragma: no cover # Docstrings are omitted for documentation purposes. - raise AttributeError(str(Removed('MultiSpectralDistribution.zeros'))) + raise AttributeError( + str(ObjectRemoved('MultiSpectralDistributions.zeros'))) - def trim_wavelengths(self, shape): + def trim_wavelengths(self, shape): # pragma: no cover # Docstrings are omitted for documentation purposes. runtime_warning( str( - Renamed('TriSpectralPowerDistribution.trim_wavelengths', - 'MultiSpectralDistribution.trim'))) + ObjectRenamed('TriSpectralPowerDistribution.trim_wavelengths', + 'MultiSpectralDistributions.trim'))) return self.trim(shape) - def clone(self): + def clone(self): # pragma: no cover # Docstrings are omitted for documentation purposes. runtime_warning( str( - Renamed('TriSpectralPowerDistribution.clone', - 'MultiSpectralDistribution.copy'))) + ObjectRenamed('TriSpectralPowerDistribution.clone', + 'MultiSpectralDistributions.copy'))) return self.copy() + + +def sds_and_multi_sds_to_sds(sds): + """ + Converts given spectral and multi-spectral distributions to a flat list of + spectral distributions. + + Parameters + ---------- + sds : array_like + Spectral and multi-spectral distributions to convert to a flat list of + spectral distributions. + + Returns + ------- + list + Flat list of spectral distributions. + + Examples + -------- + >>> data = { + ... 500: 0.0651, + ... 520: 0.0705, + ... 540: 0.0772, + ... 560: 0.0870, + ... 580: 0.1128, + ... 600: 0.1360 + ... } + >>> sd_1 = SpectralDistribution(data) + >>> sd_2 = SpectralDistribution(data) + >>> data = { + ... 500: (0.004900, 0.323000, 0.272000), + ... 510: (0.009300, 0.503000, 0.158200), + ... 520: (0.063270, 0.710000, 0.078250), + ... 530: (0.165500, 0.862000, 0.042160), + ... 540: (0.290400, 0.954000, 0.020300), + ... 550: (0.433450, 0.994950, 0.008750), + ... 560: (0.594500, 0.995000, 0.003900) + ... } + >>> multi_sds_1 = MultiSpectralDistributions(data) + >>> multi_sds_2 = MultiSpectralDistributions(data) + >>> len(sds_and_multi_sds_to_sds([sd_1, sd_2, multi_sds_1, multi_sds_2])) + 8 + """ + + if isinstance(sds, MultiSpectralDistributions): + sds = sds.to_sds() + else: + sds = list(sds) + for i, sd in enumerate(sds[:]): + if isinstance(sd, MultiSpectralDistributions): + sds.remove(sd) + sds[i:i] = sd.to_sds() + + return sds diff --git a/colour/colorimetry/tests/test_blackbody.py b/colour/colorimetry/tests/test_blackbody.py index 23a89a8f11..c31a03d629 100644 --- a/colour/colorimetry/tests/test_blackbody.py +++ b/colour/colorimetry/tests/test_blackbody.py @@ -9,7 +9,7 @@ import unittest from itertools import permutations -from colour.colorimetry import (SpectralShape, planck_law, sd_blackbody) +from colour.colorimetry import SpectralShape, planck_law, sd_blackbody from colour.utilities import ignore_numpy_errors __author__ = 'Colour Developers' diff --git a/colour/colorimetry/tests/test_dominant.py b/colour/colorimetry/tests/test_dominant.py index 6c80a926a4..52bece9d00 100644 --- a/colour/colorimetry/tests/test_dominant.py +++ b/colour/colorimetry/tests/test_dominant.py @@ -100,7 +100,7 @@ def test_n_dimensional_closest_spectral_locus_wavelength(self): def test_nan_closest_spectral_locus_wavelength(self): """ Tests :func:`colour.colorimetry.dominant.\ - closest_spectral_locus_wavelength` definition nan support. +closest_spectral_locus_wavelength` definition nan support. """ cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] diff --git a/colour/colorimetry/tests/test_luminance.py b/colour/colorimetry/tests/test_luminance.py index 8974470e15..8a987e6722 100644 --- a/colour/colorimetry/tests/test_luminance.py +++ b/colour/colorimetry/tests/test_luminance.py @@ -10,7 +10,7 @@ from colour.colorimetry import ( luminance_Newhall1943, intermediate_luminance_function_CIE1976, - luminance_CIE1976, luminance_ASTMD153508, luminance_Fairchild2010, + luminance_CIE1976, luminance_ASTMD1535, luminance_Fairchild2010, luminance_Fairchild2011) from colour.colorimetry.luminance import luminance from colour.utilities import domain_range_scale, ignore_numpy_errors @@ -23,7 +23,7 @@ __status__ = 'Production' __all__ = [ - 'TestLuminanceNewhall1943', 'TestLuminanceASTMD153508', + 'TestLuminanceNewhall1943', 'TestLuminanceASTMD1535', 'TestIntermediateLuminanceFunctionCIE1976', 'TestLuminanceCIE1976', 'TestLuminanceFairchild2010', 'TestLuminanceFairchild2011', 'TestLuminance' ] @@ -98,72 +98,72 @@ def test_nan_luminance_Newhall1943(self): np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) -class TestLuminanceASTMD153508(unittest.TestCase): +class TestLuminanceASTMD1535(unittest.TestCase): """ - Defines :func:`colour.colorimetry.luminance.luminance_ASTMD153508` + Defines :func:`colour.colorimetry.luminance.luminance_ASTMD1535` definition unit tests methods. """ - def test_luminance_ASTMD153508(self): + def test_luminance_ASTMD1535(self): """ - Tests :func:`colour.colorimetry.luminance.luminance_ASTMD153508` + Tests :func:`colour.colorimetry.luminance.luminance_ASTMD1535` definition. """ self.assertAlmostEqual( - luminance_ASTMD153508(4.08244375), 12.236342675366036, places=7) + luminance_ASTMD1535(4.08244375), 12.236342675366036, places=7) self.assertAlmostEqual( - luminance_ASTMD153508(5.39132685), 22.893999867280378, places=7) + luminance_ASTMD1535(5.39132685), 22.893999867280378, places=7) self.assertAlmostEqual( - luminance_ASTMD153508(2.97619312), 6.2902253509053132, places=7) + luminance_ASTMD1535(2.97619312), 6.2902253509053132, places=7) - def test_n_dimensional_luminance_ASTMD153508(self): + def test_n_dimensional_luminance_ASTMD1535(self): """ - Tests :func:`colour.colorimetry.luminance.luminance_ASTMD153508` + Tests :func:`colour.colorimetry.luminance.luminance_ASTMD1535` definition n-dimensional arrays support. """ V = 4.08244375 - Y = luminance_ASTMD153508(V) + Y = luminance_ASTMD1535(V) V = np.tile(V, 6) Y = np.tile(Y, 6) - np.testing.assert_almost_equal(luminance_ASTMD153508(V), Y, decimal=7) + np.testing.assert_almost_equal(luminance_ASTMD1535(V), Y, decimal=7) V = np.reshape(V, (2, 3)) Y = np.reshape(Y, (2, 3)) - np.testing.assert_almost_equal(luminance_ASTMD153508(V), Y, decimal=7) + np.testing.assert_almost_equal(luminance_ASTMD1535(V), Y, decimal=7) V = np.reshape(V, (2, 3, 1)) Y = np.reshape(Y, (2, 3, 1)) - np.testing.assert_almost_equal(luminance_ASTMD153508(V), Y, decimal=7) + np.testing.assert_almost_equal(luminance_ASTMD1535(V), Y, decimal=7) - def test_domain_range_scale_luminance_ASTMD153508(self): + def test_domain_range_scale_luminance_ASTMD1535(self): """ - Tests :func:`colour.colorimetry.luminance.luminance_ASTMD153508` + Tests :func:`colour.colorimetry.luminance.luminance_ASTMD1535` definition domain and range scale support. """ - Y = luminance_ASTMD153508(4.08244375) + Y = luminance_ASTMD1535(4.08244375) d_r = (('reference', 1, 1), (1, 0.1, 0.01), (100, 10, 1)) for scale, factor_a, factor_b in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - luminance_ASTMD153508(4.08244375 * factor_a), + luminance_ASTMD1535(4.08244375 * factor_a), Y * factor_b, decimal=7) @ignore_numpy_errors - def test_nan_luminance_ASTMD153508(self): + def test_nan_luminance_ASTMD1535(self): """ - Tests :func:`colour.colorimetry.luminance.luminance_ASTMD153508` + Tests :func:`colour.colorimetry.luminance.luminance_ASTMD1535` definition nan support. """ - luminance_ASTMD153508( + luminance_ASTMD1535( np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) @@ -240,7 +240,7 @@ def test_domain_range_scale_intermediate_luminance_function_CIE1976(self): def test_nan_intermediate_luminance_function_CIE1976(self): """ Tests :func:`colour.colorimetry.luminance.\ - intermediate_luminance_function_CIE1976` definition nan support. +intermediate_luminance_function_CIE1976` definition nan support. """ intermediate_luminance_function_CIE1976( @@ -532,7 +532,7 @@ def test_domain_range_scale_luminance(self): domain and range scale support. """ - m = ('Newhall 1943', 'ASTM D1535-08', 'CIE 1976', 'Fairchild 2010', + m = ('Newhall 1943', 'ASTM D1535', 'CIE 1976', 'Fairchild 2010', 'Fairchild 2011') v = [luminance(41.527875844653451, method, Y_n=100) for method in m] diff --git a/colour/colorimetry/tests/test_spectrum.py b/colour/colorimetry/tests/test_spectrum.py index 3bd45938b1..f3f9ca1071 100644 --- a/colour/colorimetry/tests/test_spectrum.py +++ b/colour/colorimetry/tests/test_spectrum.py @@ -11,7 +11,8 @@ from distutils.version import LooseVersion from colour.colorimetry.spectrum import (SpectralShape, SpectralDistribution, - MultiSpectralDistribution) + MultiSpectralDistributions, + sds_and_multi_sds_to_sds) from colour.utilities import tstack __author__ = 'Colour Developers' @@ -26,7 +27,7 @@ 'INTERPOLATED_SAMPLE_SD_DATA', 'INTERPOLATED_NON_UNIFORM_SAMPLE_SD_DATA', 'NORMALISED_SAMPLE_SD_DATA', 'CIE_1931_2_DEGREE_STANDARD_OBSERVER', 'CMFS_DATA', 'TestSpectralShape', 'TestSpectralDistribution', - 'TestMultiSpectralDistribution' + 'TestMultiSpectralDistributions', 'TestSdsAndMultiSdsToSds' ] SAMPLE_SD_DATA = { @@ -1325,6 +1326,14 @@ def test_range(self): [wavelength for wavelength in SpectralShape(0, 10, 0.1)], np.arange(0, 10 + 0.1, 0.1)) + def test_raise_exception_range(self): + """ + Tests :func:`colour.colorimetry.spectrum.SpectralShape.range` method + raised exception. + """ + + self.assertRaises(RuntimeError, SpectralShape().range) + class TestSpectralDistribution(unittest.TestCase): """ @@ -1385,6 +1394,10 @@ def test_wavelengths(self): np.testing.assert_array_equal(self._sd.wavelengths, self._sd.domain) + sd = self._sd.copy() + sd.wavelengths = sd.wavelengths + 10 + np.testing.assert_array_equal(sd.wavelengths, sd.domain) + def test_values(self): """ Tests :attr:`colour.colorimetry.spectrum.\ @@ -1393,6 +1406,10 @@ def test_values(self): np.testing.assert_array_equal(self._sd.values, self._sd.range) + sd = self._sd.copy() + sd.values = sd.values + 10 + np.testing.assert_array_equal(sd.values, sd.range) + def test_shape(self): """ Tests :attr:`colour.colorimetry.spectrum.\ @@ -1442,7 +1459,7 @@ def test_interpolate(self): # version. # Skipping tests because of "Scipy" 0.19.0 interpolation code changes. if LooseVersion(scipy.__version__) < LooseVersion('0.19.0'): - return + return # pragma: no cover np.testing.assert_allclose( self._non_uniform_sd.copy().interpolate( @@ -1485,9 +1502,9 @@ def test_normalise(self): NORMALISED_SAMPLE_SD_DATA) -class TestMultiSpectralDistribution(unittest.TestCase): +class TestMultiSpectralDistributions(unittest.TestCase): """ - Defines :class:`colour.colorimetry.spectrum.MultiSpectralDistribution` + Defines :class:`colour.colorimetry.spectrum.MultiSpectralDistributions` class unit tests methods. """ @@ -1497,8 +1514,10 @@ def setUp(self): """ self._labels = ('x_bar', 'y_bar', 'z_bar') + self._strict_labels = ('Strict x_bar', 'Strict y_bar', + 'Strict z_bar') - self._multi_sd = MultiSpectralDistribution( + self._msds = MultiSpectralDistributions( CIE_1931_2_DEGREE_STANDARD_OBSERVER, name='Observer', labels=self._labels) @@ -1506,7 +1525,7 @@ def setUp(self): sd = SpectralDistribution(SAMPLE_SD_DATA) domain = sd.domain range_ = tstack([sd.values, sd.values, sd.values]) - self._sample_multi_sd = MultiSpectralDistribution( + self._sample_msds = MultiSpectralDistributions( range_, domain, name='Sample Observer', @@ -1516,7 +1535,7 @@ def setUp(self): sd = SpectralDistribution(NON_UNIFORM_SAMPLE_SD_DATA) domain = sd.domain range_ = tstack([sd.values, sd.values, sd.values]) - self._non_uniform_sample_multi_sd = MultiSpectralDistribution( + self._non_uniform_sample_msds = MultiSpectralDistributions( range_, domain, name='Non Uniform Sample Observer', @@ -1535,7 +1554,7 @@ def test_required_attributes(self): 'values', 'shape') for attribute in required_attributes: - self.assertIn(attribute, dir(MultiSpectralDistribution)) + self.assertIn(attribute, dir(MultiSpectralDistributions)) def test_required_methods(self): """ @@ -1546,74 +1565,81 @@ def test_required_methods(self): 'trim', 'normalise', 'to_sds') for method in required_methods: - self.assertIn(method, dir(MultiSpectralDistribution)) + self.assertIn(method, dir(MultiSpectralDistributions)) def test_strict_name(self): """ Tests :attr:`colour.colorimetry.spectrum.\ -MultiSpectralDistribution.strict_name` attribute. +MultiSpectralDistributions.strict_name` attribute. """ - self.assertEqual(self._sample_multi_sd.strict_name, 'Sample Observer') - self.assertEqual(self._non_uniform_sample_multi_sd.strict_name, + self.assertEqual(self._sample_msds.strict_name, 'Sample Observer') + self.assertEqual(self._non_uniform_sample_msds.strict_name, 'Strict Non Uniform Sample Observer') def test_wavelengths(self): """ Tests :attr:`colour.colorimetry.spectrum.\ -MultiSpectralDistribution.wavelengths` attribute. +MultiSpectralDistributions.wavelengths` attribute. """ - np.testing.assert_array_equal(self._multi_sd.wavelengths, - self._multi_sd.domain) + np.testing.assert_array_equal(self._msds.wavelengths, + self._msds.domain) + + msds = self._msds.copy() + msds.wavelengths = msds.wavelengths + 10 + np.testing.assert_array_equal(msds.wavelengths, msds.domain) def test_values(self): """ Tests :attr:`colour.colorimetry.spectrum.\ -MultiSpectralDistribution.values` attribute. +MultiSpectralDistributions.values` attribute. """ - np.testing.assert_array_equal(self._multi_sd.values, - self._multi_sd.range) + np.testing.assert_array_equal(self._msds.values, self._msds.range) + + msds = self._msds.copy() + msds.values = msds.values + 10 + np.testing.assert_array_equal(msds.values, msds.range) def test_strict_labels(self): """ Tests :attr:`colour.colorimetry.spectrum.\ -MultiSpectralDistribution.strict_labels` attribute. +MultiSpectralDistributions.strict_labels` attribute. """ self.assertTupleEqual( - tuple(self._sample_multi_sd.strict_labels), self._labels) + tuple(self._sample_msds.strict_labels), self._labels) self.assertEqual( - tuple(self._non_uniform_sample_multi_sd.strict_labels), + tuple(self._non_uniform_sample_msds.strict_labels), ('Strict x_bar', 'Strict y_bar', 'Strict z_bar')) def test_shape(self): """ Tests :attr:`colour.colorimetry.spectrum.\ -MultiSpectralDistribution.shape` attribute. +MultiSpectralDistributions.shape` attribute. """ - self.assertEqual(self._multi_sd.shape, SpectralShape(380, 780, 5)) + self.assertEqual(self._msds.shape, SpectralShape(380, 780, 5)) def test_extrapolate(self): """ Tests :func:`colour.colorimetry.spectrum.\ -MultiSpectralDistribution.extrapolate` method. +MultiSpectralDistributions.extrapolate` method. """ data = dict(zip(range(25, 35), tstack([[0] * 5 + [1] * 5] * 3))) - multi_sd = MultiSpectralDistribution(data) - multi_sd.extrapolate(SpectralShape(10, 50)) + msds = MultiSpectralDistributions(data) + msds.extrapolate(SpectralShape(10, 50)) np.testing.assert_almost_equal( - multi_sd[10], np.array([0.0, 0.0, 0.0]), decimal=7) + msds[10], np.array([0.0, 0.0, 0.0]), decimal=7) np.testing.assert_almost_equal( - multi_sd[50], np.array([1.0, 1.0, 1.0]), decimal=7) + msds[50], np.array([1.0, 1.0, 1.0]), decimal=7) - multi_sd = MultiSpectralDistribution( + msds = MultiSpectralDistributions( tstack([np.linspace(0, 1, 10)] * 3), np.linspace(25, 35, 10)) - multi_sd.extrapolate( + msds.extrapolate( SpectralShape(10, 50), extrapolator_args={ 'method': 'Linear', @@ -1621,20 +1647,20 @@ def test_extrapolate(self): 'right': None }) np.testing.assert_almost_equal( - multi_sd[10], np.array([-1.5, -1.5, -1.5]), decimal=7) + msds[10], np.array([-1.5, -1.5, -1.5]), decimal=7) np.testing.assert_almost_equal( - multi_sd[50], np.array([2.5, 2.5, 2.5]), decimal=7) + msds[50], np.array([2.5, 2.5, 2.5]), decimal=7) def test_interpolate(self): """ Tests :func:`colour.colorimetry.spectrum.\ -MultiSpectralDistribution.interpolate` method. +MultiSpectralDistributions.interpolate` method. """ - multi_sd = self._sample_multi_sd.copy() + msds = self._sample_msds.copy() - multi_sd.interpolate(SpectralShape(interval=1)) - for signal in multi_sd.signals.values(): + msds.interpolate(SpectralShape(interval=1)) + for signal in msds.signals.values(): np.testing.assert_almost_equal( signal.values, INTERPOLATED_SAMPLE_SD_DATA, decimal=7) @@ -1642,11 +1668,11 @@ def test_interpolate(self): # version. # Skipping tests because of "Scipy" 0.19.0 interpolation code changes. if LooseVersion(scipy.__version__) < LooseVersion('0.19.0'): - return + return # pragma: no cover - multi_sd = self._non_uniform_sample_multi_sd.copy() - multi_sd.interpolate(SpectralShape(interval=1)) - for signal in multi_sd.signals.values(): + msds = self._non_uniform_sample_msds.copy() + msds.interpolate(SpectralShape(interval=1)) + for signal in msds.signals.values(): np.testing.assert_allclose( signal.values, INTERPOLATED_NON_UNIFORM_SAMPLE_SD_DATA, @@ -1656,57 +1682,103 @@ def test_interpolate(self): def test_align(self): """ Tests :func:`colour.colorimetry.spectrum.\ -MultiSpectralDistribution.align` method. +MultiSpectralDistributions.align` method. """ - multi_sd = self._sample_multi_sd.copy() + msds = self._sample_msds.copy() shape = SpectralShape(100, 900, 5) - self.assertEqual(multi_sd.align(shape).shape, shape) + self.assertEqual(msds.align(shape).shape, shape) shape = SpectralShape(600, 650, 1) - self.assertEqual(multi_sd.align(shape).shape, shape) + self.assertEqual(msds.align(shape).shape, shape) def test_trim(self): """ Tests :func:`colour.colorimetry.spectrum.\ -MultiSpectralDistribution.trim` method. +MultiSpectralDistributions.trim` method. """ shape = SpectralShape(400, 700, 5) - self.assertEqual(self._multi_sd.copy().trim(shape).shape, shape) + self.assertEqual(self._msds.copy().trim(shape).shape, shape) shape = SpectralShape(200, 900, 1) - self.assertEqual(self._multi_sd.copy().trim(shape).shape, - self._multi_sd.shape) + self.assertEqual(self._msds.copy().trim(shape).shape, self._msds.shape) def test_normalise(self): """ Tests :func:`colour.colorimetry.spectrum.\ -MultiSpectralDistribution.normalise` method. +MultiSpectralDistributions.normalise` method. """ np.testing.assert_almost_equal( - self._sample_multi_sd.copy().normalise(100).values, + self._sample_msds.copy().normalise(100).values, tstack([NORMALISED_SAMPLE_SD_DATA] * 3)) - def to_sds(self): + def test_to_sds(self): """ Tests :func:`colour.colorimetry.spectrum.\ -MultiSpectralDistribution.to_sds` method. +MultiSpectralDistributions.to_sds` method. """ - sds = self._non_uniform_sample_multi_sd.to_sds() + sds = self._non_uniform_sample_msds.to_sds() self.assertEqual(len(sds), 3) - for i, sd in sds: + for i, sd in enumerate(sds): self.assertEqual( sd.name, '{0} - {1}'.format( - self._labels[i], self._non_uniform_sample_multi_sd.name)) + self._labels[i], self._non_uniform_sample_msds.name)) self.assertEqual( sd.strict_name, '{0} - {1}'.format( self._strict_labels[i], - self._non_uniform_sample_multi_sd.name)) + self._non_uniform_sample_msds.strict_name)) + + +class TestSdsAndMultiSdsToSds(unittest.TestCase): + """ + Defines :func:`colour.colorimetry.spectrum.sds_and_multi_sds_to_sds` + definition unit tests methods. + """ + + def test_sds_and_multi_sds_to_sds(self): + """ + Tests :func:`colour.colorimetry.spectrum.sds_and_multi_sds_to_sds` + definition. + """ + + data = { + 500: 0.0651, + 520: 0.0705, + 540: 0.0772, + 560: 0.0870, + 580: 0.1128, + 600: 0.1360 + } + sd_1 = SpectralDistribution(data) + sd_2 = SpectralDistribution(data) + data = { + 500: (0.004900, 0.323000, 0.272000), + 510: (0.009300, 0.503000, 0.158200), + 520: (0.063270, 0.710000, 0.078250), + 530: (0.165500, 0.862000, 0.042160), + 540: (0.290400, 0.954000, 0.020300), + 550: (0.433450, 0.994950, 0.008750), + 560: (0.594500, 0.995000, 0.003900) + } + + multi_sds_1 = MultiSpectralDistributions(data) + multi_sds_2 = MultiSpectralDistributions(data) + + self.assertEqual( + len( + sds_and_multi_sds_to_sds([ + sd_1, + sd_2, + multi_sds_1, + multi_sds_2, + ])), 8) + + self.assertEqual(len(sds_and_multi_sds_to_sds(multi_sds_1)), 3) if __name__ == '__main__': diff --git a/colour/colorimetry/tests/test_tristimulus.py b/colour/colorimetry/tests/test_tristimulus.py index 108dd3ca74..c16fc8958c 100644 --- a/colour/colorimetry/tests/test_tristimulus.py +++ b/colour/colorimetry/tests/test_tristimulus.py @@ -16,14 +16,13 @@ from colour.algebra import LinearInterpolator from colour.colorimetry import (CMFS, sd_CIE_standard_illuminant_A, - ILLUMINANTS_SDS, SpectralDistribution, - SpectralShape) + ILLUMINANTS_SDS, MultiSpectralDistributions, + SpectralDistribution, SpectralShape) from colour.colorimetry import ( - lagrange_coefficients_ASTME202211, - tristimulus_weighting_factors_ASTME202211, - adjust_tristimulus_weighting_factors_ASTME30815, sd_to_XYZ_integration, - sd_to_XYZ_tristimulus_weighting_factors_ASTME30815, sd_to_XYZ_ASTME30815, - multi_sds_to_XYZ_integration, wavelength_to_XYZ) + lagrange_coefficients_ASTME2022, tristimulus_weighting_factors_ASTME2022, + adjust_tristimulus_weighting_factors_ASTME308, sd_to_XYZ_integration, + sd_to_XYZ_tristimulus_weighting_factors_ASTME308, sd_to_XYZ_ASTME308, + multi_sds_to_XYZ_integration, multi_sds_to_XYZ_ASTME308, wavelength_to_XYZ) from colour.utilities import domain_range_scale __author__ = 'Colour Developers' @@ -36,12 +35,15 @@ __all__ = [ 'SAMPLE_SD', 'LAGRANGE_COEFFICIENTS_A', 'LAGRANGE_COEFFICIENTS_B', 'A_CIE_1964_10_10_TWF', 'A_CIE_1964_10_20_TWF', 'D65_CIE_1931_2_20_TWF', - 'D65_CIE_1931_2_20_TWF_K1', 'D65_CIE_1931_2_20_ATWF', 'MSD', 'XYZ_D65', - 'XYZ_D65_K1', 'TestLagrangeCoefficientsASTME202211', - 'TestTristimulusWeightingFactorsASTME202211', - 'TestAdjustTristimulusWeightingFactorsASTME30815', - 'TestSd_to_XYZ_integration', 'TestSd_to_XYZ_ASTME30815', - 'TestMultiSds_to_XYZ_integration', 'TestWavelength_to_XYZ' + 'D65_CIE_1931_2_20_TWF_K1', 'D65_CIE_1931_2_20_ATWF', 'MSDS_ARRAY', 'MSDS', + 'XYZ_D65_INTEGRATION_MSDS', 'XYZ_D65_ARRAY_INTEGRATION', + 'XYZ_D65_ARRAY_K1_INTEGRATION', 'XYZ_D65_ASTME308_MSDS', + 'XYZ_D65_ASTME308_K1_MSDS', 'TestLagrangeCoefficientsASTME2022', + 'TestTristimulusWeightingFactorsASTME2022', + 'TestAdjustTristimulusWeightingFactorsASTME308', + 'TestSd_to_XYZ_integration', 'TestSd_to_XYZ_ASTME308', + 'TestMultiSds_to_XYZ_integration', 'TestMultiSds_to_XYZ_ASTME308', + 'TestWavelength_to_XYZ' ] SAMPLE_SD = SpectralDistribution({ @@ -321,7 +323,7 @@ [0.185, 0.067, 0.000], ]) -MSD = np.array([ +MSDS_ARRAY = np.array([ [[0.01367208, 0.09127947, 0.01524376, 0.02810712, 0.19176012, 0.04299992], [0.01591516, 0.31454948, 0.08416876, 0.09071489, 0.71026170, 0.04374762], [0.00959792, 0.25822842, 0.41388571, 0.22275120, 0.00407416, 0.37439537], @@ -336,7 +338,26 @@ [0.04727245, 0.32210270, 0.22679484, 0.31613642, 0.11242847, 0.00244144]], ]) -XYZ_D65 = np.array([ +MSDS = MultiSpectralDistributions( + np.transpose(np.reshape(MSDS_ARRAY, [-1, 6])), + SpectralShape(400, 700, 60).range()) + +XYZ_D65_INTEGRATION_MSDS = np.array([ + [7.50233492, 3.95038753, 8.40338691], + [26.92687731, 15.07139447, 28.71690972], + [16.70142165, 28.21458593, 25.65389977], + [11.57556582, 8.64089371, 6.57886800], + [18.73219899, 35.07426727, 30.15041858], + [45.16536627, 39.61360393, 43.69092793], + [8.17423105, 13.09267724, 25.94320661], + [22.46636804, 19.31025987, 7.96118575], + [6.58131705, 2.52857864, 11.09362054], + [43.91622393, 27.97952698, 11.73575112], + [8.53774314, 19.70241814, 17.70479540], + [23.91149458, 26.21467120, 30.68294836], +]) + +XYZ_D65_ARRAY_INTEGRATION = np.array([ [ [7.19510558, 3.86227393, 10.09950719], [25.57464912, 14.71934603, 34.84931928], @@ -355,7 +376,7 @@ ], ]) -XYZ_D65_K1 = np.array([ +XYZ_D65_ARRAY_K1_INTEGRATION = np.array([ [ [776.11755347, 416.61356647, 1089.40789347], [2758.67169575, 1587.73804035, 3759.10653835], @@ -374,40 +395,70 @@ ], ]) +XYZ_D65_ASTME308_MSDS = np.array([ + [7.50462879, 3.95733605, 8.38922164], + [26.94169070, 15.09763521, 28.67425696], + [16.70295581, 28.20634330, 25.66397540], + [11.57004370, 8.64530316, 6.56080272], + [18.74361790, 35.06186242, 30.18256374], + [45.12217114, 39.62387120, 43.59379506], + [8.17736556, 13.09427036, 25.93377871], + [22.44504068, 19.31189958, 7.92783105], + [6.57962398, 2.53363268, 11.07307595], + [43.91277836, 27.99946326, 11.69170298], + [8.55079137, 19.69075442, 17.73974503], + [23.88934466, 26.21652383, 30.63634245], +]) + +XYZ_D65_ASTME308_K1_MSDS = np.array([ + [793.03459123, 418.18249296, 886.51193069], + [2847.00193341, 1595.40828847, 3030.08693538], + [1765.04689430, 2980.64122346, 2711.98227327], + [1222.63807218, 913.57276319, 693.29791668], + [1980.68922284, 3705.08262551, 3189.47382721], + [4768.18288568, 4187.16253479, 4606.67521602], + [864.12452076, 1383.70726024, 2740.49312500], + [2371.82866258, 2040.74109793, 837.75552835], + [695.28681092, 267.73587534, 1170.12213512], + [4640.38305142, 2958.77964509, 1235.49414014], + [903.58544429, 2080.77572128, 1874.60723907], + [2524.45220328, 2770.37157298, 3237.42586015], +]) -class TestLagrangeCoefficientsASTME202211(unittest.TestCase): + +class TestLagrangeCoefficientsASTME2022(unittest.TestCase): """ Defines :func:`colour.colorimetry.tristimulus.\ -lagrange_coefficients_ASTME202211` definition unit tests methods. +lagrange_coefficients_ASTME2022` definition unit tests methods. """ - def test_lagrange_coefficients_ASTME202211(self): + def test_lagrange_coefficients_ASTME2022(self): """ Tests :func:`colour.colorimetry.tristimulus.\ - lagrange_coefficients_ASTME202211` definition. +lagrange_coefficients_ASTME2022` definition. """ np.testing.assert_almost_equal( - lagrange_coefficients_ASTME202211(10, 'inner'), + lagrange_coefficients_ASTME2022(10, 'inner'), LAGRANGE_COEFFICIENTS_A, decimal=7) np.testing.assert_almost_equal( - lagrange_coefficients_ASTME202211(10, 'boundary'), + lagrange_coefficients_ASTME2022(10, 'boundary'), LAGRANGE_COEFFICIENTS_B, decimal=7) -class TestTristimulusWeightingFactorsASTME202211(unittest.TestCase): +class TestTristimulusWeightingFactorsASTME2022(unittest.TestCase): """ Defines :func:`colour.colorimetry.tristimulus.\ -tristimulus_weighting_factors_ASTME202211` definition unit tests methods. +tristimulus_weighting_factors_ASTME2022` definition unit tests methods. """ - def test_tristimulus_weighting_factors_ASTME202211(self): + def test_tristimulus_weighting_factors_ASTME2022(self): """ Tests :func:`colour.colorimetry.tristimulus.\ -tristimulus_weighting_factors_ASTME202211` definition. +tristimulus_weighting_factors_ASTME2022` definition. Notes ----- @@ -423,12 +474,12 @@ def test_tristimulus_weighting_factors_ASTME202211(self): cmfs = CMFS['CIE 1964 10 Degree Standard Observer'] A = sd_CIE_standard_illuminant_A(cmfs.shape) - twf = tristimulus_weighting_factors_ASTME202211( + twf = tristimulus_weighting_factors_ASTME2022( cmfs, A, SpectralShape(360, 830, 10)) np.testing.assert_almost_equal( np.round(twf, 3), A_CIE_1964_10_10_TWF, decimal=3) - twf = tristimulus_weighting_factors_ASTME202211( + twf = tristimulus_weighting_factors_ASTME2022( cmfs, A, SpectralShape(360, 830, 20)) np.testing.assert_almost_equal( np.round(twf, 3), A_CIE_1964_10_20_TWF, decimal=3) @@ -436,31 +487,49 @@ def test_tristimulus_weighting_factors_ASTME202211(self): cmfs = CMFS['CIE 1931 2 Degree Standard Observer'] D65 = ILLUMINANTS_SDS['D65'].copy().align( cmfs.shape, interpolator=LinearInterpolator) - twf = tristimulus_weighting_factors_ASTME202211( + twf = tristimulus_weighting_factors_ASTME2022( cmfs, D65, SpectralShape(360, 830, 20)) np.testing.assert_almost_equal( np.round(twf, 3), D65_CIE_1931_2_20_TWF, decimal=3) - twf = tristimulus_weighting_factors_ASTME202211( + twf = tristimulus_weighting_factors_ASTME2022( cmfs, D65, SpectralShape(360, 830, 20), k=1) np.testing.assert_almost_equal( twf, D65_CIE_1931_2_20_TWF_K1, decimal=7) + def test_raise_exception_tristimulus_weighting_factors_ASTME2022(self): + """ + Tests :func:`colour.colorimetry.tristimulus.\ +tristimulus_weighting_factors_ASTME2022` definition raised exception. + """ -class TestAdjustTristimulusWeightingFactorsASTME30815(unittest.TestCase): + shape = SpectralShape(360, 830, 10) + cmfs_1 = CMFS['CIE 1964 10 Degree Standard Observer'] + cmfs_2 = cmfs_1.copy().align(shape) + A_1 = sd_CIE_standard_illuminant_A(cmfs_1.shape) + A_2 = sd_CIE_standard_illuminant_A(cmfs_2.shape) + + self.assertRaises(ValueError, tristimulus_weighting_factors_ASTME2022, + cmfs_1, A_2, shape) + + self.assertRaises(ValueError, tristimulus_weighting_factors_ASTME2022, + cmfs_2, A_1, shape) + + +class TestAdjustTristimulusWeightingFactorsASTME308(unittest.TestCase): """ Defines :func:`colour.colorimetry.tristimulus.\ -adjust_tristimulus_weighting_factors_ASTME30815` definition unit tests methods. +adjust_tristimulus_weighting_factors_ASTME308` definition unit tests methods. """ - def test_adjust_tristimulus_weighting_factors_ASTME30815(self): + def test_adjust_tristimulus_weighting_factors_ASTME308(self): """ Tests :func:`colour.colorimetry.tristimulus.\ -adjust_tristimulus_weighting_factors_ASTME30815` definition. +adjust_tristimulus_weighting_factors_ASTME308` definition. """ np.testing.assert_almost_equal( - adjust_tristimulus_weighting_factors_ASTME30815( + adjust_tristimulus_weighting_factors_ASTME308( D65_CIE_1931_2_20_TWF, SpectralShape(360, 830, 20), SpectralShape(400, 700, 20)), D65_CIE_1931_2_20_ATWF, @@ -522,64 +591,63 @@ def test_domain_range_scale_sd_to_XYZ_integration(self): decimal=7) -class TestSd_to_XYZ_tristimulus_weighting_factors_ASTME30815( - unittest.TestCase): +class TestSd_to_XYZ_tristimulus_weighting_factors_ASTME308(unittest.TestCase): """ Defines :func:`colour.colorimetry.tristimulus.\ -sd_to_XYZ_tristimulus_weighting_factors_ASTME30815` +sd_to_XYZ_tristimulus_weighting_factors_ASTME308` definition unit tests methods. """ - def test_sd_to_XYZ_tristimulus_weighting_factors_ASTME30815(self): + def test_sd_to_XYZ_tristimulus_weighting_factors_ASTME308(self): """ Tests :func:`colour.colorimetry.tristimulus.\ -sd_to_XYZ_tristimulus_weighting_factors_ASTME30815` +sd_to_XYZ_tristimulus_weighting_factors_ASTME308` definition. """ cmfs = CMFS['CIE 1931 2 Degree Standard Observer'] np.testing.assert_almost_equal( - sd_to_XYZ_tristimulus_weighting_factors_ASTME30815( + sd_to_XYZ_tristimulus_weighting_factors_ASTME308( SAMPLE_SD, cmfs, ILLUMINANTS_SDS['A']), np.array([14.46366344, 10.85828513, 2.04663792]), decimal=7) cmfs = CMFS['CIE 1964 10 Degree Standard Observer'] np.testing.assert_almost_equal( - sd_to_XYZ_tristimulus_weighting_factors_ASTME30815( + sd_to_XYZ_tristimulus_weighting_factors_ASTME308( SAMPLE_SD, cmfs, ILLUMINANTS_SDS['C']), np.array([10.77033881, 9.44864632, 6.62758924]), decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_tristimulus_weighting_factors_ASTME30815( + sd_to_XYZ_tristimulus_weighting_factors_ASTME308( SAMPLE_SD, cmfs, ILLUMINANTS_SDS['FL2']), np.array([11.57837130, 9.98734511, 3.95499522]), decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_tristimulus_weighting_factors_ASTME30815( + sd_to_XYZ_tristimulus_weighting_factors_ASTME308( SAMPLE_SD.copy().trim(SpectralShape(400, 700, 5)), cmfs, ILLUMINANTS_SDS['A']), np.array([14.38180830, 10.74512906, 2.01579131]), decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_tristimulus_weighting_factors_ASTME30815( + sd_to_XYZ_tristimulus_weighting_factors_ASTME308( SAMPLE_SD.copy().interpolate(SpectralShape(400, 700, 10)), cmfs, ILLUMINANTS_SDS['A']), np.array([14.38284399, 10.74577954, 2.01553721]), decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_tristimulus_weighting_factors_ASTME30815( + sd_to_XYZ_tristimulus_weighting_factors_ASTME308( SAMPLE_SD.copy().interpolate(SpectralShape(400, 700, 20)), cmfs, ILLUMINANTS_SDS['A']), np.array([14.38356848, 10.74613294, 2.01526418]), decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_tristimulus_weighting_factors_ASTME30815( + sd_to_XYZ_tristimulus_weighting_factors_ASTME308( SAMPLE_SD.copy().interpolate(SpectralShape(400, 700, 20)), cmfs, ILLUMINANTS_SDS['A'], @@ -587,30 +655,30 @@ def test_sd_to_XYZ_tristimulus_weighting_factors_ASTME30815(self): np.array([1636.74286798, 1222.82981953, 229.32204062]), decimal=7) - def test_domain_range_scale_sd_to_XYZ_twf_ASTME30815(self): + def test_domain_range_scale_sd_to_XYZ_twf_ASTME308(self): """ Tests :func:`colour.colorimetry.tristimulus.\ -sd_to_XYZ_tristimulus_weighting_factors_ASTME30815` definition domain and +sd_to_XYZ_tristimulus_weighting_factors_ASTME308` definition domain and range scale support. """ cmfs = CMFS['CIE 1931 2 Degree Standard Observer'] - XYZ = sd_to_XYZ_tristimulus_weighting_factors_ASTME30815( + XYZ = sd_to_XYZ_tristimulus_weighting_factors_ASTME308( SAMPLE_SD, cmfs, ILLUMINANTS_SDS['A']) d_r = (('reference', 1), (1, 0.01), (100, 1)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - sd_to_XYZ_tristimulus_weighting_factors_ASTME30815( + sd_to_XYZ_tristimulus_weighting_factors_ASTME308( SAMPLE_SD, cmfs, ILLUMINANTS_SDS['A']), XYZ * factor, decimal=7) -class TestSd_to_XYZ_ASTME30815(unittest.TestCase): +class TestSd_to_XYZ_ASTME308(unittest.TestCase): """ - Defines :func:`colour.colorimetry.tristimulus.sd_to_XYZ_ASTME30815` + Defines :func:`colour.colorimetry.tristimulus.sd_to_XYZ_ASTME308` definition unit tests methods. """ @@ -623,20 +691,20 @@ def setUp(self): self._cmfs = CMFS['CIE 1931 2 Degree Standard Observer'] self._A = sd_CIE_standard_illuminant_A(self._cmfs.shape) - def test_sd_to_XYZ_ASTME30815_mi_1nm(self): + def test_sd_to_XYZ_ASTME308_mi_1nm(self): """ - Tests :func:`colour.colorimetry.tristimulus.sd_to_XYZ_ASTME30815` + Tests :func:`colour.colorimetry.tristimulus.sd_to_XYZ_ASTME308` definition for 1 nm measurement intervals. """ np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815(self._sd.copy().align(self._cmfs.shape), - self._cmfs, self._A), + sd_to_XYZ_ASTME308(self._sd.copy().align(self._cmfs.shape), + self._cmfs, self._A), np.array([14.46372680, 10.85832950, 2.04663200]), decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(self._cmfs.shape), self._cmfs, self._A, @@ -645,14 +713,14 @@ def test_sd_to_XYZ_ASTME30815_mi_1nm(self): decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(400, 700, 1)), self._cmfs, self._A), np.array([14.54173397, 10.88628632, 2.04965822]), decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(400, 700, 1)), self._cmfs, self._A, @@ -661,7 +729,7 @@ def test_sd_to_XYZ_ASTME30815_mi_1nm(self): decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(400, 700, 1)), self._cmfs, self._A, @@ -669,21 +737,21 @@ def test_sd_to_XYZ_ASTME30815_mi_1nm(self): np.array([1568.98152997, 1174.57671769, 221.14803420]), decimal=7) - def test_sd_to_XYZ_ASTME30815_mi_5nm(self): + def test_sd_to_XYZ_ASTME308_mi_5nm(self): """ - Tests :func:`colour.colorimetry.tristimulus.sd_to_XYZ_ASTME30815` + Tests :func:`colour.colorimetry.tristimulus.sd_to_XYZ_ASTME308` definition for 5 nm measurement intervals. """ np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(360, 830, 5)), self._cmfs, self._A), np.array([14.46372173, 10.85832502, 2.04664734]), decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(360, 830, 5)), self._cmfs, self._A, @@ -692,7 +760,7 @@ def test_sd_to_XYZ_ASTME30815_mi_5nm(self): decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(360, 830, 5)), self._cmfs, self._A, @@ -701,14 +769,14 @@ def test_sd_to_XYZ_ASTME30815_mi_5nm(self): decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(400, 700, 5)), self._cmfs, self._A), np.array([14.54025742, 10.88576251, 2.04950226]), decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(400, 700, 5)), self._cmfs, self._A, @@ -717,7 +785,7 @@ def test_sd_to_XYZ_ASTME30815_mi_5nm(self): decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(400, 700, 5)), self._cmfs, self._A, @@ -726,7 +794,7 @@ def test_sd_to_XYZ_ASTME30815_mi_5nm(self): decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(360, 830, 5)), self._cmfs, self._A, @@ -736,7 +804,7 @@ def test_sd_to_XYZ_ASTME30815_mi_5nm(self): decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(400, 700, 5)), self._cmfs, self._A, @@ -746,7 +814,7 @@ def test_sd_to_XYZ_ASTME30815_mi_5nm(self): decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(400, 700, 5)), self._cmfs, self._A, @@ -754,21 +822,21 @@ def test_sd_to_XYZ_ASTME30815_mi_5nm(self): np.array([1568.82479013, 1174.52212708, 221.13156963]), decimal=7) - def test_sd_to_XYZ_ASTME30815_mi_10nm(self): + def test_sd_to_XYZ_ASTME308_mi_10nm(self): """ - Tests :func:`colour.colorimetry.tristimulus.sd_to_XYZ_ASTME30815` + Tests :func:`colour.colorimetry.tristimulus.sd_to_XYZ_ASTME308` definition for 10 nm measurement intervals. """ np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(360, 830, 10)), self._cmfs, self._A), np.array([14.47779980, 10.86358645, 2.04751388]), decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(360, 830, 10)), self._cmfs, self._A, @@ -777,14 +845,14 @@ def test_sd_to_XYZ_ASTME30815_mi_10nm(self): decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(400, 700, 10)), self._cmfs, self._A), np.array([14.54137532, 10.88641727, 2.04931318]), decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(400, 700, 10)), self._cmfs, self._A, @@ -793,7 +861,7 @@ def test_sd_to_XYZ_ASTME30815_mi_10nm(self): decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(400, 700, 10)), self._cmfs, self._A, @@ -801,21 +869,21 @@ def test_sd_to_XYZ_ASTME30815_mi_10nm(self): np.array([1568.94283333, 1174.59084705, 221.11080639]), decimal=7) - def test_sd_to_XYZ_ASTME30815_mi_20nm(self): + def test_sd_to_XYZ_ASTME308_mi_20nm(self): """ - Tests :func:`colour.colorimetry.tristimulus.sd_to_XYZ_ASTME30815` + Tests :func:`colour.colorimetry.tristimulus.sd_to_XYZ_ASTME308` definition for 20 nm measurement intervals. """ np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(360, 820, 20)), self._cmfs, self._A), np.array([14.50187464, 10.87217124, 2.04918305]), decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(360, 820, 20)), self._cmfs, self._A, @@ -824,7 +892,7 @@ def test_sd_to_XYZ_ASTME30815_mi_20nm(self): decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(360, 820, 20)), self._cmfs, self._A, @@ -833,14 +901,14 @@ def test_sd_to_XYZ_ASTME30815_mi_20nm(self): decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(400, 700, 20)), self._cmfs, self._A), np.array([14.54114025, 10.88634755, 2.04916445]), decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(400, 700, 20)), self._cmfs, self._A, @@ -849,7 +917,7 @@ def test_sd_to_XYZ_ASTME30815_mi_20nm(self): decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(400, 700, 20)), self._cmfs, self._A, @@ -858,7 +926,7 @@ def test_sd_to_XYZ_ASTME30815_mi_20nm(self): decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(360, 820, 20)), self._cmfs, self._A, @@ -868,7 +936,7 @@ def test_sd_to_XYZ_ASTME30815_mi_20nm(self): decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(400, 700, 20)), self._cmfs, self._A, @@ -878,7 +946,7 @@ def test_sd_to_XYZ_ASTME30815_mi_20nm(self): decimal=7) np.testing.assert_almost_equal( - sd_to_XYZ_ASTME30815( + sd_to_XYZ_ASTME308( self._sd.copy().align(SpectralShape(400, 700, 20)), self._cmfs, self._A, @@ -886,6 +954,15 @@ def test_sd_to_XYZ_ASTME30815_mi_20nm(self): np.array([1568.91747040, 1174.58332427, 221.09475945]), decimal=7) + def test_raise_exception_sd_to_XYZ_ASTME308(self): + """ + Tests :func:`colour.colorimetry.tristimulus.sd_to_XYZ_ASTME308` + definition raised exception. + """ + + self.assertRaises(ValueError, sd_to_XYZ_ASTME308, + self._sd.copy().align(SpectralShape(360, 820, 2))) + class TestMultiSds_to_XYZ_integration(unittest.TestCase): """ @@ -902,20 +979,27 @@ def test_multi_sds_to_XYZ_integration(self): cmfs = CMFS['CIE 1931 2 Degree Standard Observer'] np.testing.assert_almost_equal( - multi_sds_to_XYZ_integration(MSD, SpectralShape(400, 700, 60), - cmfs, ILLUMINANTS_SDS['D65']), - XYZ_D65, + multi_sds_to_XYZ_integration(MSDS, cmfs, ILLUMINANTS_SDS['D65']), + XYZ_D65_INTEGRATION_MSDS, decimal=7) - cmfs = CMFS['CIE 1931 2 Degree Standard Observer'] np.testing.assert_almost_equal( multi_sds_to_XYZ_integration( - MSD, - SpectralShape(400, 700, 60), + MSDS_ARRAY, cmfs, ILLUMINANTS_SDS['D65'], - k=1), - XYZ_D65_K1, + shape=SpectralShape(400, 700, 60)), + XYZ_D65_ARRAY_INTEGRATION, + decimal=7) + + np.testing.assert_almost_equal( + multi_sds_to_XYZ_integration( + MSDS_ARRAY, + cmfs, + ILLUMINANTS_SDS['D65'], + 1, + shape=SpectralShape(400, 700, 60)), + XYZ_D65_ARRAY_K1_INTEGRATION, decimal=7) def test_domain_range_scale_multi_sds_to_XYZ_integration(self): @@ -930,13 +1014,67 @@ def test_domain_range_scale_multi_sds_to_XYZ_integration(self): for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - multi_sds_to_XYZ_integration(MSD, - SpectralShape(400, 700, 60), - cmfs, ILLUMINANTS_SDS['D65']), - XYZ_D65 * factor, + multi_sds_to_XYZ_integration( + MSDS_ARRAY, + cmfs, + ILLUMINANTS_SDS['D65'], + shape=SpectralShape(400, 700, 60)), + XYZ_D65_ARRAY_INTEGRATION * factor, decimal=7) +class TestMultiSds_to_XYZ_ASTME308(unittest.TestCase): + """ + Defines :func:`colour.colorimetry.tristimulus.\ +multi_sds_to_XYZ_ASTME308` definition unit tests methods. + """ + + def test_multi_sds_to_XYZ_ASTME308(self): + """ + Tests :func:`colour.colorimetry.tristimulus.\ +multi_sds_to_XYZ_ASTME308` + definition. + """ + + cmfs = CMFS['CIE 1931 2 Degree Standard Observer'] + msds = MSDS.clone().align(SpectralShape(400, 700, 20)) + np.testing.assert_almost_equal( + multi_sds_to_XYZ_ASTME308(msds, cmfs, ILLUMINANTS_SDS['D65']), + XYZ_D65_ASTME308_MSDS, + decimal=7) + + np.testing.assert_almost_equal( + multi_sds_to_XYZ_ASTME308(msds, cmfs, ILLUMINANTS_SDS['D65'], k=1), + XYZ_D65_ASTME308_K1_MSDS, + decimal=7) + + def test_domain_range_scale_multi_sds_to_XYZ_ASTME308(self): + """ + Tests :func:`colour.colorimetry.tristimulus.\ +multi_sds_to_XYZ_ASTME308` definition domain and range scale support. + """ + + cmfs = CMFS['CIE 1931 2 Degree Standard Observer'] + + d_r = (('reference', 1), (1, 0.01), (100, 1)) + for scale, factor in d_r: + with domain_range_scale(scale): + np.testing.assert_almost_equal( + multi_sds_to_XYZ_ASTME308( + MSDS.clone().align(SpectralShape(400, 700, 20)), cmfs, + ILLUMINANTS_SDS['D65']), + XYZ_D65_ASTME308_MSDS * factor, + decimal=7) + + def test_raise_exception_multi_sds_to_XYZ_ASTME308(self): + """ + Tests :func:`colour.colorimetry.tristimulus.\ +multi_sds_to_XYZ_ASTME308` definition raise exception. + """ + + self.assertRaises(ValueError, multi_sds_to_XYZ_ASTME308, MSDS_ARRAY) + + class TestWavelength_to_XYZ(unittest.TestCase): """ Defines :func:`colour.colorimetry.tristimulus.wavelength_to_XYZ` definition @@ -967,6 +1105,16 @@ def test_wavelength_to_XYZ(self): np.array([0.44575583, 0.18184213, 0.00000000]), decimal=7) + def test_raise_exception_wavelength_to_XYZ(self): + """ + Tests :func:`colour.colorimetry.tristimulus.wavelength_to_XYZ` + definition raised exception. + """ + + self.assertRaises(ValueError, wavelength_to_XYZ, 1) + + self.assertRaises(ValueError, wavelength_to_XYZ, 1000) + def test_n_dimensional_wavelength_to_XYZ(self): """ Tests :func:`colour.colorimetry.tristimulus.wavelength_to_XYZ` diff --git a/colour/colorimetry/tristimulus.py b/colour/colorimetry/tristimulus.py index 46b73365e5..006a78c73d 100644 --- a/colour/colorimetry/tristimulus.py +++ b/colour/colorimetry/tristimulus.py @@ -5,14 +5,15 @@ Defines objects for tristimulus values computation from spectral data: -- :func:`colour.colorimetry.tristimulus_weighting_factors_ASTME202211` +- :func:`colour.colorimetry.tristimulus_weighting_factors_ASTME2022` - :func:`colour.colorimetry.sd_to_XYZ_integration` - :func:`colour.colorimetry.\ -sd_to_XYZ_tristimulus_weighting_factors_ASTME30815` -- :func:`colour.colorimetry.sd_to_XYZ_ASTME30815` +sd_to_XYZ_tristimulus_weighting_factors_ASTME308` +- :func:`colour.colorimetry.sd_to_XYZ_ASTME308` - :attr:`colour.SD_TO_XYZ_METHODS` - :func:`colour.sd_to_XYZ` - :func:`colour.colorimetry.multi_sds_to_XYZ_integration` +- :func:`colour.colorimetry.multi_sds_to_XYZ_ASTME308` - :attr:`colour.MULTI_SD_TO_XYZ_METHODS` - :func:`colour.multi_sds_to_XYZ` - :func:`colour.wavelength_to_XYZ` @@ -37,7 +38,8 @@ import numpy as np from colour.algebra import lagrange_coefficients -from colour.colorimetry import (DEFAULT_SPECTRAL_SHAPE, SpectralShape, +from colour.colorimetry import (DEFAULT_SPECTRAL_SHAPE, + MultiSpectralDistributions, SpectralShape, STANDARD_OBSERVERS_CMFS, sd_ones) from colour.constants import DEFAULT_INT_DTYPE from colour.utilities import (CaseInsensitiveMapping, as_float_array, @@ -52,24 +54,24 @@ __status__ = 'Production' __all__ = [ - 'ASTME30815_PRACTISE_SHAPE', 'lagrange_coefficients_ASTME202211', - 'tristimulus_weighting_factors_ASTME202211', - 'adjust_tristimulus_weighting_factors_ASTME30815', 'sd_to_XYZ_integration', - 'sd_to_XYZ_tristimulus_weighting_factors_ASTME30815', - 'sd_to_XYZ_ASTME30815', 'SD_TO_XYZ_METHODS', 'sd_to_XYZ', - 'multi_sds_to_XYZ_integration', 'MULTI_SD_TO_XYZ_METHODS', - 'multi_sds_to_XYZ', 'wavelength_to_XYZ' + 'ASTME308_PRACTISE_SHAPE', 'lagrange_coefficients_ASTME2022', + 'tristimulus_weighting_factors_ASTME2022', + 'adjust_tristimulus_weighting_factors_ASTME308', 'sd_to_XYZ_integration', + 'sd_to_XYZ_tristimulus_weighting_factors_ASTME308', 'sd_to_XYZ_ASTME308', + 'SD_TO_XYZ_METHODS', 'sd_to_XYZ', 'multi_sds_to_XYZ_integration', + 'multi_sds_to_XYZ_ASTME308', 'MULTI_SD_TO_XYZ_METHODS', 'multi_sds_to_XYZ', + 'wavelength_to_XYZ' ] -ASTME30815_PRACTISE_SHAPE = DEFAULT_SPECTRAL_SHAPE -ASTME30815_PRACTISE_SHAPE.__doc__ = """ +ASTME308_PRACTISE_SHAPE = DEFAULT_SPECTRAL_SHAPE +ASTME308_PRACTISE_SHAPE.__doc__ = """ Shape for *ASTM E308-15* practise: (360, 780, 1). References ---------- :cite:`ASTMInternational2015b` -ASTME30815_PRACTISE_SHAPE : SpectralShape +ASTME308_PRACTISE_SHAPE : SpectralShape """ _LAGRANGE_INTERPOLATING_COEFFICIENTS_CACHE = None @@ -77,7 +79,7 @@ _TRISTIMULUS_WEIGHTING_FACTORS_CACHE = None -def lagrange_coefficients_ASTME202211(interval=10, interval_type='inner'): +def lagrange_coefficients_ASTME2022(interval=10, interval_type='inner'): """ Computes the *Lagrange Coefficients* for given interval size using practise *ASTM E2022-11* method. @@ -102,7 +104,7 @@ def lagrange_coefficients_ASTME202211(interval=10, interval_type='inner'): Examples -------- - >>> lagrange_coefficients_ASTME202211(10, 'inner') + >>> lagrange_coefficients_ASTME2022(10, 'inner') ... # doctest: +ELLIPSIS array([[-0.028..., 0.940..., 0.104..., -0.016...], [-0.048..., 0.864..., 0.216..., -0.032...], @@ -113,7 +115,7 @@ def lagrange_coefficients_ASTME202211(interval=10, interval_type='inner'): [-0.045..., 0.331..., 0.773..., -0.059...], [-0.032..., 0.216..., 0.864..., -0.048...], [-0.016..., 0.104..., 0.940..., -0.028...]]) - >>> lagrange_coefficients_ASTME202211(10, 'boundary') + >>> lagrange_coefficients_ASTME2022(10, 'boundary') ... # doctest: +ELLIPSIS array([[ 0.85..., 0.19..., -0.04...], [ 0.72..., 0.36..., -0.08...], @@ -146,7 +148,7 @@ def lagrange_coefficients_ASTME202211(interval=10, interval_type='inner'): return lica -def tristimulus_weighting_factors_ASTME202211(cmfs, illuminant, shape, k=None): +def tristimulus_weighting_factors_ASTME2022(cmfs, illuminant, shape, k=None): """ Returns a table of tristimulus weighting factors for given colour matching functions and illuminant using practise *ASTM E2022-11* method. @@ -195,8 +197,8 @@ def tristimulus_weighting_factors_ASTME202211(cmfs, illuminant, shape, k=None): :attr:`colour.colorimetry.tristimulus.\ _TRISTIMULUS_WEIGHTING_FACTORS_CACHE` attribute. Their identifier key is defined by the colour matching functions and illuminant names along - the current shape such as: - `CIE 1964 10 Degree Standard Observer, A, (360.0, 830.0, 10.0)` + with the current shape and normalisation constant :math:`k` such as: + `CIE 1964 10 Degree Standard Observer, A, (360.0, 830.0, 10.0), None` Considering the above, one should be mindful that using similar colour matching functions and illuminant names but with different spectral data will lead to unexpected behaviour. @@ -223,7 +225,7 @@ def tristimulus_weighting_factors_ASTME202211(cmfs, illuminant, shape, k=None): >>> cmfs = CMFS['CIE 1964 10 Degree Standard Observer'] >>> A = sd_CIE_standard_illuminant_A(cmfs.shape) >>> with numpy_print_options(suppress=True): - ... tristimulus_weighting_factors_ASTME202211( + ... tristimulus_weighting_factors_ASTME2022( ... cmfs, A, SpectralShape(360, 830, 20)) ... # doctest: +ELLIPSIS array([[ -0.0002981..., -0.0000317..., -0.0013301...], @@ -274,9 +276,9 @@ def tristimulus_weighting_factors_ASTME202211(cmfs, illuminant, shape, k=None): W = S[::interval_i, np.newaxis] * Y[::interval_i, :] # First and last measurement intervals *Lagrange Coefficients*. - c_c = lagrange_coefficients_ASTME202211(interval_i, 'boundary') + c_c = lagrange_coefficients_ASTME2022(interval_i, 'boundary') # Intermediate measurement intervals *Lagrange Coefficients*. - c_b = lagrange_coefficients_ASTME202211(interval_i, 'inner') + c_b = lagrange_coefficients_ASTME2022(interval_i, 'inner') # Total wavelengths count. w_c = len(Y) @@ -325,7 +327,7 @@ def tristimulus_weighting_factors_ASTME202211(cmfs, illuminant, shape, k=None): return W -def adjust_tristimulus_weighting_factors_ASTME30815(W, shape_r, shape_t): +def adjust_tristimulus_weighting_factors_ASTME308(W, shape_r, shape_t): """ Adjusts given table of tristimulus weighting factors to account for a shorter wavelengths range of the test spectral shape compared to the @@ -359,10 +361,10 @@ def adjust_tristimulus_weighting_factors_ASTME30815(W, shape_r, shape_t): >>> from colour.utilities import numpy_print_options >>> cmfs = CMFS['CIE 1964 10 Degree Standard Observer'] >>> A = sd_CIE_standard_illuminant_A(cmfs.shape) - >>> W = tristimulus_weighting_factors_ASTME202211( + >>> W = tristimulus_weighting_factors_ASTME2022( ... cmfs, A, SpectralShape(360, 830, 20)) >>> with numpy_print_options(suppress=True): - ... adjust_tristimulus_weighting_factors_ASTME30815( + ... adjust_tristimulus_weighting_factors_ASTME308( ... W, SpectralShape(360, 830, 20), SpectralShape(400, 700, 20)) ... # doctest: +ELLIPSIS array([[ 0.0509543..., 0.0040971..., 0.2144280...], @@ -400,9 +402,9 @@ def adjust_tristimulus_weighting_factors_ASTME30815(W, shape_r, shape_t): def sd_to_XYZ_integration( sd, - cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'], - illuminant=sd_ones(STANDARD_OBSERVERS_CMFS[ - 'CIE 1931 2 Degree Standard Observer'].shape), + cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] + .copy().trim(DEFAULT_SPECTRAL_SHAPE), + illuminant=sd_ones(), k=None): """ Converts given spectral distribution to *CIE XYZ* tristimulus values @@ -509,10 +511,11 @@ def sd_to_XYZ_integration( return from_range_100(XYZ) -def sd_to_XYZ_tristimulus_weighting_factors_ASTME30815( +def sd_to_XYZ_tristimulus_weighting_factors_ASTME308( sd, - cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'], - illuminant=sd_ones(ASTME30815_PRACTISE_SHAPE), + cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] + .copy().trim(ASTME308_PRACTISE_SHAPE), + illuminant=sd_ones(ASTME308_PRACTISE_SHAPE), k=None): """ Converts given spectral distribution to *CIE XYZ* tristimulus values @@ -586,7 +589,7 @@ def sd_to_XYZ_tristimulus_weighting_factors_ASTME30815( ... } >>> sd = SpectralDistribution(data) >>> illuminant = ILLUMINANTS_SDS['D65'] - >>> sd_to_XYZ_tristimulus_weighting_factors_ASTME30815( + >>> sd_to_XYZ_tristimulus_weighting_factors_ASTME308( ... sd, cmfs, illuminant) # doctest: +ELLIPSIS array([ 10.8402899..., 9.6843539..., 6.2160858...]) """ @@ -603,12 +606,12 @@ def sd_to_XYZ_tristimulus_weighting_factors_ASTME30815( illuminant.name, cmfs.name)) sd = sd.copy().trim(cmfs.shape) - W = tristimulus_weighting_factors_ASTME202211( + W = tristimulus_weighting_factors_ASTME2022( cmfs, illuminant, SpectralShape(cmfs.shape.start, cmfs.shape.end, sd.shape.interval), k) start_w = cmfs.shape.start end_w = cmfs.shape.start + sd.shape.interval * (W.shape[0] - 1) - W = adjust_tristimulus_weighting_factors_ASTME30815( + W = adjust_tristimulus_weighting_factors_ASTME308( W, SpectralShape(start_w, end_w, sd.shape.interval), sd.shape) R = sd.values @@ -617,10 +620,11 @@ def sd_to_XYZ_tristimulus_weighting_factors_ASTME30815( return from_range_100(XYZ) -def sd_to_XYZ_ASTME30815( +def sd_to_XYZ_ASTME308( sd, - cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'], - illuminant=sd_ones(ASTME30815_PRACTISE_SHAPE), + cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] + .copy().trim(ASTME308_PRACTISE_SHAPE), + illuminant=sd_ones(ASTME308_PRACTISE_SHAPE), use_practice_range=True, mi_5nm_omission_method=True, mi_20nm_interpolation_method=True, @@ -677,8 +681,8 @@ def sd_to_XYZ_ASTME30815( :attr:`colour.colorimetry.tristimulus.\ _TRISTIMULUS_WEIGHTING_FACTORS_CACHE` attribute. Their identifier key is defined by the colour matching functions and illuminant names along - the current shape such as: - `CIE 1964 10 Degree Standard Observer, A, (360.0, 830.0, 10.0)` + with the current shape and normalisation constant :math:`k` such as: + `CIE 1964 10 Degree Standard Observer, A, (360.0, 830.0, 10.0), None` Considering the above, one should be mindful that using similar colour matching functions and illuminant names but with different spectral data will lead to unexpected behaviour. @@ -721,7 +725,7 @@ def sd_to_XYZ_ASTME30815( ... } >>> sd = SpectralDistribution(data) >>> illuminant = ILLUMINANTS_SDS['D65'] - >>> sd_to_XYZ_ASTME30815(sd, cmfs, illuminant) + >>> sd_to_XYZ_ASTME308(sd, cmfs, illuminant) ... # doctest: +ELLIPSIS array([ 10.8399031..., 9.6840375..., 6.2164159...]) """ @@ -733,9 +737,9 @@ def sd_to_XYZ_ASTME30815( 'with measurement interval of 1, 5, 10 or 20nm!') if use_practice_range: - cmfs = cmfs.copy().trim(ASTME30815_PRACTISE_SHAPE) + cmfs = cmfs.copy().trim(ASTME308_PRACTISE_SHAPE) - method = sd_to_XYZ_tristimulus_weighting_factors_ASTME30815 + method = sd_to_XYZ_tristimulus_weighting_factors_ASTME308 if sd.shape.interval == 1: method = sd_to_XYZ_integration elif sd.shape.interval == 5 and mi_5nm_omission_method: @@ -755,8 +759,8 @@ def sd_to_XYZ_ASTME30815( sd.align(SpectralShape(sd.shape.start - 20, sd.shape.end + 20, 10)) for i in range(2): sd[sd.wavelengths[i]] = ( - 3 * sd.values[i + 2] - - 3 * sd.values[i + 4] + sd.values[i + 6]) # yapf: disable + 3 * sd.values[i + 2] - + 3 * sd.values[i + 4] + sd.values[i + 6]) # yapf: disable i_e = len(sd.domain) - 1 - i sd[sd.wavelengths[i_e]] = ( sd.values[i_e - 6] - 3 * sd.values[i_e - 4] + @@ -778,7 +782,7 @@ def sd_to_XYZ_ASTME30815( SD_TO_XYZ_METHODS = CaseInsensitiveMapping({ - 'ASTM E308-15': sd_to_XYZ_ASTME30815, + 'ASTM E308': sd_to_XYZ_ASTME308, 'Integration': sd_to_XYZ_integration }) SD_TO_XYZ_METHODS.__doc__ = """ @@ -791,21 +795,22 @@ def sd_to_XYZ_ASTME30815( :cite:`Wyszecki2000bf` SD_TO_XYZ_METHODS : CaseInsensitiveMapping - **{'ASTM E308-15', 'Integration'}** + **{'ASTM E308', 'Integration'}** Aliases: -- 'astm2015': 'ASTM E308-15' +- 'astm2015': 'ASTM E308' """ -SD_TO_XYZ_METHODS['astm2015'] = (SD_TO_XYZ_METHODS['ASTM E308-15']) +SD_TO_XYZ_METHODS['astm2015'] = SD_TO_XYZ_METHODS['ASTM E308'] def sd_to_XYZ( sd, - cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'], - illuminant=sd_ones(ASTME30815_PRACTISE_SHAPE), + cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] + .copy().trim(DEFAULT_SPECTRAL_SHAPE), + illuminant=sd_ones(), k=None, - method='ASTM E308-15', + method='ASTM E308', **kwargs): """ Converts given spectral distribution to *CIE XYZ* tristimulus values using @@ -835,23 +840,23 @@ def sd_to_XYZ( be the spectral concentration of the radiometric quantity corresponding to the photometric quantity required. method : unicode, optional - **{'ASTM E308-15', 'Integration'}**, + **{'ASTM E308', 'Integration'}**, Computation method. Other Parameters ---------------- mi_5nm_omission_method : bool, optional - {:func:`colour.colorimetry.sd_to_XYZ_ASTME30815`}, + {:func:`colour.colorimetry.sd_to_XYZ_ASTME308`}, 5 nm measurement intervals spectral distribution conversion to tristimulus values will use a 5 nm version of the colour matching functions instead of a table of tristimulus weighting factors. mi_20nm_interpolation_method : bool, optional - {:func:`colour.colorimetry.sd_to_XYZ_ASTME30815`}, + {:func:`colour.colorimetry.sd_to_XYZ_ASTME308`}, 20 nm measurement intervals spectral distribution conversion to tristimulus values will use a dedicated interpolation method instead of a table of tristimulus weighting factors. use_practice_range : bool, optional - {:func:`colour.colorimetry.sd_to_XYZ_ASTME30815`}, + {:func:`colour.colorimetry.sd_to_XYZ_ASTME308`}, Practise *ASTM E308-15* working wavelengths range is [360, 780], if *True* this argument will trim the colour matching functions appropriately. @@ -918,26 +923,25 @@ def sd_to_XYZ( def multi_sds_to_XYZ_integration( - msd, - shape, - cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'], - illuminant=sd_ones(STANDARD_OBSERVERS_CMFS[ - 'CIE 1931 2 Degree Standard Observer'].shape), - k=None): + msds, + cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] + .copy().trim(DEFAULT_SPECTRAL_SHAPE), + illuminant=sd_ones(), + k=None, + shape=DEFAULT_SPECTRAL_SHAPE): """ - Converts given multi-spectral distribution array :math:`msd` with given - spectral shape to *CIE XYZ* tristimulus values using given colour matching - functions and illuminant. + Converts given multi-spectral distributions to *CIE XYZ* tristimulus values + using given colour matching functions and illuminant. The multi-spectral + distribution can be either a :class:`colour.MultiSpectralDistributions` + class instance or an *array_like* in which case the ``shape`` must be + passed. Parameters ---------- - msa : array_like - Multi-spectral distribution array :math:`msd`, the wavelengths are + msds : MultiSpectralDistributions or array_like + Multi-spectral distributions, if an *array_like* the wavelengths are expected to be in the last axis, e.g. for a 512x384 multi-spectral - image with 77 bins, ``msd`` shape should be (384, 512, 77). - shape : SpectralShape, optional - Spectral shape of the multi-spectral distribution array :math:`msd`, - ``cmfs`` and ``illuminant`` will be aligned with it. + image with 77 bins, ``msds`` shape should be (384, 512, 77). cmfs : XYZ_ColourMatchingFunctions Standard observer colour matching functions. illuminant : SpectralDistribution, optional @@ -957,6 +961,9 @@ def multi_sds_to_XYZ_integration( 683 :math:`lm\\cdot W^{-1}`) and :math:`\\Phi_\\lambda(\\lambda)` must be the spectral concentration of the radiometric quantity corresponding to the photometric quantity required. + shape : SpectralShape, optional + Spectral shape of the multi-spectral distributions, ``cmfs`` and + ``illuminant`` will be aligned to it. Returns ------- @@ -973,6 +980,14 @@ def multi_sds_to_XYZ_integration( | ``XYZ`` | [0, 100] | [0, 1] | +-----------+-----------------------+---------------+ + - The code path using the *array_like* multi-spectral distributions + produces results different to the code path using a + :class:`colour.MultiSpectralDistributions` class instance: the former + favours execution speed by aligning the colour matching functions and + illuminant to the given spectral shape while the latter favours + precision by aligning the multi-spectral distributions to the colour + matching functions. + References ---------- :cite:`Wyszecki2000bf` @@ -980,7 +995,38 @@ def multi_sds_to_XYZ_integration( Examples -------- >>> from colour import ILLUMINANTS_SDS - >>> msd = np.array([ + >>> shape = SpectralShape(400, 700, 60) + >>> D65 = ILLUMINANTS_SDS['D65'] + >>> data = np.array([ + ... [0.0137, 0.0159, 0.0096, 0.0111, 0.0179, 0.1057, 0.0433, + ... 0.0258, 0.0248, 0.0186, 0.0310, 0.0473], + ... [0.0913, 0.3145, 0.2582, 0.0709, 0.2971, 0.4620, 0.2683, + ... 0.0831, 0.1203, 0.1292, 0.1682, 0.3221], + ... [0.0152, 0.0842, 0.4139, 0.0220, 0.5630, 0.1918, 0.2373, + ... 0.0430, 0.0054, 0.0079, 0.3719, 0.2268], + ... [0.0281, 0.0907, 0.2228, 0.1249, 0.2375, 0.5625, 0.0518, + ... 0.3230, 0.0065, 0.4006, 0.0861, 0.3161], + ... [0.1918, 0.7103, 0.0041, 0.1817, 0.0024, 0.4209, 0.0118, + ... 0.2302, 0.1860, 0.9404, 0.0041, 0.1124], + ... [0.0430, 0.0437, 0.3744, 0.0020, 0.5819, 0.0027, 0.0823, + ... 0.0081, 0.3625, 0.3213, 0.7849, 0.0024], + ... ]) + >>> msds = MultiSpectralDistributions(data, shape.range()) + >>> multi_sds_to_XYZ_integration(msds, illuminant=D65, shape=shape) + ... # doctest: +ELLIPSIS + array([[ 7.5031039..., 3.9486887..., 8.4053425...], + [ 26.9265732..., 15.0721676..., 28.7125195...], + [ 16.7039284..., 28.2175962..., 25.6515081...], + [ 11.5765075..., 8.6399161..., 6.5783111...], + [ 18.7324243..., 35.0755847..., 30.1525320...], + [ 45.1654991..., 39.6132308..., 43.6877410...], + [ 8.1765955..., 13.0937369..., 25.9477816...], + [ 22.4668631..., 19.3095206..., 7.9654068...], + [ 6.5782666..., 2.5254216..., 11.0954901...], + [ 43.9134487..., 27.9794809..., 11.731893 ...], + [ 8.5371481..., 19.7034075..., 17.7088101...], + [ 23.9092001..., 26.2129391..., 30.6831630...]]) + >>> msds = np.array([ ... [ ... [0.0137, 0.0913, 0.0152, 0.0281, 0.1918, 0.0430], ... [0.0159, 0.3145, 0.0842, 0.0907, 0.7103, 0.0437], @@ -998,9 +1044,7 @@ def multi_sds_to_XYZ_integration( ... [0.0473, 0.3221, 0.2268, 0.3161, 0.1124, 0.0024], ... ], ... ]) - >>> D65 = ILLUMINANTS_SDS['D65'] - >>> multi_sds_to_XYZ( - ... msd, SpectralShape(400, 700, 60), illuminant=D65) + >>> multi_sds_to_XYZ_integration(msds, illuminant=D65, shape=shape) ... # doctest: +ELLIPSIS array([[[ 7.1958378..., 3.8605390..., 10.1016398...], [ 25.5738615..., 14.7200581..., 34.8440007...], @@ -1017,34 +1061,175 @@ def multi_sds_to_XYZ_integration( [ 24.7830551..., 26.2221584..., 36.4430633...]]]) """ - msd = as_float_array(msd) + if isinstance(msds, MultiSpectralDistributions): + return as_float_array([ + sd_to_XYZ_integration(sd, cmfs, illuminant, k) + for sd in msds.to_sds() + ]) + else: + msds = as_float_array(msds) - if cmfs.shape != shape: - runtime_warning('Aligning "{0}" cmfs shape to "{1}".'.format( - cmfs.name, shape)) - cmfs = cmfs.copy().align(shape) + msd_shape_m_1, shape_wl_count = msds.shape[-1], len(shape.range()) + assert msd_shape_m_1 == shape_wl_count, ( + 'Multi-spectral distributions array with {0} wavelengths ' + 'is not compatible with spectral shape with {1} wavelengths!'. + format(msd_shape_m_1, shape_wl_count)) - if illuminant.shape != shape: - runtime_warning('Aligning "{0}" illuminant shape to "{1}".'.format( - illuminant.name, shape)) - illuminant = illuminant.copy().align(shape) + if cmfs.shape != shape: + runtime_warning('Aligning "{0}" cmfs shape to "{1}".'.format( + cmfs.name, shape)) + cmfs = cmfs.copy().align(shape) - S = illuminant.values - x_bar, y_bar, z_bar = tsplit(cmfs.values) - dw = cmfs.shape.interval + if illuminant.shape != shape: + runtime_warning('Aligning "{0}" illuminant shape to "{1}".'.format( + illuminant.name, shape)) + illuminant = illuminant.copy().align(shape) - k = 100 / (np.sum(y_bar * S) * dw) if k is None else k + S = illuminant.values + x_bar, y_bar, z_bar = tsplit(cmfs.values) + dw = cmfs.shape.interval - X_p = msd * x_bar * S * dw - Y_p = msd * y_bar * S * dw - Z_p = msd * z_bar * S * dw + k = 100 / (np.sum(y_bar * S) * dw) if k is None else k - XYZ = k * np.sum(np.array([X_p, Y_p, Z_p]), axis=-1) + X_p = msds * x_bar * S * dw + Y_p = msds * y_bar * S * dw + Z_p = msds * z_bar * S * dw + + XYZ = k * np.sum(np.array([X_p, Y_p, Z_p]), axis=-1) + + return from_range_100(np.rollaxis(XYZ, 0, msds.ndim)) + + +def multi_sds_to_XYZ_ASTME308( + msds, + cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] + .copy().trim(ASTME308_PRACTISE_SHAPE), + illuminant=sd_ones(ASTME308_PRACTISE_SHAPE), + use_practice_range=True, + mi_5nm_omission_method=True, + mi_20nm_interpolation_method=True, + k=None): + """ + Converts given multi-spectral distributions to *CIE XYZ* tristimulus values + using given colour matching functions and illuminant according to practise + *ASTM E308-15* method. + + Parameters + ---------- + msds : MultiSpectralDistributions or array_like + Multi-spectral distributions. + cmfs : XYZ_ColourMatchingFunctions + Standard observer colour matching functions. + illuminant : SpectralDistribution, optional + Illuminant spectral distribution. + use_practice_range : bool, optional + Practise *ASTM E308-15* working wavelengths range is [360, 780], + if *True* this argument will trim the colour matching functions + appropriately. + mi_5nm_omission_method : bool, optional + 5 nm measurement intervals multi-spectral distributions conversion to + tristimulus values will use a 5 nm version of the colour matching + functions instead of a table of tristimulus weighting factors. + mi_20nm_interpolation_method : bool, optional + 20 nm measurement intervals multi-spectral distributions conversion to + tristimulus values will use a dedicated interpolation method instead + of a table of tristimulus weighting factors. + k : numeric, optional + Normalisation constant :math:`k`. For reflecting or transmitting object + colours, :math:`k` is chosen so that :math:`Y = 100` for objects for + which the spectral reflectance factor :math:`R(\\lambda)` of the object + colour or the spectral transmittance factor :math:`\\tau(\\lambda)` of + the object is equal to unity for all wavelengths. For self-luminous + objects and illuminants, the constants :math:`k` is usually chosen on + the grounds of convenience. If, however, in the CIE 1931 standard + colorimetric system, the :math:`Y` value is required to be numerically + equal to the absolute value of a photometric quantity, the constant, + :math:`k`, must be put equal to the numerical value of :math:`K_m`, the + maximum spectral luminous efficacy (which is equal to + 683 :math:`lm\\cdot W^{-1}`) and :math:`\\Phi_\\lambda(\\lambda)` must + be the spectral concentration of the radiometric quantity corresponding + to the photometric quantity required. + shape : SpectralShape, optional + Spectral shape of the multi-spectral distributions, ``cmfs`` and + ``illuminant`` will be aligned to it. + + Returns + ------- + array_like + *CIE XYZ* tristimulus values. + + Notes + ----- + + +-----------+-----------------------+---------------+ + | **Range** | **Scale - Reference** | **Scale - 1** | + +===========+=======================+===============+ + | ``XYZ`` | [0, 100] | [0, 1] | + +-----------+-----------------------+---------------+ + + - The code path using the *array_like* multi-spectral distributions + produces results different to the code path using a + :class:`colour.MultiSpectralDistributions` class instance: the former + favours execution speed by aligning the colour matching functions and + illuminant to the given spectral shape while the latter favours + precision by aligning the multi-spectral distributions to the colour + matching functions. + + References + ---------- + :cite:`Wyszecki2000bf` - return from_range_100(np.rollaxis(XYZ, 0, msd.ndim)) + Examples + -------- + >>> from colour import ILLUMINANTS_SDS + >>> shape = SpectralShape(400, 700, 60) + >>> D65 = ILLUMINANTS_SDS['D65'] + >>> data = np.array([ + ... [0.0137, 0.0159, 0.0096, 0.0111, 0.0179, 0.1057, 0.0433, + ... 0.0258, 0.0248, 0.0186, 0.0310, 0.0473], + ... [0.0913, 0.3145, 0.2582, 0.0709, 0.2971, 0.4620, 0.2683, + ... 0.0831, 0.1203, 0.1292, 0.1682, 0.3221], + ... [0.0152, 0.0842, 0.4139, 0.0220, 0.5630, 0.1918, 0.2373, + ... 0.0430, 0.0054, 0.0079, 0.3719, 0.2268], + ... [0.0281, 0.0907, 0.2228, 0.1249, 0.2375, 0.5625, 0.0518, + ... 0.3230, 0.0065, 0.4006, 0.0861, 0.3161], + ... [0.1918, 0.7103, 0.0041, 0.1817, 0.0024, 0.4209, 0.0118, + ... 0.2302, 0.1860, 0.9404, 0.0041, 0.1124], + ... [0.0430, 0.0437, 0.3744, 0.0020, 0.5819, 0.0027, 0.0823, + ... 0.0081, 0.3625, 0.3213, 0.7849, 0.0024], + ... ]) + >>> msds = MultiSpectralDistributions(data, shape.range()) + >>> msds = msds.align(SpectralShape(400, 700, 20)) + >>> multi_sds_to_XYZ_ASTME308(msds, illuminant=D65) + ... # doctest: +ELLIPSIS + array([[ 7.5054003..., 3.9556401..., 8.3911571...], + [ 26.9413788..., 15.0983954..., 28.6698509...], + [ 16.7055672..., 28.2093633..., 25.6615580...], + [ 11.570967 ..., 8.6443158..., 6.5602307...], + [ 18.7440223..., 35.0632090..., 30.1846483...], + [ 45.1222564..., 39.6234504..., 43.5905694...], + [ 8.1797385..., 13.0953249..., 25.9383064...], + [ 22.4455034..., 19.311139 ..., 7.9320266...], + [ 6.5766847..., 2.5305175..., 11.0749224...], + [ 43.9100652..., 27.9994198..., 11.6878495...], + [ 8.5504477..., 19.6918148..., 17.7437346...], + [ 23.8870261..., 26.2147602..., 30.6365272...]]) + """ + + if isinstance(msds, MultiSpectralDistributions): + return as_float_array([ + sd_to_XYZ_ASTME308(sd, cmfs, illuminant, use_practice_range, + mi_5nm_omission_method, + mi_20nm_interpolation_method, k) + for sd in msds.to_sds() + ]) + else: + raise ValueError('"ASTM E308-15" method does not support "array_like" ' + 'multi-spectral distributions!') MULTI_SD_TO_XYZ_METHODS = CaseInsensitiveMapping({ + 'ASTM E308': multi_sds_to_XYZ_ASTME308, 'Integration': multi_sds_to_XYZ_integration }) MULTI_SD_TO_XYZ_METHODS.__doc__ = """ @@ -1053,46 +1238,45 @@ def multi_sds_to_XYZ_integration( References ---------- +:cite:`ASTMInternational2011a`, :cite:`ASTMInternational2015b`, :cite:`Wyszecki2000bf` MULTI_SD_TO_XYZ_METHODS : CaseInsensitiveMapping - **{'Integration'}** + **{'ASTM E308', 'Integration'}** + +Aliases: + +- 'astm2015': 'ASTM E308' """ +MULTI_SD_TO_XYZ_METHODS['astm2015'] = MULTI_SD_TO_XYZ_METHODS['ASTM E308'] def multi_sds_to_XYZ( - msd, - shape=DEFAULT_SPECTRAL_SHAPE, - cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'], - illuminant=sd_ones(ASTME30815_PRACTISE_SHAPE), - method='Integration', + msds, + cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] + .copy().trim(DEFAULT_SPECTRAL_SHAPE), + illuminant=sd_ones(), + k=None, + method='ASTM E308', **kwargs): """ - Converts given multi-spectral distribution array :math:`msd` with given - spectral shape to *CIE XYZ* tristimulus values using given colour matching - functions and illuminant. + Converts given multi-spectral distributions to *CIE XYZ* tristimulus values + using given colour matching functions and illuminant. For the *Integration* + method, the multi-spectral distributions can be either a + :class:`colour.MultiSpectralDistributions` class instance or an + *array_like* in which case the ``shape`` must be passed. Parameters ---------- - msa : array_like - Multi-spectral distribution array :math:`msd`, the wavelengths are + msds : MultiSpectralDistributions or array_like + Multi-spectral distributions, if an *array_like* the wavelengths are expected to be in the last axis, e.g. for a 512x384 multi-spectral - image with 77 bins, ``msd`` shape should be (384, 512, 77). - shape : SpectralShape, optional - Spectral shape of the multi-spectral distribution array :math:`msd`, - ``cmfs`` and ``illuminant`` will be aligned with it. + image with 77 bins, ``msds`` shape should be (384, 512, 77). cmfs : XYZ_ColourMatchingFunctions Standard observer colour matching functions. illuminant : SpectralDistribution, optional Illuminant spectral distribution. - method : unicode, optional - **{'Integration'}**, - Computation method. - - Other Parameters - ---------------- k : numeric, optional - {:func:`colour.colorimetry.multi_sds_to_XYZ_integration`}, Normalisation constant :math:`k`. For reflecting or transmitting object colours, :math:`k` is chosen so that :math:`Y = 100` for objects for which the spectral reflectance factor :math:`R(\\lambda)` of the object @@ -1107,12 +1291,37 @@ def multi_sds_to_XYZ( 683 :math:`lm\\cdot W^{-1}`) and :math:`\\Phi_\\lambda(\\lambda)` must be the spectral concentration of the radiometric quantity corresponding to the photometric quantity required. + method : unicode, optional + **{'ASTM E308', 'Integration'}**, + Computation method. + + Other Parameters + ---------------- + use_practice_range : bool, optional + {:func:`colour.colorimetry.multi_sds_to_XYZ_ASTME308`}, + Practise *ASTM E308-15* working wavelengths range is [360, 780], + if *True* this argument will trim the colour matching functions + appropriately. + mi_5nm_omission_method : bool, optional + {:func:`colour.colorimetry.multi_sds_to_XYZ_ASTME308`}, + 5 nm measurement intervals multi-spectral distributions conversion to + tristimulus values will use a 5 nm version of the colour matching + functions instead of a table of tristimulus weighting factors. + mi_20nm_interpolation_method : bool, optional + {:func:`colour.colorimetry.multi_sds_to_XYZ_ASTME308`}, + 20 nm measurement intervals multi-spectral distributions conversion to + tristimulus values will use a dedicated interpolation method instead + of a table of tristimulus weighting factors. + shape : SpectralShape, optional + {:func:`colour.colorimetry.multi_sds_to_XYZ_integration`}, + Spectral shape of the multi-spectral distributions array :math:`msds`, + ``cmfs`` and ``illuminant`` will be aligned to it. Returns ------- array_like *CIE XYZ* tristimulus values, for a 512x384 multi-spectral image with - 77 bins, the output shape will be (384, 512, 3). + 77 wavelengths, the output shape will be (384, 512, 3). Notes ----- @@ -1123,13 +1332,52 @@ def multi_sds_to_XYZ( | ``XYZ`` | [0, 100] | [0, 1] | +-----------+-----------------------+---------------+ + - The code path using the *array_like* multi-spectral distributions + produces results different to the code path using a + :class:`colour.MultiSpectralDistributions` class instance: the former + favours execution speed by aligning the colour matching functions and + illuminant to the given spectral shape while the latter favours + precision by aligning the multi-spectral distributions to the colour + matching functions. + References ---------- + :cite:`ASTMInternational2011a`, :cite:`ASTMInternational2015b`, :cite:`Wyszecki2000bf` Examples -------- - >>> msd = np.array([ + >>> shape = SpectralShape(400, 700, 60) + >>> data = np.array([ + ... [0.0137, 0.0159, 0.0096, 0.0111, 0.0179, 0.1057, 0.0433, + ... 0.0258, 0.0248, 0.0186, 0.0310, 0.0473], + ... [0.0913, 0.3145, 0.2582, 0.0709, 0.2971, 0.4620, 0.2683, + ... 0.0831, 0.1203, 0.1292, 0.1682, 0.3221], + ... [0.0152, 0.0842, 0.4139, 0.0220, 0.5630, 0.1918, 0.2373, + ... 0.0430, 0.0054, 0.0079, 0.3719, 0.2268], + ... [0.0281, 0.0907, 0.2228, 0.1249, 0.2375, 0.5625, 0.0518, + ... 0.3230, 0.0065, 0.4006, 0.0861, 0.3161], + ... [0.1918, 0.7103, 0.0041, 0.1817, 0.0024, 0.4209, 0.0118, + ... 0.2302, 0.1860, 0.9404, 0.0041, 0.1124], + ... [0.0430, 0.0437, 0.3744, 0.0020, 0.5819, 0.0027, 0.0823, + ... 0.0081, 0.3625, 0.3213, 0.7849, 0.0024], + ... ]) + >>> msds = MultiSpectralDistributions(data, shape.range()) + >>> multi_sds_to_XYZ(msds, method='Integration', shape=shape) + ... # doctest: +ELLIPSIS + array([[ 8.2415862..., 4.2543993..., 7.6100842...], + [ 29.6144619..., 16.1158465..., 25.9015472...], + [ 16.6799560..., 27.2350547..., 22.9413337...], + [ 12.5597688..., 9.0667136..., 5.9670327...], + [ 18.5804689..., 33.6618109..., 26.9249733...], + [ 47.7113308..., 40.4573249..., 39.6439145...], + [ 7.830207 ..., 12.3689624..., 23.3742655...], + [ 24.1695370..., 20.0629815..., 7.2718670...], + [ 7.2333751..., 2.7982097..., 10.0688374...], + [ 48.7358074..., 30.2417164..., 10.6753233...], + [ 8.3231013..., 18.6791507..., 15.8228184...], + [ 24.6452277..., 26.0809382..., 27.7106399...]]) + >>> msds = np.array([ ... [ ... [0.0137, 0.0913, 0.0152, 0.0281, 0.1918, 0.0430], ... [0.0159, 0.3145, 0.0842, 0.0907, 0.7103, 0.0437], @@ -1147,7 +1395,7 @@ def multi_sds_to_XYZ( ... [0.0473, 0.3221, 0.2268, 0.3161, 0.1124, 0.0024], ... ], ... ]) - >>> multi_sds_to_XYZ(msd, SpectralShape(400, 700, 60)) + >>> multi_sds_to_XYZ(msds, method='Integration', shape=shape) ... # doctest: +ELLIPSIS array([[[ 7.6862675..., 4.0925470..., 8.4950412...], [ 27.4119366..., 15.5014764..., 29.2825122...], @@ -1166,7 +1414,7 @@ def multi_sds_to_XYZ( function = MULTI_SD_TO_XYZ_METHODS[method] - return function(msd, shape, cmfs, illuminant, + return function(msds, cmfs, illuminant, k, **filter_kwargs(function, **kwargs)) diff --git a/colour/colorimetry/whiteness.py b/colour/colorimetry/whiteness.py index 98beee5e9f..57ecfd0e12 100644 --- a/colour/colorimetry/whiteness.py +++ b/colour/colorimetry/whiteness.py @@ -17,11 +17,11 @@ - :func:`colour.colorimetry.whiteness_ASTME313`: *Whiteness* index :math:`WI` of given sample *CIE XYZ* tristimulus values using *ASTM E313* method. - :func:`colour.colorimetry.whiteness_Ganz1979`: *Whiteness* index :math:`W` - and *tint* :math:`T` computation of given sample *xy* chromaticity + and *tint* :math:`T` computation of given sample *CIE xy* chromaticity coordinates using *Ganz and Griesser (1979)* method. - :func:`colour.colorimetry.whiteness_CIE2004`: *Whiteness* :math:`W` or :math:`W_{10}` and *tint* :math:`T` or :math:`T_{10}` computation of given - sample *xy* chromaticity coordinates using *CIE 2004* method. + sample *CIE xy* chromaticity coordinates using *CIE 2004* method. - :attr:`colour.WHITENESS_METHODS`: Supported *whiteness* computations methods. - :func:`colour.whiteness`: *Whiteness* :math:`W` computation using given @@ -293,13 +293,13 @@ def whiteness_ASTME313(XYZ): def whiteness_Ganz1979(xy, Y): """ Returns the *whiteness* index :math:`W` and *tint* :math:`T` of given - sample *xy* chromaticity coordinates using *Ganz and Griesser (1979)* + sample *CIE xy* chromaticity coordinates using *Ganz and Griesser (1979)* method. Parameters ---------- xy : array_like - Chromaticity coordinates *xy* of sample. + Chromaticity coordinates *CIE xy* of sample. Y : numeric or array_like Tristimulus :math:`Y` value of sample. @@ -362,13 +362,13 @@ def whiteness_CIE2004(xy, observer='CIE 1931 2 Degree Standard Observer'): """ Returns the *whiteness* :math:`W` or :math:`W_{10}` and *tint* :math:`T` - or :math:`T_{10}` of given sample *xy* chromaticity coordinates using + or :math:`T_{10}` of given sample *CIE xy* chromaticity coordinates using *CIE 2004* method. Parameters ---------- xy : array_like - Chromaticity coordinates *xy* of sample. + Chromaticity coordinates *CIE xy* of sample. Y : numeric or array_like Tristimulus :math:`Y` value of sample. xy_n : array_like diff --git a/colour/continuous/__init__.py b/colour/continuous/__init__.py index 8509527a17..56044d8b8e 100644 --- a/colour/continuous/__init__.py +++ b/colour/continuous/__init__.py @@ -2,11 +2,44 @@ from __future__ import absolute_import +import sys + +from colour.utilities.deprecation import ModuleAPI, build_API_changes +from colour.utilities.documentation import is_documentation_building + from .abstract import AbstractContinuousFunction from .signal import Signal -from .multi_signal import MultiSignal +from .multi_signals import MultiSignals __all__ = [] __all__ += ['AbstractContinuousFunction'] __all__ += ['Signal'] -__all__ += ['MultiSignal'] +__all__ += ['MultiSignals'] + + +# ----------------------------------------------------------------------------# +# --- API Changes and Deprecation Management ---# +# ----------------------------------------------------------------------------# +class continuous(ModuleAPI): + def __getattr__(self, attribute): + return super(continuous, self).__getattr__(attribute) + + +# v0.3.14 +API_CHANGES = { + 'ObjectRenamed': [[ + 'colour.continuous.MultiSignal', + 'colour.continuous.MultiSignals', + ], ] +} +""" +Defines *colour.continuous* sub-package API changes. + +API_CHANGES : dict +""" + +if not is_documentation_building(): + sys.modules['colour.continuous'] = continuous( + sys.modules['colour.continuous'], build_API_changes(API_CHANGES)) + + del ModuleAPI, is_documentation_building, build_API_changes, sys diff --git a/colour/continuous/abstract.py b/colour/continuous/abstract.py index 16f24c1f9c..1ee7eb5de9 100644 --- a/colour/continuous/abstract.py +++ b/colour/continuous/abstract.py @@ -6,7 +6,7 @@ Defines the abstract class implementing support for abstract continuous function: -- :class:`colour.continuous.AbstractContinuousFunction. +- :class:`colour.continuous.AbstractContinuousFunction`. """ from __future__ import division, unicode_literals @@ -390,7 +390,7 @@ def __str__(self): Formatted string representation. """ - pass + return '<{0} object at {1}>'.format(self.__class__.__name__, id(self)) @abstractmethod def __repr__(self): @@ -404,8 +404,9 @@ def __repr__(self): Evaluable string representation. """ - pass + return '{0}()'.format(self.__class__.__name__) + @abstractmethod def __hash__(self): """ Returns the abstract continuous function hash. @@ -416,7 +417,7 @@ def __hash__(self): Object hash. """ - return hash(repr(self)) + pass @abstractmethod def __getitem__(self, x): diff --git a/colour/continuous/multi_signal.py b/colour/continuous/multi_signals.py similarity index 84% rename from colour/continuous/multi_signal.py rename to colour/continuous/multi_signals.py index 779965d65c..ab8d962ddb 100644 --- a/colour/continuous/multi_signal.py +++ b/colour/continuous/multi_signals.py @@ -1,17 +1,16 @@ # -*- coding: utf-8 -*- """ -Multi Signal -============ +Multi Signals +============= -Defines the class implementing support for multi-continuous signal: +Defines the class implementing support for multi-continuous signals: -- :class:`colour.continuous.MultiSignal` +- :class:`colour.continuous.MultiSignals` """ from __future__ import division, unicode_literals import numpy as np -from collections import Iterator, Mapping, OrderedDict, Sequence # Python 3 compatibility. try: @@ -21,6 +20,11 @@ div = truediv idiv = itruediv +from collections import OrderedDict +try: # pragma: no cover + from collections import Iterator, Mapping, Sequence +except ImportError: # pragma: no cover + from collections.abc import Iterator, Mapping, Sequence from colour.constants import DEFAULT_FLOAT_DTYPE from colour.continuous import AbstractContinuousFunction, Signal @@ -34,19 +38,19 @@ __email__ = 'colour-science@googlegroups.com' __status__ = 'Production' -__all__ = ['MultiSignal'] +__all__ = ['MultiSignals'] -class MultiSignal(AbstractContinuousFunction): +class MultiSignals(AbstractContinuousFunction): """ - Defines the base class for multi-continuous signal, a container for + Defines the base class for multi-continuous signals, a container for multiple :class:`colour.continuous.Signal` sub-class instances. Parameters ---------- - data : Series or Dataframe or Signal or MultiSignal or array_like or \ + data : Series or Dataframe or Signal or MultiSignals or array_like or \ dict_like, optional - Data to be stored in the multi-continuous signal. + Data to be stored in the multi-continuous signals. domain : array_like, optional Values to initialise the multiple :class:`colour.continuous.Signal` sub-class instances :attr:`colour.continuous.Signal.domain` attribute @@ -60,7 +64,7 @@ class MultiSignal(AbstractContinuousFunction): Other Parameters ---------------- name : unicode, optional - Multi-continuous signal name. + multi-continuous signals name. dtype : type, optional **{np.float16, np.float32, np.float64, np.float128}**, Floating point data type. @@ -105,7 +109,7 @@ class MultiSignal(AbstractContinuousFunction): __eq__ __ne__ arithmetical_operation - multi_signal_unpack_data + multi_signals_unpack_data fill_nan to_dataframe @@ -114,7 +118,7 @@ class MultiSignal(AbstractContinuousFunction): Instantiation with implicit *domain* and a single signal: >>> range_ = np.linspace(10, 100, 10) - >>> print(MultiSignal(range_)) + >>> print(MultiSignals(range_)) [[ 0. 10.] [ 1. 20.] [ 2. 30.] @@ -129,7 +133,7 @@ class MultiSignal(AbstractContinuousFunction): Instantiation with explicit *domain* and a single signal: >>> domain = np.arange(100, 1100, 100) - >>> print(MultiSignal(range_, domain)) + >>> print(MultiSignals(range_, domain)) [[ 100. 10.] [ 200. 20.] [ 300. 30.] @@ -145,7 +149,7 @@ class MultiSignal(AbstractContinuousFunction): >>> range_ = tstack([np.linspace(10, 100, 10)] * 3) >>> range_ += np.array([0, 10, 20]) - >>> print(MultiSignal(range_, domain)) + >>> print(MultiSignals(range_, domain)) [[ 100. 10. 20. 30.] [ 200. 20. 30. 40.] [ 300. 30. 40. 50.] @@ -159,7 +163,7 @@ class MultiSignal(AbstractContinuousFunction): Instantiation with a *dict*: - >>> print(MultiSignal(dict(zip(domain, range_)))) + >>> print(MultiSignals(dict(zip(domain, range_)))) [[ 100. 10. 20. 30.] [ 200. 20. 30. 40.] [ 300. 30. 40. 50.] @@ -176,8 +180,8 @@ class MultiSignal(AbstractContinuousFunction): >>> class NotSignal(Signal): ... pass - >>> multi_signal = MultiSignal(range_, domain, signal_type=NotSignal) - >>> print(multi_signal) + >>> multi_signals = MultiSignals(range_, domain, signal_type=NotSignal) + >>> print(multi_signals) [[ 100. 10. 20. 30.] [ 200. 20. 30. 40.] [ 300. 30. 40. 50.] @@ -188,14 +192,14 @@ class MultiSignal(AbstractContinuousFunction): [ 800. 80. 90. 100.] [ 900. 90. 100. 110.] [ 1000. 100. 110. 120.]] - >>> type(multi_signal.signals[0]) # doctest: +SKIP - + >>> type(multi_signals.signals[0]) # doctest: +SKIP + Instantiation with a *Pandas* *Series*: >>> if is_pandas_installed(): ... from pandas import Series - ... print(MultiSignal( # doctest: +SKIP + ... print(MultiSignals( # doctest: +SKIP ... Series(dict(zip(domain, np.linspace(10, 100, 10)))))) [[ 100. 10.] [ 200. 20.] @@ -213,7 +217,7 @@ class MultiSignal(AbstractContinuousFunction): >>> if is_pandas_installed(): ... from pandas import DataFrame ... data = dict(zip(['a', 'b', 'c'], tsplit(range_))) - ... print(MultiSignal( # doctest: +SKIP + ... print(MultiSignals( # doctest: +SKIP ... DataFrame(data, domain))) [[ 100. 10. 20. 30.] [ 200. 20. 30. 40.] @@ -231,10 +235,10 @@ class MultiSignal(AbstractContinuousFunction): >>> x = 150 >>> range_ = tstack([np.sin(np.linspace(0, 1, 10))] * 3) >>> range_ += np.array([0.0, 0.25, 0.5]) - >>> MultiSignal(range_, domain)[x] # doctest: +ELLIPSIS + >>> MultiSignals(range_, domain)[x] # doctest: +ELLIPSIS array([ 0.0359701..., 0.2845447..., 0.5331193...]) >>> x = np.linspace(100, 1000, 3) - >>> MultiSignal(range_, domain)[x] # doctest: +ELLIPSIS + >>> MultiSignals(range_, domain)[x] # doctest: +ELLIPSIS array([[ 4.4085384...e-20, 2.5000000...e-01, 5.0000000...e-01], [ 4.7669395...e-01, 7.2526859...e-01, 9.7384323...e-01], [ 8.4147098...e-01, 1.0914709...e+00, 1.3414709...e+00]]) @@ -243,13 +247,13 @@ class MultiSignal(AbstractContinuousFunction): >>> x = 150 >>> from colour.algebra import CubicSplineInterpolator - >>> MultiSignal( + >>> MultiSignals( ... range_, ... domain, ... interpolator=CubicSplineInterpolator)[x] # doctest: +ELLIPSIS array([ 0.0555274..., 0.3055274..., 0.5555274...]) >>> x = np.linspace(100, 1000, 3) - >>> MultiSignal( + >>> MultiSignals( ... range_, ... domain, ... interpolator=CubicSplineInterpolator)[x] # doctest: +ELLIPSIS @@ -259,12 +263,12 @@ class MultiSignal(AbstractContinuousFunction): """ def __init__(self, data=None, domain=None, labels=None, **kwargs): - super(MultiSignal, self).__init__(kwargs.get('name')) + super(MultiSignals, self).__init__(kwargs.get('name')) self._signal_type = kwargs.get('signal_type', Signal) - self._signals = self.multi_signal_unpack_data(data, domain, labels, - **kwargs) + self._signals = self.multi_signals_unpack_data(data, domain, labels, + **kwargs) @property def dtype(self): @@ -529,8 +533,8 @@ def signals(self): Parameters ---------- - value : Series or Dataframe or Signal or MultiSignal or array_like or \ -dict_like + value : Series or Dataframe or Signal or MultiSignals or array_like \ +or dict_like Attribute value. Returns @@ -548,7 +552,7 @@ def signals(self, value): """ if value is not None: - self._signals = self.multi_signal_unpack_data( + self._signals = self.multi_signals_unpack_data( value, signal_type=self._signal_type) @property @@ -606,7 +610,7 @@ def signal_type(self): def __str__(self): """ Returns a formatted string representation of the multi-continuous - signal. + signals. Returns ------- @@ -618,7 +622,7 @@ def __str__(self): >>> domain = np.arange(0, 10, 1) >>> range_ = tstack([np.linspace(10, 100, 10)] * 3) >>> range_ += np.array([0, 10, 20]) - >>> print(MultiSignal(range_)) + >>> print(MultiSignals(range_)) [[ 0. 10. 20. 30.] [ 1. 20. 30. 40.] [ 2. 30. 40. 50.] @@ -634,12 +638,12 @@ def __str__(self): try: return str(np.hstack([self.domain[:, np.newaxis], self.range])) except TypeError: - return super(MultiSignal, self).__str__() + return super(MultiSignals, self).__str__() def __repr__(self): """ Returns an evaluable string representation of the multi-continuous - signal. + signals. Returns ------- @@ -651,22 +655,22 @@ def __repr__(self): >>> domain = np.arange(0, 10, 1) >>> range_ = tstack([np.linspace(10, 100, 10)] * 3) >>> range_ += np.array([0, 10, 20]) - >>> MultiSignal(range_) # doctest: +ELLIPSIS - MultiSignal([[ 0., 10., 20., 30.], - [ 1., 20., 30., 40.], - [ 2., 30., 40., 50.], - [ 3., 40., 50., 60.], - [ 4., 50., 60., 70.], - [ 5., 60., 70., 80.], - [ 6., 70., 80., 90.], - [ 7., 80., 90., 100.], - [ 8., 90., 100., 110.], - [ 9., 100., 110., 120.]], - labels=[0, 1, 2], - interpolator=KernelInterpolator, - interpolator_args={}, - extrapolator=Extrapolator, - extrapolator_args={...) + >>> MultiSignals(range_) # doctest: +ELLIPSIS + MultiSignals([[ 0., 10., 20., 30.], + [ 1., 20., 30., 40.], + [ 2., 30., 40., 50.], + [ 3., 40., 50., 60.], + [ 4., 50., 60., 70.], + [ 5., 60., 70., 80.], + [ 6., 70., 80., 90.], + [ 7., 80., 90., 100.], + [ 8., 90., 100., 110.], + [ 9., 100., 110., 120.]], + labels=[0, 1, 2], + interpolator=KernelInterpolator, + interpolator_args={}, + extrapolator=Extrapolator, + extrapolator_args={...) """ try: @@ -696,9 +700,7 @@ def __repr__(self): return representation except TypeError: - # TODO: Discuss what is the most suitable behaviour, either the - # following or __str__ one. - return '{0}()'.format(self.__class__.__name__) + return super(MultiSignals, self).__repr__() def __hash__(self): """ @@ -731,8 +733,8 @@ def __getitem__(self, x): -------- >>> range_ = tstack([np.linspace(10, 100, 10)] * 3) >>> range_ += np.array([0, 10, 20]) - >>> multi_signal = MultiSignal(range_) - >>> print(multi_signal) + >>> multi_signals = MultiSignals(range_) + >>> print(multi_signals) [[ 0. 10. 20. 30.] [ 1. 20. 30. 40.] [ 2. 30. 40. 50.] @@ -743,17 +745,17 @@ def __getitem__(self, x): [ 7. 80. 90. 100.] [ 8. 90. 100. 110.] [ 9. 100. 110. 120.]] - >>> multi_signal[0] + >>> multi_signals[0] array([ 10., 20., 30.]) - >>> multi_signal[np.array([0, 1, 2])] + >>> multi_signals[np.array([0, 1, 2])] array([[ 10., 20., 30.], [ 20., 30., 40.], [ 30., 40., 50.]]) - >>> multi_signal[0:3] + >>> multi_signals[0:3] array([[ 10., 20., 30.], [ 20., 30., 40.], [ 30., 40., 50.]]) - >>> multi_signal[np.linspace(0, 5, 5)] # doctest: +ELLIPSIS + >>> multi_signals[np.linspace(0, 5, 5)] # doctest: +ELLIPSIS array([[ 10. ..., 20. ..., 30. ...], [ 22.8348902..., 32.8046056..., 42.774321 ...], [ 34.8004492..., 44.7434347..., 54.6864201...], @@ -783,8 +785,8 @@ def __setitem__(self, x, y): >>> domain = np.arange(0, 10, 1) >>> range_ = tstack([np.linspace(10, 100, 10)] * 3) >>> range_ += np.array([0, 10, 20]) - >>> multi_signal = MultiSignal(range_) - >>> print(multi_signal) + >>> multi_signals = MultiSignals(range_) + >>> print(multi_signals) [[ 0. 10. 20. 30.] [ 1. 20. 30. 40.] [ 2. 30. 40. 50.] @@ -795,21 +797,21 @@ def __setitem__(self, x, y): [ 7. 80. 90. 100.] [ 8. 90. 100. 110.] [ 9. 100. 110. 120.]] - >>> multi_signal[0] = 20 - >>> multi_signal[0] + >>> multi_signals[0] = 20 + >>> multi_signals[0] array([ 20., 20., 20.]) - >>> multi_signal[np.array([0, 1, 2])] = 30 - >>> multi_signal[np.array([0, 1, 2])] + >>> multi_signals[np.array([0, 1, 2])] = 30 + >>> multi_signals[np.array([0, 1, 2])] array([[ 30., 30., 30.], [ 30., 30., 30.], [ 30., 30., 30.]]) - >>> multi_signal[0:3] = 40 - >>> multi_signal[0:3] + >>> multi_signals[0:3] = 40 + >>> multi_signals[0:3] array([[ 40., 40., 40.], [ 40., 40., 40.], [ 40., 40., 40.]]) - >>> multi_signal[np.linspace(0, 5, 5)] = 50 - >>> print(multi_signal) + >>> multi_signals[np.linspace(0, 5, 5)] = 50 + >>> print(multi_signals) [[ 0. 50. 50. 50. ] [ 1. 40. 40. 40. ] [ 1.25 50. 50. 50. ] @@ -823,8 +825,8 @@ def __setitem__(self, x, y): [ 7. 80. 90. 100. ] [ 8. 90. 100. 110. ] [ 9. 100. 110. 120. ]] - >>> multi_signal[np.array([0, 1, 2])] = np.array([10, 20, 30]) - >>> print(multi_signal) + >>> multi_signals[np.array([0, 1, 2])] = np.array([10, 20, 30]) + >>> print(multi_signals) [[ 0. 10. 20. 30. ] [ 1. 10. 20. 30. ] [ 1.25 50. 50. 50. ] @@ -839,8 +841,8 @@ def __setitem__(self, x, y): [ 8. 90. 100. 110. ] [ 9. 100. 110. 120. ]] >>> y = np.arange(1, 10, 1).reshape(3, 3) - >>> multi_signal[np.array([0, 1, 2])] = y - >>> print(multi_signal) + >>> multi_signals[np.array([0, 1, 2])] = y + >>> print(multi_signals) [[ 0. 1. 2. 3. ] [ 1. 4. 5. 6. ] [ 1.25 50. 50. 50. ] @@ -876,7 +878,7 @@ def __setitem__(self, x, y): def __contains__(self, x): """ - Returns whether the multi-continuous signal contains given independent + Returns whether the multi-continuous signals contains given independent domain :math:`x` variable. Parameters @@ -892,12 +894,12 @@ def __contains__(self, x): Examples -------- >>> range_ = np.linspace(10, 100, 10) - >>> multi_signal = MultiSignal(range_) - >>> 0 in multi_signal + >>> multi_signals = MultiSignals(range_) + >>> 0 in multi_signals True - >>> 0.5 in multi_signal + >>> 0.5 in multi_signals True - >>> 1000 in multi_signal + >>> 1000 in multi_signals False """ @@ -908,39 +910,39 @@ def __contains__(self, x): def __eq__(self, other): """ - Returns whether the multi-continuous signal is equal to given other + Returns whether the multi-continuous signals is equal to given other object. Parameters ---------- other : object - Object to test whether it is equal to the multi-continuous signal. + Object to test whether it is equal to the multi-continuous signals. Returns ------- bool - Is given object equal to the multi-continuous signal. + Is given object equal to the multi-continuous signals. Examples -------- >>> range_ = np.linspace(10, 100, 10) - >>> multi_signal_1 = MultiSignal(range_) - >>> multi_signal_2 = MultiSignal(range_) - >>> multi_signal_1 == multi_signal_2 + >>> multi_signals_1 = MultiSignals(range_) + >>> multi_signals_2 = MultiSignals(range_) + >>> multi_signals_1 == multi_signals_2 True - >>> multi_signal_2[0] = 20 - >>> multi_signal_1 == multi_signal_2 + >>> multi_signals_2[0] = 20 + >>> multi_signals_1 == multi_signals_2 False - >>> multi_signal_2[0] = 10 - >>> multi_signal_1 == multi_signal_2 + >>> multi_signals_2[0] = 10 + >>> multi_signals_1 == multi_signals_2 True >>> from colour.algebra import CubicSplineInterpolator - >>> multi_signal_2.interpolator = CubicSplineInterpolator - >>> multi_signal_1 == multi_signal_2 + >>> multi_signals_2.interpolator = CubicSplineInterpolator + >>> multi_signals_1 == multi_signals_2 False """ - if isinstance(other, MultiSignal): + if isinstance(other, MultiSignals): if all([ np.array_equal(self.domain, other.domain), np.array_equal( @@ -957,36 +959,36 @@ def __eq__(self, other): def __ne__(self, other): """ - Returns whether the multi-continuous signal is not equal to given other - object. + Returns whether the multi-continuous signals is not equal to given + other object. Parameters ---------- other : object Object to test whether it is not equal to the multi-continuous - signal. + signals. Returns ------- bool - Is given object not equal to the multi-continuous signal. + Is given object not equal to the multi-continuous signals. Examples -------- >>> range_ = np.linspace(10, 100, 10) - >>> multi_signal_1 = MultiSignal(range_) - >>> multi_signal_2 = MultiSignal(range_) - >>> multi_signal_1 != multi_signal_2 + >>> multi_signals_1 = MultiSignals(range_) + >>> multi_signals_2 = MultiSignals(range_) + >>> multi_signals_1 != multi_signals_2 False - >>> multi_signal_2[0] = 20 - >>> multi_signal_1 != multi_signal_2 + >>> multi_signals_2[0] = 20 + >>> multi_signals_1 != multi_signals_2 True - >>> multi_signal_2[0] = 10 - >>> multi_signal_1 != multi_signal_2 + >>> multi_signals_2[0] = 10 + >>> multi_signals_1 != multi_signals_2 False >>> from colour.algebra import CubicSplineInterpolator - >>> multi_signal_2.interpolator = CubicSplineInterpolator - >>> multi_signal_1 != multi_signal_2 + >>> multi_signals_2.interpolator = CubicSplineInterpolator + >>> multi_signals_1 != multi_signals_2 True """ @@ -1008,8 +1010,8 @@ def arithmetical_operation(self, a, operation, in_place=False): Returns ------- - MultiSignal - Multi-continuous signal. + MultiSignals + multi-continuous signals. Examples -------- @@ -1018,8 +1020,8 @@ def arithmetical_operation(self, a, operation, in_place=False): >>> domain = np.arange(0, 10, 1) >>> range_ = tstack([np.linspace(10, 100, 10)] * 3) >>> range_ += np.array([0, 10, 20]) - >>> multi_signal_1 = MultiSignal(range_) - >>> print(multi_signal_1) + >>> multi_signals_1 = MultiSignals(range_) + >>> print(multi_signals_1) [[ 0. 10. 20. 30.] [ 1. 20. 30. 40.] [ 2. 30. 40. 50.] @@ -1030,7 +1032,7 @@ def arithmetical_operation(self, a, operation, in_place=False): [ 7. 80. 90. 100.] [ 8. 90. 100. 110.] [ 9. 100. 110. 120.]] - >>> print(multi_signal_1.arithmetical_operation(10, '+', True)) + >>> print(multi_signals_1.arithmetical_operation(10, '+', True)) [[ 0. 20. 30. 40.] [ 1. 30. 40. 50.] [ 2. 40. 50. 60.] @@ -1045,7 +1047,7 @@ def arithmetical_operation(self, a, operation, in_place=False): Adding an *array_like* variable: >>> a = np.linspace(10, 100, 10) - >>> print(multi_signal_1.arithmetical_operation(a, '+', True)) + >>> print(multi_signals_1.arithmetical_operation(a, '+', True)) [[ 0. 30. 40. 50.] [ 1. 50. 60. 70.] [ 2. 70. 80. 90.] @@ -1058,7 +1060,7 @@ def arithmetical_operation(self, a, operation, in_place=False): [ 9. 210. 220. 230.]] >>> a = np.array([[10, 20, 30]]) - >>> print(multi_signal_1.arithmetical_operation(a, '+', True)) + >>> print(multi_signals_1.arithmetical_operation(a, '+', True)) [[ 0. 40. 60. 80.] [ 1. 60. 80. 100.] [ 2. 80. 100. 120.] @@ -1071,7 +1073,7 @@ def arithmetical_operation(self, a, operation, in_place=False): [ 9. 220. 240. 260.]] >>> a = np.arange(0, 30, 1).reshape([10, 3]) - >>> print(multi_signal_1.arithmetical_operation(a, '+', True)) + >>> print(multi_signals_1.arithmetical_operation(a, '+', True)) [[ 0. 40. 61. 82.] [ 1. 63. 84. 105.] [ 2. 86. 107. 128.] @@ -1085,9 +1087,9 @@ def arithmetical_operation(self, a, operation, in_place=False): Adding a :class:`colour.continuous.Signal` sub-class: - >>> multi_signal_2 = MultiSignal(range_) - >>> print(multi_signal_1.arithmetical_operation( - ... multi_signal_2, '+', True)) + >>> multi_signals_2 = MultiSignals(range_) + >>> print(multi_signals_1.arithmetical_operation( + ... multi_signals_2, '+', True)) [[ 0. 50. 81. 112.] [ 1. 83. 114. 145.] [ 2. 116. 147. 178.] @@ -1100,13 +1102,13 @@ def arithmetical_operation(self, a, operation, in_place=False): [ 9. 347. 378. 409.]] """ - multi_signal = self if in_place else self.copy() + multi_signals = self if in_place else self.copy() - if isinstance(a, MultiSignal): + if isinstance(a, MultiSignals): assert len(self.signals) == len(a.signals), ( - '"MultiSignal" operands must have same count than ' + '"MultiSignals" operands must have same count than ' 'underlying "Signal" components!') - for signal_a, signal_b in zip(multi_signal.signals.values(), + for signal_a, signal_b in zip(multi_signals.signals.values(), a.signals.values()): signal_a.arithmetical_operation(signal_b, operation, True) else: @@ -1117,33 +1119,34 @@ def arithmetical_operation(self, a, operation, in_place=False): '2-dimensional array!') if a.ndim in (0, 1): - for signal in multi_signal.signals.values(): + for signal in multi_signals.signals.values(): signal.arithmetical_operation(a, operation, True) else: - assert a.shape[-1] == len(multi_signal.signals), ( + assert a.shape[-1] == len(multi_signals.signals), ( 'Operand "a" variable columns must have same count than ' 'underlying "Signal" components!') - for signal, y in zip(multi_signal.signals.values(), tsplit(a)): + for signal, y in zip(multi_signals.signals.values(), + tsplit(a)): signal.arithmetical_operation(y, operation, True) - return multi_signal + return multi_signals @staticmethod - def multi_signal_unpack_data(data=None, - domain=None, - labels=None, - dtype=DEFAULT_FLOAT_DTYPE, - signal_type=Signal, - **kwargs): + def multi_signals_unpack_data(data=None, + domain=None, + labels=None, + dtype=DEFAULT_FLOAT_DTYPE, + signal_type=Signal, + **kwargs): """ - Unpack given data for multi-continuous signal instantiation. + Unpack given data for multi-continuous signals instantiation. Parameters ---------- - data : Series or Dataframe or Signal or MultiSignal or array_like or \ + data : Series or Dataframe or Signal or MultiSignals or array_like or \ dict_like, optional - Data to unpack for multi-continuous signal instantiation. + Data to unpack for multi-continuous signals instantiation. domain : array_like, optional Values to initialise the multiple :class:`colour.continuous.Signal` sub-class instances :attr:`colour.continuous.Signal.domain` @@ -1159,7 +1162,7 @@ def multi_signal_unpack_data(data=None, Other Parameters ---------------- name : unicode, optional - Multi-continuous signal name. + multi-continuous signals name. interpolator : object, optional Interpolator class type to use as interpolating function for the :class:`colour.continuous.Signal` sub-class instances. @@ -1184,7 +1187,7 @@ def multi_signal_unpack_data(data=None, Unpacking using implicit *domain* and a single signal: >>> range_ = np.linspace(10, 100, 10) - >>> signals = MultiSignal.multi_signal_unpack_data(range_) + >>> signals = MultiSignals.multi_signals_unpack_data(range_) >>> list(signals.keys()) [0] >>> print(signals[0]) @@ -1202,7 +1205,7 @@ def multi_signal_unpack_data(data=None, Unpacking using explicit *domain* and a single signal: >>> domain = np.arange(100, 1100, 100) - >>> signals = MultiSignal.multi_signal_unpack_data(range_, domain) + >>> signals = MultiSignals.multi_signals_unpack_data(range_, domain) >>> list(signals.keys()) [0] >>> print(signals[0]) @@ -1221,7 +1224,7 @@ def multi_signal_unpack_data(data=None, >>> range_ = tstack([np.linspace(10, 100, 10)] * 3) >>> range_ += np.array([0, 10, 20]) - >>> signals = MultiSignal.multi_signal_unpack_data(range_, domain) + >>> signals = MultiSignals.multi_signals_unpack_data(range_, domain) >>> list(signals.keys()) [0, 1, 2] >>> print(signals[2]) @@ -1238,7 +1241,7 @@ def multi_signal_unpack_data(data=None, Unpacking using a *dict*: - >>> signals = MultiSignal.multi_signal_unpack_data( + >>> signals = MultiSignals.multi_signals_unpack_data( ... dict(zip(domain, range_))) >>> list(signals.keys()) [0, 1, 2] @@ -1254,11 +1257,11 @@ def multi_signal_unpack_data(data=None, [ 900. 110.] [ 1000. 120.]] - Unpacking using *MultiSignal.multi_signal_unpack_data* method output: + Unpacking using *MultiSignals.multi_signals_unpack_data* method output: - >>> signals = MultiSignal.multi_signal_unpack_data( + >>> signals = MultiSignals.multi_signals_unpack_data( ... dict(zip(domain, range_))) - >>> signals = MultiSignal.multi_signal_unpack_data(signals) + >>> signals = MultiSignals.multi_signals_unpack_data(signals) >>> list(signals.keys()) [0, 1, 2] >>> print(signals[2]) @@ -1277,7 +1280,7 @@ def multi_signal_unpack_data(data=None, >>> if is_pandas_installed(): ... from pandas import Series - ... signals = MultiSignal.multi_signal_unpack_data( + ... signals = MultiSignals.multi_signals_unpack_data( ... Series(dict(zip(domain, np.linspace(10, 100, 10))))) ... print(signals[0]) # doctest: +SKIP [[ 100. 10.] @@ -1296,7 +1299,7 @@ def multi_signal_unpack_data(data=None, >>> if is_pandas_installed(): ... from pandas import DataFrame ... data = dict(zip(['a', 'b', 'c'], tsplit(range_))) - ... signals = MultiSignal.multi_signal_unpack_data( + ... signals = MultiSignals.multi_signals_unpack_data( ... DataFrame(data, domain)) ... print(signals['c']) # doctest: +SKIP [[ 100. 30.] @@ -1318,7 +1321,7 @@ def multi_signal_unpack_data(data=None, domain_u, range_u, signals = None, None, None signals = OrderedDict() # TODO: Implement support for Signal class passing. - if isinstance(data, MultiSignal): + if isinstance(data, MultiSignals): signals = data.signals elif (issubclass(type(data), Sequence) or isinstance(data, (tuple, list, np.ndarray, Iterator))): @@ -1332,8 +1335,8 @@ def multi_signal_unpack_data(data=None, elif (issubclass(type(data), Mapping) or isinstance(data, (dict, OrderedDict))): - # Handling `MultiSignal.multi_signal_unpack_data` method output - # used as argument to `MultiSignal.multi_signal_unpack_data` + # Handling `MultiSignals.multi_signals_unpack_data` method output + # used as argument to `MultiSignals.multi_signals_unpack_data` # method. is_signal = all([ True if isinstance(i, Signal) else False @@ -1394,14 +1397,14 @@ def fill_nan(self, method='Interpolation', default=0): Returns ------- Signal - NaNs filled multi-continuous signal. + NaNs filled multi-continuous signals. >>> domain = np.arange(0, 10, 1) >>> range_ = tstack([np.linspace(10, 100, 10)] * 3) >>> range_ += np.array([0, 10, 20]) - >>> multi_signal = MultiSignal(range_) - >>> multi_signal[3:7] = np.nan - >>> print(multi_signal) + >>> multi_signals = MultiSignals(range_) + >>> multi_signals[3:7] = np.nan + >>> print(multi_signals) [[ 0. 10. 20. 30.] [ 1. 20. 30. 40.] [ 2. 30. 40. 50.] @@ -1412,7 +1415,7 @@ def fill_nan(self, method='Interpolation', default=0): [ 7. 80. 90. 100.] [ 8. 90. 100. 110.] [ 9. 100. 110. 120.]] - >>> print(multi_signal.fill_nan()) + >>> print(multi_signals.fill_nan()) [[ 0. 10. 20. 30.] [ 1. 20. 30. 40.] [ 2. 30. 40. 50.] @@ -1423,8 +1426,8 @@ def fill_nan(self, method='Interpolation', default=0): [ 7. 80. 90. 100.] [ 8. 90. 100. 110.] [ 9. 100. 110. 120.]] - >>> multi_signal[3:7] = np.nan - >>> print(multi_signal.fill_nan(method='Constant')) + >>> multi_signals[3:7] = np.nan + >>> print(multi_signals.fill_nan(method='Constant')) [[ 0. 10. 20. 30.] [ 1. 20. 30. 40.] [ 2. 30. 40. 50.] @@ -1458,8 +1461,8 @@ def to_dataframe(self): ... domain = np.arange(0, 10, 1) ... range_ = tstack([np.linspace(10, 100, 10)] * 3) ... range_ += np.array([0, 10, 20]) - ... multi_signal = MultiSignal(range_) - ... print(multi_signal.to_dataframe()) # doctest: +SKIP + ... multi_signals = MultiSignals(range_) + ... print(multi_signals.to_dataframe()) # doctest: +SKIP 0 1 2 0.0 10.0 20.0 30.0 1.0 20.0 30.0 40.0 diff --git a/colour/continuous/signal.py b/colour/continuous/signal.py index b6c897005c..f2c78ccfeb 100644 --- a/colour/continuous/signal.py +++ b/colour/continuous/signal.py @@ -11,7 +11,6 @@ from __future__ import division, unicode_literals import numpy as np -from collections import Iterator, Mapping, OrderedDict, Sequence from operator import add, mul, pow, sub, iadd, imul, ipow, isub # Python 3 compatibility. @@ -22,6 +21,11 @@ div = truediv idiv = itruediv +from collections import OrderedDict +try: # pragma: no cover + from collections import Iterator, Mapping, Sequence +except ImportError: # pragma: no cover + from collections.abc import Iterator, Mapping, Sequence from colour.algebra import Extrapolator, KernelInterpolator from colour.constants import DEFAULT_FLOAT_DTYPE @@ -584,9 +588,7 @@ def __repr__(self): return representation except TypeError: - # TODO: Discuss what is the most suitable behaviour, either the - # following or __str__ one. - return '{0}()'.format(self.__class__.__name__) + return super(Signal, self).__repr__() def __hash__(self): """ diff --git a/colour/continuous/tests/test_multi_signal.py b/colour/continuous/tests/test_multi_signal.py index 96aeb879de..287e619f59 100644 --- a/colour/continuous/tests/test_multi_signal.py +++ b/colour/continuous/tests/test_multi_signal.py @@ -1,18 +1,21 @@ # -*- coding: utf-8 -*- """ -Defines unit tests for :mod:`colour.continuous.multi_signal` module. +Defines unit tests for :mod:`colour.continuous.multi_signals` module. """ from __future__ import division, unicode_literals import numpy as np +import operator import unittest import re import textwrap +from six import string_types from colour.algebra import (CubicSplineInterpolator, Extrapolator, KernelInterpolator) -from colour.continuous import MultiSignal, Signal +from colour.constants import DEFAULT_FLOAT_DTYPE +from colour.continuous import MultiSignals, Signal from colour.utilities import is_pandas_installed, tsplit, tstack __author__ = 'Colour Developers' @@ -22,12 +25,12 @@ __email__ = 'colour-science@googlegroups.com' __status__ = 'Production' -__all__ = ['TestMultiSignal'] +__all__ = ['TestMultiSignals'] -class TestMultiSignal(unittest.TestCase): +class TestMultiSignals(unittest.TestCase): """ - Defines :class:`colour.continuous.multi_signal.MultiSignal` class unit + Defines :class:`colour.continuous.multi_signals.MultiSignals` class unit tests methods. """ @@ -41,7 +44,7 @@ def setUp(self): self._domain_1 = np.arange(0, 10, 1) self._domain_2 = np.arange(100, 1100, 100) - self._multi_signal = MultiSignal(self._range_2) + self._multi_signals = MultiSignals(self._range_2) def test_required_attributes(self): """ @@ -54,7 +57,7 @@ def test_required_attributes(self): 'labels', 'signal_type') for attribute in required_attributes: - self.assertIn(attribute, dir(MultiSignal)) + self.assertIn(attribute, dir(MultiSignals)) def test_required_methods(self): """ @@ -64,81 +67,99 @@ def test_required_methods(self): required_methods = ('__str__', '__repr__', '__hash__', '__getitem__', '__setitem__', '__contains__', '__eq__', '__ne__', 'arithmetical_operation', - 'multi_signal_unpack_data', 'fill_nan', + 'multi_signals_unpack_data', 'fill_nan', 'domain_distance', 'to_dataframe') for method in required_methods: - self.assertIn(method, dir(MultiSignal)) + self.assertIn(method, dir(MultiSignals)) + + def test_dtype(self): + """ + Tests :func:`colour.continuous.multi_signals.MultiSignals.dtype` + property. + """ + + self.assertEqual(self._multi_signals.dtype, None) + + multi_signals = self._multi_signals.copy() + multi_signals.dtype = DEFAULT_FLOAT_DTYPE + self.assertEqual(multi_signals.dtype, DEFAULT_FLOAT_DTYPE) def test_domain(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.domain` + Tests :func:`colour.continuous.multi_signals.MultiSignals.domain` property. """ - multi_signal = self._multi_signal.copy() + multi_signals = self._multi_signals.copy() np.testing.assert_almost_equal( - multi_signal[np.array([0, 1, 2])], + multi_signals[np.array([0, 1, 2])], np.array([[10.0, 20.0, 30.0], [20.0, 30.0, 40.0], [30.0, 40.0, 50.0]]), decimal=7) - multi_signal.domain = self._domain_1 * 10 + multi_signals.domain = self._domain_1 * 10 - np.testing.assert_array_equal(multi_signal.domain, self._domain_1 * 10) + np.testing.assert_array_equal(multi_signals.domain, + self._domain_1 * 10) np.testing.assert_almost_equal( - multi_signal[np.array([0, 1, 2]) * 10], + multi_signals[np.array([0, 1, 2]) * 10], np.array([[10.0, 20.0, 30.0], [20.0, 30.0, 40.0], [30.0, 40.0, 50.0]]), decimal=7) + # TODO: Use "assertWarns" when dropping Python 2.7. + domain = np.linspace(0, 1, 10) + domain[0] = -np.inf + multi_signals.domain = domain + def test_range(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.range` + Tests :func:`colour.continuous.multi_signals.MultiSignals.range` property. """ - multi_signal = self._multi_signal.copy() + multi_signals = self._multi_signals.copy() np.testing.assert_almost_equal( - multi_signal[np.array([0, 1, 2])], + multi_signals[np.array([0, 1, 2])], np.array([[10.0, 20.0, 30.0], [20.0, 30.0, 40.0], [30.0, 40.0, 50.0]]), decimal=7) - multi_signal.range = self._range_1 * 10 + multi_signals.range = self._range_1 * 10 - np.testing.assert_array_equal(multi_signal.range, + np.testing.assert_array_equal(multi_signals.range, tstack([self._range_1] * 3) * 10) np.testing.assert_almost_equal( - multi_signal[np.array([0, 1, 2])], + multi_signals[np.array([0, 1, 2])], np.array([[10.0, 10.0, 10.0], [20.0, 20.0, 20.0], [30.0, 30.0, 30.0]]) * 10, decimal=7) - multi_signal.range = self._range_2 * 10 + multi_signals.range = self._range_2 * 10 - np.testing.assert_array_equal(multi_signal.range, self._range_2 * 10) + np.testing.assert_array_equal(multi_signals.range, self._range_2 * 10) np.testing.assert_almost_equal( - multi_signal[np.array([0, 1, 2])], + multi_signals[np.array([0, 1, 2])], np.array([[10.0, 20.0, 30.0], [20.0, 30.0, 40.0], [30.0, 40.0, 50.0]]) * 10, decimal=7) def test_interpolator(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.interpolator` + Tests :func:`colour.continuous.multi_signals.MultiSignals.interpolator` property. """ - multi_signal = self._multi_signal.copy() + multi_signals = self._multi_signals.copy() np.testing.assert_almost_equal( - multi_signal[np.linspace(0, 5, 5)], + multi_signals[np.linspace(0, 5, 5)], np.array([[10.00000000, 20.00000000, 30.00000000], [22.83489024, 32.80460562, 42.77432100], [34.80044921, 44.74343470, @@ -146,10 +167,10 @@ def test_interpolator(self): [60.00000000, 70.00000000, 80.00000000]]), decimal=7) - multi_signal.interpolator = CubicSplineInterpolator + multi_signals.interpolator = CubicSplineInterpolator np.testing.assert_almost_equal( - multi_signal[np.linspace(0, 5, 5)], + multi_signals[np.linspace(0, 5, 5)], np.array([[10.00000000, 20.00000000, 30.00000000], [22.50000000, 32.50000000, 42.50000000], [35.00000000, 45.00000000, @@ -159,14 +180,14 @@ def test_interpolator(self): def test_interpolator_args(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.\ + Tests :func:`colour.continuous.multi_signals.MultiSignals.\ interpolator_args` property. """ - multi_signal = self._multi_signal.copy() + multi_signals = self._multi_signals.copy() np.testing.assert_almost_equal( - multi_signal[np.linspace(0, 5, 5)], + multi_signals[np.linspace(0, 5, 5)], np.array([[10.00000000, 20.00000000, 30.00000000], [22.83489024, 32.80460562, 42.77432100], [34.80044921, 44.74343470, @@ -174,10 +195,15 @@ def test_interpolator_args(self): [60.00000000, 70.00000000, 80.00000000]]), decimal=7) - multi_signal.interpolator_args = {'window': 1, 'kernel_args': {'a': 1}} + multi_signals.interpolator_args = { + 'window': 1, + 'kernel_args': { + 'a': 1 + } + } np.testing.assert_almost_equal( - multi_signal[np.linspace(0, 5, 5)], + multi_signals[np.linspace(0, 5, 5)], np.array([[10.00000000, 20.00000000, 30.00000000], [18.91328761, 27.91961505, 36.92594248], [28.36993142, 36.47562611, @@ -187,104 +213,112 @@ def test_interpolator_args(self): def test_extrapolator(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.extrapolator` + Tests :func:`colour.continuous.multi_signals.MultiSignals.extrapolator` property. """ - self.assertIsInstance(self._multi_signal.extrapolator(), Extrapolator) + self.assertIsInstance(self._multi_signals.extrapolator(), Extrapolator) def test_extrapolator_args(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.\ + Tests :func:`colour.continuous.multi_signals.MultiSignals.\ extrapolator_args` property. """ - multi_signal = self._multi_signal.copy() + multi_signals = self._multi_signals.copy() - assert np.all(np.isnan(multi_signal[np.array([-1000, 1000])])) + assert np.all(np.isnan(multi_signals[np.array([-1000, 1000])])) - multi_signal.extrapolator_args = { + multi_signals.extrapolator_args = { 'method': 'Linear', } np.testing.assert_almost_equal( - multi_signal[np.array([-1000, 1000])], + multi_signals[np.array([-1000, 1000])], np.array([[-9990.0, -9980.0, -9970.0], [10010.0, 10020.0, 10030.0]]), decimal=7) def test_function(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.function` + Tests :func:`colour.continuous.multi_signals.MultiSignals.function` property. """ - assert hasattr(self._multi_signal.function, '__call__') + assert hasattr(self._multi_signals.function, '__call__') + + def test_raise_exception_function(self): + """ + Tests :func:`colour.continuous.signal.multi_signals.MultiSignals` + property raised exception. + """ + + self.assertRaises(RuntimeError, MultiSignals().function, 0) def test_signals(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.signals` + Tests :func:`colour.continuous.multi_signals.MultiSignals.signals` property. """ - multi_signal = self._multi_signal.copy() + multi_signals = self._multi_signals.copy() - multi_signal.signals = self._range_1 - np.testing.assert_array_equal(multi_signal.domain, self._domain_1) - np.testing.assert_array_equal(multi_signal.range, + multi_signals.signals = self._range_1 + np.testing.assert_array_equal(multi_signals.domain, self._domain_1) + np.testing.assert_array_equal(multi_signals.range, self._range_1[:, np.newaxis]) def test_labels(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.labels` + Tests :func:`colour.continuous.multi_signals.MultiSignals.labels` property. """ - self.assertListEqual(self._multi_signal.labels, [0, 1, 2]) + self.assertListEqual(self._multi_signals.labels, [0, 1, 2]) - multi_signal = self._multi_signal.copy() + multi_signals = self._multi_signals.copy() - multi_signal.labels = ['a', 'b', 'c'] + multi_signals.labels = ['a', 'b', 'c'] - self.assertListEqual(multi_signal.labels, ['a', 'b', 'c']) + self.assertListEqual(multi_signals.labels, ['a', 'b', 'c']) def test_signal_type(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.signal_type` + Tests :func:`colour.continuous.multi_signals.MultiSignals.signal_type` property. """ - multi_signal = MultiSignal(signal_type=Signal) + multi_signals = MultiSignals(signal_type=Signal) - self.assertEqual(multi_signal.signal_type, Signal) + self.assertEqual(multi_signals.signal_type, Signal) def test__init__(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.__init__` + Tests :func:`colour.continuous.multi_signals.MultiSignals.__init__` method. """ - multi_signal = MultiSignal(self._range_1) - np.testing.assert_array_equal(multi_signal.domain, self._domain_1) - np.testing.assert_array_equal(multi_signal.range, + multi_signals = MultiSignals(self._range_1) + np.testing.assert_array_equal(multi_signals.domain, self._domain_1) + np.testing.assert_array_equal(multi_signals.range, self._range_1[:, np.newaxis]) - multi_signal = MultiSignal(self._range_1, self._domain_2) - np.testing.assert_array_equal(multi_signal.domain, self._domain_2) - np.testing.assert_array_equal(multi_signal.range, + multi_signals = MultiSignals(self._range_1, self._domain_2) + np.testing.assert_array_equal(multi_signals.domain, self._domain_2) + np.testing.assert_array_equal(multi_signals.range, self._range_1[:, np.newaxis]) - multi_signal = MultiSignal(self._range_2, self._domain_2) - np.testing.assert_array_equal(multi_signal.domain, self._domain_2) - np.testing.assert_array_equal(multi_signal.range, self._range_2) + multi_signals = MultiSignals(self._range_2, self._domain_2) + np.testing.assert_array_equal(multi_signals.domain, self._domain_2) + np.testing.assert_array_equal(multi_signals.range, self._range_2) - multi_signal = MultiSignal(dict(zip(self._domain_2, self._range_2))) - np.testing.assert_array_equal(multi_signal.domain, self._domain_2) - np.testing.assert_array_equal(multi_signal.range, self._range_2) + multi_signals = MultiSignals(dict(zip(self._domain_2, self._range_2))) + np.testing.assert_array_equal(multi_signals.domain, self._domain_2) + np.testing.assert_array_equal(multi_signals.range, self._range_2) - multi_signal = MultiSignal(multi_signal) - np.testing.assert_array_equal(multi_signal.domain, self._domain_2) - np.testing.assert_array_equal(multi_signal.range, self._range_2) + multi_signals = MultiSignals(multi_signals) + np.testing.assert_array_equal(multi_signals.domain, self._domain_2) + np.testing.assert_array_equal(multi_signals.range, self._range_2) class NotSignal(Signal): """ @@ -293,34 +327,42 @@ class NotSignal(Signal): pass - multi_signal = MultiSignal(self._range_1, signal_type=NotSignal) - self.assertIsInstance(multi_signal.signals[0], NotSignal) - np.testing.assert_array_equal(multi_signal.domain, self._domain_1) - np.testing.assert_array_equal(multi_signal.range, + multi_signals = MultiSignals(self._range_1, signal_type=NotSignal) + self.assertIsInstance(multi_signals.signals[0], NotSignal) + np.testing.assert_array_equal(multi_signals.domain, self._domain_1) + np.testing.assert_array_equal(multi_signals.range, self._range_1[:, np.newaxis]) if is_pandas_installed(): from pandas import DataFrame, Series - multi_signal = MultiSignal( + multi_signals = MultiSignals( Series(dict(zip(self._domain_2, self._range_1)))) - np.testing.assert_array_equal(multi_signal.domain, self._domain_2) - np.testing.assert_array_equal(multi_signal.range, + np.testing.assert_array_equal(multi_signals.domain, self._domain_2) + np.testing.assert_array_equal(multi_signals.range, self._range_1[:, np.newaxis]) data = dict(zip(['a', 'b', 'c'], tsplit(self._range_2))) - multi_signal = MultiSignal(DataFrame(data, self._domain_2)) - np.testing.assert_array_equal(multi_signal.domain, self._domain_2) - np.testing.assert_array_equal(multi_signal.range, self._range_2) + multi_signals = MultiSignals(DataFrame(data, self._domain_2)) + np.testing.assert_array_equal(multi_signals.domain, self._domain_2) + np.testing.assert_array_equal(multi_signals.range, self._range_2) + + def test__hash__(self): + """ + Tests :func:`colour.continuous.multi_signals.MultiSignals.__hash__` + method. + """ + + self.assertIsInstance(hash(self._multi_signals), int) def test__str__(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.__str__` + Tests :func:`colour.continuous.multi_signals.MultiSignals.__str__` method. """ self.assertEqual( - str(self._multi_signal), + str(self._multi_signals), textwrap.dedent(""" [[ 0. 10. 20. 30.] [ 1. 20. 30. 40.] @@ -333,49 +375,53 @@ def test__str__(self): [ 8. 90. 100. 110.] [ 9. 100. 110. 120.]]""")[1:]) + self.assertIsInstance(str(MultiSignals()), string_types) + def test__repr__(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.__repr__` + Tests :func:`colour.continuous.multi_signals.MultiSignals.__repr__` method. """ self.assertEqual( re.sub(r'extrapolator_args={.*}', 'extrapolator_args={...}', - repr(self._multi_signal)), + repr(self._multi_signals)), textwrap.dedent(""" - MultiSignal([[ 0., 10., 20., 30.], - [ 1., 20., 30., 40.], - [ 2., 30., 40., 50.], - [ 3., 40., 50., 60.], - [ 4., 50., 60., 70.], - [ 5., 60., 70., 80.], - [ 6., 70., 80., 90.], - [ 7., 80., 90., 100.], - [ 8., 90., 100., 110.], - [ 9., 100., 110., 120.]], - labels=[0, 1, 2], - interpolator=KernelInterpolator, - interpolator_args={}, - extrapolator=Extrapolator, - extrapolator_args={...})""")[1:]) + MultiSignals([[ 0., 10., 20., 30.], + [ 1., 20., 30., 40.], + [ 2., 30., 40., 50.], + [ 3., 40., 50., 60.], + [ 4., 50., 60., 70.], + [ 5., 60., 70., 80.], + [ 6., 70., 80., 90.], + [ 7., 80., 90., 100.], + [ 8., 90., 100., 110.], + [ 9., 100., 110., 120.]], + labels=[0, 1, 2], + interpolator=KernelInterpolator, + interpolator_args={}, + extrapolator=Extrapolator, + extrapolator_args={...})""")[1:]) + + self.assertIsInstance(repr(MultiSignals()), string_types) def test__getitem__(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.__getitem__` + Tests :func:`colour.continuous.multi_signals.MultiSignals.__getitem__` method. """ np.testing.assert_almost_equal( - self._multi_signal[0], np.array([10.0, 20.0, 30.0]), decimal=7) + self._multi_signals[0], np.array([10.0, 20.0, 30.0]), decimal=7) np.testing.assert_almost_equal( - self._multi_signal[np.array([0, 1, 2])], + self._multi_signals[np.array([0, 1, 2])], np.array([[10.0, 20.0, 30.0], [20.0, 30.0, 40.0], [30.0, 40.0, 50.0]]), decimal=7) np.testing.assert_almost_equal( - self._multi_signal[np.linspace(0, 5, 5)], + self._multi_signals[np.linspace(0, 5, 5)], np.array([[10.00000000, 20.00000000, 30.00000000], [22.83489024, 32.80460562, 42.77432100], [34.80044921, 44.74343470, @@ -383,62 +429,70 @@ def test__getitem__(self): [60.00000000, 70.00000000, 80.00000000]]), decimal=7) - assert np.all(np.isnan(self._multi_signal[np.array([-1000, 1000])])) + assert np.all(np.isnan(self._multi_signals[np.array([-1000, 1000])])) - multi_signal = self._multi_signal.copy() - multi_signal.extrapolator_args = { + multi_signals = self._multi_signals.copy() + multi_signals.extrapolator_args = { 'method': 'Linear', } np.testing.assert_array_equal( - multi_signal[np.array([-1000, 1000])], + multi_signals[np.array([-1000, 1000])], np.array([[-9990.0, -9980.0, -9970.0], [10010.0, 10020.0, 10030.0]])) - multi_signal.extrapolator_args = { + multi_signals.extrapolator_args = { 'method': 'Constant', 'left': 0, 'right': 1 } np.testing.assert_array_equal( - multi_signal[np.array([-1000, 1000])], + multi_signals[np.array([-1000, 1000])], np.array([[0.0, 0.0, 0.0], [1.0, 1.0, 1.0]])) + def test_raise_exception__getitem__(self): + """ + Tests :func:`colour.continuous.multi_signals.MultiSignals.__getitem__` + method raised exception. + """ + + self.assertRaises(RuntimeError, operator.getitem, MultiSignals(), 0) + def test__setitem__(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.__setitem__` + Tests :func:`colour.continuous.multi_signals.MultiSignals.__setitem__` method. """ - multi_signal = self._multi_signal.copy() + multi_signals = self._multi_signals.copy() - multi_signal[0] = 20 + multi_signals[0] = 20 np.testing.assert_almost_equal( - multi_signal[0], np.array([20.0, 20.0, 20.0]), decimal=7) + multi_signals[0], np.array([20.0, 20.0, 20.0]), decimal=7) - multi_signal[np.array([0, 1, 2])] = 30 + multi_signals[np.array([0, 1, 2])] = 30 np.testing.assert_almost_equal( - multi_signal[np.array([0, 1, 2])], + multi_signals[np.array([0, 1, 2])], np.array([[30.0, 30.0, 30.0], [30.0, 30.0, 30.0], [30.0, 30.0, 30.0]]), decimal=7) - multi_signal[0:3] = 40 + multi_signals[0:3] = 40 np.testing.assert_almost_equal( - multi_signal[0:3], + multi_signals[0:3], np.array([[40.0, 40.0, 40.0], [40.0, 40.0, 40.0], [40.0, 40.0, 40.0]]), decimal=7) - multi_signal[np.linspace(0, 5, 5)] = 50 + multi_signals[np.linspace(0, 5, 5)] = 50 np.testing.assert_almost_equal( - multi_signal.domain, + multi_signals.domain, np.array([ 0.00, 1.00, 1.25, 2.00, 2.50, 3.00, 3.75, 4.00, 5.00, 6.00, 7.00, 8.00, 9.00 ]), decimal=7) np.testing.assert_almost_equal( - multi_signal.range, + multi_signals.range, np.array([ [50.0, 50.0, 50.0], [40.0, 40.0, 40.0], @@ -456,9 +510,9 @@ def test__setitem__(self): ]), decimal=7) - multi_signal[np.array([0, 1, 2])] = np.array([10, 20, 30]) + multi_signals[np.array([0, 1, 2])] = np.array([10, 20, 30]) np.testing.assert_almost_equal( - multi_signal.range, + multi_signals.range, np.array([ [10.0, 20.0, 30.0], [10.0, 20.0, 30.0], @@ -476,9 +530,9 @@ def test__setitem__(self): ]), decimal=7) - multi_signal[np.array([0, 1, 2])] = np.arange(1, 10, 1).reshape(3, 3) + multi_signals[np.array([0, 1, 2])] = np.arange(1, 10, 1).reshape(3, 3) np.testing.assert_almost_equal( - multi_signal.range, + multi_signals.range, np.array([ [1.0, 2.0, 3.0], [4.0, 5.0, 6.0], @@ -498,57 +552,67 @@ def test__setitem__(self): def test__contains__(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.__contains__` + Tests :func:`colour.continuous.multi_signals.MultiSignals.__contains__` method. """ - self.assertIn(0, self._multi_signal) - self.assertIn(0.5, self._multi_signal) - self.assertNotIn(1000, self._multi_signal) + self.assertIn(0, self._multi_signals) + self.assertIn(0.5, self._multi_signals) + self.assertNotIn(1000, self._multi_signals) + + def test_raise_exception__contains__(self): + """ + Tests :func:`colour.continuous.multi_signals.MultiSignals.__contains__` + method raised exception. + """ + + self.assertRaises(RuntimeError, operator.contains, MultiSignals(), 0) def test__len__(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.__len__` + Tests :func:`colour.continuous.multi_signals.MultiSignals.__len__` method. """ - self.assertEqual(len(self._multi_signal), 10) + self.assertEqual(len(self._multi_signals), 10) def test__eq__(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.__eq__` method. + Tests :func:`colour.continuous.multi_signals.MultiSignals.__eq__` + method. """ - signal_1 = self._multi_signal.copy() - signal_2 = self._multi_signal.copy() + signal_1 = self._multi_signals.copy() + signal_2 = self._multi_signals.copy() self.assertEqual(signal_1, signal_2) def test__ne__(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.__ne__` method. + Tests :func:`colour.continuous.multi_signals.MultiSignals.__ne__` + method. """ - multi_signal_1 = self._multi_signal.copy() - multi_signal_2 = self._multi_signal.copy() + multi_signals_1 = self._multi_signals.copy() + multi_signals_2 = self._multi_signals.copy() - multi_signal_2[0] = 20 - self.assertNotEqual(multi_signal_1, multi_signal_2) + multi_signals_2[0] = 20 + self.assertNotEqual(multi_signals_1, multi_signals_2) - multi_signal_2[0] = np.array([10, 20, 30]) - self.assertEqual(multi_signal_1, multi_signal_2) + multi_signals_2[0] = np.array([10, 20, 30]) + self.assertEqual(multi_signals_1, multi_signals_2) - multi_signal_2.interpolator = CubicSplineInterpolator - self.assertNotEqual(multi_signal_1, multi_signal_2) + multi_signals_2.interpolator = CubicSplineInterpolator + self.assertNotEqual(multi_signals_1, multi_signals_2) - multi_signal_2.interpolator = KernelInterpolator - self.assertEqual(multi_signal_1, multi_signal_2) + multi_signals_2.interpolator = KernelInterpolator + self.assertEqual(multi_signals_1, multi_signals_2) - multi_signal_2.interpolator_args = {'window': 1} - self.assertNotEqual(multi_signal_1, multi_signal_2) + multi_signals_2.interpolator_args = {'window': 1} + self.assertNotEqual(multi_signals_1, multi_signals_2) - multi_signal_2.interpolator_args = {} - self.assertEqual(multi_signal_1, multi_signal_2) + multi_signals_2.interpolator_args = {} + self.assertEqual(multi_signals_1, multi_signals_2) class NotExtrapolator(Extrapolator): """ @@ -557,146 +621,161 @@ class NotExtrapolator(Extrapolator): pass - multi_signal_2.extrapolator = NotExtrapolator - self.assertNotEqual(multi_signal_1, multi_signal_2) + multi_signals_2.extrapolator = NotExtrapolator + self.assertNotEqual(multi_signals_1, multi_signals_2) - multi_signal_2.extrapolator = Extrapolator - self.assertEqual(multi_signal_1, multi_signal_2) + multi_signals_2.extrapolator = Extrapolator + self.assertEqual(multi_signals_1, multi_signals_2) - multi_signal_2.extrapolator_args = {} - self.assertNotEqual(multi_signal_1, multi_signal_2) + multi_signals_2.extrapolator_args = {} + self.assertNotEqual(multi_signals_1, multi_signals_2) - multi_signal_2.extrapolator_args = { + multi_signals_2.extrapolator_args = { 'method': 'Constant', 'left': np.nan, 'right': np.nan } - self.assertEqual(multi_signal_1, multi_signal_2) + self.assertEqual(multi_signals_1, multi_signals_2) def test_arithmetical_operation(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.\ + Tests :func:`colour.continuous.multi_signals.MultiSignals.\ arithmetical_operation` method. """ np.testing.assert_almost_equal( - self._multi_signal.arithmetical_operation(10, '+', False).range, + self._multi_signals.arithmetical_operation(10, '+', False).range, self._range_2 + 10, decimal=7) np.testing.assert_almost_equal( - self._multi_signal.arithmetical_operation(10, '-', False).range, + self._multi_signals.arithmetical_operation(10, '-', False).range, self._range_2 - 10, decimal=7) np.testing.assert_almost_equal( - self._multi_signal.arithmetical_operation(10, '*', False).range, + self._multi_signals.arithmetical_operation(10, '*', False).range, self._range_2 * 10, decimal=7) np.testing.assert_almost_equal( - self._multi_signal.arithmetical_operation(10, '/', False).range, + self._multi_signals.arithmetical_operation(10, '/', False).range, self._range_2 / 10, decimal=7) np.testing.assert_almost_equal( - self._multi_signal.arithmetical_operation(10, '**', False).range, + self._multi_signals.arithmetical_operation(10, '**', False).range, self._range_2 ** 10, decimal=7) - multi_signal = self._multi_signal.copy() + np.testing.assert_almost_equal( + (self._multi_signals + 10).range, self._range_2 + 10, decimal=7) + + np.testing.assert_almost_equal( + (self._multi_signals - 10).range, self._range_2 - 10, decimal=7) + + np.testing.assert_almost_equal( + (self._multi_signals * 10).range, self._range_2 * 10, decimal=7) + + np.testing.assert_almost_equal( + (self._multi_signals / 10).range, self._range_2 / 10, decimal=7) + + np.testing.assert_almost_equal( + (self._multi_signals ** 10).range, self._range_2 ** 10, decimal=7) + + multi_signals = self._multi_signals.copy() np.testing.assert_almost_equal( - multi_signal.arithmetical_operation(10, '+', True).range, + multi_signals.arithmetical_operation(10, '+', True).range, self._range_2 + 10, decimal=7) np.testing.assert_almost_equal( - multi_signal.arithmetical_operation(10, '-', True).range, + multi_signals.arithmetical_operation(10, '-', True).range, self._range_2, decimal=7) np.testing.assert_almost_equal( - multi_signal.arithmetical_operation(10, '*', True).range, + multi_signals.arithmetical_operation(10, '*', True).range, self._range_2 * 10, decimal=7) np.testing.assert_almost_equal( - multi_signal.arithmetical_operation(10, '/', True).range, + multi_signals.arithmetical_operation(10, '/', True).range, self._range_2, decimal=7) np.testing.assert_almost_equal( - multi_signal.arithmetical_operation(10, '**', True).range, + multi_signals.arithmetical_operation(10, '**', True).range, self._range_2 ** 10, decimal=7) - multi_signal = self._multi_signal.copy() + multi_signals = self._multi_signals.copy() np.testing.assert_almost_equal( - multi_signal.arithmetical_operation(self._range_2, '+', - False).range, + multi_signals.arithmetical_operation(self._range_2, '+', + False).range, self._range_2 + self._range_2, decimal=7) np.testing.assert_almost_equal( - multi_signal.arithmetical_operation(multi_signal, '+', - False).range, + multi_signals.arithmetical_operation(multi_signals, '+', + False).range, self._range_2 + self._range_2, decimal=7) def test_is_uniform(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.is_uniform` + Tests :func:`colour.continuous.multi_signals.MultiSignals.is_uniform` method. """ - self.assertTrue(self._multi_signal.is_uniform()) + self.assertTrue(self._multi_signals.is_uniform()) - multi_signal = self._multi_signal.copy() - multi_signal[0.5] = 1.0 - self.assertFalse(multi_signal.is_uniform()) + multi_signals = self._multi_signals.copy() + multi_signals[0.5] = 1.0 + self.assertFalse(multi_signals.is_uniform()) def test_copy(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.copy` method. + Tests :func:`colour.continuous.multi_signals.MultiSignals.copy` method. """ - self.assertIsNot(self._multi_signal, self._multi_signal.copy()) - self.assertEqual(self._multi_signal, self._multi_signal.copy()) + self.assertIsNot(self._multi_signals, self._multi_signals.copy()) + self.assertEqual(self._multi_signals, self._multi_signals.copy()) - def test_multi_signal_unpack_data(self): + def test_multi_signals_unpack_data(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.\ -multi_signal_unpack_data` method. + Tests :func:`colour.continuous.multi_signals.MultiSignals.\ +multi_signals_unpack_data` method. """ - signals = MultiSignal.multi_signal_unpack_data(self._range_1) + signals = MultiSignals.multi_signals_unpack_data(self._range_1) self.assertListEqual(list(signals.keys()), [0]) np.testing.assert_array_equal(signals[0].domain, self._domain_1) np.testing.assert_array_equal(signals[0].range, self._range_1) - signals = MultiSignal.multi_signal_unpack_data(self._range_1, - self._domain_2) + signals = MultiSignals.multi_signals_unpack_data( + self._range_1, self._domain_2) self.assertListEqual(list(signals.keys()), [0]) np.testing.assert_array_equal(signals[0].domain, self._domain_2) np.testing.assert_array_equal(signals[0].range, self._range_1) - signals = MultiSignal.multi_signal_unpack_data(self._range_2, - self._domain_2) + signals = MultiSignals.multi_signals_unpack_data( + self._range_2, self._domain_2) self.assertListEqual(list(signals.keys()), [0, 1, 2]) np.testing.assert_array_equal(signals[0].range, self._range_1) np.testing.assert_array_equal(signals[1].range, self._range_1 + 10) np.testing.assert_array_equal(signals[2].range, self._range_1 + 20) - signals = MultiSignal.multi_signal_unpack_data( + signals = MultiSignals.multi_signals_unpack_data( dict(zip(self._domain_2, self._range_2))) self.assertListEqual(list(signals.keys()), [0, 1, 2]) np.testing.assert_array_equal(signals[0].range, self._range_1) np.testing.assert_array_equal(signals[1].range, self._range_1 + 10) np.testing.assert_array_equal(signals[2].range, self._range_1 + 20) - signals = MultiSignal.multi_signal_unpack_data( - MultiSignal.multi_signal_unpack_data( + signals = MultiSignals.multi_signals_unpack_data( + MultiSignals.multi_signals_unpack_data( dict(zip(self._domain_2, self._range_2)))) self.assertListEqual(list(signals.keys()), [0, 1, 2]) np.testing.assert_array_equal(signals[0].range, self._range_1) @@ -706,14 +785,14 @@ def test_multi_signal_unpack_data(self): if is_pandas_installed(): from pandas import DataFrame, Series - signals = MultiSignal.multi_signal_unpack_data( + signals = MultiSignals.multi_signals_unpack_data( Series(dict(zip(self._domain_1, self._range_1)))) self.assertListEqual(list(signals.keys()), [0]) np.testing.assert_array_equal(signals[0].domain, self._domain_1) np.testing.assert_array_equal(signals[0].range, self._range_1) data = dict(zip(['a', 'b', 'c'], tsplit(self._range_2))) - signals = MultiSignal.multi_signal_unpack_data( + signals = MultiSignals.multi_signals_unpack_data( DataFrame(data, self._domain_1)) self.assertListEqual(list(signals.keys()), ['a', 'b', 'c']) np.testing.assert_array_equal(signals['a'].range, self._range_1) @@ -724,16 +803,16 @@ def test_multi_signal_unpack_data(self): def test_fill_nan(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.fill_nan` + Tests :func:`colour.continuous.multi_signals.MultiSignals.fill_nan` method. """ - multi_signal = self._multi_signal.copy() + multi_signals = self._multi_signals.copy() - multi_signal[3:7] = np.nan + multi_signals[3:7] = np.nan np.testing.assert_almost_equal( - multi_signal.fill_nan().range, + multi_signals.fill_nan().range, np.array([[10.0, 20.0, 30.0], [20.0, 30.0, 40.0], [ 30.0, 40.0, 50.0 ], [40.0, 50.0, 60.0], [50.0, 60.0, 70.0], [60.0, 70.0, 80.0], @@ -741,10 +820,10 @@ def test_fill_nan(self): [90.0, 100.0, 110.0], [100.0, 110.0, 120.0]]), decimal=7) - multi_signal[3:7] = np.nan + multi_signals[3:7] = np.nan np.testing.assert_almost_equal( - multi_signal.fill_nan(method='Constant').range, + multi_signals.fill_nan(method='Constant').range, np.array([[10.0, 20.0, 30.0], [20.0, 30.0, 40.0], [30.0, 40.0, 50.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [80.0, 90.0, 100.0], @@ -753,21 +832,21 @@ def test_fill_nan(self): def test_domain_distance(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.\ + Tests :func:`colour.continuous.multi_signals.MultiSignals.\ domain_distance` method. """ self.assertAlmostEqual( - self._multi_signal.domain_distance(0.5), 0.5, places=7) + self._multi_signals.domain_distance(0.5), 0.5, places=7) np.testing.assert_almost_equal( - self._multi_signal.domain_distance(np.linspace(0, 9, 10) + 0.5), + self._multi_signals.domain_distance(np.linspace(0, 9, 10) + 0.5), np.array([0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5]), decimal=7) def test_to_dataframe(self): """ - Tests :func:`colour.continuous.multi_signal.MultiSignal.to_dataframe` + Tests :func:`colour.continuous.multi_signals.MultiSignals.to_dataframe` method. """ @@ -775,7 +854,7 @@ def test_to_dataframe(self): from pandas import DataFrame data = dict(zip(['a', 'b', 'c'], tsplit(self._range_2))) - assert MultiSignal( + assert MultiSignals( self._range_2, self._domain_2, labels=['a', 'b', 'c']).to_dataframe().equals( DataFrame(data, self._domain_2)) diff --git a/colour/continuous/tests/test_signal.py b/colour/continuous/tests/test_signal.py index 74a04a1766..0ac1ee6a20 100644 --- a/colour/continuous/tests/test_signal.py +++ b/colour/continuous/tests/test_signal.py @@ -9,9 +9,11 @@ import unittest import re import textwrap +from six import string_types from colour.algebra import (CubicSplineInterpolator, Extrapolator, KernelInterpolator) +from colour.constants import DEFAULT_FLOAT_DTYPE from colour.continuous import Signal from colour.utilities import is_pandas_installed @@ -65,6 +67,17 @@ def test_required_methods(self): for method in required_methods: self.assertIn(method, dir(Signal)) + def test_dtype(self): + """ + Tests :func:`colour.continuous.signal.Signal.dtype` property. + """ + + self.assertEqual(self._signal.dtype, None) + + signal = self._signal.copy() + signal.dtype = DEFAULT_FLOAT_DTYPE + self.assertEqual(signal.dtype, DEFAULT_FLOAT_DTYPE) + def test_domain(self): """ Tests :func:`colour.continuous.signal.Signal.domain` property. @@ -86,6 +99,11 @@ def test_domain(self): np.array([10.0, 20.0, 30.0]), decimal=7) + # TODO: Use "assertWarns" when dropping Python 2.7. + domain = np.linspace(0, 1, 10) + domain[0] = -np.inf + signal.domain = domain + def test_range(self): """ Tests :func:`colour.continuous.signal.Signal.range` property. @@ -185,6 +203,14 @@ def test_function(self): assert hasattr(self._signal.function, '__call__') + def test_raise_exception_function(self): + """ + Tests :func:`colour.continuous.signal.Signal.function` property raised + exception. + """ + + self.assertRaises(RuntimeError, Signal().function, 0) + def test__init__(self): """ Tests :func:`colour.continuous.signal.Signal.__init__` method. @@ -213,6 +239,13 @@ def test__init__(self): np.testing.assert_array_equal(signal.domain, self._domain) np.testing.assert_array_equal(signal.range, self._range) + def test__hash__(self): + """ + Tests :func:`colour.continuous.signal.Signal.__hash__` method. + """ + + self.assertIsInstance(hash(self._signal), int) + def test__str__(self): """ Tests :func:`colour.continuous.signal.Signal.__str__` method. @@ -232,6 +265,8 @@ def test__str__(self): [ 8. 90.] [ 9. 100.]]""")[1:]) + self.assertIsInstance(str(Signal()), string_types) + def test__repr__(self): """ Tests :func:`colour.continuous.signal.Signal.__repr__` method. @@ -256,6 +291,8 @@ def test__repr__(self): extrapolator=Extrapolator, extrapolator_args={...})""")[1:]) + self.assertIsInstance(repr(Signal()), string_types) + def test__getitem__(self): """ Tests :func:`colour.continuous.signal.Signal.__getitem__` method. @@ -450,6 +487,21 @@ def test_arithmetical_operation(self): self._range ** 10, decimal=7) + np.testing.assert_almost_equal( + (self._signal + 10).range, self._range + 10, decimal=7) + + np.testing.assert_almost_equal( + (self._signal - 10).range, self._range - 10, decimal=7) + + np.testing.assert_almost_equal( + (self._signal * 10).range, self._range * 10, decimal=7) + + np.testing.assert_almost_equal( + (self._signal / 10).range, self._range / 10, decimal=7) + + np.testing.assert_almost_equal( + (self._signal ** 10).range, self._range ** 10, decimal=7) + signal = self._signal.copy() np.testing.assert_almost_equal( diff --git a/colour/corresponding/__init__.py b/colour/corresponding/__init__.py index 5690d2cdc5..de963906a5 100644 --- a/colour/corresponding/__init__.py +++ b/colour/corresponding/__init__.py @@ -2,9 +2,11 @@ from __future__ import absolute_import -from .dataset import * # noqa -from . import dataset -from .prediction import (corresponding_chromaticities_prediction_CIE1994, +from .datasets import * # noqa +from . import datasets +from .prediction import (CorrespondingColourDataset, + CorrespondingChromaticitiesPrediction, + corresponding_chromaticities_prediction_CIE1994, corresponding_chromaticities_prediction_CMCCAT2000, corresponding_chromaticities_prediction_Fairchild1990, corresponding_chromaticities_prediction_VonKries, @@ -12,8 +14,9 @@ corresponding_chromaticities_prediction) __all__ = [] -__all__ += dataset.__all__ +__all__ += datasets.__all__ __all__ += [ + 'CorrespondingColourDataset', 'CorrespondingChromaticitiesPrediction', 'corresponding_chromaticities_prediction_CIE1994', 'corresponding_chromaticities_prediction_CMCCAT2000', 'corresponding_chromaticities_prediction_Fairchild1990', diff --git a/colour/corresponding/dataset/__init__.py b/colour/corresponding/datasets/__init__.py similarity index 55% rename from colour/corresponding/dataset/__init__.py rename to colour/corresponding/datasets/__init__.py index 2f016cb811..29b1d5fccc 100644 --- a/colour/corresponding/dataset/__init__.py +++ b/colour/corresponding/datasets/__init__.py @@ -2,8 +2,8 @@ from __future__ import absolute_import -from .corresponding_chromaticities import ( - BRENEMAN_EXPERIMENTS, BRENEMAN_EXPERIMENTS_PRIMARIES_CHROMATICITIES) +from .breneman1987 import (BRENEMAN_EXPERIMENTS, + BRENEMAN_EXPERIMENTS_PRIMARIES_CHROMATICITIES) __all__ = [ 'BRENEMAN_EXPERIMENTS', 'BRENEMAN_EXPERIMENTS_PRIMARIES_CHROMATICITIES' diff --git a/colour/corresponding/dataset/corresponding_chromaticities.py b/colour/corresponding/datasets/breneman1987.py similarity index 96% rename from colour/corresponding/dataset/corresponding_chromaticities.py rename to colour/corresponding/datasets/breneman1987.py index e1b510ed94..1a6adeb5c3 100644 --- a/colour/corresponding/dataset/corresponding_chromaticities.py +++ b/colour/corresponding/datasets/breneman1987.py @@ -48,7 +48,7 @@ class BrenemanExperimentResult( namedtuple('BrenemanExperimentResult', - ('name', 'uvp_t', 'uvp_m', 's_uvp', 'd_uvp_i', 'd_uvp_g'))): + ('name', 'uv_t', 'uv_m', 's_uv', 'd_uv_i', 'd_uv_g'))): """ Experiment result. @@ -56,36 +56,30 @@ class BrenemanExperimentResult( ---------- name : unicode Test colour name. - uvp_t : numeric + uv_t : numeric Chromaticity coordinates :math:`uv_t^p` of test colour. - uvp_m : array_like, (2,) + uv_m : array_like, (2,) Chromaticity coordinates :math:`uv_m^p` of matching colour. - s_uvp : array_like, (2,), optional + s_uv : array_like, (2,), optional Interobserver variation (:math:`x10^3`) :math:`\\sigma_uv^p`. - d_uvp_i : array_like, (2,), optional + d_uv_i : array_like, (2,), optional Deviation of individual linear transformation (:math:`x10^3`) :math:`\\delta_uv_i^p`. - d_uvp_g : array_like, (2,), optional + d_uv_g : array_like, (2,), optional Deviation of individual linear transformation (:math:`x10^3`) :math:`\\delta_uv_g^p`. """ - def __new__(cls, - name, - uvp_t, - uvp_m, - s_uvp=None, - d_uvp_i=None, - d_uvp_g=None): + def __new__(cls, name, uv_t, uv_m, s_uv=None, d_uv_i=None, d_uv_g=None): """ Returns a new instance of the - :class:`colour.corresponding.dataset.corresponding_chromaticities.\ + :class:`colour.corresponding.datasets.corresponding_chromaticities.\ BrenemanExperimentResult` class. """ return super(BrenemanExperimentResult, cls).__new__( - cls, name, np.array(uvp_t), np.array(uvp_m), np.array(s_uvp), - np.array(d_uvp_i), np.array(d_uvp_g)) + cls, name, np.array(uv_t), np.array(uv_m), np.array(s_uv), + np.array(d_uv_i), np.array(d_uv_g)) class PrimariesChromaticityCoordinates( @@ -112,21 +106,21 @@ class PrimariesChromaticityCoordinates( """ def __new__(cls, - name, - uvp_t, - uvp_m, - s_uvp=None, - d_uvp_i=None, - d_uvp_g=None): + experiment, + illuminants, + Y, + P_uvp=None, + D_uvp=None, + T_uvp=None): """ Returns a new instance of the - :class:`colour.corresponding.dataset.corresponding_chromaticities.\ + :class:`colour.corresponding.datasets.corresponding_chromaticities.\ PrimariesChromaticityCoordinates` class. """ return super(PrimariesChromaticityCoordinates, cls).__new__( - cls, name, np.array(uvp_t), np.array(uvp_m), np.array(s_uvp), - np.array(d_uvp_i), np.array(d_uvp_g)) + cls, experiment, np.array(illuminants), np.array(Y), + np.array(P_uvp), np.array(D_uvp), np.array(T_uvp)) # yapf: disable diff --git a/colour/corresponding/prediction.py b/colour/corresponding/prediction.py index 22a6d35355..15dfa5f1c2 100644 --- a/colour/corresponding/prediction.py +++ b/colour/corresponding/prediction.py @@ -31,6 +31,9 @@ - :cite:`Li2002a` : Li, C., Luo, M. R., Rigg, B., & Hunt, R. W. G. (2002). CMC 2000 chromatic adaptation transform: CMCCAT2000. Color Research & Application, 27(1), 49-58. doi:10.1002/col.10005 +- :cite:`Luo1999` : Luo, M. R., & Rhodes, P. A. (1999). Corresponding-colour + datasets. Color Research & Application, 24(4), 295-296. + doi:10.1002/(SICI)1520-6378(199908)24:4<295::AID-COL10>3.0.CO;2-K - :cite:`Westland2012k` : Westland, S., Ripamonti, C., & Cheung, V. (2012). CMCCAT2000. In Computational Colour Science Using MATLAB (2nd ed., pp. 83-86). ISBN:978-0-470-66569-5 @@ -38,6 +41,7 @@ from __future__ import division, unicode_literals +import numpy as np from collections import namedtuple from colour.adaptation import ( @@ -46,9 +50,9 @@ from colour.corresponding import ( BRENEMAN_EXPERIMENTS, BRENEMAN_EXPERIMENTS_PRIMARIES_CHROMATICITIES) from colour.models import (Luv_to_uv, Luv_uv_to_xy, XYZ_to_Luv, XYZ_to_xy, - xy_to_XYZ) + xy_to_XYZ, xyY_to_XYZ) from colour.utilities import (CaseInsensitiveMapping, domain_range_scale, - filter_kwargs) + filter_kwargs, is_numeric) __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -58,7 +62,8 @@ __status__ = 'Production' __all__ = [ - 'CorrespondingChromaticitiesPrediction', + 'CorrespondingColourDataset', 'CorrespondingChromaticitiesPrediction', + 'convert_experiment_results_Breneman1987', 'corresponding_chromaticities_prediction_Fairchild1990', 'corresponding_chromaticities_prediction_CIE1994', 'corresponding_chromaticities_prediction_CMCCAT2000', @@ -68,9 +73,53 @@ ] +class CorrespondingColourDataset( + namedtuple('CorrespondingColourDataset', + ('name', 'XYZ_r', 'XYZ_t', 'XYZ_cr', 'XYZ_ct', 'Y_r', 'Y_t', + 'B_r', 'B_t', 'metadata'))): + """ + Defines a corresponding colour dataset. + + Parameters + ---------- + name : unicode + Corresponding colour dataset name. + XYZ_r : array_like + *CIE XYZ* tristimulus values of the reference illuminant. + XYZ_t : array_like + *CIE XYZ* tristimulus values of the test illuminant. + XYZ_cr : array_like + Corresponding *CIE XYZ* tristimulus values under the reference + illuminant. + XYZ_ct : array_like + Corresponding *CIE XYZ* tristimulus values under the test illuminant. + Y_r : numeric + Reference white luminance :math:`Y_r` in :math:`cd/m^2`. + Y_t : numeric + Test white luminance :math:`Y_t` in :math:`cd/m^2`. + B_r : numeric + Luminance factor :math:`B_r` of reference achromatic background as + percentage. + B_t : numeric + Luminance factor :math:`B_t` of test achromatic background as + percentage. + metadata : dict + Dataset metadata. + + Notes + ----- + - This class is compatible with *Luo and Rhodes (1999)* + *Corresponding-Colour Datasets* datasets. + + References + ---------- + :cite:`Luo1999` + """ + + class CorrespondingChromaticitiesPrediction( namedtuple('CorrespondingChromaticitiesPrediction', - ('name', 'uvp_t', 'uvp_m', 'uvp_p'))): + ('name', 'uv_t', 'uv_m', 'uv_p'))): """ Defines a chromatic adaptation model prediction. @@ -78,15 +127,119 @@ class CorrespondingChromaticitiesPrediction( ---------- name : unicode Test colour name. - uvp_t : numeric + uv_t : array_like, (2,) Chromaticity coordinates :math:`uv_t^p` of test colour. - uvp_m : array_like, (2,) + uv_m : array_like, (2,) Chromaticity coordinates :math:`uv_m^p` of matching colour. - uvp_p : array_like, (2,) + uv_p : array_like, (2,) Chromaticity coordinates :math:`uv_p^p` of predicted colour. """ +def convert_experiment_results_Breneman1987(experiment): + """ + Converts *Breneman (1987)* experiment results to a + :class:`colour.CorrespondingColourDataset` class instance. + + Parameters + ---------- + experiment : integer + {1, 2, 3, 4, 6, 8, 9, 11, 12} + *Breneman (1987)* experiment number. + + Returns + ------- + CorrespondingColourDataset + :class:`colour.CorrespondingColourDataset` class instance. + + Examples + -------- + >>> from pprint import pprint + >>> pprint(tuple(convert_experiment_results_Breneman1987(2))) + ... # doctest: +ELLIPSIS + (2, + array([ 0.9582463..., 1. , 0.9436325...]), + array([ 0.9587332..., 1. , 0.4385796...]), + array([[ 388.125 , 405. , 345.625 ], + [ 266.8957925..., 135. , 28.5983365...], + [ 474.5717821..., 405. , 222.75 ...], + [ 538.3899082..., 405. , 24.8944954...], + [ 178.7430167..., 135. , 19.6089385...], + [ 436.6749547..., 405. , 26.5483725...], + [ 124.7746282..., 135. , 36.1965613...], + [ 77.0794172..., 135. , 60.5850563...], + [ 279.9390889..., 405. , 455.8395127...], + [ 149.5808157..., 135. , 498.7046827...], + [ 372.1113689..., 405. , 669.9883990...], + [ 212.3638968..., 135. , 414.6704871...]]), + array([[ 400.1039651..., 405. , 191.7287234...], + [ 271.0384615..., 135. , 13.5 ...], + [ 495.4705323..., 405. , 119.7290874...], + [ 580.7967033..., 405. , 6.6758241...], + [ 190.1933701..., 135. , 7.4585635...], + [ 473.7184115..., 405. , 10.2346570...], + [ 135.4936014..., 135. , 20.2376599...], + [ 86.4689781..., 135. , 35.2281021...], + [ 283.5396281..., 405. , 258.1775929...], + [ 119.7044335..., 135. , 282.6354679...], + [ 359.9532224..., 405. , 381.0031185...], + [ 181.8271461..., 135. , 204.0661252...]]), + array(1500), + array(1500), + 0.3, + 0.3, + {}) + """ + + valid_experiment_results = (1, 2, 3, 4, 6, 8, 9, 11, 12) + assert experiment in valid_experiment_results, ( + '"Breneman (1987)" experiment result must be one of "{0}"!'.format( + valid_experiment_results)) + + samples_luminance = [ + 0.270, + 0.090, + 0.270, + 0.270, + 0.090, + 0.270, + 0.090, + 0.090, + 0.270, + 0.090, + 0.270, + 0.090, + ] + + experiment_results = list(BRENEMAN_EXPERIMENTS[experiment]) + illuminant_chromaticities = experiment_results.pop(0) + Y_r = Y_t = BRENEMAN_EXPERIMENTS_PRIMARIES_CHROMATICITIES[experiment].Y + B_r = B_t = 0.3 + + XYZ_t, XYZ_r = xy_to_XYZ( + np.hstack([ + Luv_uv_to_xy(illuminant_chromaticities[1:3]), + np.full([2, 1], Y_r) + ])) / Y_r + + xyY_cr, xyY_ct = [], [] + for i, experiment_result in enumerate(experiment_results): + xyY_cr.append( + np.hstack([ + Luv_uv_to_xy(experiment_result[2]), samples_luminance[i] * Y_r + ])) + xyY_ct.append( + np.hstack([ + Luv_uv_to_xy(experiment_result[1]), samples_luminance[i] * Y_t + ])) + + XYZ_cr = xyY_to_XYZ(xyY_cr) + XYZ_ct = xyY_to_XYZ(xyY_ct) + + return CorrespondingColourDataset(experiment, XYZ_r, XYZ_t, XYZ_cr, XYZ_ct, + Y_r, Y_t, B_r, B_t, {}) + + def corresponding_chromaticities_prediction_Fairchild1990(experiment=1): """ Returns the corresponding chromaticities prediction for *Fairchild (1990)* @@ -94,9 +247,10 @@ def corresponding_chromaticities_prediction_Fairchild1990(experiment=1): Parameters ---------- - experiment : integer, optional + experiment : integer or CorrespondingColourDataset, optional {1, 2, 3, 4, 6, 8, 9, 11, 12} - *Breneman (1987)* experiment number. + *Breneman (1987)* experiment number or + :class:`colour.CorrespondingColourDataset` class instance. Returns ------- @@ -111,42 +265,43 @@ def corresponding_chromaticities_prediction_Fairchild1990(experiment=1): -------- >>> from pprint import pprint >>> pr = corresponding_chromaticities_prediction_Fairchild1990(2) - >>> pr = [(p.uvp_m, p.uvp_p) for p in pr] - >>> pprint(pr) # doctest: +SKIP - [((0.207, 0.486), (0.2089528..., 0.4724034...)), - ((0.449, 0.511), (0.4375652..., 0.5121030...)), - ((0.263, 0.505), (0.2621362..., 0.4972538...)), - ((0.322, 0.545), (0.3235312..., 0.5475665...)), - ((0.316, 0.537), (0.3151390..., 0.5398333...)), - ((0.265, 0.553), (0.2634745..., 0.5544335...)), - ((0.221, 0.538), (0.2211595..., 0.5324470...)), - ((0.135, 0.532), (0.1396949..., 0.5207234...)), - ((0.145, 0.472), (0.1512288..., 0.4533041...)), - ((0.163, 0.331), (0.1715691..., 0.3026264...)), - ((0.176, 0.431), (0.1825792..., 0.4077892...)), - ((0.244, 0.349), (0.2418904..., 0.3413401...))] + >>> pr = [(p.uv_m, p.uv_p) for p in pr] + >>> pprint(pr) # doctest: +ELLIPSIS + [(array([ 0.207, 0.486]), array([ 0.2089528..., 0.4724034...])), + (array([ 0.449, 0.511]), array([ 0.4375652..., 0.5121030...])), + (array([ 0.263, 0.505]), array([ 0.2621362..., 0.4972538...])), + (array([ 0.322, 0.545]), array([ 0.3235312..., 0.5475665...])), + (array([ 0.316, 0.537]), array([ 0.3151391..., 0.5398333...])), + (array([ 0.265, 0.553]), array([ 0.2634745..., 0.5544335...])), + (array([ 0.221, 0.538]), array([ 0.2211595..., 0.5324470...])), + (array([ 0.135, 0.532]), array([ 0.1396949..., 0.5207234...])), + (array([ 0.145, 0.472]), array([ 0.1512288..., 0.4533041...])), + (array([ 0.163, 0.331]), array([ 0.1715691..., 0.3026264...])), + (array([ 0.176, 0.431]), array([ 0.1825792..., 0.4077892...])), + (array([ 0.244, 0.349]), array([ 0.2418905..., 0.3413401...]))] """ + experiment_results = (convert_experiment_results_Breneman1987(experiment) + if is_numeric(experiment) else experiment) + with domain_range_scale(1): - experiment_results = list(BRENEMAN_EXPERIMENTS[experiment]) + XYZ_t, XYZ_r = experiment_results.XYZ_t, experiment_results.XYZ_r + xy_t, xy_r = XYZ_to_xy([XYZ_t, XYZ_r]) - illuminants = experiment_results.pop(0) - XYZ_n = xy_to_XYZ(Luv_uv_to_xy(illuminants.uvp_t)) - XYZ_r = xy_to_XYZ(Luv_uv_to_xy(illuminants.uvp_m)) - xy_r = XYZ_to_xy(XYZ_r) - Y_n = BRENEMAN_EXPERIMENTS_PRIMARIES_CHROMATICITIES[experiment].Y + uv_t = Luv_to_uv(XYZ_to_Luv(experiment_results.XYZ_ct, xy_t), xy_t) + uv_m = Luv_to_uv(XYZ_to_Luv(experiment_results.XYZ_cr, xy_r), xy_r) - prediction = [] - for result in experiment_results: - XYZ_1 = xy_to_XYZ(Luv_uv_to_xy(result.uvp_t)) - XYZ_2 = chromatic_adaptation_Fairchild1990(XYZ_1, XYZ_n, XYZ_r, - Y_n) - uvp = Luv_to_uv(XYZ_to_Luv(XYZ_2, xy_r), xy_r) - prediction.append( - CorrespondingChromaticitiesPrediction( - result.name, result.uvp_t, result.uvp_m, uvp)) + Y_n = experiment_results.Y_t - return tuple(prediction) + XYZ_1 = experiment_results.XYZ_ct + XYZ_2 = chromatic_adaptation_Fairchild1990(XYZ_1, XYZ_t, XYZ_r, Y_n) + uv_p = Luv_to_uv(XYZ_to_Luv(XYZ_2, xy_r), xy_r) + + return tuple([ + CorrespondingChromaticitiesPrediction(experiment_results.name, + uv_t[i], uv_m[i], uv_p[i]) + for i in range(len(uv_t)) + ]) def corresponding_chromaticities_prediction_CIE1994(experiment=1): @@ -156,11 +311,10 @@ def corresponding_chromaticities_prediction_CIE1994(experiment=1): Parameters ---------- - experiment : integer, optional + experiment : integer or CorrespondingColourDataset, optional {1, 2, 3, 4, 6, 8, 9, 11, 12} - *Breneman (1987)* experiment number. - - Returns + *Breneman (1987)* experiment number or + :class:`colour.CorrespondingColourDataset` class instance. Returns ------- tuple Corresponding chromaticities prediction. @@ -173,45 +327,45 @@ def corresponding_chromaticities_prediction_CIE1994(experiment=1): -------- >>> from pprint import pprint >>> pr = corresponding_chromaticities_prediction_CIE1994(2) - >>> pr = [(p.uvp_m, p.uvp_p) for p in pr] - >>> pprint(pr) # doctest: +SKIP - [((0.207, 0.486), (0.2133909..., 0.4939794...)), - ((0.449, 0.511), (0.4450345..., 0.5120939...)), - ((0.263, 0.505), (0.2693262..., 0.5083212...)), - ((0.322, 0.545), (0.3308593..., 0.5443940...)), - ((0.316, 0.537), (0.3225195..., 0.5377826...)), - ((0.265, 0.553), (0.2709737..., 0.5513666...)), - ((0.221, 0.538), (0.2280786..., 0.5351592...)), - ((0.135, 0.532), (0.1439436..., 0.5303576...)), - ((0.145, 0.472), (0.1500743..., 0.4842895...)), - ((0.163, 0.331), (0.1559955..., 0.3772379...)), - ((0.176, 0.431), (0.1806318..., 0.4518475...)), - ((0.244, 0.349), (0.2454445..., 0.4018004...))] + >>> pr = [(p.uv_m, p.uv_p) for p in pr] + >>> pprint(pr) # doctest: +ELLIPSIS + [(array([ 0.207, 0.486]), array([ 0.2273130..., 0.5267609...])), + (array([ 0.449, 0.511]), array([ 0.4612181..., 0.5191849...])), + (array([ 0.263, 0.505]), array([ 0.2872404..., 0.5306938...])), + (array([ 0.322, 0.545]), array([ 0.3489822..., 0.5454398...])), + (array([ 0.316, 0.537]), array([ 0.3371612..., 0.5421567...])), + (array([ 0.265, 0.553]), array([ 0.2889416..., 0.5534074...])), + (array([ 0.221, 0.538]), array([ 0.2412195..., 0.5464301...])), + (array([ 0.135, 0.532]), array([ 0.1530344..., 0.5488239...])), + (array([ 0.145, 0.472]), array([ 0.1568709..., 0.5258835...])), + (array([ 0.163, 0.331]), array([ 0.1499762..., 0.4401747...])), + (array([ 0.176, 0.431]), array([ 0.1876711..., 0.5039627...])), + (array([ 0.244, 0.349]), array([ 0.2560012..., 0.4546263...]))] """ + experiment_results = (convert_experiment_results_Breneman1987(experiment) + if is_numeric(experiment) else experiment) + with domain_range_scale(1): - experiment_results = list(BRENEMAN_EXPERIMENTS[experiment]) - - illuminants = experiment_results.pop(0) - xy_o1 = Luv_uv_to_xy(illuminants.uvp_t) - xy_o2 = Luv_uv_to_xy(illuminants.uvp_m) - # :math:`Y_o` is set to an arbitrary value normalised to domain - # [18, 100]. - Y_o = 0.18 - E_o1 = E_o2 = BRENEMAN_EXPERIMENTS_PRIMARIES_CHROMATICITIES[ - experiment].Y - - prediction = [] - for result in experiment_results: - XYZ_1 = xy_to_XYZ(Luv_uv_to_xy(result.uvp_t)) - XYZ_2 = chromatic_adaptation_CIE1994(XYZ_1, xy_o1, xy_o2, Y_o, - E_o1, E_o2) - uvp = Luv_to_uv(XYZ_to_Luv(XYZ_2, xy_o2), xy_o2) - prediction.append( - CorrespondingChromaticitiesPrediction( - result.name, result.uvp_t, result.uvp_m, uvp)) - - return tuple(prediction) + XYZ_t, XYZ_r = experiment_results.XYZ_t, experiment_results.XYZ_r + xy_o1, xy_o2 = XYZ_to_xy([XYZ_t, XYZ_r]) + + uv_t = Luv_to_uv(XYZ_to_Luv(experiment_results.XYZ_ct, xy_o1), xy_o1) + uv_m = Luv_to_uv(XYZ_to_Luv(experiment_results.XYZ_cr, xy_o2), xy_o2) + + Y_r = experiment_results.B_r + E_o1, E_o2 = experiment_results.Y_t, experiment_results.Y_r + + XYZ_1 = experiment_results.XYZ_ct + XYZ_2 = chromatic_adaptation_CIE1994(XYZ_1, xy_o1, xy_o2, Y_r, E_o1, + E_o2) + uv_p = Luv_to_uv(XYZ_to_Luv(XYZ_2, xy_o2), xy_o2) + + return tuple([ + CorrespondingChromaticitiesPrediction(experiment_results.name, + uv_t[i], uv_m[i], uv_p[i]) + for i in range(len(uv_t)) + ]) def corresponding_chromaticities_prediction_CMCCAT2000(experiment=1): @@ -221,9 +375,10 @@ def corresponding_chromaticities_prediction_CMCCAT2000(experiment=1): Parameters ---------- - experiment : integer, optional + experiment : integer or CorrespondingColourDataset, optional {1, 2, 3, 4, 6, 8, 9, 11, 12} - *Breneman (1987)* experiment number. + *Breneman (1987)* experiment number or + :class:`colour.CorrespondingColourDataset` class instance. Returns ------- @@ -238,43 +393,45 @@ def corresponding_chromaticities_prediction_CMCCAT2000(experiment=1): -------- >>> from pprint import pprint >>> pr = corresponding_chromaticities_prediction_CMCCAT2000(2) - >>> pr = [(p.uvp_m, p.uvp_p) for p in pr] - >>> pprint(pr) # doctest: +SKIP - [((0.207, 0.486), (0.2083210..., 0.4727168...)), - ((0.449, 0.511), (0.4459270..., 0.5077735...)), - ((0.263, 0.505), (0.2640262..., 0.4955361...)), - ((0.322, 0.545), (0.3316884..., 0.5431580...)), - ((0.316, 0.537), (0.3222624..., 0.5357624...)), - ((0.265, 0.553), (0.2710705..., 0.5501997...)), - ((0.221, 0.538), (0.2261826..., 0.5294740...)), - ((0.135, 0.532), (0.1439693..., 0.5190984...)), - ((0.145, 0.472), (0.1494835..., 0.4556760...)), - ((0.163, 0.331), (0.1563172..., 0.3164151...)), - ((0.176, 0.431), (0.1763199..., 0.4127589...)), - ((0.244, 0.349), (0.2287638..., 0.3499324...))] + >>> pr = [(p.uv_m, p.uv_p) for p in pr] + >>> pprint(pr) # doctest: +ELLIPSIS + [(array([ 0.207, 0.486]), array([ 0.2083210..., 0.4727168...])), + (array([ 0.449, 0.511]), array([ 0.4459270..., 0.5077735...])), + (array([ 0.263, 0.505]), array([ 0.2640262..., 0.4955361...])), + (array([ 0.322, 0.545]), array([ 0.3316884..., 0.5431580...])), + (array([ 0.316, 0.537]), array([ 0.3222624..., 0.5357624...])), + (array([ 0.265, 0.553]), array([ 0.2710705..., 0.5501997...])), + (array([ 0.221, 0.538]), array([ 0.2261826..., 0.5294740...])), + (array([ 0.135, 0.532]), array([ 0.1439693..., 0.5190984...])), + (array([ 0.145, 0.472]), array([ 0.1494835..., 0.4556760...])), + (array([ 0.163, 0.331]), array([ 0.1563172..., 0.3164151...])), + (array([ 0.176, 0.431]), array([ 0.1763199..., 0.4127589...])), + (array([ 0.244, 0.349]), array([ 0.2287638..., 0.3499324...]))] """ + experiment_results = (convert_experiment_results_Breneman1987(experiment) + if is_numeric(experiment) else experiment) + with domain_range_scale(1): - experiment_results = list(BRENEMAN_EXPERIMENTS[experiment]) + XYZ_w, XYZ_wr = experiment_results.XYZ_t, experiment_results.XYZ_r + xy_w, xy_wr = XYZ_to_xy([XYZ_w, XYZ_wr]) + + uv_t = Luv_to_uv(XYZ_to_Luv(experiment_results.XYZ_ct, xy_w), xy_w) + uv_m = Luv_to_uv(XYZ_to_Luv(experiment_results.XYZ_cr, xy_wr), xy_wr) - illuminants = experiment_results.pop(0) - XYZ_w = xy_to_XYZ(Luv_uv_to_xy(illuminants.uvp_t)) - XYZ_wr = xy_to_XYZ(Luv_uv_to_xy(illuminants.uvp_m)) - xy_wr = XYZ_to_xy(XYZ_wr) - L_A1 = L_A2 = BRENEMAN_EXPERIMENTS_PRIMARIES_CHROMATICITIES[ - experiment].Y + L_A1 = experiment_results.Y_t + L_A2 = experiment_results.Y_r - prediction = [] - for result in experiment_results: - XYZ_1 = xy_to_XYZ(Luv_uv_to_xy(result.uvp_t)) - XYZ_2 = chromatic_adaptation_CMCCAT2000(XYZ_1, XYZ_w, XYZ_wr, L_A1, - L_A2) - uvp = Luv_to_uv(XYZ_to_Luv(XYZ_2, xy_wr), xy_wr) - prediction.append( - CorrespondingChromaticitiesPrediction( - result.name, result.uvp_t, result.uvp_m, uvp)) + XYZ_1 = experiment_results.XYZ_ct + XYZ_2 = chromatic_adaptation_CMCCAT2000(XYZ_1, XYZ_w, XYZ_wr, L_A1, + L_A2) + uv_p = Luv_to_uv(XYZ_to_Luv(XYZ_2, xy_wr), xy_wr) - return tuple(prediction) + return tuple([ + CorrespondingChromaticitiesPrediction(experiment_results.name, + uv_t[i], uv_m[i], uv_p[i]) + for i in range(len(uv_t)) + ]) def corresponding_chromaticities_prediction_VonKries(experiment=1, @@ -285,9 +442,10 @@ def corresponding_chromaticities_prediction_VonKries(experiment=1, Parameters ---------- - experiment : integer, optional + experiment : integer or CorrespondingColourDataset, optional {1, 2, 3, 4, 6, 8, 9, 11, 12} - *Breneman (1987)* experiment number. + *Breneman (1987)* experiment number or + :class:`colour.CorrespondingColourDataset` class instance. transform : unicode, optional **{'CAT02', 'XYZ Scaling', 'Von Kries', 'Bradford', 'Sharp', 'Fairchild', 'CMCCAT97', 'CMCCAT2000', 'CAT02_BRILL_CAT', 'Bianco', @@ -307,39 +465,41 @@ def corresponding_chromaticities_prediction_VonKries(experiment=1, -------- >>> from pprint import pprint >>> pr = corresponding_chromaticities_prediction_VonKries(2, 'Bradford') - >>> pr = [(p.uvp_m, p.uvp_p) for p in pr] - >>> pprint(pr) # doctest: +SKIP - [((0.207, 0.486), (0.2082014..., 0.4722922...)), - ((0.449, 0.511), (0.4489102..., 0.5071602...)), - ((0.263, 0.505), (0.2643545..., 0.4959631...)), - ((0.322, 0.545), (0.3348730..., 0.5471220...)), - ((0.316, 0.537), (0.3248758..., 0.5390589...)), - ((0.265, 0.553), (0.2733105..., 0.5555028...)), - ((0.221, 0.538), (0.2271480..., 0.5331317...)), - ((0.135, 0.532), (0.1442730..., 0.5226804...)), - ((0.145, 0.472), (0.1498745..., 0.4550785...)), - ((0.163, 0.331), (0.1564975..., 0.3148795...)), - ((0.176, 0.431), (0.1760593..., 0.4103772...)), - ((0.244, 0.349), (0.2259805..., 0.3465291...))] + >>> pr = [(p.uv_m, p.uv_p) for p in pr] + >>> pprint(pr) # doctest: +ELLIPSIS + [(array([ 0.207, 0.486]), array([ 0.2082014..., 0.4722922...])), + (array([ 0.449, 0.511]), array([ 0.4489102..., 0.5071602...])), + (array([ 0.263, 0.505]), array([ 0.2643545..., 0.4959631...])), + (array([ 0.322, 0.545]), array([ 0.3348730..., 0.5471220...])), + (array([ 0.316, 0.537]), array([ 0.3248758..., 0.5390589...])), + (array([ 0.265, 0.553]), array([ 0.2733105..., 0.5555028...])), + (array([ 0.221, 0.538]), array([ 0.227148 ..., 0.5331318...)), + (array([ 0.135, 0.532]), array([ 0.1442730..., 0.5226804...])), + (array([ 0.145, 0.472]), array([ 0.1498745..., 0.4550785...])), + (array([ 0.163, 0.331]), array([ 0.1564975..., 0.3148796...])), + (array([ 0.176, 0.431]), array([ 0.1760593..., 0.4103772...])), + (array([ 0.244, 0.349]), array([ 0.2259805..., 0.3465291...]))] """ - experiment_results = list(BRENEMAN_EXPERIMENTS[experiment]) + experiment_results = (convert_experiment_results_Breneman1987(experiment) + if is_numeric(experiment) else experiment) + + with domain_range_scale(1): + XYZ_w, XYZ_wr = experiment_results.XYZ_t, experiment_results.XYZ_r + xy_w, xy_wr = XYZ_to_xy([XYZ_w, XYZ_wr]) - illuminants = experiment_results.pop(0) - XYZ_w = xy_to_XYZ(Luv_uv_to_xy(illuminants.uvp_t)) - XYZ_wr = xy_to_XYZ(Luv_uv_to_xy(illuminants.uvp_m)) - xy_wr = XYZ_to_xy(XYZ_wr) + uv_t = Luv_to_uv(XYZ_to_Luv(experiment_results.XYZ_ct, xy_w), xy_w) + uv_m = Luv_to_uv(XYZ_to_Luv(experiment_results.XYZ_cr, xy_wr), xy_wr) - prediction = [] - for result in experiment_results: - XYZ_1 = xy_to_XYZ(Luv_uv_to_xy(result.uvp_t)) + XYZ_1 = experiment_results.XYZ_ct XYZ_2 = chromatic_adaptation_VonKries(XYZ_1, XYZ_w, XYZ_wr, transform) - uvp = Luv_to_uv(XYZ_to_Luv(XYZ_2, xy_wr), xy_wr) - prediction.append( - CorrespondingChromaticitiesPrediction(result.name, result.uvp_t, - result.uvp_m, uvp)) + uv_p = Luv_to_uv(XYZ_to_Luv(XYZ_2, xy_wr), xy_wr) - return tuple(prediction) + return tuple([ + CorrespondingChromaticitiesPrediction(experiment_results.name, + uv_t[i], uv_m[i], uv_p[i]) + for i in range(len(uv_t)) + ]) CORRESPONDING_CHROMATICITIES_PREDICTION_MODELS = CaseInsensitiveMapping({ @@ -377,9 +537,10 @@ def corresponding_chromaticities_prediction(experiment=1, Parameters ---------- - experiment : integer, optional + experiment : integer or CorrespondingColourDataset, optional {1, 2, 3, 4, 6, 8, 9, 11, 12} - *Breneman (1987)* experiment number. + *Breneman (1987)* experiment number or + :class:`colour.CorrespondingColourDataset` class instance. model : unicode, optional **{'Von Kries', 'CIE 1994', 'CMCCAT2000', 'Fairchild 1990'}**, Chromatic adaptation model. @@ -387,7 +548,8 @@ def corresponding_chromaticities_prediction(experiment=1, Other Parameters ---------------- transform : unicode, optional - {:func:`colour.corresponding.corresponding_chromaticities_prediction_VonKries`}, + {:func:`colour.corresponding.\ +corresponding_chromaticities_prediction_VonKries`}, **{'CAT02', 'XYZ Scaling', 'Von Kries', 'Bradford', 'Sharp', 'Fairchild', 'CMCCAT97', 'CMCCAT2000', 'CAT02_BRILL_CAT', 'Bianco', 'Bianco PC'}**, @@ -408,7 +570,7 @@ def corresponding_chromaticities_prediction(experiment=1, -------- >>> from pprint import pprint >>> pr = corresponding_chromaticities_prediction(2, 'CMCCAT2000') - >>> pr = [(p.uvp_m, p.uvp_p) for p in pr] + >>> pr = [(p.uv_m, p.uv_p) for p in pr] >>> pprint(pr) # doctest: +SKIP [((0.207, 0.486), (0.2083210..., 0.4727168...)), ((0.449, 0.511), (0.4459270..., 0.5077735...)), diff --git a/colour/corresponding/tests/test_prediction.py b/colour/corresponding/tests/test_prediction.py index 984c58afd0..0d29aa85af 100644 --- a/colour/corresponding/tests/test_prediction.py +++ b/colour/corresponding/tests/test_prediction.py @@ -10,6 +10,8 @@ import unittest from colour.corresponding.prediction import ( + CorrespondingColourDataset, convert_experiment_results_Breneman1987) +from colour.corresponding import ( corresponding_chromaticities_prediction_VonKries, corresponding_chromaticities_prediction_CIE1994, corresponding_chromaticities_prediction_CMCCAT2000, @@ -23,14 +25,53 @@ __status__ = 'Production' __all__ = [ - 'FAIRCHILD1990_PREDICTION_DATA', 'CIE1994_PREDICTION_DATA', - 'CMCCAT2000_PREDICTION_DATA', 'VONKRIES_PREDICTION_DATA', + 'CORRESPONDING_COLOUR_DATASET_1', 'FAIRCHILD1990_PREDICTION_DATA', + 'CIE1994_PREDICTION_DATA', 'CMCCAT2000_PREDICTION_DATA', + 'VONKRIES_PREDICTION_DATA', 'TestCorrespondingChromaticitiesPredictionFairchild1990', 'TestCorrespondingChromaticitiesPredictionCIE1994', 'TestCorrespondingChromaticitiesPredictionCMCCAT2000', 'TestCorrespondingChromaticitiesPredictionVonKries' ] +CORRESPONDING_COLOUR_DATASET_1 = CorrespondingColourDataset( + name=1, + XYZ_r=np.array([0.947368421052632, 1.000000000000000, 1.000000000000000]), + XYZ_t=np.array([1.107889733840304, 1.000000000000000, 0.334125475285171]), + XYZ_cr=np.array([ + [372.358829568788565, 405.000000000000000, 345.746919917864489], + [250.638506876227865, 135.000000000000000, 37.131630648330052], + [456.541750503018136, 405.000000000000000, 267.487424547283638], + [502.185218978102114, 405.000000000000000, 24.758211678831920], + [164.036312849162016, 135.000000000000000, 24.511173184357535], + [422.727888086642622, 405.000000000000000, 27.231498194945619], + [110.245746691871460, 135.000000000000000, 53.846880907372366], + [75.208733205374273, 135.000000000000000, 77.281669865642954], + [258.414179104477626, 405.000000000000000, 479.480277185501166], + [141.154411764705856, 135.000000000000000, 469.124999999999943], + [380.757042253521092, 405.000000000000000, 700.193661971831261], + [192.236301369863071, 135.000000000000000, 370.510273972602761], + ]), + XYZ_ct=np.array([ + [450.407919847328230, 405.000000000000000, 143.566316793893037], + [267.090517241379359, 135.000000000000000, 11.831896551724059], + [531.851235741444839, 405.000000000000000, 107.602186311787023], + [603.033088235294031, 405.000000000000000, 7.444852941176350], + [196.511090573012893, 135.000000000000000, 8.109981515711597], + [526.868181818181711, 405.000000000000000, 8.468181818181574], + [144.589483394833962, 135.000000000000000, 24.035977859778562], + [108.161900369003689, 135.000000000000000, 36.178505535055272], + [317.877906976744100, 405.000000000000000, 223.691860465116235], + [126.960674157303373, 135.000000000000000, 192.792134831460686], + [419.434826883910489, 405.000000000000000, 309.730142566191489], + [185.180921052631589, 135.000000000000000, 151.430921052631589], + ]), + Y_r=np.array(1500), + Y_t=np.array(1500), + B_r=0.3, + B_t=0.3, + metadata={}) + FAIRCHILD1990_PREDICTION_DATA = np.array([ [(0.199, 0.487), (0.200554934448681, 0.470155699619516)], [(0.420, 0.509), (0.389214449896027, 0.514002881379267)], @@ -47,18 +88,18 @@ ]) CIE1994_PREDICTION_DATA = np.array([ - [(0.199, 0.487), (0.215767890780959, 0.498895367826280)], - [(0.420, 0.509), (0.410267748469504, 0.513821531425251)], - [(0.249, 0.497), (0.260571497362321, 0.505148168687439)], - [(0.302, 0.548), (0.311801622971574, 0.544064249771824)], - [(0.290, 0.537), (0.301614668967021, 0.535375706603034)], - [(0.257, 0.554), (0.269684273997378, 0.549604431199331)], - [(0.192, 0.529), (0.212643185166644, 0.525635424809257)], - [(0.129, 0.521), (0.152356526399028, 0.519785490832987)], - [(0.133, 0.469), (0.144776887283650, 0.484297760360214)], - [(0.158, 0.340), (0.158080133044082, 0.408581420625705)], - [(0.178, 0.426), (0.189260852492846, 0.456756636791417)], - [(0.231, 0.365), (0.239473218525016, 0.420497483443809)], + [(0.199, 0.487), (0.261386136420622, 0.533662817418878)], + [(0.420, 0.509), (0.451546322781523, 0.521730655299867)], + [(0.249, 0.497), (0.310170032403198, 0.532080871352910)], + [(0.302, 0.548), (0.362647256496429, 0.543095116682339)], + [(0.290, 0.537), (0.342002205412566, 0.540654345195812)], + [(0.257, 0.554), (0.320554395869614, 0.549100152511420)], + [(0.192, 0.529), (0.249890733398992, 0.543032894366422)], + [(0.129, 0.521), (0.184477356124214, 0.545089114658268)], + [(0.133, 0.469), (0.179131489840910, 0.534176133801835)], + [(0.158, 0.340), (0.173452103066259, 0.480817508459012)], + [(0.178, 0.426), (0.226570643054285, 0.516988754071352)], + [(0.231, 0.365), (0.272300292824155, 0.482318190580811)], ]) CMCCAT2000_PREDICTION_DATA = np.array([ @@ -92,6 +133,53 @@ ]) +class TestConvertExperimentResultsBreneman1987(unittest.TestCase): + """ + Defines :func:`colour.corresponding.prediction.\ +convert_experiment_results_Breneman1987` definition unit tests + methods. + """ + + def test_convert_experiment_results_Breneman1987(self): + """ + Tests :func:`colour.corresponding.prediction.\ +convert_experiment_results_Breneman1987` definition. + """ + + corresponding_colour_dataset = convert_experiment_results_Breneman1987( + 1) + + np.testing.assert_almost_equal( + corresponding_colour_dataset.XYZ_r, + CORRESPONDING_COLOUR_DATASET_1.XYZ_r, + decimal=7) + + np.testing.assert_almost_equal( + corresponding_colour_dataset.XYZ_t, + CORRESPONDING_COLOUR_DATASET_1.XYZ_t, + decimal=7) + + np.testing.assert_almost_equal( + corresponding_colour_dataset.XYZ_cr, + CORRESPONDING_COLOUR_DATASET_1.XYZ_cr, + decimal=7) + + np.testing.assert_almost_equal( + corresponding_colour_dataset.XYZ_ct, + CORRESPONDING_COLOUR_DATASET_1.XYZ_ct, + decimal=7) + + np.testing.assert_almost_equal( + corresponding_colour_dataset.Y_r, + CORRESPONDING_COLOUR_DATASET_1.Y_r, + decimal=7) + + np.testing.assert_almost_equal( + corresponding_colour_dataset.Y_t, + CORRESPONDING_COLOUR_DATASET_1.Y_t, + decimal=7) + + class TestCorrespondingChromaticitiesPredictionFairchild1990( unittest.TestCase): # noqa """ @@ -108,7 +196,7 @@ def test_corresponding_chromaticities_prediction_Fairchild1990(self): np.testing.assert_almost_equal( np.array( - [(p.uvp_m, p.uvp_p) for p in + [(p.uv_m, p.uv_p) for p in corresponding_chromaticities_prediction_Fairchild1990()]), FAIRCHILD1990_PREDICTION_DATA, decimal=7) @@ -128,7 +216,7 @@ def test_corresponding_chromaticities_prediction_CIE1994(self): np.testing.assert_almost_equal( np.array( - [(p.uvp_m, p.uvp_p) + [(p.uv_m, p.uv_p) for p in corresponding_chromaticities_prediction_CIE1994()]), CIE1994_PREDICTION_DATA, decimal=7) @@ -144,12 +232,12 @@ class TestCorrespondingChromaticitiesPredictionCMCCAT2000(unittest.TestCase): def test_corresponding_chromaticities_prediction_CMCCAT2000(self): """ Tests :func:`colour.corresponding.prediction.\ - corresponding_chromaticities_prediction_CMCCAT2000` definition. +corresponding_chromaticities_prediction_CMCCAT2000` definition. """ np.testing.assert_almost_equal( np.array([ - (p.uvp_m, p.uvp_p) + (p.uv_m, p.uv_p) for p in corresponding_chromaticities_prediction_CMCCAT2000() ]), CMCCAT2000_PREDICTION_DATA, @@ -171,7 +259,7 @@ def test_corresponding_chromaticities_prediction_VonKries(self): np.testing.assert_almost_equal( np.array( - [(p.uvp_m, p.uvp_p) + [(p.uv_m, p.uv_p) for p in corresponding_chromaticities_prediction_VonKries()]), VONKRIES_PREDICTION_DATA, decimal=7) diff --git a/colour/examples/adaptation/examples_cmccat2000.py b/colour/examples/adaptation/examples_cmccat2000.py index 450b5ed850..f2cd73a24e 100644 --- a/colour/examples/adaptation/examples_cmccat2000.py +++ b/colour/examples/adaptation/examples_cmccat2000.py @@ -31,7 +31,7 @@ print('\n') XYZ_c = np.array([0.19526983, 0.23068340, 0.24971752]) -message_box(('Computing chromatic adaptation using "CMCCAT200" reverse ' +message_box(('Computing chromatic adaptation using "CMCCAT200" inverse ' 'chromatic adaptation model.\n' '\n\t"XYZ_c":\n\t\t{0}\n\t"XYZ_w":\n\t\t{1}\n\t"XYZ_wr":\n\t\t{2}' '\n\t"L_A1":\n\t\t{3}\n\t"L_A2":\n\t\t{4}\n\n' @@ -45,7 +45,7 @@ method='CMCCAT2000', L_A1=L_A1, L_A2=L_A2, - direction='Reverse')) + direction='Inverse')) print( colour.adaptation.chromatic_adaptation_CMCCAT2000( - XYZ_c * 100.0, XYZ_w, XYZ_wr, L_A1, L_A2, direction='Reverse') / 100.0) + XYZ_c * 100.0, XYZ_w, XYZ_wr, L_A1, L_A2, direction='Inverse') / 100.0) diff --git a/colour/examples/algebra/examples_interpolation.py b/colour/examples/algebra/examples_interpolation.py index 250cc99701..8e8d584a76 100644 --- a/colour/examples/algebra/examples_interpolation.py +++ b/colour/examples/algebra/examples_interpolation.py @@ -142,7 +142,7 @@ '\nusing given interpolation table.'.format(V_xyz))) path = os.path.join( os.path.dirname(__file__), '..', '..', 'io', 'luts', 'tests', 'resources', - 'iridas_cube', 'ColourCorrect.cube') + 'iridas_cube', 'Colour_Correct.cube') table = colour.read_LUT(path).table print(colour.table_interpolation(V_xyz, table, method='Trilinear')) print(colour.algebra.table_interpolation_trilinear(V_xyz, table)) diff --git a/colour/examples/characterisation/examples_colour_checkers.py b/colour/examples/characterisation/examples_colour_checkers.py index c1ff639047..adddf250fc 100644 --- a/colour/examples/characterisation/examples_colour_checkers.py +++ b/colour/examples/characterisation/examples_colour_checkers.py @@ -38,7 +38,7 @@ colour.xyY_to_XYZ(xyY), illuminant, colour.ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D65'], colour.RGB_COLOURSPACES['sRGB'].XYZ_to_RGB_matrix, 'Bradford', - colour.RGB_COLOURSPACES['sRGB'].encoding_cctf) + colour.RGB_COLOURSPACES['sRGB'].cctf_encoding) RGB = [int(round(x * 255)) if x >= 0 else 0 for x in np.ravel(RGB)] print('"{0}": {1}'.format(name, RGB)) diff --git a/colour/examples/colorimetry/examples_illuminants.py b/colour/examples/colorimetry/examples_illuminants.py index 01b6f5e231..d66d332c64 100644 --- a/colour/examples/colorimetry/examples_illuminants.py +++ b/colour/examples/colorimetry/examples_illuminants.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """ -Showcases illuminants dataset. +Showcases illuminants datasets. """ from pprint import pprint diff --git a/colour/examples/colorimetry/examples_light_sources.py b/colour/examples/colorimetry/examples_light_sources.py index c554cf238e..6010d2e774 100644 --- a/colour/examples/colorimetry/examples_light_sources.py +++ b/colour/examples/colorimetry/examples_light_sources.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """ -Showcases light sources dataset. +Showcases light sources datasets. """ from pprint import pprint @@ -10,12 +10,12 @@ message_box('Light Sources Dataset') -message_box('Light sources spectral distributions dataset.') +message_box('Light sources spectral distributions datasets.') pprint(sorted(colour.LIGHT_SOURCES_SDS.keys())) print('\n') -message_box('Light sources chromaticity coordinates dataset.') +message_box('Light sources chromaticity coordinates datasets.') # Filtering aliases. observers = dict(((observer, dataset) for observer, dataset in sorted(colour.LIGHT_SOURCES.items()) diff --git a/colour/examples/colorimetry/examples_luminance.py b/colour/examples/colorimetry/examples_luminance.py index aa2fca0514..e44dfa6a05 100644 --- a/colour/examples/colorimetry/examples_luminance.py +++ b/colour/examples/colorimetry/examples_luminance.py @@ -49,5 +49,5 @@ message_box(('Computing "luminance" using "ASTM D1535-08e1" method for given ' '"Munsell" value:\n' '\n\t{0}'.format(V))) -print(colour.luminance(V, method='ASTM D1535-08')) -print(colour.colorimetry.luminance_ASTMD153508(V)) +print(colour.luminance(V, method='ASTM D1535')) +print(colour.colorimetry.luminance_ASTMD1535(V)) diff --git a/colour/examples/colorimetry/examples_tristimulus.py b/colour/examples/colorimetry/examples_tristimulus.py index 8a541b7514..65e20d5a5f 100644 --- a/colour/examples/colorimetry/examples_tristimulus.py +++ b/colour/examples/colorimetry/examples_tristimulus.py @@ -119,7 +119,7 @@ message_box(('Computing *CIE XYZ* tristimulus values from given ' 'multi-spectral image with shape (4, 3, 6).')) -msa = np.array([ +msds = np.array([ [[0.01367208, 0.09127947, 0.01524376, 0.02810712, 0.19176012, 0.04299992], [0.00959792, 0.25822842, 0.41388571, 0.22275120, 0.00407416, 0.37439537], [0.01791409, 0.29707789, 0.56295109, 0.23752193, 0.00236515, 0.58190280]], @@ -134,5 +134,9 @@ [0.00305180, 0.11288624, 0.11357290, 0.12924391, 0.00195315, 0.21771573]], ]) print( - colour.multi_sds_to_XYZ(msa, colour.SpectralShape(400, 700, 60), cmfs, - illuminant)) + colour.multi_sds_to_XYZ( + msds, + cmfs, + illuminant, + method='Integration', + shape=colour.SpectralShape(400, 700, 60))) diff --git a/colour/examples/examples_colour.py b/colour/examples/examples_colour.py index 0ed9b52c34..37ef9f2b3b 100644 --- a/colour/examples/examples_colour.py +++ b/colour/examples/examples_colour.py @@ -8,8 +8,37 @@ import colour from colour.utilities import (filter_warnings, message_box, warning, - runtime_warning, - usage_warning) + runtime_warning, usage_warning) + +message_box('Automatic Colour Conversion Graph') + +message_box('Starting with version "0.3.14", "Colour" implements an automatic ' + 'colour conversion graph enabling easier colour conversions.') + +message_box('Converting a "ColorChecker" "dark skin" sample spectral ' + 'distribution to "Output-Referred" "sRGB" colourspace.') + +sd = colour.COLOURCHECKERS_SDS['ColorChecker N Ohta']['dark skin'] + +print(colour.convert(sd, 'Spectral Distribution', 'sRGB')) + +print('\n') + +RGB = np.array([0.45675795, 0.30986982, 0.24861924]) +message_box(('Converting to "CAM16-UCS" colourspace from given ' + '"Output-Referred" "sRGB" colourspace values:\n' + '\n\t{0}'.format(RGB))) +print(colour.convert(RGB, 'Output-Referred RGB', 'CAM16UCS')) + +print('\n') + +Jpapbp = np.array([0.39994811, 0.09206558, 0.0812752]) +message_box(('Converting to "Output-Referred" "sRGB" colourspace from given ' + '"CAM16-UCS" colourspace colourspace values:\n' + '\n\t{0}'.format(RGB))) +print(colour.convert(Jpapbp, 'CAM16UCS', 'sRGB')) + +print('\n') message_box('Filter "Colour" Warnings') diff --git a/colour/examples/graph/examples_graph.py b/colour/examples/graph/examples_graph.py new file mode 100644 index 0000000000..cc7180225e --- /dev/null +++ b/colour/examples/graph/examples_graph.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +""" +Showcases *Automatic Colour Conversion Graph* computations. +""" + +import numpy as np + +import colour +from colour.utilities import message_box + +message_box('Automatic Colour Conversion Graph') + +message_box('Converting a "ColorChecker" "dark skin" sample spectral ' + 'distribution to "Output-Referred" "sRGB" colourspace.') + +sd = colour.COLOURCHECKERS_SDS['ColorChecker N Ohta']['dark skin'] +print(colour.convert(sd, 'Spectral Distribution', 'sRGB')) +print( + colour.XYZ_to_sRGB( + colour.sd_to_XYZ(sd, illuminant=colour.ILLUMINANTS_SDS['D65']) / 100)) + +print('\n') + +RGB = np.array([0.45675795, 0.30986982, 0.24861924]) +message_box(('Converting to "CAM16-UCS" colourspace from given ' + '"Output-Referred" "sRGB" colourspace values:\n' + '\n\t{0}'.format(RGB))) +print(colour.convert(RGB, 'Output-Referred RGB', 'CAM16UCS')) +specification = colour.XYZ_to_CAM16( + colour.sRGB_to_XYZ(RGB) * 100, + XYZ_w=colour.xy_to_XYZ( + colour.ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D65']) * + 100, + L_A=64 / np.pi * 0.2, + Y_b=20) +print( + colour.JMh_CAM16_to_CAM16UCS( + colour.utilities.tstack([ + specification.J, + specification.M, + specification.h, + ])) / 100) + +print('\n') + +Jpapbp = np.array([0.39994811, 0.09206558, 0.0812752]) +message_box(('Converting to "Output-Referred" "sRGB" colourspace from given ' + '"CAM16-UCS" colourspace colourspace values:\n' + '\n\t{0}'.format(RGB))) +print( + colour.convert( + Jpapbp, + 'CAM16UCS', + 'sRGB', + verbose_parameters={ + 'describe': 'Extended', + 'width': 75 + })) +J, M, h = colour.utilities.tsplit(colour.CAM16UCS_to_JMh_CAM16(Jpapbp * 100)) +specification = colour.CAM16_Specification(J=J, M=M, h=h) +print( + colour.XYZ_to_sRGB( + colour.CAM16_to_XYZ( + specification, + XYZ_w=colour.xy_to_XYZ( + colour.ILLUMINANTS['CIE 1931 2 Degree Standard Observer'] + ['D65']) * 100, + L_A=64 / np.pi * 0.2, + Y_b=20) / 100)) diff --git a/colour/examples/io/examples_ies_tm2714.py b/colour/examples/io/examples_ies_tm2714.py index 10ad5bf59f..2eaa60bea0 100644 --- a/colour/examples/io/examples_ies_tm2714.py +++ b/colour/examples/io/examples_ies_tm2714.py @@ -15,8 +15,8 @@ message_box('Reading spectral data from "IES TM-27-14" "XML" file.') sd = colour.SpectralDistribution_IESTM2714( - os.path.join(RESOURCES_DIRECTORY, 'TM27 Sample Spectral Data.spdx')) -sd.read() + os.path.join(RESOURCES_DIRECTORY, + 'TM27 Sample Spectral Data.spdx')).read() print(sd) print('\n') diff --git a/colour/examples/io/examples_luts.py b/colour/examples/io/examples_luts.py index 874c51df0e..f393190575 100644 --- a/colour/examples/io/examples_luts.py +++ b/colour/examples/io/examples_luts.py @@ -24,7 +24,7 @@ print('\n') message_box('Reading "Iridas" ".cube" 3D LUT file.') -path = os.path.join(RESOURCES_DIRECTORY, 'iridas_cube', 'ColourCorrect.cube') +path = os.path.join(RESOURCES_DIRECTORY, 'iridas_cube', 'Colour_Correct.cube') print(colour.io.read_LUT_IridasCube(path)) print('\n') print(colour.read_LUT(path)) @@ -32,8 +32,7 @@ print('\n') message_box('Reading "Sony" ".spi1d" 1D LUT file.') -path = os.path.join(RESOURCES_DIRECTORY, 'sony_spi1d', - 'oetf_reverse_sRGB_1D.spi1d') +path = os.path.join(RESOURCES_DIRECTORY, 'sony_spi1d', 'eotf_sRGB_1D.spi1d') print(colour.io.read_LUT_SonySPI1D(path)) print('\n') print(colour.read_LUT(path)) @@ -41,8 +40,7 @@ print('\n') message_box('Reading "Sony" ".spi1d" 3x1D LUT file.') -path = os.path.join(RESOURCES_DIRECTORY, 'sony_spi1d', - 'oetf_reverse_sRGB_3x1D.spi1d') +path = os.path.join(RESOURCES_DIRECTORY, 'sony_spi1d', 'eotf_sRGB_3x1D.spi1d') print(colour.io.read_LUT_SonySPI1D(path)) print('\n') print(colour.read_LUT(path)) @@ -51,8 +49,7 @@ RGB = np.array([0.35521588, 0.41000000, 0.24177934]) message_box(('Applying 1D LUT to given "RGB" values:\n' '\n\t{0}'.format(RGB))) -path = os.path.join(RESOURCES_DIRECTORY, 'sony_spi1d', - 'oetf_reverse_sRGB_1D.spi1d') +path = os.path.join(RESOURCES_DIRECTORY, 'sony_spi1d', 'eotf_sRGB_1D.spi1d') LUT = colour.io.read_LUT(path) print(LUT.apply(RGB)) @@ -68,6 +65,6 @@ print('\n') message_box(('Applying 3D LUT to given "RGB" values:\n' '\n\t{0}'.format(RGB))) -path = os.path.join(RESOURCES_DIRECTORY, 'iridas_cube', 'ColourCorrect.cube') +path = os.path.join(RESOURCES_DIRECTORY, 'iridas_cube', 'Colour_Correct.cube') LUT = colour.io.read_LUT(path) print(LUT.apply(RGB)) diff --git a/colour/examples/models/examples_models.py b/colour/examples/models/examples_models.py index c44c100d43..67f6bc9451 100644 --- a/colour/examples/models/examples_models.py +++ b/colour/examples/models/examples_models.py @@ -67,7 +67,7 @@ colour.RGB_COLOURSPACES['sRGB'].whitepoint, colour.RGB_COLOURSPACES['sRGB'].XYZ_to_RGB_matrix, 'Bradford', - colour.RGB_COLOURSPACES['sRGB'].encoding_cctf, + colour.RGB_COLOURSPACES['sRGB'].cctf_encoding, )) print('\n') @@ -83,7 +83,7 @@ D65, colour.RGB_COLOURSPACES['sRGB'].RGB_to_XYZ_matrix, 'Bradford', - colour.RGB_COLOURSPACES['sRGB'].decoding_cctf, + colour.RGB_COLOURSPACES['sRGB'].cctf_decoding, )) print('\n') diff --git a/colour/examples/models/examples_rgb.py b/colour/examples/models/examples_rgb.py index 8af971326d..7dad73b717 100644 --- a/colour/examples/models/examples_rgb.py +++ b/colour/examples/models/examples_rgb.py @@ -25,9 +25,9 @@ print('\nNormalised primary matrix to "ACES2065-1":\n{0}'.format( colourspace.XYZ_to_RGB_matrix)) print('\nOpto-electronic transfer function from ' - 'linear to colourspace:\n{0}'.format(colourspace.encoding_cctf)) + 'linear to colourspace:\n{0}'.format(colourspace.cctf_encoding)) print('\nElectro-optical transfer function from ' - 'colourspace to linear:\n{0}'.format(colourspace.decoding_cctf)) + 'colourspace to linear:\n{0}'.format(colourspace.cctf_decoding)) print('\n') diff --git a/colour/examples/models/examples_transfer_functions.py b/colour/examples/models/examples_transfer_functions.py index 093fcfd8b2..1ba0e430d3 100644 --- a/colour/examples/models/examples_transfer_functions.py +++ b/colour/examples/models/examples_transfer_functions.py @@ -29,7 +29,7 @@ message_box(('Encoding to "Cineon" using given linear-light value:\n' '\n\t{0}'.format(C))) -print(colour.log_encoding_curve(C, curve='Cineon')) +print(colour.log_encoding(C, function='Cineon')) print(colour.models.log_encoding_Cineon(C)) print('\n') @@ -37,14 +37,14 @@ N = 0.45731961 message_box(('Decoding to linear-light using given "Cineon" code value:\n' '\n\t{0}'.format(N))) -print(colour.log_decoding_curve(N, curve='Cineon')) +print(colour.log_decoding(N, function='Cineon')) print(colour.models.log_decoding_Cineon(N)) print('\n') message_box(('Encoding to "PLog" using given linear-light value:\n' '\n\t{0}'.format(C))) -print(colour.log_encoding_curve(C, curve='PLog')) +print(colour.log_encoding(C, function='PLog')) print(colour.models.log_encoding_PivotedLog(C)) print('\n') @@ -52,7 +52,7 @@ N = 0.43499511 message_box(('Decoding to linear-light value using given "PLog" code value:\n' '\n\t{0}'.format(N))) -print(colour.log_decoding_curve(N, curve='PLog')) +print(colour.log_decoding(N, function='PLog')) print(colour.models.log_decoding_PivotedLog(N)) print('\n') diff --git a/colour/examples/notation/examples_munsell.py b/colour/examples/notation/examples_munsell.py index 281741008a..ecc20d3c03 100644 --- a/colour/examples/notation/examples_munsell.py +++ b/colour/examples/notation/examples_munsell.py @@ -64,8 +64,8 @@ message_box(('Computing "Munsell" value using "ASTM D1535-08e1" method ' 'for given "luminance" value:\n' '\n\t{0}'.format(Y))) -print(colour.munsell_value(Y, method='ASTM D1535-08')) -print(colour.notation.munsell_value_ASTMD153508(Y)) +print(colour.munsell_value(Y, method='ASTM D1535')) +print(colour.notation.munsell_value_ASTMD1535(Y)) print('\n') diff --git a/colour/examples/plotting/examples_blindness.py b/colour/examples/plotting/examples_blindness.py index 4baa00b9a5..d9db06ff60 100644 --- a/colour/examples/plotting/examples_blindness.py +++ b/colour/examples/plotting/examples_blindness.py @@ -16,7 +16,7 @@ colour_style() -ISHIHARA_CBT_3_IMAGE = colour.oetf_reverse( +ISHIHARA_CBT_3_IMAGE = colour.cctf_decoding( colour.read_image( os.path.join(RESOURCES_DIRECTORY, 'Ishihara_Colour_Blindness_Test_Plate_3.png')), @@ -25,8 +25,12 @@ message_box('Colour Blindness Plots') message_box('Displaying "Ishihara Colour Blindness Test - Plate 3".') -plot_image(colour.oetf(ISHIHARA_CBT_3_IMAGE), - text_parameters={'text': 'Normal Trichromat', 'color': 'black'}) +plot_image( + colour.cctf_encoding(ISHIHARA_CBT_3_IMAGE), + text_parameters={ + 'text': 'Normal Trichromat', + 'color': 'black' + }) print('\n') @@ -34,8 +38,13 @@ '"Ishihara Colour Blindness Test - Plate 3" with Machado (2010) ' 'model and pre-computed matrix.') plot_cvd_simulation_Machado2009( - ISHIHARA_CBT_3_IMAGE, 'Protanomaly', 0.5, - text_parameters={'text': 'Protanomaly - 50%', 'color': 'black'}) + ISHIHARA_CBT_3_IMAGE, + 'Protanomaly', + 0.5, + text_parameters={ + 'text': 'Protanomaly - 50%', + 'color': 'black' + }) print('\n') @@ -48,8 +57,12 @@ 'model using "Stockman & Sharpe 2 Degree Cone Fundamentals" and ' '"Typical CRT Brainard 1997" "RGB" display primaries.') plot_cvd_simulation_Machado2009( - ISHIHARA_CBT_3_IMAGE, M_a=M_a, - text_parameters={'text': 'Average Protanomaly - 10nm', 'color': 'black'}) + ISHIHARA_CBT_3_IMAGE, + M_a=M_a, + text_parameters={ + 'text': 'Average Protanomaly - 10nm', + 'color': 'black' + }) print('\n') @@ -62,5 +75,9 @@ 'model using "Stockman & Sharpe 2 Degree Cone Fundamentals" and ' '"Typical CRT Brainard 1997" "RGB" display primaries.') plot_cvd_simulation_Machado2009( - ISHIHARA_CBT_3_IMAGE, M_a=M_a, - text_parameters={'text': 'Protanopia - 20nm', 'color': 'black'}) + ISHIHARA_CBT_3_IMAGE, + M_a=M_a, + text_parameters={ + 'text': 'Protanopia - 20nm', + 'color': 'black' + }) diff --git a/colour/examples/plotting/examples_colorimetry_plots.py b/colour/examples/plotting/examples_colorimetry_plots.py index b5ae14dc9a..b6bd0a21aa 100644 --- a/colour/examples/plotting/examples_colorimetry_plots.py +++ b/colour/examples/plotting/examples_colorimetry_plots.py @@ -7,7 +7,7 @@ import colour from colour.plotting import ( - ASTM_G_173_ETR, plot_blackbody_colours, plot_blackbody_spectral_radiance, + ASTMG173_ETR, plot_blackbody_colours, plot_blackbody_spectral_radiance, colour_style, plot_multi_cmfs, plot_multi_illuminant_sds, plot_multi_lightness_functions, plot_multi_sds, plot_single_cmfs, plot_single_illuminant_sd, plot_single_lightness_function, plot_single_sd, @@ -925,17 +925,17 @@ print('\n') message_box('Comparing theoretical and measured "Sun" spectral distributions.') -# Arbitrary ASTM_G_173_ETR scaling factor calculated with +# Arbitrary ASTMG173_ETR scaling factor calculated with # :func:`colour.sd_to_XYZ` definition. -ASTM_G_173_sd = ASTM_G_173_ETR.copy() * 1.37905559e+13 +ASTMG173_sd = ASTMG173_ETR.copy() * 1.37905559e+13 -ASTM_G_173_sd.interpolate( +ASTMG173_sd.interpolate( colour.SpectralShape(interval=5), interpolator=colour.LinearInterpolator) -blackbody_sd = colour.sd_blackbody(5778, ASTM_G_173_sd.shape) +blackbody_sd = colour.sd_blackbody(5778, ASTMG173_sd.shape) blackbody_sd.name = 'The Sun - 5778K' -plot_multi_sds((ASTM_G_173_sd, blackbody_sd), y_label='W / (sr m$^2$) / m') +plot_multi_sds((ASTMG173_sd, blackbody_sd), y_label='W / (sr m$^2$) / m') print('\n') diff --git a/colour/examples/plotting/examples_models_plots.py b/colour/examples/plotting/examples_models_plots.py index 4b38571ee4..292b00b80f 100644 --- a/colour/examples/plotting/examples_models_plots.py +++ b/colour/examples/plotting/examples_models_plots.py @@ -104,4 +104,4 @@ message_box(('Plotting multiple "RGB" colourspaces decoding colour component ' 'transfer functions.')) -plot_multi_cctfs(['ACES2065-1', 'ProPhoto RGB'], decoding_cctf=True) +plot_multi_cctfs(['ACES2065-1', 'ProPhoto RGB'], cctf_decoding=True) diff --git a/colour/examples/temperature/examples_cct.py b/colour/examples/temperature/examples_cct.py index d46da59528..289b21cec1 100644 --- a/colour/examples/temperature/examples_cct.py +++ b/colour/examples/temperature/examples_cct.py @@ -63,16 +63,17 @@ print('\n') xy = colour.ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D65'] -message_box(('Converting to "CCT" from given "xy" chromaticity coordinates ' - 'using "McCamy (1992)" method:\n' +message_box(('Converting to "CCT" from given "CIE xy" chromaticity ' + 'coordinates using "McCamy (1992)" method:\n' '\n\t{0}'.format(xy))) print(colour.xy_to_CCT(xy, method='McCamy 1992')) print(colour.temperature.xy_to_CCT_McCamy1992(xy)) print('\n') -message_box(('Converting to "CCT" from given "xy" chromaticity coordinates ' - 'using "Hernandez-Andres, Lee and Romero (1999)" method:\n' +message_box(('Converting to "CCT" from given "CIE xy" chromaticity ' + 'coordinates using "Hernandez-Andres, Lee and Romero (1999)" ' + 'method:\n' '\n\t{0}'.format(xy))) print(colour.xy_to_CCT(xy, method='Hernandez 1999')) print(colour.temperature.xy_to_CCT_Hernandez1999(xy)) @@ -80,16 +81,17 @@ print('\n') CCT = 6503.49254150 -message_box(('Converting to "xy" chromaticity coordinates from given "CCT" ' - 'using "Kang, Moon, Hong, Lee, Cho and Kim (2002)" method:\n' +message_box(('Converting to "CIE xy" chromaticity coordinates from given ' + '"CCT" using "Kang, Moon, Hong, Lee, Cho and Kim (2002)" ' + 'method:\n' '\n\t{0}'.format(CCT))) -print(colour.CCT_to_xy(CCT, method="Kang 2002")) +print(colour.CCT_to_xy(CCT, method='Kang 2002')) print(colour.temperature.CCT_to_xy_Kang2002(CCT)) print('\n') -message_box(('Converting to "xy" chromaticity coordinates from given "CCT" ' - 'using "CIE Illuminant D Series" method:\n' +message_box(('Converting to "CIE xy" chromaticity coordinates from given ' + '"CCT" using "CIE Illuminant D Series" method:\n' '\n\t{0}'.format(CCT))) -print(colour.CCT_to_xy(CCT, method="CIE Illuminant D Series")) +print(colour.CCT_to_xy(CCT, method='CIE Illuminant D Series')) print(colour.temperature.CCT_to_xy_CIE_D(CCT)) diff --git a/colour/graph/__init__.py b/colour/graph/__init__.py new file mode 100644 index 0000000000..4f81be6e30 --- /dev/null +++ b/colour/graph/__init__.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- + +from __future__ import absolute_import + +from .conversion import (CONVERSION_GRAPH, CONVERSION_GRAPH_NODE_LABELS, + describe_conversion_path, convert) + +__all__ = [ + 'CONVERSION_GRAPH', 'CONVERSION_GRAPH_NODE_LABELS', + 'describe_conversion_path', 'convert' +] diff --git a/colour/graph/conversion.py b/colour/graph/conversion.py new file mode 100644 index 0000000000..74a06a2a94 --- /dev/null +++ b/colour/graph/conversion.py @@ -0,0 +1,967 @@ +# -*- coding: utf-8 -*- +""" +Automatic Colour Conversion Graph +================================= + +Defines the automatic colour conversion graph objects: + +- :func:`colour.describe_conversion_path` +- :func:`colour.convert` + +See Also +-------- +`Automatic Colour Conversion Graph Jupyter Notebook +`_ +""" + +from __future__ import division, print_function, unicode_literals + +import inspect +import numpy as np +import textwrap +from collections import namedtuple +from copy import copy +from functools import partial +from pprint import pformat + +from colour.colorimetry import (ILLUMINANTS, ILLUMINANTS_SDS, + HUNTERLAB_ILLUMINANTS) +from colour.colorimetry import (colorimetric_purity, complementary_wavelength, + dominant_wavelength, excitation_purity, + lightness, luminance, luminous_efficacy, + luminous_efficiency, luminous_flux, sd_to_XYZ, + whiteness, yellowness, wavelength_to_XYZ) +from colour.recovery import XYZ_to_sd +from colour.models import sRGB_COLOURSPACE +from colour.models import ( + CAM02LCD_to_JMh_CIECAM02, CAM02SCD_to_JMh_CIECAM02, + CAM02UCS_to_JMh_CIECAM02, CAM16LCD_to_JMh_CAM16, CAM16SCD_to_JMh_CAM16, + CAM16UCS_to_JMh_CAM16, CMYK_to_CMY, CMY_to_CMYK, CMY_to_RGB, DIN99_to_Lab, + HSL_to_RGB, HSV_to_RGB, Hunter_Lab_to_XYZ, Hunter_Rdab_to_XYZ, + ICTCP_to_RGB, IPT_to_XYZ, JMh_CAM16_to_CAM16LCD, JMh_CAM16_to_CAM16SCD, + JMh_CAM16_to_CAM16UCS, JMh_CIECAM02_to_CAM02LCD, JMh_CIECAM02_to_CAM02SCD, + JMh_CIECAM02_to_CAM02UCS, JzAzBz_to_XYZ, LCHab_to_Lab, LCHuv_to_Luv, + Lab_to_DIN99, Lab_to_LCHab, Lab_to_XYZ, Luv_to_LCHuv, Luv_to_XYZ, + Luv_to_uv, Luv_uv_to_xy, OSA_UCS_to_XYZ, Prismatic_to_RGB, RGB_luminance, + RGB_to_CMY, RGB_to_HSL, RGB_to_HSV, RGB_to_ICTCP, RGB_to_Prismatic, + RGB_to_RGB, RGB_to_XYZ, RGB_to_YCbCr, RGB_to_YCoCg, RGB_to_YcCbcCrc, + UCS_to_XYZ, UCS_to_uv, UCS_uv_to_xy, UVW_to_XYZ, XYZ_to_Hunter_Lab, + XYZ_to_Hunter_Rdab, XYZ_to_IPT, XYZ_to_JzAzBz, XYZ_to_Lab, XYZ_to_Luv, + XYZ_to_OSA_UCS, XYZ_to_RGB, XYZ_to_UCS, XYZ_to_UVW, XYZ_to_hdr_CIELab, + XYZ_to_hdr_IPT, XYZ_to_sRGB, XYZ_to_xy, XYZ_to_xyY, YCbCr_to_RGB, + YCoCg_to_RGB, YcCbcCrc_to_RGB, cctf_decoding, cctf_encoding, + hdr_CIELab_to_XYZ, hdr_IPT_to_XYZ, sRGB_to_XYZ, uv_to_Luv, uv_to_UCS, + xyY_to_XYZ, xyY_to_xy, xy_to_Luv_uv, xy_to_UCS_uv, xy_to_XYZ, xy_to_xyY) +from colour.notation import (HEX_to_RGB, RGB_to_HEX, munsell_value, + munsell_colour_to_xyY, xyY_to_munsell_colour) +from colour.quality import colour_quality_scale, colour_rendering_index +from colour.appearance import ( + CAM16_Specification, CAM16_to_XYZ, CIECAM02_Specification, CIECAM02_to_XYZ, + XYZ_to_ATD95, XYZ_to_CAM16, XYZ_to_CIECAM02, XYZ_to_Hunt, XYZ_to_LLAB, + XYZ_to_Nayatani95, XYZ_to_RLAB) +from colour.temperature import CCT_to_uv, CCT_to_xy, uv_to_CCT, xy_to_CCT +from colour.utilities import (domain_range_scale, filter_kwargs, + is_networkx_installed, message_box, tsplit, + tstack, usage_warning) + +if is_networkx_installed(): # pragma: no cover + import networkx as nx + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = [ + 'ConversionSpecification', 'CIECAM02_to_JMh_CIECAM02', + 'JMh_CIECAM02_to_CIECAM02', 'CAM16_to_JMh_CAM16', 'JMh_CAM16_to_CAM16', + 'XYZ_to_luminance', 'RGB_luminance_to_RGB', + 'CONVERSION_SPECIFICATIONS_DATA', 'CONVERSION_GRAPH_NODE_LABELS', + 'CONVERSION_SPECIFICATIONS', 'CONVERSION_GRAPH', + 'describe_conversion_path', 'convert' +] + + +class ConversionSpecification( + namedtuple('ConversionSpecification', + ('source', 'target', 'conversion_function'))): + """ + Conversion specification for *Colour* graph for automatic colour + conversion describing two nodes and the edge in the graph. + + Parameters + ---------- + source : unicode + Source node in the graph. + target : array_like + Target node in the graph. + conversion_function : callable + Callable converting from the ``source`` node to the ``target`` node. + """ + + def __new__(cls, source=None, target=None, conversion_function=None): + return super(ConversionSpecification, cls).__new__( + cls, source.lower(), target.lower(), conversion_function) + + +def CIECAM02_to_JMh_CIECAM02(CIECAM02_specification): + """ + Converts from *CIECAM02* specification to *CIECAM02* :math:`JMh` + correlates. + + Parameters + ---------- + CIECAM02_specification : CIECAM02_Specification + *CIECAM02* colour appearance model specification. + + Returns + ------- + ndarray + *CIECAM02* :math:`JMh` correlates. + + Examples + -------- + >>> specification = CIECAM02_Specification(J=41.731091132513917, + ... M=0.108842175669226, + ... h=219.048432658311780) + >>> CIECAM02_to_JMh_CIECAM02(specification) # doctest: +ELLIPSIS + array([ 4.1731091...e+01, 1.0884217...e-01, 2.1904843...e+02]) + """ + + return tstack([ + CIECAM02_specification.J, + CIECAM02_specification.M, + CIECAM02_specification.h, + ]) + + +def JMh_CIECAM02_to_CIECAM02(JMh): + """ + Converts from *CIECAM02* :math:`JMh` correlates to *CIECAM02* + specification. + + Parameters + ---------- + JMh : array_like + *CIECAM02* :math:`JMh` correlates. + + Returns + ------- + CIECAM02_Specification + *CIECAM02* colour appearance model specification. + + Examples + -------- + >>> JMh = np.array([4.17310911e+01, 1.08842176e-01, 2.19048433e+02]) + >>> JMh_CIECAM02_to_CIECAM02(JMh) # doctest: +ELLIPSIS + CIECAM02_Specification(J=41.7310911..., C=None, h=219.0484329..., s=None, \ +Q=None, M=0.1088421..., H=None, HC=None) + """ + + J, M, h = tsplit(JMh) + + return CIECAM02_Specification(J=J, M=M, h=h) + + +def CAM16_to_JMh_CAM16(CAM16_specification): + """ + Converts from *CAM16* specification to *CAM16* :math:`JMh` correlates. + + Parameters + ---------- + CAM16_specification : CAM16_Specification + *CAM16* colour appearance model specification. + + Returns + ------- + ndarray + *CAM16* :math:`JMh` correlates. + + Examples + -------- + >>> specification = CAM16_Specification(J=41.731207905126638, + ... M=0.107436772335905, + ... h=217.067959767393010) + >>> CAM16_to_JMh_CAM16(specification) # doctest: +ELLIPSIS + array([ 4.1731207...e+01, 1.0743677...e-01, 2.1706796...e+02]) + """ + + return tstack([ + CAM16_specification.J, + CAM16_specification.M, + CAM16_specification.h, + ]) + + +def JMh_CAM16_to_CAM16(JMh): + """ + Converts from *CAM6* :math:`JMh` correlates to *CAM6* specification. + + Parameters + ---------- + JMh : array_like + *CAM6* :math:`JMh` correlates. + + Returns + ------- + CAM6_Specification + *CAM6* colour appearance model specification. + + Examples + -------- + >>> JMh = np.array([4.17312079e+01, 1.07436772e-01, 2.17067960e+02]) + >>> JMh_CAM16_to_CAM16(JMh) # doctest: +ELLIPSIS + CAM16_Specification(J=41.7312079..., C=None, h=217.06796..., s=None, \ +Q=None, M=0.1074367..., H=None, HC=None) + """ + + J, M, h = tsplit(JMh) + + return CAM16_Specification(J=J, M=M, h=h) + + +def XYZ_to_luminance(XYZ): + """ + Converts from *CIE XYZ* tristimulus values to *luminance* :math:`Y`. + + Parameters + ---------- + XYZ : array_like + *CIE XYZ* tristimulus values. + + Returns + ------- + array_like + *Luminance* :math:`Y`. + + Examples + -------- + >>> XYZ = np.array([0.20654008, 0.12197225, 0.05136952]) + >>> XYZ_to_luminance(XYZ) # doctest: +ELLIPSIS + 0.1219722... + """ + + _X, Y, _Z = tsplit(XYZ) + + return Y + + +def RGB_luminance_to_RGB(Y): + """ + Converts from *luminance* :math:`Y` to *RGB*. + + Parameters + ---------- + Y : array_like + *Luminance* :math:`Y`. + + Returns + ------- + array_like + *RGB*. + + Examples + -------- + >>> RGB_luminance_to_RGB(0.123014562384318) # doctest: +ELLIPSIS + array([ 0.1230145..., 0.1230145..., 0.1230145...]) + """ + + return tstack([Y, Y, Y]) + + +_DEFAULT_ILLUMINANT = 'D65' +""" +Default automatic colour conversion graph illuminant name. + +_DEFAULT_ILLUMINANT : unicode +""" + +_DEFAULT_ILLUMINANT_SD = ILLUMINANTS_SDS[_DEFAULT_ILLUMINANT] +""" +Default automatic colour conversion graph illuminant spectral distribution. + +_DEFAULT_ILLUMINANT_SD : SpectralDistribution +""" + +_DEFAULT_ILLUMINANT_XY = ILLUMINANTS['CIE 1931 2 Degree Standard Observer'][ + _DEFAULT_ILLUMINANT] +""" +Default automatic colour conversion graph illuminant *CIE xy* chromaticity +coordinates. + +_DEFAULT_ILLUMINANT_XY : ndarray +""" + +_DEFAULT_ILLUMINANT_XYZ = xy_to_XYZ(_DEFAULT_ILLUMINANT_XY) +""" +Default automatic colour conversion graph illuminant *CIE XYZ* tristimulus +values. + +_DEFAULT_ILLUMINANT_XYZ : ndarray +""" + +_DEFAULT_RGB_COLOURSPACE = sRGB_COLOURSPACE +""" +Default automatic colour conversion graph *RGB* colourspace. + +_DEFAULT_RGB_COLOURSPACE : RGB_COLOURSPACE +""" + +CONVERSION_SPECIFICATIONS_DATA = [ + # Colorimetry + ('Spectral Distribution', 'CIE XYZ', + partial(sd_to_XYZ, illuminant=_DEFAULT_ILLUMINANT_SD)), + ('CIE XYZ', 'Spectral Distribution', XYZ_to_sd), + ('Spectral Distribution', 'Luminous Flux', luminous_flux), + ('Spectral Distribution', 'Luminous Efficiency', luminous_efficiency), + ('Spectral Distribution', 'Luminous Efficacy', luminous_efficacy), + ('CIE XYZ', 'Luminance', XYZ_to_luminance), + ('Luminance', 'Lightness', lightness), + ('Lightness', 'Luminance', luminance), + ('CIE XYZ', 'Whiteness', partial(whiteness, + XYZ_0=_DEFAULT_ILLUMINANT_XYZ)), + ('CIE XYZ', 'Yellowness', yellowness), + ('CIE xy', 'Colorimetric Purity', + partial(colorimetric_purity, xy_n=_DEFAULT_ILLUMINANT_XY)), + ('CIE xy', 'Complementary Wavelength', + partial(complementary_wavelength, xy_n=_DEFAULT_ILLUMINANT_XY)), + ('CIE xy', 'Dominant Wavelength', + partial(dominant_wavelength, xy_n=_DEFAULT_ILLUMINANT_XY)), + ('CIE xy', 'Excitation Purity', + partial(excitation_purity, xy_n=_DEFAULT_ILLUMINANT_XY)), + ('Wavelength', 'CIE XYZ', wavelength_to_XYZ), + # Colour Models + ('CIE XYZ', 'CIE xyY', XYZ_to_xyY), + ('CIE xyY', 'CIE XYZ', xyY_to_XYZ), + ('CIE xyY', 'CIE xy', xyY_to_xy), + ('CIE xy', 'CIE xyY', xy_to_xyY), + ('CIE XYZ', 'CIE xy', XYZ_to_xy), + ('CIE xy', 'CIE XYZ', xy_to_XYZ), + ('CIE XYZ', 'CIE Lab', XYZ_to_Lab), + ('CIE Lab', 'CIE XYZ', Lab_to_XYZ), + ('CIE Lab', 'CIE LCHab', Lab_to_LCHab), + ('CIE LCHab', 'CIE Lab', LCHab_to_Lab), + ('CIE XYZ', 'CIE Luv', XYZ_to_Luv), + ('CIE Luv', 'CIE XYZ', Luv_to_XYZ), + ('CIE Luv', 'CIE Luv uv', Luv_to_uv), + ('CIE Luv uv', 'CIE Luv', uv_to_Luv), + ('CIE Luv uv', 'CIE xy', Luv_uv_to_xy), + ('CIE xy', 'CIE Luv uv', xy_to_Luv_uv), + ('CIE Luv', 'CIE LCHuv', Luv_to_LCHuv), + ('CIE LCHuv', 'CIE Luv', LCHuv_to_Luv), + ('CIE XYZ', 'CIE UCS', XYZ_to_UCS), + ('CIE UCS', 'CIE XYZ', UCS_to_XYZ), + ('CIE UCS', 'CIE UCS uv', UCS_to_uv), + ('CIE UCS uv', 'CIE UCS', uv_to_UCS), + ('CIE UCS uv', 'CIE xy', UCS_uv_to_xy), + ('CIE xy', 'CIE UCS uv', xy_to_UCS_uv), + ('CIE XYZ', 'CIE UVW', XYZ_to_UVW), + ('CIE UVW', 'CIE XYZ', UVW_to_XYZ), + ('CIE Lab', 'DIN99', Lab_to_DIN99), + ('DIN99', 'CIE Lab', DIN99_to_Lab), + ('CIE XYZ', 'hdr CIELab', XYZ_to_hdr_CIELab), + ('hdr CIELab', 'CIE XYZ', hdr_CIELab_to_XYZ), + ('CIE XYZ', 'Hunter Lab', + partial( + XYZ_to_Hunter_Lab, + XYZ_n=HUNTERLAB_ILLUMINANTS['CIE 1931 2 Degree Standard Observer'] + ['D65'].XYZ_n / 100)), + ('Hunter Lab', 'CIE XYZ', + partial( + Hunter_Lab_to_XYZ, + XYZ_n=HUNTERLAB_ILLUMINANTS['CIE 1931 2 Degree Standard Observer'] + ['D65'].XYZ_n / 100)), + ('CIE XYZ', 'Hunter Rdab', + partial( + XYZ_to_Hunter_Rdab, + XYZ_n=HUNTERLAB_ILLUMINANTS['CIE 1931 2 Degree Standard Observer'] + ['D65'].XYZ_n / 100)), + ('Hunter Rdab', 'CIE XYZ', + partial( + Hunter_Rdab_to_XYZ, + XYZ_n=HUNTERLAB_ILLUMINANTS['CIE 1931 2 Degree Standard Observer'] + ['D65'].XYZ_n / 100)), + ('CIE XYZ', 'IPT', XYZ_to_IPT), + ('IPT', 'CIE XYZ', IPT_to_XYZ), + ('CIE XYZ', 'JzAzBz', XYZ_to_JzAzBz), + ('JzAzBz', 'CIE XYZ', JzAzBz_to_XYZ), + ('CIE XYZ', 'hdr IPT', XYZ_to_hdr_IPT), + ('hdr IPT', 'CIE XYZ', hdr_IPT_to_XYZ), + ('CIE XYZ', 'OSA UCS', XYZ_to_OSA_UCS), + ('OSA UCS', 'CIE XYZ', OSA_UCS_to_XYZ), + # RGB Colour Models + ('CIE XYZ', 'RGB', + partial( + XYZ_to_RGB, + illuminant_XYZ=_DEFAULT_RGB_COLOURSPACE.whitepoint, + illuminant_RGB=_DEFAULT_RGB_COLOURSPACE.whitepoint, + XYZ_to_RGB_matrix=_DEFAULT_RGB_COLOURSPACE.XYZ_to_RGB_matrix)), + ('RGB', 'CIE XYZ', + partial( + RGB_to_XYZ, + illuminant_RGB=_DEFAULT_RGB_COLOURSPACE.whitepoint, + illuminant_XYZ=_DEFAULT_RGB_COLOURSPACE.whitepoint, + RGB_to_XYZ_matrix=_DEFAULT_RGB_COLOURSPACE.RGB_to_XYZ_matrix)), + ('RGB', 'RGB', + partial( + RGB_to_RGB, + input_colourspace=_DEFAULT_RGB_COLOURSPACE, + output_colourspace=_DEFAULT_RGB_COLOURSPACE)), + ('RGB', 'HSV', RGB_to_HSV), + ('HSV', 'RGB', HSV_to_RGB), + ('RGB', 'HSL', RGB_to_HSL), + ('HSL', 'RGB', HSL_to_RGB), + ('CMY', 'RGB', CMY_to_RGB), + ('RGB', 'CMY', RGB_to_CMY), + ('CMY', 'CMYK', CMY_to_CMYK), + ('CMYK', 'CMY', CMYK_to_CMY), + ('RGB', 'RGB Luminance', + partial( + RGB_luminance, + primaries=_DEFAULT_RGB_COLOURSPACE.primaries, + whitepoint=_DEFAULT_RGB_COLOURSPACE.whitepoint)), + ('RGB Luminance', 'RGB', RGB_luminance_to_RGB), + ('RGB', 'ICTCP', RGB_to_ICTCP), + ('ICTCP', 'RGB', ICTCP_to_RGB), + ('RGB', 'Prismatic', RGB_to_Prismatic), + ('Prismatic', 'RGB', Prismatic_to_RGB), + ('Output-Referred RGB', 'YCbCr', RGB_to_YCbCr), + ('YCbCr', 'Output-Referred RGB', YCbCr_to_RGB), + ('RGB', 'YcCbcCrc', RGB_to_YcCbcCrc), + ('YcCbcCrc', 'RGB', YcCbcCrc_to_RGB), + ('Output-Referred RGB', 'YCoCg', RGB_to_YCoCg), + ('YCoCg', 'Output-Referred RGB', YCoCg_to_RGB), + ('RGB', 'Output-Referred RGB', cctf_encoding), + ('Output-Referred RGB', 'RGB', cctf_decoding), + ('Scene-Referred RGB', 'Output-Referred RGB', cctf_encoding), + ('Output-Referred RGB', 'Scene-Referred RGB', cctf_decoding), + ('CIE XYZ', 'sRGB', XYZ_to_sRGB), + ('sRGB', 'CIE XYZ', sRGB_to_XYZ), + # Colour Notation Systems + ('Output-Referred RGB', 'Hexadecimal', RGB_to_HEX), + ('Hexadecimal', 'Output-Referred RGB', HEX_to_RGB), + ('CIE xyY', 'Munsell Colour', xyY_to_munsell_colour), + ('Munsell Colour', 'CIE xyY', munsell_colour_to_xyY), + ('Luminance', 'Munsell Value', munsell_value), + ('Munsell Value', 'Luminance', partial(luminance, method='ASTM D1535')), + # Colour Quality + ('Spectral Distribution', 'CRI', colour_rendering_index), + ('Spectral Distribution', 'CQS', colour_quality_scale), + # Colour Temperature + ('CCT', 'CIE UCS uv', CCT_to_uv), + ('CCT', 'CIE xy', CCT_to_xy), + ('CIE UCS uv', 'CCT', uv_to_CCT), + ('CIE xy', 'CCT', xy_to_CCT), + # Advanced Colorimetry + ('CIE XYZ', 'Hunt', + partial( + XYZ_to_Hunt, + XYZ_w=_DEFAULT_ILLUMINANT_XYZ, + XYZ_b=_DEFAULT_ILLUMINANT_XYZ, + L_A=80 * 0.2)), + ('CIE XYZ', 'ATD95', + partial( + XYZ_to_ATD95, + XYZ_0=_DEFAULT_ILLUMINANT_XYZ, + Y_0=80 * 0.2, + k_1=0, + k_2=(15 + 50) / 2)), + ('CIE XYZ', 'CIECAM02', + partial( + XYZ_to_CIECAM02, + XYZ_w=_DEFAULT_ILLUMINANT_XYZ, + L_A=64 / np.pi * 0.2, + Y_b=20)), + ('CIECAM02', 'CIE XYZ', + partial( + CIECAM02_to_XYZ, + XYZ_w=_DEFAULT_ILLUMINANT_XYZ, + L_A=64 / np.pi * 0.2, + Y_b=20)), + ('CIECAM02', 'CIECAM02 JMh', CIECAM02_to_JMh_CIECAM02), + ('CIECAM02 JMh', 'CIECAM02', JMh_CIECAM02_to_CIECAM02), + ('CIE XYZ', 'CAM16', + partial( + XYZ_to_CAM16, + XYZ_w=_DEFAULT_ILLUMINANT_XYZ, + L_A=64 / np.pi * 0.2, + Y_b=20)), + ('CAM16', 'CIE XYZ', + partial( + CAM16_to_XYZ, + XYZ_w=_DEFAULT_ILLUMINANT_XYZ, + L_A=64 / np.pi * 0.2, + Y_b=20)), + ('CAM16', 'CAM16 JMh', CAM16_to_JMh_CAM16), + ('CAM16 JMh', 'CAM16', JMh_CAM16_to_CAM16), + ('CIE XYZ', 'LLAB', + partial(XYZ_to_LLAB, XYZ_0=_DEFAULT_ILLUMINANT_XYZ, Y_b=80 * 0.2, L=80)), + ('CIE XYZ', 'Nayatani95', + partial( + XYZ_to_Nayatani95, + XYZ_n=_DEFAULT_ILLUMINANT_XYZ, + Y_o=0.2, + E_o=1000, + E_or=1000)), + ('CIE XYZ', 'RLAB', XYZ_to_RLAB), + ('CIECAM02 JMh', 'CAM02LCD', JMh_CIECAM02_to_CAM02LCD), + ('CAM02LCD', 'CIECAM02 JMh', CAM02LCD_to_JMh_CIECAM02), + ('CIECAM02 JMh', 'CAM02SCD', JMh_CIECAM02_to_CAM02SCD), + ('CAM02SCD', 'CIECAM02 JMh', CAM02SCD_to_JMh_CIECAM02), + ('CIECAM02 JMh', 'CAM02UCS', JMh_CIECAM02_to_CAM02UCS), + ('CAM02UCS', 'CIECAM02 JMh', CAM02UCS_to_JMh_CIECAM02), + ('CAM16 JMh', 'CAM16LCD', JMh_CAM16_to_CAM16LCD), + ('CAM16LCD', 'CAM16 JMh', CAM16LCD_to_JMh_CAM16), + ('CAM16 JMh', 'CAM16SCD', JMh_CAM16_to_CAM16SCD), + ('CAM16SCD', 'CAM16 JMh', CAM16SCD_to_JMh_CAM16), + ('CAM16 JMh', 'CAM16UCS', JMh_CAM16_to_CAM16UCS), + ('CAM16UCS', 'CAM16 JMh', CAM16UCS_to_JMh_CAM16), +] +""" +Automatic colour conversion graph specifications data describing two nodes and +the edge in the graph. + +CONVERSION_SPECIFICATIONS_DATA : list +""" + +CONVERSION_SPECIFICATIONS = [ + ConversionSpecification(*specification) + for specification in CONVERSION_SPECIFICATIONS_DATA +] +""" +Automatic colour conversion graph specifications describing two nodes and +the edge in the graph. + +CONVERSION_SPECIFICATIONS : list +""" + +CONVERSION_GRAPH_NODE_LABELS = { + specification[0].lower(): specification[0] + for specification in CONVERSION_SPECIFICATIONS_DATA +} +""" +Automatic colour conversion graph node labels. + +CONVERSION_GRAPH_NODE_LABELS : dict +""" + +CONVERSION_GRAPH_NODE_LABELS.update({ + specification[1].lower(): specification[1] + for specification in CONVERSION_SPECIFICATIONS_DATA +}) + + +def _build_graph(): + """ + Builds the automatic colour conversion graph. + + Returns + ------- + DiGraph + Automatic colour conversion graph. + """ + + graph = nx.DiGraph() + + for specification in CONVERSION_SPECIFICATIONS: + graph.add_edge( + specification.source, + specification.target, + conversion_function=specification.conversion_function) + + return graph + + +CONVERSION_GRAPH = _build_graph() if is_networkx_installed() else None +""" +Automatic colour conversion graph. + +CONVERSION_GRAPH : DiGraph +""" + + +def _conversion_path(source, target): + """ + Returns the conversion path from the source node to the target node in the + automatic colour conversion graph. + + Parameters + ---------- + source : unicode + Source node. + target : unicode + Target node. + + Returns + ------- + list + Conversion path from the source node to the target node, i.e. a list of + conversion function callables. + + Examples + -------- + >>> _conversion_path('cie lab', 'cct') + ... # doctest: +ELLIPSIS + [, , \ +] + """ + if is_networkx_installed(raise_exception=True): # pragma: no cover + path = nx.shortest_path(CONVERSION_GRAPH, source, target) + + return [ + CONVERSION_GRAPH.get_edge_data(a, b)['conversion_function'] + for a, b in zip(path[:-1], path[1:]) + ] + + +def _lower_order_function(callable_): + """ + Returns the lower order function associated with given callable, i.e. + the function wrapped by a partial object. + + Parameters + ---------- + callable_ : callable + Callable to return the lower order function. + + Returns + ------- + callable + Lower order function or given callable if no lower order function + exists. + """ + + return callable_.func if isinstance(callable_, partial) else callable_ + + +def describe_conversion_path(source, + target, + mode='Short', + width=79, + padding=3, + print_callable=print, + **kwargs): + """ + Describes the conversion path from source colour representation to target + colour representation using the automatic colour conversion graph. + + Parameters + ---------- + source : unicode + Source colour representation, i.e. the source node in the automatic + colour conversion graph. + target : unicode + Target colour representation, i.e. the target node in the automatic + colour conversion graph. + mode : unicode, optional + **{'Short', 'Long', 'Extended'}**, + Verbose mode: *Short* describes the conversion path, *Long* provides + details about the arguments, definitions signatures and output values, + *Extended* appends the definitions documentation. + width : int, optional + Message box width. + padding : unicode, optional + Padding on each sides of the message. + print_callable : callable, optional + Callable used to print the message box. + + Other Parameters + ---------------- + \\**kwargs : dict, optional + {:func:`colour.convert`}, + Please refer to the documentation of the previously listed definition. + + Examples + -------- + >>> describe_conversion_path('Spectral Distribution', 'sRGB', width=75) + =========================================================================== + * * + * [ Conversion Path ] * + * * + * "sd_to_XYZ" --> "XYZ_to_sRGB" * + * * + =========================================================================== + """ + + try: # pragma: no cover + signature_inspection = inspect.signature + except AttributeError: # pragma: no cover + signature_inspection = inspect.getargspec + + source, target, mode = source.lower(), target.lower(), mode.lower() + width = (79 + 2 + 2 * 3 - 4) if mode == 'extended' else width + + conversion_path = _conversion_path(source, target) + + message_box( + '[ Conversion Path ]\n\n{0}'.format(' --> '.join([ + '"{0}"'.format( + _lower_order_function(conversion_function).__name__) + for conversion_function in conversion_path + ])), width, padding, print_callable) + + for conversion_function in conversion_path: + conversion_function_name = _lower_order_function( + conversion_function).__name__ + + # Filtering compatible keyword arguments passed directly and + # irrespective of any conversion function name. + filtered_kwargs = filter_kwargs(conversion_function, **kwargs) + + # Filtering keyword arguments passed as dictionary with the + # conversion function name. + filtered_kwargs.update(kwargs.get(conversion_function_name, {})) + + return_value = filtered_kwargs.pop('return', None) + + if mode in ('long', 'extended'): + message = ( + '[ "{0}" ]' + '\n\n[ Signature ]\n\n{1}').format( + _lower_order_function(conversion_function).__name__, + pformat( + signature_inspection( + _lower_order_function(conversion_function)))) + + if filtered_kwargs: + message += '\n\n[ Filtered Arguments ]\n\n{0}'.format( + pformat(filtered_kwargs)) + + if mode in ('extended', ): + message += '\n\n[ Documentation ]\n\n{0}'.format( + textwrap.dedent( + str( + _lower_order_function(conversion_function) + .__doc__)).strip()) + + if return_value is not None: + message += '\n\n[ Conversion Output ]\n\n{0}'.format( + return_value) + + message_box(message, width, padding, print_callable) + + +@domain_range_scale('1') +def convert(a, source, target, **kwargs): + """ + Converts given object :math:`a` from source colour representation to target + colour representation using the automatic colour conversion graph. + + The conversion is performed by finding the shortest path in a + `NetworkX `_ :class:`DiGraph` class instance. + + The conversion path adopts the **'1'** domain-range scale and the object + :math:`a` is expected to be *soft* normalised accordingly. For example, + *CIE XYZ* tristimulus values arguments for use with the *CAM16* colour + appearance model should be in domain `[0, 1]` instead of the domain + `[0, 100]` used with the **'Reference'** domain-range scale. The arguments + are typically converted as follows: + + - *Scalars* in domain-range `[0, 10]`, e.g *Munsell Value* are + scaled by *10*. + - *Percentages* in domain-range `[0, 100]` are scaled by *100*. + - *Degrees* in domain-range `[0, 360]` are scaled by *360*. + - *Integers* in domain-range `[0, 2**n -1]` where `n` is the bit + depth are scaled by *2**n -1*. + + See the `Domain-Range Scales <../basics.html#domain-range-scales>`_ page + for more information. + + Parameters + ---------- + a : array_like or numeric or SpectralDistribution + Object :math:`a` to convert. If :math:`a` represents a reflectance, + transmittance or absorptance value, the expectation is that it is + viewed under *CIE Standard Illuminant D Series* *D65*. The illuminant + can be changed on a per definition basis along the conversion path. + source : unicode + Source colour representation, i.e. the source node in the automatic + colour conversion graph. + target : unicode + Target colour representation, i.e. the target node in the automatic + colour conversion graph. + + Other Parameters + ---------------- + \\**kwargs : dict, optional + {'\\*'}, + Please refer to the documentation of the supported conversion + definitions. + + Arguments for the conversion definitions are passed as keyword + arguments whose names is those of the conversion definitions and values + set as dictionaries. For example, in the conversion from spectral + distribution to *sRGB* colourspace, passing arguments to the + :func:`colour.sd_to_XYZ` definition is done as follows:: + + convert(sd, 'Spectral Distribution', 'sRGB', sd_to_XYZ={\ +'illuminant': ILLUMINANTS_SDS['FL2']}) + + It is also possible to pass keyword arguments directly to the various + conversion definitions irrespective of their name. This is + ``dangerous`` and could cause unexpected behaviour because of + unavoidable discrepancies with the underlying + :func:`colour.utilities.filter_kwargs` definition between Python 2.7 + and 3.x. Using this direct keyword arguments passing mechanism might + also ends up passing incompatible arguments to a given conversion + definition. Consider the following conversion:: + + convert(sd, 'Spectral Distribution', 'sRGB', 'illuminant': \ +ILLUMINANTS_SDS['FL2']) + + Because both the :func:`colour.sd_to_XYZ` and + :func:`colour.XYZ_to_sRGB` definitions have an *illuminant* argument, + `ILLUMINANTS_SDS['FL2']` will be passed to both of them and will raise + an exception in the :func:`colour.XYZ_to_sRGB` definition. This will + be addressed in the future by either catching the exception and trying + a new time without the keyword argument or more elegantly via type + checking. + + With that in mind, this mechanism offers some good benefits: For + example, it allows defining a conversion from *CIE XYZ* colourspace to + *n* different colour models while passing an illuminant argument but + without having to explicitly define all the explicit conversion + definition arguments:: + + a = np.array([0.20654008, 0.12197225, 0.05136952]) + illuminant = ILLUMINANTS['CIE 1931 2 Degree Standard Observer']\ +['D65'] + for model in ('CIE xyY', 'CIE Lab'): + convert(a, 'CIE XYZ', model, illuminant=illuminant) + + Instead of:: + + for model in ('CIE xyY', 'CIE Lab'): + convert(a, 'CIE XYZ', model, XYZ_to_xyY={'illuminant': \ +illuminant}, XYZ_to_Lab={'illuminant': illuminant}) + + Mixing both approaches is possible for the brevity benefits. It is made + possible because the keyword arguments directly passed are filtered + first and then the resulting dict is updated with the explicit + conversion definition arguments:: + + illuminant = ILLUMINANTS['CIE 1931 2 Degree Standard Observer']\ +['D65'] + convert(sd, 'Spectral Distribution', 'sRGB', 'illuminant': \ +ILLUMINANTS_SDS['FL2'], XYZ_to_sRGB={'illuminant': illuminant}) + + For inspection purposes, verbose is enabled by passing arguments to the + :func:`colour.describe_conversion_path` definition via the ``verbose`` + keyword argument as follows:: + + convert(sd, 'Spectral Distribution', 'sRGB', \ +verbose={'mode': 'Long'}) + + Returns + ------- + ndarray or numeric or SpectralDistribution + Converted object :math:`a`. + + Warnings + -------- + The domain-range scale is **'1'** and cannot be changed. + + Notes + ----- + - Various defaults have been systematically adopted compared to the + low-level *Colour* API: + + - The default illuminant for the computation is + *CIE Standard Illuminant D Series* *D65*. It can be changed on a + per definition basis along the conversion path. + - The default *RGB* colourspace is the *sRGB* colourspace. It can + also be changed on a per definition basis along the conversion + path. + - Most of the colour appearance models have defaults set according to + *IEC 61966-2-1:1999* viewing conditions, i.e. *sRGB* 64 Lux ambiant + illumination, 80 :math:`cd/m^2`, adapting field luminance about + 20% of a white object in the scene. + + - The **RGB** colour representation is assumed to be linear and + representing *scene-referred* imagery. To convert such *RGB* values to + *output-referred* (*display-referred*) imagery, i.e. encode the *RGB* + values using an encoding colour component transfer function + (Encoding CCTF) / opto-electronic transfer function (OETF / OECF), the + **Output-Referred RGB** representation must be used. + + Examples + -------- + >>> from colour import COLOURCHECKERS_SDS + >>> sd = COLOURCHECKERS_SDS['ColorChecker N Ohta']['dark skin'] + >>> convert(sd, 'Spectral Distribution', 'sRGB', + ... verbose={'mode': 'Short', 'width': 75}) + ... # doctest: +ELLIPSIS + =========================================================================== + * * + * [ Conversion Path ] * + * * + * "sd_to_XYZ" --> "XYZ_to_sRGB" * + * * + =========================================================================== + array([ 0.4567579..., 0.3098698..., 0.2486192...]) + >>> illuminant = ILLUMINANTS_SDS['FL2'] + >>> convert(sd, 'Spectral Distribution', 'sRGB', + ... sd_to_XYZ={'illuminant': illuminant}) + ... # doctest: +ELLIPSIS + array([ 0.4792457..., 0.3167696..., 0.1736272...]) + >>> a = np.array([0.45675795, 0.30986982, 0.24861924]) + >>> convert(a, 'Output-Referred RGB', 'CAM16UCS') + ... # doctest: +ELLIPSIS + array([ 0.3999481..., 0.0920655..., 0.0812752...]) + >>> a = np.array([0.39994811, 0.09206558, 0.08127526]) + >>> convert(a, 'CAM16UCS', 'sRGB', verbose={'mode': 'Short', 'width': 75}) + ... # doctest: +ELLIPSIS + =========================================================================== + * * + * [ Conversion Path ] * + * * + * "UCS_Luo2006_to_JMh_CIECAM02" --> "JMh_CAM16_to_CAM16" --> * + * "CAM16_to_XYZ" --> "XYZ_to_sRGB" * + * * + =========================================================================== + array([ 0.4567576..., 0.3098826..., 0.2486222...]) + """ + + # TODO: Remove the following warning whenever the automatic colour + # conversion graph implementation is considered stable. + usage_warning( + 'The "Automatic Colour Conversion Graph" is a beta feature, be ' + 'mindful of this when using it. Please report any unexpected ' + 'behaviour and do not hesitate to ask any questions should they arise.' + '\nThis warning can be disabled with the ' + '"colour.utilities.suppress_warnings" context manager as follows:\n' + 'with colour.utilities.suppress_warnings(colour_usage_warnings=True): ' + '\n convert(*args, **kwargs)') + + source, target = source.lower(), target.lower() + + conversion_path = _conversion_path(source, target) + + verbose_kwargs = copy(kwargs) + for conversion_function in conversion_path: + conversion_function_name = _lower_order_function( + conversion_function).__name__ + + # Filtering compatible keyword arguments passed directly and + # irrespective of any conversion function name. + filtered_kwargs = filter_kwargs(conversion_function, **kwargs) + + # Filtering keyword arguments passed as dictionary with the + # conversion function name. + filtered_kwargs.update(kwargs.get(conversion_function_name, {})) + + a = conversion_function(a, **filtered_kwargs) + + if conversion_function_name in verbose_kwargs: + verbose_kwargs[conversion_function_name]['return'] = a + else: + verbose_kwargs[conversion_function_name] = {'return': a} + + if 'verbose' in verbose_kwargs: + verbose_kwargs.update(verbose_kwargs.pop('verbose')) + describe_conversion_path(source, target, **verbose_kwargs) + + return a diff --git a/colour/graph/tests/__init__.py b/colour/graph/tests/__init__.py new file mode 100644 index 0000000000..40a96afc6f --- /dev/null +++ b/colour/graph/tests/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/colour/graph/tests/test_conversion.py b/colour/graph/tests/test_conversion.py new file mode 100644 index 0000000000..97127a1a19 --- /dev/null +++ b/colour/graph/tests/test_conversion.py @@ -0,0 +1,119 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.graph.conversion` module. +""" + +from __future__ import division, unicode_literals + +import numpy as np +import six +import unittest + +from colour import COLOURCHECKERS_SDS, ILLUMINANTS, ILLUMINANTS_SDS +from colour.graph import describe_conversion_path, convert + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = ['TestDescribeConversionPath', 'TestConvert'] + + +class TestDescribeConversionPath(unittest.TestCase): + """ + Defines :func:`colour.graph.conversion.describe_conversion_path` definition + unit tests methods. + """ + + def test_describe_conversion_path(self): + """ + Tests :func:`colour.graph.conversion.describe_conversion_path` + definition. + """ + + describe_conversion_path('Spectral Distribution', 'sRGB') + + describe_conversion_path('Spectral Distribution', 'sRGB', mode='Long') + + describe_conversion_path( + 'Spectral Distribution', + 'sRGB', + mode='Extended', + sd_to_XYZ={ + 'illuminant': ILLUMINANTS_SDS['FL2'], + 'return': np.array([0.47924575, 0.31676968, 0.17362725]) + }) + + +class TestConvert(unittest.TestCase): + """ + Defines :func:`colour.graph.conversion.convert` definition unit tests + methods. + """ + + def test_convert(self): + """ + Tests :func:`colour.graph.conversion.convert` definition. + """ + + RGB_a = convert(COLOURCHECKERS_SDS['ColorChecker N Ohta']['dark skin'], + 'Spectral Distribution', 'sRGB') + np.testing.assert_almost_equal( + RGB_a, np.array([0.45675795, 0.30986982, 0.24861924]), decimal=7) + + Jpapbp = convert(RGB_a, 'Output-Referred RGB', 'CAM16UCS') + np.testing.assert_almost_equal( + Jpapbp, np.array([0.39994810, 0.09206557, 0.08127526]), decimal=7) + + RGB_b = convert( + Jpapbp, 'CAM16UCS', 'sRGB', verbose={'mode': 'Extended'}) + # NOTE: The "CIE XYZ" tristimulus values to "sRGB" matrix is given + # rounded at 4 decimals as per "IEC 61966-2-1:1999" and thus preventing + # exact roundtrip. + np.testing.assert_allclose(RGB_a, RGB_b, rtol=1e-5, atol=1e-5) + + np.testing.assert_almost_equal( + convert('#808080', 'Hexadecimal', 'Scene-Referred RGB'), + np.array([0.21586050, 0.21586050, 0.21586050]), + decimal=7) + + self.assertAlmostEqual( + convert('#808080', 'Hexadecimal', 'RGB Luminance'), + 0.21586050, + places=7) + + np.testing.assert_almost_equal( + convert( + convert( + np.array([0.5, 0.5, 0.5]), 'Output-Referred RGB', + 'Scene-Referred RGB'), 'RGB', 'YCbCr'), + np.array([0.49215686, 0.50196078, 0.50196078]), + decimal=7) + + def test_convert_direct_keyword_argument_passing(self): + """ + Tests :func:`colour.graph.conversion.convert` definition behaviour when + direct keyword arguments are passed. + """ + + a = np.array([0.20654008, 0.12197225, 0.05136952]) + illuminant = ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D50'] + np.testing.assert_almost_equal( + convert( + a, 'CIE XYZ', 'CIE xyY', + XYZ_to_xyY={'illuminant': illuminant}), + convert(a, 'CIE XYZ', 'CIE xyY', illuminant=illuminant), + decimal=7) + + if six.PY3: # pragma: no cover + self.assertRaises(AttributeError, lambda: convert( + COLOURCHECKERS_SDS['ColorChecker N Ohta']['dark skin'], + 'Spectral Distribution', 'sRGB', + illuminant=illuminant)) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/io/__init__.py b/colour/io/__init__.py index 06fa4fdbc9..01183538c3 100644 --- a/colour/io/__init__.py +++ b/colour/io/__init__.py @@ -5,14 +5,22 @@ from .ies_tm2714 import SpectralDistribution_IESTM2714 from .luts import * # noqa from . import luts -from .image import ImageAttribute_Specification, read_image, write_image +from .image import ImageAttribute_Specification, convert_bit_depth +from .image import read_image_OpenImageIO, write_image_OpenImageIO +from .image import read_image_Imageio, write_image_Imageio +from .image import READ_IMAGE_METHODS, WRITE_IMAGE_METHODS +from .image import read_image, write_image from .tabular import (read_spectral_data_from_csv_file, read_sds_from_csv_file, write_sds_to_csv_file) from .xrite import read_sds_from_xrite_file __all__ = ['SpectralDistribution_IESTM2714'] __all__ += luts.__all__ -__all__ += ['ImageAttribute_Specification', 'read_image', 'write_image'] +__all__ += ['ImageAttribute_Specification', 'convert_bit_depth'] +__all__ += ['read_image_OpenImageIO', 'write_image_OpenImageIO'] +__all__ += ['read_image_Imageio', 'write_image_Imageio'] +__all__ += ['READ_IMAGE_METHODS', 'WRITE_IMAGE_METHODS'] +__all__ += ['read_image', 'write_image'] __all__ += [ 'read_spectral_data_from_csv_file', 'read_sds_from_csv_file', 'write_sds_to_csv_file' diff --git a/colour/io/ies_tm2714.py b/colour/io/ies_tm2714.py index 358e2af75d..a9c57f7257 100644 --- a/colour/io/ies_tm2714.py +++ b/colour/io/ies_tm2714.py @@ -639,9 +639,7 @@ class SpectralDistribution_IESTM2714(SpectralDistribution): >>> from os.path import dirname, join >>> directory = join(dirname(__file__), 'tests', 'resources') >>> sd = SpectralDistribution_IESTM2714( - ... join(directory, 'Fluorescent.spdx')) - >>> sd.read() - True + ... join(directory, 'Fluorescent.spdx')).read() >>> sd.header.manufacturer 'Unknown' >>> # Doctests ellipsis for Python 2.x compatibility. @@ -949,9 +947,7 @@ def read(self): >>> from os.path import dirname, join >>> directory = join(dirname(__file__), 'tests', 'resources') >>> sd = SpectralDistribution_IESTM2714( - ... join(directory, 'Fluorescent.spdx')) - >>> sd.read() - True + ... join(directory, 'Fluorescent.spdx')).read() >>> sd.header.description 'Rare earth fluorescent lamp' >>> # Doctests ellipsis for Python 2.x compatibility. @@ -993,7 +989,7 @@ def read(self): self.wavelengths = wavelengths self.values = values - return True + return self def write(self): """ @@ -1011,9 +1007,7 @@ def write(self): >>> from tempfile import mkdtemp >>> directory = join(dirname(__file__), 'tests', 'resources') >>> sd = SpectralDistribution_IESTM2714( - ... join(directory, 'Fluorescent.spdx')) - >>> sd.read() - True + ... join(directory, 'Fluorescent.spdx')).read() >>> temporary_directory = mkdtemp() >>> sd.path = join(temporary_directory, 'Fluorescent.spdx') >>> sd.write() diff --git a/colour/io/image.py b/colour/io/image.py index 0f16ec00e9..7ac34b7dcd 100644 --- a/colour/io/image.py +++ b/colour/io/image.py @@ -9,11 +9,13 @@ from __future__ import division, unicode_literals import numpy as np +import platform from collections import namedtuple from six import string_types from colour.utilities import (CaseInsensitiveMapping, as_float_array, - is_openimageio_installed) + is_openimageio_installed, filter_kwargs, + usage_warning) __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -24,7 +26,9 @@ __all__ = [ 'BitDepth_Specification', 'ImageAttribute_Specification', - 'BIT_DEPTH_MAPPING', 'read_image', 'write_image' + 'convert_bit_depth', 'read_image_OpenImageIO', 'read_image_Imageio', + 'READ_IMAGE_METHODS', 'read_image', 'write_image_OpenImageIO', + 'write_image_Imageio', 'WRITE_IMAGE_METHODS', 'write_image' ] BitDepth_Specification = namedtuple( @@ -58,7 +62,7 @@ def __new__(cls, name, value, type_=None): cls, name, value, type_) -if is_openimageio_installed(): +if is_openimageio_installed(): # pragma: no cover from OpenImageIO import UINT8, UINT16, HALF, FLOAT BIT_DEPTH_MAPPING = CaseInsensitiveMapping({ @@ -69,9 +73,14 @@ def __new__(cls, name, value, type_=None): 'float16': BitDepth_Specification('float16', np.float16, HALF, 1, False), 'float32': - BitDepth_Specification('float32', np.float32, FLOAT, 1, False) + BitDepth_Specification('float32', np.float32, FLOAT, 1, False), + 'float64': + BitDepth_Specification('float64', np.float64, FLOAT, 1, False), }) -else: + if platform.system() not in ('Windows', 'Microsoft'): # pragma: no cover + BIT_DEPTH_MAPPING['float128'] = BitDepth_Specification( + 'float128', np.float128, FLOAT, 1, False) +else: # pragma: no cover BIT_DEPTH_MAPPING = CaseInsensitiveMapping({ 'uint8': BitDepth_Specification('uint8', np.uint8, None, 255, True), @@ -80,13 +89,88 @@ def __new__(cls, name, value, type_=None): 'float16': BitDepth_Specification('float16', np.float16, None, 1, False), 'float32': - BitDepth_Specification('float32', np.float32, None, 1, False) + BitDepth_Specification('float32', np.float32, None, 1, False), + 'float64': + BitDepth_Specification('float64', np.float64, None, 1, False), }) + if platform.system() not in ('Windows', 'Microsoft'): # pragma: no cover + BIT_DEPTH_MAPPING['float128'] = BitDepth_Specification( + 'float128', np.float128, None, 1, False) -def read_image(path, bit_depth='float32', attributes=False): +def convert_bit_depth(a, bit_depth='float32'): """ - Reads given image using *OpenImageIO*. + Converts given array to given bit depth, the current bit depth of the array + is used to determine the appropriate conversion path. + + Parameters + ---------- + a : array_like + Array to convert to given bit depth. + bit_depth : unicode + Bit depth. + + Returns + ------- + ndarray + Converted array. + + Examples + -------- + >>> a = np.array([0.0, 0.5, 1.0]) + >>> convert_bit_depth(a, 'uint8') + array([ 0, 128, 255], dtype=uint8) + >>> convert_bit_depth(a, 'uint16') + array([ 0, 32768, 65535], dtype=uint16) + >>> convert_bit_depth(a, 'float16') + array([ 0. , 0.5, 1. ], dtype=float16) + >>> a = np.array([0, 128, 255], dtype=np.uint8) + >>> convert_bit_depth(a, 'uint16') + array([ 0, 32896, 65535], dtype=uint16) + >>> convert_bit_depth(a, 'float32') # doctest: +ELLIPSIS + array([ 0. , 0.501960..., 1. ], dtype=float32) + """ + + a = np.asarray(a) + + bit_depths = ', '.join(sorted(BIT_DEPTH_MAPPING.keys())) + + assert bit_depth in bit_depths, ( + 'Incorrect bit depth was specified, it must be one of: "{0}"!'.format( + bit_depths)) + + assert str(a.dtype) in bit_depths, ( + 'Image bit depth must be one of: "{0}"!'.format(bit_depths)) + + source_dtype = str(a.dtype) + target_dtype = BIT_DEPTH_MAPPING[bit_depth].numpy + + if source_dtype == 'uint8': + if bit_depth == 'uint8': + return a + elif bit_depth == 'uint16': + return (a * 257).astype(target_dtype) + elif bit_depth in ('float16', 'float32', 'float64', 'float128'): + return (a / 255).astype(target_dtype) + elif source_dtype == 'uint16': + if bit_depth == 'uint8': + return (a / 257).astype(target_dtype) + elif bit_depth == 'uint16': + return a + elif bit_depth in ('float16', 'float32', 'float64', 'float128'): + return (a / 65535).astype(target_dtype) + elif source_dtype in ('float16', 'float32', 'float64', 'float128'): + if bit_depth == 'uint8': + return np.around(a * 255).astype(target_dtype) + elif bit_depth == 'uint16': + return np.around(a * 65535).astype(target_dtype) + elif bit_depth in ('float16', 'float32', 'float64', 'float128'): + return a.astype(target_dtype) + + +def read_image_OpenImageIO(path, bit_depth='float32', attributes=False): + """ + Reads the image at given path using *OpenImageIO*. Parameters ---------- @@ -94,14 +178,16 @@ def read_image(path, bit_depth='float32', attributes=False): Image path. bit_depth : unicode, optional **{'float32', 'uint8', 'uint16', 'float16'}**, - Image bit_depth. + Returned image bit depth, the bit depth conversion behaviour is driven + directly by *OpenImageIO*, this definition only converts to the + relevant data type after reading. attributes : bool, optional Whether to return the image attributes. Returns ------- - ndarray - Image as a ndarray. + ndarray or tuple + Image as a ndarray or tuple of image as ndarray and list of attributes Notes ----- @@ -110,16 +196,18 @@ def read_image(path, bit_depth='float32', attributes=False): Examples -------- >>> import os - >>> path = os.path.join('tests', 'resources', 'CMSTestPattern.exr') + >>> import colour + >>> path = os.path.join(colour.__path__[0], 'io', 'tests', 'resources', + ... 'CMS_Test_Pattern.exr') >>> image = read_image(path) # doctest: +SKIP """ - if is_openimageio_installed(raise_exception=True): + if is_openimageio_installed(raise_exception=True): # pragma: no cover from OpenImageIO import ImageInput path = str(path) - bit_depth = BIT_DEPTH_MAPPING[bit_depth].openimageio + bit_depth = BIT_DEPTH_MAPPING[bit_depth] image = ImageInput.open(path) specification = image.spec() @@ -127,9 +215,10 @@ def read_image(path, bit_depth='float32', attributes=False): shape = (specification.height, specification.width, specification.nchannels) - image_data = image.read_image(bit_depth) + image_data = image.read_image(bit_depth.openimageio) image.close() - image = np.squeeze(np.array(image_data).reshape(shape)) + image = np.squeeze( + np.array(image_data, dtype=bit_depth.numpy).reshape(shape)) if attributes: extra_attributes = [] @@ -144,9 +233,135 @@ def read_image(path, bit_depth='float32', attributes=False): return image -def write_image(image, path, bit_depth='float32', attributes=None): +def read_image_Imageio(path, bit_depth='float32', **kwargs): + """ + Reads the image at given path using *Imageio*. + + Parameters + ---------- + path : unicode + Image path. + bit_depth : unicode, optional + **{'float32', 'uint8', 'uint16', 'float16'}**, + Returned image bit depth, the image data is converted with + :func:`colour.io.convert_bit_depth` definition after reading the + image. + + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments. + + Returns + ------- + ndarray + Image as a ndarray. + + Notes + ----- + - For convenience, single channel images are squeezed to 2d arrays. + + Examples + -------- + >>> import os + >>> import colour + >>> path = os.path.join(colour.__path__[0], 'io', 'tests', 'resources', + ... 'CMS_Test_Pattern.exr') + >>> image = read_image_Imageio(path) + >>> image.shape # doctest: +SKIP + (1267, 1274, 3) + >>> image.dtype + dtype('float32') + """ + + from imageio import imread + + image = imread(path, **kwargs) + + return convert_bit_depth(image, bit_depth) + + +READ_IMAGE_METHODS = CaseInsensitiveMapping({ + 'Imageio': read_image_Imageio, + 'OpenImageIO': read_image_OpenImageIO, +}) +READ_IMAGE_METHODS.__doc__ = """ +Supported read image methods. + +READ_IMAGE_METHODS : CaseInsensitiveMapping + **{'Imageio', 'OpenImageIO'}** +""" + + +def read_image(path, bit_depth='float32', method='OpenImageIO', **kwargs): """ - Writes given image using *OpenImageIO*. + Reads the image at given path using given method. + + Parameters + ---------- + path : unicode + Image path. + bit_depth : unicode, optional + **{'float32', 'uint8', 'uint16', 'float16'}**, + Returned image bit depth, for the *Imageio* method, the image data is + converted with :func:`colour.io.convert_bit_depth` definition after + reading the image, for the *OpenImageIO* method, the bit depth + conversion behaviour is driven directly by the library, this definition + only converts to the relevant data type after reading. + method : unicode, optional + **{'OpenImageIO', 'Imageio'}**, + Read method, i.e. the image library used for reading images. + + Other Parameters + ---------------- + attributes : bool, optional + {:func:`colour.io.read_image_OpenImageIO`}, + Whether to return the image attributes. + + Returns + ------- + ndarray + Image as a ndarray. + + Notes + ----- + - If the given method is *OpenImageIO* but the library is not available + writing will be performed by *Imageio*. + - If the given method is *Imageio*, ``kwargs`` is passed directly to the + wrapped definition. + - For convenience, single channel images are squeezed to 2d arrays. + + Examples + -------- + >>> import os + >>> import colour + >>> path = os.path.join(colour.__path__[0], 'io', 'tests', 'resources', + ... 'CMS_Test_Pattern.exr') + >>> image = read_image(path) + >>> image.shape # doctest: +SKIP + (1267, 1274, 3) + >>> image.dtype + dtype('float32') + """ + + if method.lower() == 'openimageio': # pragma: no cover + if not is_openimageio_installed(): + usage_warning( + '"OpenImageIO" related API features are not available, ' + 'switching to "Imageio"!') + method = 'Imageio' + + function = READ_IMAGE_METHODS[method] + + if method.lower() == 'openimageio': # pragma: no cover + kwargs = filter_kwargs(function, **kwargs) + + return function(path, bit_depth, **kwargs) + + +def write_image_OpenImageIO(image, path, bit_depth='float32', attributes=None): + """ + Writes given image at given path using *OpenImageIO*. Parameters ---------- @@ -156,7 +371,8 @@ def write_image(image, path, bit_depth='float32', attributes=None): Image path. bit_depth : unicode, optional **{'float32', 'uint8', 'uint16', 'float16'}**, - Image bit_depth. + Bit depth to write the image at, the bit depth conversion behaviour is + ruled directly by *OpenImageIO*. attributes : array_like, optional An array of :class:`colour.io.ImageAttribute_Specification` class instances used to set attributes of the image. @@ -171,9 +387,12 @@ def write_image(image, path, bit_depth='float32', attributes=None): Basic image writing: >>> import os - >>> path = os.path.join('tests', 'resources', 'CMSTestPattern.exr') + >>> import colour + >>> path = os.path.join(colour.__path__[0], 'io', 'tests', 'resources', + ... 'CMS_Test_Pattern.exr') >>> image = read_image(path) # doctest: +SKIP - >>> path = os.path.join('tests', 'resources', 'CMSTestPattern.tif') + >>> path = os.path.join(colour.__path__[0], 'io', 'tests', 'resources', + ... 'CMSTestPattern.tif') >>> write_image(image, path) # doctest: +SKIP True @@ -184,8 +403,8 @@ def write_image(image, path, bit_depth='float32', attributes=None): True """ - if is_openimageio_installed(raise_exception=True): - from OpenImageIO import ImageOutput, ImageOutputOpenMode, ImageSpec + if is_openimageio_installed(raise_exception=True): # pragma: no cover + from OpenImageIO import VERSION_MAJOR, ImageOutput, ImageSpec path = str(path) @@ -196,7 +415,7 @@ def write_image(image, path, bit_depth='float32', attributes=None): bit_depth = bit_depth_specification.openimageio image = as_float_array(image) - image *= bit_depth_specification.domain + image = image * bit_depth_specification.domain if bit_depth_specification.clip: image = np.clip(image, 0, bit_depth_specification.domain) image = image.astype(bit_depth_specification.numpy) @@ -219,8 +438,153 @@ def write_image(image, path, bit_depth='float32', attributes=None): specification.attribute(name, type_, value) image_output = ImageOutput.create(path) - image_output.open(path, specification, ImageOutputOpenMode.Create) - image_output.write_image(bit_depth, image.tostring()) + + if VERSION_MAJOR == 1: + from OpenImageIO import ImageOutputOpenMode + + image_output.open(path, specification, ImageOutputOpenMode.Create) + image_output.write_image(bit_depth, image.tostring()) + else: + image_output.open(path, specification) + image_output.write_image(image) + image_output.close() return True + + +def write_image_Imageio(image, path, bit_depth='float32', **kwargs): + """ + Writes given image at given path using *Imageio*. + + Parameters + ---------- + image : array_like + Image data. + path : unicode + Image path. + bit_depth : unicode, optional + **{'float32', 'uint8', 'uint16', 'float16'}**, + Bit depth to write the image at, the image data is converted with + :func:`colour.io.convert_bit_depth` definition prior to writing the + image. + + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments. + + Returns + ------- + bool + Definition success. + + Examples + -------- + >>> import os + >>> import colour + >>> path = os.path.join(colour.__path__[0], 'io', 'tests', 'resources', + ... 'CMS_Test_Pattern.exr') + >>> image = read_image(path) # doctest: +SKIP + >>> path = os.path.join(colour.__path__[0], 'io', 'tests', 'resources', + ... 'CMSTestPattern.tif') + >>> write_image(image, path) # doctest: +SKIP + True + """ + + from imageio import imwrite + + image = convert_bit_depth(image, bit_depth) + + return imwrite(path, image, **kwargs) + + +WRITE_IMAGE_METHODS = CaseInsensitiveMapping({ + 'Imageio': write_image_Imageio, + 'OpenImageIO': write_image_OpenImageIO, +}) +WRITE_IMAGE_METHODS.__doc__ = """ +Supported write image methods. + +WRITE_IMAGE_METHODS : CaseInsensitiveMapping + **{'Imageio', 'OpenImageIO'}** +""" + + +def write_image(image, + path, + bit_depth='float32', + method='OpenImageIO', + **kwargs): + """ + Writes given image at given path using given method. + + Parameters + ---------- + image : array_like + Image data. + path : unicode + Image path. + bit_depth : unicode, optional + **{'float32', 'uint8', 'uint16', 'float16'}**, + Bit depth to write the image at, for the *Imageio* method, the image + data is converted with :func:`colour.io.convert_bit_depth` definition + prior to writing the image. + method : unicode, optional + **{'OpenImageIO', 'Imageio'}**, + Write method, i.e. the image library used for writing images. + + Other Parameters + ---------------- + attributes : array_like, optional + {:func:`colour.io.write_image_OpenImageIO`}, + An array of :class:`colour.io.ImageAttribute_Specification` class + instances used to set attributes of the image. + + Returns + ------- + bool + Definition success. + + Notes + ----- + - If the given method is *OpenImageIO* but the library is not available + writing will be performed by *Imageio*. + - If the given method is *Imageio*, ``kwargs`` is passed directly to the + wrapped definition. + + Examples + -------- + Basic image writing: + + >>> import os + >>> import colour + >>> path = os.path.join(colour.__path__[0], 'io', 'tests', 'resources', + ... 'CMS_Test_Pattern.exr') + >>> image = read_image(path) # doctest: +SKIP + >>> path = os.path.join(colour.__path__[0], 'io', 'tests', 'resources', + ... 'CMSTestPattern.tif') + >>> write_image(image, path) # doctest: +SKIP + True + + Advanced image writing while setting attributes using *OpenImageIO*: + + >>> compression = ImageAttribute_Specification('Compression', 'none') + >>> write_image(image, path, bit_depth='uint8', attributes=[compression]) + ... # doctest: +SKIP + True + """ + + if method.lower() == 'openimageio': # pragma: no cover + if not is_openimageio_installed(): + usage_warning( + '"OpenImageIO" related API features are not available, ' + 'switching to "Imageio"!') + method = 'Imageio' + + function = WRITE_IMAGE_METHODS[method] + + if method.lower() == 'openimageio': # pragma: no cover + kwargs = filter_kwargs(function, **kwargs) + + return function(image, path, bit_depth, **kwargs) diff --git a/colour/io/luts/__init__.py b/colour/io/luts/__init__.py index 7a0c194033..fa686820d5 100644 --- a/colour/io/luts/__init__.py +++ b/colour/io/luts/__init__.py @@ -112,25 +112,25 @@ def read_LUT(path, method=None, **kwargs): >>> path = os.path.join( ... os.path.dirname(__file__), 'tests', 'resources', 'sony_spi1d', - ... 'oetf_reverse_sRGB_1D.spi1d') + ... 'eotf_sRGB_1D.spi1d') >>> print(read_LUT(path)) - LUT1D - oetf reverse sRGB 1D - ---------------------------- + LUT1D - eotf sRGB 1D + -------------------- Dimensions : 1 Domain : [-0.1 1.5] Size : (16,) Comment 01 : Generated by "Colour 0.3.11". - Comment 02 : "colour.models.oetf_reverse_sRGB". + Comment 02 : "colour.models.eotf_sRGB". Reading a 3D *Sony* *.spi3d* *LUT*: >>> path = os.path.join( ... os.path.dirname(__file__), 'tests', 'resources', 'sony_spi3d', - ... 'ColourCorrect.spi3d') + ... 'Colour_Correct.spi3d') >>> print(read_LUT(path)) - LUT3D - ColourCorrect - --------------------- + LUT3D - Colour Correct + ---------------------- Dimensions : 3 Domain : [[ 0. 0. 0.] @@ -144,7 +144,16 @@ def read_LUT(path, method=None, **kwargs): function = LUT_READ_METHODS[method] - return function(path, **filter_kwargs(function, **kwargs)) + try: + return function(path, **filter_kwargs(function, **kwargs)) + except ValueError as error: + # Case where a "Resolve Cube" with "LUT3x1D" shaper was read as an + # "Iridas Cube" "LUT". + if method == 'Iridas Cube': + function = LUT_READ_METHODS['Resolve Cube'] + return function(path, **filter_kwargs(function, **kwargs)) + else: + raise error LUT_WRITE_METHODS = CaseInsensitiveMapping({ diff --git a/colour/io/luts/cinespace_csp.py b/colour/io/luts/cinespace_csp.py index c9cec7b824..3c7f01ae12 100644 --- a/colour/io/luts/cinespace_csp.py +++ b/colour/io/luts/cinespace_csp.py @@ -74,7 +74,7 @@ def read_LUT_Cinespace(path): >>> path = os.path.join( ... os.path.dirname(__file__), 'tests', 'resources', 'cinespace', - ... 'ColourCorrect.csp') + ... 'Colour_Correct.csp') >>> print(read_LUT_Cinespace(path)) LUT3D - Generated by Foundry::LUT --------------------------------- @@ -87,19 +87,12 @@ def read_LUT_Cinespace(path): unity_range = np.array([[0., 0., 0.], [1., 1., 1.]]) - def _parse_metadata_section(lines): + def _parse_metadata_section(metadata): """ Parses the metadata at given lines. """ - if len(metadata) > 0: - title = metadata[0] - comments = metadata[1:] - else: - title = '' - comments = [] - - return title, comments + return (metadata[0], metadata[1:]) if len(metadata) > 0 else ('', []) def _parse_domain_section(lines): """ @@ -206,9 +199,7 @@ def _parse_table_section(lines): pre_domain = tstack((pre_LUT[0], pre_LUT[2], pre_LUT[4])) pre_table = tstack((pre_LUT[1], pre_LUT[3], pre_LUT[5])) - if np.array_equal(table, unity_range): - return LUT3x1D(pre_table, title, pre_domain, comments=comments) - elif table.shape == (2, 3): + if table.shape == (2, 3): table_max = table[1] table_min = table[0] pre_table *= (table_max - table_min) @@ -216,8 +207,8 @@ def _parse_table_section(lines): return LUT3x1D(pre_table, title, pre_domain, comments=comments) else: - pre_name = '{0} - preLUT'.format(title) - table_name = '{0} - table'.format(title) + pre_name = '{0} - PreLUT'.format(title) + table_name = '{0} - Table'.format(title) LUT_A = LUT3x1D(pre_table, pre_name, pre_domain) LUT_B = LUT3x1D(table, table_name, comments=comments) @@ -282,18 +273,17 @@ def write_LUT_Cinespace(LUT, path, decimals=7): has_3D = True name = LUT[1].name if isinstance(LUT[0], LUT1D): + non_uniform = LUT[0].is_domain_explicit() LUT[0] = LUT[0].as_LUT(LUT3x1D) elif isinstance(LUT, LUT1D): - if LUT.is_domain_explicit(): - non_uniform = True + non_uniform = LUT.is_domain_explicit() name = LUT.name LUT = LUTSequence(LUT.as_LUT(LUT3x1D), LUT3D()) has_3x1D = True elif isinstance(LUT, LUT3x1D): - if LUT.is_domain_explicit(): - non_uniform = True + non_uniform = LUT.is_domain_explicit() name = LUT.name LUT = LUTSequence(LUT, LUT3D()) has_3x1D = True @@ -304,7 +294,7 @@ def write_LUT_Cinespace(LUT, path, decimals=7): has_3D = True else: - assert False, 'LUT must be 1D, 3x1D, 3D, 1D+3D or 3x1D+3D!' + raise ValueError('LUT must be 1D, 3x1D, 3D, 1D + 3D or 3x1D + 3D!') if has_3x1D: assert 2 <= LUT[0].size <= 65536, ( @@ -317,12 +307,13 @@ def _ragged_size(table): Return the ragged size of given table. """ - r, g, b = tsplit(table) - r_len = r.shape[-1] - np.sum(np.isnan(r)) - g_len = g.shape[-1] - np.sum(np.isnan(g)) - b_len = b.shape[-1] - np.sum(np.isnan(b)) + R, G, B = tsplit(table) + + R_len = R.shape[-1] - np.sum(np.isnan(R)) + G_len = G.shape[-1] - np.sum(np.isnan(G)) + B_len = B.shape[-1] - np.sum(np.isnan(B)) - return [r_len, g_len, b_len] + return [R_len, G_len, B_len] def _format_array(array): """ diff --git a/colour/io/luts/common.py b/colour/io/luts/common.py index 9718c00e2a..6a7f3d2176 100644 --- a/colour/io/luts/common.py +++ b/colour/io/luts/common.py @@ -75,7 +75,7 @@ def path_to_title(path): -------- >>> # Doctests skip for Python 2.x compatibility. >>> path_to_title( - ... 'colour/io/luts/tests/resources/sony_spi3d/ColourCorrect.spi3d' + ... 'colour/io/luts/tests/resources/sony_spi3d/Colour_Correct.spi3d' ... ) # doctest: +SKIP u'ColourCorrect' """ diff --git a/colour/io/luts/iridas_cube.py b/colour/io/luts/iridas_cube.py index 139c2e47b7..df4a060ddd 100644 --- a/colour/io/luts/iridas_cube.py +++ b/colour/io/luts/iridas_cube.py @@ -73,7 +73,7 @@ def read_LUT_IridasCube(path): >>> path = os.path.join( ... os.path.dirname(__file__), 'tests', 'resources', 'iridas_cube', - ... 'ColourCorrect.cube') + ... 'Colour_Correct.cube') >>> print(read_LUT_IridasCube(path)) LUT3D - Generated by Foundry::LUT --------------------------------- diff --git a/colour/io/luts/lut.py b/colour/io/luts/lut.py index dfce447d54..09c2460bc0 100644 --- a/colour/io/luts/lut.py +++ b/colour/io/luts/lut.py @@ -980,6 +980,9 @@ def apply(self, array([ 0.4529220..., 0.4529220..., 0.4529220...]) """ + if interpolator_args is None: + interpolator_args = {} + if self.is_domain_explicit(): samples = self.domain else: @@ -987,7 +990,8 @@ def apply(self, samples = np.linspace(domain_min, domain_max, self._table.size) - RGB_interpolator = interpolator(samples, self._table) + RGB_interpolator = interpolator(samples, self._table, + **interpolator_args) return RGB_interpolator(RGB) @@ -1354,6 +1358,9 @@ def apply(self, array([ 0.2996370..., -0.0901332..., -0.3949770...]) """ + if interpolator_args is None: + interpolator_args = {} + R, G, B = tsplit(RGB) if self.is_domain_explicit(): @@ -1378,7 +1385,7 @@ def apply(self, s_R, s_G, s_B = samples RGB_i = [ - interpolator(a[0], a[1])(a[2]) + interpolator(a[0], a[1], **interpolator_args)(a[2]) for a in zip((s_R, s_G, s_B), (R_t, G_t, B_t), (R, G, B)) ] @@ -1813,6 +1820,9 @@ def apply(self, array([ 0.2996370..., -0.0901332..., -0.3949770...]) """ + if interpolator_args is None: + interpolator_args = {} + R, G, B = tsplit(RGB) if self.is_domain_explicit(): @@ -1834,7 +1844,7 @@ def apply(self, for i, j in enumerate((R, G, B)) ] - return interpolator(tstack(RGB_l), self._table) + return interpolator(tstack(RGB_l), self._table, **interpolator_args) def as_LUT(self, cls, force_conversion=False, **kwargs): """ @@ -1997,6 +2007,8 @@ def LUT_to_LUT(LUT, cls, force_conversion=False, **kwargs): if 'channel_weights' in kwargs: del kwargs['channel_weights'] + # TODO: Implement support for non-uniform domain, e.g. "cinespace" + # LUTs. if isinstance(LUT, LUT1D): if cls is LUT3x1D: domain = tstack([LUT.domain, LUT.domain, LUT.domain]) @@ -2007,9 +2019,10 @@ def LUT_to_LUT(LUT, cls, force_conversion=False, **kwargs): table = LUT.apply(table, **kwargs) elif isinstance(LUT, LUT3x1D): if cls is LUT1D: - domain = np.array( - [np.max(LUT.domain[0, ...]), - np.min(LUT.domain[1, ...])]) + domain = np.array([ + np.sum(LUT.domain[0, ...] * channel_weights), + np.sum(LUT.domain[-1, ...] * channel_weights) + ]) table = np.sum(LUT.table * channel_weights, axis=-1) elif cls is LUT3D: domain = LUT.domain @@ -2017,9 +2030,10 @@ def LUT_to_LUT(LUT, cls, force_conversion=False, **kwargs): table = LUT.apply(table, **kwargs) elif isinstance(LUT, LUT3D): if cls is LUT1D: - domain = np.array( - [np.max(LUT.domain[0, ...]), - np.min(LUT.domain[1, ...])]) + domain = np.array([ + np.sum(LUT.domain[0, ...] * channel_weights), + np.sum(LUT.domain[-1, ...] * channel_weights) + ]) table = LUT1D.linear_table(size, domain) table = LUT.apply(tstack([table, table, table]), **kwargs) table = np.sum(table * channel_weights, axis=-1) diff --git a/colour/io/luts/resolve_cube.py b/colour/io/luts/resolve_cube.py index 784c4070d1..cfea69b0b8 100644 --- a/colour/io/luts/resolve_cube.py +++ b/colour/io/luts/resolve_cube.py @@ -74,7 +74,7 @@ def read_LUT_ResolveCube(path): >>> path = os.path.join( ... os.path.dirname(__file__), 'tests', 'resources', 'resolve_cube', - ... 'ColourCorrect.cube') + ... 'Colour_Correct.cube') >>> print(read_LUT_ResolveCube(path)) LUT3D - Generated by Foundry::LUT --------------------------------- @@ -98,6 +98,41 @@ def read_LUT_ResolveCube(path): [ 3. 3. 3.]] Size : (3, 3) Comment 01 : Comments can't go anywhere + + Reading a 3x1D + 3D *Resolve* *.cube* *LUT*: + + >>> path = os.path.join( + ... os.path.dirname(__file__), 'tests', 'resources', 'resolve_cube', + ... 'Three_Dimensional_Table_With_Shaper.cube') + >>> print(read_LUT_ResolveCube(path)) + LUT Sequence + ------------ + + Overview + + LUT3x1D ---> LUT3D + + Operations + + LUT3x1D - LUT3D with My Shaper - Shaper + --------------------------------------- + + Dimensions : 2 + Domain : [[-0.1 -0.1 -0.1] + [ 3. 3. 3. ]] + Size : (10, 3) + + LUT3D - LUT3D with My Shaper - Cube + ----------------------------------- + + Dimensions : 3 + Domain : [[-0.1 -0.1 -0.1] + [ 3. 3. 3. ]] + Size : (3, 3, 3, 3) + Comment 01 : A first "Shaper" comment. + Comment 02 : A second "Shaper" comment. + Comment 03 : A first "LUT3D" comment. + Comment 04 : A second "LUT3D" comment. """ title = path_to_title(path) @@ -201,7 +236,7 @@ def write_LUT_ResolveCube(LUT, path, decimals=7): ... comments=['A first comment.', 'A second comment.']) >>> write_LUT_ResolveCube(LUT, 'My_LUT.cube') # doctest: +SKIP - Writing a 3D *Iridas* *.cube* *LUT*: + Writing a 3D *Resolve* *.cube* *LUT*: >>> domain = np.array([[-0.1, -0.1, -0.1], [3.0, 3.0, 3.0]]) >>> LUT = LUT3D( @@ -210,6 +245,31 @@ def write_LUT_ResolveCube(LUT, path, decimals=7): ... domain, ... comments=['A first comment.', 'A second comment.']) >>> write_LUT_ResolveCube(LUT, 'My_LUT.cube') # doctest: +SKIP + + Writing a 3x1D + 3D *Resolve* *.cube* *LUT*: + + >>> from colour.models import RGB_to_HSV, HSV_to_RGB + >>> from colour.utilities import tstack + >>> def rotate_hue(a, angle): + ... H, S, V = RGB_to_HSV(a) + ... H += angle / 360 + ... H[H > 1] -= 1 + ... H[H < 0] += 1 + ... return HSV_to_RGB([H, S, V]) + >>> domain = np.array([[-0.1, -0.1, -0.1], [3.0, 3.0, 3.0]]) + >>> shaper = LUT3x1D( + ... spow(LUT3x1D.linear_table(10, domain), 1 / 2.2), + ... 'My Shaper', + ... domain, + ... comments=[ + ... 'A first "Shaper" comment.', 'A second "Shaper" comment.']) + >>> LUT = LUT3D( + ... rotate_hue(LUT3D.linear_table(3, domain), 10), + ... 'LUT3D with My Shaper', + ... domain, + ... comments=['A first "LUT3D" comment.', 'A second "LUT3D" comment.']) + >>> LUT_sequence = LUTSequence(shaper, LUT) + >>> write_LUT_ResolveCube(LUT_sequence, 'My_LUT.cube') # doctest: +SKIP """ has_3D, has_3x1D = False, False diff --git a/colour/io/luts/sony_spi1d.py b/colour/io/luts/sony_spi1d.py index e80a8f67db..e3d9337800 100644 --- a/colour/io/luts/sony_spi1d.py +++ b/colour/io/luts/sony_spi1d.py @@ -49,32 +49,32 @@ def read_LUT_SonySPI1D(path): >>> import os >>> path = os.path.join( ... os.path.dirname(__file__), 'tests', 'resources', 'sony_spi1d', - ... 'oetf_reverse_sRGB_1D.spi1d') + ... 'eotf_sRGB_1D.spi1d') >>> print(read_LUT_SonySPI1D(path)) - LUT1D - oetf reverse sRGB 1D - ---------------------------- + LUT1D - eotf sRGB 1D + -------------------- Dimensions : 1 Domain : [-0.1 1.5] Size : (16,) Comment 01 : Generated by "Colour 0.3.11". - Comment 02 : "colour.models.oetf_reverse_sRGB". + Comment 02 : "colour.models.eotf_sRGB". Reading a 3x1D *Sony* *.spi1d* *LUT*: >>> path = os.path.join( ... os.path.dirname(__file__), 'tests', 'resources', 'sony_spi1d', - ... 'oetf_reverse_sRGB_3x1D.spi1d') + ... 'eotf_sRGB_3x1D.spi1d') >>> print(read_LUT_SonySPI1D(path)) - LUT3x1D - oetf reverse sRGB 3x1D - -------------------------------- + LUT3x1D - eotf sRGB 3x1D + ------------------------ Dimensions : 2 Domain : [[-0.1 -0.1 -0.1] [ 1.5 1.5 1.5]] Size : (16, 3) Comment 01 : Generated by "Colour 0.3.11". - Comment 02 : "colour.models.oetf_reverse_sRGB". + Comment 02 : "colour.models.eotf_sRGB". """ title = path_to_title(path) @@ -85,13 +85,8 @@ def read_LUT_SonySPI1D(path): comments = [] with open(path) as spi1d_file: - lines = spi1d_file.readlines() + lines = filter(None, (line.strip() for line in spi1d_file.readlines())) for line in lines: - line = line.strip() - - if len(line) == 0: - continue - if line.startswith('#'): comments.append(line[1:].strip()) continue diff --git a/colour/io/luts/sony_spi3d.py b/colour/io/luts/sony_spi3d.py index cbe37db9a4..c1e1aa855b 100644 --- a/colour/io/luts/sony_spi3d.py +++ b/colour/io/luts/sony_spi3d.py @@ -49,10 +49,10 @@ def read_LUT_SonySPI3D(path): >>> import os >>> path = os.path.join( ... os.path.dirname(__file__), 'tests', 'resources', 'sony_spi3d', - ... 'ColourCorrect.spi3d') + ... 'Colour_Correct.spi3d') >>> print(read_LUT_SonySPI3D(path)) - LUT3D - ColourCorrect - --------------------- + LUT3D - Colour Correct + ---------------------- Dimensions : 3 Domain : [[ 0. 0. 0.] @@ -69,13 +69,8 @@ def read_LUT_SonySPI3D(path): comments = [] with open(path) as spi3d_file: - lines = spi3d_file.readlines() + lines = filter(None, (line.strip() for line in spi3d_file.readlines())) for line in lines: - line = line.strip() - - if len(line) == 0: - continue - if line.startswith('#'): comments.append(line[1:].strip()) continue diff --git a/colour/io/luts/tests/resources/cinespace/ColourCorrect.csp b/colour/io/luts/tests/resources/cinespace/Colour_Correct.csp similarity index 100% rename from colour/io/luts/tests/resources/cinespace/ColourCorrect.csp rename to colour/io/luts/tests/resources/cinespace/Colour_Correct.csp diff --git a/colour/io/luts/tests/resources/cinespace/NonUniform.csp b/colour/io/luts/tests/resources/cinespace/Non_Uniform.csp similarity index 100% rename from colour/io/luts/tests/resources/cinespace/NonUniform.csp rename to colour/io/luts/tests/resources/cinespace/Non_Uniform.csp diff --git a/colour/io/luts/tests/resources/cinespace/ThreeDimensionalTable.csp b/colour/io/luts/tests/resources/cinespace/Three_Dimensional_Table.csp similarity index 100% rename from colour/io/luts/tests/resources/cinespace/ThreeDimensionalTable.csp rename to colour/io/luts/tests/resources/cinespace/Three_Dimensional_Table.csp diff --git a/colour/io/luts/tests/resources/cinespace/Three_Dimensional_Table_With_Shaper.csp b/colour/io/luts/tests/resources/cinespace/Three_Dimensional_Table_With_Shaper.csp new file mode 100644 index 0000000000..4d75f78077 --- /dev/null +++ b/colour/io/luts/tests/resources/cinespace/Three_Dimensional_Table_With_Shaper.csp @@ -0,0 +1,49 @@ +CSPLUTV100 +3D + +BEGIN METADATA +LUT3D with My Shaper - Cube +A first "Shaper" comment. +A second "Shaper" comment. +A first "LUT3D" comment. +A second "LUT3D" comment. +END METADATA + +10 +-0.1000000 0.2444444 0.5888889 0.9333333 1.2777778 1.6222222 1.9666667 2.3111111 2.6555556 3.0000000 +-0.3511192 0.5271086 0.7860854 0.9691262 1.1178635 1.2459617 1.3599219 1.4634339 1.5588269 1.6476816 +10 +-0.1000000 0.2444444 0.5888889 0.9333333 1.2777778 1.6222222 1.9666667 2.3111111 2.6555556 3.0000000 +-0.3511192 0.5271086 0.7860854 0.9691262 1.1178635 1.2459617 1.3599219 1.4634339 1.5588269 1.6476816 +10 +-0.1000000 0.2444444 0.5888889 0.9333333 1.2777778 1.6222222 1.9666667 2.3111111 2.6555556 3.0000000 +-0.3511192 0.5271086 0.7860854 0.9691262 1.1178635 1.2459617 1.3599219 1.4634339 1.5588269 1.6476816 + +3 3 3 +0.9277778 0.9063014 0.9020062 +1.4500000 -0.1000000 -0.1000000 +3.0000000 -0.1000000 -0.1000000 +0.4315560 0.4777778 0.4392596 +1.4500000 1.4500000 -0.1000000 +3.0000000 1.4500000 -0.1000000 +1.9038580 2.0277778 1.9245113 +1.4500000 3.0000000 -0.1000000 +3.0000000 3.0000000 -0.1000000 +0.4392596 0.4315560 0.4777778 +1.4500000 -0.1000000 1.4500000 +3.0000000 -0.1000000 1.4500000 +0.4315560 0.4700741 0.4777778 +1.4500000 1.4500000 1.4500000 +3.0000000 1.4500000 1.4500000 +1.9038580 2.0277778 1.9864712 +1.4500000 3.0000000 1.4500000 +3.0000000 3.0000000 1.4500000 +1.9245113 1.9038580 2.0277778 +1.4500000 -0.1000000 3.0000000 +3.0000000 -0.1000000 3.0000000 +1.9038580 1.9451646 2.0277778 +1.4500000 1.4500000 3.0000000 +3.0000000 1.4500000 3.0000000 +1.9038580 2.0071245 2.0277778 +1.4500000 3.0000000 3.0000000 +3.0000000 3.0000000 3.0000000 diff --git a/colour/io/luts/tests/resources/cinespace/Uncommon_3x1D_With_Pre_Lut.csp b/colour/io/luts/tests/resources/cinespace/Uncommon_3x1D_With_Pre_Lut.csp new file mode 100644 index 0000000000..4947cea71f --- /dev/null +++ b/colour/io/luts/tests/resources/cinespace/Uncommon_3x1D_With_Pre_Lut.csp @@ -0,0 +1,24 @@ +CSPLUTV100 +1D + +BEGIN METADATA +lin to LogC +LogC to lin +END METADATA + +5 +-0.0172904 0.0415196 0.5133834 5.3571636 55.0795767 +0.0000000 0.2500000 0.5000000 0.7500000 1.0000000 +5 +-0.0172904 0.0415196 0.5133834 5.3571636 55.0795767 +0.0000000 0.2500000 0.5000000 0.7500000 1.0000000 +5 +-0.0172904 0.0415196 0.5133834 5.3571636 55.0795767 +0.0000000 0.2500000 0.5000000 0.7500000 1.0000000 + +5 +-0.0172904 -0.0172904 -0.0172904 +0.0415196 0.0415196 0.0415196 +0.5133834 0.5133834 0.5133834 +5.3571636 5.3571636 5.3571636 +55.0795767 55.0795767 55.0795767 diff --git a/colour/io/luts/tests/resources/cinespace/oetf_reverse_sRGB_3D.csp b/colour/io/luts/tests/resources/cinespace/eotf_sRGB_3D.csp similarity index 99% rename from colour/io/luts/tests/resources/cinespace/oetf_reverse_sRGB_3D.csp rename to colour/io/luts/tests/resources/cinespace/eotf_sRGB_3D.csp index 727ed6393f..acfa130e41 100644 --- a/colour/io/luts/tests/resources/cinespace/oetf_reverse_sRGB_3D.csp +++ b/colour/io/luts/tests/resources/cinespace/eotf_sRGB_3D.csp @@ -4,7 +4,7 @@ CSPLUTV100 BEGIN METADATA Unity 8 Generated by "Colour 0.3.11". -"colour.models.oetf_reverse_sRGB". +"colour.models.eotf_sRGB". END METADATA 2 diff --git a/colour/io/luts/tests/resources/iridas_cube/ColourCorrect.cube b/colour/io/luts/tests/resources/iridas_cube/Colour_Correct.cube similarity index 100% rename from colour/io/luts/tests/resources/iridas_cube/ColourCorrect.cube rename to colour/io/luts/tests/resources/iridas_cube/Colour_Correct.cube diff --git a/colour/io/luts/tests/resources/iridas_cube/ThreeDimensionalTable.cube b/colour/io/luts/tests/resources/iridas_cube/Three_Dimensional_Table.cube similarity index 100% rename from colour/io/luts/tests/resources/iridas_cube/ThreeDimensionalTable.cube rename to colour/io/luts/tests/resources/iridas_cube/Three_Dimensional_Table.cube diff --git a/colour/io/luts/tests/resources/iridas_cube/oetf_reverse_sRGB_3D.cube b/colour/io/luts/tests/resources/iridas_cube/eotf_sRGB_3D.cube similarity index 99% rename from colour/io/luts/tests/resources/iridas_cube/oetf_reverse_sRGB_3D.cube rename to colour/io/luts/tests/resources/iridas_cube/eotf_sRGB_3D.cube index b08bcc58de..6162e91659 100644 --- a/colour/io/luts/tests/resources/iridas_cube/oetf_reverse_sRGB_3D.cube +++ b/colour/io/luts/tests/resources/iridas_cube/eotf_sRGB_3D.cube @@ -1,6 +1,6 @@ -TITLE "Unity 8" +TITLE "sRGB EOTF" # Generated by "Colour 0.3.11". -# "colour.models.oetf_reverse_sRGB". +# "colour.models.eotf_sRGB". LUT_3D_SIZE 8 DOMAIN_MIN -0.1000000 -0.1500000 -0.2000000 DOMAIN_MAX 1.5000000 2.0000000 3.0000000 diff --git a/colour/io/luts/tests/resources/resolve_cube/ColourCorrect.cube b/colour/io/luts/tests/resources/resolve_cube/Colour_Correct.cube similarity index 100% rename from colour/io/luts/tests/resources/resolve_cube/ColourCorrect.cube rename to colour/io/luts/tests/resources/resolve_cube/Colour_Correct.cube diff --git a/colour/io/luts/tests/resources/resolve_cube/ThreeDimensionalTable.cube b/colour/io/luts/tests/resources/resolve_cube/Three_Dimensional_Table.cube similarity index 100% rename from colour/io/luts/tests/resources/resolve_cube/ThreeDimensionalTable.cube rename to colour/io/luts/tests/resources/resolve_cube/Three_Dimensional_Table.cube diff --git a/colour/io/luts/tests/resources/resolve_cube/Three_Dimensional_Table_With_Shaper.cube b/colour/io/luts/tests/resources/resolve_cube/Three_Dimensional_Table_With_Shaper.cube new file mode 100644 index 0000000000..1350cc0416 --- /dev/null +++ b/colour/io/luts/tests/resources/resolve_cube/Three_Dimensional_Table_With_Shaper.cube @@ -0,0 +1,47 @@ +TITLE "LUT3D with My Shaper" +# A first "Shaper" comment. +# A second "Shaper" comment. +# A first "LUT3D" comment. +# A second "LUT3D" comment. +LUT_1D_SIZE 10 +LUT_1D_INPUT_RANGE -0.1000000 3.0000000 +LUT_3D_SIZE 3 +LUT_3D_INPUT_RANGE -0.1000000 3.0000000 +-0.3511192 -0.3511192 -0.3511192 +0.5271086 0.5271086 0.5271086 +0.7860854 0.7860854 0.7860854 +0.9691262 0.9691262 0.9691262 +1.1178635 1.1178635 1.1178635 +1.2459617 1.2459617 1.2459617 +1.3599219 1.3599219 1.3599219 +1.4634339 1.4634339 1.4634339 +1.5588269 1.5588269 1.5588269 +1.6476816 1.6476816 1.6476816 + +0.9277778 0.9063014 0.9020062 +1.4500000 -0.1000000 -0.1000000 +3.0000000 -0.1000000 -0.1000000 +0.4315560 0.4777778 0.4392596 +1.4500000 1.4500000 -0.1000000 +3.0000000 1.4500000 -0.1000000 +1.9038580 2.0277778 1.9245113 +1.4500000 3.0000000 -0.1000000 +3.0000000 3.0000000 -0.1000000 +0.4392596 0.4315560 0.4777778 +1.4500000 -0.1000000 1.4500000 +3.0000000 -0.1000000 1.4500000 +0.4315560 0.4700741 0.4777778 +1.4500000 1.4500000 1.4500000 +3.0000000 1.4500000 1.4500000 +1.9038580 2.0277778 1.9864712 +1.4500000 3.0000000 1.4500000 +3.0000000 3.0000000 1.4500000 +1.9245113 1.9038580 2.0277778 +1.4500000 -0.1000000 3.0000000 +3.0000000 -0.1000000 3.0000000 +1.9038580 1.9451646 2.0277778 +1.4500000 1.4500000 3.0000000 +3.0000000 1.4500000 3.0000000 +1.9038580 2.0071245 2.0277778 +1.4500000 3.0000000 3.0000000 +3.0000000 3.0000000 3.0000000 diff --git a/colour/io/luts/tests/resources/resolve_cube/oetf_reverse_sRGB_3D.cube b/colour/io/luts/tests/resources/resolve_cube/eotf_sRGB_3D.cube similarity index 99% rename from colour/io/luts/tests/resources/resolve_cube/oetf_reverse_sRGB_3D.cube rename to colour/io/luts/tests/resources/resolve_cube/eotf_sRGB_3D.cube index c1dd4fe037..1d49c91004 100644 --- a/colour/io/luts/tests/resources/resolve_cube/oetf_reverse_sRGB_3D.cube +++ b/colour/io/luts/tests/resources/resolve_cube/eotf_sRGB_3D.cube @@ -1,6 +1,6 @@ -TITLE "sRGB reverse OETF" +TITLE "sRGB EOTF" # Generated by "Colour 0.3.11". -# "colour.models.oetf_reverse_sRGB". +# "colour.models.eotf_sRGB". LUT_3D_SIZE 8 LUT_1D_INPUT_RANGE -1.0000000 3.0000000 -0.0773994 -0.0773994 -0.0773994 diff --git a/colour/io/luts/tests/resources/sony_spi1d/Exception_Raising.spi1d b/colour/io/luts/tests/resources/sony_spi1d/Exception_Raising.spi1d new file mode 100644 index 0000000000..a3117f130b --- /dev/null +++ b/colour/io/luts/tests/resources/sony_spi1d/Exception_Raising.spi1d @@ -0,0 +1,8 @@ +Version 1 +From 0.0 +Length 2 +Components 1 +{ + 0.0 + 1.0 +} diff --git a/colour/io/luts/tests/resources/sony_spi1d/oetf_reverse_sRGB_1D.spi1d b/colour/io/luts/tests/resources/sony_spi1d/eotf_sRGB_1D.spi1d similarity index 88% rename from colour/io/luts/tests/resources/sony_spi1d/oetf_reverse_sRGB_1D.spi1d rename to colour/io/luts/tests/resources/sony_spi1d/eotf_sRGB_1D.spi1d index 444219e613..6bd483fc1e 100644 --- a/colour/io/luts/tests/resources/sony_spi1d/oetf_reverse_sRGB_1D.spi1d +++ b/colour/io/luts/tests/resources/sony_spi1d/eotf_sRGB_1D.spi1d @@ -21,4 +21,4 @@ Components 1 2.5371552 } # Generated by "Colour 0.3.11". -# "colour.models.oetf_reverse_sRGB". +# "colour.models.eotf_sRGB". diff --git a/colour/io/luts/tests/resources/sony_spi1d/oetf_reverse_sRGB_3x1D.spi1d b/colour/io/luts/tests/resources/sony_spi1d/eotf_sRGB_3x1D.spi1d similarity index 94% rename from colour/io/luts/tests/resources/sony_spi1d/oetf_reverse_sRGB_3x1D.spi1d rename to colour/io/luts/tests/resources/sony_spi1d/eotf_sRGB_3x1D.spi1d index 922eb1614e..41fbbcad1d 100644 --- a/colour/io/luts/tests/resources/sony_spi1d/oetf_reverse_sRGB_3x1D.spi1d +++ b/colour/io/luts/tests/resources/sony_spi1d/eotf_sRGB_3x1D.spi1d @@ -21,4 +21,4 @@ Components 3 2.5371552 2.5371552 2.5371552 } # Generated by "Colour 0.3.11". -# "colour.models.oetf_reverse_sRGB". +# "colour.models.eotf_sRGB". diff --git a/colour/io/luts/tests/resources/sony_spi3d/ColourCorrect.spi3d b/colour/io/luts/tests/resources/sony_spi3d/Colour_Correct.spi3d similarity index 100% rename from colour/io/luts/tests/resources/sony_spi3d/ColourCorrect.spi3d rename to colour/io/luts/tests/resources/sony_spi3d/Colour_Correct.spi3d diff --git a/colour/io/luts/tests/test__init__.py b/colour/io/luts/tests/test__init__.py new file mode 100644 index 0000000000..901b962619 --- /dev/null +++ b/colour/io/luts/tests/test__init__.py @@ -0,0 +1,156 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.io.luts.__init__` module. +""" + +from __future__ import division, unicode_literals + +import numpy as np +import os +import shutil +import tempfile +import unittest + +from colour.io import LUTSequence, read_LUT, write_LUT + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = ['LUTS_DIRECTORY', 'TestReadLUT', 'TestWriteLUT'] + +LUTS_DIRECTORY = os.path.join(os.path.dirname(__file__), 'resources') + + +class TestReadLUT(unittest.TestCase): + """ + Defines :func:`colour.io.luts.__init__.read_LUT` definition unit tests + methods. + """ + + def test_read_LUT(self): + """ + Tests :func:`colour.io.luts.__init__.read_LUT` definition. + """ + + LUT_1 = read_LUT( + os.path.join(LUTS_DIRECTORY, 'sony_spi1d', 'eotf_sRGB_1D.spi1d')) + + np.testing.assert_almost_equal( + LUT_1.table, + np.array([ + -7.73990000e-03, 5.16000000e-04, 1.22181000e-02, + 3.96819000e-02, 8.71438000e-02, 1.57439400e-01, 2.52950100e-01, + 3.75757900e-01, 5.27729400e-01, 7.10566500e-01, 9.25840600e-01, + 1.17501630e+00, 1.45946870e+00, 1.78049680e+00, 2.13933380e+00, + 2.53715520e+00 + ])) + self.assertEqual(LUT_1.name, 'eotf sRGB 1D') + self.assertEqual(LUT_1.dimensions, 1) + np.testing.assert_array_equal(LUT_1.domain, np.array([-0.1, 1.5])) + self.assertEqual(LUT_1.size, 16) + self.assertListEqual( + LUT_1.comments, + ['Generated by "Colour 0.3.11".', '"colour.models.eotf_sRGB".']) + + LUT_2 = read_LUT( + os.path.join(LUTS_DIRECTORY, 'resolve_cube', 'LogC_Video.cube')) + np.testing.assert_almost_equal( + LUT_2[0].table, + np.array([ + [0.00000000, 0.00000000, 0.00000000], + [0.02708500, 0.02708500, 0.02708500], + [0.06304900, 0.06304900, 0.06304900], + [0.11314900, 0.11314900, 0.11314900], + [0.18304900, 0.18304900, 0.18304900], + [0.28981100, 0.28981100, 0.28981100], + [0.41735300, 0.41735300, 0.41735300], + [0.54523100, 0.54523100, 0.54523100], + [0.67020500, 0.67020500, 0.67020500], + [0.78963000, 0.78963000, 0.78963000], + [0.88646800, 0.88646800, 0.88646800], + [0.94549100, 0.94549100, 0.94549100], + [0.97644900, 0.97644900, 0.97644900], + [0.98924800, 0.98924800, 0.98924800], + [0.99379700, 0.99379700, 0.99379700], + [1.00000000, 1.00000000, 1.00000000], + ]), + ) + self.assertEqual(LUT_2[1].size, 4) + + def test_raise_exception_read_LUT(self): + """ + Tests :func:`colour.io.luts.__init__.read_LUT` definition raised + exception. + """ + + self.assertRaises( + ValueError, read_LUT, + os.path.join(LUTS_DIRECTORY, 'sony_spi1d', + 'Exception_Raising.spi1d')) + + +class TestWriteLUT(unittest.TestCase): + """ + Defines :func:`colour.io.luts.__init__.write_LUT` definition unit tests + methods. + """ + + def setUp(self): + """ + Initialises common tests attributes. + """ + + self._temporary_directory = tempfile.mkdtemp() + + def tearDown(self): + """ + After tests actions. + """ + + shutil.rmtree(self._temporary_directory) + + def test_write_LUT(self): + """ + Tests :func:`colour.io.luts.__init__.write_LUT` definition. + """ + + LUT_1_r = read_LUT( + os.path.join(LUTS_DIRECTORY, 'sony_spi1d', 'eotf_sRGB_1D.spi1d')) + + write_LUT( + LUT_1_r, + os.path.join(self._temporary_directory, 'eotf_sRGB_1D.spi1d')) + + LUT_1_t = read_LUT( + os.path.join(self._temporary_directory, 'eotf_sRGB_1D.spi1d')) + + self.assertEqual(LUT_1_r, LUT_1_t) + + write_LUT( + LUTSequence(LUT_1_r), + os.path.join(self._temporary_directory, 'eotf_sRGB_1D.spi1d')) + + self.assertEqual(LUT_1_r, LUT_1_t) + + LUT_2_r = read_LUT( + os.path.join(LUTS_DIRECTORY, 'resolve_cube', + 'Three_Dimensional_Table_With_Shaper.cube')) + + write_LUT( + LUT_2_r, + os.path.join(self._temporary_directory, + 'Three_Dimensional_Table_With_Shaper.cube')) + + LUT_2_t = read_LUT( + os.path.join(self._temporary_directory, + 'Three_Dimensional_Table_With_Shaper.cube')) + + self.assertEqual(LUT_2_r, LUT_2_t) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/io/luts/tests/test_cinespace_csp.py b/colour/io/luts/tests/test_cinespace_csp.py index 187e3c7ea1..72b4d64171 100644 --- a/colour/io/luts/tests/test_cinespace_csp.py +++ b/colour/io/luts/tests/test_cinespace_csp.py @@ -11,7 +11,7 @@ import shutil import tempfile -from colour.io import LUTSequence, LUT3x1D +from colour.io import LUT1D, LUT3x1D from colour.io import read_LUT_Cinespace, write_LUT_Cinespace from colour.utilities import tstack @@ -93,15 +93,20 @@ def test_read_LUT_Cinespace(self): np.array([[0, 0, 0], [1, 2, 3]])) LUT_3 = read_LUT_Cinespace( - os.path.join(LUTS_DIRECTORY, 'ThreeDimensionalTable.csp')) + os.path.join(LUTS_DIRECTORY, 'Three_Dimensional_Table.csp')) self.assertEqual(LUT_3.dimensions, 3) self.assertEqual(LUT_3.size, 2) LUT_4 = read_LUT_Cinespace( - os.path.join(LUTS_DIRECTORY, 'NonUniform.csp')) + os.path.join(LUTS_DIRECTORY, 'Non_Uniform.csp')) self.assertEqual(LUT_4[0].is_domain_explicit(), True) self.assertEqual(LUT_4[1].table.shape, (2, 3, 4, 3)) + LUT_5 = read_LUT_Cinespace( + os.path.join(LUTS_DIRECTORY, 'Uncommon_3x1D_With_Pre_Lut.csp')) + self.assertIsInstance(LUT_5[0], LUT3x1D) + self.assertIsInstance(LUT_5[1], LUT3x1D) + class TestWriteLUTCinespace(unittest.TestCase): """ @@ -131,67 +136,84 @@ def test_write_LUT_Cinespace(self): LUT_1_r = read_LUT_Cinespace( os.path.join(LUTS_DIRECTORY, 'ACES_Proxy_10_to_ACES.csp')) - write_LUT_Cinespace( LUT_1_r, os.path.join(self._temporary_directory, 'ACES_Proxy_10_to_ACES.csp')) - LUT_1_t = read_LUT_Cinespace( os.path.join(self._temporary_directory, 'ACES_Proxy_10_to_ACES.csp')) - self.assertEqual(LUT_1_r, LUT_1_t) - self.assertEqual(LUT_1_r, LUT_1_t) LUT_2_r = read_LUT_Cinespace(os.path.join(LUTS_DIRECTORY, 'Demo.csp')) - write_LUT_Cinespace( LUT_2_r, os.path.join(self._temporary_directory, 'Demo.csp')) - LUT_2_t = read_LUT_Cinespace( os.path.join(self._temporary_directory, 'Demo.csp')) - self.assertEqual(LUT_2_r, LUT_2_t) self.assertListEqual(LUT_2_r.comments, LUT_2_t.comments) LUT_3_r = read_LUT_Cinespace( - os.path.join(LUTS_DIRECTORY, 'ThreeDimensionalTable.csp')) - + os.path.join(LUTS_DIRECTORY, 'Three_Dimensional_Table.csp')) write_LUT_Cinespace( LUT_3_r, os.path.join(self._temporary_directory, - 'ThreeDimensionalTable.csp')) - + 'Three_Dimensional_Table.csp')) LUT_3_t = read_LUT_Cinespace( os.path.join(self._temporary_directory, - 'ThreeDimensionalTable.csp')) - + 'Three_Dimensional_Table.csp')) self.assertEqual(LUT_3_r, LUT_3_t) - write_LUT_Cinespace( - LUTSequence(LUT_1_r, LUT_3_r), - os.path.join(self._temporary_directory, 'test_sequence.csp')) - - r = np.array([0.0, 0.1, 0.2, 0.4, 0.8, 1.2]) - g = np.array([-0.1, 0.5, 1.0, np.nan, np.nan, np.nan]) - b = np.array([-1.0, -0.5, 0.0, 0.5, 1.0, np.nan]) - - domain = tstack((r, g, b)) - + domain = tstack(( + np.array([0.0, 0.1, 0.2, 0.4, 0.8, 1.2]), + np.array([-0.1, 0.5, 1.0, np.nan, np.nan, np.nan]), + np.array([-1.0, -0.5, 0.0, 0.5, 1.0, np.nan]), + )) LUT_4_t = LUT3x1D(domain=domain, table=domain * 2) + write_LUT_Cinespace( + LUT_4_t, os.path.join(self._temporary_directory, + 'RaggedDomain.csp')) + LUT_4_r = read_LUT_Cinespace( + os.path.join(self._temporary_directory, 'RaggedDomain.csp')) + np.testing.assert_almost_equal(LUT_4_t.domain, LUT_4_r.domain) + np.testing.assert_almost_equal(LUT_4_t.table, LUT_4_r.table, decimal=6) + LUT_5_r = read_LUT_Cinespace( + os.path.join(LUTS_DIRECTORY, + 'Three_Dimensional_Table_With_Shaper.csp')) + LUT_5_r.sequence[0] = LUT_5_r.sequence[0].as_LUT( + LUT1D, force_conversion=True) write_LUT_Cinespace( - LUT_4_t, - os.path.join(self._temporary_directory, 'ragged_domain.csp')) + LUT_5_r, + os.path.join(self._temporary_directory, + 'Three_Dimensional_Table_With_Shaper.csp')) + LUT_5_t = read_LUT_Cinespace( + os.path.join(self._temporary_directory, + 'Three_Dimensional_Table_With_Shaper.csp')) + LUT_5_r = read_LUT_Cinespace( + os.path.join(LUTS_DIRECTORY, + 'Three_Dimensional_Table_With_Shaper.csp')) + self.assertEqual(LUT_5_r, LUT_5_t) - LUT_4_r = read_LUT_Cinespace( - os.path.join(self._temporary_directory, 'ragged_domain.csp')) + LUT_6_r = read_LUT_Cinespace( + os.path.join(LUTS_DIRECTORY, 'ACES_Proxy_10_to_ACES.csp')) + write_LUT_Cinespace( + LUT_6_r.as_LUT(LUT1D, force_conversion=True), + os.path.join(self._temporary_directory, + 'ACES_Proxy_10_to_ACES.csp')) + LUT_6_t = read_LUT_Cinespace( + os.path.join(self._temporary_directory, + 'ACES_Proxy_10_to_ACES.csp')) + self.assertEqual(LUT_6_r, LUT_6_t) - np.testing.assert_almost_equal(LUT_4_t.domain, LUT_4_r.domain) + def test_raise_exception_write_LUT_Cinespace(self): + """ + Tests :func:`colour.io.luts.cinespace_csp.write_LUT_Cinespace` + definition raised exception. + """ - np.testing.assert_almost_equal(LUT_4_t.table, LUT_4_r.table, decimal=6) + self.assertRaises(ValueError, write_LUT_Cinespace, object(), '') if __name__ == '__main__': diff --git a/colour/io/luts/tests/test_iridas_cube.py b/colour/io/luts/tests/test_iridas_cube.py index 2182d371cb..2c67d3beb5 100644 --- a/colour/io/luts/tests/test_iridas_cube.py +++ b/colour/io/luts/tests/test_iridas_cube.py @@ -11,7 +11,8 @@ import shutil import tempfile -from colour.io import LUTSequence, read_LUT_IridasCube, write_LUT_IridasCube +from colour.io import (LUT1D, LUTSequence, read_LUT_IridasCube, + write_LUT_IridasCube) __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -90,7 +91,7 @@ def test_read_LUT_IridasCube(self): np.array([[0, 0, 0], [1, 2, 3]])) LUT_3 = read_LUT_IridasCube( - os.path.join(LUTS_DIRECTORY, 'ThreeDimensionalTable.cube')) + os.path.join(LUTS_DIRECTORY, 'Three_Dimensional_Table.cube')) self.assertEqual(LUT_3.dimensions, 3) self.assertEqual(LUT_3.size, 2) @@ -123,51 +124,52 @@ def test_write_LUT_IridasCube(self): LUT_1_r = read_LUT_IridasCube( os.path.join(LUTS_DIRECTORY, 'ACES_Proxy_10_to_ACES.cube')) - write_LUT_IridasCube( LUT_1_r, os.path.join(self._temporary_directory, 'ACES_Proxy_10_to_ACES.cube')) - LUT_1_t = read_LUT_IridasCube( os.path.join(self._temporary_directory, 'ACES_Proxy_10_to_ACES.cube')) - self.assertEqual(LUT_1_r, LUT_1_t) write_LUT_IridasCube( LUTSequence(LUT_1_r), os.path.join(self._temporary_directory, 'ACES_Proxy_10_to_ACES.cube')) - self.assertEqual(LUT_1_r, LUT_1_t) LUT_2_r = read_LUT_IridasCube( os.path.join(LUTS_DIRECTORY, 'Demo.cube')) - write_LUT_IridasCube( LUT_2_r, os.path.join(self._temporary_directory, 'Demo.cube')) - LUT_2_t = read_LUT_IridasCube( os.path.join(self._temporary_directory, 'Demo.cube')) - self.assertEqual(LUT_2_r, LUT_2_t) self.assertListEqual(LUT_2_r.comments, LUT_2_t.comments) LUT_3_r = read_LUT_IridasCube( - os.path.join(LUTS_DIRECTORY, 'ThreeDimensionalTable.cube')) - + os.path.join(LUTS_DIRECTORY, 'Three_Dimensional_Table.cube')) write_LUT_IridasCube( LUT_3_r, os.path.join(self._temporary_directory, - 'ThreeDimensionalTable.cube')) - + 'Three_Dimensional_Table.cube')) LUT_3_t = read_LUT_IridasCube( os.path.join(self._temporary_directory, - 'ThreeDimensionalTable.cube')) - + 'Three_Dimensional_Table.cube')) self.assertEqual(LUT_3_r, LUT_3_t) + LUT_4_r = read_LUT_IridasCube( + os.path.join(LUTS_DIRECTORY, 'ACES_Proxy_10_to_ACES.cube')) + write_LUT_IridasCube( + LUT_4_r.as_LUT(LUT1D, force_conversion=True), + os.path.join(self._temporary_directory, + 'ACES_Proxy_10_to_ACES.cube')) + LUT_4_t = read_LUT_IridasCube( + os.path.join(self._temporary_directory, + 'ACES_Proxy_10_to_ACES.cube')) + self.assertEqual(LUT_4_r, LUT_4_t) + if __name__ == '__main__': unittest.main() diff --git a/colour/io/luts/tests/test_lut.py b/colour/io/luts/tests/test_lut.py index 20e71ee269..16c64d81d1 100644 --- a/colour/io/luts/tests/test_lut.py +++ b/colour/io/luts/tests/test_lut.py @@ -385,6 +385,21 @@ def test_arithmetical_operation(self): self._table_1 ** 10, decimal=7) + np.testing.assert_almost_equal( + (LUT_1 + 10).table, self._table_1 + 10, decimal=7) + + np.testing.assert_almost_equal( + (LUT_1 - 10).table, self._table_1 - 10, decimal=7) + + np.testing.assert_almost_equal( + (LUT_1 * 10).table, self._table_1 * 10, decimal=7) + + np.testing.assert_almost_equal( + (LUT_1 / 10).table, self._table_1 / 10, decimal=7) + + np.testing.assert_almost_equal( + (LUT_1 ** 10).table, self._table_1 ** 10, decimal=7) + np.testing.assert_almost_equal( LUT_2.arithmetical_operation(10, '+', True).table, self._table_1 + 10, @@ -819,6 +834,16 @@ def test_required_methods(self): for method in required_methods: self.assertIn(method, dir(LUTSequence)) + def test_sequence(self): + """ + Tests :class:`colour.io.luts.lut.LUTSequence.sequence` property. + """ + + sequence = [self._LUT_1, self._LUT_2, self._LUT_3] + LUT_sequence = LUTSequence() + LUT_sequence.sequence = sequence + self.assertListEqual(self._LUT_sequence.sequence, sequence) + def test__init__(self): """ Tests :class:`colour.io.luts.lut.LUTSequence.__init__` method. @@ -1109,8 +1134,14 @@ def test__eq__(self): Tests :class:`colour.io.luts.lut.LUTSequence.__eq__` method. """ - self.assertEqual(self._LUT_sequence, - LUTSequence(self._LUT_1, self._LUT_2, self._LUT_3)) + LUT_sequence_1 = LUTSequence(self._LUT_1, self._LUT_2, self._LUT_3) + LUT_sequence_2 = LUTSequence(self._LUT_1, self._LUT_2) + + self.assertEqual(self._LUT_sequence, LUT_sequence_1) + + self.assertNotEqual(self._LUT_sequence, self._LUT_sequence[0]) + + self.assertNotEqual(LUT_sequence_1, LUT_sequence_2) def test__neq__(self): """ @@ -1399,13 +1430,13 @@ def test_LUT_to_LUT(self): force_conversion=True, channel_weights=channel_weights) - domain = np.array( - [np.max(self._domain[0, ...]), - np.min(self._domain[1, ...])]) + channel_weights = np.array([1 / 3, 1 / 3, 1 / 3]) - np.testing.assert_array_equal(LUT.domain, domain) + domain = np.array([ + np.sum(self._domain[0, ...] * channel_weights), + np.sum(self._domain[1, ...] * channel_weights) + ]) - channel_weights = np.array([1 / 3, 1 / 3, 1 / 3]) LUT = LUT_to_LUT( self._LUT_2, LUT1D, @@ -1614,18 +1645,12 @@ def test_LUT_to_LUT(self): np.testing.assert_almost_equal( LUT.table, np.array([ - 0.18251270, 0.32131094, 0.38946008, 0.44459323, 0.49143103, - 0.53320310, 0.57131488, 0.60668991, 0.63936815, 0.67021168, - 0.69974159, 0.72733338, 0.75390361, 0.77972044, 0.80398593, - 0.82762659 + 0.04562817, 0.24699999, 0.40967557, 0.50401689, 0.57985117, + 0.64458830, 0.70250077, 0.75476586, 0.80317708, 0.83944710, + 0.86337188, 0.88622285, 0.90786039, 0.92160338, 0.92992641, + 0.93781796 ])) - domain = np.array( - [np.max(self._domain[0, ...]), - np.min(self._domain[1, ...])]) - - np.testing.assert_array_equal(LUT.domain, domain) - # "LUT" 3D to "LUT" 3x1D. self.assertRaises(ValueError, lambda: LUT_to_LUT(self._LUT_3, LUT3x1D)) diff --git a/colour/io/luts/tests/test_resolve_cube.py b/colour/io/luts/tests/test_resolve_cube.py index 26b67e795a..d2cc6a5599 100644 --- a/colour/io/luts/tests/test_resolve_cube.py +++ b/colour/io/luts/tests/test_resolve_cube.py @@ -11,7 +11,7 @@ import shutil import tempfile -from colour.io import read_LUT_ResolveCube, write_LUT_ResolveCube +from colour.io import LUT1D, read_LUT_ResolveCube, write_LUT_ResolveCube __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -92,7 +92,7 @@ def test_read_LUT_ResolveCube(self): np.array([[0, 0, 0], [3, 3, 3]])) LUT_3 = read_LUT_ResolveCube( - os.path.join(LUTS_DIRECTORY, 'ThreeDimensionalTable.cube')) + os.path.join(LUTS_DIRECTORY, 'Three_Dimensional_Table.cube')) self.assertEqual(LUT_3.dimensions, 3) self.assertEqual(LUT_3.size, 2) @@ -175,19 +175,63 @@ def test_write_LUT_ResolveCube(self): self.assertListEqual(LUT_2_r.comments, LUT_2_t.comments) LUT_3_r = read_LUT_ResolveCube( - os.path.join(LUTS_DIRECTORY, 'ThreeDimensionalTable.cube')) + os.path.join(LUTS_DIRECTORY, 'Three_Dimensional_Table.cube')) write_LUT_ResolveCube( LUT_3_r, os.path.join(self._temporary_directory, - 'ThreeDimensionalTable.cube')) + 'Three_Dimensional_Table.cube')) LUT_3_t = read_LUT_ResolveCube( os.path.join(self._temporary_directory, - 'ThreeDimensionalTable.cube')) + 'Three_Dimensional_Table.cube')) self.assertEqual(LUT_3_r, LUT_3_t) + LUT_4_r = read_LUT_ResolveCube( + os.path.join(LUTS_DIRECTORY, + 'Three_Dimensional_Table_With_Shaper.cube')) + + LUT_4_r.sequence[0] = LUT_4_r.sequence[0].as_LUT( + LUT1D, force_conversion=True) + + write_LUT_ResolveCube( + LUT_4_r, + os.path.join(self._temporary_directory, + 'Three_Dimensional_Table_With_Shaper.cube')) + + LUT_4_t = read_LUT_ResolveCube( + os.path.join(self._temporary_directory, + 'Three_Dimensional_Table_With_Shaper.cube')) + + LUT_4_r = read_LUT_ResolveCube( + os.path.join(LUTS_DIRECTORY, + 'Three_Dimensional_Table_With_Shaper.cube')) + + self.assertEqual(LUT_4_r, LUT_4_t) + + LUT_5_r = read_LUT_ResolveCube( + os.path.join(LUTS_DIRECTORY, 'ACES_Proxy_10_to_ACES.cube')) + + write_LUT_ResolveCube( + LUT_5_r.as_LUT(LUT1D, force_conversion=True), + os.path.join(self._temporary_directory, + 'ACES_Proxy_10_to_ACES.cube')) + + LUT_5_t = read_LUT_ResolveCube( + os.path.join(self._temporary_directory, + 'ACES_Proxy_10_to_ACES.cube')) + + self.assertEqual(LUT_5_r, LUT_5_t) + + def test_raise_exception_write_LUT_ResolveCube(self): + """ + Tests :func:`colour.io.luts.resolve_cube.write_LUT_ResolveCube` + definition raised exception. + """ + + self.assertRaises(ValueError, write_LUT_ResolveCube, object(), '') + if __name__ == '__main__': unittest.main() diff --git a/colour/io/luts/tests/test_sony_spi1d.py b/colour/io/luts/tests/test_sony_spi1d.py index 7a51c85b48..947c814008 100644 --- a/colour/io/luts/tests/test_sony_spi1d.py +++ b/colour/io/luts/tests/test_sony_spi1d.py @@ -11,7 +11,7 @@ import tempfile import unittest -from colour.io import LUTSequence, read_LUT_SonySPI1D, write_LUT_SonySPI1D +from colour.io import read_LUT_SonySPI1D, write_LUT_SonySPI1D __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -38,7 +38,7 @@ def test_read_LUT_SonySPI1D(self): """ LUT_1 = read_LUT_SonySPI1D( - os.path.join(LUTS_DIRECTORY, 'oetf_reverse_sRGB_1D.spi1d')) + os.path.join(LUTS_DIRECTORY, 'eotf_sRGB_1D.spi1d')) np.testing.assert_almost_equal( LUT_1.table, @@ -49,21 +49,19 @@ def test_read_LUT_SonySPI1D(self): 1.17501630e+00, 1.45946870e+00, 1.78049680e+00, 2.13933380e+00, 2.53715520e+00 ])) - self.assertEqual(LUT_1.name, 'oetf reverse sRGB 1D') + self.assertEqual(LUT_1.name, 'eotf sRGB 1D') self.assertEqual(LUT_1.dimensions, 1) np.testing.assert_array_equal(LUT_1.domain, np.array([-0.1, 1.5])) self.assertEqual(LUT_1.size, 16) - self.assertListEqual(LUT_1.comments, [ - 'Generated by "Colour 0.3.11".', - '"colour.models.oetf_reverse_sRGB".' - ]) + self.assertListEqual( + LUT_1.comments, + ['Generated by "Colour 0.3.11".', '"colour.models.eotf_sRGB".']) LUT_2 = read_LUT_SonySPI1D( - os.path.join(LUTS_DIRECTORY, 'oetf_reverse_sRGB_3x1D.spi1d')) - self.assertListEqual(LUT_2.comments, [ - 'Generated by "Colour 0.3.11".', - '"colour.models.oetf_reverse_sRGB".' - ]) + os.path.join(LUTS_DIRECTORY, 'eotf_sRGB_3x1D.spi1d')) + self.assertListEqual( + LUT_2.comments, + ['Generated by "Colour 0.3.11".', '"colour.models.eotf_sRGB".']) np.testing.assert_array_equal( LUT_2.domain, np.array([[-0.1, -0.1, -0.1], [1.5, 1.5, 1.5]])) @@ -94,38 +92,21 @@ def test_write_LUT_SonySPI1D(self): """ LUT_1_r = read_LUT_SonySPI1D( - os.path.join(LUTS_DIRECTORY, 'oetf_reverse_sRGB_1D.spi1d')) - + os.path.join(LUTS_DIRECTORY, 'eotf_sRGB_1D.spi1d')) write_LUT_SonySPI1D( LUT_1_r, - os.path.join(self._temporary_directory, - 'oetf_reverse_sRGB_1D.spi1d')) - + os.path.join(self._temporary_directory, 'eotf_sRGB_1D.spi1d')) LUT_1_t = read_LUT_SonySPI1D( - os.path.join(self._temporary_directory, - 'oetf_reverse_sRGB_1D.spi1d')) - - self.assertEqual(LUT_1_r, LUT_1_t) - - write_LUT_SonySPI1D( - LUTSequence(LUT_1_r), - os.path.join(self._temporary_directory, - 'oetf_reverse_sRGB_1D.spi1d')) - + os.path.join(self._temporary_directory, 'eotf_sRGB_1D.spi1d')) self.assertEqual(LUT_1_r, LUT_1_t) LUT_2_r = read_LUT_SonySPI1D( - os.path.join(LUTS_DIRECTORY, 'oetf_reverse_sRGB_3x1D.spi1d')) - + os.path.join(LUTS_DIRECTORY, 'eotf_sRGB_3x1D.spi1d')) write_LUT_SonySPI1D( LUT_2_r, - os.path.join(self._temporary_directory, - 'oetf_reverse_sRGB_3x1D.spi1d')) - + os.path.join(self._temporary_directory, 'eotf_sRGB_3x1D.spi1d')) LUT_2_t = read_LUT_SonySPI1D( - os.path.join(self._temporary_directory, - 'oetf_reverse_sRGB_3x1D.spi1d')) - + os.path.join(self._temporary_directory, 'eotf_sRGB_3x1D.spi1d')) self.assertEqual(LUT_2_r, LUT_2_t) self.assertListEqual(LUT_2_r.comments, LUT_2_t.comments) diff --git a/colour/io/luts/tests/test_sony_spi3d.py b/colour/io/luts/tests/test_sony_spi3d.py index 48602de8a5..c4de3cf493 100644 --- a/colour/io/luts/tests/test_sony_spi3d.py +++ b/colour/io/luts/tests/test_sony_spi3d.py @@ -37,11 +37,11 @@ def test_read_LUT_SonySPI3D(self): Tests :func:`colour.io.luts.sony_spi3d.read_LUT_SonySPI3D` definition. """ - LUT = read_LUT_SonySPI3D( - os.path.join(LUTS_DIRECTORY, 'ColourCorrect.spi3d')) + LUT_1 = read_LUT_SonySPI3D( + os.path.join(LUTS_DIRECTORY, 'Colour_Correct.spi3d')) np.testing.assert_almost_equal( - LUT.table, + LUT_1.table, np.array([ [ [ @@ -148,12 +148,12 @@ def test_read_LUT_SonySPI3D(self): ], ], ])) - self.assertEqual(LUT.name, 'ColourCorrect') - self.assertEqual(LUT.dimensions, 3) - np.testing.assert_array_equal(LUT.domain, + self.assertEqual(LUT_1.name, 'Colour Correct') + self.assertEqual(LUT_1.dimensions, 3) + np.testing.assert_array_equal(LUT_1.domain, np.array([[0, 0, 0], [1, 1, 1]])) - self.assertEqual(LUT.size, 4) - self.assertListEqual(LUT.comments, + self.assertEqual(LUT_1.size, 4) + self.assertListEqual(LUT_1.comments, ['Adapted from a LUT generated by Foundry::LUT.']) @@ -183,21 +183,18 @@ def test_write_LUT_SonySPI3D(self): """ LUT_r = read_LUT_SonySPI3D( - os.path.join(LUTS_DIRECTORY, 'ColourCorrect.spi3d')) + os.path.join(LUTS_DIRECTORY, 'Colour_Correct.spi3d')) write_LUT_SonySPI3D( LUT_r, - os.path.join(self._temporary_directory, 'ColourCorrect.spi3d')) - + os.path.join(self._temporary_directory, 'Colour_Correct.spi3d')) LUT_t = read_LUT_SonySPI3D( - os.path.join(self._temporary_directory, 'ColourCorrect.spi3d')) - + os.path.join(self._temporary_directory, 'Colour_Correct.spi3d')) self.assertEqual(LUT_r, LUT_t) write_LUT_SonySPI3D( LUTSequence(LUT_r), - os.path.join(self._temporary_directory, 'ColourCorrect.spi3d')) - + os.path.join(self._temporary_directory, 'Colour_Correct.spi3d')) self.assertEqual(LUT_r, LUT_t) diff --git a/colour/io/tabular.py b/colour/io/tabular.py index 793a6aa085..bfa80e944a 100644 --- a/colour/io/tabular.py +++ b/colour/io/tabular.py @@ -308,9 +308,9 @@ def write_sds_to_csv_file(sds, path, delimiter=',', fields=None): delimiter=str(delimiter), fieldnames=['wavelength'] + fields, lineterminator='\n') - # Python 2.7.x / 3.4.x only. - # writer.writeheader() - writer.writerow(dict((name, name) for name in writer.fieldnames)) + + writer.writeheader() + for wavelength in wavelengths: row = {'wavelength': wavelength} row.update( diff --git a/colour/io/tests/resources/CMSTestPattern.exr b/colour/io/tests/resources/CMS_Test_Pattern.exr similarity index 100% rename from colour/io/tests/resources/CMSTestPattern.exr rename to colour/io/tests/resources/CMS_Test_Pattern.exr diff --git a/colour/io/tests/resources/Colour_Logo.png b/colour/io/tests/resources/Colour_Logo.png new file mode 100644 index 0000000000..50fae32053 Binary files /dev/null and b/colour/io/tests/resources/Colour_Logo.png differ diff --git a/colour/io/tests/resources/Invalid.csv b/colour/io/tests/resources/Invalid.csv new file mode 100644 index 0000000000..99f0fe0183 --- /dev/null +++ b/colour/io/tests/resources/Invalid.csv @@ -0,0 +1,32 @@ +wavelength +400 +410 +420 +430 +440 +450 +460 +470 +480 +490 +500 +510 +520 +530 +540 +550 +560 +570 +580 +590 +600 +610 +620 +630 +640 +650 +660 +670 +680 +690 +700 diff --git a/colour/io/tests/resources/Single_Channel.exr b/colour/io/tests/resources/Single_Channel.exr new file mode 100644 index 0000000000..81c5d7d493 Binary files /dev/null and b/colour/io/tests/resources/Single_Channel.exr differ diff --git a/colour/io/tests/resources/xrite_digital_colour_checker.txt b/colour/io/tests/resources/X-Rite_Digital_Colour_Checker.txt similarity index 100% rename from colour/io/tests/resources/xrite_digital_colour_checker.txt rename to colour/io/tests/resources/X-Rite_Digital_Colour_Checker.txt diff --git a/colour/io/tests/test_ies_tm2714.py b/colour/io/tests/test_ies_tm2714.py index a79aa36872..176bb273a5 100644 --- a/colour/io/tests/test_ies_tm2714.py +++ b/colour/io/tests/test_ies_tm2714.py @@ -206,7 +206,7 @@ def test_read(self, sd=None): """ Tests :attr:`colour.io.iestm2714.SpectralDistribution_IESTM2714.read` method. - +_temporary_directory_temporary_directory Parameters ---------- sd : SpectralDistribution_IESTM2714, optional @@ -215,9 +215,7 @@ def test_read(self, sd=None): if sd is None: sd = SpectralDistribution_IESTM2714( - os.path.join(RESOURCES_DIRECTORY, 'Fluorescent.spdx')) - - self.assertTrue(sd.read()) + os.path.join(RESOURCES_DIRECTORY, 'Fluorescent.spdx')).read() sd_r = SpectralDistribution(FLUORESCENT_FILE_SPECTRAL_DATA) @@ -239,13 +237,11 @@ def test_write(self): """ sd_r = SpectralDistribution_IESTM2714( - os.path.join(RESOURCES_DIRECTORY, 'Fluorescent.spdx')) - - sd_r.read() + os.path.join(RESOURCES_DIRECTORY, 'Fluorescent.spdx')).read() sd_r.path = os.path.join(self._temporary_directory, 'Fluorescent.spdx') self.assertTrue(sd_r.write()) - sd_t = SpectralDistribution_IESTM2714(sd_r.path) + sd_t = SpectralDistribution_IESTM2714(sd_r.path).read() self.test_read(sd_t) self.assertEquals(sd_r, sd_t) diff --git a/colour/io/tests/test_image.py b/colour/io/tests/test_image.py new file mode 100644 index 0000000000..96e6a52511 --- /dev/null +++ b/colour/io/tests/test_image.py @@ -0,0 +1,420 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.io.image` module. +""" + +from __future__ import division, unicode_literals + +import numpy as np +import os +import platform +import shutil +import unittest +import tempfile + +from colour.io import convert_bit_depth +from colour.io import read_image_OpenImageIO, write_image_OpenImageIO +from colour.io import read_image_Imageio, write_image_Imageio +from colour.io import read_image, write_image +from colour.io import ImageAttribute_Specification +from colour.utilities import is_openimageio_installed + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = [ + 'RESOURCES_DIRECTORY', 'TestReadImageOpenImageIO', + 'TestWriteImageOpenImageIO', 'TestReadImageImageio', + 'TestWriteImageImageio', 'TestReadImage', 'TestWriteImage' +] + +RESOURCES_DIRECTORY = os.path.join(os.path.dirname(__file__), 'resources') + + +class TestConvertBitDepth(unittest.TestCase): + """ + Defines :func:`colour.io.image.convert_bit_depth` definition units tests + methods. + """ + + def test_convert_bit_depth(self): + """ + Tests :func:`colour.io.image.convert_bit_depth` definition. + """ + + a = np.around(np.linspace(0, 1, 10) * 255).astype('uint8') + self.assertIs(convert_bit_depth(a, 'uint8').dtype, np.dtype('uint8')) + np.testing.assert_equal(convert_bit_depth(a, 'uint8'), a) + + self.assertIs(convert_bit_depth(a, 'uint16').dtype, np.dtype('uint16')) + np.testing.assert_equal( + convert_bit_depth(a, 'uint16'), + np.array([ + 0, 7196, 14649, 21845, 29041, 36494, 43690, 50886, 58339, 65535 + ])) + + self.assertIs( + convert_bit_depth(a, 'float16').dtype, np.dtype('float16')) + np.testing.assert_almost_equal( + convert_bit_depth(a, 'float16'), + np.array([ + 0.0000, 0.1098, 0.2235, 0.3333, 0.443, 0.5566, 0.6665, 0.7764, + 0.8900, 1.0000 + ]), + decimal=3) + + self.assertIs( + convert_bit_depth(a, 'float32').dtype, np.dtype('float32')) + np.testing.assert_almost_equal( + convert_bit_depth(a, 'float32'), + np.array([ + 0.00000000, 0.10980392, 0.22352941, 0.33333334, 0.44313726, + 0.55686277, 0.66666669, 0.77647060, 0.89019608, 1.00000000 + ]), + decimal=7) + + self.assertIs( + convert_bit_depth(a, 'float64').dtype, np.dtype('float64')) + + if platform.system() not in ('Windows', + 'Microsoft'): # pragma: no cover + self.assertIs( + convert_bit_depth(a, 'float128').dtype, np.dtype('float128')) + + a = np.around(np.linspace(0, 1, 10) * 65535).astype('uint16') + self.assertIs(convert_bit_depth(a, 'uint8').dtype, np.dtype('uint8')) + np.testing.assert_equal( + convert_bit_depth(a, 'uint8'), + np.array([0, 28, 56, 85, 113, 141, 170, 198, 226, 255])) + + self.assertIs(convert_bit_depth(a, 'uint16').dtype, np.dtype('uint16')) + np.testing.assert_equal(convert_bit_depth(a, 'uint16'), a) + + self.assertIs( + convert_bit_depth(a, 'float16').dtype, np.dtype('float16')) + np.testing.assert_almost_equal( + convert_bit_depth(a, 'float16'), + np.array([ + 0.0000, 0.1098, 0.2235, 0.3333, 0.443, 0.5566, 0.6665, 0.7764, + 0.8900, 1.0000 + ]), + decimal=3) + + self.assertIs( + convert_bit_depth(a, 'float32').dtype, np.dtype('float32')) + np.testing.assert_almost_equal( + convert_bit_depth(a, 'float32'), + np.array([ + 0.00000000, 0.11111620, 0.22221714, 0.33333334, 0.44444954, + 0.55555046, 0.66666669, 0.77778286, 0.88888383, 1.00000000 + ]), + decimal=7) + + self.assertIs( + convert_bit_depth(a, 'float64').dtype, np.dtype('float64')) + + if platform.system() not in ('Windows', + 'Microsoft'): # pragma: no cover + self.assertIs( + convert_bit_depth(a, 'float128').dtype, np.dtype('float128')) + + a = np.linspace(0, 1, 10, dtype=np.float64) + self.assertIs(convert_bit_depth(a, 'uint8').dtype, np.dtype('uint8')) + np.testing.assert_equal( + convert_bit_depth(a, 'uint8'), + np.array([0, 28, 57, 85, 113, 142, 170, 198, 227, 255])) + + self.assertIs(convert_bit_depth(a, 'uint16').dtype, np.dtype('uint16')) + np.testing.assert_equal( + convert_bit_depth(a, 'uint16'), + np.array([ + 0, 7282, 14563, 21845, 29127, 36408, 43690, 50972, 58253, 65535 + ])) + + self.assertIs( + convert_bit_depth(a, 'float16').dtype, np.dtype('float16')) + np.testing.assert_almost_equal( + convert_bit_depth(a, 'float16'), + np.array([ + 0.0000, 0.1111, 0.2222, 0.3333, 0.4443, 0.5557, 0.6665, 0.7780, + 0.8887, 1.0000 + ]), + decimal=3) + + self.assertIs( + convert_bit_depth(a, 'float32').dtype, np.dtype('float32')) + np.testing.assert_almost_equal( + convert_bit_depth(a, 'float32'), a, decimal=7) + + self.assertIs( + convert_bit_depth(a, 'float64').dtype, np.dtype('float64')) + + if platform.system() not in ('Windows', + 'Microsoft'): # pragma: no cover + self.assertIs( + convert_bit_depth(a, 'float128').dtype, np.dtype('float128')) + + +class TestReadImageOpenImageIO(unittest.TestCase): + """ + Defines :func:`colour.io.image.read_image_OpenImageIO` definition units + tests methods. + """ + + def test_read_image_OpenImageIO(self): # pragma: no cover + """ + Tests :func:`colour.io.image.read_image_OpenImageIO` definition. + """ + + if not is_openimageio_installed(): + return + + image = read_image_OpenImageIO( + os.path.join(RESOURCES_DIRECTORY, 'CMS_Test_Pattern.exr')) + self.assertTupleEqual(image.shape, (1267, 1274, 3)) + self.assertIs(image.dtype, np.dtype('float32')) + + image = read_image_OpenImageIO( + os.path.join(RESOURCES_DIRECTORY, 'CMS_Test_Pattern.exr'), + 'float16') + self.assertIs(image.dtype, np.dtype('float16')) + + image, attributes = read_image_OpenImageIO( + os.path.join(RESOURCES_DIRECTORY, 'CMS_Test_Pattern.exr'), + attributes=True) + self.assertTupleEqual(image.shape, (1267, 1274, 3)) + self.assertEqual(attributes[0].name, 'oiio:ColorSpace') + self.assertEqual(attributes[0].value, 'Linear') + + image = read_image_OpenImageIO( + os.path.join(RESOURCES_DIRECTORY, 'Single_Channel.exr')) + self.assertTupleEqual(image.shape, (256, 256)) + + image = read_image_OpenImageIO( + os.path.join(RESOURCES_DIRECTORY, 'Colour_Logo.png'), 'uint8') + self.assertTupleEqual(image.shape, (128, 256, 4)) + self.assertIs(image.dtype, np.dtype('uint8')) + self.assertEqual(np.min(image), 0) + self.assertEqual(np.max(image), 255) + + image = read_image_OpenImageIO( + os.path.join(RESOURCES_DIRECTORY, 'Colour_Logo.png'), 'uint16') + self.assertTupleEqual(image.shape, (128, 256, 4)) + self.assertIs(image.dtype, np.dtype('uint16')) + self.assertEqual(np.min(image), 0) + self.assertEqual(np.max(image), 65535) + + # TODO: Investigate "OIIO" behaviour here: 1.0 != 15360.0 + # image = read_image_OpenImageIO( + # os.path.join(RESOURCES_DIRECTORY, 'Colour_Logo.png'), 'float16') + # self.assertIs(image.dtype, np.dtype('float16')) + # self.assertEqual(np.min(image), 0.0) + # self.assertEqual(np.max(image), 1.0) + + image = read_image_OpenImageIO( + os.path.join(RESOURCES_DIRECTORY, 'Colour_Logo.png'), 'float32') + self.assertIs(image.dtype, np.dtype('float32')) + self.assertEqual(np.min(image), 0.0) + self.assertEqual(np.max(image), 1.0) + + +class TestWriteImageOpenImageIO(unittest.TestCase): + """ + Defines :func:`colour.io.image.write_image_OpenImageIO` definition units + tests methods. + """ + + def setUp(self): + """ + Initialises common tests attributes. + """ + + self._temporary_directory = tempfile.mkdtemp() + + def tearDown(self): + """ + After tests actions. + """ + + shutil.rmtree(self._temporary_directory) + + def test_write_image_OpenImageIO(self): # pragma: no cover + """ + Tests :func:`colour.io.image.write_image_OpenImageIO` definition. + """ + + if not is_openimageio_installed(): + return + + source_image_path = os.path.join(RESOURCES_DIRECTORY, + 'CMS_Test_Pattern.exr') + target_image_path = os.path.join(self._temporary_directory, + 'CMS_Test_Pattern.exr') + image = read_image_OpenImageIO(source_image_path) + write_image_OpenImageIO(image, target_image_path) + image = read_image_OpenImageIO(target_image_path) + self.assertTupleEqual(image.shape, (1267, 1274, 3)) + self.assertIs(image.dtype, np.dtype('float32')) + + write_image_OpenImageIO( + image, + target_image_path, + attributes=[ImageAttribute_Specification('John', 'Doe')]) + image, attributes = read_image_OpenImageIO( + target_image_path, attributes=True) + for attribute in attributes: + if attribute.name == 'John': + self.assertEqual(attribute.value, 'Doe') + + +class TestReadImageImageio(unittest.TestCase): + """ + Defines :func:`colour.io.image.read_image_Imageio` definition units tests + methods. + """ + + def test_read_image_Imageio(self): + """ + Tests :func:`colour.io.image.read_image_Imageio` definition. + """ + + image = read_image_Imageio( + os.path.join(RESOURCES_DIRECTORY, 'CMS_Test_Pattern.exr')) + self.assertTupleEqual(image.shape, (1267, 1274, 3)) + self.assertIs(image.dtype, np.dtype('float32')) + + image = read_image_Imageio( + os.path.join(RESOURCES_DIRECTORY, 'CMS_Test_Pattern.exr'), + 'float16') + self.assertTupleEqual(image.shape, (1267, 1274, 3)) + self.assertIs(image.dtype, np.dtype('float16')) + + image = read_image_Imageio( + os.path.join(RESOURCES_DIRECTORY, 'Single_Channel.exr')) + self.assertTupleEqual(image.shape, (256, 256)) + + image = read_image_Imageio( + os.path.join(RESOURCES_DIRECTORY, 'Colour_Logo.png'), 'uint8') + self.assertTupleEqual(image.shape, (128, 256, 4)) + self.assertIs(image.dtype, np.dtype('uint8')) + self.assertEqual(np.min(image), 0) + self.assertEqual(np.max(image), 255) + + image = read_image_Imageio( + os.path.join(RESOURCES_DIRECTORY, 'Colour_Logo.png'), 'uint16') + self.assertTupleEqual(image.shape, (128, 256, 4)) + self.assertIs(image.dtype, np.dtype('uint16')) + self.assertEqual(np.min(image), 0) + self.assertEqual(np.max(image), 65535) + + image = read_image_Imageio( + os.path.join(RESOURCES_DIRECTORY, 'Colour_Logo.png'), 'float16') + self.assertIs(image.dtype, np.dtype('float16')) + self.assertEqual(np.min(image), 0.0) + self.assertEqual(np.max(image), 1.0) + + image = read_image_Imageio( + os.path.join(RESOURCES_DIRECTORY, 'Colour_Logo.png'), 'float32') + self.assertIs(image.dtype, np.dtype('float32')) + self.assertEqual(np.min(image), 0.0) + self.assertEqual(np.max(image), 1.0) + + +class TestWriteImageImageio(unittest.TestCase): + """ + Defines :func:`colour.io.image.write_image_Imageio` definition units + tests methods. + """ + + def setUp(self): + """ + Initialises common tests attributes. + """ + + self._temporary_directory = tempfile.mkdtemp() + + def tearDown(self): + """ + After tests actions. + """ + + shutil.rmtree(self._temporary_directory) + + def test_write_image_Imageio(self): + """ + Tests :func:`colour.io.image.write_image_Imageio` definition. + """ + + source_image_path = os.path.join(RESOURCES_DIRECTORY, + 'CMS_Test_Pattern.exr') + target_image_path = os.path.join(self._temporary_directory, + 'CMS_Test_Pattern.exr') + image = read_image_Imageio(source_image_path) + write_image_Imageio(image, target_image_path) + image = read_image_Imageio(target_image_path) + self.assertTupleEqual(image.shape, (1267, 1274, 3)) + self.assertIs(image.dtype, np.dtype('float32')) + + +class TestReadImage(unittest.TestCase): + """ + Defines :func:`colour.io.image.read_image` definition units tests + methods. + """ + + def test_read_image(self): + """ + Tests :func:`colour.io.image.read_image` definition. + """ + + image = read_image( + os.path.join(RESOURCES_DIRECTORY, 'CMS_Test_Pattern.exr')) + self.assertTupleEqual(image.shape, (1267, 1274, 3)) + self.assertIs(image.dtype, np.dtype('float32')) + + image = read_image( + os.path.join(RESOURCES_DIRECTORY, 'Single_Channel.exr')) + self.assertTupleEqual(image.shape, (256, 256)) + + +class TestWriteImage(unittest.TestCase): + """ + Defines :func:`colour.io.image.write_image` definition units tests methods. + """ + + def setUp(self): + """ + Initialises common tests attributes. + """ + + self._temporary_directory = tempfile.mkdtemp() + + def tearDown(self): + """ + After tests actions. + """ + + shutil.rmtree(self._temporary_directory) + + def test_write_image(self): + """ + Tests :func:`colour.io.image.write_image` definition. + """ + + source_image_path = os.path.join(RESOURCES_DIRECTORY, + 'CMS_Test_Pattern.exr') + target_image_path = os.path.join(self._temporary_directory, + 'CMS_Test_Pattern.exr') + image = read_image(source_image_path) + write_image(image, target_image_path) + image = read_image(target_image_path) + self.assertTupleEqual(image.shape, (1267, 1274, 3)) + self.assertIs(image.dtype, np.dtype('float32')) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/io/tests/test_tabular.py b/colour/io/tests/test_tabular.py index 214c7c5503..4f85fa6635 100644 --- a/colour/io/tests/test_tabular.py +++ b/colour/io/tests/test_tabular.py @@ -12,7 +12,7 @@ import tempfile from six import PY2, text_type -from colour.colorimetry import SpectralDistribution +from colour.colorimetry import SpectralDistribution, SpectralShape from colour.io import (read_spectral_data_from_csv_file, read_sds_from_csv_file, write_sds_to_csv_file) @@ -146,6 +146,15 @@ def test_read_spectral_data_from_csv_file(self): default=-1) self.assertEqual(data['s_bar'][760], -1) + def test_raise_exception_read_spectral_data_from_csv_file(self): + """ + Tests :attr:`colour.io.tabular.read_spectral_data_from_csv_file` + definition raised exception. + """ + + self.assertRaises(RuntimeError, read_spectral_data_from_csv_file, + os.path.join(RESOURCES_DIRECTORY, 'Invalid.csv')) + class TestReadSdsFromCsvFile(unittest.TestCase): """ @@ -201,7 +210,7 @@ def test_write_sds_to_csv_file(self): write_sds_to_csv_file(sds, colour_checker_n_ohta_test) sds_test = read_sds_from_csv_file(colour_checker_n_ohta_test) for key, value in sds.items(): - if PY2: + if PY2: # pragma: no cover # Running into precision issues with Python 2.x, applying # conservative rounding. value.wavelengths = np.around(value.wavelengths, decimals=7) @@ -217,6 +226,20 @@ def test_write_sds_to_csv_file(self): sds_test = read_sds_from_csv_file(colour_checker_n_ohta_test) self.assertEqual(len(sds_test), 1) + def test_raise_exception_write_sds_to_csv_file(self): + """ + Tests :func:`colour.io.tabular.write_sds_to_csv_file` definition + raised exception. + """ + + colour_checker_n_ohta = os.path.join(RESOURCES_DIRECTORY, + 'colorchecker_n_ohta.csv') + sds = read_sds_from_csv_file(colour_checker_n_ohta) + key = list(sds.keys())[0] + sds[key] = sds[key].align(SpectralShape(400, 700, 10)) + + self.assertRaises(RuntimeError, write_sds_to_csv_file, sds, '') + if __name__ == '__main__': unittest.main() diff --git a/colour/io/tests/test_xrite.py b/colour/io/tests/test_xrite.py index 64ef2a3d9b..2bc423862d 100644 --- a/colour/io/tests/test_xrite.py +++ b/colour/io/tests/test_xrite.py @@ -76,7 +76,7 @@ def test_read_sds_from_xrite_file(self): """ colour_checker_xrite = os.path.join( - RESOURCES_DIRECTORY, 'xrite_digital_colour_checker.txt') + RESOURCES_DIRECTORY, 'X-Rite_Digital_Colour_Checker.txt') sds = read_sds_from_xrite_file(colour_checker_xrite) for sd in sds.values(): self.assertIsInstance(sd, SpectralDistribution) diff --git a/colour/io/xrite.py b/colour/io/xrite.py index 6087b9eba9..2345cb391c 100644 --- a/colour/io/xrite.py +++ b/colour/io/xrite.py @@ -55,7 +55,7 @@ def read_sds_from_xrite_file(path): >>> from pprint import pprint >>> xrite_file = os.path.join(os.path.dirname(__file__), 'tests', ... 'resources', - ... 'xrite_digital_colour_checker.txt') + ... 'X-Rite_Digital_Colour_Checker.txt') >>> sds_data = read_sds_from_xrite_file(xrite_file) >>> pprint(list(sds_data.keys())) # doctest: +SKIP ['X1', 'X2', 'X3', 'X4', 'X5', 'X6', 'X7', 'X8', 'X9', 'X10'] diff --git a/colour/models/__init__.py b/colour/models/__init__.py index 6d4e3c1434..c2c4a98b32 100644 --- a/colour/models/__init__.py +++ b/colour/models/__init__.py @@ -2,6 +2,11 @@ from __future__ import absolute_import +import sys + +from colour.utilities.deprecation import ModuleAPI, build_API_changes +from colour.utilities.documentation import is_documentation_building + from .cam02_ucs import (JMh_CIECAM02_to_CAM02LCD, CAM02LCD_to_JMh_CIECAM02, JMh_CIECAM02_to_CAM02SCD, CAM02SCD_to_JMh_CIECAM02, JMh_CIECAM02_to_CAM02UCS, CAM02UCS_to_JMh_CIECAM02) @@ -26,10 +31,10 @@ from .jzazbz import XYZ_to_JzAzBz, JzAzBz_to_XYZ from .hdr_ipt import HDR_IPT_METHODS, XYZ_to_hdr_IPT, hdr_IPT_to_XYZ from .osa_ucs import XYZ_to_OSA_UCS, OSA_UCS_to_XYZ -from .common import (COLOURSPACE_MODELS, COLOURSPACE_MODELS_LABELS, +from .common import (COLOURSPACE_MODELS, COLOURSPACE_MODELS_AXIS_LABELS, XYZ_to_colourspace_model) -from .dataset import * # noqa -from . import dataset +from .datasets import * # noqa +from . import datasets from .rgb import * # noqa from . import rgb @@ -68,8 +73,179 @@ __all__ += ['HDR_IPT_METHODS', 'XYZ_to_hdr_IPT', 'hdr_IPT_to_XYZ'] __all__ += ['XYZ_to_OSA_UCS', 'OSA_UCS_to_XYZ'] __all__ += [ - 'COLOURSPACE_MODELS', 'COLOURSPACE_MODELS_LABELS', + 'COLOURSPACE_MODELS', 'COLOURSPACE_MODELS_AXIS_LABELS', 'XYZ_to_colourspace_model' ] -__all__ += dataset.__all__ +__all__ += datasets.__all__ __all__ += rgb.__all__ + + +# ----------------------------------------------------------------------------# +# --- API Changes and Deprecation Management ---# +# ----------------------------------------------------------------------------# +class models(ModuleAPI): + def __getattr__(self, attribute): + return super(models, self).__getattr__(attribute) + + +# v0.3.14 +API_CHANGES = { + 'ObjectFutureRemove': ['colour.models.XYZ_to_colourspace_model', ], + 'ObjectRenamed': [ + [ + 'colour.models.decoding_cctf', + 'colour.models.cctf_decoding', + ], + [ + 'colour.models.DECODING_CCTFS', + 'colour.models.CCTF_DECODINGS', + ], + [ + 'colour.models.encoding_cctf', + 'colour.models.cctf_encoding', + ], + [ + 'colour.models.ENCODING_CCTFS', + 'colour.models.CCTF_ENCODINGS', + ], + [ + 'colour.models.log_decoding_curve', + 'colour.models.log_decoding', + ], + [ + 'colour.models.LOG_DECODING_CURVES', + 'colour.models.LOG_DECODINGS', + ], + [ + 'colour.models.log_encoding_curve', + 'colour.models.log_encoding', + ], + [ + 'colour.models.LOG_ENCODING_CURVES', + 'colour.models.LOG_ENCODINGS', + ], + [ + 'colour.models.oetf_ROMMRGB', + 'colour.models.cctf_encoding_ROMMRGB', + ], + [ + 'colour.models.oetf_RIMMRGB', + 'colour.models.cctf_encoding_RIMMRGB', + ], + [ + 'colour.models.oetf_ProPhotoRGB', + 'colour.models.cctf_encoding_ProPhotoRGB', + ], + [ + 'colour.models.oetf_ST2084', + 'colour.models.eotf_inverse_ST2084', + ], + [ + 'colour.models.oetf_sRGB', + 'colour.models.eotf_inverse_sRGB', + ], + [ + 'colour.models.oetf_inverse_sRGB', + 'colour.models.eotf_sRGB', + ], + [ + 'colour.models.oetf_BT2100_HLG', + 'colour.models.oetf_HLG_BT2100', + ], + [ + 'colour.models.oetf_reverse_ARIBSTDB67', + 'colour.models.oetf_inverse_ARIBSTDB67' + ], + [ + 'colour.models.oetf_reverse_BT2100_HLG', + 'colour.models.oetf_inverse_HLG_BT2100', + ], + [ + 'colour.models.oetf_reverse_BT601', + 'colour.models.oetf_inverse_BT601', + ], + [ + 'colour.models.oetf_reverse_BT709', + 'colour.models.oetf_inverse_BT709', + ], + [ + 'colour.models.eotf_ROMMRGB', + 'colour.models.cctf_decoding_ROMMRGB', + ], + [ + 'colour.models.eotf_RIMMRGB', + 'colour.models.cctf_decoding_RIMMRGB', + ], + [ + 'colour.models.eotf_ProPhotoRGB', + 'colour.models.cctf_decoding_ProPhotoRGB', + ], + [ + 'colour.models.eotf_reverse_BT1886', + 'colour.models.eotf_inverse_BT1886', + ], + [ + 'colour.models.eotf_BT2100_HLG', + 'colour.models.eotf_HLG_BT2100', + ], + [ + 'colour.models.eotf_reverse_BT2100_HLG', + 'colour.models.eotf_inverse_HLG_BT2100', + ], + [ + 'colour.models.eotf_reverse_DCDM', + 'colour.models.eotf_inverse_DCDM', + ], + [ + 'colour.models.eotf_reverse_sRGB', + 'colour.models.eotf_inverse_sRGB', + ], + [ + 'colour.models.eotf_reverse_ST2084', + 'colour.models.eotf_inverse_ST2084', + ], + [ + 'colour.models.ootf_BT2100_HLG', + 'colour.models.ootf_HLG_BT2100', + ], + [ + 'colour.models.ootf_reverse_BT2100_HLG', + 'colour.models.ootf_inverse_HLG_BT2100', + ], + [ + 'colour.models.oetf_BT2100_PQ', + 'colour.models.oetf_PQ_BT2100', + ], + [ + 'colour.models.oetf_reverse_BT2100_PQ', + 'colour.models.oetf_inverse_PQ_BT2100', + ], + [ + 'colour.models.eotf_BT2100_PQ', + 'colour.models.eotf_PQ_BT2100', + ], + [ + 'colour.models.eotf_reverse_BT2100_PQ', + 'colour.models.eotf_inverse_PQ_BT2100', + ], + [ + 'colour.models.ootf_BT2100_PQ', + 'colour.models.ootf_PQ_BT2100', + ], + [ + 'colour.models.ootf_reverse_BT2100_PQ', + 'colour.models.ootf_inverse_PQ_BT2100', + ], + ] +} +""" +Defines *colour.models* sub-package API changes. + +API_CHANGES : dict +""" + +if not is_documentation_building(): + sys.modules['colour.models'] = models(sys.modules['colour.models'], + build_API_changes(API_CHANGES)) + + del ModuleAPI, is_documentation_building, build_API_changes, sys diff --git a/colour/models/cie_lab.py b/colour/models/cie_lab.py index b532bea629..a8740b1dbd 100644 --- a/colour/models/cie_lab.py +++ b/colour/models/cie_lab.py @@ -58,7 +58,7 @@ def XYZ_to_Lab( XYZ : array_like *CIE XYZ* tristimulus values. illuminant : array_like, optional - Reference *illuminant* *xy* chromaticity coordinates or *CIE xyY* + Reference *illuminant* *CIE xy* chromaticity coordinates or *CIE xyY* colourspace array. Returns @@ -127,7 +127,7 @@ def Lab_to_XYZ( Lab : array_like *CIE L\\*a\\*b\\** colourspace array. illuminant : array_like, optional - Reference *illuminant* *xy* chromaticity coordinates or *CIE xyY* + Reference *illuminant* *CIE xy* chromaticity coordinates or *CIE xyY* colourspace array. Returns diff --git a/colour/models/cie_luv.py b/colour/models/cie_luv.py index e71e034eda..e4383e249c 100644 --- a/colour/models/cie_luv.py +++ b/colour/models/cie_luv.py @@ -73,7 +73,7 @@ def XYZ_to_Luv( XYZ : array_like *CIE XYZ* tristimulus values. illuminant : array_like, optional - Reference *illuminant* *xy* chromaticity coordinates or *CIE xyY* + Reference *illuminant* *CIE xy* chromaticity coordinates or *CIE xyY* colourspace array. Returns @@ -142,7 +142,7 @@ def Luv_to_XYZ( Luv : array_like *CIE L\\*u\\*v\\** colourspace array. illuminant : array_like, optional - Reference *illuminant* *xy* chromaticity coordinates or *CIE xyY* + Reference *illuminant* *CIE xy* chromaticity coordinates or *CIE xyY* colourspace array. Returns @@ -216,7 +216,7 @@ def Luv_to_uv( Luv : array_like *CIE L\\*u\\*v\\** colourspace array. illuminant : array_like, optional - Reference *illuminant* *xy* chromaticity coordinates or *CIE xyY* + Reference *illuminant* *CIE xy* chromaticity coordinates or *CIE xyY* colourspace array. Returns @@ -273,7 +273,7 @@ def uv_to_Luv( uv : array_like :math:`uv^p` chromaticity coordinates. illuminant : array_like, optional - Reference *illuminant* *xy* chromaticity coordinates or *CIE xyY* + Reference *illuminant* *CIE xy* chromaticity coordinates or *CIE xyY* colourspace array. Y : numeric, optional Optional :math:`Y` *luminance* value used to construct the intermediate @@ -323,7 +323,7 @@ def uv_to_Luv( def Luv_uv_to_xy(uv): """ - Returns the *xy* chromaticity coordinates from given *CIE L\\*u\\*v\\** + Returns the *CIE xy* chromaticity coordinates from given *CIE L\\*u\\*v\\** colourspace :math:`uv^p` chromaticity coordinates. Parameters @@ -334,7 +334,7 @@ def Luv_uv_to_xy(uv): Returns ------- ndarray - *xy* chromaticity coordinates. + *CIE xy* chromaticity coordinates. References ---------- @@ -358,12 +358,12 @@ def Luv_uv_to_xy(uv): def xy_to_Luv_uv(xy): """ Returns the *CIE L\\*u\\*v\\** colourspace :math:`uv^p` chromaticity - coordinates from given *xy* chromaticity coordinates. + coordinates from given *CIE xy* chromaticity coordinates. Parameters ---------- xy : array_like - *xy* chromaticity coordinates. + *CIE xy* chromaticity coordinates. Returns ------- diff --git a/colour/models/cie_ucs.py b/colour/models/cie_ucs.py index 0844171625..7c76ed034d 100644 --- a/colour/models/cie_ucs.py +++ b/colour/models/cie_ucs.py @@ -226,7 +226,7 @@ def uv_to_UCS(uv, V=1): def UCS_uv_to_xy(uv): """ - Returns the *xy* chromaticity coordinates from given *CIE 1960 UCS* + Returns the *CIE xy* chromaticity coordinates from given *CIE 1960 UCS* colourspace *uv* chromaticity coordinates. Parameters @@ -237,7 +237,7 @@ def UCS_uv_to_xy(uv): Returns ------- ndarray - *xy* chromaticity coordinates. + *CIE xy* chromaticity coordinates. References ---------- @@ -261,12 +261,12 @@ def UCS_uv_to_xy(uv): def xy_to_UCS_uv(xy): """ Returns the *CIE 1960 UCS* colourspace *uv* chromaticity coordinates from - given *xy* chromaticity coordinates. + given *CIE xy* chromaticity coordinates. Parameters ---------- xy : array_like - *xy* chromaticity coordinates. + *CIE xy* chromaticity coordinates. Returns ------- diff --git a/colour/models/cie_uvw.py b/colour/models/cie_uvw.py index 1f0ab3fbc5..93a1899b58 100644 --- a/colour/models/cie_uvw.py +++ b/colour/models/cie_uvw.py @@ -51,7 +51,7 @@ def XYZ_to_UVW( XYZ : array_like *CIE XYZ* tristimulus values. illuminant : array_like, optional - Reference *illuminant* *xy* chromaticity coordinates or *CIE xyY* + Reference *illuminant* *CIE xy* chromaticity coordinates or *CIE xyY* colourspace array. Returns @@ -126,7 +126,7 @@ def UVW_to_XYZ( UVW : array_like *CIE 1964 U\\*V\\*W\\** colourspace array. illuminant : array_like, optional - Reference *illuminant* *xy* chromaticity coordinates or *CIE xyY* + Reference *illuminant* *CIE xy* chromaticity coordinates or *CIE xyY* colourspace array. Returns diff --git a/colour/models/cie_xyy.py b/colour/models/cie_xyy.py index 1f41c2318c..4b1801d982 100644 --- a/colour/models/cie_xyy.py +++ b/colour/models/cie_xyy.py @@ -167,21 +167,21 @@ def xyY_to_XYZ(xyY): def xyY_to_xy(xyY): """ - Converts from *CIE xyY* colourspace to *xy* chromaticity coordinates. + Converts from *CIE xyY* colourspace to *CIE xy* chromaticity coordinates. ``xyY`` argument with last dimension being equal to 2 will be assumed to be - a *xy* chromaticity coordinates argument and will be returned directly by - the definition. + a *CIE xy* chromaticity coordinates argument and will be returned directly + by the definition. Parameters ---------- xyY : array_like - *CIE xyY* colourspace array or *xy* chromaticity coordinates. + *CIE xyY* colourspace array or *CIE xy* chromaticity coordinates. Returns ------- ndarray - *xy* chromaticity coordinates. + *CIE xy* chromaticity coordinates. Notes ----- @@ -208,8 +208,8 @@ def xyY_to_xy(xyY): xyY = as_float_array(xyY) - # Assuming ``xyY`` is actually a *xy* chromaticity coordinates argument and - # returning it directly. + # Assuming ``xyY`` is actually a *CIE xy* chromaticity coordinates argument + # and returning it directly. if xyY.shape[-1] == 2: return xyY @@ -220,7 +220,7 @@ def xyY_to_xy(xyY): def xy_to_xyY(xy, Y=1): """ - Converts from *xy* chromaticity coordinates to *CIE xyY* colourspace by + Converts from *CIE xy* chromaticity coordinates to *CIE xyY* colourspace by extending the array last dimension with given :math:`Y` *luminance*. ``xy`` argument with last dimension being equal to 3 will be assumed to be @@ -230,7 +230,7 @@ def xy_to_xyY(xy, Y=1): Parameters ---------- xy : array_like - *xy* chromaticity coordinates or *CIE xyY* colourspace array. + *CIE xy* chromaticity coordinates or *CIE xyY* colourspace array. Y : numeric, optional Optional :math:`Y` *luminance* value used to construct the *CIE xyY* colourspace array, the default :math:`Y` *luminance* value is 1. @@ -298,8 +298,8 @@ def XYZ_to_xy( XYZ, illuminant=ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D65']): """ - Returns the *xy* chromaticity coordinates from given *CIE XYZ* tristimulus - values. + Returns the *CIE xy* chromaticity coordinates from given *CIE XYZ* + tristimulus values. Parameters ---------- @@ -311,7 +311,7 @@ def XYZ_to_xy( Returns ------- ndarray - *xy* chromaticity coordinates. + *CIE xy* chromaticity coordinates. Notes ----- @@ -338,13 +338,13 @@ def XYZ_to_xy( def xy_to_XYZ(xy): """ - Returns the *CIE XYZ* tristimulus values from given *xy* chromaticity + Returns the *CIE XYZ* tristimulus values from given *CIE xy* chromaticity coordinates. Parameters ---------- xy : array_like - *xy* chromaticity coordinates. + *CIE xy* chromaticity coordinates. Returns ------- diff --git a/colour/models/common.py b/colour/models/common.py index 241a301054..71fff83f72 100644 --- a/colour/models/common.py +++ b/colour/models/common.py @@ -23,7 +23,7 @@ __status__ = 'Production' __all__ = [ - 'COLOURSPACE_MODELS', 'COLOURSPACE_MODELS_LABELS', + 'COLOURSPACE_MODELS', 'COLOURSPACE_MODELS_AXIS_LABELS', 'XYZ_to_colourspace_model' ] @@ -32,30 +32,30 @@ 'CIE UVW', 'DIN 99', 'Hunter Lab', 'Hunter Rdab', 'IPT', 'JzAzBz', 'OSA UCS', 'hdr-CIELAB', 'hdr-IPT') -COLOURSPACE_MODELS_LABELS = { +COLOURSPACE_MODELS_AXIS_LABELS = { 'CIE XYZ': ('X', 'Y', 'Z'), 'CIE xyY': ('x', 'y', 'Y'), - 'CIE Lab': ('$a^*$', '$b^*$', '$L^*$'), - 'CIE LCHab': ('CH', 'ab', '$L^*$'), - 'CIE Luv': ('$u^\\prime$', '$v^\\prime$', '$L^*$'), + 'CIE Lab': ('$L^*$', '$a^*$', '$b^*$'), + 'CIE LCHab': ('$L^*$', 'CH', 'ab'), + 'CIE Luv': ('$L^*$', '$u^\\prime$', '$v^\\prime$'), 'CIE Luv uv': ('$u^\\prime$', '$v^\\prime$'), - 'CIE LCHuv': ('CH', 'uv', '$L^*$'), + 'CIE LCHuv': ('$L^*$', 'CH', 'uv'), 'CIE UCS': ('U', 'V', 'W'), 'CIE UCS uv': ('u', 'v'), 'CIE UVW': ('U', 'V', 'W'), - 'DIN 99': ('a99', 'b99', 'L99'), - 'Hunter Lab': ('$a^*$', '$b^*$', '$L^*$'), - 'Hunter Rdab': ('a', 'b', 'Rd'), - 'IPT': ('P', 'T', 'I'), - 'JzAzBz': ('$A_z$', '$B_z$', '$J_z$'), - 'OSA UCS': ('j', 'g', 'L'), - 'hdr-CIELAB': ('a hdr', 'b hdr', 'L hdr'), - 'hdr-IPT': ('P hdr', 'T hdr', 'I hdr'), + 'DIN 99': ('L99', 'a99', 'b99'), + 'Hunter Lab': ('$L^*$', '$a^*$', '$b^*$'), + 'Hunter Rdab': ('Rd', 'a', 'b'), + 'IPT': ('I', 'P', 'T'), + 'JzAzBz': ('$J_z$', '$A_z$', '$B_z$'), + 'OSA UCS': ('L', 'j', 'g'), + 'hdr-CIELAB': ('L hdr', 'a hdr', 'b hdr'), + 'hdr-IPT': ('I hdr', 'P hdr', 'T hdr'), } """ Colourspace models labels mapping. -COLOURSPACE_MODELS_LABELS : dict +COLOURSPACE_MODELS_AXIS_LABELS : dict **{'CIE XYZ', 'CIE xyY', 'CIE Lab', 'CIE LCHab, 'CIE Luv', 'CIE Luv uv', 'CIE LCHuv', 'CIE UCS', 'CIE UCS uv', 'CIE UVW', 'DIN 99', 'Hunter Lab', 'Hunter Rdab','IPT', 'JzAzBz', 'OSA UCS', 'hdr-CIELAB', 'hdr-IPT'}** @@ -71,8 +71,8 @@ def XYZ_to_colourspace_model(XYZ, illuminant, model, **kwargs): XYZ : array_like *CIE XYZ* tristimulus values. illuminant : array_like - *CIE XYZ* tristimulus values *illuminant* *xy* chromaticity - coordinates. + Reference *illuminant* *CIE xy* chromaticity coordinates or *CIE xyY* + colourspace array. model : unicode **{'CIE XYZ', 'CIE xyY', 'CIE xy', 'CIE Lab', 'CIE LCHab', 'CIE Luv', 'CIE Luv uv', 'CIE LCHuv', 'CIE UCS', 'CIE UCS uv', 'CIE UVW', @@ -90,6 +90,11 @@ def XYZ_to_colourspace_model(XYZ, illuminant, model, **kwargs): ndarray Colourspace model values. + Warnings + -------- + This definition is is deprecated and will be removed in a future release. + :func:`colour.convert` definition should be used instead. + Examples -------- >>> import numpy as np @@ -120,6 +125,9 @@ def XYZ_to_colourspace_model(XYZ, illuminant, model, **kwargs): ... XYZ, W, 'CIE LCHuv') array([ 0.4152787..., 0.9844997..., 0.0288560...]) >>> XYZ_to_colourspace_model( # doctest: +ELLIPSIS + ... XYZ, W, 'CIE UCS') + array([ 0.1376933..., 0.1219722..., 0.1053731...]) + >>> XYZ_to_colourspace_model( # doctest: +ELLIPSIS ... XYZ, W, 'CIE UCS uv') array([ 0.3772021..., 0.3341350...]) >>> XYZ_to_colourspace_model( # doctest: +ELLIPSIS @@ -149,6 +157,13 @@ def XYZ_to_colourspace_model(XYZ, illuminant, model, **kwargs): >>> XYZ_to_colourspace_model( # doctest: +ELLIPSIS ... XYZ, W, 'hdr-IPT') array([ 0.4839376..., 0.4244990..., 0.2201954...]) + >>> try: + ... XYZ_to_colourspace_model(XYZ, W, 'Undefined') + ... except ValueError as error: + ... print(error) + "Undefined" not found in colourspace models: "CIE XYZ, CIE xyY, CIE Lab, \ +CIE LCHab, CIE Luv, CIE Luv uv, CIE LCHuv, CIE UCS, CIE UCS uv, CIE UVW, \ +DIN 99, Hunter Lab, Hunter Rdab, IPT, JzAzBz, OSA UCS, hdr-CIELAB, hdr-IPT". """ with domain_range_scale(1): diff --git a/colour/models/dataset/__init__.py b/colour/models/datasets/__init__.py similarity index 100% rename from colour/models/dataset/__init__.py rename to colour/models/datasets/__init__.py diff --git a/colour/models/dataset/macadam_ellipses.py b/colour/models/datasets/macadam_ellipses.py similarity index 100% rename from colour/models/dataset/macadam_ellipses.py rename to colour/models/datasets/macadam_ellipses.py diff --git a/colour/models/dataset/pointer_gamut.py b/colour/models/datasets/pointer_gamut.py similarity index 99% rename from colour/models/dataset/pointer_gamut.py rename to colour/models/datasets/pointer_gamut.py index e22aa2c399..c5c8f12775 100644 --- a/colour/models/dataset/pointer_gamut.py +++ b/colour/models/datasets/pointer_gamut.py @@ -670,7 +670,7 @@ [0.508, 0.226], ]) """ -*Pointer's Gamut* *xy* chromaticity coordinates boundaries. +*Pointer's Gamut* *CIE xy* chromaticity coordinates boundaries. References ---------- diff --git a/colour/models/hdr_cie_lab.py b/colour/models/hdr_cie_lab.py index 015f074da0..b656cd8ab1 100644 --- a/colour/models/hdr_cie_lab.py +++ b/colour/models/hdr_cie_lab.py @@ -143,7 +143,7 @@ def XYZ_to_hdr_CIELab( XYZ : array_like *CIE XYZ* tristimulus values. illuminant : array_like, optional - Reference *illuminant* *xy* chromaticity coordinates or *CIE xyY* + Reference *illuminant* *CIE xy* chromaticity coordinates or *CIE xyY* colourspace array. Y_s : numeric or array_like Relative luminance :math:`Y_s` of the surround. @@ -245,7 +245,7 @@ def hdr_CIELab_to_XYZ( Lab_hdr : array_like *hdr-CIELAB* colourspace array. illuminant : array_like, optional - Reference *illuminant* *xy* chromaticity coordinates or *CIE xyY* + Reference *illuminant* *CIE xy* chromaticity coordinates or *CIE xyY* colourspace array. Y_s : numeric or array_like Relative luminance :math:`Y_s` of the surround. diff --git a/colour/models/jzazbz.py b/colour/models/jzazbz.py index 5e80a8915f..8323131ae0 100644 --- a/colour/models/jzazbz.py +++ b/colour/models/jzazbz.py @@ -26,7 +26,8 @@ import numpy as np -from colour.models.rgb.transfer_functions import oetf_ST2084, eotf_ST2084 +from colour.models.rgb.transfer_functions import (eotf_inverse_ST2084, + eotf_ST2084) from colour.models.rgb.transfer_functions.st_2084 import ST2084_CONSTANTS from colour.utilities import (Structure, domain_range_scale, dot_vector, from_range_1, to_domain_1, tsplit, tstack) @@ -161,7 +162,7 @@ def XYZ_to_JzAzBz(XYZ_D65, constants=JZAZBZ_CONSTANTS): LMS = dot_vector(JZAZBZ_XYZ_TO_LMS_MATRIX, XYZ_p_D65) with domain_range_scale('ignore'): - LMS_p = oetf_ST2084(LMS, 10000, constants) + LMS_p = eotf_inverse_ST2084(LMS, 10000, constants) I_z, A_z, B_z = tsplit(dot_vector(JZAZBZ_LMS_P_TO_IZAZBZ_MATRIX, LMS_p)) diff --git a/colour/models/osa_ucs.py b/colour/models/osa_ucs.py index 2969177272..d4e766873c 100644 --- a/colour/models/osa_ucs.py +++ b/colour/models/osa_ucs.py @@ -33,8 +33,8 @@ from colour.algebra import spow from colour.models import XYZ_to_xyY -from colour.utilities import (domain_range_scale, dot_vector, from_range_100, - to_domain_100, tsplit, tstack) +from colour.utilities import (as_float_array, domain_range_scale, dot_vector, + from_range_100, to_domain_100, tsplit, tstack) __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -156,7 +156,7 @@ def OSA_UCS_to_XYZ(Ljg, optimisation_parameters=None): Warnings -------- - There is no analytical reverse transformation from *OSA UCS* to :math:`Ljg` + There is no analytical inverse transformation from *OSA UCS* to :math:`Ljg` lightness, jaune (yellowness), and greenness to *CIE XYZ* tristimulus values, the current implementation relies on optimization using :func:`scipy.optimize.fmin` definition and thus has reduced precision and @@ -215,7 +215,7 @@ def error_function(XYZ, Ljg): return error x_0 = np.array([30, 30, 30]) - XYZ = np.array([ + XYZ = as_float_array([ fmin(error_function, x_0, (Ljg_i, ), **optimisation_settings) for Ljg_i in Ljg ]) diff --git a/colour/models/rgb/__init__.py b/colour/models/rgb/__init__.py index 388006c3c5..c9d8cf298f 100644 --- a/colour/models/rgb/__init__.py +++ b/colour/models/rgb/__init__.py @@ -10,8 +10,8 @@ from .rgb_colourspace import RGB_to_RGB_matrix, RGB_to_RGB from .transfer_functions import * # noqa from . import transfer_functions -from .dataset import * # noqa -from . import dataset +from .datasets import * # noqa +from . import datasets from .common import XYZ_to_sRGB, sRGB_to_XYZ from .aces_it import sd_to_aces_relative_exposure_values from .deprecated import (RGB_to_HSV, HSV_to_RGB, RGB_to_HSL, HSL_to_RGB, @@ -30,7 +30,7 @@ __all__ += ['XYZ_to_RGB', 'RGB_to_XYZ'] __all__ += ['RGB_to_RGB_matrix', 'RGB_to_RGB'] __all__ += transfer_functions.__all__ -__all__ += dataset.__all__ +__all__ += datasets.__all__ __all__ += ['XYZ_to_sRGB', 'sRGB_to_XYZ'] __all__ += ['sd_to_aces_relative_exposure_values'] __all__ += [ diff --git a/colour/models/rgb/common.py b/colour/models/rgb/common.py index 51df3f8d99..850a80eaf3 100644 --- a/colour/models/rgb/common.py +++ b/colour/models/rgb/common.py @@ -16,6 +16,7 @@ from colour.colorimetry import ILLUMINANTS from colour.models.rgb import RGB_COLOURSPACES, RGB_to_XYZ, XYZ_to_RGB +from colour.utilities.deprecation import handle_arguments_deprecation __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -31,7 +32,8 @@ def XYZ_to_sRGB( XYZ, illuminant=ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D65'], chromatic_adaptation_transform='CAT02', - apply_encoding_cctf=True): + apply_cctf_encoding=True, + **kwargs): """ Converts from *CIE XYZ* tristimulus values to *sRGB* colourspace. @@ -46,10 +48,15 @@ def XYZ_to_sRGB( 'Fairchild', 'CMCCAT97', 'CMCCAT2000', 'CAT02_BRILL_CAT', 'Bianco', 'Bianco PC'}**, *Chromatic adaptation* transform. - apply_encoding_cctf : bool, optional + apply_cctf_encoding : bool, optional Apply *sRGB* encoding colour component transfer function / opto-electronic transfer function. + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments for deprecation management. + Returns ------- ndarray @@ -78,6 +85,10 @@ def XYZ_to_sRGB( array([ 0.7057393..., 0.1924826..., 0.2235416...]) """ + apply_cctf_encoding = handle_arguments_deprecation({ + 'ArgumentRenamed': [['apply_encoding_cctf', 'apply_cctf_encoding']], + }, **kwargs).get('apply_cctf_encoding', apply_cctf_encoding) + sRGB = RGB_COLOURSPACES['sRGB'] return XYZ_to_RGB( @@ -86,7 +97,7 @@ def XYZ_to_sRGB( sRGB.whitepoint, sRGB.XYZ_to_RGB_matrix, chromatic_adaptation_transform, - sRGB.encoding_cctf if apply_encoding_cctf else None, + sRGB.cctf_encoding if apply_cctf_encoding else None, ) @@ -94,7 +105,8 @@ def sRGB_to_XYZ( RGB, illuminant=ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D65'], chromatic_adaptation_method='CAT02', - apply_decoding_cctf=True): + apply_cctf_decoding=True, + **kwargs): """ Converts from *sRGB* colourspace to *CIE XYZ* tristimulus values. @@ -109,10 +121,15 @@ def sRGB_to_XYZ( 'Fairchild', 'CMCCAT97', 'CMCCAT2000', 'CAT02_BRILL_CAT', 'Bianco', 'Bianco PC'}**, *Chromatic adaptation* method. - apply_decoding_cctf : bool, optional + apply_cctf_decoding : bool, optional Apply *sRGB* decoding colour component transfer function / electro-optical transfer function. + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments for deprecation management. + Returns ------- ndarray @@ -141,6 +158,10 @@ def sRGB_to_XYZ( array([ 0.2065429..., 0.1219794..., 0.0513714...]) """ + apply_cctf_decoding = handle_arguments_deprecation({ + 'ArgumentRenamed': [['apply_decoding_cctf', 'apply_cctf_decoding']], + }, **kwargs).get('apply_cctf_decoding', apply_cctf_decoding) + sRGB = RGB_COLOURSPACES['sRGB'] return RGB_to_XYZ( @@ -149,5 +170,5 @@ def sRGB_to_XYZ( illuminant, sRGB.RGB_to_XYZ_matrix, chromatic_adaptation_method, - sRGB.decoding_cctf if apply_decoding_cctf else None, + sRGB.cctf_decoding if apply_cctf_decoding else None, ) diff --git a/colour/models/rgb/dataset/ntsc.py b/colour/models/rgb/dataset/ntsc.py deleted file mode 100644 index 2d4746763d..0000000000 --- a/colour/models/rgb/dataset/ntsc.py +++ /dev/null @@ -1,96 +0,0 @@ -# -*- coding: utf-8 -*- -""" -NTSC Colourspace -================ - -Defines the *NTSC* colourspace: - -- :attr:`colour.models.NTSC_COLOURSPACE`. - -See Also --------- -`RGB Colourspaces Jupyter Notebook -`_ - -References ----------- -- :cite:`InternationalTelecommunicationUnion1998a` : International - Telecommunication Union. (1998). Recommendation ITU-R BT.470-6 - - CONVENTIONAL TELEVISION SYSTEMS. Retrieved from http://www.itu.int/\ -dms_pubrec/itu-r/rec/bt/R-REC-BT.470-6-199811-S!!PDF-E.pdf -""" - -from __future__ import division, unicode_literals - -from colour.models.rgb import RGB_Colourspace -from colour.models.rgb.dataset.itur_bt_470 import ( - BT470_525_PRIMARIES, BT470_525_WHITEPOINT, BT470_525_WHITEPOINT_NAME, - BT470_525_TO_XYZ_MATRIX, XYZ_TO_BT470_525_MATRIX, BT470_525_COLOURSPACE) - -__author__ = 'Colour Developers' -__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' -__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' -__maintainer__ = 'Colour Developers' -__email__ = 'colour-science@googlegroups.com' -__status__ = 'Production' - -__all__ = [ - 'NTSC_PRIMARIES', 'NTSC_WHITEPOINT_NAME', 'NTSC_WHITEPOINT', - 'NTSC_TO_XYZ_MATRIX', 'XYZ_TO_NTSC_MATRIX', 'NTSC_COLOURSPACE' -] - -NTSC_PRIMARIES = BT470_525_PRIMARIES -""" -*NTSC* colourspace primaries. - -NTSC_PRIMARIES : ndarray, (3, 2) -""" - -NTSC_WHITEPOINT_NAME = BT470_525_WHITEPOINT_NAME -""" -*NTSC* colourspace whitepoint name. - -NTSC_WHITEPOINT_NAME : unicode -""" - -NTSC_WHITEPOINT = BT470_525_WHITEPOINT -""" -*NTSC* colourspace whitepoint. - -NTSC_WHITEPOINT : ndarray -""" - -NTSC_TO_XYZ_MATRIX = BT470_525_TO_XYZ_MATRIX -""" -*NTSC* colourspace to *CIE XYZ* tristimulus values matrix. - -NTSC_TO_XYZ_MATRIX : array_like, (3, 3) -""" - -XYZ_TO_NTSC_MATRIX = XYZ_TO_BT470_525_MATRIX -""" -*CIE XYZ* tristimulus values to *NTSC* colourspace matrix. - -XYZ_TO_NTSC_MATRIX : array_like, (3, 3) -""" - -NTSC_COLOURSPACE = RGB_Colourspace( - 'NTSC', - NTSC_PRIMARIES, - NTSC_WHITEPOINT, - NTSC_WHITEPOINT_NAME, - NTSC_TO_XYZ_MATRIX, - XYZ_TO_NTSC_MATRIX, - BT470_525_COLOURSPACE.encoding_cctf, - BT470_525_COLOURSPACE.decoding_cctf, -) -NTSC_COLOURSPACE.__doc__ = """ -*NTSC* colourspace. - -References ----------- -:cite:`InternationalTelecommunicationUnion1998a` - -NTSC_COLOURSPACE : RGB_Colourspace -""" diff --git a/colour/models/rgb/dataset/__init__.py b/colour/models/rgb/datasets/__init__.py similarity index 88% rename from colour/models/rgb/dataset/__init__.py rename to colour/models/rgb/datasets/__init__.py index 5b3b7eca5d..eb03bbcad0 100644 --- a/colour/models/rgb/dataset/__init__.py +++ b/colour/models/rgb/datasets/__init__.py @@ -9,12 +9,12 @@ from .aces_it import ACES_RICD from .adobe_rgb_1998 import ADOBE_RGB_1998_COLOURSPACE from .adobe_wide_gamut_rgb import ADOBE_WIDE_GAMUT_RGB_COLOURSPACE -from .alexa_wide_gamut import ALEXA_WIDE_GAMUT_COLOURSPACE from .apple_rgb import APPLE_RGB_COLOURSPACE +from .arri_alexa_wide_gamut import ALEXA_WIDE_GAMUT_COLOURSPACE from .best_rgb import BEST_RGB_COLOURSPACE from .beta_rgb import BETA_RGB_COLOURSPACE from .cie_rgb import CIE_RGB_COLOURSPACE -from .cinema_gamut import CINEMA_GAMUT_COLOURSPACE +from .canon_cinema_gamut import CINEMA_GAMUT_COLOURSPACE from .color_match_rgb import COLOR_MATCH_RGB_COLOURSPACE from .dcdm_xyz import DCDM_XYZ_COLOURSPACE from .dci_p3 import DCI_P3_COLOURSPACE, DCI_P3_P_COLOURSPACE @@ -23,13 +23,13 @@ from .dji_dgamut import DJI_D_GAMUT_COLOURSPACE from .eci_rgb_v2 import ECI_RGB_V2_COLOURSPACE from .ekta_space_ps5 import EKTA_SPACE_PS_5_COLOURSPACE +from .fujifilm_f_gamut import F_GAMUT_COLOURSPACE from .filmlight_egamut import FILMLIGHT_E_GAMUT_COLOURSPACE from .gopro import PROTUNE_NATIVE_COLOURSPACE from .itur_bt_470 import BT470_525_COLOURSPACE, BT470_625_COLOURSPACE from .itur_bt_709 import BT709_COLOURSPACE from .itur_bt_2020 import BT2020_COLOURSPACE from .max_rgb import MAX_RGB_COLOURSPACE -from .ntsc import NTSC_COLOURSPACE from .pal_secam import PAL_SECAM_COLOURSPACE from .red import (RED_COLOR_COLOURSPACE, RED_COLOR_2_COLOURSPACE, RED_COLOR_3_COLOURSPACE, RED_COLOR_4_COLOURSPACE, @@ -40,10 +40,12 @@ from .russell_rgb import RUSSELL_RGB_COLOURSPACE from .sharp import SHARP_RGB_COLOURSPACE from .smpte_240m import SMPTE_240M_COLOURSPACE +from .smpte_c import SMPTE_C_COLOURSPACE +from .ntsc import NTSC_1953_COLOURSPACE, NTSC_1987_COLOURSPACE from .sony import (S_GAMUT_COLOURSPACE, S_GAMUT3_COLOURSPACE, S_GAMUT3_CINE_COLOURSPACE) from .srgb import sRGB_COLOURSPACE -from .v_gamut import V_GAMUT_COLOURSPACE +from .panasonic_v_gamut import V_GAMUT_COLOURSPACE from .xtreme_rgb import XTREME_RGB_COLOURSPACE RGB_COLOURSPACES = CaseInsensitiveMapping({ @@ -54,8 +56,8 @@ ACES_CG_COLOURSPACE.name: ACES_CG_COLOURSPACE, ADOBE_RGB_1998_COLOURSPACE.name: ADOBE_RGB_1998_COLOURSPACE, ADOBE_WIDE_GAMUT_RGB_COLOURSPACE.name: ADOBE_WIDE_GAMUT_RGB_COLOURSPACE, - ALEXA_WIDE_GAMUT_COLOURSPACE.name: ALEXA_WIDE_GAMUT_COLOURSPACE, APPLE_RGB_COLOURSPACE.name: APPLE_RGB_COLOURSPACE, + ALEXA_WIDE_GAMUT_COLOURSPACE.name: ALEXA_WIDE_GAMUT_COLOURSPACE, BEST_RGB_COLOURSPACE.name: BEST_RGB_COLOURSPACE, BETA_RGB_COLOURSPACE.name: BETA_RGB_COLOURSPACE, BT470_525_COLOURSPACE.name: BT470_525_COLOURSPACE, @@ -75,7 +77,6 @@ FILMLIGHT_E_GAMUT_COLOURSPACE.name: FILMLIGHT_E_GAMUT_COLOURSPACE, PROTUNE_NATIVE_COLOURSPACE.name: PROTUNE_NATIVE_COLOURSPACE, MAX_RGB_COLOURSPACE.name: MAX_RGB_COLOURSPACE, - NTSC_COLOURSPACE.name: NTSC_COLOURSPACE, P3_D65_COLOURSPACE.name: P3_D65_COLOURSPACE, PAL_SECAM_COLOURSPACE.name: PAL_SECAM_COLOURSPACE, RED_COLOR_COLOURSPACE.name: RED_COLOR_COLOURSPACE, @@ -88,10 +89,14 @@ ROMM_RGB_COLOURSPACE.name: ROMM_RGB_COLOURSPACE, RIMM_RGB_COLOURSPACE.name: RIMM_RGB_COLOURSPACE, ERIMM_RGB_COLOURSPACE.name: ERIMM_RGB_COLOURSPACE, + F_GAMUT_COLOURSPACE.name: F_GAMUT_COLOURSPACE, PROPHOTO_RGB_COLOURSPACE.name: PROPHOTO_RGB_COLOURSPACE, RUSSELL_RGB_COLOURSPACE.name: RUSSELL_RGB_COLOURSPACE, SHARP_RGB_COLOURSPACE.name: SHARP_RGB_COLOURSPACE, SMPTE_240M_COLOURSPACE.name: SMPTE_240M_COLOURSPACE, + SMPTE_C_COLOURSPACE.name: SMPTE_C_COLOURSPACE, + NTSC_1953_COLOURSPACE.name: NTSC_1953_COLOURSPACE, + NTSC_1987_COLOURSPACE.name: NTSC_1987_COLOURSPACE, S_GAMUT_COLOURSPACE.name: S_GAMUT_COLOURSPACE, S_GAMUT3_COLOURSPACE.name: S_GAMUT3_COLOURSPACE, S_GAMUT3_CINE_COLOURSPACE.name: S_GAMUT3_CINE_COLOURSPACE, @@ -133,14 +138,15 @@ 'DCI_P3_COLOURSPACE', 'DCI_P3_P_COLOURSPACE', 'DJI_D_GAMUT_COLOURSPACE', 'DON_RGB_4_COLOURSPACE', 'ECI_RGB_V2_COLOURSPACE', 'EKTA_SPACE_PS_5_COLOURSPACE', 'FILMLIGHT_E_GAMUT_COLOURSPACE', - 'PROTUNE_NATIVE_COLOURSPACE', 'MAX_RGB_COLOURSPACE', 'NTSC_COLOURSPACE', - 'P3_D65_COLOURSPACE', 'PAL_SECAM_COLOURSPACE', 'RED_COLOR_COLOURSPACE', + 'PROTUNE_NATIVE_COLOURSPACE', 'MAX_RGB_COLOURSPACE', 'P3_D65_COLOURSPACE', + 'PAL_SECAM_COLOURSPACE', 'RED_COLOR_COLOURSPACE', 'RED_COLOR_2_COLOURSPACE', 'RED_COLOR_3_COLOURSPACE', 'RED_COLOR_4_COLOURSPACE', 'DRAGON_COLOR_COLOURSPACE', 'DRAGON_COLOR_2_COLOURSPACE', 'RED_WIDE_GAMUT_RGB_COLOURSPACE', 'ROMM_RGB_COLOURSPACE', 'RIMM_RGB_COLOURSPACE', 'ERIMM_RGB_COLOURSPACE', 'PROPHOTO_RGB_COLOURSPACE', 'RUSSELL_RGB_COLOURSPACE', - 'SHARP_RGB_COLOURSPACE', 'SMPTE_240M_COLOURSPACE', 'S_GAMUT_COLOURSPACE', + 'SHARP_RGB_COLOURSPACE', 'SMPTE_240M_COLOURSPACE', 'SMPTE_C_COLOURSPACE', + 'NTSC_1953_COLOURSPACE', 'NTSC_1987_COLOURSPACE', 'S_GAMUT_COLOURSPACE', 'S_GAMUT3_COLOURSPACE', 'S_GAMUT3_CINE_COLOURSPACE', 'sRGB_COLOURSPACE', - 'V_GAMUT_COLOURSPACE', 'XTREME_RGB_COLOURSPACE' + 'V_GAMUT_COLOURSPACE', 'XTREME_RGB_COLOURSPACE', 'F_GAMUT_COLOURSPACE' ] diff --git a/colour/models/rgb/dataset/aces.py b/colour/models/rgb/datasets/aces.py similarity index 100% rename from colour/models/rgb/dataset/aces.py rename to colour/models/rgb/datasets/aces.py diff --git a/colour/models/rgb/dataset/aces_it.py b/colour/models/rgb/datasets/aces_it.py similarity index 99% rename from colour/models/rgb/dataset/aces_it.py rename to colour/models/rgb/datasets/aces_it.py index 0ec28e504c..02658eeecf 100644 --- a/colour/models/rgb/dataset/aces_it.py +++ b/colour/models/rgb/datasets/aces_it.py @@ -3,7 +3,7 @@ Academy Color Encoding System - Input Transform Dataset ======================================================= -Defines the *Academy Color Encoding System* (ACES) *Input Transform* dataset. +Defines the *Academy Color Encoding System* (ACES) *Input Transform* datasets. See Also -------- diff --git a/colour/models/rgb/dataset/adobe_rgb_1998.py b/colour/models/rgb/datasets/adobe_rgb_1998.py similarity index 100% rename from colour/models/rgb/dataset/adobe_rgb_1998.py rename to colour/models/rgb/datasets/adobe_rgb_1998.py diff --git a/colour/models/rgb/dataset/adobe_wide_gamut_rgb.py b/colour/models/rgb/datasets/adobe_wide_gamut_rgb.py similarity index 100% rename from colour/models/rgb/dataset/adobe_wide_gamut_rgb.py rename to colour/models/rgb/datasets/adobe_wide_gamut_rgb.py diff --git a/colour/models/rgb/dataset/apple_rgb.py b/colour/models/rgb/datasets/apple_rgb.py similarity index 100% rename from colour/models/rgb/dataset/apple_rgb.py rename to colour/models/rgb/datasets/apple_rgb.py diff --git a/colour/models/rgb/dataset/alexa_wide_gamut.py b/colour/models/rgb/datasets/arri_alexa_wide_gamut.py similarity index 84% rename from colour/models/rgb/dataset/alexa_wide_gamut.py rename to colour/models/rgb/datasets/arri_alexa_wide_gamut.py index d170e98ab9..cd1326a99e 100644 --- a/colour/models/rgb/dataset/alexa_wide_gamut.py +++ b/colour/models/rgb/datasets/arri_alexa_wide_gamut.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- """ -ALEXA Wide Gamut Colourspace -============================ +ARRI ALEXA Wide Gamut Colourspace +================================= -Defines the *ALEXA Wide Gamut* colourspace: +Defines the *ARRI ALEXA Wide Gamut* colourspace: - :attr:`colour.models.ALEXA_WIDE_GAMUT_COLOURSPACE`. @@ -47,14 +47,14 @@ [0.0861, -0.1020], ]) """ -*ALEXA Wide Gamut* colourspace primaries. +*ARRI ALEXA Wide Gamut* colourspace primaries. ALEXA_WIDE_GAMUT_PRIMARIES : ndarray, (3, 2) """ ALEXA_WIDE_GAMUT_WHITEPOINT_NAME = 'D65' """ -*ALEXA Wide Gamut* colourspace whitepoint name. +*ARRI ALEXA Wide Gamut* colourspace whitepoint name. ALEXA_WIDE_GAMUT_WHITEPOINT : unicode """ @@ -62,7 +62,7 @@ ALEXA_WIDE_GAMUT_WHITEPOINT = (ILLUMINANTS[ 'CIE 1931 2 Degree Standard Observer'][ALEXA_WIDE_GAMUT_WHITEPOINT_NAME]) """ -*ALEXA Wide Gamut* colourspace whitepoint. +*ARRI ALEXA Wide Gamut* colourspace whitepoint. ALEXA_WIDE_GAMUT_WHITEPOINT : ndarray """ @@ -73,7 +73,7 @@ [0.002798, -0.067034, 1.153294], ]) """ -*ALEXA Wide Gamut* colourspace to *CIE XYZ* tristimulus values matrix. +*ARRI ALEXA Wide Gamut* colourspace to *CIE XYZ* tristimulus values matrix. ALEXA_WIDE_GAMUT_TO_XYZ_MATRIX : array_like, (3, 3) """ @@ -84,7 +84,7 @@ [-0.041532, 0.082335, 0.878868], ]) """ -*CIE XYZ* tristimulus values to *ALEXA Wide Gamut* colourspace matrix. +*CIE XYZ* tristimulus values to *ARRI ALEXA Wide Gamut* colourspace matrix. XYZ_TO_ALEXA_WIDE_GAMUT_MATRIX : array_like, (3, 3) """ @@ -100,7 +100,7 @@ log_decoding_ALEXALogC, ) ALEXA_WIDE_GAMUT_COLOURSPACE.__doc__ = """ -*ALEXA Wide Gamut* colourspace. +*ARRI ALEXA Wide Gamut* colourspace. References ---------- diff --git a/colour/models/rgb/dataset/best_rgb.py b/colour/models/rgb/datasets/best_rgb.py similarity index 100% rename from colour/models/rgb/dataset/best_rgb.py rename to colour/models/rgb/datasets/best_rgb.py diff --git a/colour/models/rgb/dataset/beta_rgb.py b/colour/models/rgb/datasets/beta_rgb.py similarity index 100% rename from colour/models/rgb/dataset/beta_rgb.py rename to colour/models/rgb/datasets/beta_rgb.py diff --git a/colour/models/rgb/dataset/cinema_gamut.py b/colour/models/rgb/datasets/canon_cinema_gamut.py similarity index 84% rename from colour/models/rgb/dataset/cinema_gamut.py rename to colour/models/rgb/datasets/canon_cinema_gamut.py index 1ee9aba781..93c54afc56 100644 --- a/colour/models/rgb/dataset/cinema_gamut.py +++ b/colour/models/rgb/datasets/canon_cinema_gamut.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- """ -Cinema Gamut Colourspace -======================== +Canon Cinema Gamut Colourspace +============================== -Defines the *Canon* *Cinema Gamut* colourspace: +Defines the *Canon Cinema Gamut* colourspace: - :attr:`colour.models.CINEMA_GAMUT_COLOURSPACE`. @@ -47,14 +47,14 @@ [0.0800, -0.1000], ]) """ -*Cinema Gamut* colourspace primaries. +*Canon Cinema Gamut* colourspace primaries. CINEMA_GAMUT_PRIMARIES : ndarray, (3, 2) """ CINEMA_GAMUT_WHITEPOINT_NAME = 'D65' """ -*Cinema Gamut* colourspace whitepoint name. +*Canon Cinema Gamut* colourspace whitepoint name. CINEMA_GAMUT_WHITEPOINT_NAME : unicode """ @@ -62,7 +62,7 @@ CINEMA_GAMUT_WHITEPOINT = (ILLUMINANTS['CIE 1931 2 Degree Standard Observer'][ CINEMA_GAMUT_WHITEPOINT_NAME]) """ -*Cinema Gamut* colourspace whitepoint. +*Canon Cinema Gamut* colourspace whitepoint. CINEMA_GAMUT_WHITEPOINT : ndarray """ @@ -70,14 +70,14 @@ CINEMA_GAMUT_TO_XYZ_MATRIX = normalised_primary_matrix( CINEMA_GAMUT_PRIMARIES, CINEMA_GAMUT_WHITEPOINT) """ -*Cinema Gamut* colourspace to *CIE XYZ* tristimulus values matrix. +*Canon Cinema Gamut* colourspace to *CIE XYZ* tristimulus values matrix. CINEMA_GAMUT_TO_XYZ_MATRIX : array_like, (3, 3) """ XYZ_TO_CINEMA_GAMUT_MATRIX = np.linalg.inv(CINEMA_GAMUT_TO_XYZ_MATRIX) """ -*CIE XYZ* tristimulus values to *Cinema Gamut* colourspace matrix. +*CIE XYZ* tristimulus values to *Canon Cinema Gamut* colourspace matrix. XYZ_TO_CINEMA_GAMUT_MATRIX : array_like, (3, 3) """ @@ -93,7 +93,7 @@ linear_function, ) CINEMA_GAMUT_COLOURSPACE.__doc__ = """ -*Cinema Gamut* colourspace. +*Canon Cinema Gamut* colourspace. References ---------- diff --git a/colour/models/rgb/dataset/cie_rgb.py b/colour/models/rgb/datasets/cie_rgb.py similarity index 97% rename from colour/models/rgb/dataset/cie_rgb.py rename to colour/models/rgb/datasets/cie_rgb.py index 2932ee6460..4570fab2c9 100644 --- a/colour/models/rgb/dataset/cie_rgb.py +++ b/colour/models/rgb/datasets/cie_rgb.py @@ -54,7 +54,7 @@ Notes ----- - *CIE RGB* colourspace primaries were computed using - :attr:`colour.models.rgb.dataset.cie_rgb.CIE_RGB_TO_XYZ_MATRIX` attribute + :attr:`colour.models.rgb.datasets.cie_rgb.CIE_RGB_TO_XYZ_MATRIX` attribute and :func:`colour.primaries_whitepoint` definition. """ diff --git a/colour/models/rgb/dataset/color_match_rgb.py b/colour/models/rgb/datasets/color_match_rgb.py similarity index 100% rename from colour/models/rgb/dataset/color_match_rgb.py rename to colour/models/rgb/datasets/color_match_rgb.py diff --git a/colour/models/rgb/dataset/dcdm_xyz.py b/colour/models/rgb/datasets/dcdm_xyz.py similarity index 96% rename from colour/models/rgb/dataset/dcdm_xyz.py rename to colour/models/rgb/datasets/dcdm_xyz.py index 43158e3579..a4ef353339 100644 --- a/colour/models/rgb/dataset/dcdm_xyz.py +++ b/colour/models/rgb/datasets/dcdm_xyz.py @@ -27,7 +27,7 @@ from colour.colorimetry import ILLUMINANTS from colour.models.rgb import (RGB_Colourspace, eotf_DCDM, - normalised_primary_matrix, eotf_reverse_DCDM) + normalised_primary_matrix, eotf_inverse_DCDM) __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -89,7 +89,7 @@ DCDM_XYZ_WHITEPOINT_NAME, DCDM_XYZ_TO_XYZ_MATRIX, XYZ_TO_DCDM_XYZ_MATRIX, - eotf_reverse_DCDM, + eotf_inverse_DCDM, eotf_DCDM, ) DCDM_XYZ_COLOURSPACE.__doc__ = """ diff --git a/colour/models/rgb/dataset/dci_p3.py b/colour/models/rgb/datasets/dci_p3.py similarity index 100% rename from colour/models/rgb/dataset/dci_p3.py rename to colour/models/rgb/datasets/dci_p3.py diff --git a/colour/models/rgb/dataset/dji_dgamut.py b/colour/models/rgb/datasets/dji_dgamut.py similarity index 100% rename from colour/models/rgb/dataset/dji_dgamut.py rename to colour/models/rgb/datasets/dji_dgamut.py diff --git a/colour/models/rgb/dataset/don_rgb_4.py b/colour/models/rgb/datasets/don_rgb_4.py similarity index 100% rename from colour/models/rgb/dataset/don_rgb_4.py rename to colour/models/rgb/datasets/don_rgb_4.py diff --git a/colour/models/rgb/dataset/eci_rgb_v2.py b/colour/models/rgb/datasets/eci_rgb_v2.py similarity index 100% rename from colour/models/rgb/dataset/eci_rgb_v2.py rename to colour/models/rgb/datasets/eci_rgb_v2.py diff --git a/colour/models/rgb/dataset/ekta_space_ps5.py b/colour/models/rgb/datasets/ekta_space_ps5.py similarity index 100% rename from colour/models/rgb/dataset/ekta_space_ps5.py rename to colour/models/rgb/datasets/ekta_space_ps5.py diff --git a/colour/models/rgb/dataset/filmlight_egamut.py b/colour/models/rgb/datasets/filmlight_egamut.py similarity index 100% rename from colour/models/rgb/dataset/filmlight_egamut.py rename to colour/models/rgb/datasets/filmlight_egamut.py diff --git a/colour/models/rgb/datasets/fujifilm_f_gamut.py b/colour/models/rgb/datasets/fujifilm_f_gamut.py new file mode 100644 index 0000000000..853df399f2 --- /dev/null +++ b/colour/models/rgb/datasets/fujifilm_f_gamut.py @@ -0,0 +1,102 @@ +# -*- coding: utf-8 -*- +""" +Fujifilm F-Gamut Colourspace +============================ + +Defines the *Fujifilm F-Gamut* colourspace: + +- :attr:`colour.models.F_GAMUT_COLOURSPACE`. + +See Also +-------- +`RGB Colourspaces Jupyter Notebook +`_ + +References +---------- +- :cite:`Fujifilm2016` : Fujifilm. (2016). F-Log Data Sheet Ver.1.0. \ +Retrieved from https://www.fujifilm.com/support/digital_cameras/\ +software/lut/pdf/F-Log_DataSheet_E_Ver.1.0.pdf +""" + +from __future__ import division, unicode_literals + +import numpy as np + +from colour.colorimetry import ILLUMINANTS +from colour.models.rgb import (RGB_Colourspace, log_encoding_FLog, + normalised_primary_matrix, log_decoding_FLog) + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - http://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = [ + 'F_GAMUT_PRIMARIES', 'F_GAMUT_WHITEPOINT_NAME', 'F_GAMUT_WHITEPOINT', + 'F_GAMUT_TO_XYZ_MATRIX', 'XYZ_TO_F_GAMUT_MATRIX', 'F_GAMUT_COLOURSPACE' +] + +F_GAMUT_PRIMARIES = np.array([ + [0.70800, 0.29200], + [0.17000, 0.79700], + [0.13100, 0.04600], +]) +""" +*Fujifilm F-Gamut* colourspace primaries. + +F_GAMUT_PRIMARIES : ndarray, (3, 2) +""" + +F_GAMUT_WHITEPOINT_NAME = 'D65' +""" +*Fujifilm F-Gamut* colourspace whitepoint name. + +F_GAMUT_WHITEPOINT : unicode +""" + +F_GAMUT_WHITEPOINT = (ILLUMINANTS['CIE 1931 2 Degree Standard Observer'][ + F_GAMUT_WHITEPOINT_NAME]) +""" +*Fujifilm F-Gamut* colourspace whitepoint. + +F_GAMUT_WHITEPOINT : ndarray +""" + +F_GAMUT_TO_XYZ_MATRIX = normalised_primary_matrix(F_GAMUT_PRIMARIES, + F_GAMUT_WHITEPOINT) +""" +*Fujifilm F-Gamut* colourspace to *CIE XYZ* tristimulus values matrix. + +F_GAMUT_TO_XYZ_MATRIX : array_like, (3, 3) +""" + +XYZ_TO_F_GAMUT_MATRIX = np.linalg.inv(F_GAMUT_TO_XYZ_MATRIX) +""" +*CIE XYZ* tristimulus values to *Fujifilm F-Gamut* colourspace matrix. + +XYZ_TO_F_GAMUT_MATRIX : array_like, (3, 3) +""" + +F_GAMUT_COLOURSPACE = RGB_Colourspace( + 'F-Gamut', + F_GAMUT_PRIMARIES, + F_GAMUT_WHITEPOINT, + F_GAMUT_WHITEPOINT_NAME, + F_GAMUT_TO_XYZ_MATRIX, + XYZ_TO_F_GAMUT_MATRIX, + log_encoding_FLog, + log_decoding_FLog, +) +F_GAMUT_COLOURSPACE.__doc__ = """ +*Fujifilm F-Gamut* colourspace. + +References +---------- +:cite:`Fujifilm2016` + +F_GAMUT_COLOURSPACE : RGB_Colourspace +""" diff --git a/colour/models/rgb/dataset/gopro.py b/colour/models/rgb/datasets/gopro.py similarity index 100% rename from colour/models/rgb/dataset/gopro.py rename to colour/models/rgb/datasets/gopro.py diff --git a/colour/models/rgb/dataset/itur_bt_2020.py b/colour/models/rgb/datasets/itur_bt_2020.py similarity index 100% rename from colour/models/rgb/dataset/itur_bt_2020.py rename to colour/models/rgb/datasets/itur_bt_2020.py diff --git a/colour/models/rgb/dataset/itur_bt_470.py b/colour/models/rgb/datasets/itur_bt_470.py similarity index 97% rename from colour/models/rgb/dataset/itur_bt_470.py rename to colour/models/rgb/datasets/itur_bt_470.py index 6781099c0b..fcbf73fba5 100644 --- a/colour/models/rgb/dataset/itur_bt_470.py +++ b/colour/models/rgb/datasets/itur_bt_470.py @@ -107,7 +107,11 @@ BT470_525_COLOURSPACE : RGB_Colourspace """ -BT470_625_PRIMARIES = np.array([[0.64, 0.33], [0.29, 0.60], [0.15, 0.06]], ) +BT470_625_PRIMARIES = np.array([ + [0.6400, 0.3300], + [0.2900, 0.6000], + [0.1500, 0.0600], +]) """ *ITU-R BT.470 - 625* colourspace primaries. diff --git a/colour/models/rgb/dataset/itur_bt_709.py b/colour/models/rgb/datasets/itur_bt_709.py similarity index 98% rename from colour/models/rgb/dataset/itur_bt_709.py rename to colour/models/rgb/datasets/itur_bt_709.py index b65b531b7c..aa1973b0fb 100644 --- a/colour/models/rgb/dataset/itur_bt_709.py +++ b/colour/models/rgb/datasets/itur_bt_709.py @@ -28,7 +28,7 @@ import numpy as np from colour.colorimetry import ILLUMINANTS -from colour.models.rgb import (RGB_Colourspace, oetf_BT709, oetf_reverse_BT709, +from colour.models.rgb import (RGB_Colourspace, oetf_BT709, oetf_inverse_BT709, normalised_primary_matrix) __author__ = 'Colour Developers' @@ -92,7 +92,7 @@ BT709_TO_XYZ_MATRIX, XYZ_TO_BT709_MATRIX, oetf_BT709, - oetf_reverse_BT709, + oetf_inverse_BT709, ) BT709_COLOURSPACE.__doc__ = """ *ITU-R BT.709* colourspace. diff --git a/colour/models/rgb/dataset/max_rgb.py b/colour/models/rgb/datasets/max_rgb.py similarity index 100% rename from colour/models/rgb/dataset/max_rgb.py rename to colour/models/rgb/datasets/max_rgb.py diff --git a/colour/models/rgb/datasets/ntsc.py b/colour/models/rgb/datasets/ntsc.py new file mode 100644 index 0000000000..99d7ad1b57 --- /dev/null +++ b/colour/models/rgb/datasets/ntsc.py @@ -0,0 +1,163 @@ +# -*- coding: utf-8 -*- +""" +NTSC Colourspaces +================= + +Defines the *NTSC* colourspaces: + +- :attr:`colour.models.NTSC_1953_COLOURSPACE`. +- :attr:`colour.models.NTSC_1987_COLOURSPACE`. + +See Also +-------- +`RGB Colourspaces Jupyter Notebook +`_ + +References +---------- +- :cite:`InternationalTelecommunicationUnion1998a` : International + Telecommunication Union. (1998). Recommendation ITU-R BT.470-6 - + CONVENTIONAL TELEVISION SYSTEMS. Retrieved from http://www.itu.int/\ +dms_pubrec/itu-r/rec/bt/R-REC-BT.470-6-199811-S!!PDF-E.pdf +- :cite:`SocietyofMotionPictureandTelevisionEngineers2004a` : Society of +Motion Picture and Television Engineers. (2004). RP 145:2004: SMPTE C Color +Monitor Colorimetry. RP 145:2004 (Vol. RP 145:200). The Society of Motion +Picture and Television Engineers. doi:10.5594/S9781614821649 +""" + +from __future__ import division, unicode_literals + +from colour.models.rgb import RGB_Colourspace +from colour.models.rgb.datasets.itur_bt_470 import ( + BT470_525_PRIMARIES, BT470_525_WHITEPOINT, BT470_525_WHITEPOINT_NAME, + BT470_525_TO_XYZ_MATRIX, XYZ_TO_BT470_525_MATRIX, BT470_525_COLOURSPACE) +from colour.models.rgb.datasets.smpte_c import ( + SMPTE_C_PRIMARIES, SMPTE_C_WHITEPOINT_NAME, SMPTE_C_WHITEPOINT, + SMPTE_C_TO_XYZ_MATRIX, XYZ_TO_SMPTE_C_MATRIX, SMPTE_C_COLOURSPACE) + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = [ + 'NTSC_1953_PRIMARIES', 'NTSC_1953_WHITEPOINT_NAME', 'NTSC_1953_WHITEPOINT', + 'NTSC_1953_TO_XYZ_MATRIX', 'XYZ_TO_NTSC_1953_MATRIX', + 'NTSC_1953_COLOURSPACE', 'NTSC_1987_PRIMARIES', + 'NTSC_1987_WHITEPOINT_NAME', 'NTSC_1987_WHITEPOINT', + 'NTSC_1987_TO_XYZ_MATRIX', 'XYZ_TO_NTSC_1987_MATRIX', + 'NTSC_1987_COLOURSPACE' +] + +NTSC_1953_PRIMARIES = BT470_525_PRIMARIES +""" +*NTSC (1953)* colourspace primaries. + +NTSC_1953_PRIMARIES : ndarray, (3, 2) +""" + +NTSC_1953_WHITEPOINT_NAME = BT470_525_WHITEPOINT_NAME +""" +*NTSC (1953)* colourspace whitepoint name. + +NTSC_1953_WHITEPOINT_NAME : unicode +""" + +NTSC_1953_WHITEPOINT = BT470_525_WHITEPOINT +""" +*NTSC (1953)* colourspace whitepoint. + +NTSC_1953_WHITEPOINT : ndarray +""" + +NTSC_1953_TO_XYZ_MATRIX = BT470_525_TO_XYZ_MATRIX +""" +*NTSC (1953)* colourspace to *CIE XYZ* tristimulus values matrix. + +NTSC_1953_TO_XYZ_MATRIX : array_like, (3, 3) +""" + +XYZ_TO_NTSC_1953_MATRIX = XYZ_TO_BT470_525_MATRIX +""" +*CIE XYZ* tristimulus values to *NTSC (1953)* colourspace matrix. + +XYZ_TO_NTSC_1953_MATRIX : array_like, (3, 3) +""" + +NTSC_1953_COLOURSPACE = RGB_Colourspace( + 'NTSC (1953)', + NTSC_1953_PRIMARIES, + NTSC_1953_WHITEPOINT, + NTSC_1953_WHITEPOINT_NAME, + NTSC_1953_TO_XYZ_MATRIX, + XYZ_TO_NTSC_1953_MATRIX, + BT470_525_COLOURSPACE.cctf_encoding, + BT470_525_COLOURSPACE.cctf_decoding, +) +NTSC_1953_COLOURSPACE.__doc__ = """ +*NTSC (1953)* colourspace. + +References +---------- +:cite:`InternationalTelecommunicationUnion1998a` + +NTSC_1953_COLOURSPACE : RGB_Colourspace +""" + +NTSC_1987_PRIMARIES = SMPTE_C_PRIMARIES +""" +*NTSC (1987)* colourspace primaries. + +NTSC_1987_PRIMARIES : ndarray, (3, 2) +""" + +NTSC_1987_WHITEPOINT_NAME = SMPTE_C_WHITEPOINT_NAME +""" +*NTSC (1987)* colourspace whitepoint name. + +NTSC_1987_WHITEPOINT_NAME : unicode +""" + +NTSC_1987_WHITEPOINT = SMPTE_C_WHITEPOINT +""" +*NTSC (1987)* colourspace whitepoint. + +NTSC_1987_WHITEPOINT : ndarray +""" + +NTSC_1987_TO_XYZ_MATRIX = SMPTE_C_TO_XYZ_MATRIX +""" +*NTSC (1987)* colourspace to *CIE XYZ* tristimulus values matrix. + +NTSC_1987_TO_XYZ_MATRIX : array_like, (3, 3) +""" + +XYZ_TO_NTSC_1987_MATRIX = XYZ_TO_SMPTE_C_MATRIX +""" +*CIE XYZ* tristimulus values to *NTSC (1987)* colourspace matrix. + +XYZ_TO_NTSC_1987_MATRIX : array_like, (3, 3) +""" + +NTSC_1987_COLOURSPACE = RGB_Colourspace( + 'NTSC (1987)', + NTSC_1987_PRIMARIES, + NTSC_1987_WHITEPOINT, + NTSC_1987_WHITEPOINT_NAME, + NTSC_1987_TO_XYZ_MATRIX, + XYZ_TO_NTSC_1987_MATRIX, + SMPTE_C_COLOURSPACE.cctf_encoding, + SMPTE_C_COLOURSPACE.cctf_decoding, +) +NTSC_1987_COLOURSPACE.__doc__ = """ +*NTSC (1987)* colourspace. + +References +---------- +:cite:`SocietyofMotionPictureandTelevisionEngineers2004a` + +NTSC_1987_COLOURSPACE : RGB_Colourspace +""" diff --git a/colour/models/rgb/dataset/p3_d65.py b/colour/models/rgb/datasets/p3_d65.py similarity index 100% rename from colour/models/rgb/dataset/p3_d65.py rename to colour/models/rgb/datasets/p3_d65.py diff --git a/colour/models/rgb/dataset/pal_secam.py b/colour/models/rgb/datasets/pal_secam.py similarity index 94% rename from colour/models/rgb/dataset/pal_secam.py rename to colour/models/rgb/datasets/pal_secam.py index 74446d475a..c0bfa886bc 100644 --- a/colour/models/rgb/dataset/pal_secam.py +++ b/colour/models/rgb/datasets/pal_secam.py @@ -24,7 +24,7 @@ from __future__ import division, unicode_literals from colour.models.rgb import RGB_Colourspace -from colour.models.rgb.dataset.itur_bt_470 import ( +from colour.models.rgb.datasets.itur_bt_470 import ( BT470_625_PRIMARIES, BT470_625_WHITEPOINT, BT470_625_WHITEPOINT_NAME, BT470_625_TO_XYZ_MATRIX, XYZ_TO_BT470_625_MATRIX, BT470_625_COLOURSPACE) @@ -83,8 +83,8 @@ PAL_SECAM_WHITEPOINT_NAME, PAL_SECAM_TO_XYZ_MATRIX, XYZ_TO_PAL_SECAM_MATRIX, - BT470_625_COLOURSPACE.encoding_cctf, - BT470_625_COLOURSPACE.decoding_cctf, + BT470_625_COLOURSPACE.cctf_encoding, + BT470_625_COLOURSPACE.cctf_decoding, ) PAL_SECAM_COLOURSPACE.__doc__ = """ *Pal/Secam* colourspace. diff --git a/colour/models/rgb/dataset/v_gamut.py b/colour/models/rgb/datasets/panasonic_v_gamut.py similarity index 84% rename from colour/models/rgb/dataset/v_gamut.py rename to colour/models/rgb/datasets/panasonic_v_gamut.py index 122912cd1e..468915b0fc 100644 --- a/colour/models/rgb/dataset/v_gamut.py +++ b/colour/models/rgb/datasets/panasonic_v_gamut.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- """ -V-Gamut Colourspace -=================== +Panasonic V-Gamut Colourspace +============================= -Defines the *V-Gamut* colourspace: +Defines the *Panasonic V-Gamut* colourspace: - :attr:`colour.models.V_GAMUT_COLOURSPACE`. @@ -46,14 +46,14 @@ [0.1000, -0.0300], ]) """ -*V-Gamut* colourspace primaries. +*Panasonic V-Gamut* colourspace primaries. V_GAMUT_PRIMARIES : ndarray, (3, 2) """ V_GAMUT_WHITEPOINT_NAME = 'D65' """ -*V-Gamut* colourspace whitepoint name. +*Panasonic V-Gamut* colourspace whitepoint name. V_GAMUT_WHITEPOINT : unicode """ @@ -61,7 +61,7 @@ V_GAMUT_WHITEPOINT = (ILLUMINANTS['CIE 1931 2 Degree Standard Observer'][ V_GAMUT_WHITEPOINT_NAME]) """ -*V-Gamut* colourspace whitepoint. +*Panasonic V-Gamut* colourspace whitepoint. V_GAMUT_WHITEPOINT : ndarray """ @@ -72,7 +72,7 @@ [-0.009310, -0.004612, 1.102980], ]) """ -*V-Gamut* colourspace to *CIE XYZ* tristimulus values matrix. +*Panasonic V-Gamut* colourspace to *CIE XYZ* tristimulus values matrix. V_GAMUT_TO_XYZ_MATRIX : array_like, (3, 3) """ @@ -83,7 +83,7 @@ [0.011179, 0.003194, 0.905535], ]) """ -*CIE XYZ* tristimulus values to *V-Gamut* colourspace matrix. +*CIE XYZ* tristimulus values to *Panasonic V-Gamut* colourspace matrix. XYZ_TO_V_GAMUT_MATRIX : array_like, (3, 3) """ @@ -99,7 +99,7 @@ log_decoding_VLog, ) V_GAMUT_COLOURSPACE.__doc__ = """ -*V-Gamut* colourspace. +*Panasonic V-Gamut* colourspace. References ---------- diff --git a/colour/models/rgb/dataset/red.py b/colour/models/rgb/datasets/red.py similarity index 100% rename from colour/models/rgb/dataset/red.py rename to colour/models/rgb/datasets/red.py diff --git a/colour/models/rgb/dataset/rimm_romm_rgb.py b/colour/models/rgb/datasets/rimm_romm_rgb.py similarity index 94% rename from colour/models/rgb/dataset/rimm_romm_rgb.py rename to colour/models/rgb/datasets/rimm_romm_rgb.py index 0e6e75b1b5..682b31f087 100644 --- a/colour/models/rgb/dataset/rimm_romm_rgb.py +++ b/colour/models/rgb/datasets/rimm_romm_rgb.py @@ -31,10 +31,11 @@ import numpy as np from colour.colorimetry import ILLUMINANTS -from colour.models.rgb import (RGB_Colourspace, oetf_ROMMRGB, eotf_ROMMRGB, - oetf_RIMMRGB, eotf_RIMMRGB, - log_encoding_ERIMMRGB, log_decoding_ERIMMRGB, - oetf_ProPhotoRGB, eotf_ProPhotoRGB) +from colour.models.rgb import ( + RGB_Colourspace, cctf_encoding_ROMMRGB, cctf_decoding_ROMMRGB, + cctf_encoding_RIMMRGB, cctf_decoding_RIMMRGB, log_encoding_ERIMMRGB, + log_decoding_ERIMMRGB, cctf_encoding_ProPhotoRGB, + cctf_decoding_ProPhotoRGB) __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -111,8 +112,8 @@ ROMM_RGB_WHITEPOINT_NAME, ROMM_RGB_TO_XYZ_MATRIX, XYZ_TO_ROMM_RGB_MATRIX, - oetf_ROMMRGB, - eotf_ROMMRGB, + cctf_encoding_ROMMRGB, + cctf_decoding_ROMMRGB, ) ROMM_RGB_COLOURSPACE.__doc__ = """ *ROMM RGB* colourspace. @@ -166,8 +167,8 @@ RIMM_RGB_WHITEPOINT_NAME, RIMM_RGB_TO_XYZ_MATRIX, XYZ_TO_RIMM_RGB_MATRIX, - oetf_RIMMRGB, - eotf_RIMMRGB, + cctf_encoding_RIMMRGB, + cctf_decoding_RIMMRGB, ) RIMM_RGB_COLOURSPACE.__doc__ = """ *RIMM RGB* colourspace. In cases in which it is necessary to identify a @@ -278,8 +279,8 @@ PROPHOTO_RGB_WHITEPOINT_NAME, PROPHOTO_RGB_TO_XYZ_MATRIX, XYZ_TO_PROPHOTO_RGB_MATRIX, - oetf_ProPhotoRGB, - eotf_ProPhotoRGB, + cctf_encoding_ProPhotoRGB, + cctf_decoding_ProPhotoRGB, ) PROPHOTO_RGB_COLOURSPACE.__doc__ = """ *ProPhoto RGB* colourspace, an alias colourspace for *ROMM RGB*. diff --git a/colour/models/rgb/dataset/russell_rgb.py b/colour/models/rgb/datasets/russell_rgb.py similarity index 98% rename from colour/models/rgb/dataset/russell_rgb.py rename to colour/models/rgb/datasets/russell_rgb.py index f2fef1fdc3..cf25c35788 100644 --- a/colour/models/rgb/dataset/russell_rgb.py +++ b/colour/models/rgb/datasets/russell_rgb.py @@ -25,7 +25,7 @@ import numpy as np from functools import partial -from colour.colorimetry.dataset import ILLUMINANTS +from colour.colorimetry.datasets import ILLUMINANTS from colour.models.rgb import (RGB_Colourspace, gamma_function, normalised_primary_matrix) diff --git a/colour/models/rgb/dataset/sharp.py b/colour/models/rgb/datasets/sharp.py similarity index 100% rename from colour/models/rgb/dataset/sharp.py rename to colour/models/rgb/datasets/sharp.py diff --git a/colour/models/rgb/dataset/smpte_240m.py b/colour/models/rgb/datasets/smpte_240m.py similarity index 89% rename from colour/models/rgb/dataset/smpte_240m.py rename to colour/models/rgb/datasets/smpte_240m.py index c6e86c239c..ebc0c48593 100644 --- a/colour/models/rgb/dataset/smpte_240m.py +++ b/colour/models/rgb/datasets/smpte_240m.py @@ -20,10 +20,6 @@ Signal Parameters - 1125-Line High-Definition Production Systems. Retrieved from http://car.france3.mars.free.fr/HD/INA- 26 jan 06/\ SMPTE normes et confs/s240m.pdf -- :cite:`SocietyofMotionPictureandTelevisionEngineers2004a` : Society of -Motion Picture and Television Engineers. (2004). RP 145:2004: SMPTE C Color -Monitor Colorimetry. RP 145:2004 (Vol. RP 145:200). The Society of Motion -Picture and Television Engineers. doi:10.5594/S9781614821649 """ from __future__ import division, unicode_literals @@ -104,7 +100,6 @@ References ---------- :cite:`SocietyofMotionPictureandTelevisionEngineers1999b`, -:cite:`SocietyofMotionPictureandTelevisionEngineers2004a` SMPTE_240M_COLOURSPACE : RGB_Colourspace """ diff --git a/colour/models/rgb/datasets/smpte_c.py b/colour/models/rgb/datasets/smpte_c.py new file mode 100644 index 0000000000..7ff262912b --- /dev/null +++ b/colour/models/rgb/datasets/smpte_c.py @@ -0,0 +1,104 @@ +# -*- coding: utf-8 -*- +""" +SMPTE C Colourspace +=================== + +Defines the *SMPTE C* colourspace: + +- :attr:`SMPTE_C_COLOURSPACE`. + +See Also +-------- +`RGB Colourspaces Jupyter Notebook +`_ + +References +---------- +- :cite:`SocietyofMotionPictureandTelevisionEngineers2004a` : Society of +Motion Picture and Television Engineers. (2004). RP 145:2004: SMPTE C Color +Monitor Colorimetry. RP 145:2004 (Vol. RP 145:200). The Society of Motion +Picture and Television Engineers. doi:10.5594/S9781614821649 +""" + +from __future__ import division, unicode_literals + +import numpy as np +from functools import partial + +from colour.colorimetry import ILLUMINANTS +from colour.models.rgb import (RGB_Colourspace, gamma_function, + normalised_primary_matrix) + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = [ + 'SMPTE_C_PRIMARIES', 'SMPTE_C_WHITEPOINT_NAME', 'SMPTE_C_WHITEPOINT', + 'SMPTE_C_TO_XYZ_MATRIX', 'XYZ_TO_SMPTE_C_MATRIX', 'SMPTE_C_COLOURSPACE' +] + +SMPTE_C_PRIMARIES = np.array([ + [0.630, 0.340], + [0.310, 0.595], + [0.155, 0.070], +]) +""" +*SMPTE C* colourspace primaries. + +SMPTE_C_PRIMARIES : ndarray, (3, 2) +""" + +SMPTE_C_WHITEPOINT_NAME = 'D65' +""" +*SMPTE C* colourspace whitepoint name. + +SMPTE_C_WHITEPOINT_NAME : unicode +""" + +SMPTE_C_WHITEPOINT = (ILLUMINANTS['CIE 1931 2 Degree Standard Observer'][ + SMPTE_C_WHITEPOINT_NAME]) +""" +*SMPTE C* colourspace whitepoint. + +SMPTE_C_WHITEPOINT : ndarray +""" + +SMPTE_C_TO_XYZ_MATRIX = normalised_primary_matrix(SMPTE_C_PRIMARIES, + SMPTE_C_WHITEPOINT) +""" +*SMPTE C* colourspace to *CIE XYZ* tristimulus values matrix. + +SMPTE_C_TO_XYZ_MATRIX : array_like, (3, 3) +""" + +XYZ_TO_SMPTE_C_MATRIX = np.linalg.inv(SMPTE_C_TO_XYZ_MATRIX) +""" +*CIE XYZ* tristimulus values to *SMPTE C* colourspace matrix. + +XYZ_TO_SMPTE_C_MATRIX : array_like, (3, 3) +""" + +SMPTE_C_COLOURSPACE = RGB_Colourspace( + 'SMPTE C', + SMPTE_C_PRIMARIES, + SMPTE_C_WHITEPOINT, + SMPTE_C_WHITEPOINT_NAME, + SMPTE_C_TO_XYZ_MATRIX, + XYZ_TO_SMPTE_C_MATRIX, + partial(gamma_function, exponent=1 / 2.2), + partial(gamma_function, exponent=2.2), +) +""" +*SMPTE C* colourspace. + +References +---------- +:cite:`SocietyofMotionPictureandTelevisionEngineers2004a` + +SMPTE_C_COLOURSPACE : RGB_Colourspace +""" diff --git a/colour/models/rgb/dataset/sony.py b/colour/models/rgb/datasets/sony.py similarity index 100% rename from colour/models/rgb/dataset/sony.py rename to colour/models/rgb/datasets/sony.py diff --git a/colour/models/rgb/dataset/srgb.py b/colour/models/rgb/datasets/srgb.py similarity index 96% rename from colour/models/rgb/dataset/srgb.py rename to colour/models/rgb/datasets/srgb.py index 8dc5f199d9..5aee1c09ff 100644 --- a/colour/models/rgb/dataset/srgb.py +++ b/colour/models/rgb/datasets/srgb.py @@ -33,7 +33,7 @@ import numpy as np from colour.colorimetry import ILLUMINANTS -from colour.models.rgb import (RGB_Colourspace, oetf_sRGB, oetf_reverse_sRGB) +from colour.models.rgb import RGB_Colourspace, eotf_inverse_sRGB, eotf_sRGB __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -102,8 +102,8 @@ sRGB_WHITEPOINT_NAME, sRGB_TO_XYZ_MATRIX, XYZ_TO_sRGB_MATRIX, - oetf_sRGB, - oetf_reverse_sRGB, + eotf_inverse_sRGB, + eotf_sRGB, ) sRGB_COLOURSPACE.__doc__ = """ *sRGB* colourspace. diff --git a/colour/models/rgb/dataset/xtreme_rgb.py b/colour/models/rgb/datasets/xtreme_rgb.py similarity index 100% rename from colour/models/rgb/dataset/xtreme_rgb.py rename to colour/models/rgb/datasets/xtreme_rgb.py diff --git a/colour/models/rgb/ictcp.py b/colour/models/rgb/ictcp.py index 8e648588b4..94f94ccec3 100644 --- a/colour/models/rgb/ictcp.py +++ b/colour/models/rgb/ictcp.py @@ -30,7 +30,8 @@ import numpy as np -from colour.models.rgb.transfer_functions import oetf_ST2084, eotf_ST2084 +from colour.models.rgb.transfer_functions import (eotf_inverse_ST2084, + eotf_ST2084) from colour.utilities import (domain_range_scale, dot_vector, from_range_1, to_domain_1) @@ -140,7 +141,7 @@ def RGB_to_ICTCP(RGB, L_p=10000): LMS = dot_vector(ICTCP_RGB_TO_LMS_MATRIX, RGB) with domain_range_scale('ignore'): - LMS_p = oetf_ST2084(LMS, L_p) + LMS_p = eotf_inverse_ST2084(LMS, L_p) ICTCP = dot_vector(ICTCP_LMS_P_TO_ICTCP_MATRIX, LMS_p) diff --git a/colour/models/rgb/rgb_colourspace.py b/colour/models/rgb/rgb_colourspace.py index 44580e1b37..0bbf77a415 100644 --- a/colour/models/rgb/rgb_colourspace.py +++ b/colour/models/rgb/rgb_colourspace.py @@ -4,7 +4,7 @@ =================================== Defines the :class:`colour.RGB_Colourspace` class for the *RGB* colourspaces -dataset from :mod:`colour.models.dataset.aces_rgb`, etc... and the following +datasets from :mod:`colour.models.datasets.aces_rgb`, etc... and the following *RGB* colourspace transformations or helper definitions: - :func:`colour.XYZ_to_RGB` @@ -39,9 +39,10 @@ normalised_primary_matrix) from colour.adaptation import chromatic_adaptation_matrix_VonKries from colour.utilities import (as_float_array, domain_range_scale, dot_matrix, - dot_vector, from_range_1, to_domain_1, is_string, - runtime_warning) -from colour.utilities.deprecation import Renamed + dot_vector, filter_kwargs, from_range_1, + to_domain_1, is_string, runtime_warning) +from colour.utilities.deprecation import (ObjectRenamed, + handle_arguments_deprecation) __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -58,8 +59,8 @@ class RGB_Colourspace(object): """ - Implements support for the *RGB* colourspaces dataset from - :mod:`colour.models.dataset.aces_rgb`, etc.... + Implements support for the *RGB* colourspaces datasets from + :mod:`colour.models.datasets.aces_rgb`, etc.... Colour science literature related to *RGB* colourspaces and encodings defines their dataset using different degree of precision or rounding. @@ -123,12 +124,12 @@ class RGB_Colourspace(object): Transformation matrix from colourspace to *CIE XYZ* tristimulus values. XYZ_to_RGB_matrix : array_like, optional Transformation matrix from *CIE XYZ* tristimulus values to colourspace. - encoding_cctf : object, optional + cctf_encoding : object, optional Encoding colour component transfer function (Encoding CCTF) / opto-electronic transfer function (OETF / OECF) that maps estimated tristimulus values in a scene to :math:`R'G'B'` video component signal value. - decoding_cctf : object, optional + cctf_decoding : object, optional Decoding colour component transfer function (Decoding CCTF) / electro-optical transfer function (EOTF / EOCF) that maps an :math:`R'G'B'` video component signal value to tristimulus values at @@ -148,8 +149,8 @@ class RGB_Colourspace(object): whitepoint_name RGB_to_XYZ_matrix XYZ_to_RGB_matrix - encoding_cctf - decoding_cctf + cctf_encoding + cctf_decoding use_derived_RGB_to_XYZ_matrix use_derived_XYZ_to_RGB_matrix @@ -221,8 +222,8 @@ def __init__(self, whitepoint_name=None, RGB_to_XYZ_matrix=None, XYZ_to_RGB_matrix=None, - encoding_cctf=None, - decoding_cctf=None, + cctf_encoding=None, + cctf_decoding=None, use_derived_RGB_to_XYZ_matrix=False, use_derived_XYZ_to_RGB_matrix=False): self._derived_RGB_to_XYZ_matrix = None @@ -240,10 +241,10 @@ def __init__(self, self.RGB_to_XYZ_matrix = RGB_to_XYZ_matrix self._XYZ_to_RGB_matrix = None self.XYZ_to_RGB_matrix = XYZ_to_RGB_matrix - self._encoding_cctf = None - self.encoding_cctf = encoding_cctf - self._decoding_cctf = None - self.decoding_cctf = decoding_cctf + self._cctf_encoding = None + self.cctf_encoding = cctf_encoding + self._cctf_decoding = None + self.cctf_decoding = cctf_decoding self._use_derived_RGB_to_XYZ_matrix = False self.use_derived_RGB_to_XYZ_matrix = use_derived_RGB_to_XYZ_matrix self._use_derived_XYZ_to_RGB_matrix = False @@ -441,7 +442,7 @@ def XYZ_to_RGB_matrix(self, value): self._XYZ_to_RGB_matrix = value @property - def encoding_cctf(self): + def cctf_encoding(self): """ Getter and setter property for the encoding colour component transfer function (Encoding CCTF) / opto-electronic transfer function @@ -460,23 +461,23 @@ def encoding_cctf(self): opto-electronic transfer function (OETF / OECF). """ - return self._encoding_cctf + return self._cctf_encoding - @encoding_cctf.setter - def encoding_cctf(self, value): + @cctf_encoding.setter + def cctf_encoding(self, value): """ - Setter for the **self.encoding_cctf** property. + Setter for the **self.cctf_encoding** property. """ if value is not None: assert hasattr( value, '__call__'), ('"{0}" attribute: "{1}" is not callable!'.format( - 'encoding_cctf', value)) - self._encoding_cctf = value + 'cctf_encoding', value)) + self._cctf_encoding = value @property - def decoding_cctf(self): + def cctf_decoding(self): """ Getter and setter property for the decoding colour component transfer function (Decoding CCTF) / electro-optical transfer function @@ -495,20 +496,20 @@ def decoding_cctf(self): electro-optical transfer function (EOTF / EOCF). """ - return self._decoding_cctf + return self._cctf_decoding - @decoding_cctf.setter - def decoding_cctf(self, value): + @cctf_decoding.setter + def cctf_decoding(self, value): """ - Setter for the **self.decoding_cctf** property. + Setter for the **self.cctf_decoding** property. """ if value is not None: assert hasattr( value, '__call__'), ('"{0}" attribute: "{1}" is not callable!'.format( - 'decoding_cctf', value)) - self._decoding_cctf = value + 'cctf_decoding', value)) + self._cctf_decoding = value @property def use_derived_RGB_to_XYZ_matrix(self): @@ -590,11 +591,11 @@ def __str__(self): >>> whitepoint = np.array([0.32168, 0.33767]) >>> RGB_to_XYZ_matrix = np.identity(3) >>> XYZ_to_RGB_matrix = np.identity(3) - >>> encoding_cctf = lambda x: x - >>> decoding_cctf = lambda x: x + >>> cctf_encoding = lambda x: x + >>> cctf_decoding = lambda x: x >>> print(RGB_Colourspace('RGB Colourspace', p, whitepoint, 'ACES', ... RGB_to_XYZ_matrix, XYZ_to_RGB_matrix, - ... encoding_cctf, decoding_cctf)) + ... cctf_encoding, cctf_decoding)) ... # doctest: +ELLIPSIS RGB Colourspace --------------- @@ -653,8 +654,8 @@ def _indent_array(a): _indent_array(self.primaries), self.whitepoint, self.whitepoint_name, - self.encoding_cctf, - self.decoding_cctf, + self.cctf_encoding, + self.cctf_decoding, _indent_array(self._RGB_to_XYZ_matrix), _indent_array(self._XYZ_to_RGB_matrix), _indent_array(self._derived_RGB_to_XYZ_matrix), @@ -680,11 +681,11 @@ def __repr__(self): >>> whitepoint = np.array([0.32168, 0.33767]) >>> RGB_to_XYZ_matrix = np.identity(3) >>> XYZ_to_RGB_matrix = np.identity(3) - >>> encoding_cctf = lambda x: x - >>> decoding_cctf = lambda x: x + >>> cctf_encoding = lambda x: x + >>> cctf_decoding = lambda x: x >>> RGB_Colourspace('RGB Colourspace', p, whitepoint, 'ACES', ... RGB_to_XYZ_matrix, XYZ_to_RGB_matrix, - ... encoding_cctf, decoding_cctf) + ... cctf_encoding, cctf_decoding) ... # doctest: +ELLIPSIS RGB_Colourspace(RGB Colourspace, [[ 7.34700000e-01, 2.65300000e-01], @@ -730,8 +731,8 @@ def _indent_array(a): self.whitepoint_name, _indent_array(self.RGB_to_XYZ_matrix), _indent_array(self.XYZ_to_RGB_matrix), - self.encoding_cctf, - self.decoding_cctf, + self.cctf_encoding, + self.cctf_decoding, self.use_derived_RGB_to_XYZ_matrix, self.use_derived_XYZ_to_RGB_matrix, ) @@ -863,32 +864,53 @@ def copy(self): # --- API Changes and Deprecation Management ---# # ------------------------------------------------------------------------# @property - def illuminant(self): + def illuminant(self): # pragma: no cover # Docstrings are omitted for documentation purposes. runtime_warning( str( - Renamed('RGB_Colourspace.illuminant', - 'RGB_Colourspace.whitepoint_name'))) + ObjectRenamed('RGB_Colourspace.illuminant', + 'RGB_Colourspace.whitepoint_name'))) return self.whitepoint_name @illuminant.setter - def illuminant(self, value): + def illuminant(self, value): # pragma: no cover # Docstrings are omitted for documentation purposes. runtime_warning( str( - Renamed('RGB_Colourspace.illuminant', - 'RGB_Colourspace.whitepoint_name'))) + ObjectRenamed('RGB_Colourspace.illuminant', + 'RGB_Colourspace.whitepoint_name'))) self.whitepoint_name = value + @property + def decoding_cctf(self): # pragma: no cover + # Docstrings are omitted for documentation purposes. + runtime_warning( + str( + ObjectRenamed('RGB_Colourspace.decoding_cctf', + 'RGB_Colourspace.cctf_decoding'))) + + return self.cctf_decoding + + @property + def encoding_cctf(self): # pragma: no cover + # Docstrings are omitted for documentation purposes. + runtime_warning( + str( + ObjectRenamed('RGB_Colourspace.encoding_cctf', + 'RGB_Colourspace.cctf_encoding'))) + + return self.cctf_encoding + def XYZ_to_RGB(XYZ, illuminant_XYZ, illuminant_RGB, XYZ_to_RGB_matrix, chromatic_adaptation_transform='CAT02', - encoding_cctf=None): + cctf_encoding=None, + **kwargs): """ Converts from *CIE XYZ* tristimulus values to *RGB* colourspace array. @@ -897,10 +919,10 @@ def XYZ_to_RGB(XYZ, XYZ : array_like *CIE XYZ* tristimulus values. illuminant_XYZ : array_like - *CIE XYZ* tristimulus values *illuminant* *xy* chromaticity coordinates - or *CIE xyY* colourspace array. + *CIE XYZ* tristimulus values *illuminant* *CIE xy* chromaticity + coordinates or *CIE xyY* colourspace array. illuminant_RGB : array_like - *RGB* colourspace *illuminant* *xy* chromaticity coordinates or + *RGB* colourspace *illuminant* *CIE xy* chromaticity coordinates or *CIE xyY* colourspace array. XYZ_to_RGB_matrix : array_like *Normalised primary matrix*. @@ -910,10 +932,15 @@ def XYZ_to_RGB(XYZ, 'Bianco PC', None}**, *Chromatic adaptation* transform, if *None* no chromatic adaptation is performed. - encoding_cctf : object, optional + cctf_encoding : object, optional Encoding colour component transfer function (Encoding CCTF) or opto-electronic transfer function (OETF / OECF). + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments for deprecation management. + Returns ------- ndarray @@ -954,6 +981,10 @@ def XYZ_to_RGB(XYZ, array([ 0.4559557..., 0.0303970..., 0.0408724...]) """ + cctf_encoding = handle_arguments_deprecation({ + 'ArgumentRenamed': [['encoding_cctf', 'cctf_encoding']], + }, **kwargs).get('cctf_encoding', cctf_encoding) + XYZ = to_domain_1(XYZ) if chromatic_adaptation_transform is not None: @@ -966,9 +997,9 @@ def XYZ_to_RGB(XYZ, RGB = dot_vector(XYZ_to_RGB_matrix, XYZ) - if encoding_cctf is not None: + if cctf_encoding is not None: with domain_range_scale('ignore'): - RGB = encoding_cctf(RGB) + RGB = cctf_encoding(RGB) return from_range_1(RGB) @@ -978,7 +1009,8 @@ def RGB_to_XYZ(RGB, illuminant_XYZ, RGB_to_XYZ_matrix, chromatic_adaptation_transform='CAT02', - decoding_cctf=None): + cctf_decoding=None, + **kwargs): """ Converts given *RGB* colourspace array to *CIE XYZ* tristimulus values. @@ -1000,10 +1032,15 @@ def RGB_to_XYZ(RGB, 'Bianco PC', None}**, *Chromatic adaptation* transform, if *None* no chromatic adaptation is performed. - decoding_cctf : object, optional + cctf_decoding : object, optional Decoding colour component transfer function (Decoding CCTF) or electro-optical transfer function (EOTF / EOCF). + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments for deprecation management. + Returns ------- ndarray @@ -1044,11 +1081,15 @@ def RGB_to_XYZ(RGB, array([ 0.2163881..., 0.1257 , 0.0384749...]) """ + cctf_decoding = handle_arguments_deprecation({ + 'ArgumentRenamed': [['decoding_cctf', 'cctf_decoding']], + }, **kwargs).get('cctf_decoding', cctf_decoding) + RGB = to_domain_1(RGB) - if decoding_cctf is not None: + if cctf_decoding is not None: with domain_range_scale('ignore'): - RGB = decoding_cctf(RGB) + RGB = cctf_decoding(RGB) XYZ = dot_vector(RGB_to_XYZ_matrix, RGB) @@ -1118,8 +1159,9 @@ def RGB_to_RGB(RGB, input_colourspace, output_colourspace, chromatic_adaptation_transform='CAT02', - apply_decoding_cctf=False, - apply_encoding_cctf=False): + apply_cctf_decoding=False, + apply_cctf_encoding=False, + **kwargs): """ Converts given *RGB* colourspace array from given input *RGB* colourspace to output *RGB* colourspace using given *chromatic adaptation* method. @@ -1138,13 +1180,18 @@ def RGB_to_RGB(RGB, 'Bianco PC', None}**, *Chromatic adaptation* transform, if *None* no chromatic adaptation is performed. - apply_decoding_cctf : bool, optional + apply_cctf_decoding : bool, optional Apply input colourspace decoding colour component transfer function / electro-optical transfer function. - apply_encoding_cctf : bool, optional + apply_cctf_encoding : bool, optional Apply output colourspace encoding colour component transfer function / opto-electronic transfer function. + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments for the colour component transfer functions. + Returns ------- ndarray @@ -1174,19 +1221,31 @@ def RGB_to_RGB(RGB, array([ 0.2568891..., 0.0721446..., 0.0465553...]) """ + apply_cctf_decoding = handle_arguments_deprecation({ + 'ArgumentRenamed': [['apply_decoding_cctf', 'apply_cctf_decoding']], + }, **kwargs).get('apply_cctf_decoding', apply_cctf_decoding) + + apply_cctf_encoding = handle_arguments_deprecation({ + 'ArgumentRenamed': [['apply_encoding_cctf', 'apply_cctf_encoding']], + }, **kwargs).get('apply_cctf_encoding', apply_cctf_encoding) + RGB = to_domain_1(RGB) - if apply_decoding_cctf: + if apply_cctf_decoding: with domain_range_scale('ignore'): - RGB = input_colourspace.decoding_cctf(RGB) + RGB = input_colourspace.cctf_decoding( + RGB, **filter_kwargs(input_colourspace.cctf_decoding, + **kwargs)) M = RGB_to_RGB_matrix(input_colourspace, output_colourspace, chromatic_adaptation_transform) RGB = dot_vector(M, RGB) - if apply_encoding_cctf: + if apply_cctf_encoding: with domain_range_scale('ignore'): - RGB = output_colourspace.encoding_cctf(RGB) + RGB = output_colourspace.cctf_encoding( + RGB, **filter_kwargs(output_colourspace.cctf_encoding, + **kwargs)) return from_range_1(RGB) diff --git a/colour/models/rgb/tests/test_common.py b/colour/models/rgb/tests/test_common.py index 6350b48c6d..6391d50516 100644 --- a/colour/models/rgb/tests/test_common.py +++ b/colour/models/rgb/tests/test_common.py @@ -65,7 +65,7 @@ def test_XYZ_to_sRGB(self): np.testing.assert_almost_equal( XYZ_to_sRGB( np.array([0.20654008, 0.12197225, 0.05136952]), - apply_encoding_cctf=False), + apply_cctf_encoding=False), np.array([0.45620520, 0.03081070, 0.04091953]), decimal=7) @@ -115,7 +115,7 @@ def test_sRGB_to_XYZ(self): np.testing.assert_almost_equal( sRGB_to_XYZ( np.array([0.45620520, 0.03081070, 0.04091953]), - apply_decoding_cctf=False), + apply_cctf_decoding=False), np.array([0.20654291, 0.12197943, 0.05137141]), decimal=7) diff --git a/colour/models/rgb/tests/test_derivation.py b/colour/models/rgb/tests/test_derivation.py index 266051add5..4a08e71fdd 100644 --- a/colour/models/rgb/tests/test_derivation.py +++ b/colour/models/rgb/tests/test_derivation.py @@ -297,7 +297,7 @@ class TestRGBLuminance(unittest.TestCase): def test_RGB_luminance(self): """ - Tests:func:`colour.models.rgb.derivation.RGB_luminance` + Tests :func:`colour.models.rgb.derivation.RGB_luminance` definition. """ @@ -329,7 +329,7 @@ def test_RGB_luminance(self): def test_n_dimensional_RGB_luminance(self): """ - Tests:func:`colour.models.rgb.derivation.RGB_luminance` definition + Tests :func:`colour.models.rgb.derivation.RGB_luminance` definition n_dimensional arrays support. """ diff --git a/colour/models/rgb/tests/test_rgb_colourspace.py b/colour/models/rgb/tests/test_rgb_colourspace.py index f509f3d8fd..2035655804 100644 --- a/colour/models/rgb/tests/test_rgb_colourspace.py +++ b/colour/models/rgb/tests/test_rgb_colourspace.py @@ -17,7 +17,7 @@ from colour.models import ( RGB_COLOURSPACES, RGB_Colourspace, XYZ_to_RGB, RGB_to_XYZ, RGB_to_RGB_matrix, RGB_to_RGB, chromatically_adapted_primaries, - normalised_primary_matrix, oetf_sRGB, oetf_reverse_sRGB) + normalised_primary_matrix, eotf_inverse_sRGB, eotf_sRGB) from colour.utilities import domain_range_scale, ignore_numpy_errors __author__ = 'Colour Developers' @@ -46,25 +46,24 @@ def test_transformation_matrices(self): colourspace models. """ + tolerances = { + 'Adobe RGB (1998)': 1e-5, + 'ALEXA Wide Gamut': 1e-6, + 'DJI D-Gamut': 1e-4, + 'ERIMM RGB': 1e-3, + 'ProPhoto RGB': 1e-3, + 'REDWideGamutRGB': 1e-6, + 'RIMM RGB': 1e-3, + 'ROMM RGB': 1e-3, + 'sRGB': 1e-4, + 'V-Gamut': 1e-6, + } XYZ_r = np.array([0.5, 0.5, 0.5]).reshape([3, 1]) for colourspace in RGB_COLOURSPACES.values(): - # Instantiation transformation matrices. - if colourspace.name in ('ProPhoto RGB', 'ERIMM RGB', 'RIMM RGB', - 'ROMM RGB'): - tolerance = 1e-3 - elif colourspace.name in ('sRGB', 'DJI D-Gamut'): - tolerance = 1e-4 - elif colourspace.name in ('Adobe RGB (1998)', ): - tolerance = 1e-5 - elif colourspace.name in ('ALEXA Wide Gamut', 'V-Gamut', - 'REDWideGamutRGB'): - tolerance = 1e-6 - else: - tolerance = 1e-7 - M = normalised_primary_matrix(colourspace.primaries, colourspace.whitepoint) + tolerance = tolerances.get(colourspace.name, 1e-7) np.testing.assert_allclose( colourspace.RGB_to_XYZ_matrix, M, @@ -91,7 +90,9 @@ def test_cctf(self): colourspace models. """ - ignored_colourspaces = ('ACESproxy', 'DJI D-Gamut') + ignored_colourspaces = ('ACESproxy', ) + + decimals = {'DJI D-Gamut': 1, 'F-Gamut': 4} samples = np.hstack( [np.linspace(0, 1, 1e5), @@ -101,10 +102,13 @@ def test_cctf(self): if colourspace.name in ignored_colourspaces: continue - encoding_cctf_s = colourspace.encoding_cctf(samples) - decoding_cctf_s = colourspace.decoding_cctf(encoding_cctf_s) + cctf_encoding_s = colourspace.cctf_encoding(samples) + cctf_decoding_s = colourspace.cctf_decoding(cctf_encoding_s) - np.testing.assert_almost_equal(samples, decoding_cctf_s, decimal=7) + np.testing.assert_almost_equal( + samples, + cctf_decoding_s, + decimal=decimals.get(colourspace.name, 7)) def test_n_dimensional_cctf(self): """ @@ -113,32 +117,37 @@ def test_n_dimensional_cctf(self): colourspace models n-dimensional arrays support. """ + decimals = {'DJI D-Gamut': 6, 'F-Gamut': 4} + for colourspace in RGB_COLOURSPACES.values(): - if colourspace.name in ('DJI D-Gamut', ): - decimal = 6 - else: - decimal = 7 - - value_encoding_cctf = 0.5 - value_decoding_cctf = colourspace.decoding_cctf( - colourspace.encoding_cctf(value_encoding_cctf)) + value_cctf_encoding = 0.5 + value_cctf_decoding = colourspace.cctf_decoding( + colourspace.cctf_encoding(value_cctf_encoding)) np.testing.assert_almost_equal( - value_encoding_cctf, value_decoding_cctf, decimal=decimal) + value_cctf_encoding, + value_cctf_decoding, + decimal=decimals.get(colourspace.name, 7)) - value_encoding_cctf = np.tile(value_encoding_cctf, 6) - value_decoding_cctf = np.tile(value_decoding_cctf, 6) + value_cctf_encoding = np.tile(value_cctf_encoding, 6) + value_cctf_decoding = np.tile(value_cctf_decoding, 6) np.testing.assert_almost_equal( - value_encoding_cctf, value_decoding_cctf, decimal=decimal) + value_cctf_encoding, + value_cctf_decoding, + decimal=decimals.get(colourspace.name, 7)) - value_encoding_cctf = np.reshape(value_encoding_cctf, (3, 2)) - value_decoding_cctf = np.reshape(value_decoding_cctf, (3, 2)) + value_cctf_encoding = np.reshape(value_cctf_encoding, (3, 2)) + value_cctf_decoding = np.reshape(value_cctf_decoding, (3, 2)) np.testing.assert_almost_equal( - value_encoding_cctf, value_decoding_cctf, decimal=decimal) + value_cctf_encoding, + value_cctf_decoding, + decimal=decimals.get(colourspace.name, 7)) - value_encoding_cctf = np.reshape(value_encoding_cctf, (3, 2, 1)) - value_decoding_cctf = np.reshape(value_decoding_cctf, (3, 2, 1)) + value_cctf_encoding = np.reshape(value_cctf_encoding, (3, 2, 1)) + value_cctf_decoding = np.reshape(value_cctf_decoding, (3, 2, 1)) np.testing.assert_almost_equal( - value_encoding_cctf, value_decoding_cctf, decimal=decimal) + value_cctf_encoding, + value_cctf_decoding, + decimal=decimals.get(colourspace.name, 7)) @ignore_numpy_errors def test_nan_cctf(self): @@ -151,8 +160,8 @@ def test_nan_cctf(self): cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] for colourspace in RGB_COLOURSPACES.values(): for case in cases: - colourspace.encoding_cctf(case) - colourspace.decoding_cctf(case) + colourspace.cctf_encoding(case) + colourspace.cctf_decoding(case) def test_pickle(self): """ @@ -189,8 +198,8 @@ def test_required_attributes(self): required_attributes = ('name', 'primaries', 'whitepoint', 'whitepoint_name', 'RGB_to_XYZ_matrix', - 'XYZ_to_RGB_matrix', 'encoding_cctf', - 'decoding_cctf', + 'XYZ_to_RGB_matrix', 'cctf_encoding', + 'cctf_decoding', 'use_derived_RGB_to_XYZ_matrix', 'use_derived_XYZ_to_RGB_matrix') @@ -216,7 +225,7 @@ def test__str__(self): """ # Skipping unit test on Python 2.7. - if six.PY2: + if six.PY2: # pragma: no cover return self.assertEqual( @@ -254,7 +263,7 @@ def test__repr__(self): """ # Skipping unit test on Python 2.7. - if six.PY2: + if six.PY2: # pragma: no cover return self.assertEqual( @@ -386,7 +395,7 @@ def test_XYZ_to_RGB(self): [3.24062548, -1.53720797, -0.49862860], [-0.96893071, 1.87575606, 0.04151752], [0.05571012, -0.20402105, 1.05699594], - ]), 'Bradford', oetf_sRGB), + ]), 'Bradford', eotf_inverse_sRGB), np.array([0.70556599, 0.19109268, 0.22340812]), decimal=7) @@ -398,7 +407,7 @@ def test_XYZ_to_RGB(self): [3.24062548, -1.53720797, -0.49862860], [-0.96893071, 1.87575606, 0.04151752], [0.05571012, -0.20402105, 1.05699594], - ]), None, oetf_sRGB), + ]), None, eotf_inverse_sRGB), np.array([0.72794579, 0.18180021, 0.17951580]), decimal=7) @@ -441,19 +450,19 @@ def test_n_dimensional_XYZ_to_RGB(self): [-0.96893071, 1.87575606, 0.04151752], [0.05571012, -0.20402105, 1.05699594], ]) - RGB = XYZ_to_RGB(XYZ, W_R, W_T, M, 'Bradford', oetf_sRGB) + RGB = XYZ_to_RGB(XYZ, W_R, W_T, M, 'Bradford', eotf_inverse_sRGB) XYZ = np.tile(XYZ, (6, 1)) RGB = np.tile(RGB, (6, 1)) np.testing.assert_almost_equal( - XYZ_to_RGB(XYZ, W_R, W_T, M, 'Bradford', oetf_sRGB), + XYZ_to_RGB(XYZ, W_R, W_T, M, 'Bradford', eotf_inverse_sRGB), RGB, decimal=7) W_R = np.tile(W_R, (6, 1)) W_T = np.tile(W_T, (6, 1)) np.testing.assert_almost_equal( - XYZ_to_RGB(XYZ, W_R, W_T, M, 'Bradford', oetf_sRGB), + XYZ_to_RGB(XYZ, W_R, W_T, M, 'Bradford', eotf_inverse_sRGB), RGB, decimal=7) @@ -462,7 +471,7 @@ def test_n_dimensional_XYZ_to_RGB(self): W_T = np.reshape(W_T, (2, 3, 2)) RGB = np.reshape(RGB, (2, 3, 3)) np.testing.assert_almost_equal( - XYZ_to_RGB(XYZ, W_R, W_T, M, 'Bradford', oetf_sRGB), + XYZ_to_RGB(XYZ, W_R, W_T, M, 'Bradford', eotf_inverse_sRGB), RGB, decimal=7) @@ -526,7 +535,7 @@ def test_RGB_to_XYZ(self): [0.41240000, 0.35760000, 0.18050000], [0.21260000, 0.71520000, 0.07220000], [0.01930000, 0.11920000, 0.95050000], - ]), 'Bradford', oetf_reverse_sRGB), + ]), 'Bradford', eotf_sRGB), np.array([0.21638819, 0.12570000, 0.03847493]), decimal=7) @@ -538,7 +547,7 @@ def test_RGB_to_XYZ(self): [0.41240000, 0.35760000, 0.18050000], [0.21260000, 0.71520000, 0.07220000], [0.01930000, 0.11920000, 0.95050000], - ]), None, oetf_reverse_sRGB), + ]), None, eotf_sRGB), np.array([0.21638819, 0.12570000, 0.03847493]), decimal=7) @@ -581,19 +590,19 @@ def test_n_dimensional_RGB_to_XYZ(self): [0.21260000, 0.71520000, 0.07220000], [0.01930000, 0.11920000, 0.95050000], ]) - XYZ = RGB_to_XYZ(RGB, W_R, W_T, M, 'Bradford', oetf_reverse_sRGB) + XYZ = RGB_to_XYZ(RGB, W_R, W_T, M, 'Bradford', eotf_sRGB) RGB = np.tile(RGB, (6, 1)) XYZ = np.tile(XYZ, (6, 1)) np.testing.assert_almost_equal( - RGB_to_XYZ(RGB, W_R, W_T, M, 'Bradford', oetf_reverse_sRGB), + RGB_to_XYZ(RGB, W_R, W_T, M, 'Bradford', eotf_sRGB), XYZ, decimal=7) W_R = np.tile(W_R, (6, 1)) W_T = np.tile(W_T, (6, 1)) np.testing.assert_almost_equal( - RGB_to_XYZ(RGB, W_R, W_T, M, 'Bradford', oetf_reverse_sRGB), + RGB_to_XYZ(RGB, W_R, W_T, M, 'Bradford', eotf_sRGB), XYZ, decimal=7) @@ -602,7 +611,7 @@ def test_n_dimensional_RGB_to_XYZ(self): W_T = np.reshape(W_T, (2, 3, 2)) XYZ = np.reshape(XYZ, (2, 3, 3)) np.testing.assert_almost_equal( - RGB_to_XYZ(RGB, W_R, W_T, M, 'Bradford', oetf_reverse_sRGB), + RGB_to_XYZ(RGB, W_R, W_T, M, 'Bradford', eotf_sRGB), XYZ, decimal=7) @@ -761,8 +770,8 @@ def test_RGB_to_RGB(self): np.array([0.21931722, 0.06950287, 0.04694832]), aces_cg_colourspace, aces_cc_colourspace, - apply_decoding_cctf=True, - apply_encoding_cctf=True), + apply_cctf_decoding=True, + apply_cctf_encoding=True), np.array([0.42985679, 0.33522924, 0.30292336]), decimal=7) @@ -771,11 +780,19 @@ def test_RGB_to_RGB(self): np.array([0.46956438, 0.48137533, 0.43788601]), aces_cc_colourspace, sRGB_colourspace, - apply_decoding_cctf=True, - apply_encoding_cctf=True), + apply_cctf_decoding=True, + apply_cctf_encoding=True), np.array([0.60983062, 0.67896356, 0.50435764]), decimal=7) + np.testing.assert_equal( + RGB_to_RGB( + np.array([0.21931722, 0.06950287, 0.04694832]), + aces_2065_1_colourspace, + RGB_COLOURSPACES['ProPhoto RGB'], + apply_cctf_encoding=True, + out_int=True), np.array([120, 59, 46])) + def test_n_dimensional_RGB_to_RGB(self): """ Tests :func:`colour.models.rgb.rgb_colourspace.RGB_to_RGB` definition diff --git a/colour/models/rgb/transfer_functions/__init__.py b/colour/models/rgb/transfer_functions/__init__.py index bf5b769a76..f18635a351 100644 --- a/colour/models/rgb/transfer_functions/__init__.py +++ b/colour/models/rgb/transfer_functions/__init__.py @@ -6,96 +6,107 @@ from colour.utilities import (CaseInsensitiveMapping, filter_kwargs, usage_warning) +from colour.utilities.deprecation import handle_arguments_deprecation from .common import CV_range, legal_to_full, full_to_legal +from .gamma import gamma_function from .aces import (log_encoding_ACESproxy, log_decoding_ACESproxy, log_encoding_ACEScc, log_decoding_ACEScc, log_encoding_ACEScct, log_decoding_ACEScct) -from .alexa_log_c import log_encoding_ALEXALogC, log_decoding_ALEXALogC -from .arib_std_b67 import oetf_ARIBSTDB67, oetf_reverse_ARIBSTDB67 +from .arib_std_b67 import oetf_ARIBSTDB67, oetf_inverse_ARIBSTDB67 +from .arri_alexa_log_c import log_encoding_ALEXALogC, log_decoding_ALEXALogC from .canon_log import (log_encoding_CanonLog, log_decoding_CanonLog, log_encoding_CanonLog2, log_decoding_CanonLog2, log_encoding_CanonLog3, log_decoding_CanonLog3) from .cineon import log_encoding_Cineon, log_decoding_Cineon -from .dcdm import eotf_reverse_DCDM, eotf_DCDM -from .dicom_gsdf import oetf_DICOMGSDF, eotf_DICOMGSDF +from .dcdm import eotf_inverse_DCDM, eotf_DCDM +from .dicom_gsdf import eotf_inverse_DICOMGSDF, eotf_DICOMGSDF from .dji_dlog import log_encoding_DJIDLog, log_decoding_DJIDLog from .filmic_pro import log_encoding_FilmicPro6, log_decoding_FilmicPro6 from .filmlight_tlog import (log_encoding_FilmLightTLog, log_decoding_FilmLightTLog) -from .gamma import gamma_function from .gopro import log_encoding_Protune, log_decoding_Protune -from .itur_bt_601 import oetf_BT601, oetf_reverse_BT601 -from .itur_bt_709 import oetf_BT709, oetf_reverse_BT709 -from .itur_bt_1886 import eotf_reverse_BT1886, eotf_BT1886 +from .itur_bt_601 import oetf_BT601, oetf_inverse_BT601 +from .itur_bt_709 import oetf_BT709, oetf_inverse_BT709 +from .itur_bt_1886 import eotf_inverse_BT1886, eotf_BT1886 from .itur_bt_2020 import oetf_BT2020, eotf_BT2020 -from .st_2084 import oetf_ST2084, eotf_ST2084 +from .st_2084 import eotf_inverse_ST2084, eotf_ST2084 from .itur_bt_2100 import ( - oetf_BT2100_PQ, oetf_reverse_BT2100_PQ, eotf_BT2100_PQ, - eotf_reverse_BT2100_PQ, ootf_BT2100_PQ, ootf_reverse_BT2100_PQ, - oetf_BT2100_HLG, oetf_reverse_BT2100_HLG, eotf_BT2100_HLG, - eotf_reverse_BT2100_HLG, ootf_BT2100_HLG, ootf_reverse_BT2100_HLG) + oetf_PQ_BT2100, oetf_inverse_PQ_BT2100, eotf_PQ_BT2100, + eotf_inverse_PQ_BT2100, ootf_PQ_BT2100, ootf_inverse_PQ_BT2100, + oetf_HLG_BT2100, oetf_inverse_HLG_BT2100, BT2100_HLG_EOTF_METHODS, + eotf_HLG_BT2100, BT2100_HLG_EOTF_INVERSE_METHODS, eotf_inverse_HLG_BT2100, + BT2100_HLG_OOTF_METHODS, ootf_HLG_BT2100, BT2100_HLG_OOTF_INVERSE_METHODS, + ootf_inverse_HLG_BT2100) from .linear import linear_function from .panalog import log_encoding_Panalog, log_decoding_Panalog from .panasonic_vlog import log_encoding_VLog, log_decoding_VLog +from .fujifilm_flog import log_encoding_FLog, log_decoding_FLog from .pivoted_log import log_encoding_PivotedLog, log_decoding_PivotedLog from .red_log import (log_encoding_REDLog, log_decoding_REDLog, log_encoding_REDLogFilm, log_decoding_REDLogFilm, + LOG3G10_ENCODING_METHODS, LOG3G10_DECODING_METHODS, log_encoding_Log3G10, log_decoding_Log3G10, log_encoding_Log3G12, log_decoding_Log3G12) -from .rimm_romm_rgb import (oetf_ROMMRGB, eotf_ROMMRGB, oetf_ProPhotoRGB, - eotf_ProPhotoRGB, oetf_RIMMRGB, eotf_RIMMRGB, - log_encoding_ERIMMRGB, log_decoding_ERIMMRGB) +from .rimm_romm_rgb import ( + cctf_encoding_ROMMRGB, cctf_decoding_ROMMRGB, cctf_encoding_ProPhotoRGB, + cctf_decoding_ProPhotoRGB, cctf_encoding_RIMMRGB, cctf_decoding_RIMMRGB, + log_encoding_ERIMMRGB, log_decoding_ERIMMRGB) from .smpte_240m import oetf_SMPTE240M, eotf_SMPTE240M from .sony_slog import (log_encoding_SLog, log_decoding_SLog, log_encoding_SLog2, log_decoding_SLog2, log_encoding_SLog3, log_decoding_SLog3) -from .srgb import oetf_sRGB, oetf_reverse_sRGB +from .srgb import eotf_inverse_sRGB, eotf_sRGB from .viper_log import log_encoding_ViperLog, log_decoding_ViperLog __all__ = ['CV_range', 'legal_to_full', 'full_to_legal'] +__all__ += ['gamma_function'] __all__ += [ 'log_encoding_ACESproxy', 'log_decoding_ACESproxy', 'log_encoding_ACEScc', 'log_decoding_ACEScc', 'log_encoding_ACEScct', 'log_decoding_ACEScct' ] +__all__ += ['oetf_ARIBSTDB67', 'oetf_inverse_ARIBSTDB67'] __all__ += ['log_encoding_ALEXALogC', 'log_decoding_ALEXALogC'] -__all__ += ['oetf_ARIBSTDB67', 'oetf_reverse_ARIBSTDB67'] __all__ += [ 'log_encoding_CanonLog', 'log_decoding_CanonLog', 'log_encoding_CanonLog2', 'log_decoding_CanonLog2', 'log_encoding_CanonLog3', 'log_decoding_CanonLog3' ] __all__ += ['log_encoding_Cineon', 'log_decoding_Cineon'] -__all__ += ['eotf_reverse_DCDM', 'eotf_DCDM'] -__all__ += ['oetf_DICOMGSDF', 'eotf_DICOMGSDF'] +__all__ += ['eotf_inverse_DCDM', 'eotf_DCDM'] +__all__ += ['eotf_inverse_DICOMGSDF', 'eotf_DICOMGSDF'] __all__ += ['log_encoding_DJIDLog', 'log_decoding_DJIDLog'] __all__ += ['log_encoding_FilmicPro6', 'log_decoding_FilmicPro6'] __all__ += ['log_encoding_FilmLightTLog', 'log_decoding_FilmLightTLog'] -__all__ += ['gamma_function'] __all__ += ['log_encoding_Protune', 'log_decoding_Protune'] -__all__ += ['oetf_BT601', 'oetf_reverse_BT601'] -__all__ += ['oetf_BT709', 'oetf_reverse_BT709'] -__all__ += ['eotf_reverse_BT1886', 'eotf_BT1886'] +__all__ += ['oetf_BT601', 'oetf_inverse_BT601'] +__all__ += ['oetf_BT709', 'oetf_inverse_BT709'] +__all__ += ['eotf_inverse_BT1886', 'eotf_BT1886'] __all__ += ['oetf_BT2020', 'eotf_BT2020'] -__all__ += ['oetf_ST2084', 'eotf_ST2084'] +__all__ += ['eotf_inverse_ST2084', 'eotf_ST2084'] __all__ += [ - 'oetf_BT2100_PQ', 'oetf_reverse_BT2100_PQ', 'eotf_BT2100_PQ', - 'eotf_reverse_BT2100_PQ', 'ootf_BT2100_PQ', 'ootf_reverse_BT2100_PQ', - 'oetf_BT2100_HLG', 'oetf_reverse_BT2100_HLG', 'eotf_BT2100_HLG', - 'eotf_reverse_BT2100_HLG', 'ootf_BT2100_HLG', 'ootf_reverse_BT2100_HLG' + 'oetf_PQ_BT2100', 'oetf_inverse_PQ_BT2100', 'eotf_PQ_BT2100', + 'eotf_inverse_PQ_BT2100', 'ootf_PQ_BT2100', 'ootf_inverse_PQ_BT2100', + 'oetf_HLG_BT2100', 'oetf_inverse_HLG_BT2100', 'BT2100_HLG_EOTF_METHODS', + 'eotf_HLG_BT2100', 'BT2100_HLG_EOTF_INVERSE_METHODS', + 'eotf_inverse_HLG_BT2100', 'BT2100_HLG_OOTF_METHODS', 'ootf_HLG_BT2100', + 'BT2100_HLG_OOTF_INVERSE_METHODS', 'ootf_inverse_HLG_BT2100' ] __all__ += ['linear_function'] __all__ += ['log_encoding_Panalog', 'log_decoding_Panalog'] __all__ += ['log_encoding_VLog', 'log_decoding_VLog'] +__all__ += ['log_encoding_FLog', 'log_decoding_FLog'] __all__ += ['log_encoding_PivotedLog', 'log_decoding_PivotedLog'] __all__ += [ 'log_encoding_REDLog', 'log_decoding_REDLog', 'log_encoding_REDLogFilm', - 'log_decoding_REDLogFilm', 'log_encoding_Log3G10', 'log_decoding_Log3G10', + 'log_decoding_REDLogFilm', 'LOG3G10_ENCODING_METHODS', + 'LOG3G10_DECODING_METHODS', 'log_encoding_Log3G10', 'log_decoding_Log3G10', 'log_encoding_Log3G12', 'log_decoding_Log3G12' ] __all__ += [ - 'oetf_ROMMRGB', 'eotf_ROMMRGB', 'oetf_ProPhotoRGB', 'eotf_ProPhotoRGB', - 'oetf_RIMMRGB', 'eotf_RIMMRGB', 'log_encoding_ERIMMRGB', + 'cctf_encoding_ROMMRGB', 'cctf_decoding_ROMMRGB', + 'cctf_encoding_ProPhotoRGB', 'cctf_decoding_ProPhotoRGB', + 'cctf_encoding_RIMMRGB', 'cctf_decoding_RIMMRGB', 'log_encoding_ERIMMRGB', 'log_decoding_ERIMMRGB' ] __all__ += ['oetf_SMPTE240M', 'eotf_SMPTE240M'] @@ -103,10 +114,10 @@ 'log_encoding_SLog', 'log_decoding_SLog', 'log_encoding_SLog2', 'log_decoding_SLog2', 'log_encoding_SLog3', 'log_decoding_SLog3' ] -__all__ += ['oetf_sRGB', 'oetf_reverse_sRGB'] +__all__ += ['eotf_inverse_sRGB', 'eotf_sRGB'] __all__ += ['log_encoding_ViperLog', 'log_decoding_ViperLog'] -LOG_ENCODING_CURVES = CaseInsensitiveMapping({ +LOG_ENCODINGS = CaseInsensitiveMapping({ 'ACEScc': log_encoding_ACEScc, 'ACEScct': log_encoding_ACEScct, 'ACESproxy': log_encoding_ACESproxy, @@ -117,6 +128,7 @@ 'Cineon': log_encoding_Cineon, 'D-Log': log_encoding_DJIDLog, 'ERIMM RGB': log_encoding_ERIMMRGB, + 'F-Log': log_encoding_FLog, 'Filmic Pro 6': log_encoding_FilmicPro6, 'Log3G10': log_encoding_Log3G10, 'Log3G12': log_encoding_Log3G12, @@ -132,33 +144,34 @@ 'V-Log': log_encoding_VLog, 'ViperLog': log_encoding_ViperLog }) -LOG_ENCODING_CURVES.__doc__ = """ -Supported *log* encoding curves. +LOG_ENCODINGS.__doc__ = """ +Supported *log* encoding functions. -LOG_ENCODING_CURVES : CaseInsensitiveMapping +LOG_ENCODINGS : CaseInsensitiveMapping **{'ACEScc', 'ACEScct', 'ACESproxy', 'ALEXA Log C', 'Canon Log 2', - 'Canon Log 3', 'Canon Log', 'Cineon', 'D-Log', 'ERIMM RGB', 'Filmic Pro 6', - 'Log3G10', 'Log3G12', 'Panalog', 'PLog', 'Protune', 'REDLog', 'REDLogFilm', - 'S-Log', 'S-Log2', 'S-Log3', 'T-Log', 'V-Log', 'ViperLog'}** + 'Canon Log 3', 'Canon Log', 'Cineon', 'D-Log', 'ERIMM RGB', 'F-Log', + 'Filmic Pro 6', 'Log3G10', 'Log3G12', 'Panalog', 'PLog', 'Protune', + 'REDLog', 'REDLogFilm', 'S-Log', 'S-Log2', 'S-Log3', 'T-Log', 'V-Log', + 'ViperLog'}** """ -def log_encoding_curve(value, curve='Cineon', **kwargs): +def log_encoding(value, function='Cineon', **kwargs): """ Encodes linear-light values to :math:`R'G'B'` video component signal - value using given *log* curve. + value using given *log* function. Parameters ---------- value : numeric or array_like Value. - curve : unicode, optional + function : unicode, optional **{'ACEScc', 'ACEScct', 'ACESproxy', 'ALEXA Log C', 'Canon Log 2', 'Canon Log 3', 'Canon Log', 'Cineon', 'D-Log', 'ERIMM RGB', 'Filmic Pro 6', 'Log3G10', 'Log3G12', 'Panalog', 'PLog', 'Protune', 'REDLog', 'REDLogFilm', 'S-Log', 'S-Log2', 'S-Log3', 'T-Log', 'V-Log', 'ViperLog'}**, - Computation curve. + Computation function. Other Parameters ---------------- @@ -204,12 +217,15 @@ def log_encoding_curve(value, curve='Cineon', **kwargs): log_reference : numeric or array_like {:func:`colour.models.log_encoding_PivotedLog`}, Log reference. - out_legal : bool, optional + method : unicode, optional + {:func:`colour.models.log_encoding_Log3G10`}, + Whether to use the *Log3G10* *v1* or *v2* log encoding curve. + out_normalised_code_value : bool, optional {:func:`colour.models.log_encoding_SLog`, :func:`colour.models.log_encoding_SLog2`, :func:`colour.models.log_encoding_SLog3`}, Whether the non-linear *Sony S-Log*, *Sony S-Log2* or *Sony S-Log3* - data :math:`y` is encoded in legal range. + data :math:`y` is encoded as normalised code values. negative_gamma : numeric or array_like {:func:`colour.models.log_encoding_PivotedLog`}, Negative gamma. @@ -225,23 +241,27 @@ def log_encoding_curve(value, curve='Cineon', **kwargs): Examples -------- - >>> log_encoding_curve(0.18) # doctest: +ELLIPSIS + >>> log_encoding(0.18) # doctest: +ELLIPSIS 0.4573196... - >>> log_encoding_curve(0.18, curve='ACEScc') # doctest: +ELLIPSIS + >>> log_encoding(0.18, function='ACEScc') # doctest: +ELLIPSIS 0.4135884... - >>> log_encoding_curve(0.18, curve='PLog', log_reference=400) + >>> log_encoding(0.18, function='PLog', log_reference=400) ... # doctest: +ELLIPSIS 0.3910068... - >>> log_encoding_curve(0.18, curve='S-Log') # doctest: +ELLIPSIS + >>> log_encoding(0.18, function='S-Log') # doctest: +ELLIPSIS 0.3849708... """ - function = LOG_ENCODING_CURVES[curve] + function = handle_arguments_deprecation({ + 'ArgumentRenamed': [['curve', 'function']], + }, **kwargs).get('function', function) + + function = LOG_ENCODINGS[function] return function(value, **filter_kwargs(function, **kwargs)) -LOG_DECODING_CURVES = CaseInsensitiveMapping({ +LOG_DECODINGS = CaseInsensitiveMapping({ 'ACEScc': log_decoding_ACEScc, 'ACEScct': log_decoding_ACEScct, 'ACESproxy': log_decoding_ACESproxy, @@ -252,6 +272,7 @@ def log_encoding_curve(value, curve='Cineon', **kwargs): 'Cineon': log_decoding_Cineon, 'D-Log': log_decoding_DJIDLog, 'ERIMM RGB': log_decoding_ERIMMRGB, + 'F-Log': log_decoding_FLog, 'Filmic Pro 6': log_decoding_FilmicPro6, 'Log3G10': log_decoding_Log3G10, 'Log3G12': log_decoding_Log3G12, @@ -267,33 +288,34 @@ def log_encoding_curve(value, curve='Cineon', **kwargs): 'V-Log': log_decoding_VLog, 'ViperLog': log_decoding_ViperLog }) -LOG_DECODING_CURVES.__doc__ = """ -Supported *log* decoding curves. +LOG_DECODINGS.__doc__ = """ +Supported *log* decoding functions. -LOG_DECODING_CURVES : CaseInsensitiveMapping +LOG_DECODINGS : CaseInsensitiveMapping **{'ACEScc', 'ACEScct', 'ACESproxy', 'ALEXA Log C', 'Canon Log 2', - 'Canon Log 3', 'Canon Log', 'Cineon', 'D-Log', 'ERIMM RGB', 'Filmic Pro 6', - 'Log3G10', 'Log3G12', 'Panalog', 'PLog', 'Protune', 'REDLog', 'REDLogFilm', - 'S-Log', 'S-Log2', 'S-Log3', 'T-Log', 'V-Log', 'ViperLog'}** + 'Canon Log 3', 'Canon Log', 'Cineon', 'D-Log', 'ERIMM RGB', 'F-Log', + 'Filmic Pro 6', 'Log3G10', 'Log3G12', 'Panalog', 'PLog', 'Protune', + 'REDLog', 'REDLogFilm', 'S-Log', 'S-Log2', 'S-Log3', 'T-Log', 'V-Log', + 'ViperLog'}** """ -def log_decoding_curve(value, curve='Cineon', **kwargs): +def log_decoding(value, function='Cineon', **kwargs): """ Decodes :math:`R'G'B'` video component signal value to linear-light values - using given *log* curve. + using given *log* function. Parameters ---------- value : numeric or array_like Value. - curve : unicode, optional + function : unicode, optional **{'ACEScc', 'ACEScct', 'ACESproxy', 'ALEXA Log C', 'Canon Log 2', 'Canon Log 3', 'Canon Log', 'Cineon', 'D-Log', 'ERIMM RGB', 'Filmic Pro 6', 'Log3G10', 'Log3G12', 'Panalog', 'PLog', 'Protune', 'REDLog', 'REDLogFilm', 'S-Log', 'S-Log2', 'S-Log3', 'T-Log', 'V-Log', 'ViperLog'}**, - Computation curve. + Computation function. Other Parameters ---------------- @@ -329,18 +351,21 @@ def log_decoding_curve(value, curve='Cineon', **kwargs): {:func:`colour.models.log_decoding_ALEXALogC`}, **{'SUP 3.x', 'SUP 2.x'}**, Alexa firmware version. - in_legal : bool, optional + in_normalised_code_value : bool, optional {:func:`colour.models.log_decoding_SLog`, :func:`colour.models.log_decoding_SLog2`, :func:`colour.models.log_decoding_SLog3`}, Whether the non-linear *Sony S-Log*, *Sony S-Log2* or *Sony S-Log3* - data :math:`y` is encoded in legal range. + data :math:`y` is encoded as normalised code values. linear_reference : numeric or array_like {:func:`colour.models.log_decoding_PivotedLog`}, Linear reference. log_reference : numeric or array_like {:func:`colour.models.log_decoding_PivotedLog`}, Log reference. + method : unicode, optional + {:func:`colour.models.log_decoding_Log3G10`}, + Whether to use the *Log3G10* *v1* or *v2* log encoding curve. negative_gamma : numeric or array_like {:func:`colour.models.log_decoding_PivotedLog`}, Negative gamma. @@ -360,53 +385,51 @@ def log_decoding_curve(value, curve='Cineon', **kwargs): Examples -------- - >>> log_decoding_curve(0.457319613085418) # doctest: +ELLIPSIS + >>> log_decoding(0.457319613085418) # doctest: +ELLIPSIS 0.1... - >>> log_decoding_curve(0.413588402492442, curve='ACEScc') + >>> log_decoding(0.413588402492442, function='ACEScc') ... # doctest: +ELLIPSIS 0.1... - >>> log_decoding_curve(0.391006842619746, curve='PLog', log_reference=400) + >>> log_decoding(0.391006842619746, function='PLog', log_reference=400) ... # doctest: +ELLIPSIS 0.1... - >>> log_decoding_curve(0.376512722254600, curve='S-Log') + >>> log_decoding(0.376512722254600, function='S-Log') ... # doctest: +ELLIPSIS 0.1... """ - function = LOG_DECODING_CURVES[curve] + function = handle_arguments_deprecation({ + 'ArgumentRenamed': [['curve', 'function']], + }, **kwargs).get('function', function) + + function = LOG_DECODINGS[function] return function(value, **filter_kwargs(function, **kwargs)) -__all__ += ['LOG_ENCODING_CURVES', 'LOG_DECODING_CURVES'] -__all__ += ['log_encoding_curve', 'log_decoding_curve'] +__all__ += ['LOG_ENCODINGS', 'LOG_DECODINGS'] +__all__ += ['log_encoding', 'log_decoding'] OETFS = CaseInsensitiveMapping({ 'ARIB STD-B67': oetf_ARIBSTDB67, - 'DICOM GSDF': oetf_DICOMGSDF, 'ITU-R BT.2020': oetf_BT2020, - 'ITU-R BT.2100 HLG': oetf_BT2100_HLG, - 'ITU-R BT.2100 PQ': oetf_BT2100_PQ, + 'ITU-R BT.2100 HLG': oetf_HLG_BT2100, + 'ITU-R BT.2100 PQ': oetf_PQ_BT2100, 'ITU-R BT.601': oetf_BT601, 'ITU-R BT.709': oetf_BT709, - 'ProPhoto RGB': oetf_ProPhotoRGB, - 'RIMM RGB': oetf_RIMMRGB, - 'ROMM RGB': oetf_ROMMRGB, 'SMPTE 240M': oetf_SMPTE240M, - 'ST 2084': oetf_ST2084, - 'sRGB': oetf_sRGB }) OETFS.__doc__ = """ Supported opto-electrical transfer functions (OETFs / OECFs). OETFS : CaseInsensitiveMapping - **{'sRGB', 'ARIB STD-B67', 'DICOM GSDF', 'ITU-R BT.2020', - 'ITU-R BT.2100 HLG', 'ITU-R BT.2100 PQ', 'ITU-R BT.601', 'ITU-R BT.709', - 'ProPhoto RGB', 'RIMM RGB', 'ROMM RGB', 'SMPTE 240M', 'ST 2084'}** + **{'sRGB', 'ARIB STD-B67', 'ITU-R BT.2020', 'ITU-R BT.2100 HLG', + 'ITU-R BT.2100 PQ', 'ITU-R BT.601', 'ITU-R BT.709', 'SMPTE 240M', + 'ST 2084'}** """ -def oetf(value, function='sRGB', **kwargs): +def oetf(value, function='ITU-R BT.709', **kwargs): """ Encodes estimated tristimulus values in a scene to :math:`R'G'B'` video component signal value using given opto-electronic transfer function @@ -417,26 +440,22 @@ def oetf(value, function='sRGB', **kwargs): value : numeric or array_like Value. function : unicode, optional - **{'sRGB', 'ARIB STD-B67', 'DICOM GSDF', 'ITU-R BT.2020', - 'ITU-R BT.2100 HLG', 'ITU-R BT.2100 PQ', 'ITU-R BT.601', - 'ITU-R BT.709', 'ProPhoto RGB', 'RIMM RGB', 'ROMM RGB', 'SMPTE 240M', + **{'ITU-R BT.709', 'ARIB STD-B67', 'ITU-R BT.2020', + 'ITU-R BT.2100 HLG', 'ITU-R BT.2100 PQ', 'ITU-R BT.601', 'SMPTE 240M', 'ST 2084'}**, Opto-electronic transfer function (OETF / OECF). Other Parameters ---------------- E_clip : numeric, optional - {:func:`colour.models.oetf_RIMMRGB`}, + {:func:`colour.models.cctf_encoding_RIMMRGB`}, Maximum exposure level. I_max : numeric, optional - {:func:`colour.models.oetf_ROMMRGB`, - :func:`colour.models.oetf_RIMMRGB`}, + {:func:`colour.models.cctf_encoding_ROMMRGB`, + :func:`colour.models.cctf_encoding_RIMMRGB`}, Maximum code value: 255, 4095 and 650535 for respectively 8-bit, 12-bit and 16-bit per channel. - L_p : numeric, optional - {:func:`colour.models.oetf_ST2084`}, - Display peak luminance :math:`cd/m^2`. - is_12_bits_system : bool + is_12_bits_system : bool, optional {:func:`colour.models.oetf_BT2020`}, *ITU-R BT.2020* *alpha* and *beta* constants are used if system is not @@ -453,12 +472,9 @@ def oetf(value, function='sRGB', **kwargs): Examples -------- >>> oetf(0.18) # doctest: +ELLIPSIS - 0.4613561... - >>> oetf(0.18, function='ITU-R BT.2020') # doctest: +ELLIPSIS 0.4090077... - >>> oetf(0.18, function='ST 2084', L_p=1000) - ... # doctest: +ELLIPSIS - 0.1820115... + >>> oetf(0.18, function='ITU-R BT.601') # doctest: +ELLIPSIS + 0.4090077... """ function = OETFS[function] @@ -466,27 +482,26 @@ def oetf(value, function='sRGB', **kwargs): return function(value, **filter_kwargs(function, **kwargs)) -OETFS_REVERSE = CaseInsensitiveMapping({ - 'ARIB STD-B67': oetf_reverse_ARIBSTDB67, - 'ITU-R BT.2100 HLD': oetf_reverse_BT2100_HLG, - 'ITU-R BT.2100 PQ': oetf_reverse_BT2100_PQ, - 'ITU-R BT.601': oetf_reverse_BT601, - 'ITU-R BT.709': oetf_reverse_BT709, - 'sRGB': oetf_reverse_sRGB +OETF_INVERSES = CaseInsensitiveMapping({ + 'ARIB STD-B67': oetf_inverse_ARIBSTDB67, + 'ITU-R BT.2100 HLD': oetf_inverse_HLG_BT2100, + 'ITU-R BT.2100 PQ': oetf_inverse_PQ_BT2100, + 'ITU-R BT.601': oetf_inverse_BT601, + 'ITU-R BT.709': oetf_inverse_BT709, }) -OETFS_REVERSE.__doc__ = """ -Supported reverse opto-electrical transfer functions (OETFs / OECFs). +OETF_INVERSES.__doc__ = """ +Supported inverse opto-electrical transfer functions (OETFs / OECFs). -OETFS_REVERSE : CaseInsensitiveMapping - **{'sRGB', 'ARIB STD-B67', 'ITU-R BT.2100 HLD', 'ITU-R BT.2100 PQ', +OETF_INVERSES : CaseInsensitiveMapping + **{'ARIB STD-B67', 'ITU-R BT.2100 HLD', 'ITU-R BT.2100 PQ', 'ITU-R BT.601', 'ITU-R BT.709'}** """ -def oetf_reverse(value, function='sRGB', **kwargs): +def oetf_inverse(value, function='ITU-R BT.709', **kwargs): """ Decodes :math:`R'G'B'` video component signal value to tristimulus values - at the display using given reverse opto-electronic transfer function + at the display using given inverse opto-electronic transfer function (OETF / OECF). Parameters @@ -494,9 +509,9 @@ def oetf_reverse(value, function='sRGB', **kwargs): value : numeric or array_like Value. function : unicode, optional - **{'sRGB', 'ARIB STD-B67', 'ITU-R BT.2100 HLD', 'ITU-R BT.2100 PQ', - 'ITU-R BT.601', 'ITU-R BT.709'}**, - Reverse opto-electronic transfer function (OETF / OECF). + **{'ITU-R BT.709', 'ARIB STD-B67', 'ITU-R BT.2100 HLD', + 'ITU-R BT.2100 PQ', 'ITU-R BT.601', }**, + Inverse opto-electronic transfer function (OETF / OECF). Other Parameters ---------------- @@ -511,14 +526,14 @@ def oetf_reverse(value, function='sRGB', **kwargs): Examples -------- - >>> oetf_reverse(0.461356129500442) # doctest: +ELLIPSIS + >>> oetf_inverse(0.409007728864150) # doctest: +ELLIPSIS 0.1... - >>> oetf_reverse( # doctest: +ELLIPSIS + >>> oetf_inverse( # doctest: +ELLIPSIS ... 0.409007728864150, function='ITU-R BT.601') 0.1... """ - function = OETFS_REVERSE[function] + function = OETF_INVERSES[function] return function(value, **filter_kwargs(function, **kwargs)) @@ -528,21 +543,18 @@ def oetf_reverse(value, function='sRGB', **kwargs): 'DICOM GSDF': eotf_DICOMGSDF, 'ITU-R BT.1886': eotf_BT1886, 'ITU-R BT.2020': eotf_BT2020, - 'ITU-R BT.2100 HLG': eotf_BT2100_HLG, - 'ITU-R BT.2100 PQ': eotf_BT2100_PQ, - 'ProPhoto RGB': eotf_ProPhotoRGB, - 'RIMM RGB': eotf_RIMMRGB, - 'ROMM RGB': eotf_ROMMRGB, + 'ITU-R BT.2100 HLG': eotf_HLG_BT2100, + 'ITU-R BT.2100 PQ': eotf_PQ_BT2100, 'SMPTE 240M': eotf_SMPTE240M, 'ST 2084': eotf_ST2084, + 'sRGB': eotf_sRGB, }) EOTFS.__doc__ = """ Supported electro-optical transfer functions (EOTFs / EOCFs). EOTFS : CaseInsensitiveMapping **{'DCDM', 'DICOM GSDF', 'ITU-R BT.1886', 'ITU-R BT.2020', - 'ITU-R BT.2100 HLG', 'ITU-R BT.2100 PQ', 'ProPhoto RGB', 'RIMM RGB', - 'ROMM RGB', 'SMPTE 240M', 'ST 2084'}** + 'ITU-R BT.2100 HLG', 'ITU-R BT.2100 PQ', 'SMPTE 240M', 'ST 2084', 'sRGB'}** """ @@ -557,39 +569,47 @@ def eotf(value, function='ITU-R BT.1886', **kwargs): Value. function : unicode, optional **{'ITU-R BT.1886', 'DCDM', 'DICOM GSDF', 'ITU-R BT.2020', - 'ITU-R BT.2100 HLG', 'ITU-R BT.2100 PQ', 'ProPhoto RGB', 'RIMM RGB', - 'ROMM RGB', 'SMPTE 240M', 'ST 2084'}**, + 'ITU-R BT.2100 HLG', 'ITU-R BT.2100 PQ', 'SMPTE 240M', 'ST 2084', + 'sRGB'}**, Electro-optical transfer function (EOTF / EOCF). Other Parameters ---------------- E_clip : numeric, optional - {:func:`colour.models.eotf_RIMMRGB`}, + {:func:`colour.models.cctf_decoding_RIMMRGB`}, Maximum exposure level. I_max : numeric, optional - {:func:`colour.models.eotf_ROMMRGB`, - :func:`colour.models.eotf_RIMMRGB`}, + {:func:`colour.models.cctf_decoding_ROMMRGB`, + :func:`colour.models.cctf_decoding_RIMMRGB`}, Maximum code value: 255, 4095 and 650535 for respectively 8-bit, 12-bit and 16-bit per channel. L_B : numeric, optional {:func:`colour.models.eotf_BT1886`, - :func:`colour.models.eotf_BT2100_HLG`}, + :func:`colour.models.eotf_HLG_BT2100`}, Screen luminance for black. L_W : numeric, optional {:func:`colour.models.eotf_BT1886`, - :func:`colour.models.eotf_BT2100_HLG`}, + :func:`colour.models.eotf_HLG_BT2100`}, Screen luminance for white. L_p : numeric, optional {:func:`colour.models.eotf_ST2084`}, Display peak luminance :math:`cd/m^2`. gamma : numeric, optional - {:func:`colour.models.eotf_BT2100_HLG`}, + {:func:`colour.models.eotf_HLG_BT2100`}, System gamma value, 1.2 at the nominal display peak luminance of :math:`1000 cd/m^2`. - is_12_bits_system : bool + is_12_bits_system : bool, optional {:func:`colour.models.eotf_BT2020`}, *ITU-R BT.2020* *alpha* and *beta* constants are used if system is not 12-bit. + method : unicode, optional + {:func:`colour.models.eotf_HLG_BT2100`}, + **{'ITU-R BT.2100-1', 'ITU-R BT.2100-2'}** + out_int : bool, optional + {:func:`colour.models.eotf_DCDM`, + :func:`colour.models.eotf_DICOMGSDF`}, + Whether to return value as integer code value or float equivalent of a + code value at a given bit depth. Returns ------- @@ -613,24 +633,28 @@ def eotf(value, function='ITU-R BT.1886', **kwargs): return function(value, **filter_kwargs(function, **kwargs)) -EOTFS_REVERSE = CaseInsensitiveMapping({ - 'DCDM': eotf_reverse_DCDM, - 'ITU-R BT.1886': eotf_reverse_BT1886, - 'ITU-R BT.2100 HLG': eotf_reverse_BT2100_HLG, - 'ITU-R BT.2100 PQ': eotf_reverse_BT2100_PQ, +EOTF_INVERSES = CaseInsensitiveMapping({ + 'DCDM': eotf_inverse_DCDM, + 'DICOM GSDF': eotf_inverse_DICOMGSDF, + 'ITU-R BT.1886': eotf_inverse_BT1886, + 'ITU-R BT.2100 HLG': eotf_inverse_HLG_BT2100, + 'ITU-R BT.2100 PQ': eotf_inverse_PQ_BT2100, + 'ST 2084': eotf_inverse_ST2084, + 'sRGB': eotf_inverse_sRGB, }) -EOTFS_REVERSE.__doc__ = """ -Supported reverse electro-optical transfer functions (EOTFs / EOCFs). +EOTF_INVERSES.__doc__ = """ +Supported inverse electro-optical transfer functions (EOTFs / EOCFs). -EOTFS_REVERSE : CaseInsensitiveMapping - **{'DCDM', 'ITU-R BT.1886', 'ITU-R BT.2100 HLG', 'ITU-R BT.2100 PQ'}** +EOTF_INVERSES : CaseInsensitiveMapping + **{'DCDM', 'DICOM GSDF', 'ITU-R BT.1886', 'ITU-R BT.2100 HLG', + 'ITU-R BT.2100 PQ', 'ST 2084', 'sRGB'}** """ -def eotf_reverse(value, function='ITU-R BT.1886', **kwargs): +def eotf_inverse(value, function='ITU-R BT.1886', **kwargs): """ Encodes estimated tristimulus values in a scene to :math:`R'G'B'` video - component signal value using given reverse electro-optical transfer + component signal value using given inverse electro-optical transfer function (EOTF / EOCF). Parameters @@ -638,25 +662,33 @@ def eotf_reverse(value, function='ITU-R BT.1886', **kwargs): value : numeric or array_like Value. function : unicode, optional - **{'ITU-R BT.1886', 'DCDM', 'ITU-R BT.2100 HLG', 'ITU-R BT.2100 PQ'}**, - Reverse electro-optical transfer function (EOTF / EOCF). + **{'ITU-R BT.1886', 'DCDM', 'DICOM GSDF', 'ITU-R BT.2100 HLG', + 'ITU-R BT.2100 PQ', 'ST 2084', 'sRGB'}**, + Inverse electro-optical transfer function (EOTF / EOCF). Other Parameters ---------------- L_B : numeric, optional - {:func:`colour.models.eotf_reverse_BT1886`, - :func:`colour.models.eotf_reverse_BT2100_HLG`}, + {:func:`colour.models.eotf_inverse_BT1886`, + :func:`colour.models.eotf_inverse_HLG_BT2100`}, Screen luminance for black. L_W : numeric, optional - {:func:`colour.models.eotf_reverse_BT1886`, - :func:`colour.models.eotf_reverse_BT2100_HLG`}, + {:func:`colour.models.eotf_inverse_BT1886`, + :func:`colour.models.eotf_inverse_HLG_BT2100`}, Screen luminance for white. gamma : numeric, optional - {:func:`colour.models.eotf_BT2100_HLG`}, + {:func:`colour.models.eotf_HLG_BT2100`}, System gamma value, 1.2 at the nominal display peak luminance of :math:`1000 cd/m^2`. + L_p : numeric, optional + {:func:`colour.models.eotf_inverse_ST2084`}, + Display peak luminance :math:`cd/m^2`. + method : unicode, optional + {:func:`colour.models.eotf_inverse_HLG_BT2100`}, + **{'ITU-R BT.2100-1', 'ITU-R BT.2100-2'}** out_int : bool, optional - {:func:`colour.models.eotf_reverse_DCDM`}, + {:func:`colour.models.eotf_inverse_DCDM`, + :func:`colour.models.eotf_inverse_DICOMGSDF`}, Whether to return value as integer code value or float equivalent of a code value at a given bit depth. @@ -667,49 +699,55 @@ def eotf_reverse(value, function='ITU-R BT.1886', **kwargs): Examples -------- - >>> eotf_reverse(0.11699185725296059) # doctest: +ELLIPSIS + >>> eotf_inverse(0.11699185725296059) # doctest: +ELLIPSIS 0.4090077... - >>> eotf_reverse( # doctest: +ELLIPSIS + >>> eotf_inverse( # doctest: +ELLIPSIS ... 0.11699185725296059, function='ITU-R BT.1886') 0.4090077... """ - function = EOTFS_REVERSE[function] + function = EOTF_INVERSES[function] return function(value, **filter_kwargs(function, **kwargs)) -__all__ += ['OETFS', 'OETFS_REVERSE', 'EOTFS', 'EOTFS_REVERSE'] -__all__ += ['oetf', 'oetf_reverse', 'eotf', 'eotf_reverse'] +__all__ += ['OETFS', 'OETF_INVERSES', 'EOTFS', 'EOTF_INVERSES'] +__all__ += ['oetf', 'oetf_inverse', 'eotf', 'eotf_inverse'] -ENCODING_CCTFS = CaseInsensitiveMapping(LOG_ENCODING_CURVES) -ENCODING_CCTFS.update(OETFS) -ENCODING_CCTFS.update(EOTFS_REVERSE) -ENCODING_CCTFS.update({ +CCTF_ENCODINGS = CaseInsensitiveMapping({ 'Gamma 2.2': partial(gamma_function, exponent=1 / 2.2), 'Gamma 2.4': partial(gamma_function, exponent=1 / 2.4), 'Gamma 2.6': partial(gamma_function, exponent=1 / 2.6), + 'ProPhoto RGB': cctf_encoding_ProPhotoRGB, + 'RIMM RGB': cctf_encoding_RIMMRGB, + 'ROMM RGB': cctf_encoding_ROMMRGB, }) -ENCODING_CCTFS.__doc__ = """ +CCTF_ENCODINGS.update(LOG_ENCODINGS) +CCTF_ENCODINGS.update(OETFS) +CCTF_ENCODINGS.update(EOTF_INVERSES) +CCTF_ENCODINGS.__doc__ = """ Supported encoding colour component transfer functions (Encoding CCTFs), a -collection of the functions defined by :attr:`colour.LOG_ENCODING_CURVES`, -:attr:`colour.OETFS`, :attr:`colour.EOTFS_REVERSE` attributes and 3 gamma -encoding functions (1 / 2.2, 1 / 2.4, 1 / 2.6). +collection of the functions defined by :attr:`colour.LOG_ENCODINGS`, +:attr:`colour.OETFS`, :attr:`colour.EOTF_INVERSES` attributes, the +:func:`colour.models.cctf_encoding_ProPhotoRGB`, +:func:`colour.models.cctf_encoding_RIMMRGB`, +:func:`colour.models.cctf_encoding_ROMMRGB` definitions and 3 gamma encoding +functions (1 / 2.2, 1 / 2.4, 1 / 2.6). Warning ------- -For *ITU-R BT.2100*, only the reverse electro-optical transfer functions +For *ITU-R BT.2100*, only the inverse electro-optical transfer functions (EOTFs / EOCFs) are exposed by this attribute, please refer to the :attr:`colour.OETFS` attribute for the opto-electronic transfer functions (OETF / OECF). -ENCODING_CCTFS : CaseInsensitiveMapping - {:attr:`colour.LOG_ENCODING_CURVES`, :attr:`colour.OETFS`, - :attr:`colour.EOTFS_REVERSE`} +CCTF_ENCODINGS : CaseInsensitiveMapping + {:attr:`colour.LOG_ENCODINGS`, :attr:`colour.OETFS`, + :attr:`colour.EOTF_INVERSES`} """ -def encoding_cctf(value, function='sRGB', **kwargs): +def cctf_encoding(value, function='sRGB', **kwargs): """ Encodes linear :math:`RGB` values to non linear :math:`R'G'B'` values using given encoding colour component transfer function (Encoding CCTF). @@ -719,18 +757,18 @@ def encoding_cctf(value, function='sRGB', **kwargs): value : numeric or array_like Linear :math:`RGB` values. function : unicode, optional - {:attr:`colour.ENCODING_CCTFS`}, + {:attr:`colour.CCTF_ENCODINGS`}, Computation function. Other Parameters ---------------- \\**kwargs : dict, optional Keywords arguments for the relevant encoding CCTF of the - :attr:`colour.ENCODING_CCTFS` attribute collection. + :attr:`colour.CCTF_ENCODINGS` attribute collection. Warning ------- - For *ITU-R BT.2100*, only the reverse electro-optical transfer functions + For *ITU-R BT.2100*, only the inverse electro-optical transfer functions (EOTFs / EOCFs) are exposed by this definition, please refer to the :func:`colour.oetf` definition for the opto-electronic transfer functions (OETF / OECF). @@ -742,48 +780,54 @@ def encoding_cctf(value, function='sRGB', **kwargs): Examples -------- - >>> encoding_cctf(0.18, function='PLog', log_reference=400) + >>> cctf_encoding(0.18, function='PLog', log_reference=400) ... # doctest: +ELLIPSIS 0.3910068... - >>> encoding_cctf(0.18, function='ST 2084', L_p=1000) + >>> cctf_encoding(0.18, function='ST 2084', L_p=1000) ... # doctest: +ELLIPSIS 0.1820115... - >>> encoding_cctf( # doctest: +ELLIPSIS + >>> cctf_encoding( # doctest: +ELLIPSIS ... 0.11699185725296059, function='ITU-R BT.1886') 0.4090077... """ if 'itu-r bt.2100' in function.lower(): usage_warning( - 'For "ITU-R BT.2100", only the reverse electro-optical transfer ' - 'functions (EOTFs / EOCFs) are exposed by this definition, please ' - 'refer to the "colour.oetf" definition for the opto-electronic ' - 'transfer functions (OETF / OECF).') + 'With the "ITU-R BT.2100" method, only the inverse ' + 'electro-optical transfer functions (EOTFs / EOCFs) are exposed ' + 'by this definition, please refer to the "colour.oetf" definition ' + 'for the opto-electronic transfer functions (OETF / OECF).') - function = ENCODING_CCTFS[function] + function = CCTF_ENCODINGS[function] return function(value, **filter_kwargs(function, **kwargs)) -DECODING_CCTFS = CaseInsensitiveMapping(LOG_DECODING_CURVES) -DECODING_CCTFS.update(OETFS_REVERSE) -DECODING_CCTFS.update(EOTFS) -DECODING_CCTFS.update({ +CCTF_DECODINGS = CaseInsensitiveMapping({ 'Gamma 2.2': partial(gamma_function, exponent=2.2), 'Gamma 2.4': partial(gamma_function, exponent=2.4), 'Gamma 2.6': partial(gamma_function, exponent=2.6), + 'ProPhoto RGB': cctf_decoding_ProPhotoRGB, + 'RIMM RGB': cctf_decoding_RIMMRGB, + 'ROMM RGB': cctf_decoding_ROMMRGB, }) -DECODING_CCTFS.__doc__ = """ +CCTF_DECODINGS.update(LOG_DECODINGS) +CCTF_DECODINGS.update(OETF_INVERSES) +CCTF_DECODINGS.update(EOTFS) +CCTF_DECODINGS.__doc__ = """ Supported decoding colour component transfer functions (Decoding CCTFs), a -collection of the functions defined by :attr:`colour.LOG_DECODING_CURVES`, -:attr:`colour.EOTFS`, :attr:`colour.OETFS_REVERSE` attributes and 3 gamma -decoding functions (2.2, 2.4, 2.6). +collection of the functions defined by :attr:`colour.LOG_DECODINGS`, +:attr:`colour.EOTFS`, :attr:`colour.OETF_INVERSES` attributes, the +:func:`colour.models.cctf_decoding_ProPhotoRGB`, +:func:`colour.models.cctf_decoding_RIMMRGB`, +:func:`colour.models.cctf_decoding_ROMMRGB` definitions and 3 gamma decoding +functions (2.2, 2.4, 2.6). Warning ------- For *ITU-R BT.2100*, only the electro-optical transfer functions (EOTFs / EOCFs) are exposed by this attribute, please refer to the -:attr:`colour.OETFS_REVERSE` attribute for the reverse opto-electronic +:attr:`colour.OETF_INVERSES` attribute for the inverse opto-electronic transfer functions (OETF / OECF). Notes @@ -791,13 +835,13 @@ def encoding_cctf(value, function='sRGB', **kwargs): - The order by which this attribute is defined and updated is critically important to ensure that *ITU-R BT.2100* definitions are reciprocal. -DECODING_CCTFS : CaseInsensitiveMapping - {:attr:`colour.LOG_DECODING_CURVES`, :attr:`colour.EOTFS`, - :attr:`colour.OETFS_REVERSE`} +CCTF_DECODINGS : CaseInsensitiveMapping + {:attr:`colour.LOG_DECODINGS`, :attr:`colour.EOTFS`, + :attr:`colour.OETF_INVERSES`} """ -def decoding_cctf(value, function='Cineon', **kwargs): +def cctf_decoding(value, function='sRGB', **kwargs): """ Decodes non-linear :math:`R'G'B'` values to linear :math:`RGB` values using given decoding colour component transfer function (Decoding CCTF). @@ -807,20 +851,20 @@ def decoding_cctf(value, function='Cineon', **kwargs): value : numeric or array_like Non-linear :math:`R'G'B'` values. function : unicode, optional - {:attr:`colour.DECODING_CCTFS`}, + {:attr:`colour.CCTF_DECODINGS`}, Computation function. Other Parameters ---------------- \\**kwargs : dict, optional Keywords arguments for the relevant decoding CCTF of the - :attr:`colour.DECODING_CCTFS` attribute collection. + :attr:`colour.CCTF_DECODINGS` attribute collection. Warning ------- For *ITU-R BT.2100*, only the electro-optical transfer functions (EOTFs / EOCFs) are exposed by this definition, please refer to the - :func:`colour.oetf_reverse` definition for the reverse opto-electronic + :func:`colour.oetf_inverse` definition for the inverse opto-electronic transfer functions (OETF / OECF). Returns @@ -830,35 +874,36 @@ def decoding_cctf(value, function='Cineon', **kwargs): Examples -------- - >>> decoding_cctf(0.391006842619746, function='PLog', log_reference=400) + >>> cctf_decoding(0.391006842619746, function='PLog', log_reference=400) ... # doctest: +ELLIPSIS 0.1... - >>> decoding_cctf(0.182011532850008, function='ST 2084', L_p=1000) + >>> cctf_decoding(0.182011532850008, function='ST 2084', L_p=1000) ... # doctest: +ELLIPSIS 0.1... - >>> decoding_cctf( # doctest: +ELLIPSIS + >>> cctf_decoding( # doctest: +ELLIPSIS ... 0.461356129500442, function='ITU-R BT.1886') 0.1... """ if 'itu-r bt.2100' in function.lower(): usage_warning( - 'For "ITU-R BT.2100", only the electro-optical transfer functions ' - '(EOTFs / EOCFs) are exposed by this definition, please refer to ' - 'the "colour.oetf_reverse" definition for the reverse ' - 'opto-electronic transfer functions (OETF / OECF).') + 'With the "ITU-R BT.2100" method, only the electro-optical ' + 'transfer functions (EOTFs / EOCFs) are exposed by this ' + 'definition, please refer to the "colour.oetf_inverse" definition ' + 'for the inverse opto-electronic transfer functions (OETF / OECF).' + ) - function = DECODING_CCTFS[function] + function = CCTF_DECODINGS[function] return function(value, **filter_kwargs(function, **kwargs)) -__all__ += ['ENCODING_CCTFS', 'DECODING_CCTFS'] -__all__ += ['encoding_cctf', 'decoding_cctf'] +__all__ += ['CCTF_ENCODINGS', 'CCTF_DECODINGS'] +__all__ += ['cctf_encoding', 'cctf_decoding'] OOTFS = CaseInsensitiveMapping({ - 'ITU-R BT.2100 HLG': ootf_BT2100_HLG, - 'ITU-R BT.2100 PQ': ootf_BT2100_PQ, + 'ITU-R BT.2100 HLG': ootf_HLG_BT2100, + 'ITU-R BT.2100 PQ': ootf_PQ_BT2100, }) OOTFS.__doc__ = """ Supported opto-optical transfer functions (OOTFs / OOCFs). @@ -899,22 +944,22 @@ def ootf(value, function='ITU-R BT.2100 PQ', **kwargs): return function(value, **filter_kwargs(function, **kwargs)) -OOTFS_REVERSE = CaseInsensitiveMapping({ - 'ITU-R BT.2100 HLG': ootf_reverse_BT2100_HLG, - 'ITU-R BT.2100 PQ': ootf_reverse_BT2100_PQ, +OOTF_INVERSES = CaseInsensitiveMapping({ + 'ITU-R BT.2100 HLG': ootf_inverse_HLG_BT2100, + 'ITU-R BT.2100 PQ': ootf_inverse_PQ_BT2100, }) -OOTFS_REVERSE.__doc__ = """ -Supported reverse opto-optical transfer functions (OOTFs / OOCFs). +OOTF_INVERSES.__doc__ = """ +Supported inverse opto-optical transfer functions (OOTFs / OOCFs). -OOTFS_REVERSE : CaseInsensitiveMapping +OOTF_INVERSES : CaseInsensitiveMapping **{'ITU-R BT.2100 HLG', 'ITU-R BT.2100 PQ'}** """ -def ootf_reverse(value, function='ITU-R BT.2100 PQ', **kwargs): +def ootf_inverse(value, function='ITU-R BT.2100 PQ', **kwargs): """ Maps relative display linear light to scene linear light using given - reverse opto-optical transfer function (OOTF / OOCF). + inverse opto-optical transfer function (OOTF / OOCF). Parameters ---------- @@ -922,19 +967,19 @@ def ootf_reverse(value, function='ITU-R BT.2100 PQ', **kwargs): Value. function : unicode, optional **{'ITU-R BT.2100 HLG', 'ITU-R BT.2100 PQ'}** - Reverse opto-optical transfer function (OOTF / OOCF). + Inverse opto-optical transfer function (OOTF / OOCF). Other Parameters ---------------- L_B : numeric, optional - {:func:`colour.models.ootf_reverse_BT2100_HLG`}, + {:func:`colour.models.ootf_inverse_HLG_BT2100`}, :math:`L_B` is the display luminance for black in :math:`cd/m^2`. L_W : numeric, optional - {:func:`colour.models.ootf_reverse_BT2100_HLG`}, + {:func:`colour.models.ootf_inverse_HLG_BT2100`}, :math:`L_W` is nominal peak luminance of the display in :math:`cd/m^2` for achromatic pixels. gamma : numeric, optional - {:func:`colour.models.ootf_reverse_BT2100_HLG`}, + {:func:`colour.models.ootf_inverse_HLG_BT2100`}, System gamma value, 1.2 at the nominal display peak luminance of :math:`1000 cd/m^2`. @@ -945,17 +990,17 @@ def ootf_reverse(value, function='ITU-R BT.2100 PQ', **kwargs): Examples -------- - >>> ootf_reverse(779.988360834115840) # doctest: +ELLIPSIS + >>> ootf_inverse(779.988360834115840) # doctest: +ELLIPSIS 0.1000000... - >>> ootf_reverse( # doctest: +ELLIPSIS + >>> ootf_inverse( # doctest: +ELLIPSIS ... 63.095734448019336, function='ITU-R BT.2100 HLG') 0.1000000... """ - function = OOTFS_REVERSE[function] + function = OOTF_INVERSES[function] return function(value, **filter_kwargs(function, **kwargs)) -__all__ += ['OOTFS', 'OOTFS_REVERSE'] -__all__ += ['ootf', 'ootf_reverse'] +__all__ += ['OOTFS', 'OOTF_INVERSES'] +__all__ += ['ootf', 'ootf_inverse'] diff --git a/colour/models/rgb/transfer_functions/aces.py b/colour/models/rgb/transfer_functions/aces.py index 7a13d5a5fa..6d5cec1636 100644 --- a/colour/models/rgb/transfer_functions/aces.py +++ b/colour/models/rgb/transfer_functions/aces.py @@ -166,8 +166,8 @@ def log_encoding_ACESproxy(lin_AP1, | ``ACESproxy`` | [0, 1] | [0, 1] | +----------------+-----------------------+---------------+ - - \\* This definition has an output integer switch, thus the domain-range - scale information is only given for the floating point mode. + \\* This definition has an output integer switch, thus the domain-range + scale information is only given for the floating point mode. References ---------- @@ -253,8 +253,8 @@ def log_decoding_ACESproxy(ACESproxy, | ``lin_AP1`` | [0, 1] | [0, 1] | +----------------+-----------------------+---------------+ - - \\* This definition has an input integer switch, thus the domain-range - scale information is only given for the floating point mode. + \\* This definition has an input integer switch, thus the domain-range + scale information is only given for the floating point mode. References ---------- diff --git a/colour/models/rgb/transfer_functions/arib_std_b67.py b/colour/models/rgb/transfer_functions/arib_std_b67.py index cfe64e8702..df2aecc298 100644 --- a/colour/models/rgb/transfer_functions/arib_std_b67.py +++ b/colour/models/rgb/transfer_functions/arib_std_b67.py @@ -4,10 +4,10 @@ =============================== Defines *ARIB STD-B67 (Hybrid Log-Gamma)* opto-electrical transfer function -(OETF / OECF) and its reverse: +(OETF / OECF) and its inverse: - :func:`colour.models.oetf_ARIBSTDB67` -- :func:`colour.models.oetf_reverse_ARIBSTDB67` +- :func:`colour.models.oetf_inverse_ARIBSTDB67` See Also -------- @@ -28,6 +28,7 @@ import numpy as np +from colour.models.rgb.transfer_functions import gamma_function from colour.utilities import (Structure, as_float, domain_range_scale, from_range_1, to_domain_1) @@ -39,7 +40,7 @@ __status__ = 'Production' __all__ = [ - 'ARIBSTDB67_CONSTANTS', 'oetf_ARIBSTDB67', 'oetf_reverse_ARIBSTDB67' + 'ARIBSTDB67_CONSTANTS', 'oetf_ARIBSTDB67', 'oetf_inverse_ARIBSTDB67' ] ARIBSTDB67_CONSTANTS = Structure(a=0.17883277, b=0.28466892, c=0.55991073) @@ -86,6 +87,10 @@ def oetf_ARIBSTDB67(E, r=0.5, constants=ARIBSTDB67_CONSTANTS): | ``E_p`` | [0, 1] | [0, 1] | +------------+-----------------------+---------------+ + - This definition uses the *mirror* negative number handling mode of + :func:`colour.models.gamma_function` definition to the sign of negative + numbers. + References ---------- :cite:`AssociationofRadioIndustriesandBusinesses2015a` @@ -102,14 +107,15 @@ def oetf_ARIBSTDB67(E, r=0.5, constants=ARIBSTDB67_CONSTANTS): b = constants.b c = constants.c - E_p = np.where(E <= 1, r * np.sqrt(E), a * np.log(E - b) + c) + E_p = np.where(E <= 1, r * gamma_function(E, 0.5, 'mirror'), + a * np.log(E - b) + c) return as_float(from_range_1(E_p)) -def oetf_reverse_ARIBSTDB67(E_p, r=0.5, constants=ARIBSTDB67_CONSTANTS): +def oetf_inverse_ARIBSTDB67(E_p, r=0.5, constants=ARIBSTDB67_CONSTANTS): """ - Defines *ARIB STD-B67 (Hybrid Log-Gamma)* reverse opto-electrical transfer + Defines *ARIB STD-B67 (Hybrid Log-Gamma)* inverse opto-electrical transfer function (OETF / OECF). Parameters @@ -143,13 +149,17 @@ def oetf_reverse_ARIBSTDB67(E_p, r=0.5, constants=ARIBSTDB67_CONSTANTS): | ``E`` | [0, 1] | [0, 1] | +------------+-----------------------+---------------+ + - This definition uses the *mirror* negative number handling mode of + :func:`colour.models.gamma_function` definition to the sign of negative + numbers. + References ---------- :cite:`AssociationofRadioIndustriesandBusinesses2015a` Examples -------- - >>> oetf_reverse_ARIBSTDB67(0.212132034355964) # doctest: +ELLIPSIS + >>> oetf_inverse_ARIBSTDB67(0.212132034355964) # doctest: +ELLIPSIS 0.1799999... """ @@ -162,7 +172,7 @@ def oetf_reverse_ARIBSTDB67(E_p, r=0.5, constants=ARIBSTDB67_CONSTANTS): with domain_range_scale('ignore'): E = np.where( E_p <= oetf_ARIBSTDB67(1), - (E_p / r) ** 2, + gamma_function((E_p / r), 2, 'mirror'), np.exp((E_p - c) / a) + b, ) diff --git a/colour/models/rgb/transfer_functions/alexa_log_c.py b/colour/models/rgb/transfer_functions/arri_alexa_log_c.py similarity index 94% rename from colour/models/rgb/transfer_functions/alexa_log_c.py rename to colour/models/rgb/transfer_functions/arri_alexa_log_c.py index 06d97a2337..a326c79fbf 100644 --- a/colour/models/rgb/transfer_functions/alexa_log_c.py +++ b/colour/models/rgb/transfer_functions/arri_alexa_log_c.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- """ -ALEXA Log C Log Encoding -======================== +ARRI ALEXA Log C Log Encoding +============================= -Defines the *ALEXA Log C* log encoding: +Defines the *ARRI ALEXA Log C* log encoding: - :func:`colour.models.log_encoding_ALEXALogC` - :func:`colour.models.log_decoding_ALEXALogC` @@ -72,7 +72,7 @@ } }) """ -*ALEXA Log C* curve *Ei, Black, Clipping Level* data. +*ARRI ALEXA Log C* curve *Ei, Black, Clipping Level* data. ALEXA_LOG_C_CURVE_BCL_DATA : CaseInsensitiveMapping **{'SUP 3.x', 'SUP 2.x'}** @@ -180,8 +180,9 @@ }) }) # yapf: disable """ -*ALEXA Log C* curve conversion data between signal and linear scene exposure -factor for *SUP 3.x* and signal and normalised sensor signal for *SUP 2.x*. +*ARRI ALEXA Log C* curve conversion data between signal and linear scene +exposure factor for *SUP 3.x* and signal and normalised sensor signal for +*SUP 2.x*. ALEXA_LOG_C_CURVE_CONVERSION_DATA : CaseInsensitiveMapping **{'SUP 3.x', 'SUP 2.x'}** @@ -193,8 +194,8 @@ def log_encoding_ALEXALogC(x, method='Linear Scene Exposure Factor', EI=800): """ - Defines the *ALEXA Log C* log encoding curve / opto-electronic transfer - function. + Defines the *ARRI ALEXA Log C* log encoding curve / opto-electronic + transfer function. Parameters ---------- @@ -212,7 +213,7 @@ def log_encoding_ALEXALogC(x, Returns ------- numeric or ndarray - *ALEXA Log C* encoded data :math:`t`. + *ARRI ALEXA Log C* encoded data :math:`t`. References ---------- @@ -254,13 +255,13 @@ def log_decoding_ALEXALogC(t, method='Linear Scene Exposure Factor', EI=800): """ - Defines the *ALEXA Log C* log decoding curve / electro-optical transfer - function. + Defines the *ARRI ALEXA Log C* log decoding curve / electro-optical + transfer function. Parameters ---------- t : numeric or array_like - *ALEXA Log C* encoded data :math:`t`. + *ARRI ALEXA Log C* encoded data :math:`t`. firmware : unicode, optional **{'SUP 3.x', 'SUP 2.x'}**, Alexa firmware version. diff --git a/colour/models/rgb/transfer_functions/canon_log.py b/colour/models/rgb/transfer_functions/canon_log.py index 39a0a518a3..2bdd888a73 100644 --- a/colour/models/rgb/transfer_functions/canon_log.py +++ b/colour/models/rgb/transfer_functions/canon_log.py @@ -42,6 +42,7 @@ from colour.models.rgb.transfer_functions import full_to_legal, legal_to_full from colour.utilities import (as_float, domain_range_scale, from_range_1, to_domain_1) +from colour.utilities.deprecation import handle_arguments_deprecation __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -57,7 +58,11 @@ ] -def log_encoding_CanonLog(x, bit_depth=10, out_legal=True, in_reflection=True): +def log_encoding_CanonLog(x, + bit_depth=10, + out_normalised_code_value=True, + in_reflection=True, + **kwargs): """ Defines the *Canon Log* log encoding curve / opto-electronic transfer function. @@ -68,12 +73,17 @@ def log_encoding_CanonLog(x, bit_depth=10, out_legal=True, in_reflection=True): Linear data :math:`x`. bit_depth : int, optional Bit depth used for conversion. - out_legal : bool, optional - Whether the *Canon Log* non-linear data is encoded in legal - range. + out_normalised_code_value : bool, optional + Whether the *Canon Log* non-linear data is encoded as normalised code + values. in_reflection : bool, optional Whether the light level :math:`x` to a camera is reflection. + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments for deprecation management. + Returns ------- numeric or ndarray @@ -102,8 +112,21 @@ def log_encoding_CanonLog(x, bit_depth=10, out_legal=True, in_reflection=True): -------- >>> log_encoding_CanonLog(0.18) * 100 # doctest: +ELLIPSIS 34.3389651... + + The values of *Table 2 Canon-Log Code Values* table in :cite:`Thorpe2012a` + are obtained as follows: + + >>> x = np.array([0, 2, 18, 90, 720]) / 100 + >>> np.around(log_encoding_CanonLog(x) * (2 ** 10 - 1)).astype(np.int) + array([ 128, 169, 351, 614, 1016]) + >>> np.around(log_encoding_CanonLog(x, 10, False) * 100, 1) + array([ 7.3, 12. , 32.8, 62.7, 108.7]) """ + out_normalised_code_value = handle_arguments_deprecation({ + 'ArgumentRenamed': [['out_legal', 'out_normalised_code_value']], + }, **kwargs).get('out_normalised_code_value', out_normalised_code_value) + x = to_domain_1(x) if in_reflection: @@ -116,15 +139,17 @@ def log_encoding_CanonLog(x, bit_depth=10, out_legal=True, in_reflection=True): 0.529136 * np.log10(10.1596 * x + 1) + 0.0730597, ) - clog = full_to_legal(clog, bit_depth) if out_legal else clog + clog = (full_to_legal(clog, bit_depth) + if out_normalised_code_value else clog) return as_float(from_range_1(clog)) def log_decoding_CanonLog(clog, bit_depth=10, - in_legal=True, - out_reflection=True): + in_normalised_code_value=True, + out_reflection=True, + **kwargs): """ Defines the *Canon Log* log decoding curve / electro-optical transfer function. @@ -135,12 +160,17 @@ def log_decoding_CanonLog(clog, *Canon Log* non-linear data. bit_depth : int, optional Bit depth used for conversion. - in_legal : bool, optional - Whether the *Canon Log* non-linear data is encoded in legal - range. + in_normalised_code_value : bool, optional + Whether the *Canon Log* non-linear data is encoded with normalised + code values. out_reflection : bool, optional Whether the light level :math:`x` to a camera is reflection. + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments for deprecation management. + Returns ------- numeric or ndarray @@ -171,9 +201,14 @@ def log_decoding_CanonLog(clog, 0.17999999... """ + in_normalised_code_value = handle_arguments_deprecation({ + 'ArgumentRenamed': [['in_legal', 'in_normalised_code_value']], + }, **kwargs).get('in_normalised_code_value', in_normalised_code_value) + clog = to_domain_1(clog) - clog = legal_to_full(clog, bit_depth) if in_legal else clog + clog = (legal_to_full(clog, bit_depth) + if in_normalised_code_value else clog) x = np.where( clog < 0.0730597, @@ -187,8 +222,11 @@ def log_decoding_CanonLog(clog, return as_float(from_range_1(x)) -def log_encoding_CanonLog2(x, bit_depth=10, out_legal=True, - in_reflection=True): +def log_encoding_CanonLog2(x, + bit_depth=10, + out_normalised_code_value=True, + in_reflection=True, + **kwargs): """ Defines the *Canon Log 2* log encoding curve / opto-electronic transfer function. @@ -199,12 +237,17 @@ def log_encoding_CanonLog2(x, bit_depth=10, out_legal=True, Linear data :math:`x`. bit_depth : int, optional Bit depth used for conversion. - out_legal : bool, optional - Whether the *Canon Log 2* non-linear data is encoded in legal - range. + out_normalised_code_value : bool, optional + Whether the *Canon Log 2* non-linear data is encoded as normalised + code values. in_reflection : bool, optional Whether the light level :math:`x` to a camera is reflection. + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments for deprecation management. + Returns ------- numeric or ndarray @@ -235,6 +278,10 @@ def log_encoding_CanonLog2(x, bit_depth=10, out_legal=True, 39.8254694... """ + out_normalised_code_value = handle_arguments_deprecation({ + 'ArgumentRenamed': [['out_legal', 'out_normalised_code_value']], + }, **kwargs).get('out_normalised_code_value', out_normalised_code_value) + x = to_domain_1(x) if in_reflection: @@ -247,15 +294,17 @@ def log_encoding_CanonLog2(x, bit_depth=10, out_legal=True, 0.281863093 * np.log10(x * 87.09937546 + 1) + 0.035388128, ) - clog2 = full_to_legal(clog2, bit_depth) if out_legal else clog2 + clog2 = (full_to_legal(clog2, bit_depth) + if out_normalised_code_value else clog2) return as_float(from_range_1(clog2)) def log_decoding_CanonLog2(clog2, bit_depth=10, - in_legal=True, - out_reflection=True): + in_normalised_code_value=True, + out_reflection=True, + **kwargs): """ Defines the *Canon Log 2* log decoding curve / electro-optical transfer function. @@ -266,12 +315,17 @@ def log_decoding_CanonLog2(clog2, *Canon Log 2* non-linear data. bit_depth : int, optional Bit depth used for conversion. - in_legal : bool, optional - Whether the *Canon Log 2* non-linear data is encoded in legal - range. + in_normalised_code_value : bool, optional + Whether the *Canon Log 2* non-linear data is encoded with normalised + code values. out_reflection : bool, optional Whether the light level :math:`x` to a camera is reflection. + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments for deprecation management. + Returns ------- numeric or ndarray @@ -302,9 +356,14 @@ def log_decoding_CanonLog2(clog2, 0.1799999... """ + in_normalised_code_value = handle_arguments_deprecation({ + 'ArgumentRenamed': [['in_legal', 'in_normalised_code_value']], + }, **kwargs).get('in_normalised_code_value', in_normalised_code_value) + clog2 = to_domain_1(clog2) - clog2 = legal_to_full(clog2, bit_depth) if in_legal else clog2 + clog2 = (legal_to_full(clog2, bit_depth) + if in_normalised_code_value else clog2) x = np.where( clog2 < 0.035388128, @@ -318,8 +377,11 @@ def log_decoding_CanonLog2(clog2, return as_float(from_range_1(x)) -def log_encoding_CanonLog3(x, bit_depth=10, out_legal=True, - in_reflection=True): +def log_encoding_CanonLog3(x, + bit_depth=10, + out_normalised_code_value=True, + in_reflection=True, + **kwargs): """ Defines the *Canon Log 3* log encoding curve / opto-electronic transfer function. @@ -330,12 +392,17 @@ def log_encoding_CanonLog3(x, bit_depth=10, out_legal=True, Linear data :math:`x`. bit_depth : int, optional Bit depth used for conversion. - out_legal : bool, optional - Whether the *Canon Log 3* non-linear data is encoded in legal - range. + out_normalised_code_value : bool, optional + Whether the *Canon Log 3* non-linear data is encoded as normalised code + values. in_reflection : bool, optional Whether the light level :math:`x` to a camera is reflection. + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments for deprecation management. + Returns ------- numeric or ndarray @@ -379,6 +446,10 @@ def log_encoding_CanonLog3(x, bit_depth=10, out_legal=True, 34.3389369... """ + out_normalised_code_value = handle_arguments_deprecation({ + 'ArgumentRenamed': [['out_legal', 'out_normalised_code_value']], + }, **kwargs).get('out_normalised_code_value', out_normalised_code_value) + x = to_domain_1(x) if in_reflection: @@ -393,15 +464,17 @@ def log_encoding_CanonLog3(x, bit_depth=10, out_legal=True, 2.3069815 * x + 0.073059361, 0.42889912 * np.log10(x * 14.98325 + 1) + 0.069886632)) - clog3 = full_to_legal(clog3, bit_depth) if out_legal else clog3 + clog3 = (full_to_legal(clog3, bit_depth) + if out_normalised_code_value else clog3) return as_float(from_range_1(clog3)) def log_decoding_CanonLog3(clog3, bit_depth=10, - in_legal=True, - out_reflection=True): + in_normalised_code_value=True, + out_reflection=True, + **kwargs): """ Defines the *Canon Log 3* log decoding curve / electro-optical transfer function. @@ -412,12 +485,17 @@ def log_decoding_CanonLog3(clog3, *Canon Log 3* non-linear data. bit_depth : int, optional Bit depth used for conversion. - in_legal : bool, optional - Whether the *Canon Log 3* non-linear data is encoded in legal - range. + in_normalised_code_value : bool, optional + Whether the *Canon Log 3* non-linear data is encoded with normalised + code values. out_reflection : bool, optional Whether the light level :math:`x` to a camera is reflection. + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments for deprecation management. + Returns ------- numeric or ndarray @@ -448,9 +526,14 @@ def log_decoding_CanonLog3(clog3, 0.1800000... """ + in_normalised_code_value = handle_arguments_deprecation({ + 'ArgumentRenamed': [['in_legal', 'in_normalised_code_value']], + }, **kwargs).get('in_normalised_code_value', in_normalised_code_value) + clog3 = to_domain_1(clog3) - clog3 = legal_to_full(clog3, bit_depth) if in_legal else clog3 + clog3 = (legal_to_full(clog3, bit_depth) + if in_normalised_code_value else clog3) x = np.select( (clog3 < 0.04076162, clog3 <= 0.105357102, clog3 > 0.105357102), diff --git a/colour/models/rgb/transfer_functions/dcdm.py b/colour/models/rgb/transfer_functions/dcdm.py index ff5e7fde78..f352e63ef8 100644 --- a/colour/models/rgb/transfer_functions/dcdm.py +++ b/colour/models/rgb/transfer_functions/dcdm.py @@ -3,10 +3,10 @@ Digital Cinema Distribution Master (DCDM) ========================================= -Defines the *DCDM* opto-electrical transfer function (OETF / OECF) and -electro-optical transfer function (EOTF / EOCF): +Defines the *DCDM* electro-optical transfer function (EOTF / EOCF) and its +inverse: -- :func:`colour.models.eotf_reverse_DCDM` +- :func:`colour.models.eotf_inverse_DCDM` - :func:`colour.models.eotf_DCDM` See Also @@ -38,12 +38,12 @@ __email__ = 'colour-science@googlegroups.com' __status__ = 'Production' -__all__ = ['eotf_reverse_DCDM', 'eotf_DCDM'] +__all__ = ['eotf_inverse_DCDM', 'eotf_DCDM'] -def eotf_reverse_DCDM(XYZ, out_int=False): +def eotf_inverse_DCDM(XYZ, out_int=False): """ - Defines the *DCDM* reverse electro-optical transfer function (EOTF / EOCF). + Defines the *DCDM* inverse electro-optical transfer function (EOTF / EOCF). Parameters ---------- @@ -58,9 +58,17 @@ def eotf_reverse_DCDM(XYZ, out_int=False): numeric or ndarray Non-linear *CIE XYZ'* tristimulus values. + Warnings + -------- + *DCDM* is an absolute transfer function. + Notes ----- + - *DCDM* is an absolute transfer function, thus the domain and range + values for the *Reference* and *1* scales are only indicative that the + data is not affected by scale transformations. + +----------------+-----------------------+---------------+ | **Domain \\*** | **Scale - Reference** | **Scale - 1** | +================+=======================+===============+ @@ -73,8 +81,8 @@ def eotf_reverse_DCDM(XYZ, out_int=False): | ``XYZ_p`` | [0, 1] | [0, 1] | +----------------+-----------------------+---------------+ - - \\* This definition has an output integer switch, thus the domain-range - scale information is only given for the floating point mode. + \\* This definition has an output integer switch, thus the domain-range + scale information is only given for the floating point mode. References ---------- @@ -82,9 +90,9 @@ def eotf_reverse_DCDM(XYZ, out_int=False): Examples -------- - >>> eotf_reverse_DCDM(0.18) # doctest: +ELLIPSIS + >>> eotf_inverse_DCDM(0.18) # doctest: +ELLIPSIS 0.1128186... - >>> eotf_reverse_DCDM(0.18, out_int=True) + >>> eotf_inverse_DCDM(0.18, out_int=True) 462 """ @@ -115,9 +123,17 @@ def eotf_DCDM(XYZ_p, in_int=False): numeric or ndarray *CIE XYZ* tristimulus values. + Warnings + -------- + *DCDM* is an absolute transfer function. + Notes ----- + - *DCDM* is an absolute transfer function, thus the domain and range + values for the *Reference* and *1* scales are only indicative that the + data is not affected by scale transformations. + +----------------+-----------------------+---------------+ | **Domain \\*** | **Scale - Reference** | **Scale - 1** | +================+=======================+===============+ @@ -130,8 +146,8 @@ def eotf_DCDM(XYZ_p, in_int=False): | ``XYZ`` | [0, 1] | [0, 1] | +----------------+-----------------------+---------------+ - - \\* This definition has an input integer switch, thus the domain-range - scale information is only given for the floating point mode. + \\* This definition has an input integer switch, thus the domain-range + scale information is only given for the floating point mode. References ---------- diff --git a/colour/models/rgb/transfer_functions/dicom_gsdf.py b/colour/models/rgb/transfer_functions/dicom_gsdf.py index 51f948e4e9..05a4a5af05 100644 --- a/colour/models/rgb/transfer_functions/dicom_gsdf.py +++ b/colour/models/rgb/transfer_functions/dicom_gsdf.py @@ -3,11 +3,10 @@ DICOM - Grayscale Standard Display Function =========================================== -Defines the *DICOM - Grayscale Standard Display Function* opto-electrical -transfer function (OETF / OECF) and electro-optical transfer function -(EOTF / EOCF): +Defines the *DICOM - Grayscale Standard Display Function* electro-optical +transfer function (EOTF / EOCF) and its inverse: -- :func:`colour.models.oetf_DICOMGSDF` +- :func:`colour.models.eotf_inverse_DICOMGSDF` - :func:`colour.models.eotf_DICOMGSDF` The Grayscale Standard Display Function is defined for the Luminance Range @@ -45,7 +44,7 @@ __email__ = 'colour-science@googlegroups.com' __status__ = 'Production' -__all__ = ['DICOMGSDF_CONSTANTS', 'oetf_DICOMGSDF', 'eotf_DICOMGSDF'] +__all__ = ['DICOMGSDF_CONSTANTS', 'eotf_inverse_DICOMGSDF', 'eotf_DICOMGSDF'] DICOMGSDF_CONSTANTS = Structure( a=-1.3011877, @@ -74,10 +73,10 @@ """ -def oetf_DICOMGSDF(L, out_int=False): +def eotf_inverse_DICOMGSDF(L, out_int=False): """ - Defines the *DICOM - Grayscale Standard Display Function* opto-electronic - transfer function (OETF / OECF). + Defines the *DICOM - Grayscale Standard Display Function* inverse + electro-optical transfer function (EOTF / EOCF). Parameters ---------- @@ -113,9 +112,9 @@ def oetf_DICOMGSDF(L, out_int=False): Examples -------- - >>> oetf_DICOMGSDF(130.0662) # doctest: +ELLIPSIS + >>> eotf_inverse_DICOMGSDF(130.0662) # doctest: +ELLIPSIS 0.5004862... - >>> oetf_DICOMGSDF(130.0662, out_int=True) + >>> eotf_inverse_DICOMGSDF(130.0662, out_int=True) 512 """ diff --git a/colour/models/rgb/transfer_functions/fujifilm_flog.py b/colour/models/rgb/transfer_functions/fujifilm_flog.py new file mode 100644 index 0000000000..ef4542dc2e --- /dev/null +++ b/colour/models/rgb/transfer_functions/fujifilm_flog.py @@ -0,0 +1,218 @@ +# -*- coding: utf-8 -*- +""" +Fujifilm F-Log Log Encoding +=========================== + +Defines the *Fujifilm F-Log* log encoding: + +- :func:`colour.models.log_encoding_FLog` +- :func:`colour.models.log_decoding_FLog` + +See Also +-------- +`RGB Colourspaces Jupyter Notebook +`_ + +References +---------- +- :cite:`Fujifilm2016` : Fujifilm. (2016). F-Log Data Sheet Ver.1.0. + Retrieved from https://www.fujifilm.com/support/digital_cameras/\ +software/lut/pdf/F-Log_DataSheet_E_Ver.1.0.pdf +""" + +from __future__ import division, unicode_literals + +import numpy as np + +from colour.models.rgb.transfer_functions import full_to_legal, legal_to_full +from colour.utilities import Structure, as_float, from_range_1, to_domain_1 + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - http://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = ['FLOG_CONSTANTS', 'log_encoding_FLog', 'log_decoding_FLog'] + +FLOG_CONSTANTS = Structure( + cut1=0.00089, + cut2=0.100537775223865, + a=0.555556, + b=0.009468, + c=0.344676, + d=0.790453, + e=8.735631, + f=0.092864) +""" +*Fujifilm F-Log* colourspace constants. + +FLOG_CONSTANTS : Structure +""" + + +def log_encoding_FLog(in_r, + bit_depth=10, + out_normalised_code_value=True, + in_reflection=True, + constants=FLOG_CONSTANTS): + """ + Defines the *Fujifilm F-Log* log encoding curve / opto-electronic transfer + function. + + Parameters + ---------- + in_r : numeric or array_like + Linear reflection data :math`in`. + bit_depth : int, optional + Bit depth used for conversion. + out_normalised_code_value : bool, optional + Whether the non-linear *Fujifilm F-Log* data :math:`out` is encoded as + normalised code values. + in_reflection : bool, optional + Whether the light level :math`in` to a camera is reflection. + constants : Structure, optional + *Fujifilm F-Log* constants. + + Returns + ------- + numeric or ndarray + Non-linear data :math:`out`. + + Notes + ----- + + +------------+-----------------------+---------------+ + | **Domain** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``in_r`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + +------------+-----------------------+---------------+ + | **Range** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``out_r`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + References + ---------- + :cite:`Fujifilm2016` + + Examples + -------- + >>> log_encoding_FLog(0.18) # doctest: +ELLIPSIS + 0.4593184... + + The values of *2-2. F-Log Code Value* table in :cite:`Fujifilm2016` are + obtained as follows: + + >>> x = np.array([0, 18, 90]) / 100 + >>> np.around(log_encoding_FLog(x, 10, False) * 100, 1) + array([ 3.5, 46.3, 73.2]) + >>> np.around(log_encoding_FLog(x) * (2 ** 10 - 1)).astype(np.int) + array([ 95, 470, 705]) + """ + + in_r = to_domain_1(in_r) + + if not in_reflection: + in_r = in_r * 0.9 + + cut1 = constants.cut1 + a = constants.a + b = constants.b + c = constants.c + d = constants.d + e = constants.e + f = constants.f + + out_r = np.where( + in_r < cut1, + e * in_r + f, + c * np.log10(a * in_r + b) + d, + ) + + out_r = (out_r + if out_normalised_code_value else legal_to_full(out_r, bit_depth)) + + return as_float(from_range_1(out_r)) + + +def log_decoding_FLog(out_r, + bit_depth=10, + in_normalised_code_value=True, + out_reflection=True, + constants=FLOG_CONSTANTS): + """ + Defines the *Fujifilm F-Log* log decoding curve / electro-optical transfer + function. + + Parameters + ---------- + out_r : numeric or array_like + Non-linear data :math:`out`. + bit_depth : int, optional + Bit depth used for conversion. + in_normalised_code_value : bool, optional + Whether the non-linear *Fujifilm F-Log* data :math:`out` is encoded as + normalised code values. + out_reflection : bool, optional + Whether the light level :math`in` to a camera is reflection. + constants : Structure, optional + *Fujifilm F-Log* constants. + + Returns + ------- + numeric or ndarray + Linear reflection data :math`in`. + + Notes + ----- + + +------------+-----------------------+---------------+ + | **Domain** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``out_r`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + +------------+-----------------------+---------------+ + | **Range** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``in_r`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + References + ---------- + :cite:`Fujifilm2016` + + Examples + -------- + >>> log_decoding_FLog(0.45931845866162124) # doctest: +ELLIPSIS + 0.1800000... + """ + + out_r = to_domain_1(out_r) + + out_r = (out_r + if in_normalised_code_value else full_to_legal(out_r, bit_depth)) + + cut2 = constants.cut2 + a = constants.a + b = constants.b + c = constants.c + d = constants.d + e = constants.e + f = constants.f + + in_r = np.where( + out_r < cut2, + (out_r - f) / e, + (10 ** ((out_r - d) / c)) / a - b / a, + ) + + if not out_reflection: + in_r = in_r / 0.9 + + return as_float(from_range_1(in_r)) diff --git a/colour/models/rgb/transfer_functions/gamma.py b/colour/models/rgb/transfer_functions/gamma.py index 38f6da8477..a1e9c2c6a0 100644 --- a/colour/models/rgb/transfer_functions/gamma.py +++ b/colour/models/rgb/transfer_functions/gamma.py @@ -97,5 +97,7 @@ def gamma_function(a, exponent=1, negative_number_handling='Indeterminate'): return as_float(np.where(a <= 0, 0, a ** exponent)) else: raise ValueError( - 'Undefined negative number handling method: "{0}".'.format( - negative_number_handling)) + 'Undefined negative number handling method: "{0}", must be one of ' + '"{1}".'.format( + negative_number_handling, + ', '.join(['Indeterminate', 'Mirror', 'Preserve', 'Clamp']))) diff --git a/colour/models/rgb/transfer_functions/itur_bt_1886.py b/colour/models/rgb/transfer_functions/itur_bt_1886.py index 41de6863c5..6dd14ff1f0 100644 --- a/colour/models/rgb/transfer_functions/itur_bt_1886.py +++ b/colour/models/rgb/transfer_functions/itur_bt_1886.py @@ -4,9 +4,9 @@ ============= Defines *Recommendation ITU-R BT.1886* electro-optical transfer function -(EOTF / EOCF) and its reverse: +(EOTF / EOCF) and its inverse: -- :func:`colour.models.eotf_reverse_BT1886` +- :func:`colour.models.eotf_inverse_BT1886` - :func:`colour.models.eotf_BT1886` See Also @@ -38,12 +38,12 @@ __email__ = 'colour-science@googlegroups.com' __status__ = 'Production' -__all__ = ['eotf_reverse_BT1886', 'eotf_BT1886'] +__all__ = ['eotf_inverse_BT1886', 'eotf_BT1886'] -def eotf_reverse_BT1886(L, L_B=0, L_W=1): +def eotf_inverse_BT1886(L, L_B=0, L_W=1): """ - Defines *Recommendation ITU-R BT.1886* reverse electro-optical transfer + Defines *Recommendation ITU-R BT.1886* inverse electro-optical transfer function (EOTF / EOCF). Parameters @@ -82,7 +82,7 @@ def eotf_reverse_BT1886(L, L_B=0, L_W=1): Examples -------- - >>> eotf_reverse_BT1886(0.11699185725296059) # doctest: +ELLIPSIS + >>> eotf_inverse_BT1886(0.11699185725296059) # doctest: +ELLIPSIS 0.4090077... """ diff --git a/colour/models/rgb/transfer_functions/itur_bt_2020.py b/colour/models/rgb/transfer_functions/itur_bt_2020.py index cb0f17f381..4b572ae5b2 100644 --- a/colour/models/rgb/transfer_functions/itur_bt_2020.py +++ b/colour/models/rgb/transfer_functions/itur_bt_2020.py @@ -79,7 +79,7 @@ def oetf_BT2020(E, is_12_bits_system=False, constants=BT2020_CONSTANTS): Voltage :math:`E` normalised by the reference white level and proportional to the implicit light intensity that would be detected with a reference camera colour channel R, G, B. - is_12_bits_system : bool + is_12_bits_system : bool, optional *BT.709* *alpha* and *beta* constants are used if system is not 12-bit. constants : Structure, optional *Recommendation ITU-R BT.2020* constants. @@ -133,7 +133,7 @@ def eotf_BT2020(E_p, is_12_bits_system=False, constants=BT2020_CONSTANTS): ---------- E_p : numeric or array_like Non-linear signal :math:`E'`. - is_12_bits_system : bool + is_12_bits_system : bool, optional *BT.709* *alpha* and *beta* constants are used if system is not 12-bit. constants : Structure, optional *Recommendation ITU-R BT.2020* constants. diff --git a/colour/models/rgb/transfer_functions/itur_bt_2100.py b/colour/models/rgb/transfer_functions/itur_bt_2100.py index 5d7651ec9f..bb586b08cf 100644 --- a/colour/models/rgb/transfer_functions/itur_bt_2100.py +++ b/colour/models/rgb/transfer_functions/itur_bt_2100.py @@ -5,20 +5,34 @@ Defines *ITU-R BT.2100* opto-electrical transfer functions (OETF / OECF), opto-optical transfer functions (OOTF / OOCF) and electro-optical transfer -functions (EOTF / EOCF) and their reverse: - -- :func:`colour.models.oetf_BT2100_PQ` -- :func:`colour.models.oetf_reverse_BT2100_PQ` -- :func:`colour.models.eotf_BT2100_PQ` -- :func:`colour.models.eotf_reverse_BT2100_PQ` -- :func:`colour.models.ootf_BT2100_PQ` -- :func:`colour.models.ootf_reverse_BT2100_PQ` -- :func:`colour.models.oetf_BT2100_HLG` -- :func:`colour.models.oetf_reverse_BT2100_HLG` -- :func:`colour.models.eotf_BT2100_HLG` -- :func:`colour.models.eotf_reverse_BT2100_HLG` -- :func:`colour.models.ootf_BT2100_HLG` -- :func:`colour.models.ootf_reverse_BT2100_HLG` +functions (EOTF / EOCF) and their inverse: + +- :func:`colour.models.oetf_PQ_BT2100` +- :func:`colour.models.oetf_inverse_PQ_BT2100` +- :func:`colour.models.eotf_PQ_BT2100` +- :func:`colour.models.eotf_inverse_PQ_BT2100` +- :func:`colour.models.ootf_PQ_BT2100` +- :func:`colour.models.ootf_inverse_PQ_BT2100` +- :func:`colour.models.oetf_HLG_BT2100` +- :func:`colour.models.oetf_inverse_HLG_BT2100` +- :func:`colour.models.eotf_HLG_BT2100_1` +- :func:`colour.models.eotf_HLG_BT2100_2` +- :attr:`colour.models.BT2100_HLG_EOTF_METHODS` +- :func:`colour.models.eotf_HLG_BT2100` +- :func:`colour.models.eotf_inverse_HLG_BT2100_1` +- :func:`colour.models.eotf_inverse_HLG_BT2100_2` +- :attr:`colour.models.BT2100_HLG_EOTF_INVERSE_METHODS` +- :func:`colour.models.eotf_inverse_HLG_BT2100` +- :func:`colour.models.ootf_HLG_BT2100` +- :func:`colour.models.ootf_inverse_HLG_BT2100` +- :func:`colour.models.ootf_HLG_BT2100_1` +- :func:`colour.models.ootf_HLG_BT2100_2` +- :attr:`colour.models.BT2100_HLG_OOTF_METHODS` +- :func:`colour.models.ootf_HLG_BT2100` +- :func:`colour.models.ootf_inverse_HLG_BT2100_1` +- :func:`colour.models.ootf_inverse_HLG_BT2100_2` +- :attr:`colour.models.BT2100_HLG_OOTF_INVERSE_METHODS` +- :func:`colour.models.ootf_inverse_HLG_BT2100` See Also -------- @@ -30,26 +44,33 @@ ---------- - :cite:`Borer2017a` : Borer, T. (2017). Private Discussion with Mansencal, T. and Shaw, N. -- :cite:`InternationalTelecommunicationUnion2016a` : International - Telecommunication Union. (2016). Recommendation ITU-R BT.2100-1 - Image +- :cite:`InternationalTelecommunicationUnion2017` : International + Telecommunication Union. (2017). Recommendation ITU-R BT.2100-1 - Image parameter values for high dynamic range television for use in production and international programme exchange. Retrieved from https://www.itu.int/dms_pubrec/itu-r/rec/bt/\ R-REC-BT.2100-1-201706-I!!PDF-E.pdf +- :cite:`InternationalTelecommunicationUnion2018` : International + Telecommunication Union. (2018). Recommendation ITU-R BT.2100-2 - Image + parameter values for high dynamic range television for use in production + and international programme exchange. Retrieved from +https://www.itu.int/dms_pubrec/itu-r/rec/bt/\ +R-REC-BT.2100-2-201807-I!!PDF-E.pdf """ from __future__ import division, unicode_literals import numpy as np +from colour.algebra import spow from colour.models.rgb.transfer_functions import ( - eotf_BT1886, eotf_ST2084, eotf_reverse_BT1886, oetf_ARIBSTDB67, oetf_BT709, - oetf_ST2084, oetf_reverse_ARIBSTDB67, oetf_reverse_BT709) + eotf_BT1886, eotf_ST2084, eotf_inverse_BT1886, oetf_ARIBSTDB67, oetf_BT709, + eotf_inverse_ST2084, oetf_inverse_ARIBSTDB67, oetf_inverse_BT709) from colour.models.rgb.transfer_functions.arib_std_b67 import ( ARIBSTDB67_CONSTANTS) -from colour.utilities import (Structure, as_float_array, as_float, - from_range_1, to_domain_1, tsplit, tstack, - usage_warning) +from colour.utilities import ( + CaseInsensitiveMapping, Structure, as_float_array, as_float, filter_kwargs, + from_range_1, to_domain_1, tsplit, tstack, usage_warning) __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -59,15 +80,21 @@ __status__ = 'Production' __all__ = [ - 'oetf_BT2100_PQ', 'oetf_reverse_BT2100_PQ', 'eotf_BT2100_PQ', - 'eotf_reverse_BT2100_PQ', 'ootf_BT2100_PQ', 'ootf_reverse_BT2100_PQ', - 'BT2100_HLG_WEIGHTS', 'BT2100_HLG_CONSTANTS', 'gamma_function_BT2100_HLG', - 'oetf_BT2100_HLG', 'oetf_reverse_BT2100_HLG', 'eotf_BT2100_HLG', - 'eotf_reverse_BT2100_HLG', 'ootf_BT2100_HLG', 'ootf_reverse_BT2100_HLG' + 'oetf_PQ_BT2100', 'oetf_inverse_PQ_BT2100', 'eotf_PQ_BT2100', + 'eotf_inverse_PQ_BT2100', 'ootf_PQ_BT2100', 'ootf_inverse_PQ_BT2100', + 'BT2100_HLG_WEIGHTS', 'BT2100_HLG_CONSTANTS', 'gamma_function_HLG_BT2100', + 'oetf_HLG_BT2100', 'oetf_inverse_HLG_BT2100', + 'black_level_lift_HLG_BT2100', 'eotf_HLG_BT2100_1', 'eotf_HLG_BT2100_2', + 'BT2100_HLG_EOTF_METHODS', 'eotf_HLG_BT2100', 'eotf_inverse_HLG_BT2100_1', + 'eotf_inverse_HLG_BT2100_2', 'BT2100_HLG_EOTF_INVERSE_METHODS', + 'eotf_inverse_HLG_BT2100', 'ootf_HLG_BT2100_1', 'ootf_HLG_BT2100_2', + 'BT2100_HLG_OOTF_METHODS', 'ootf_HLG_BT2100', 'ootf_inverse_HLG_BT2100_1', + 'ootf_inverse_HLG_BT2100_2', 'BT2100_HLG_OOTF_INVERSE_METHODS', + 'ootf_inverse_HLG_BT2100' ] -def oetf_BT2100_PQ(E): +def oetf_PQ_BT2100(E): """ Defines *Recommendation ITU-R BT.2100* *Reference PQ* opto-electrical transfer function (OETF / OECF). @@ -104,20 +131,20 @@ def oetf_BT2100_PQ(E): References ---------- - :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2016a` + :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2017` Examples -------- - >>> oetf_BT2100_PQ(0.1) # doctest: +ELLIPSIS + >>> oetf_PQ_BT2100(0.1) # doctest: +ELLIPSIS 0.7247698... """ - return oetf_ST2084(ootf_BT2100_PQ(E), 10000) + return eotf_inverse_ST2084(ootf_PQ_BT2100(E), 10000) -def oetf_reverse_BT2100_PQ(E_p): +def oetf_inverse_PQ_BT2100(E_p): """ - Defines *Recommendation ITU-R BT.2100* *Reference PQ* reverse + Defines *Recommendation ITU-R BT.2100* *Reference PQ* inverse opto-electrical transfer function (OETF / OECF). Parameters @@ -149,18 +176,18 @@ def oetf_reverse_BT2100_PQ(E_p): References ---------- - :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2016a` + :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2017` Examples -------- - >>> oetf_reverse_BT2100_PQ(0.724769816665726) # doctest: +ELLIPSIS + >>> oetf_inverse_PQ_BT2100(0.724769816665726) # doctest: +ELLIPSIS 0.0999999... """ - return ootf_reverse_BT2100_PQ(eotf_ST2084(E_p, 10000)) + return ootf_inverse_PQ_BT2100(eotf_ST2084(E_p, 10000)) -def eotf_BT2100_PQ(E_p): +def eotf_PQ_BT2100(E_p): """ Defines *Recommendation ITU-R BT.2100* *Reference PQ* electro-optical transfer function (EOTF / EOCF). @@ -197,20 +224,20 @@ def eotf_BT2100_PQ(E_p): References ---------- - :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2016a` + :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2017` Examples -------- - >>> eotf_BT2100_PQ(0.724769816665726) # doctest: +ELLIPSIS + >>> eotf_PQ_BT2100(0.724769816665726) # doctest: +ELLIPSIS 779.9883608... """ return eotf_ST2084(E_p, 10000) -def eotf_reverse_BT2100_PQ(F_D): +def eotf_inverse_PQ_BT2100(F_D): """ - Defines *Recommendation ITU-R BT.2100* *Reference PQ* reverse + Defines *Recommendation ITU-R BT.2100* *Reference PQ* inverse electro-optical transfer function (EOTF / EOCF). Parameters @@ -243,18 +270,18 @@ def eotf_reverse_BT2100_PQ(F_D): References ---------- - :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2016a` + :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2017` Examples -------- - >>> eotf_reverse_BT2100_PQ(779.988360834085370) # doctest: +ELLIPSIS + >>> eotf_inverse_PQ_BT2100(779.988360834085370) # doctest: +ELLIPSIS 0.7247698... """ - return oetf_ST2084(F_D, 10000) + return eotf_inverse_ST2084(F_D, 10000) -def ootf_BT2100_PQ(E): +def ootf_PQ_BT2100(E): """ Defines *Recommendation ITU-R BT.2100* *Reference PQ* opto-optical transfer function (OOTF / OOCF). @@ -290,11 +317,11 @@ def ootf_BT2100_PQ(E): References ---------- - :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2016a` + :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2017` Examples -------- - >>> ootf_BT2100_PQ(0.1) # doctest: +ELLIPSIS + >>> ootf_PQ_BT2100(0.1) # doctest: +ELLIPSIS 779.9883608... """ @@ -303,9 +330,9 @@ def ootf_BT2100_PQ(E): return 100 * eotf_BT1886(oetf_BT709(59.5208 * E)) -def ootf_reverse_BT2100_PQ(F_D): +def ootf_inverse_PQ_BT2100(F_D): """ - Defines *Recommendation ITU-R BT.2100* *Reference PQ* reverse opto-optical + Defines *Recommendation ITU-R BT.2100* *Reference PQ* inverse opto-optical transfer function (OOTF / OOCF). Parameters @@ -337,17 +364,17 @@ def ootf_reverse_BT2100_PQ(F_D): References ---------- - :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2016a` + :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2017` Examples -------- - >>> ootf_reverse_BT2100_PQ(779.988360834115840) # doctest: +ELLIPSIS + >>> ootf_inverse_PQ_BT2100(779.988360834115840) # doctest: +ELLIPSIS 0.1000000... """ F_D = as_float_array(F_D) - return oetf_reverse_BT709(eotf_reverse_BT1886(F_D / 100)) / 59.5208 + return oetf_inverse_BT709(eotf_inverse_BT1886(F_D / 100)) / 59.5208 BT2100_HLG_WEIGHTS = np.array([0.2627, 0.6780, 0.0593]) @@ -366,17 +393,15 @@ def ootf_reverse_BT2100_PQ(F_D): analytical form in contrast to the *ARIB STD-B67 (Hybrid Log-Gamma)* numerical reference. -Those constants are not currently in use and are provided as a reference only. - References ---------- -:cite:`InternationalTelecommunicationUnion2016a` +:cite:`InternationalTelecommunicationUnion2017` BT2100_HLG_CONSTANTS : Structure """ -def gamma_function_BT2100_HLG(L_W=1000): +def gamma_function_HLG_BT2100(L_W=1000): """ Returns the *Reference HLG* system gamma value for given display nominal peak luminance. @@ -394,11 +419,11 @@ def gamma_function_BT2100_HLG(L_W=1000): Examples -------- - >>> gamma_function_BT2100_HLG() + >>> gamma_function_HLG_BT2100() 1.2 - >>> gamma_function_BT2100_HLG(2000) # doctest: +ELLIPSIS + >>> gamma_function_HLG_BT2100(2000) # doctest: +ELLIPSIS 1.3264325... - >>> gamma_function_BT2100_HLG(4000) # doctest: +ELLIPSIS + >>> gamma_function_HLG_BT2100(4000) # doctest: +ELLIPSIS 1.4528651... """ @@ -407,7 +432,7 @@ def gamma_function_BT2100_HLG(L_W=1000): return gamma -def oetf_BT2100_HLG(E): +def oetf_HLG_BT2100(E, constants=BT2100_HLG_CONSTANTS): """ Defines *Recommendation ITU-R BT.2100* *Reference HLG* opto-electrical transfer function (OETF / OECF). @@ -421,6 +446,8 @@ def oetf_BT2100_HLG(E): :math:`E` is the signal for each colour component :math:`{R_S, G_S, B_S}` proportional to scene linear light and scaled by camera exposure. + constants : Structure, optional + *Recommendation ITU-R BT.2100* *Reference HLG* constants. Returns ------- @@ -444,26 +471,28 @@ def oetf_BT2100_HLG(E): References ---------- - :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2016a` + :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2017` Examples -------- - >>> oetf_BT2100_HLG(0.18 / 12) # doctest: +ELLIPSIS + >>> oetf_HLG_BT2100(0.18 / 12) # doctest: +ELLIPSIS 0.2121320... """ - return oetf_ARIBSTDB67(12 * E) + return oetf_ARIBSTDB67(12 * E, constants=constants) -def oetf_reverse_BT2100_HLG(E): +def oetf_inverse_HLG_BT2100(E_p, constants=BT2100_HLG_CONSTANTS): """ - Defines *Recommendation ITU-R BT.2100* *Reference HLG* reverse + Defines *Recommendation ITU-R BT.2100* *Reference HLG* inverse opto-electrical transfer function (OETF / OECF). Parameters ---------- E_p : numeric or array_like :math:`E'` is the resulting non-linear signal :math:`{R', G', B'}`. + constants : Structure, optional + *Recommendation ITU-R BT.2100* *Reference HLG* constants. Returns ------- @@ -489,18 +518,217 @@ def oetf_reverse_BT2100_HLG(E): References ---------- - :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2016a` + :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2017` Examples -------- - >>> oetf_reverse_BT2100_HLG(0.212132034355964) # doctest: +ELLIPSIS + >>> oetf_inverse_HLG_BT2100(0.212132034355964) # doctest: +ELLIPSIS 0.0149999... """ - return oetf_reverse_ARIBSTDB67(E) / 12 + return oetf_inverse_ARIBSTDB67(E_p, constants=constants) / 12 + + +def black_level_lift_HLG_BT2100(L_B=0, L_W=1000, gamma=None): + """ + Returns the *Reference HLG* black level lift :math:`\\Beta` for given + display luminance for black, nominal peak luminance and system gamma value. + + Parameters + ---------- + L_B : numeric, optional + :math:`L_B` is the display luminance for black in :math:`cd/m^2`. + L_W : numeric, optional + :math:`L_W` is nominal peak luminance of the display in :math:`cd/m^2` + for achromatic pixels. + gamma : numeric, optional + System gamma value, 1.2 at the nominal display peak luminance of + :math:`1000 cd/m^2`. + + Returns + ------- + numeric + *Reference HLG* black level lift :math:`\\Beta`. + + Examples + -------- + >>> black_level_lift_HLG_BT2100() + 0.0 + >>> black_level_lift_HLG_BT2100(0.01) # doctest: +ELLIPSIS + 0.0142964... + >>> black_level_lift_HLG_BT2100(0.001, 2000) # doctest: +ELLIPSIS + 0.0073009... + >>> black_level_lift_HLG_BT2100(0.01, gamma=1.4) # doctest: +ELLIPSIS + 0.0283691... + """ + + if gamma is None: + gamma = gamma_function_HLG_BT2100(L_W) + + beta = np.sqrt(3 * spow((L_B / L_W), 1 / gamma)) + + return beta + + +def eotf_HLG_BT2100_1(E_p, + L_B=0, + L_W=1000, + gamma=None, + constants=BT2100_HLG_CONSTANTS): + """ + Defines *Recommendation ITU-R BT.2100* *Reference HLG* electro-optical + transfer function (EOTF / EOCF) as given in *ITU-R BT.2100-1*. + + The EOTF maps the non-linear *HLG* signal into display light. + + Parameters + ---------- + E_p : numeric or array_like + :math:`E'` is the non-linear signal :math:`{R', G', B'}` as defined for + the OETF. + L_B : numeric, optional + :math:`L_B` is the display luminance for black in :math:`cd/m^2`. + L_W : numeric, optional + :math:`L_W` is nominal peak luminance of the display in :math:`cd/m^2` + for achromatic pixels. + gamma : numeric, optional + System gamma value, 1.2 at the nominal display peak luminance of + :math:`1000 cd/m^2`. + constants : Structure, optional + *Recommendation ITU-R BT.2100* *Reference HLG* constants. + + Returns + ------- + numeric or ndarray + Luminance :math:`F_D` of a displayed linear component + :math:`{R_D, G_D, B_D}` or :math:`Y_D` or :math:`I_D`, in + :math:`cd/m^2`. + + Notes + ----- + + +------------+-----------------------+---------------+ + | **Domain** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``E_p`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + +------------+-----------------------+---------------+ + | **Range** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``F_D`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + References + ---------- + :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2017` + + Examples + -------- + >>> eotf_HLG_BT2100_1(0.212132034355964) # doctest: +ELLIPSIS + 6.4760398... + >>> eotf_HLG_BT2100_1(0.212132034355964, 0.01) # doctest: +ELLIPSIS + 6.4859750... + """ + + return ootf_HLG_BT2100_1( + oetf_inverse_ARIBSTDB67(E_p, constants=constants) / 12, L_B, L_W, + gamma) + + +def eotf_HLG_BT2100_2(E_p, + L_B=0, + L_W=1000, + gamma=None, + constants=BT2100_HLG_CONSTANTS): + """ + Defines *Recommendation ITU-R BT.2100* *Reference HLG* electro-optical + transfer function (EOTF / EOCF) as given in *ITU-R BT.2100-2* with the + modified black level behaviour. + + The EOTF maps the non-linear *HLG* signal into display light. + + Parameters + ---------- + E_p : numeric or array_like + :math:`E'` is the non-linear signal :math:`{R', G', B'}` as defined for + the *HLG Reference* OETF. + L_B : numeric, optional + :math:`L_B` is the display luminance for black in :math:`cd/m^2`. + L_W : numeric, optional + :math:`L_W` is nominal peak luminance of the display in :math:`cd/m^2` + for achromatic pixels. + gamma : numeric, optional + System gamma value, 1.2 at the nominal display peak luminance of + :math:`1000 cd/m^2`. + constants : Structure, optional + *Recommendation ITU-R BT.2100* *Reference HLG* constants. + + Returns + ------- + numeric or ndarray + Luminance :math:`F_D` of a displayed linear component + :math:`{R_D, G_D, B_D}` or :math:`Y_D` or :math:`I_D`, in + :math:`cd/m^2`. + + Notes + ----- + + +------------+-----------------------+---------------+ + | **Domain** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``E_p`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + +------------+-----------------------+---------------+ + | **Range** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``F_D`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + References + ---------- + :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2018` + + Examples + -------- + >>> eotf_HLG_BT2100_2(0.212132034355964) # doctest: +ELLIPSIS + 6.4760398... + >>> eotf_HLG_BT2100_2(0.212132034355964, 0.01) # doctest: +ELLIPSIS + 7.3321975... + """ + + beta = black_level_lift_HLG_BT2100(L_B, L_W, gamma) + + return ootf_HLG_BT2100_2( + oetf_inverse_ARIBSTDB67( + (1 - beta) * E_p + beta, constants=constants) / 12, L_W, gamma) -def eotf_BT2100_HLG(E_p, L_B=0, L_W=1000, gamma=None): +BT2100_HLG_EOTF_METHODS = CaseInsensitiveMapping({ + 'ITU-R BT.2100-1': eotf_HLG_BT2100_1, + 'ITU-R BT.2100-2': eotf_HLG_BT2100_2, +}) +BT2100_HLG_EOTF_METHODS.__doc__ = """ +Supported *Recommendation ITU-R BT.2100* *Reference HLG* electro-optical +transfer function (EOTF / EOCF). + +References +---------- +:cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2017`, +:cite:`InternationalTelecommunicationUnion2018` + +BT2100_HLG_EOTF_METHODS : CaseInsensitiveMapping + **{'ITU-R BT.2100-1', 'ITU-R BT.2100-2'}** +""" + + +def eotf_HLG_BT2100(E_p, + L_B=0, + L_W=1000, + gamma=None, + constants=BT2100_HLG_CONSTANTS, + method='ITU-R BT.2100-2'): """ Defines *Recommendation ITU-R BT.2100* *Reference HLG* electro-optical transfer function (EOTF / EOCF). @@ -520,6 +748,11 @@ def eotf_BT2100_HLG(E_p, L_B=0, L_W=1000, gamma=None): gamma : numeric, optional System gamma value, 1.2 at the nominal display peak luminance of :math:`1000 cd/m^2`. + constants : Structure, optional + *Recommendation ITU-R BT.2100* *Reference HLG* constants. + method : unicode, optional + **{'ITU-R BT.2100-1', 'ITU-R BT.2100-2'}**, + Computation method. Returns ------- @@ -545,21 +778,33 @@ def eotf_BT2100_HLG(E_p, L_B=0, L_W=1000, gamma=None): References ---------- - :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2016a` + :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2017`, + :cite:`InternationalTelecommunicationUnion2018` Examples -------- - >>> eotf_BT2100_HLG(0.212132034355964) # doctest: +ELLIPSIS + >>> eotf_HLG_BT2100(0.212132034355964) # doctest: +ELLIPSIS + 6.4760398... + >>> eotf_HLG_BT2100(0.212132034355964, method='ITU-R BT.2100-1') + ... # doctest: +ELLIPSIS 6.4760398... + >>> eotf_HLG_BT2100(0.212132034355964, 0.01) + ... # doctest: +ELLIPSIS + 7.3321975... """ - return ootf_BT2100_HLG(oetf_reverse_ARIBSTDB67(E_p) / 12, L_B, L_W, gamma) + return BT2100_HLG_EOTF_METHODS[method](E_p, L_B, L_W, gamma, constants) -def eotf_reverse_BT2100_HLG(F_D, L_B=0, L_W=1000, gamma=None): +def eotf_inverse_HLG_BT2100_1(F_D, + L_B=0, + L_W=1000, + gamma=None, + constants=BT2100_HLG_CONSTANTS): """ - Defines *Recommendation ITU-R BT.2100* *Reference HLG* reverse - electro-optical transfer function (EOTF / EOCF). + Defines *Recommendation ITU-R BT.2100* *Reference HLG* inverse + electro-optical transfer function (EOTF / EOCF) as given in + *ITU-R BT.2100-1*. Parameters ---------- @@ -575,6 +820,8 @@ def eotf_reverse_BT2100_HLG(F_D, L_B=0, L_W=1000, gamma=None): gamma : numeric, optional System gamma value, 1.2 at the nominal display peak luminance of :math:`1000 cd/m^2`. + constants : Structure, optional + *Recommendation ITU-R BT.2100* *Reference HLG* constants. Returns ------- @@ -599,30 +846,38 @@ def eotf_reverse_BT2100_HLG(F_D, L_B=0, L_W=1000, gamma=None): References ---------- - :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2016a` + :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2017` Examples -------- - >>> eotf_reverse_BT2100_HLG(6.476039825649814) # doctest: +ELLIPSIS + >>> eotf_inverse_HLG_BT2100_1(6.476039825649814) # doctest: +ELLIPSIS + 0.2121320... + >>> eotf_inverse_HLG_BT2100_1(6.485975065251558, 0.01) + ... # doctest: +ELLIPSIS 0.2121320... """ - return oetf_ARIBSTDB67(ootf_reverse_BT2100_HLG(F_D, L_B, L_W, gamma) * 12) + return oetf_ARIBSTDB67( + ootf_inverse_HLG_BT2100_1(F_D, L_B, L_W, gamma) * 12, + constants=constants) -def ootf_BT2100_HLG(E, L_B=0, L_W=1000, gamma=None): +def eotf_inverse_HLG_BT2100_2(F_D, + L_B=0, + L_W=1000, + gamma=None, + constants=BT2100_HLG_CONSTANTS): """ - Defines *Recommendation ITU-R BT.2100* *Reference HLG* opto-optical - transfer function (OOTF / OOCF). - - The OOTF maps relative scene linear light to display linear light. + Defines *Recommendation ITU-R BT.2100* *Reference HLG* inverse + electro-optical transfer function (EOTF / EOCF) as given in + *ITU-R BT.2100-2* with the modified black level behaviour. Parameters ---------- - E : numeric or array_like - :math:`E` is the signal for each colour component - :math:`{R_S, G_S, B_S}` proportional to scene linear light and scaled - by camera exposure. + F_D : numeric or array_like + Luminance :math:`F_D` of a displayed linear component + :math:`{R_D, G_D, B_D}` or :math:`Y_D` or :math:`I_D`, in + :math:`cd/m^2`. L_B : numeric, optional :math:`L_B` is the display luminance for black in :math:`cd/m^2`. L_W : numeric, optional @@ -631,12 +886,14 @@ def ootf_BT2100_HLG(E, L_B=0, L_W=1000, gamma=None): gamma : numeric, optional System gamma value, 1.2 at the nominal display peak luminance of :math:`1000 cd/m^2`. + constants : Structure, optional + *Recommendation ITU-R BT.2100* *Reference HLG* constants. Returns ------- numeric or ndarray - :math:`F_D` is the luminance of a displayed linear component - :math:`{R_D, G_D, or B_D}`, in :math:`cd/m^2`. + :math:`E'` denotes a non-linear colour value :math:`{R', G', B'}` or + :math:`{L', M', S'}` in *HLG* space. Notes ----- @@ -644,67 +901,69 @@ def ootf_BT2100_HLG(E, L_B=0, L_W=1000, gamma=None): +------------+-----------------------+---------------+ | **Domain** | **Scale - Reference** | **Scale - 1** | +============+=======================+===============+ - | ``E`` | [0, 1] | [0, 1] | + | ``F_D`` | [0, 1] | [0, 1] | +------------+-----------------------+---------------+ +------------+-----------------------+---------------+ | **Range** | **Scale - Reference** | **Scale - 1** | +============+=======================+===============+ - | ``F_D`` | [0, 1] | [0, 1] | + | ``E_p`` | [0, 1] | [0, 1] | +------------+-----------------------+---------------+ References ---------- - :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2016a` + :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2018` Examples -------- - >>> ootf_BT2100_HLG(0.1) # doctest: +ELLIPSIS - 63.0957344... + >>> eotf_inverse_HLG_BT2100_2(6.476039825649814) # doctest: +ELLIPSIS + 0.2121320... + >>> eotf_inverse_HLG_BT2100_2(7.332197528353875, 0.01) + ... # doctest: +ELLIPSIS + 0.2121320... """ - E = np.atleast_1d(to_domain_1(E)) - - if E.shape[-1] != 3: - usage_warning( - '"Recommendation ITU-R BT.2100" "Reference HLG OOTF" uses ' - 'RGB Luminance in computations and expects a vector input, thus ' - 'the given input array will be stacked to compose a vector for ' - 'internal computations but a single component will be output.') - R_S = G_S = B_S = E - else: - R_S, G_S, B_S = tsplit(E) - - alpha = L_W - L_B - beta = L_B + beta = black_level_lift_HLG_BT2100(L_B, L_W, gamma) - Y_S = np.sum(BT2100_HLG_WEIGHTS * tstack([R_S, G_S, B_S]), axis=-1) + return (oetf_ARIBSTDB67( + ootf_inverse_HLG_BT2100_2(F_D, L_W, gamma) * 12, constants=constants) - + beta) / (1 - beta) - if gamma is None: - gamma = gamma_function_BT2100_HLG(L_W) - R_D = alpha * R_S * np.abs(Y_S) ** (gamma - 1) + beta - G_D = alpha * G_S * np.abs(Y_S) ** (gamma - 1) + beta - B_D = alpha * B_S * np.abs(Y_S) ** (gamma - 1) + beta +BT2100_HLG_EOTF_INVERSE_METHODS = CaseInsensitiveMapping({ + 'ITU-R BT.2100-1': eotf_inverse_HLG_BT2100_1, + 'ITU-R BT.2100-2': eotf_inverse_HLG_BT2100_2, +}) +BT2100_HLG_EOTF_INVERSE_METHODS.__doc__ = """ +Supported *Recommendation ITU-R BT.2100* *Reference HLG* inverse +electro-optical transfer function (EOTF / EOCF). - if E.shape[-1] != 3: - return as_float(from_range_1(R_D)) - else: - RGB_D = tstack([R_D, G_D, B_D]) +References +---------- +:cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2017`, +:cite:`InternationalTelecommunicationUnion2018` - return from_range_1(RGB_D) +BT2100_HLG_EOTF_INVERSE_METHODS : CaseInsensitiveMapping + **{'ITU-R BT.2100-1', 'ITU-R BT.2100-2'}** +""" -def ootf_reverse_BT2100_HLG(F_D, L_B=0, L_W=1000, gamma=None): +def eotf_inverse_HLG_BT2100(F_D, + L_B=0, + L_W=1000, + gamma=None, + constants=BT2100_HLG_CONSTANTS, + method='ITU-R BT.2100-2'): """ - Defines *Recommendation ITU-R BT.2100* *Reference HLG* reverse opto-optical - transfer function (OOTF / OOCF). + Defines *Recommendation ITU-R BT.2100* *Reference HLG* inverse + electro-optical transfer function (EOTF / EOCF). Parameters ---------- F_D : numeric or array_like - :math:`F_D` is the luminance of a displayed linear component - :math:`{R_D, G_D, or B_D}`, in :math:`cd/m^2`. + Luminance :math:`F_D` of a displayed linear component + :math:`{R_D, G_D, B_D}` or :math:`Y_D` or :math:`I_D`, in + :math:`cd/m^2`. L_B : numeric, optional :math:`L_B` is the display luminance for black in :math:`cd/m^2`. L_W : numeric, optional @@ -713,13 +972,17 @@ def ootf_reverse_BT2100_HLG(F_D, L_B=0, L_W=1000, gamma=None): gamma : numeric, optional System gamma value, 1.2 at the nominal display peak luminance of :math:`1000 cd/m^2`. + constants : Structure, optional + *Recommendation ITU-R BT.2100* *Reference HLG* constants. + method : unicode, optional + **{'ITU-R BT.2100-1', 'ITU-R BT.2100-2'}**, + Computation method. Returns ------- numeric or ndarray - :math:`E` is the signal for each colour component - :math:`{R_S, G_S, B_S}` proportional to scene linear light and scaled - by camera exposure. + :math:`E'` denotes a non-linear colour value :math:`{R', G', B'}` or + :math:`{L', M', S'}` in *HLG* space. Notes ----- @@ -733,57 +996,378 @@ def ootf_reverse_BT2100_HLG(F_D, L_B=0, L_W=1000, gamma=None): +------------+-----------------------+---------------+ | **Range** | **Scale - Reference** | **Scale - 1** | +============+=======================+===============+ - | ``E`` | [0, 1] | [0, 1] | + | ``E_p`` | [0, 1] | [0, 1] | +------------+-----------------------+---------------+ References ---------- - :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2016a` + :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2017`, + :cite:`InternationalTelecommunicationUnion2018` Examples -------- - >>> ootf_reverse_BT2100_HLG(63.095734448019336) # doctest: +ELLIPSIS - 0.1000000... + >>> eotf_inverse_HLG_BT2100(6.476039825649814) # doctest: +ELLIPSIS + 0.2121320... + >>> eotf_inverse_HLG_BT2100(6.476039825649814, method='ITU-R BT.2100-1') + ... # doctest: +ELLIPSIS + 0.2121320... + >>> eotf_inverse_HLG_BT2100(7.332197528353875, 0.01) # doctest: +ELLIPSIS + 0.2121320... """ - F_D = np.atleast_1d(to_domain_1(F_D)) - - if F_D.shape[-1] != 3: - usage_warning( - '"Recommendation ITU-R BT.2100" "Reference HLG OOTF" uses ' - 'RGB Luminance in computations and expects a vector input, thus ' - 'the given input array will be stacked to compose a vector for ' - 'internal computations but a single component will be output.') - R_D = G_D = B_D = F_D - else: - R_D, G_D, B_D = tsplit(F_D) + return BT2100_HLG_EOTF_INVERSE_METHODS[method](F_D, L_B, L_W, gamma, + constants) - Y_D = np.sum(BT2100_HLG_WEIGHTS * tstack([R_D, G_D, B_D]), axis=-1) - alpha = L_W - L_B - beta = L_B +def ootf_HLG_BT2100_1(E, L_B=0, L_W=1000, gamma=None): + """ + Defines *Recommendation ITU-R BT.2100* *Reference HLG* opto-optical + transfer function (OOTF / OOCF) as given in *ITU-R BT.2100-1*. - if gamma is None: - gamma = gamma_function_BT2100_HLG(L_W) + The OOTF maps relative scene linear light to display linear light. - R_S = np.where( - Y_D == beta, - 0.0, - (np.abs((Y_D - beta) / alpha) ** - ((1 - gamma) / gamma)) * (R_D - beta) / alpha, - ) - G_S = np.where( - Y_D == beta, - 0.0, - (np.abs((Y_D - beta) / alpha) ** - ((1 - gamma) / gamma)) * (G_D - beta) / alpha, - ) - B_S = np.where( - Y_D == beta, - 0.0, - (np.abs((Y_D - beta) / alpha) ** - ((1 - gamma) / gamma)) * (B_D - beta) / alpha, - ) + Parameters + ---------- + E : numeric or array_like + :math:`E` is the signal for each colour component + :math:`{R_S, G_S, B_S}` proportional to scene linear light and scaled + by camera exposure. + L_B : numeric, optional + :math:`L_B` is the display luminance for black in :math:`cd/m^2`. + L_W : numeric, optional + :math:`L_W` is nominal peak luminance of the display in :math:`cd/m^2` + for achromatic pixels. + gamma : numeric, optional + System gamma value, 1.2 at the nominal display peak luminance of + :math:`1000 cd/m^2`. + + Returns + ------- + numeric or ndarray + :math:`F_D` is the luminance of a displayed linear component + :math:`{R_D, G_D, or B_D}`, in :math:`cd/m^2`. + + Notes + ----- + + +------------+-----------------------+---------------+ + | **Domain** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``E`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + +------------+-----------------------+---------------+ + | **Range** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``F_D`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + References + ---------- + :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2017` + + Examples + -------- + >>> ootf_HLG_BT2100_1(0.1) # doctest: +ELLIPSIS + 63.0957344... + >>> ootf_HLG_BT2100_1(0.1, 0.01) + ... # doctest: +ELLIPSIS + 63.1051034... + """ + + E = np.atleast_1d(to_domain_1(E)) + + if E.shape[-1] != 3: + usage_warning( + '"Recommendation ITU-R BT.2100" "Reference HLG OOTF" uses ' + 'RGB Luminance in computations and expects a vector input, thus ' + 'the given input array will be stacked to compose a vector for ' + 'internal computations but a single component will be output.') + R_S = G_S = B_S = E + else: + R_S, G_S, B_S = tsplit(E) + + alpha = L_W - L_B + beta = L_B + + Y_S = np.sum(BT2100_HLG_WEIGHTS * tstack([R_S, G_S, B_S]), axis=-1) + + if gamma is None: + gamma = gamma_function_HLG_BT2100(L_W) + + R_D = alpha * R_S * np.abs(Y_S) ** (gamma - 1) + beta + G_D = alpha * G_S * np.abs(Y_S) ** (gamma - 1) + beta + B_D = alpha * B_S * np.abs(Y_S) ** (gamma - 1) + beta + + if E.shape[-1] != 3: + return as_float(from_range_1(R_D)) + else: + RGB_D = tstack([R_D, G_D, B_D]) + + return from_range_1(RGB_D) + + +def ootf_HLG_BT2100_2(E, L_W=1000, gamma=None): + """ + Defines *Recommendation ITU-R BT.2100* *Reference HLG* opto-optical + transfer function (OOTF / OOCF) as given in *ITU-R BT.2100-2*. + + The OOTF maps relative scene linear light to display linear light. + + Parameters + ---------- + E : numeric or array_like + :math:`E` is the signal for each colour component + :math:`{R_S, G_S, B_S}` proportional to scene linear light and scaled + by camera exposure. + L_W : numeric, optional + :math:`L_W` is nominal peak luminance of the display in :math:`cd/m^2` + for achromatic pixels. + gamma : numeric, optional + System gamma value, 1.2 at the nominal display peak luminance of + :math:`1000 cd/m^2`. + + Returns + ------- + numeric or ndarray + :math:`F_D` is the luminance of a displayed linear component + :math:`{R_D, G_D, or B_D}`, in :math:`cd/m^2`. + + Notes + ----- + + +------------+-----------------------+---------------+ + | **Domain** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``E`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + +------------+-----------------------+---------------+ + | **Range** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``F_D`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + References + ---------- + :cite:`InternationalTelecommunicationUnion2018` + + Examples + -------- + >>> ootf_HLG_BT2100_2(0.1) # doctest: +ELLIPSIS + 63.0957344... + """ + + E = np.atleast_1d(to_domain_1(E)) + + if E.shape[-1] != 3: + usage_warning( + '"Recommendation ITU-R BT.2100" "Reference HLG OOTF" uses ' + 'RGB Luminance in computations and expects a vector input, thus ' + 'the given input array will be stacked to compose a vector for ' + 'internal computations but a single component will be output.') + R_S = G_S = B_S = E + else: + R_S, G_S, B_S = tsplit(E) + + alpha = L_W + + Y_S = np.sum(BT2100_HLG_WEIGHTS * tstack([R_S, G_S, B_S]), axis=-1) + + if gamma is None: + gamma = gamma_function_HLG_BT2100(L_W) + + R_D = alpha * R_S * np.abs(Y_S) ** (gamma - 1) + G_D = alpha * G_S * np.abs(Y_S) ** (gamma - 1) + B_D = alpha * B_S * np.abs(Y_S) ** (gamma - 1) + + if E.shape[-1] != 3: + return as_float(from_range_1(R_D)) + else: + RGB_D = tstack([R_D, G_D, B_D]) + + return from_range_1(RGB_D) + + +BT2100_HLG_OOTF_METHODS = CaseInsensitiveMapping({ + 'ITU-R BT.2100-1': ootf_HLG_BT2100_1, + 'ITU-R BT.2100-2': ootf_HLG_BT2100_2, +}) +BT2100_HLG_OOTF_METHODS.__doc__ = """ +Supported *Recommendation ITU-R BT.2100* *Reference HLG* opto-optical transfer +function (OOTF / OOCF). + +References +---------- +:cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2017`, +:cite:`InternationalTelecommunicationUnion2018` + +BT2100_HLG_OOTF_METHODS : CaseInsensitiveMapping + **{'ITU-R BT.2100-1', 'ITU-R BT.2100-2'}** +""" + + +def ootf_HLG_BT2100(E, L_B=0, L_W=1000, gamma=None, method='ITU-R BT.2100-2'): + """ + Defines *Recommendation ITU-R BT.2100* *Reference HLG* opto-optical + transfer function (OOTF / OOCF). + + The OOTF maps relative scene linear light to display linear light. + + Parameters + ---------- + E : numeric or array_like + :math:`E` is the signal for each colour component + :math:`{R_S, G_S, B_S}` proportional to scene linear light and scaled + by camera exposure. + L_B : numeric, optional + :math:`L_B` is the display luminance for black in :math:`cd/m^2`. + L_W : numeric, optional + :math:`L_W` is nominal peak luminance of the display in :math:`cd/m^2` + for achromatic pixels. + gamma : numeric, optional + System gamma value, 1.2 at the nominal display peak luminance of + :math:`1000 cd/m^2`. + method : unicode, optional + **{'ITU-R BT.2100-1', 'ITU-R BT.2100-2'}**, + Computation method. + + Returns + ------- + numeric or ndarray + :math:`F_D` is the luminance of a displayed linear component + :math:`{R_D, G_D, or B_D}`, in :math:`cd/m^2`. + + Notes + ----- + + +------------+-----------------------+---------------+ + | **Domain** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``E`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + +------------+-----------------------+---------------+ + | **Range** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``F_D`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + References + ---------- + :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2017` + + Examples + -------- + >>> ootf_HLG_BT2100(0.1) # doctest: +ELLIPSIS + 63.0957344... + >>> ootf_HLG_BT2100(0.1, 0.01, method='ITU-R BT.2100-1') + ... # doctest: +ELLIPSIS + 63.1051034... + """ + + function = BT2100_HLG_OOTF_METHODS[method] + + return function( + E, **filter_kwargs(function, **{ + 'L_B': L_B, + 'L_W': L_W, + 'gamma': gamma + })) + + +def ootf_inverse_HLG_BT2100_1(F_D, L_B=0, L_W=1000, gamma=None): + """ + Defines *Recommendation ITU-R BT.2100* *Reference HLG* inverse opto-optical + transfer function (OOTF / OOCF) as given in *ITU-R BT.2100-1*. + + Parameters + ---------- + F_D : numeric or array_like + :math:`F_D` is the luminance of a displayed linear component + :math:`{R_D, G_D, or B_D}`, in :math:`cd/m^2`. + L_B : numeric, optional + :math:`L_B` is the display luminance for black in :math:`cd/m^2`. + L_W : numeric, optional + :math:`L_W` is nominal peak luminance of the display in :math:`cd/m^2` + for achromatic pixels. + gamma : numeric, optional + System gamma value, 1.2 at the nominal display peak luminance of + :math:`1000 cd/m^2`. + + Returns + ------- + numeric or ndarray + :math:`E` is the signal for each colour component + :math:`{R_S, G_S, B_S}` proportional to scene linear light and scaled + by camera exposure. + + Notes + ----- + + +------------+-----------------------+---------------+ + | **Domain** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``F_D`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + +------------+-----------------------+---------------+ + | **Range** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``E`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + References + ---------- + :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2017` + + Examples + -------- + >>> ootf_inverse_HLG_BT2100_1(63.095734448019336) # doctest: +ELLIPSIS + 0.1000000... + >>> ootf_inverse_HLG_BT2100_1(63.105103490674857, 0.01) + ... # doctest: +ELLIPSIS + 0.0999999... + """ + + F_D = np.atleast_1d(to_domain_1(F_D)) + + if F_D.shape[-1] != 3: + usage_warning( + '"Recommendation ITU-R BT.2100" "Reference HLG OOTF" uses ' + 'RGB Luminance in computations and expects a vector input, thus ' + 'the given input array will be stacked to compose a vector for ' + 'internal computations but a single component will be output.') + R_D = G_D = B_D = F_D + else: + R_D, G_D, B_D = tsplit(F_D) + + Y_D = np.sum(BT2100_HLG_WEIGHTS * tstack([R_D, G_D, B_D]), axis=-1) + + alpha = L_W - L_B + beta = L_B + + if gamma is None: + gamma = gamma_function_HLG_BT2100(L_W) + + R_S = np.where( + Y_D == beta, + 0.0, + (np.abs((Y_D - beta) / alpha) ** + ((1 - gamma) / gamma)) * (R_D - beta) / alpha, + ) + G_S = np.where( + Y_D == beta, + 0.0, + (np.abs((Y_D - beta) / alpha) ** + ((1 - gamma) / gamma)) * (G_D - beta) / alpha, + ) + B_S = np.where( + Y_D == beta, + 0.0, + (np.abs((Y_D - beta) / alpha) ** + ((1 - gamma) / gamma)) * (B_D - beta) / alpha, + ) if F_D.shape[-1] != 3: return as_float(from_range_1(R_S)) @@ -791,3 +1375,187 @@ def ootf_reverse_BT2100_HLG(F_D, L_B=0, L_W=1000, gamma=None): RGB_S = tstack([R_S, G_S, B_S]) return from_range_1(RGB_S) + + +def ootf_inverse_HLG_BT2100_2(F_D, L_W=1000, gamma=None): + """ + Defines *Recommendation ITU-R BT.2100* *Reference HLG* inverse opto-optical + transfer function (OOTF / OOCF) as given in *ITU-R BT.2100-2*. + + Parameters + ---------- + F_D : numeric or array_like + :math:`F_D` is the luminance of a displayed linear component + :math:`{R_D, G_D, or B_D}`, in :math:`cd/m^2`. + L_W : numeric, optional + :math:`L_W` is nominal peak luminance of the display in :math:`cd/m^2` + for achromatic pixels. + gamma : numeric, optional + System gamma value, 1.2 at the nominal display peak luminance of + :math:`1000 cd/m^2`. + + Returns + ------- + numeric or ndarray + :math:`E` is the signal for each colour component + :math:`{R_S, G_S, B_S}` proportional to scene linear light and scaled + by camera exposure. + + Notes + ----- + + +------------+-----------------------+---------------+ + | **Domain** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``F_D`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + +------------+-----------------------+---------------+ + | **Range** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``E`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + References + ---------- + :cite:`InternationalTelecommunicationUnion2018` + + Examples + -------- + >>> ootf_inverse_HLG_BT2100_2(63.095734448019336) # doctest: +ELLIPSIS + 0.1000000... + """ + + F_D = np.atleast_1d(to_domain_1(F_D)) + + if F_D.shape[-1] != 3: + usage_warning( + '"Recommendation ITU-R BT.2100" "Reference HLG OOTF" uses ' + 'RGB Luminance in computations and expects a vector input, thus ' + 'the given input array will be stacked to compose a vector for ' + 'internal computations but a single component will be output.') + R_D = G_D = B_D = F_D + else: + R_D, G_D, B_D = tsplit(F_D) + + Y_D = np.sum(BT2100_HLG_WEIGHTS * tstack([R_D, G_D, B_D]), axis=-1) + + alpha = L_W + + if gamma is None: + gamma = gamma_function_HLG_BT2100(L_W) + + R_S = np.where( + Y_D == 0, + 0.0, + (np.abs(Y_D / alpha) ** ((1 - gamma) / gamma)) * R_D / alpha, + ) + G_S = np.where( + Y_D == 0, + 0.0, + (np.abs(Y_D / alpha) ** ((1 - gamma) / gamma)) * G_D / alpha, + ) + B_S = np.where( + Y_D == 0, + 0.0, + (np.abs(Y_D / alpha) ** ((1 - gamma) / gamma)) * B_D / alpha, + ) + + if F_D.shape[-1] != 3: + return as_float(from_range_1(R_S)) + else: + RGB_S = tstack([R_S, G_S, B_S]) + + return from_range_1(RGB_S) + + +BT2100_HLG_OOTF_INVERSE_METHODS = CaseInsensitiveMapping({ + 'ITU-R BT.2100-1': ootf_inverse_HLG_BT2100_1, + 'ITU-R BT.2100-2': ootf_inverse_HLG_BT2100_2, +}) +BT2100_HLG_OOTF_INVERSE_METHODS.__doc__ = """ +Supported *Recommendation ITU-R BT.2100* *Reference HLG* inverse opto-optical +transfer function (OOTF / OOCF). + +References +---------- +:cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2017`, +:cite:`InternationalTelecommunicationUnion2018` + +BT2100_HLG_OOTF_INVERSE_METHODS : CaseInsensitiveMapping + **{'ITU-R BT.2100-1', 'ITU-R BT.2100-2'}** +""" + + +def ootf_inverse_HLG_BT2100(F_D, + L_B=0, + L_W=1000, + gamma=None, + method='ITU-R BT.2100-2'): + """ + Defines *Recommendation ITU-R BT.2100* *Reference HLG* inverse opto-optical + transfer function (OOTF / OOCF). + + Parameters + ---------- + F_D : numeric or array_like + :math:`F_D` is the luminance of a displayed linear component + :math:`{R_D, G_D, or B_D}`, in :math:`cd/m^2`. + L_B : numeric, optional + :math:`L_B` is the display luminance for black in :math:`cd/m^2`. + L_W : numeric, optional + :math:`L_W` is nominal peak luminance of the display in :math:`cd/m^2` + for achromatic pixels. + gamma : numeric, optional + System gamma value, 1.2 at the nominal display peak luminance of + :math:`1000 cd/m^2`. + method : unicode, optional + **{'ITU-R BT.2100-1', 'ITU-R BT.2100-2'}**, + Computation method. + + Returns + ------- + numeric or ndarray + :math:`E` is the signal for each colour component + :math:`{R_S, G_S, B_S}` proportional to scene linear light and scaled + by camera exposure. + + Notes + ----- + + +------------+-----------------------+---------------+ + | **Domain** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``F_D`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + +------------+-----------------------+---------------+ + | **Range** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``E`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + References + ---------- + :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2017`, + :cite:`InternationalTelecommunicationUnion2018` + + Examples + -------- + >>> ootf_inverse_HLG_BT2100(63.095734448019336) # doctest: +ELLIPSIS + 0.1000000... + >>> ootf_inverse_HLG_BT2100( + ... 63.105103490674857, 0.01, method='ITU-R BT.2100-1') + ... # doctest: +ELLIPSIS + 0.0999999... + """ + + function = BT2100_HLG_OOTF_INVERSE_METHODS[method] + + return function( + F_D, + **filter_kwargs(function, **{ + 'L_B': L_B, + 'L_W': L_W, + 'gamma': gamma + })) diff --git a/colour/models/rgb/transfer_functions/itur_bt_601.py b/colour/models/rgb/transfer_functions/itur_bt_601.py index d984126773..c2f08389d5 100644 --- a/colour/models/rgb/transfer_functions/itur_bt_601.py +++ b/colour/models/rgb/transfer_functions/itur_bt_601.py @@ -4,10 +4,10 @@ ============== Defines *ITU-R BT.601-7* opto-electrical transfer function (OETF / OECF) and -its reverse: +its inverse: - :func:`colour.models.oetf_BT601` -- :func:`colour.models.oetf_reverse_BT601` +- :func:`colour.models.oetf_inverse_BT601` See Also -------- @@ -40,7 +40,7 @@ __email__ = 'colour-science@googlegroups.com' __status__ = 'Production' -__all__ = ['oetf_BT601', 'oetf_reverse_BT601'] +__all__ = ['oetf_BT601', 'oetf_inverse_BT601'] def oetf_BT601(L): @@ -90,9 +90,9 @@ def oetf_BT601(L): return as_float(from_range_1(E)) -def oetf_reverse_BT601(E): +def oetf_inverse_BT601(E): """ - Defines *Recommendation ITU-R BT.601-7* reverse opto-electronic transfer + Defines *Recommendation ITU-R BT.601-7* inverse opto-electronic transfer function (OETF / OECF). Parameters @@ -126,7 +126,7 @@ def oetf_reverse_BT601(E): Examples -------- - >>> oetf_reverse_BT601(0.409007728864150) # doctest: +ELLIPSIS + >>> oetf_inverse_BT601(0.409007728864150) # doctest: +ELLIPSIS 0.1... """ diff --git a/colour/models/rgb/transfer_functions/itur_bt_709.py b/colour/models/rgb/transfer_functions/itur_bt_709.py index 688d566334..a96179ae30 100644 --- a/colour/models/rgb/transfer_functions/itur_bt_709.py +++ b/colour/models/rgb/transfer_functions/itur_bt_709.py @@ -4,10 +4,10 @@ ============== Defines *ITU-R BT.709-6* opto-electrical transfer function (OETF / OECF) and -its reverse: +its inverse: - :func:`colour.models.oetf_BT709` -- :func:`colour.models.oetf_reverse_BT709` +- :func:`colour.models.oetf_inverse_BT709` See Also -------- @@ -27,7 +27,7 @@ from __future__ import division, unicode_literals -from colour.models.rgb.transfer_functions import oetf_BT601, oetf_reverse_BT601 +from colour.models.rgb.transfer_functions import oetf_BT601, oetf_inverse_BT601 __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -36,7 +36,7 @@ __email__ = 'colour-science@googlegroups.com' __status__ = 'Production' -__all__ = ['oetf_BT709', 'oetf_reverse_BT709'] +__all__ = ['oetf_BT709', 'oetf_inverse_BT709'] def oetf_BT709(L): @@ -82,9 +82,9 @@ def oetf_BT709(L): return oetf_BT601(L) -def oetf_reverse_BT709(V): +def oetf_inverse_BT709(V): """ - Defines *Recommendation ITU-R BT.709-6* reverse opto-electronic transfer + Defines *Recommendation ITU-R BT.709-6* inverse opto-electronic transfer function (OETF / OECF). Parameters @@ -118,8 +118,8 @@ def oetf_reverse_BT709(V): Examples -------- - >>> oetf_reverse_BT709(0.409007728864150) # doctest: +ELLIPSIS + >>> oetf_inverse_BT709(0.409007728864150) # doctest: +ELLIPSIS 0.1... """ - return oetf_reverse_BT601(V) + return oetf_inverse_BT601(V) diff --git a/colour/models/rgb/transfer_functions/panasonic_vlog.py b/colour/models/rgb/transfer_functions/panasonic_vlog.py index 249f98db11..8b2e78b3f8 100644 --- a/colour/models/rgb/transfer_functions/panasonic_vlog.py +++ b/colour/models/rgb/transfer_functions/panasonic_vlog.py @@ -27,6 +27,7 @@ from colour.models.rgb.transfer_functions import full_to_legal, legal_to_full from colour.utilities import Structure, as_float, from_range_1, to_domain_1 +from colour.utilities.deprecation import handle_arguments_deprecation __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -48,9 +49,10 @@ def log_encoding_VLog(L_in, bit_depth=10, - out_legal=True, + out_normalised_code_value=True, in_reflection=True, - constants=VLOG_CONSTANTS): + constants=VLOG_CONSTANTS, + **kwargs): """ Defines the *Panasonic V-Log* log encoding curve / opto-electronic transfer function. @@ -61,14 +63,19 @@ def log_encoding_VLog(L_in, Linear reflection data :math`L_{in}`. bit_depth : int, optional Bit depth used for conversion. - out_legal : bool, optional + out_normalised_code_value : bool, optional Whether the non-linear *Panasonic V-Log* data :math:`V_{out}` is - encoded in legal range. + encoded as normalised code values. in_reflection : bool, optional Whether the light level :math`L_{in}` to a camera is reflection. constants : Structure, optional *Panasonic V-Log* constants. + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments for deprecation management. + Returns ------- numeric or ndarray @@ -97,8 +104,27 @@ def log_encoding_VLog(L_in, -------- >>> log_encoding_VLog(0.18) # doctest: +ELLIPSIS 0.4233114... + + The values of *Fig.2.2 V-Log Code Value* table in :cite:`Panasonic2014a` + are obtained as follows: + + >>> L_in = np.array([0, 18, 90]) / 100 + >>> np.around(log_encoding_VLog(L_in, 10, False) * 100).astype(np.int) + array([ 7, 42, 61]) + >>> np.around(log_encoding_VLog(L_in) * (2 ** 10 - 1)).astype(np.int) + array([128, 433, 602]) + >>> np.around(log_encoding_VLog(L_in) * (2 ** 12 - 1)).astype(np.int) + array([ 512, 1733, 2409]) + + Note that some values in the last column values of + *Fig.2.2 V-Log Code Value* table in :cite:`Panasonic2014a` are different + by a code: [512, 1732, 2408]. """ + out_normalised_code_value = handle_arguments_deprecation({ + 'ArgumentRenamed': [['out_legal', 'out_normalised_code_value']], + }, **kwargs).get('out_normalised_code_value', out_normalised_code_value) + L_in = to_domain_1(L_in) if not in_reflection: @@ -115,16 +141,18 @@ def log_encoding_VLog(L_in, c * np.log10(L_in + b) + d, ) - V_out = V_out if out_legal else legal_to_full(V_out, bit_depth) + V_out = (V_out + if out_normalised_code_value else legal_to_full(V_out, bit_depth)) return as_float(from_range_1(V_out)) def log_decoding_VLog(V_out, bit_depth=10, - in_legal=True, + in_normalised_code_value=True, out_reflection=True, - constants=VLOG_CONSTANTS): + constants=VLOG_CONSTANTS, + **kwargs): """ Defines the *Panasonic V-Log* log decoding curve / electro-optical transfer function. @@ -135,14 +163,19 @@ def log_decoding_VLog(V_out, Non-linear data :math:`V_{out}`. bit_depth : int, optional Bit depth used for conversion. - in_legal : bool, optional + in_normalised_code_value : bool, optional Whether the non-linear *Panasonic V-Log* data :math:`V_{out}` is - encoded in legal range. + encoded as normalised code values. out_reflection : bool, optional Whether the light level :math`L_{in}` to a camera is reflection. constants : Structure, optional *Panasonic V-Log* constants. + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments for deprecation management. + Returns ------- numeric or ndarray @@ -173,9 +206,14 @@ def log_decoding_VLog(V_out, 0.1799999... """ + in_normalised_code_value = handle_arguments_deprecation({ + 'ArgumentRenamed': [['in_legal', 'in_normalised_code_value']], + }, **kwargs).get('in_normalised_code_value', in_normalised_code_value) + V_out = to_domain_1(V_out) - V_out = V_out if in_legal else full_to_legal(V_out, bit_depth) + V_out = (V_out + if in_normalised_code_value else full_to_legal(V_out, bit_depth)) cut2 = constants.cut2 b = constants.b diff --git a/colour/models/rgb/transfer_functions/red_log.py b/colour/models/rgb/transfer_functions/red_log.py index ad1fa853e3..84f531197d 100644 --- a/colour/models/rgb/transfer_functions/red_log.py +++ b/colour/models/rgb/transfer_functions/red_log.py @@ -9,7 +9,13 @@ - :func:`colour.models.log_decoding_REDLog` - :func:`colour.models.log_encoding_REDLogFilm` - :func:`colour.models.log_decoding_REDLogFilm` +- :func:`colour.models.log_encoding_Log3G10_v1` +- :func:`colour.models.log_decoding_Log3G10_v1` +- :func:`colour.models.log_encoding_Log3G10_v2` +- :func:`colour.models.log_decoding_Log3G10_v2` +- :attr:`colour.models.LOG3G10_ENCODING_METHODS` - :func:`colour.models.log_encoding_Log3G10` +- :attr:`colour.models.LOG3G10_DECODING_METHODS` - :func:`colour.models.log_decoding_Log3G10` - :func:`colour.models.log_encoding_Log3G12` - :func:`colour.models.log_decoding_Log3G12` @@ -36,7 +42,8 @@ from colour.models.rgb.transfer_functions import (log_encoding_Cineon, log_decoding_Cineon) -from colour.utilities import from_range_1, to_domain_1 +from colour.utilities import CaseInsensitiveMapping, from_range_1, to_domain_1 +from colour.utilities.deprecation import handle_arguments_deprecation __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -47,7 +54,10 @@ __all__ = [ 'log_encoding_REDLog', 'log_decoding_REDLog', 'log_encoding_REDLogFilm', - 'log_decoding_REDLogFilm', 'log_encoding_Log3G10', 'log_decoding_Log3G10', + 'log_decoding_REDLogFilm', 'log_encoding_Log3G10_v1', + 'log_decoding_Log3G10_v1', 'log_encoding_Log3G10_v2', + 'log_decoding_Log3G10_v2', 'LOG3G10_ENCODING_METHODS', + 'log_encoding_Log3G10', 'LOG3G10_DECODING_METHODS', 'log_decoding_Log3G10', 'log_encoding_Log3G12', 'log_decoding_Log3G12' ] @@ -240,7 +250,213 @@ def log_decoding_REDLogFilm(y, black_offset=10 ** ((95 - 685) / 300)): return log_decoding_Cineon(y, black_offset) -def log_encoding_Log3G10(x, legacy_curve=False): +def log_encoding_Log3G10_v1(x): + """ + Defines the *Log3G10* *v1* log encoding curve / opto-electronic transfer + function, the curve used in *REDCINE-X PRO Beta 42* and *Resolve 12.5.2*. + + Parameters + ---------- + x : numeric or array_like + Linear data :math:`x`. + + Returns + ------- + numeric or ndarray + Non-linear data :math:`y`. + + Notes + ----- + + +------------+-----------------------+---------------+ + | **Domain** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``x`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + +------------+-----------------------+---------------+ + | **Range** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``y`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + References + ---------- + :cite:`Nattress2016a` + + Examples + -------- + >>> log_encoding_Log3G10_v1(0.18) # doctest: +ELLIPSIS + 0.3333336... + """ + + x = to_domain_1(x) + + y = np.sign(x) * 0.222497 * np.log10((np.abs(x) * 169.379333) + 1) + + return from_range_1(y) + + +def log_decoding_Log3G10_v1(y): + """ + Defines the *Log3G10* *v1* log decoding curve / electro-optical transfer + function, the curve used in *REDCINE-X PRO Beta 42* and *Resolve 12.5.2*. + + Parameters + ---------- + y : numeric or array_like + Non-linear data :math:`y`. + + Returns + ------- + numeric or ndarray + Linear data :math:`x`. + + Notes + ----- + + +------------+-----------------------+---------------+ + | **Domain** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``y`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + +------------+-----------------------+---------------+ + | **Range** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``x`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + References + ---------- + :cite:`Nattress2016a` + + Examples + -------- + >>> log_decoding_Log3G10_v1(1.0 / 3) # doctest: +ELLIPSIS + 0.1799994... + """ + + y = to_domain_1(y) + + x = (np.sign(y) * (10.0 ** (np.abs(y) / 0.222497) - 1) / 169.379333) + + return from_range_1(x) + + +def log_encoding_Log3G10_v2(x): + """ + Defines the *Log3G10* *v2* log encoding curve / opto-electronic transfer + function, the current curve in *REDCINE-X PRO*. + + Parameters + ---------- + x : numeric or array_like + Linear data :math:`x`. + + Returns + ------- + numeric or ndarray + Non-linear data :math:`y`. + + Notes + ----- + + +------------+-----------------------+---------------+ + | **Domain** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``x`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + +------------+-----------------------+---------------+ + | **Range** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``y`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + References + ---------- + :cite:`Nattress2016a` + + Examples + -------- + >>> log_encoding_Log3G10_v2(0.0) # doctest: +ELLIPSIS + 0.0915514... + """ + + x = to_domain_1(x) + + y = (np.sign(x + 0.01) * 0.224282 * + np.log10((np.abs(x + 0.01) * 155.975327) + 1)) + + return from_range_1(y) + + +def log_decoding_Log3G10_v2(y): + """ + Defines the *Log3G10* *v2* log decoding curve / electro-optical transfer + function, the current curve in *REDCINE-X PRO*. + + Parameters + ---------- + y : numeric or array_like + Non-linear data :math:`y`. + + Returns + ------- + numeric or ndarray + Linear data :math:`x`. + + Notes + ----- + + +------------+-----------------------+---------------+ + | **Domain** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``y`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + +------------+-----------------------+---------------+ + | **Range** | **Scale - Reference** | **Scale - 1** | + +============+=======================+===============+ + | ``x`` | [0, 1] | [0, 1] | + +------------+-----------------------+---------------+ + + References + ---------- + :cite:`Nattress2016a` + + Examples + -------- + >>> log_decoding_Log3G10_v2(1.0) # doctest: +ELLIPSIS + 184.3223476... + """ + + y = to_domain_1(y) + + x = (np.sign(y) * (10.0 ** (np.abs(y) / 0.224282) - 1) / 155.975327) - 0.01 + + return from_range_1(x) + + +LOG3G10_ENCODING_METHODS = CaseInsensitiveMapping({ + 'v1': log_encoding_Log3G10_v1, + 'v2': log_encoding_Log3G10_v2, +}) +LOG3G10_ENCODING_METHODS.__doc__ = """ +Supported *Log3G10* log encoding curve / opto-electronic transfer function +methods. + +References +---------- +:cite:`Nattress2016a` + +LOG3G10_ENCODING_METHODS : CaseInsensitiveMapping + **{'v1', 'v2'}** +""" + + +def log_encoding_Log3G10(x, method='v2', **kwargs): """ Defines the *Log3G10* log encoding curve / opto-electronic transfer function. @@ -249,8 +465,14 @@ def log_encoding_Log3G10(x, legacy_curve=False): ---------- x : numeric or array_like Linear data :math:`x`. - legacy_curve : bool, optional - Whether to use the v1 *Log3G10* log encoding curve. Default is *False*. + method : unicode, optional + **{'v1', 'v2'}**, + Computation method. + + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments for deprecation management. Returns ------- @@ -272,14 +494,12 @@ def log_encoding_Log3G10(x, legacy_curve=False): | ``y`` | [0, 1] | [0, 1] | +------------+-----------------------+---------------+ - - The v1 *Log3G10* log encoding curve is the one used in *REDCINE-X beta - 42*. *Resolve 12.5.2* also uses the v1 curve. *RED* is planning to use - v2 *Log3G10* log encoding curve in the release version of the - *RED SDK*. - Use the `legacy_curve=True` argument to switch to the v1 curve for - compatibility with the current (as of September 21, 2016) *RED SDK*. - - The intent of the v1 *Log3G10* log encoding curve is that zero maps to - zero, 0.18 maps to 1/3, and 10 stops above 0.18 maps to 1.0. + - The *Log3G10* *v1* log encoding curve is the one used in + *REDCINE-X Beta 42*. *Resolve 12.5.2* also uses the *v1* curve. *RED* + is planning to use the *Log3G10* *v2* log encoding curve in the release + version of the *RED SDK*. + - The intent of the *Log3G10* *v1* log encoding curve is that zero maps + to zero, 0.18 maps to 1/3, and 10 stops above 0.18 maps to 1.0. The name indicates this in a similar way to the naming conventions of *Sony HyperGamma* curves. @@ -310,24 +530,38 @@ def log_encoding_Log3G10(x, legacy_curve=False): Examples -------- - >>> log_encoding_Log3G10(0.18, legacy_curve=True) # doctest: +ELLIPSIS - 0.3333336... >>> log_encoding_Log3G10(0.0) # doctest: +ELLIPSIS 0.0915514... + >>> log_encoding_Log3G10(0.18, method='v1') # doctest: +ELLIPSIS + 0.3333336... """ - x = to_domain_1(x) + method = handle_arguments_deprecation({ + 'ArgumentRenamed': [['legacy_curve', 'method']], + }, **kwargs).get('method', method) + method = {True: 'v1', False: 'v2'}.get(method, method) - if legacy_curve: - y = np.sign(x) * 0.222497 * np.log10((np.abs(x) * 169.379333) + 1) - else: - y = (np.sign(x + 0.01) * 0.224282 * - np.log10((np.abs(x + 0.01) * 155.975327) + 1)) + return LOG3G10_ENCODING_METHODS[method](x) - return from_range_1(y) +LOG3G10_DECODING_METHODS = CaseInsensitiveMapping({ + 'v1': log_decoding_Log3G10_v1, + 'v2': log_decoding_Log3G10_v2, +}) +LOG3G10_DECODING_METHODS.__doc__ = """ +Supported *Log3G10* log decoding curve / electro-optical transfer function +methods. -def log_decoding_Log3G10(y, legacy_curve=False): +References +---------- +:cite:`Nattress2016a` + +LOG3G10_DECODING_METHODS : CaseInsensitiveMapping + **{'v1', 'v2'}** +""" + + +def log_decoding_Log3G10(y, method='v2', **kwargs): """ Defines the *Log3G10* log decoding curve / electro-optical transfer function. @@ -336,8 +570,14 @@ def log_decoding_Log3G10(y, legacy_curve=False): ---------- y : numeric or array_like Non-linear data :math:`y`. - legacy_curve : bool, optional - Whether to use the v1 *Log3G10* log encoding curve. Default is *False*. + method : unicode, optional + **{'v1', 'v2'}**, + Computation method. + + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments for deprecation management. Returns ------- @@ -365,21 +605,18 @@ def log_decoding_Log3G10(y, legacy_curve=False): Examples -------- - >>> log_decoding_Log3G10(1.0 / 3, legacy_curve=True) # doctest: +ELLIPSIS - 0.1799994... >>> log_decoding_Log3G10(1.0) # doctest: +ELLIPSIS 184.3223476... + >>> log_decoding_Log3G10(1.0 / 3, method='v1') # doctest: +ELLIPSIS + 0.1799994... """ - y = to_domain_1(y) - - if legacy_curve: - x = (np.sign(y) * (10.0 ** (np.abs(y) / 0.222497) - 1) / 169.379333) - else: - x = (np.sign(y) * (10.0 ** - (np.abs(y) / 0.224282) - 1) / 155.975327) - 0.01 + method = handle_arguments_deprecation({ + 'ArgumentRenamed': [['legacy_curve', 'method']], + }, **kwargs).get('method', method) + method = {True: 'v1', False: 'v2'}.get(method, method) - return from_range_1(x) + return LOG3G10_DECODING_METHODS[method](y) def log_encoding_Log3G12(x): diff --git a/colour/models/rgb/transfer_functions/rimm_romm_rgb.py b/colour/models/rgb/transfer_functions/rimm_romm_rgb.py index d86862a1a5..56605f1e20 100644 --- a/colour/models/rgb/transfer_functions/rimm_romm_rgb.py +++ b/colour/models/rgb/transfer_functions/rimm_romm_rgb.py @@ -6,12 +6,12 @@ Defines the *RIMM, ROMM and ERIMM* encodings opto-electrical transfer functions (OETF / OECF) and electro-optical transfer functions (EOTF / EOCF): -- :func:`colour.models.oetf_ROMMRGB` -- :func:`colour.models.eotf_ROMMRGB` -- :func:`colour.models.oetf_ProPhotoRGB` -- :func:`colour.models.eotf_ProPhotoRGB` -- :func:`colour.models.oetf_RIMMRGB` -- :func:`colour.models.eotf_RIMMRGB` +- :func:`colour.models.cctf_encoding_ROMMRGB` +- :func:`colour.models.cctf_decoding_ROMMRGB` +- :func:`colour.models.cctf_encoding_ProPhotoRGB` +- :func:`colour.models.cctf_decoding_ProPhotoRGB` +- :func:`colour.models.cctf_encoding_RIMMRGB` +- :func:`colour.models.cctf_decoding_RIMMRGB` - :func:`colour.models.log_encoding_ERIMMRGB` - :func:`colour.models.log_decoding_ERIMMRGB` @@ -47,16 +47,17 @@ __status__ = 'Production' __all__ = [ - 'oetf_ROMMRGB', 'eotf_ROMMRGB', 'oetf_ProPhotoRGB', 'eotf_ProPhotoRGB', - 'oetf_RIMMRGB', 'eotf_RIMMRGB', 'log_encoding_ERIMMRGB', + 'cctf_encoding_ROMMRGB', 'cctf_decoding_ROMMRGB', + 'cctf_encoding_ProPhotoRGB', 'cctf_decoding_ProPhotoRGB', + 'cctf_encoding_RIMMRGB', 'cctf_decoding_RIMMRGB', 'log_encoding_ERIMMRGB', 'log_decoding_ERIMMRGB' ] -def oetf_ROMMRGB(X, bit_depth=8, out_int=False): +def cctf_encoding_ROMMRGB(X, bit_depth=8, out_int=False): """ - Defines the *ROMM RGB* encoding opto-electronic transfer function - (OETF / OECF). + Defines the *ROMM RGB* encoding colour component transfer function + (Encoding CCTF). Parameters ---------- @@ -88,8 +89,8 @@ def oetf_ROMMRGB(X, bit_depth=8, out_int=False): | ``X_p`` | [0, 1] | [0, 1] | +----------------+-----------------------+---------------+ - - \\* This definition has an output integer switch, thus the domain-range - scale information is only given for the floating point mode. + \\* This definition has an output integer switch, thus the domain-range + scale information is only given for the floating point mode. References ---------- @@ -97,9 +98,9 @@ def oetf_ROMMRGB(X, bit_depth=8, out_int=False): Examples -------- - >>> oetf_ROMMRGB(0.18) # doctest: +ELLIPSIS + >>> cctf_encoding_ROMMRGB(0.18) # doctest: +ELLIPSIS 0.3857114... - >>> oetf_ROMMRGB(0.18, out_int=True) + >>> cctf_encoding_ROMMRGB(0.18, out_int=True) 98 """ @@ -117,10 +118,10 @@ def oetf_ROMMRGB(X, bit_depth=8, out_int=False): return as_float(from_range_1(X_p / I_max)) -def eotf_ROMMRGB(X_p, bit_depth=8, in_int=False): +def cctf_decoding_ROMMRGB(X_p, bit_depth=8, in_int=False): """ - Defines the *ROMM RGB* encoding electro-optical transfer function - (EOTF / EOCF). + Defines the *ROMM RGB* decoding colour component transfer function + (Encoding CCTF). Parameters ---------- @@ -152,8 +153,8 @@ def eotf_ROMMRGB(X_p, bit_depth=8, in_int=False): | ``X`` | [0, 1] | [0, 1] | +----------------+-----------------------+---------------+ - - \\* This definition has an input integer switch, thus the domain-range - scale information is only given for the floating point mode. + \\* This definition has an input integer switch, thus the domain-range + scale information is only given for the floating point mode. References ---------- @@ -161,9 +162,9 @@ def eotf_ROMMRGB(X_p, bit_depth=8, in_int=False): Examples -------- - >>> eotf_ROMMRGB(0.385711424751138) # doctest: +ELLIPSIS + >>> cctf_decoding_ROMMRGB(0.385711424751138) # doctest: +ELLIPSIS 0.1... - >>> eotf_ROMMRGB(98, in_int=True) # doctest: +ELLIPSIS + >>> cctf_decoding_ROMMRGB(98, in_int=True) # doctest: +ELLIPSIS 0.1... """ @@ -185,14 +186,18 @@ def eotf_ROMMRGB(X_p, bit_depth=8, in_int=False): return as_float(from_range_1(X)) -oetf_ProPhotoRGB = oetf_ROMMRGB -eotf_ProPhotoRGB = eotf_ROMMRGB +cctf_encoding_ProPhotoRGB = cctf_encoding_ROMMRGB +cctf_encoding_ProPhotoRGB.__doc__ = cctf_encoding_ProPhotoRGB.__doc__.replace( + '*ROMM RGB*', '*ProPhoto RGB*') +cctf_decoding_ProPhotoRGB = cctf_decoding_ROMMRGB +cctf_decoding_ProPhotoRGB.__doc__ = cctf_decoding_ROMMRGB.__doc__.replace( + '*ROMM RGB*', '*ProPhoto RGB*') -def oetf_RIMMRGB(X, bit_depth=8, out_int=False, E_clip=2.0): +def cctf_encoding_RIMMRGB(X, bit_depth=8, out_int=False, E_clip=2.0): """ - Defines the *RIMM RGB* encoding opto-electronic transfer function - (OETF / OECF). + Defines the *RIMM RGB* encoding colour component transfer function + (Encoding CCTF). *RIMM RGB* encoding non-linearity is based on that specified by *Recommendation ITU-R BT.709-6*. @@ -229,8 +234,8 @@ def oetf_RIMMRGB(X, bit_depth=8, out_int=False, E_clip=2.0): | ``X_p`` | [0, 1] | [0, 1] | +----------------+-----------------------+---------------+ - - \\* This definition has an output integer switch, thus the domain-range - scale information is only given for the floating point mode. + \\* This definition has an output integer switch, thus the domain-range + scale information is only given for the floating point mode. References ---------- @@ -238,9 +243,9 @@ def oetf_RIMMRGB(X, bit_depth=8, out_int=False, E_clip=2.0): Examples -------- - >>> oetf_RIMMRGB(0.18) # doctest: +ELLIPSIS + >>> cctf_encoding_RIMMRGB(0.18) # doctest: +ELLIPSIS 0.2916737... - >>> oetf_RIMMRGB(0.18, out_int=True) + >>> cctf_encoding_RIMMRGB(0.18, out_int=True) 74 """ @@ -260,10 +265,10 @@ def oetf_RIMMRGB(X, bit_depth=8, out_int=False, E_clip=2.0): return as_float(from_range_1(X_p / I_max)) -def eotf_RIMMRGB(X_p, bit_depth=8, in_int=False, E_clip=2.0): +def cctf_decoding_RIMMRGB(X_p, bit_depth=8, in_int=False, E_clip=2.0): """ - Defines the *RIMM RGB* encoding electro-optical transfer function - (EOTF / EOCF). + Defines the *RIMM RGB* decoding colour component transfer function + (Encoding CCTF). Parameters ---------- @@ -297,8 +302,8 @@ def eotf_RIMMRGB(X_p, bit_depth=8, in_int=False, E_clip=2.0): | ``X`` | [0, 1] | [0, 1] | +----------------+-----------------------+---------------+ - - \\* This definition has an input integer switch, thus the domain-range - scale information is only given for the floating point mode. + \\* This definition has an input integer switch, thus the domain-range + scale information is only given for the floating point mode. References ---------- @@ -306,9 +311,9 @@ def eotf_RIMMRGB(X_p, bit_depth=8, in_int=False, E_clip=2.0): Examples -------- - >>> eotf_RIMMRGB(0.291673732475746) # doctest: +ELLIPSIS + >>> cctf_decoding_RIMMRGB(0.291673732475746) # doctest: +ELLIPSIS 0.1... - >>> eotf_RIMMRGB(74, in_int=True) # doctest: +ELLIPSIS + >>> cctf_decoding_RIMMRGB(74, in_int=True) # doctest: +ELLIPSIS 0.1... """ @@ -325,7 +330,8 @@ def eotf_RIMMRGB(X_p, bit_depth=8, in_int=False, E_clip=2.0): with domain_range_scale('ignore'): X = np.where( - X_p / I_max < oetf_RIMMRGB(0.018, bit_depth, E_clip=E_clip), + X_p / I_max < cctf_encoding_RIMMRGB( + 0.018, bit_depth, E_clip=E_clip), m / 4.5, spow((m + 0.099) / 1.099, 1 / 0.45), ) @@ -376,8 +382,8 @@ def log_encoding_ERIMMRGB(X, | ``X_p`` | [0, 1] | [0, 1] | +----------------+-----------------------+---------------+ - - \\* This definition has an output integer switch, thus the domain-range - scale information is only given for the floating point mode. + \\* This definition has an output integer switch, thus the domain-range + scale information is only given for the floating point mode. References ---------- @@ -460,8 +466,8 @@ def log_decoding_ERIMMRGB(X_p, | ``X`` | [0, 1] | [0, 1] | +----------------+-----------------------+---------------+ - - \\* This definition has an input integer switch, thus the domain-range - scale information is only given for the floating point mode. + \\* This definition has an input integer switch, thus the domain-range + scale information is only given for the floating point mode. References ---------- diff --git a/colour/models/rgb/transfer_functions/sony_slog.py b/colour/models/rgb/transfer_functions/sony_slog.py index 0403b5c039..95adc160cb 100644 --- a/colour/models/rgb/transfer_functions/sony_slog.py +++ b/colour/models/rgb/transfer_functions/sony_slog.py @@ -37,6 +37,7 @@ from colour.models.rgb.transfer_functions import full_to_legal, legal_to_full from colour.utilities import (as_float, domain_range_scale, from_range_1, to_domain_1) +from colour.utilities.deprecation import handle_arguments_deprecation __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -51,7 +52,11 @@ ] -def log_encoding_SLog(x, bit_depth=10, out_legal=True, in_reflection=True): +def log_encoding_SLog(x, + bit_depth=10, + out_normalised_code_value=True, + in_reflection=True, + **kwargs): """ Defines the *Sony S-Log* log encoding curve / opto-electronic transfer function. @@ -63,12 +68,17 @@ def log_encoding_SLog(x, bit_depth=10, out_legal=True, in_reflection=True): camera. bit_depth : int, optional Bit depth used for conversion. - out_legal : bool, optional - Whether the non-linear *Sony S-Log* data :math:`y` is encoded in legal - range. + out_normalised_code_value : bool, optional + Whether the non-linear *Sony S-Log* data :math:`y` is encoded as + normalised code values. in_reflection : bool, optional Whether the light level :math:`x` to a camera is reflection. + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments for deprecation management. + Returns ------- numeric or ndarray @@ -97,12 +107,21 @@ def log_encoding_SLog(x, bit_depth=10, out_legal=True, in_reflection=True): -------- >>> log_encoding_SLog(0.18) # doctest: +ELLIPSIS 0.3849708... - >>> log_encoding_SLog(0.18, out_legal=False) # doctest: +ELLIPSIS - 0.3765127... - >>> log_encoding_SLog(0.18, in_reflection=False) # doctest: +ELLIPSIS - 0.3708204... + + The values of *IRE and CV of S-Log2 @ISO800* table in + :cite:`SonyCorporation2012a` are obtained as follows: + + >>> x = np.array([0, 18, 90]) / 100 + >>> np.around(log_encoding_SLog(x, 10, False) * 100).astype(np.int) + array([ 3, 38, 65]) + >>> np.around(log_encoding_SLog(x) * (2 ** 10 - 1)).astype(np.int) + array([ 90, 394, 636]) """ + out_normalised_code_value = handle_arguments_deprecation({ + 'ArgumentRenamed': [['out_legal', 'out_normalised_code_value']], + }, **kwargs).get('out_normalised_code_value', out_normalised_code_value) + x = to_domain_1(x) if in_reflection: @@ -114,12 +133,16 @@ def log_encoding_SLog(x, bit_depth=10, out_legal=True, in_reflection=True): x * 5 + 0.030001222851889303, ) - y = full_to_legal(y, bit_depth) if out_legal else y + y = full_to_legal(y, bit_depth) if out_normalised_code_value else y return as_float(from_range_1(y)) -def log_decoding_SLog(y, bit_depth=10, in_legal=True, out_reflection=True): +def log_decoding_SLog(y, + bit_depth=10, + in_normalised_code_value=True, + out_reflection=True, + **kwargs): """ Defines the *Sony S-Log* log decoding curve / electro-optical transfer function. @@ -130,12 +153,17 @@ def log_decoding_SLog(y, bit_depth=10, in_legal=True, out_reflection=True): Non-linear *Sony S-Log* data :math:`y`. bit_depth : int, optional Bit depth used for conversion. - in_legal : bool, optional - Whether the non-linear *Sony S-Log* data :math:`y` is encoded in legal - range. + in_normalised_code_value : bool, optional + Whether the non-linear *Sony S-Log* data :math:`y` is encoded as + normalised code values. out_reflection : bool, optional Whether the light level :math:`x` to a camera is reflection. + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments for deprecation management. + Returns ------- numeric or ndarray @@ -165,21 +193,19 @@ def log_decoding_SLog(y, bit_depth=10, in_legal=True, out_reflection=True): -------- >>> log_decoding_SLog(0.384970815928670) # doctest: +ELLIPSIS 0.1... - >>> log_decoding_SLog(0.376512722254600, in_legal=False) - ... # doctest: +ELLIPSIS - 0.1... - >>> log_decoding_SLog(0.370820482371268, out_reflection=False) - ... # doctest: +ELLIPSIS - 0.1... """ + in_normalised_code_value = handle_arguments_deprecation({ + 'ArgumentRenamed': [['in_legal', 'in_normalised_code_value']], + }, **kwargs).get('in_normalised_code_value', in_normalised_code_value) + y = to_domain_1(y) - x = legal_to_full(y, bit_depth) if in_legal else y + x = legal_to_full(y, bit_depth) if in_normalised_code_value else y with domain_range_scale('ignore'): x = np.where( - y >= log_encoding_SLog(0.0, bit_depth, in_legal), + y >= log_encoding_SLog(0.0, bit_depth, in_normalised_code_value), 10 ** ((x - 0.616596 - 0.03) / 0.432699) - 0.037584, (x - 0.030001222851889303) / 5.0, ) @@ -190,7 +216,11 @@ def log_decoding_SLog(y, bit_depth=10, in_legal=True, out_reflection=True): return as_float(from_range_1(x)) -def log_encoding_SLog2(x, bit_depth=10, out_legal=True, in_reflection=True): +def log_encoding_SLog2(x, + bit_depth=10, + out_normalised_code_value=True, + in_reflection=True, + **kwargs): """ Defines the *Sony S-Log2* log encoding curve / opto-electronic transfer function. @@ -202,12 +232,17 @@ def log_encoding_SLog2(x, bit_depth=10, out_legal=True, in_reflection=True): camera. bit_depth : int, optional Bit depth used for conversion. - out_legal : bool, optional - Whether the non-linear *Sony S-Log2* data :math:`y` is encoded in legal - range. + out_normalised_code_value : bool, optional + Whether the non-linear *Sony S-Log2* data :math:`y` is encoded as + normalised code values. in_reflection : bool, optional Whether the light level :math:`x` to a camera is reflection. + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments for deprecation management. + Returns ------- numeric or ndarray @@ -236,17 +271,30 @@ def log_encoding_SLog2(x, bit_depth=10, out_legal=True, in_reflection=True): -------- >>> log_encoding_SLog2(0.18) # doctest: +ELLIPSIS 0.3395325... - >>> log_encoding_SLog2(0.18, out_legal=False) # doctest: +ELLIPSIS - 0.3234495... - >>> log_encoding_SLog2(0.18, in_reflection=False) # doctest: +ELLIPSIS - 0.3262865... + + The values of *IRE and CV of S-Log2 @ISO800* table in + :cite:`SonyCorporation2012a` are obtained as follows: + + >>> x = np.array([0, 18, 90]) / 100 + >>> np.around(log_encoding_SLog2(x, 10, False) * 100).astype(np.int) + array([ 3, 32, 59]) + >>> np.around(log_encoding_SLog2(x) * (2 ** 10 - 1)).astype(np.int) + array([ 90, 347, 582]) """ - return log_encoding_SLog(x * 155 / 219, bit_depth, out_legal, - in_reflection) + out_normalised_code_value = handle_arguments_deprecation({ + 'ArgumentRenamed': [['out_legal', 'out_normalised_code_value']], + }, **kwargs).get('out_normalised_code_value', out_normalised_code_value) + + return log_encoding_SLog(x * 155 / 219, bit_depth, + out_normalised_code_value, in_reflection) -def log_decoding_SLog2(y, bit_depth=10, in_legal=True, out_reflection=True): +def log_decoding_SLog2(y, + bit_depth=10, + in_normalised_code_value=True, + out_reflection=True, + **kwargs): """ Defines the *Sony S-Log2* log decoding curve / electro-optical transfer function. @@ -257,12 +305,17 @@ def log_decoding_SLog2(y, bit_depth=10, in_legal=True, out_reflection=True): Non-linear *Sony S-Log2* data :math:`y`. bit_depth : int, optional Bit depth used for conversion. - in_legal : bool, optional - Whether the non-linear *Sony S-Log2* data :math:`y` is encoded in legal - range. + in_normalised_code_value : bool, optional + Whether the non-linear *Sony S-Log2* data :math:`y` is encoded as + normalised code values. out_reflection : bool, optional Whether the light level :math:`x` to a camera is reflection. + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments for deprecation management. + Returns ------- numeric or ndarray @@ -292,19 +345,21 @@ def log_decoding_SLog2(y, bit_depth=10, in_legal=True, out_reflection=True): -------- >>> log_decoding_SLog2(0.339532524633774) # doctest: +ELLIPSIS 0.1... - >>> log_decoding_SLog2(0.323449512215013, in_legal=False) - ... # doctest: +ELLIPSIS - 0.1... - >>> log_decoding_SLog2(0.326286538946799, out_reflection=False) - ... # doctest: +ELLIPSIS - 0.1... """ - return 219 * log_decoding_SLog(y, bit_depth, in_legal, + in_normalised_code_value = handle_arguments_deprecation({ + 'ArgumentRenamed': [['in_legal', 'in_normalised_code_value']], + }, **kwargs).get('in_normalised_code_value', in_normalised_code_value) + + return 219 * log_decoding_SLog(y, bit_depth, in_normalised_code_value, out_reflection) / 155 -def log_encoding_SLog3(x, bit_depth=10, out_legal=True, in_reflection=True): +def log_encoding_SLog3(x, + bit_depth=10, + out_normalised_code_value=True, + in_reflection=True, + **kwargs): """ Defines the *Sony S-Log3* log encoding curve / opto-electronic transfer function. @@ -316,12 +371,17 @@ def log_encoding_SLog3(x, bit_depth=10, out_legal=True, in_reflection=True): camera. bit_depth : int, optional Bit depth used for conversion. - out_legal : bool, optional - Whether the non-linear *Sony S-Log3* data :math:`y` is encoded in legal - range. + out_normalised_code_value : bool, optional + Whether the non-linear *Sony S-Log3* data :math:`y` is encoded as + normalised code values. in_reflection : bool, optional Whether the light level :math:`x` to a camera is reflection. + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments for deprecation management. + Returns ------- numeric or ndarray @@ -350,12 +410,21 @@ def log_encoding_SLog3(x, bit_depth=10, out_legal=True, in_reflection=True): -------- >>> log_encoding_SLog3(0.18) # doctest: +ELLIPSIS 0.4105571... - >>> log_encoding_SLog3(0.18, out_legal=False) # doctest: +ELLIPSIS - 0.4063926... - >>> log_encoding_SLog3(0.18, in_reflection=False) # doctest: +ELLIPSIS - 0.3995079... + + The values of *S-Log3 10bit code values (18%, 90%)* table in + :cite:`SonyCorporationd` are obtained as follows: + + >>> x = np.array([0, 18, 90]) / 100 + >>> np.around(log_encoding_SLog3(x, 10, False) * 100).astype(np.int) + array([ 4, 41, 61]) + >>> np.around(log_encoding_SLog3(x) * (2 ** 10 - 1)).astype(np.int) + array([ 95, 420, 598]) """ + out_normalised_code_value = handle_arguments_deprecation({ + 'ArgumentRenamed': [['out_legal', 'out_normalised_code_value']], + }, **kwargs).get('out_normalised_code_value', out_normalised_code_value) + x = to_domain_1(x) if not in_reflection: @@ -367,12 +436,16 @@ def log_encoding_SLog3(x, bit_depth=10, out_legal=True, in_reflection=True): (x * (171.2102946929 - 95) / 0.01125000 + 95) / 1023, ) - y = y if out_legal else legal_to_full(y, bit_depth) + y = y if out_normalised_code_value else legal_to_full(y, bit_depth) return as_float(from_range_1(y)) -def log_decoding_SLog3(y, bit_depth=10, in_legal=True, out_reflection=True): +def log_decoding_SLog3(y, + bit_depth=10, + in_normalised_code_value=True, + out_reflection=True, + **kwargs): """ Defines the *Sony S-Log3* log decoding curve / electro-optical transfer function. @@ -383,12 +456,17 @@ def log_decoding_SLog3(y, bit_depth=10, in_legal=True, out_reflection=True): Non-linear *Sony S-Log3* data :math:`y`. bit_depth : int, optional Bit depth used for conversion. - in_legal : bool, optional - Whether the non-linear *Sony S-Log3* data :math:`y` is encoded in legal - range. + in_normalised_code_value : bool, optional + Whether the non-linear *Sony S-Log3* data :math:`y` is encoded as + normalised code values. out_reflection : bool, optional Whether the light level :math:`x` to a camera is reflection. + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments for deprecation management. + Returns ------- numeric or ndarray @@ -418,17 +496,15 @@ def log_decoding_SLog3(y, bit_depth=10, in_legal=True, out_reflection=True): -------- >>> log_decoding_SLog3(0.410557184750733) # doctest: +ELLIPSIS 0.1... - >>> log_decoding_SLog3(0.406392694063927, in_legal=False) - ... # doctest: +ELLIPSIS - 0.1... - >>> log_decoding_SLog3(0.399507939606216, out_reflection=False) - ... # doctest: +ELLIPSIS - 0.1... """ + in_normalised_code_value = handle_arguments_deprecation({ + 'ArgumentRenamed': [['in_legal', 'in_normalised_code_value']], + }, **kwargs).get('in_normalised_code_value', in_normalised_code_value) + y = to_domain_1(y) - y = y if in_legal else full_to_legal(y, bit_depth) + y = y if in_normalised_code_value else full_to_legal(y, bit_depth) x = np.where( y >= 171.2102946929 / 1023, diff --git a/colour/models/rgb/transfer_functions/srgb.py b/colour/models/rgb/transfer_functions/srgb.py index f0fc223f5b..03d5f4542d 100644 --- a/colour/models/rgb/transfer_functions/srgb.py +++ b/colour/models/rgb/transfer_functions/srgb.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- """ -sRGB Colourspace -================ +sRGB +==== -Defines *sRGB* colourspace opto-electrical transfer function (OETF / OECF) and -its reverse: +Defines the *sRGB* electro-optical transfer function (EOTF / EOCF) and its +inverse: -- :func:`colour.models.oetf_sRGB` -- :func:`colour.models.oetf_reverse_sRGB` +- :func:`colour.models.eotf_inverse_sRGB` +- :func:`colour.models.eotf_sRGB` See Also -------- @@ -45,13 +45,13 @@ __email__ = 'colour-science@googlegroups.com' __status__ = 'Production' -__all__ = ['oetf_sRGB', 'oetf_reverse_sRGB'] +__all__ = ['eotf_inverse_sRGB', 'eotf_sRGB'] -def oetf_sRGB(L): +def eotf_inverse_sRGB(L): """ - Defines the *sRGB* colourspace opto-electronic transfer function - (OETF / OECF). + Defines the *IEC 61966-2-1:1999* *sRGB* inverse electro-optical transfer + function (EOTF / EOCF). Parameters ---------- @@ -85,7 +85,7 @@ def oetf_sRGB(L): Examples -------- - >>> oetf_sRGB(0.18) # doctest: +ELLIPSIS + >>> eotf_inverse_sRGB(0.18) # doctest: +ELLIPSIS 0.4613561... """ @@ -96,10 +96,10 @@ def oetf_sRGB(L): return as_float(from_range_1(V)) -def oetf_reverse_sRGB(V): +def eotf_sRGB(V): """ - Defines the *sRGB* colourspace reverse opto-electronic transfer function - (OETF / OECF). + Defines the *IEC 61966-2-1:1999* *sRGB* electro-optical transfer function + (EOTF / EOCF). Parameters ---------- @@ -133,7 +133,7 @@ def oetf_reverse_sRGB(V): Examples -------- - >>> oetf_reverse_sRGB(0.461356129500442) # doctest: +ELLIPSIS + >>> eotf_sRGB(0.461356129500442) # doctest: +ELLIPSIS 0.1... """ @@ -141,7 +141,7 @@ def oetf_reverse_sRGB(V): with domain_range_scale('ignore'): L = np.where( - V <= oetf_sRGB(0.0031308), + V <= eotf_inverse_sRGB(0.0031308), V / 12.92, spow((V + 0.055) / 1.055, 2.4), ) diff --git a/colour/models/rgb/transfer_functions/st_2084.py b/colour/models/rgb/transfer_functions/st_2084.py index 373509b5df..2485f72e83 100644 --- a/colour/models/rgb/transfer_functions/st_2084.py +++ b/colour/models/rgb/transfer_functions/st_2084.py @@ -7,7 +7,7 @@ and electro-optical transfer function (EOTF / EOCF): - :func:`colour.models.eotf_ST2084` -- :func:`colour.models.oetf_ST2084` +- :func:`colour.models.eotf_inverse_ST2084` See Also -------- @@ -40,7 +40,7 @@ __email__ = 'colour-science@googlegroups.com' __status__ = 'Production' -__all__ = ['ST2084_CONSTANTS', 'oetf_ST2084', 'eotf_ST2084'] +__all__ = ['ST2084_CONSTANTS', 'eotf_inverse_ST2084', 'eotf_ST2084'] ST2084_CONSTANTS = Structure( m_1=2610 / 4096 * (1 / 4), @@ -49,17 +49,17 @@ c_2=2413 / 4096 * 32, c_3=2392 / 4096 * 32) """ -Constants for *SMPTE ST 2084:2014* opto-electrical transfer function -(OETF / OECF) and electro-optical transfer function (EOTF / EOCF). +Constants for *SMPTE ST 2084:2014* inverse electro-optical transfer function +(EOTF / EOCF) and electro-optical transfer function (EOTF / EOCF). ST2084_CONSTANTS : Structure """ -def oetf_ST2084(C, L_p=10000, constants=ST2084_CONSTANTS): +def eotf_inverse_ST2084(C, L_p=10000, constants=ST2084_CONSTANTS): """ - Defines *SMPTE ST 2084:2014* optimised perceptual opto-electronic transfer - function (OETF / OECF). + Defines *SMPTE ST 2084:2014* optimised perceptual inverse electro-optical + transfer function (EOTF / EOCF). Parameters ---------- @@ -87,6 +87,10 @@ def oetf_ST2084(C, L_p=10000, constants=ST2084_CONSTANTS): Notes ----- + - *SMPTE ST 2084:2014* is an absolute transfer function, thus the + domain and range values for the *Reference* and *1* scales are only + indicative that the data is not affected by scale transformations. + +------------+-----------------------+---------------+ | **Domain** | **Scale - Reference** | **Scale - 1** | +============+=======================+===============+ @@ -99,10 +103,6 @@ def oetf_ST2084(C, L_p=10000, constants=ST2084_CONSTANTS): | ``N`` | [0, 1] | [0, 1] | +------------+-----------------------+---------------+ - - *SMPTE ST 2084:2014* is an absolute transfer function, thus the - domain and range values for the *Reference* and *1* scales are only - indicative that the data is not affected by scale transformations. - References ---------- :cite:`Miller2014a`, @@ -110,7 +110,7 @@ def oetf_ST2084(C, L_p=10000, constants=ST2084_CONSTANTS): Examples -------- - >>> oetf_ST2084(100) # doctest: +ELLIPSIS + >>> eotf_inverse_ST2084(100) # doctest: +ELLIPSIS 0.5080784... """ @@ -158,6 +158,10 @@ def eotf_ST2084(N, L_p=10000, constants=ST2084_CONSTANTS): Notes ----- + - *SMPTE ST 2084:2014* is an absolute transfer function, thus the + domain and range values for the *Reference* and *1* scales are only + indicative that the data is not affected by scale transformations. + +------------+-----------------------+---------------+ | **Domain** | **Scale - Reference** | **Scale - 1** | +============+=======================+===============+ @@ -170,10 +174,6 @@ def eotf_ST2084(N, L_p=10000, constants=ST2084_CONSTANTS): | ``C`` | [0, 1] | [0, 1] | +------------+-----------------------+---------------+ - - *SMPTE ST 2084:2014* is an absolute transfer function, thus the - domain and range values for the *Reference* and *1* scales are only - indicative that the data is not affected by scale transformations. - References ---------- :cite:`Miller2014a`, diff --git a/colour/models/rgb/transfer_functions/tests/test__init__.py b/colour/models/rgb/transfer_functions/tests/test__init__.py new file mode 100644 index 0000000000..f1cce008e7 --- /dev/null +++ b/colour/models/rgb/transfer_functions/tests/test__init__.py @@ -0,0 +1,101 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.models.rgb.transfer_functions.common` +module. +""" + +from __future__ import division, unicode_literals + +import numpy as np +import unittest + +from colour.models.rgb.transfer_functions import ( + CCTF_DECODINGS, CCTF_ENCODINGS, EOTFS, EOTF_INVERSES, LOG_DECODINGS, + LOG_ENCODINGS, OETFS, OETF_INVERSES, OOTFS, OOTF_INVERSES, cctf_encoding, + cctf_decoding) + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Development' + +__all__ = ['TestCctfEncoding', 'TestCctfDecoding', 'TestTransferFunctions'] + + +class TestCctfEncoding(unittest.TestCase): + """ + Defines :func:`colour.models.rgb.transfer_functions.cctf_encoding` + definition unit tests methods. + """ + + def test_raise_exception_cctf_encoding(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.aces.\ +log_encoding_ACESproxy` definition raised exception. + """ + + # TODO: Use "assertWarns" when dropping Python 2.7. + cctf_encoding(0.18, 'ITU-R BT.2100 HLG') + cctf_encoding(0.18, 'ITU-R BT.2100 PQ') + + +class TestCctfDecoding(unittest.TestCase): + """ + Defines :func:`colour.models.rgb.transfer_functions.cctf_decoding` + definition unit tests methods. + """ + + def test_raise_exception_cctf_decoding(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.aces.\ +log_encoding_ACESproxy` definition raised exception. + """ + + # TODO: Use "assertWarns" when dropping Python 2.7. + cctf_decoding(0.18, 'ITU-R BT.2100 HLG') + cctf_decoding(0.18, 'ITU-R BT.2100 PQ') + + +class TestTransferFunctions(unittest.TestCase): + """ + Defines transfer functions unit tests methods. + """ + + def test_transfer_functions(self): + """ + Tests transfer functions reciprocity. + """ + + ignored_transfer_functions = ('ACESproxy', 'DICOM GSDF', + 'Filmic Pro 6') + + decimals = {'D-Log': 1, 'F-Log': 4} + + reciprocal_mappings = [ + (LOG_ENCODINGS, LOG_DECODINGS), + (OETFS, OETF_INVERSES), + (EOTFS, EOTF_INVERSES), + (CCTF_ENCODINGS, CCTF_DECODINGS), + (OOTFS, OOTF_INVERSES), + ] + + samples = np.hstack( + [np.linspace(0, 1, 1e5), + np.linspace(0, 65504, 65504 * 10)]) + + for encoding_mapping, _decoding_mapping in reciprocal_mappings: + for name in encoding_mapping: + if name in ignored_transfer_functions: + continue + + encoded_s = CCTF_ENCODINGS[name](samples) + decoded_s = CCTF_DECODINGS[name](encoded_s) + + np.testing.assert_almost_equal( + samples, decoded_s, decimal=decimals.get(name, 7)) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/models/rgb/transfer_functions/tests/test_arib_std_b67.py b/colour/models/rgb/transfer_functions/tests/test_arib_std_b67.py index 02c35d8ff0..51a27aa3d8 100644 --- a/colour/models/rgb/transfer_functions/tests/test_arib_std_b67.py +++ b/colour/models/rgb/transfer_functions/tests/test_arib_std_b67.py @@ -10,7 +10,7 @@ import unittest from colour.models.rgb.transfer_functions import (oetf_ARIBSTDB67, - oetf_reverse_ARIBSTDB67) + oetf_inverse_ARIBSTDB67) from colour.utilities import domain_range_scale, ignore_numpy_errors __author__ = 'Colour Developers' @@ -20,7 +20,7 @@ __email__ = 'colour-science@googlegroups.com' __status__ = 'Production' -__all__ = ['TestOetf_ARIBSTDB67', 'TestOetf_reverse_ARIBSTDB67'] +__all__ = ['TestOetf_ARIBSTDB67', 'TestOetf_inverse_ARIBSTDB67'] class TestOetf_ARIBSTDB67(unittest.TestCase): @@ -35,6 +35,8 @@ def test_oetf_ARIBSTDB67(self): oetf_ARIBSTDB67` definition. """ + self.assertAlmostEqual(oetf_ARIBSTDB67(-0.25), -0.25, places=7) + self.assertAlmostEqual(oetf_ARIBSTDB67(0.0), 0.0, places=7) self.assertAlmostEqual( @@ -91,77 +93,79 @@ def test_nan_oetf_ARIBSTDB67(self): oetf_ARIBSTDB67(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) -class TestOetf_reverse_ARIBSTDB67(unittest.TestCase): +class TestOetf_inverse_ARIBSTDB67(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.arib_std_b67.\ -oetf_reverse_ARIBSTDB67` definition unit tests methods. +oetf_inverse_ARIBSTDB67` definition unit tests methods. """ - def test_oetf_reverse_ARIBSTDB67(self): + def test_oetf_inverse_ARIBSTDB67(self): """ Tests :func:`colour.models.rgb.transfer_functions.arib_std_b67.\ -oetf_reverse_ARIBSTDB67` definition. +oetf_inverse_ARIBSTDB67` definition. """ - self.assertAlmostEqual(oetf_reverse_ARIBSTDB67(0.0), 0.0, places=7) + self.assertAlmostEqual(oetf_inverse_ARIBSTDB67(-0.25), -0.25, places=7) + + self.assertAlmostEqual(oetf_inverse_ARIBSTDB67(0.0), 0.0, places=7) self.assertAlmostEqual( - oetf_reverse_ARIBSTDB67(0.212132034355964), 0.18, places=7) + oetf_inverse_ARIBSTDB67(0.212132034355964), 0.18, places=7) - self.assertAlmostEqual(oetf_reverse_ARIBSTDB67(0.5), 1.0, places=7) + self.assertAlmostEqual(oetf_inverse_ARIBSTDB67(0.5), 1.0, places=7) self.assertAlmostEqual( - oetf_reverse_ARIBSTDB67(1.302858098046995), 64.0, places=7) + oetf_inverse_ARIBSTDB67(1.302858098046995), 64.0, places=7) - def test_n_dimensional_oetf_reverse_ARIBSTDB67(self): + def test_n_dimensional_oetf_inverse_ARIBSTDB67(self): """ Tests :func:`colour.models.rgb.transfer_functions.arib_std_b67.\ -oetf_reverse_ARIBSTDB67` definition n-dimensional arrays support. +oetf_inverse_ARIBSTDB67` definition n-dimensional arrays support. """ E_p = 0.212132034355964 - E = oetf_reverse_ARIBSTDB67(E_p) + E = oetf_inverse_ARIBSTDB67(E_p) E_p = np.tile(E_p, 6) E = np.tile(E, 6) np.testing.assert_almost_equal( - oetf_reverse_ARIBSTDB67(E_p), E, decimal=7) + oetf_inverse_ARIBSTDB67(E_p), E, decimal=7) E_p = np.reshape(E_p, (2, 3)) E = np.reshape(E, (2, 3)) np.testing.assert_almost_equal( - oetf_reverse_ARIBSTDB67(E_p), E, decimal=7) + oetf_inverse_ARIBSTDB67(E_p), E, decimal=7) E_p = np.reshape(E_p, (2, 3, 1)) E = np.reshape(E, (2, 3, 1)) np.testing.assert_almost_equal( - oetf_reverse_ARIBSTDB67(E_p), E, decimal=7) + oetf_inverse_ARIBSTDB67(E_p), E, decimal=7) - def test_domain_range_scale_oetf_reverse_ARIBSTDB67(self): + def test_domain_range_scale_oetf_inverse_ARIBSTDB67(self): """ Tests :func:`colour.models.rgb.transfer_functions.arib_std_b67.\ -oetf_reverse_ARIBSTDB67` definition domain and range scale support. +oetf_inverse_ARIBSTDB67` definition domain and range scale support. """ E_p = 0.212132034355964 - E = oetf_reverse_ARIBSTDB67(E_p) + E = oetf_inverse_ARIBSTDB67(E_p) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - oetf_reverse_ARIBSTDB67(E_p * factor), + oetf_inverse_ARIBSTDB67(E_p * factor), E * factor, decimal=7) @ignore_numpy_errors - def test_nan_oetf_reverse_ARIBSTDB67(self): + def test_nan_oetf_inverse_ARIBSTDB67(self): """ Tests :func:`colour.models.rgb.transfer_functions.arib_std_b67.\ -oetf_reverse_ARIBSTDB67` definition nan support. +oetf_inverse_ARIBSTDB67` definition nan support. """ - oetf_reverse_ARIBSTDB67( + oetf_inverse_ARIBSTDB67( np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) diff --git a/colour/models/rgb/transfer_functions/tests/test_alexa_log_c.py b/colour/models/rgb/transfer_functions/tests/test_arri_alexa_log_c.py similarity index 84% rename from colour/models/rgb/transfer_functions/tests/test_alexa_log_c.py rename to colour/models/rgb/transfer_functions/tests/test_arri_alexa_log_c.py index 57021f63d7..0e5b061787 100644 --- a/colour/models/rgb/transfer_functions/tests/test_alexa_log_c.py +++ b/colour/models/rgb/transfer_functions/tests/test_arri_alexa_log_c.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ Defines unit tests for -:mod:`colour.models.rgb.transfer_functions.alexa_log_c` module. +:mod:`colour.models.rgb.transfer_functions.arri_alexa_log_c` module. """ from __future__ import division, unicode_literals @@ -25,13 +25,13 @@ class TestLogEncoding_ALEXALogC(unittest.TestCase): """ - Defines :func:`colour.models.rgb.transfer_functions.alexa_log_c.\ + Defines :func:`colour.models.rgb.transfer_functions.arri_alexa_log_c.\ log_encoding_ALEXALogC` definition unit tests methods. """ def test_log_encoding_ALEXALogC(self): """ - Tests :func:`colour.models.rgb.transfer_functions.alexa_log_c.\ + Tests :func:`colour.models.rgb.transfer_functions.arri_alexa_log_c.\ log_encoding_ALEXALogC` definition. """ @@ -46,7 +46,7 @@ def test_log_encoding_ALEXALogC(self): def test_n_dimensional_log_encoding_ALEXALogC(self): """ - Tests :func:`colour.models.rgb.transfer_functions.alexa_log_c.\ + Tests :func:`colour.models.rgb.transfer_functions.arri_alexa_log_c.\ log_encoding_ALEXALogC` definition n-dimensional arrays support. """ @@ -67,7 +67,7 @@ def test_n_dimensional_log_encoding_ALEXALogC(self): def test_domain_range_scale_log_encoding_ALEXALogC(self): """ - Tests :func:`colour.models.rgb.transfer_functions.alexa_log_c.\ + Tests :func:`colour.models.rgb.transfer_functions.arri_alexa_log_c.\ log_encoding_ALEXALogC` definition domain and range scale support. """ @@ -83,7 +83,7 @@ def test_domain_range_scale_log_encoding_ALEXALogC(self): @ignore_numpy_errors def test_nan_log_encoding_ALEXALogC(self): """ - Tests :func:`colour.models.rgb.transfer_functions.alexa_log_c.\ + Tests :func:`colour.models.rgb.transfer_functions.arri_alexa_log_c.\ log_encoding_ALEXALogC` definition nan support. """ @@ -93,13 +93,13 @@ def test_nan_log_encoding_ALEXALogC(self): class TestLogDecoding_ALEXALogC(unittest.TestCase): """ - Defines :func:`colour.models.rgb.transfer_functions.alexa_log_c.\ + Defines :func:`colour.models.rgb.transfer_functions.arri_alexa_log_c.\ log_decoding_ALEXALogC` definition unit tests methods. """ def test_log_decoding_ALEXALogC(self): """ - Tests :func:`colour.models.rgb.transfer_functions.alexa_log_c.\ + Tests :func:`colour.models.rgb.transfer_functions.arri_alexa_log_c.\ log_decoding_ALEXALogC` definition. """ @@ -113,7 +113,7 @@ def test_log_decoding_ALEXALogC(self): def test_n_dimensional_log_decoding_ALEXALogC(self): """ - Tests :func:`colour.models.rgb.transfer_functions.alexa_log_c.\ + Tests :func:`colour.models.rgb.transfer_functions.arri_alexa_log_c.\ log_decoding_ALEXALogC` definition n-dimensional arrays support. """ @@ -134,7 +134,7 @@ def test_n_dimensional_log_decoding_ALEXALogC(self): def test_domain_range_scale_log_decoding_ALEXALogC(self): """ - Tests :func:`colour.models.rgb.transfer_functions.alexa_log_c.\ + Tests :func:`colour.models.rgb.transfer_functions.arri_alexa_log_c.\ log_decoding_ALEXALogC` definition domain and range scale support. """ @@ -150,7 +150,7 @@ def test_domain_range_scale_log_decoding_ALEXALogC(self): @ignore_numpy_errors def test_nan_log_decoding_ALEXALogC(self): """ - Tests :func:`colour.models.rgb.transfer_functions.alexa_log_c.\ + Tests :func:`colour.models.rgb.transfer_functions.arri_alexa_log_c.\ log_decoding_ALEXALogC` definition nan support. """ diff --git a/colour/models/rgb/transfer_functions/tests/test_common.py b/colour/models/rgb/transfer_functions/tests/test_common.py index 4a336b8610..2c1da30c95 100644 --- a/colour/models/rgb/transfer_functions/tests/test_common.py +++ b/colour/models/rgb/transfer_functions/tests/test_common.py @@ -9,10 +9,8 @@ import numpy as np import unittest -from colour.models.rgb.transfer_functions import ( - CV_range, DECODING_CCTFS, ENCODING_CCTFS, EOTFS, EOTFS_REVERSE, - LOG_DECODING_CURVES, LOG_ENCODING_CURVES, OETFS, OETFS_REVERSE, OOTFS, - OOTFS_REVERSE, legal_to_full, full_to_legal) +from colour.models.rgb.transfer_functions import (CV_range, legal_to_full, + full_to_legal) from colour.utilities import ignore_numpy_errors __author__ = 'Colour Developers' @@ -23,8 +21,9 @@ __status__ = 'Development' __all__ = [ - 'TestCV_range', 'TestLegalToFull', 'TestFullToLegal', - 'TestTransferFunctions' + 'TestCV_range', + 'TestLegalToFull', + 'TestFullToLegal', ] @@ -197,45 +196,5 @@ def test_nan_full_to_legal(self): full_to_legal(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]), 10) -class TestTransferFunctions(unittest.TestCase): - """ - Defines transfer functions unit tests methods. - """ - - def test_transfer_functions(self): - """ - Tests transfer functions reciprocity. - """ - - ignored_transfer_functions = ( - 'ACESproxy', - 'DICOM GSDF', - 'D-Log', - 'Filmic Pro 6', - ) - - reciprocal_mappings = [ - (LOG_ENCODING_CURVES, LOG_DECODING_CURVES), - (OETFS, OETFS_REVERSE), - (EOTFS, EOTFS_REVERSE), - (ENCODING_CCTFS, DECODING_CCTFS), - (OOTFS, OOTFS_REVERSE), - ] - - samples = np.hstack( - [np.linspace(0, 1, 1e5), - np.linspace(0, 65504, 65504 * 10)]) - - for encoding_mapping, _decoding_mapping in reciprocal_mappings: - for name in encoding_mapping: - if name in ignored_transfer_functions: - continue - - encoded_s = ENCODING_CCTFS[name](samples) - decoded_s = DECODING_CCTFS[name](encoded_s) - - np.testing.assert_almost_equal(samples, decoded_s, decimal=7) - - if __name__ == '__main__': unittest.main() diff --git a/colour/models/rgb/transfer_functions/tests/test_dcdm.py b/colour/models/rgb/transfer_functions/tests/test_dcdm.py index 91726d5169..835316eba1 100644 --- a/colour/models/rgb/transfer_functions/tests/test_dcdm.py +++ b/colour/models/rgb/transfer_functions/tests/test_dcdm.py @@ -9,7 +9,7 @@ import numpy as np import unittest -from colour.models.rgb.transfer_functions import eotf_reverse_DCDM, eotf_DCDM +from colour.models.rgb.transfer_functions import eotf_inverse_DCDM, eotf_DCDM from colour.utilities import domain_range_scale, ignore_numpy_errors __author__ = 'Colour Developers' @@ -19,76 +19,76 @@ __email__ = 'colour-science@googlegroups.com' __status__ = 'Production' -__all__ = ['TestEotf_reverse_DCDM', 'TestEotf_DCDM'] +__all__ = ['TestEotf_inverse_DCDM', 'TestEotf_DCDM'] -class TestEotf_reverse_DCDM(unittest.TestCase): +class TestEotf_inverse_DCDM(unittest.TestCase): """ - Defines :func:`colour.models.rgb.transfer_functions.dcdm.eotf_reverse_DCDM` + Defines :func:`colour.models.rgb.transfer_functions.dcdm.eotf_inverse_DCDM` definition unit tests methods. """ - def test_eotf_reverse_DCDM(self): + def test_eotf_inverse_DCDM(self): """ Tests :func:`colour.models.rgb.transfer_functions.\ -dcdm.eotf_reverse_DCDM` definition. +dcdm.eotf_inverse_DCDM` definition. """ - self.assertAlmostEqual(eotf_reverse_DCDM(0.0), 0.0, places=7) + self.assertAlmostEqual(eotf_inverse_DCDM(0.0), 0.0, places=7) - self.assertAlmostEqual(eotf_reverse_DCDM(0.18), 0.11281861, places=7) + self.assertAlmostEqual(eotf_inverse_DCDM(0.18), 0.11281861, places=7) - self.assertAlmostEqual(eotf_reverse_DCDM(1.0), 0.21817973, places=7) + self.assertAlmostEqual(eotf_inverse_DCDM(1.0), 0.21817973, places=7) - self.assertEqual(eotf_reverse_DCDM(0.18, out_int=True), 462) + self.assertEqual(eotf_inverse_DCDM(0.18, out_int=True), 462) - def test_n_dimensional_eotf_reverse_DCDM(self): + def test_n_dimensional_eotf_inverse_DCDM(self): """ Tests :func:`colour.models.rgb.transfer_functions.dcdm.\ -eotf_reverse_DCDM` definition n-dimensional arrays support. +eotf_inverse_DCDM` definition n-dimensional arrays support. """ XYZ = 0.18 - XYZ_p = eotf_reverse_DCDM(XYZ) + XYZ_p = eotf_inverse_DCDM(XYZ) XYZ = np.tile(XYZ, 6) XYZ_p = np.tile(XYZ_p, 6) np.testing.assert_almost_equal( - eotf_reverse_DCDM(XYZ), XYZ_p, decimal=7) + eotf_inverse_DCDM(XYZ), XYZ_p, decimal=7) XYZ = np.reshape(XYZ, (2, 3)) XYZ_p = np.reshape(XYZ_p, (2, 3)) np.testing.assert_almost_equal( - eotf_reverse_DCDM(XYZ), XYZ_p, decimal=7) + eotf_inverse_DCDM(XYZ), XYZ_p, decimal=7) XYZ = np.reshape(XYZ, (2, 3, 1)) XYZ_p = np.reshape(XYZ_p, (2, 3, 1)) np.testing.assert_almost_equal( - eotf_reverse_DCDM(XYZ), XYZ_p, decimal=7) + eotf_inverse_DCDM(XYZ), XYZ_p, decimal=7) - def test_domain_range_scale_eotf_reverse_DCDM(self): + def test_domain_range_scale_eotf_inverse_DCDM(self): """ Tests :func:`colour.models.rgb.transfer_functions.\ -dcdm.eotf_reverse_DCDM` definition domain and range scale support. +dcdm.eotf_inverse_DCDM` definition domain and range scale support. """ XYZ = 0.18 - XYZ_p = eotf_reverse_DCDM(XYZ) + XYZ_p = eotf_inverse_DCDM(XYZ) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - eotf_reverse_DCDM(XYZ * factor), XYZ_p * factor, decimal=7) + eotf_inverse_DCDM(XYZ * factor), XYZ_p * factor, decimal=7) @ignore_numpy_errors - def test_nan_eotf_reverse_DCDM(self): + def test_nan_eotf_inverse_DCDM(self): """ Tests :func:`colour.models.rgb.transfer_functions.dcdm.\ -eotf_reverse_DCDM` definition nan support. +eotf_inverse_DCDM` definition nan support. """ - eotf_reverse_DCDM(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + eotf_inverse_DCDM(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) class TestEotf_DCDM(unittest.TestCase): diff --git a/colour/models/rgb/transfer_functions/tests/test_dicom_gsdf.py b/colour/models/rgb/transfer_functions/tests/test_dicom_gsdf.py index 08fb7a89da..a4dbc01541 100644 --- a/colour/models/rgb/transfer_functions/tests/test_dicom_gsdf.py +++ b/colour/models/rgb/transfer_functions/tests/test_dicom_gsdf.py @@ -9,7 +9,8 @@ import numpy as np import unittest -from colour.models.rgb.transfer_functions import oetf_DICOMGSDF, eotf_DICOMGSDF +from colour.models.rgb.transfer_functions import (eotf_inverse_DICOMGSDF, + eotf_DICOMGSDF) from colour.utilities import domain_range_scale, ignore_numpy_errors __author__ = 'Colour Developers' @@ -19,77 +20,78 @@ __email__ = 'colour-science@googlegroups.com' __status__ = 'Production' -__all__ = ['TestOetf_DICOMGSDF', 'TestEotf_DICOMGSDF'] +__all__ = ['TestEotf_inverse_DICOMGSDF', 'TestEotf_DICOMGSDF'] -class TestOetf_DICOMGSDF(unittest.TestCase): +class TestEotf_inverse_DICOMGSDF(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.dicom_gsdf.\ -oetf_DICOMGSDF` definition unit tests methods. +eotf_inverse_DICOMGSDF` definition unit tests methods. """ - def test_oetf_DICOMGSDF(self): + def test_eotf_inverse_DICOMGSDF(self): """ Tests :func:`colour.models.rgb.transfer_functions.dicom_gsdf.\ -oetf_DICOMGSDF` definition. +eotf_inverse_DICOMGSDF` definition. """ self.assertAlmostEqual( - oetf_DICOMGSDF(0.05), 0.001007281350787, places=7) + eotf_inverse_DICOMGSDF(0.05), 0.001007281350787, places=7) self.assertAlmostEqual( - oetf_DICOMGSDF(130.0662), 0.500486263438448, places=7) + eotf_inverse_DICOMGSDF(130.0662), 0.500486263438448, places=7) self.assertAlmostEqual( - oetf_DICOMGSDF(4000), 1.000160314715578, places=7) + eotf_inverse_DICOMGSDF(4000), 1.000160314715578, places=7) self.assertAlmostEqual( - oetf_DICOMGSDF(130.0662, out_int=True), 512, places=7) + eotf_inverse_DICOMGSDF(130.0662, out_int=True), 512, places=7) - def test_n_dimensional_oetf_DICOMGSDF(self): + def test_n_dimensional_eotf_inverse_DICOMGSDF(self): """ Tests :func:`colour.models.rgb.transfer_functions.dicom_gsdf.\ -oetf_DICOMGSDF` definition n-dimensional arrays support. +eotf_inverse_DICOMGSDF` definition n-dimensional arrays support. """ L = 130.0662 - J = oetf_DICOMGSDF(L) + J = eotf_inverse_DICOMGSDF(L) L = np.tile(L, 6) J = np.tile(J, 6) - np.testing.assert_almost_equal(oetf_DICOMGSDF(L), J, decimal=7) + np.testing.assert_almost_equal(eotf_inverse_DICOMGSDF(L), J, decimal=7) L = np.reshape(L, (2, 3)) J = np.reshape(J, (2, 3)) - np.testing.assert_almost_equal(oetf_DICOMGSDF(L), J, decimal=7) + np.testing.assert_almost_equal(eotf_inverse_DICOMGSDF(L), J, decimal=7) L = np.reshape(L, (2, 3, 1)) J = np.reshape(J, (2, 3, 1)) - np.testing.assert_almost_equal(oetf_DICOMGSDF(L), J, decimal=7) + np.testing.assert_almost_equal(eotf_inverse_DICOMGSDF(L), J, decimal=7) - def test_domain_range_scale_oetf_DICOMGSDF(self): + def test_domain_range_scale_eotf_inverse_DICOMGSDF(self): """ Tests :func:`colour.models.rgb.transfer_functions.dicom_gsdf.\ -oetf_DICOMGSDF` definition domain and range scale support. +eotf_inverse_DICOMGSDF` definition domain and range scale support. """ L = 130.0662 - J = oetf_DICOMGSDF(L) + J = eotf_inverse_DICOMGSDF(L) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - oetf_DICOMGSDF(L * factor), J * factor, decimal=7) + eotf_inverse_DICOMGSDF(L * factor), J * factor, decimal=7) @ignore_numpy_errors - def test_nan_oetf_DICOMGSDF(self): + def test_nan_eotf_inverse_DICOMGSDF(self): """ Tests :func:`colour.models.rgb.transfer_functions.dicom_gsdf.\ -oetf_DICOMGSDF` definition nan support. +eotf_inverse_DICOMGSDF` definition nan support. """ - oetf_DICOMGSDF(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + eotf_inverse_DICOMGSDF( + np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) class TestEotf_DICOMGSDF(unittest.TestCase): diff --git a/colour/models/rgb/transfer_functions/tests/test_dji_dlog.py b/colour/models/rgb/transfer_functions/tests/test_dji_dlog.py index 62ac7713da..a8e2ca5bae 100644 --- a/colour/models/rgb/transfer_functions/tests/test_dji_dlog.py +++ b/colour/models/rgb/transfer_functions/tests/test_dji_dlog.py @@ -97,8 +97,8 @@ class TestLogDecoding_DJIDLog(unittest.TestCase): def test_log_decoding_DJIDLog(self): """ - Tests :func:`colour.models.rgb.transfer_functions.filmlight_tlog.\ -log_decoding_FilmLight_T_Log` definition. + Tests :func:`colour.models.rgb.transfer_functions.dji_dlog.\ +log_decoding_DJIDLog` definition. """ self.assertAlmostEqual(log_decoding_DJIDLog(0.0929), 0.0, places=7) @@ -147,8 +147,8 @@ def test_domain_range_scale_log_decoding_DLog(self): @ignore_numpy_errors def test_nan_log_decoding_DLog(self): """ - Tests :func:`colour.models.rgb.transfer_functions.filmlight_tlog.\ -log_decoding_FilmLight_T_Log` definition nan support. + Tests :func:`colour.models.rgb.transfer_functions.dji_dlog.\ +log_decoding_DJIDLog` definition nan support. """ log_decoding_DJIDLog( diff --git a/colour/models/rgb/transfer_functions/tests/test_fujifilm_flog.py b/colour/models/rgb/transfer_functions/tests/test_fujifilm_flog.py new file mode 100644 index 0000000000..39f9fc9460 --- /dev/null +++ b/colour/models/rgb/transfer_functions/tests/test_fujifilm_flog.py @@ -0,0 +1,193 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.models.rgb.transfer_functions.\ +fujifilm_flog` module. +""" + +from __future__ import division, unicode_literals + +import numpy as np +import unittest + +from colour.models.rgb.transfer_functions import (log_encoding_FLog, + log_decoding_FLog) +from colour.utilities import domain_range_scale, ignore_numpy_errors + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = ['TestLogEncoding_VLog', 'TestLogDecoding_VLog'] + + +class TestLogEncoding_VLog(unittest.TestCase): + """ + Defines :func:`colour.models.rgb.transfer_functions.fujifilm_flog.\ +log_encoding_FLog` definition unit tests methods. + """ + + def test_log_encoding_FLog(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.fujifilm_flog.\ +log_encoding_FLog` definition. + """ + + self.assertAlmostEqual( + log_encoding_FLog(0.0), 0.092864000000000, places=7) + + self.assertAlmostEqual( + log_encoding_FLog(0.18), 0.459318458661621, places=7) + + self.assertAlmostEqual( + log_encoding_FLog(0.18, 12), 0.459318458661621, places=7) + + self.assertAlmostEqual( + log_encoding_FLog(0.18, 10, False), 0.463336510514656, places=7) + + self.assertAlmostEqual( + log_encoding_FLog(0.18, 10, False, False), + 0.446590337236003, + places=7) + + self.assertAlmostEqual( + log_encoding_FLog(1.0), 0.704996409216428, places=7) + + def test_n_dimensional_log_encoding_FLog(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.fujifilm_flog.\ +log_encoding_FLog` definition n-dimensional arrays support. + """ + + L_in = 0.18 + V_out = log_encoding_FLog(L_in) + + L_in = np.tile(L_in, 6) + V_out = np.tile(V_out, 6) + np.testing.assert_almost_equal( + log_encoding_FLog(L_in), V_out, decimal=7) + + L_in = np.reshape(L_in, (2, 3)) + V_out = np.reshape(V_out, (2, 3)) + np.testing.assert_almost_equal( + log_encoding_FLog(L_in), V_out, decimal=7) + + L_in = np.reshape(L_in, (2, 3, 1)) + V_out = np.reshape(V_out, (2, 3, 1)) + np.testing.assert_almost_equal( + log_encoding_FLog(L_in), V_out, decimal=7) + + def test_domain_range_scale_log_encoding_FLog(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.fujifilm_flog.\ +log_encoding_FLog` definition domain and range scale support. + """ + + L_in = 0.18 + V_out = log_encoding_FLog(L_in) + + d_r = (('reference', 1), (1, 1), (100, 100)) + for scale, factor in d_r: + with domain_range_scale(scale): + np.testing.assert_almost_equal( + log_encoding_FLog(L_in * factor), + V_out * factor, + decimal=7) + + @ignore_numpy_errors + def test_nan_log_encoding_FLog(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.fujifilm_flog.\ +log_encoding_FLog` definition nan support. + """ + + log_encoding_FLog(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + + +class TestLogDecoding_VLog(unittest.TestCase): + """ + Defines :func:`colour.models.rgb.transfer_functions.fujifilm_flog.\ +log_decoding_FLog` definition unit tests methods. + """ + + def test_log_decoding_FLog(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.fujifilm_flog.\ +log_decoding_FLog` definition. + """ + + self.assertAlmostEqual( + log_decoding_FLog(0.092864000000000), 0.0, places=7) + + self.assertAlmostEqual( + log_decoding_FLog(0.459318458661621), 0.18, places=7) + + self.assertAlmostEqual( + log_decoding_FLog(0.459318458661621, 12), 0.18, places=7) + + self.assertAlmostEqual( + log_decoding_FLog(0.463336510514656, 10, False), 0.18, places=7) + + self.assertAlmostEqual( + log_decoding_FLog(0.446590337236003, 10, False, False), + 0.18, + places=7) + + self.assertAlmostEqual( + log_decoding_FLog(0.704996409216428), 1.0, places=7) + + def test_n_dimensional_log_decoding_FLog(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.fujifilm_flog.\ +log_decoding_FLog` definition n-dimensional arrays support. + """ + + V_out = 0.459318458661621 + L_in = log_decoding_FLog(V_out) + + V_out = np.tile(V_out, 6) + L_in = np.tile(L_in, 6) + np.testing.assert_almost_equal( + log_decoding_FLog(V_out), L_in, decimal=7) + + V_out = np.reshape(V_out, (2, 3)) + L_in = np.reshape(L_in, (2, 3)) + np.testing.assert_almost_equal( + log_decoding_FLog(V_out), L_in, decimal=7) + + V_out = np.reshape(V_out, (2, 3, 1)) + L_in = np.reshape(L_in, (2, 3, 1)) + np.testing.assert_almost_equal( + log_decoding_FLog(V_out), L_in, decimal=7) + + def test_domain_range_scale_log_decoding_FLog(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.fujifilm_flog.\ +log_decoding_FLog` definition domain and range scale support. + """ + + V_out = 0.459318458661621 + L_in = log_decoding_FLog(V_out) + + d_r = (('reference', 1), (1, 1), (100, 100)) + for scale, factor in d_r: + with domain_range_scale(scale): + np.testing.assert_almost_equal( + log_decoding_FLog(V_out * factor), + L_in * factor, + decimal=7) + + @ignore_numpy_errors + def test_nan_log_decoding_FLog(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.fujifilm_flog.\ +log_decoding_FLog` definition nan support. + """ + + log_decoding_FLog(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/models/rgb/transfer_functions/tests/test_gamma.py b/colour/models/rgb/transfer_functions/tests/test_gamma.py index 060e379ee4..03df3c7ea7 100644 --- a/colour/models/rgb/transfer_functions/tests/test_gamma.py +++ b/colour/models/rgb/transfer_functions/tests/test_gamma.py @@ -147,6 +147,14 @@ def test_n_dimensional_gamma_function(self): np.testing.assert_almost_equal( gamma_function(a, 2.2, 'Clamp'), a_p, decimal=7) + def test_raise_exception_gamma_function(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.gamma.\ +gamma_function` definition raised exception. + """ + + self.assertRaises(ValueError, gamma_function, 0.18, 1, 'Undefined') + @ignore_numpy_errors def test_nan_gamma_function(self): """ diff --git a/colour/models/rgb/transfer_functions/tests/test_itur_bt_1886.py b/colour/models/rgb/transfer_functions/tests/test_itur_bt_1886.py index a415ad8bfe..aaf8bcfe05 100644 --- a/colour/models/rgb/transfer_functions/tests/test_itur_bt_1886.py +++ b/colour/models/rgb/transfer_functions/tests/test_itur_bt_1886.py @@ -9,7 +9,7 @@ import numpy as np import unittest -from colour.models.rgb.transfer_functions import (eotf_reverse_BT1886, +from colour.models.rgb.transfer_functions import (eotf_inverse_BT1886, eotf_BT1886) from colour.utilities import domain_range_scale, ignore_numpy_errors @@ -20,72 +20,72 @@ __email__ = 'colour-science@googlegroups.com' __status__ = 'Production' -__all__ = ['TestEotf_reverse_BT1886', 'TestEotf_BT1886'] +__all__ = ['TestEotf_inverse_BT1886', 'TestEotf_BT1886'] -class TestEotf_reverse_BT1886(unittest.TestCase): +class TestEotf_inverse_BT1886(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.itur_bt_1886.\ -eotf_reverse_BT1886` definition unit tests methods. +eotf_inverse_BT1886` definition unit tests methods. """ - def test_eotf_reverse_BT1886(self): + def test_eotf_inverse_BT1886(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_1886.\ -eotf_reverse_BT1886` definition. +eotf_inverse_BT1886` definition. """ - self.assertAlmostEqual(eotf_reverse_BT1886(0.0), 0.0, places=7) + self.assertAlmostEqual(eotf_inverse_BT1886(0.0), 0.0, places=7) self.assertAlmostEqual( - eotf_reverse_BT1886(0.016317514686316), 0.18, places=7) + eotf_inverse_BT1886(0.016317514686316), 0.18, places=7) - self.assertAlmostEqual(eotf_reverse_BT1886(1.0), 1.0, places=7) + self.assertAlmostEqual(eotf_inverse_BT1886(1.0), 1.0, places=7) - def test_n_dimensional_eotf_reverse_BT1886(self): + def test_n_dimensional_eotf_inverse_BT1886(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_1886.\ -eotf_reverse_BT1886` definition n-dimensional arrays support. +eotf_inverse_BT1886` definition n-dimensional arrays support. """ L = 0.016317514686316 - V = eotf_reverse_BT1886(L) + V = eotf_inverse_BT1886(L) L = np.tile(L, 6) V = np.tile(V, 6) - np.testing.assert_almost_equal(eotf_reverse_BT1886(L), V, decimal=7) + np.testing.assert_almost_equal(eotf_inverse_BT1886(L), V, decimal=7) L = np.reshape(L, (2, 3)) V = np.reshape(V, (2, 3)) - np.testing.assert_almost_equal(eotf_reverse_BT1886(L), V, decimal=7) + np.testing.assert_almost_equal(eotf_inverse_BT1886(L), V, decimal=7) L = np.reshape(L, (2, 3, 1)) V = np.reshape(V, (2, 3, 1)) - np.testing.assert_almost_equal(eotf_reverse_BT1886(L), V, decimal=7) + np.testing.assert_almost_equal(eotf_inverse_BT1886(L), V, decimal=7) - def test_domain_range_scale_eotf_reverse_BT1886(self): + def test_domain_range_scale_eotf_inverse_BT1886(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_1886.\ -eotf_reverse_BT1886` definition domain and range scale support. +eotf_inverse_BT1886` definition domain and range scale support. """ L = 0.18 - V = eotf_reverse_BT1886(L) + V = eotf_inverse_BT1886(L) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - eotf_reverse_BT1886(L * factor), V * factor, decimal=7) + eotf_inverse_BT1886(L * factor), V * factor, decimal=7) @ignore_numpy_errors - def test_nan_eotf_reverse_BT1886(self): + def test_nan_eotf_inverse_BT1886(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_1886.\ -eotf_reverse_BT1886` definition nan support. +eotf_inverse_BT1886` definition nan support. """ - eotf_reverse_BT1886( + eotf_inverse_BT1886( np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) diff --git a/colour/models/rgb/transfer_functions/tests/test_itur_bt_2100.py b/colour/models/rgb/transfer_functions/tests/test_itur_bt_2100.py index d3cb23419d..9878f5a41f 100644 --- a/colour/models/rgb/transfer_functions/tests/test_itur_bt_2100.py +++ b/colour/models/rgb/transfer_functions/tests/test_itur_bt_2100.py @@ -10,12 +10,15 @@ import unittest from colour.models.rgb.transfer_functions import ( - oetf_BT2100_PQ, oetf_reverse_BT2100_PQ, eotf_BT2100_PQ, - eotf_reverse_BT2100_PQ, ootf_BT2100_PQ, ootf_reverse_BT2100_PQ, - oetf_BT2100_HLG, oetf_reverse_BT2100_HLG, eotf_BT2100_HLG, - eotf_reverse_BT2100_HLG, ootf_BT2100_HLG, ootf_reverse_BT2100_HLG) + oetf_PQ_BT2100, oetf_inverse_PQ_BT2100, eotf_PQ_BT2100, + eotf_inverse_PQ_BT2100, ootf_PQ_BT2100, ootf_inverse_PQ_BT2100, + oetf_HLG_BT2100, oetf_inverse_HLG_BT2100) from colour.models.rgb.transfer_functions.itur_bt_2100 import ( - gamma_function_BT2100_HLG) + eotf_HLG_BT2100_1, eotf_HLG_BT2100_2, eotf_inverse_HLG_BT2100_1, + eotf_inverse_HLG_BT2100_2, ootf_HLG_BT2100_1, ootf_HLG_BT2100_2, + ootf_inverse_HLG_BT2100_1, ootf_inverse_HLG_BT2100_2) +from colour.models.rgb.transfer_functions.itur_bt_2100 import ( + gamma_function_HLG_BT2100) from colour.utilities import domain_range_scale, ignore_numpy_errors __author__ = 'Colour Developers' @@ -26,985 +29,1377 @@ __status__ = 'Production' __all__ = [ - 'TestOetf_BT2100_PQ', 'TestOetf_reverse_BT2100_PQ', 'TestEotf_BT2100_PQ', - 'TestEotf_reverse_BT2100_PQ', 'TestOotf_BT2100_PQ', - 'TestOotf_reverse_BT2100_PQ', 'TestGamma_function_BT2100_HLG', - 'TestOetf_BT2100_HLG', 'TestOetf_reverse_BT2100_HLG', - 'TestEotf_BT2100_HLG', 'TestEotf_reverse_BT2100_HLG', - 'TestOotf_BT2100_HLG', 'TestOotf_reverse_BT2100_HLG' + 'TestOetf_PQ_BT2100', 'TestOetf_inverse_PQ_BT2100', 'TestEotf_PQ_BT2100', + 'TestEotf_inverse_PQ_BT2100', 'TestOotf_PQ_BT2100', + 'TestOotf_inverse_PQ_BT2100', 'TestGamma_function_HLG_BT2100', + 'TestOetf_HLG_BT2100', 'TestOetf_inverse_HLG_BT2100', + 'TestEotf_HLG_BT2100_1', 'TestEotf_HLG_BT2100_2', + 'TestEotf_inverse_HLG_BT2100_1', 'TestEotf_inverse_HLG_BT2100_2', + 'TestOotf_HLG_BT2100_1', 'TestOotf_HLG_BT2100_2', + 'TestOotf_inverse_HLG_BT2100_1', 'TestOotf_inverse_HLG_BT2100_2' ] -class TestOetf_BT2100_PQ(unittest.TestCase): +class TestOetf_PQ_BT2100(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -oetf_BT2100_PQ` definition unit tests methods. +oetf_PQ_BT2100` definition unit tests methods. """ - def test_oetf_BT2100_PQ(self): + def test_oetf_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -oetf_BT2100_PQ` definition. +oetf_PQ_BT2100` definition. """ self.assertAlmostEqual( - oetf_BT2100_PQ(0.0), 0.000000730955903, places=7) + oetf_PQ_BT2100(0.0), 0.000000730955903, places=7) self.assertAlmostEqual( - oetf_BT2100_PQ(0.1), 0.724769816665726, places=7) + oetf_PQ_BT2100(0.1), 0.724769816665726, places=7) self.assertAlmostEqual( - oetf_BT2100_PQ(1.0), 0.999999934308041, places=7) + oetf_PQ_BT2100(1.0), 0.999999934308041, places=7) - def test_n_dimensional_oetf_BT2100_PQ(self): + def test_n_dimensional_oetf_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -oetf_BT2100_PQ` definition n-dimensional arrays support. +oetf_PQ_BT2100` definition n-dimensional arrays support. """ E = 0.1 - E_p = oetf_BT2100_PQ(E) + E_p = oetf_PQ_BT2100(E) E = np.tile(E, 6) E_p = np.tile(E_p, 6) - np.testing.assert_almost_equal(oetf_BT2100_PQ(E), E_p, decimal=7) + np.testing.assert_almost_equal(oetf_PQ_BT2100(E), E_p, decimal=7) E = np.reshape(E, (2, 3)) E_p = np.reshape(E_p, (2, 3)) - np.testing.assert_almost_equal(oetf_BT2100_PQ(E), E_p, decimal=7) + np.testing.assert_almost_equal(oetf_PQ_BT2100(E), E_p, decimal=7) E = np.reshape(E, (2, 3, 1)) E_p = np.reshape(E_p, (2, 3, 1)) - np.testing.assert_almost_equal(oetf_BT2100_PQ(E), E_p, decimal=7) + np.testing.assert_almost_equal(oetf_PQ_BT2100(E), E_p, decimal=7) - def test_domain_range_scale_oetf_BT2100_PQ(self): + def test_domain_range_scale_oetf_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -oetf_BT2100_PQ` definition domain and range scale support. +oetf_PQ_BT2100` definition domain and range scale support. """ E = 0.1 - E_p = oetf_BT2100_PQ(E) + E_p = oetf_PQ_BT2100(E) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - oetf_BT2100_PQ(E * factor), E_p * factor, decimal=7) + oetf_PQ_BT2100(E * factor), E_p * factor, decimal=7) @ignore_numpy_errors - def test_nan_oetf_BT2100_PQ(self): + def test_nan_oetf_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -oetf_BT2100_PQ` definition nan support. +oetf_PQ_BT2100` definition nan support. """ - oetf_BT2100_PQ(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + oetf_PQ_BT2100(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) -class TestOetf_reverse_BT2100_PQ(unittest.TestCase): +class TestOetf_inverse_PQ_BT2100(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -oetf_reverse_BT2100_PQ` definition unit tests methods. +oetf_inverse_PQ_BT2100` definition unit tests methods. """ - def test_oetf_reverse_BT2100_PQ(self): + def test_oetf_inverse_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -oetf_reverse_BT2100_PQ` definition. +oetf_inverse_PQ_BT2100` definition. """ self.assertAlmostEqual( - oetf_reverse_BT2100_PQ(0.000000730955903), 0.0, places=7) + oetf_inverse_PQ_BT2100(0.000000730955903), 0.0, places=7) self.assertAlmostEqual( - oetf_reverse_BT2100_PQ(0.724769816665726), 0.1, places=7) + oetf_inverse_PQ_BT2100(0.724769816665726), 0.1, places=7) self.assertAlmostEqual( - oetf_reverse_BT2100_PQ(0.999999934308041), 1.0, places=7) + oetf_inverse_PQ_BT2100(0.999999934308041), 1.0, places=7) - def test_n_dimensional_oetf_reverse_BT2100_PQ(self): + def test_n_dimensional_oetf_inverse_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -oetf_reverse_BT2100_PQ` definition n-dimensional arrays support. +oetf_inverse_PQ_BT2100` definition n-dimensional arrays support. """ E_p = 0.724769816665726 - E = oetf_reverse_BT2100_PQ(E_p) + E = oetf_inverse_PQ_BT2100(E_p) E_p = np.tile(E_p, 6) E = np.tile(E, 6) np.testing.assert_almost_equal( - oetf_reverse_BT2100_PQ(E_p), E, decimal=7) + oetf_inverse_PQ_BT2100(E_p), E, decimal=7) E_p = np.reshape(E_p, (2, 3)) E = np.reshape(E, (2, 3)) np.testing.assert_almost_equal( - oetf_reverse_BT2100_PQ(E_p), E, decimal=7) + oetf_inverse_PQ_BT2100(E_p), E, decimal=7) E_p = np.reshape(E_p, (2, 3, 1)) E = np.reshape(E, (2, 3, 1)) np.testing.assert_almost_equal( - oetf_reverse_BT2100_PQ(E_p), E, decimal=7) + oetf_inverse_PQ_BT2100(E_p), E, decimal=7) - def test_domain_range_scale_oetf_reverse_BT2100_PQ(self): + def test_domain_range_scale_oetf_inverse_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -oetf_reverse_BT2100_PQ` definition domain and range scale support. +oetf_inverse_PQ_BT2100` definition domain and range scale support. """ E_p = 0.724769816665726 - E = oetf_reverse_BT2100_PQ(E_p) + E = oetf_inverse_PQ_BT2100(E_p) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - oetf_reverse_BT2100_PQ(E_p * factor), + oetf_inverse_PQ_BT2100(E_p * factor), E * factor, decimal=7) @ignore_numpy_errors - def test_nan_oetf_reverse_BT2100_PQ(self): + def test_nan_oetf_inverse_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -oetf_reverse_BT2100_PQ` definition nan support. +oetf_inverse_PQ_BT2100` definition nan support. """ - oetf_reverse_BT2100_PQ( + oetf_inverse_PQ_BT2100( np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) -class TestEotf_BT2100_PQ(unittest.TestCase): +class TestEotf_PQ_BT2100(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -eotf_BT2100_PQ` definition unit tests methods. +eotf_PQ_BT2100` definition unit tests methods. """ - def test_eotf_BT2100_PQ(self): + def test_eotf_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -eotf_BT2100_PQ` definition. +eotf_PQ_BT2100` definition. """ - self.assertAlmostEqual(eotf_BT2100_PQ(0.0), 0.0, places=7) + self.assertAlmostEqual(eotf_PQ_BT2100(0.0), 0.0, places=7) self.assertAlmostEqual( - eotf_BT2100_PQ(0.724769816665726), 779.98836083408537, places=7) + eotf_PQ_BT2100(0.724769816665726), 779.98836083408537, places=7) - self.assertAlmostEqual(eotf_BT2100_PQ(1.0), 10000.0, places=7) + self.assertAlmostEqual(eotf_PQ_BT2100(1.0), 10000.0, places=7) - def test_n_dimensional_eotf_BT2100_PQ(self): + def test_n_dimensional_eotf_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -eotf_BT2100_PQ` definition n-dimensional arrays support. +eotf_PQ_BT2100` definition n-dimensional arrays support. """ E_p = 0.724769816665726 - F_D = eotf_BT2100_PQ(E_p) + F_D = eotf_PQ_BT2100(E_p) E_p = np.tile(E_p, 6) F_D = np.tile(F_D, 6) - np.testing.assert_almost_equal(eotf_BT2100_PQ(E_p), F_D, decimal=7) + np.testing.assert_almost_equal(eotf_PQ_BT2100(E_p), F_D, decimal=7) E_p = np.reshape(E_p, (2, 3)) F_D = np.reshape(F_D, (2, 3)) - np.testing.assert_almost_equal(eotf_BT2100_PQ(E_p), F_D, decimal=7) + np.testing.assert_almost_equal(eotf_PQ_BT2100(E_p), F_D, decimal=7) E_p = np.reshape(E_p, (2, 3, 1)) F_D = np.reshape(F_D, (2, 3, 1)) - np.testing.assert_almost_equal(eotf_BT2100_PQ(E_p), F_D, decimal=7) + np.testing.assert_almost_equal(eotf_PQ_BT2100(E_p), F_D, decimal=7) - def test_domain_range_scale_eotf_BT2100_PQ(self): + def test_domain_range_scale_eotf_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -eotf_BT2100_PQ` definition domain and range scale support. +eotf_PQ_BT2100` definition domain and range scale support. """ E_p = 0.724769816665726 - F_D = eotf_BT2100_PQ(E_p) + F_D = eotf_PQ_BT2100(E_p) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - eotf_BT2100_PQ(E_p * factor), F_D * factor, decimal=7) + eotf_PQ_BT2100(E_p * factor), F_D * factor, decimal=7) @ignore_numpy_errors - def test_nan_eotf_BT2100_PQ(self): + def test_nan_eotf_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -eotf_BT2100_PQ` definition nan support. +eotf_PQ_BT2100` definition nan support. """ - eotf_BT2100_PQ(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + eotf_PQ_BT2100(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) -class TestEotf_reverse_BT2100_PQ(unittest.TestCase): +class TestEotf_inverse_PQ_BT2100(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -eotf_reverse_BT2100_PQ` definition unit tests methods. +eotf_inverse_PQ_BT2100` definition unit tests methods. """ - def test_eotf_reverse_BT2100_PQ(self): + def test_eotf_inverse_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -eotf_reverse_BT2100_PQ` definition. +eotf_inverse_PQ_BT2100` definition. """ self.assertAlmostEqual( - eotf_reverse_BT2100_PQ(0.0), 0.000000730955903, places=7) + eotf_inverse_PQ_BT2100(0.0), 0.000000730955903, places=7) self.assertAlmostEqual( - eotf_reverse_BT2100_PQ(779.98836083408537), + eotf_inverse_PQ_BT2100(779.98836083408537), 0.724769816665726, places=7) - self.assertAlmostEqual(eotf_reverse_BT2100_PQ(10000.0), 1.0, places=7) + self.assertAlmostEqual(eotf_inverse_PQ_BT2100(10000.0), 1.0, places=7) - def test_n_dimensional_eotf_reverse_BT2100_PQ(self): + def test_n_dimensional_eotf_inverse_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -eotf_reverse_BT2100_PQ` definition n-dimensional arrays support. +eotf_inverse_PQ_BT2100` definition n-dimensional arrays support. """ F_D = 779.98836083408537 - E_p = eotf_reverse_BT2100_PQ(F_D) + E_p = eotf_inverse_PQ_BT2100(F_D) F_D = np.tile(F_D, 6) E_p = np.tile(E_p, 6) np.testing.assert_almost_equal( - eotf_reverse_BT2100_PQ(F_D), E_p, decimal=7) + eotf_inverse_PQ_BT2100(F_D), E_p, decimal=7) F_D = np.reshape(F_D, (2, 3)) E_p = np.reshape(E_p, (2, 3)) np.testing.assert_almost_equal( - eotf_reverse_BT2100_PQ(F_D), E_p, decimal=7) + eotf_inverse_PQ_BT2100(F_D), E_p, decimal=7) F_D = np.reshape(F_D, (2, 3, 1)) E_p = np.reshape(E_p, (2, 3, 1)) np.testing.assert_almost_equal( - eotf_reverse_BT2100_PQ(F_D), E_p, decimal=7) + eotf_inverse_PQ_BT2100(F_D), E_p, decimal=7) - def test_domain_range_scale_eotf_reverse_BT2100_PQ(self): + def test_domain_range_scale_eotf_inverse_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -eotf_reverse_BT2100_PQ` definition domain and range scale support. +eotf_inverse_PQ_BT2100` definition domain and range scale support. """ F_D = 779.98836083408537 - E_p = eotf_reverse_BT2100_PQ(F_D) + E_p = eotf_inverse_PQ_BT2100(F_D) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - eotf_reverse_BT2100_PQ(F_D * factor), + eotf_inverse_PQ_BT2100(F_D * factor), E_p * factor, decimal=7) @ignore_numpy_errors - def test_nan_eotf_reverse_BT2100_PQ(self): + def test_nan_eotf_inverse_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -eotf_reverse_BT2100_PQ` definition nan support. +eotf_inverse_PQ_BT2100` definition nan support. """ - eotf_reverse_BT2100_PQ( + eotf_inverse_PQ_BT2100( np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) -class TestOotf_BT2100_PQ(unittest.TestCase): +class TestOotf_PQ_BT2100(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -ootf_BT2100_PQ` definition unit tests methods. +ootf_PQ_BT2100` definition unit tests methods. """ - def test_ootf_BT2100_PQ(self): + def test_ootf_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -ootf_BT2100_PQ` definition. +ootf_PQ_BT2100` definition. """ - self.assertAlmostEqual(ootf_BT2100_PQ(0.0), 0.0, places=7) + self.assertAlmostEqual(ootf_PQ_BT2100(0.0), 0.0, places=7) self.assertAlmostEqual( - ootf_BT2100_PQ(0.1), 779.98836083411584, places=7) + ootf_PQ_BT2100(0.1), 779.98836083411584, places=7) self.assertAlmostEqual( - ootf_BT2100_PQ(1.0), 9999.993723673924300, places=7) + ootf_PQ_BT2100(1.0), 9999.993723673924300, places=7) - def test_n_dimensional_ootf_BT2100_PQ(self): + def test_n_dimensional_ootf_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -ootf_BT2100_PQ` definition n-dimensional arrays support. +ootf_PQ_BT2100` definition n-dimensional arrays support. """ E = 0.1 - F_D = ootf_BT2100_PQ(E) + F_D = ootf_PQ_BT2100(E) E = np.tile(E, 6) F_D = np.tile(F_D, 6) - np.testing.assert_almost_equal(ootf_BT2100_PQ(E), F_D, decimal=7) + np.testing.assert_almost_equal(ootf_PQ_BT2100(E), F_D, decimal=7) E = np.reshape(E, (2, 3)) F_D = np.reshape(F_D, (2, 3)) - np.testing.assert_almost_equal(ootf_BT2100_PQ(E), F_D, decimal=7) + np.testing.assert_almost_equal(ootf_PQ_BT2100(E), F_D, decimal=7) E = np.reshape(E, (2, 3, 1)) F_D = np.reshape(F_D, (2, 3, 1)) - np.testing.assert_almost_equal(ootf_BT2100_PQ(E), F_D, decimal=7) + np.testing.assert_almost_equal(ootf_PQ_BT2100(E), F_D, decimal=7) - def test_domain_range_scale_ootf_BT2100_PQ(self): + def test_domain_range_scale_ootf_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -ootf_BT2100_PQ` definition domain and range scale support. +ootf_PQ_BT2100` definition domain and range scale support. """ E = 0.1 - F_D = ootf_BT2100_PQ(E) + F_D = ootf_PQ_BT2100(E) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - ootf_BT2100_PQ(E * factor), F_D * factor, decimal=7) + ootf_PQ_BT2100(E * factor), F_D * factor, decimal=7) @ignore_numpy_errors - def test_nan_ootf_BT2100_PQ(self): + def test_nan_ootf_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -ootf_BT2100_PQ` definition nan support. +ootf_PQ_BT2100` definition nan support. """ - ootf_BT2100_PQ(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + ootf_PQ_BT2100(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) -class TestOotf_reverse_BT2100_PQ(unittest.TestCase): +class TestOotf_inverse_PQ_BT2100(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -ootf_reverse_BT2100_PQ` definition unit tests methods. +ootf_inverse_PQ_BT2100` definition unit tests methods. """ - def test_ootf_reverse_BT2100_PQ(self): + def test_ootf_inverse_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -ootf_reverse_BT2100_PQ` definition. +ootf_inverse_PQ_BT2100` definition. """ - self.assertAlmostEqual(ootf_reverse_BT2100_PQ(0.0), 0.0, places=7) + self.assertAlmostEqual(ootf_inverse_PQ_BT2100(0.0), 0.0, places=7) self.assertAlmostEqual( - ootf_reverse_BT2100_PQ(779.98836083411584), 0.1, places=7) + ootf_inverse_PQ_BT2100(779.98836083411584), 0.1, places=7) self.assertAlmostEqual( - ootf_reverse_BT2100_PQ(9999.993723673924300), 1.0, places=7) + ootf_inverse_PQ_BT2100(9999.993723673924300), 1.0, places=7) - def test_n_dimensional_ootf_reverse_BT2100_PQ(self): + def test_n_dimensional_ootf_inverse_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -ootf_reverse_BT2100_PQ` definition n-dimensional arrays support. +ootf_inverse_PQ_BT2100` definition n-dimensional arrays support. """ F_D = 779.98836083411584 - E = ootf_reverse_BT2100_PQ(F_D) + E = ootf_inverse_PQ_BT2100(F_D) F_D = np.tile(F_D, 6) E = np.tile(E, 6) np.testing.assert_almost_equal( - ootf_reverse_BT2100_PQ(F_D), E, decimal=7) + ootf_inverse_PQ_BT2100(F_D), E, decimal=7) F_D = np.reshape(F_D, (2, 3)) E = np.reshape(E, (2, 3)) np.testing.assert_almost_equal( - ootf_reverse_BT2100_PQ(F_D), E, decimal=7) + ootf_inverse_PQ_BT2100(F_D), E, decimal=7) F_D = np.reshape(F_D, (2, 3, 1)) E = np.reshape(E, (2, 3, 1)) np.testing.assert_almost_equal( - ootf_reverse_BT2100_PQ(F_D), E, decimal=7) + ootf_inverse_PQ_BT2100(F_D), E, decimal=7) - def test_domain_range_scale_ootf_reverse_BT2100_PQ(self): + def test_domain_range_scale_ootf_inverse_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -ootf_reverse_BT2100_PQ` definition domain and range scale support. +ootf_inverse_PQ_BT2100` definition domain and range scale support. """ F_D = 779.98836083411584 - E = ootf_reverse_BT2100_PQ(F_D) + E = ootf_inverse_PQ_BT2100(F_D) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - ootf_reverse_BT2100_PQ(F_D * factor), + ootf_inverse_PQ_BT2100(F_D * factor), E * factor, decimal=7) @ignore_numpy_errors - def test_nan_ootf_reverse_BT2100_PQ(self): + def test_nan_ootf_inverse_PQ_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -ootf_reverse_BT2100_PQ` definition nan support. +ootf_inverse_PQ_BT2100` definition nan support. """ - ootf_reverse_BT2100_PQ( + ootf_inverse_PQ_BT2100( np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) -class TestGamma_function_BT2100_HLG(unittest.TestCase): +class TestGamma_function_HLG_BT2100(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -gamma_function_BT2100_HLG` definition unit tests methods. +gamma_function_HLG_BT2100` definition unit tests methods. """ - def test_gamma_function_BT2100_HLG(self): + def test_gamma_function_HLG_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -gamma_function_BT2100_HLG` definition. +gamma_function_HLG_BT2100` definition. """ self.assertAlmostEqual( - gamma_function_BT2100_HLG(1000.0), 1.2, places=7) + gamma_function_HLG_BT2100(1000.0), 1.2, places=7) self.assertAlmostEqual( - gamma_function_BT2100_HLG(2000.0), 1.326432598178872, places=7) + gamma_function_HLG_BT2100(2000.0), 1.326432598178872, places=7) self.assertAlmostEqual( - gamma_function_BT2100_HLG(4000.0), 1.452865196357744, places=7) + gamma_function_HLG_BT2100(4000.0), 1.452865196357744, places=7) self.assertAlmostEqual( - gamma_function_BT2100_HLG(10000.0), 1.619999999999999, places=7) + gamma_function_HLG_BT2100(10000.0), 1.619999999999999, places=7) -class TestOetf_BT2100_HLG(unittest.TestCase): +class TestOetf_HLG_BT2100(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -oetf_BT2100_HLG` definition unit tests methods. +oetf_HLG_BT2100` definition unit tests methods. """ - def test_oetf_BT2100_HLG(self): + def test_oetf_HLG_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -oetf_BT2100_HLG` definition. +oetf_HLG_BT2100` definition. """ - self.assertAlmostEqual(oetf_BT2100_HLG(0.0), 0.0, places=7) + self.assertAlmostEqual(oetf_HLG_BT2100(0.0), 0.0, places=7) self.assertAlmostEqual( - oetf_BT2100_HLG(0.18 / 12), 0.212132034355964, places=7) + oetf_HLG_BT2100(0.18 / 12), 0.212132034355964, places=7) self.assertAlmostEqual( - oetf_BT2100_HLG(1.0), 0.999999995536569, places=7) + oetf_HLG_BT2100(1.0), 0.999999995536569, places=7) - def test_n_dimensional_oetf_BT2100_HLG(self): + def test_n_dimensional_oetf_HLG_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -oetf_BT2100_HLG` definition n-dimensional arrays support. +oetf_HLG_BT2100` definition n-dimensional arrays support. """ E = 0.18 / 12 - E_p = oetf_BT2100_HLG(E) + E_p = oetf_HLG_BT2100(E) E = np.tile(E, 6) E_p = np.tile(E_p, 6) - np.testing.assert_almost_equal(oetf_BT2100_HLG(E), E_p, decimal=7) + np.testing.assert_almost_equal(oetf_HLG_BT2100(E), E_p, decimal=7) E = np.reshape(E, (2, 3)) E_p = np.reshape(E_p, (2, 3)) - np.testing.assert_almost_equal(oetf_BT2100_HLG(E), E_p, decimal=7) + np.testing.assert_almost_equal(oetf_HLG_BT2100(E), E_p, decimal=7) E = np.reshape(E, (2, 3, 1)) E_p = np.reshape(E_p, (2, 3, 1)) - np.testing.assert_almost_equal(oetf_BT2100_HLG(E), E_p, decimal=7) + np.testing.assert_almost_equal(oetf_HLG_BT2100(E), E_p, decimal=7) - def test_domain_range_scale_oetf_BT2100_HLG(self): + def test_domain_range_scale_oetf_HLG_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -oetf_BT2100_HLG` definition domain and range scale support. +oetf_HLG_BT2100` definition domain and range scale support. """ E = 0.18 / 12 - E_p = oetf_BT2100_HLG(E) + E_p = oetf_HLG_BT2100(E) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - oetf_BT2100_HLG(E * factor), E_p * factor, decimal=7) + oetf_HLG_BT2100(E * factor), E_p * factor, decimal=7) @ignore_numpy_errors - def test_nan_oetf_BT2100_HLG(self): + def test_nan_oetf_HLG_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -oetf_BT2100_HLG` definition nan support. +oetf_HLG_BT2100` definition nan support. """ - oetf_BT2100_HLG(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + oetf_HLG_BT2100(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) -class TestOetf_reverse_BT2100_HLG(unittest.TestCase): +class TestOetf_inverse_HLG_BT2100(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -oetf_reverse_BT2100_HLG` definition unit tests methods. +oetf_inverse_HLG_BT2100` definition unit tests methods. """ - def test_oetf_reverse_BT2100_HLG(self): + def test_oetf_inverse_HLG_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -oetf_reverse_BT2100_HLG` definition. +oetf_inverse_HLG_BT2100` definition. """ - self.assertAlmostEqual(oetf_reverse_BT2100_HLG(0.0), 0.0, places=7) + self.assertAlmostEqual(oetf_inverse_HLG_BT2100(0.0), 0.0, places=7) self.assertAlmostEqual( - oetf_reverse_BT2100_HLG(0.212132034355964), 0.18 / 12, places=7) + oetf_inverse_HLG_BT2100(0.212132034355964), 0.18 / 12, places=7) self.assertAlmostEqual( - oetf_reverse_BT2100_HLG(0.999999995536569), 1.0, places=7) + oetf_inverse_HLG_BT2100(0.999999995536569), 1.0, places=7) - def test_n_dimensional_oetf_reverse_BT2100_HLG(self): + def test_n_dimensional_oetf_inverse_HLG_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -oetf_reverse_BT2100_HLG` definition n-dimensional arrays support. +oetf_inverse_HLG_BT2100` definition n-dimensional arrays support. """ E_p = 0.212132034355964 - E = oetf_reverse_BT2100_HLG(E_p) + E = oetf_inverse_HLG_BT2100(E_p) E_p = np.tile(E_p, 6) E = np.tile(E, 6) np.testing.assert_almost_equal( - oetf_reverse_BT2100_HLG(E_p), E, decimal=7) + oetf_inverse_HLG_BT2100(E_p), E, decimal=7) E_p = np.reshape(E_p, (2, 3)) E = np.reshape(E, (2, 3)) np.testing.assert_almost_equal( - oetf_reverse_BT2100_HLG(E_p), E, decimal=7) + oetf_inverse_HLG_BT2100(E_p), E, decimal=7) E_p = np.reshape(E_p, (2, 3, 1)) E = np.reshape(E, (2, 3, 1)) np.testing.assert_almost_equal( - oetf_reverse_BT2100_HLG(E_p), E, decimal=7) + oetf_inverse_HLG_BT2100(E_p), E, decimal=7) - def test_domain_range_scale_oetf_reverse_BT2100_HLG(self): + def test_domain_range_scale_oetf_inverse_HLG_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -oetf_reverse_BT2100_HLG` definition domain and range scale support. +oetf_inverse_HLG_BT2100` definition domain and range scale support. """ E_p = 0.212132034355964 - E = oetf_reverse_BT2100_HLG(E_p) + E = oetf_inverse_HLG_BT2100(E_p) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - oetf_reverse_BT2100_HLG(E_p * factor), + oetf_inverse_HLG_BT2100(E_p * factor), E * factor, decimal=7) @ignore_numpy_errors - def test_nan_oetf_reverse_BT2100_HLG(self): + def test_nan_oetf_inverse_HLG_BT2100(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -oetf_reverse_BT2100_HLG` definition nan support. +oetf_inverse_HLG_BT2100` definition nan support. """ - oetf_reverse_BT2100_HLG( + oetf_inverse_HLG_BT2100( np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) -class TestEotf_BT2100_HLG(unittest.TestCase): +class TestEotf_HLG_BT2100_1(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -eotf_BT2100_HLG` definition unit tests methods. +eotf_HLG_BT2100_1` definition unit tests methods. """ - def test_eotf_BT2100_HLG(self): + def test_eotf_HLG_BT2100_1(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -eotf_BT2100_HLG` definition. +eotf_HLG_BT2100_1` definition. """ - self.assertAlmostEqual(eotf_BT2100_HLG(0.0), 0.0, places=7) + self.assertAlmostEqual(eotf_HLG_BT2100_1(0.0), 0.0, places=7) self.assertAlmostEqual( - eotf_BT2100_HLG(0.212132034355964), 6.476039825649814, places=7) + eotf_HLG_BT2100_1(0.212132034355964), 6.476039825649814, places=7) self.assertAlmostEqual( - eotf_BT2100_HLG(1.0), 1000.000029239784300, places=7) + eotf_HLG_BT2100_1(1.0), 1000.000032321769100, places=7) self.assertAlmostEqual( - eotf_BT2100_HLG(0.212132034355964, 0.001, 10000, 1.4), + eotf_HLG_BT2100_1(0.212132034355964, 0.001, 10000, 1.4), 27.96039175299561, places=7) - def test_n_dimensional_eotf_BT2100_HLG(self): + def test_n_dimensional_eotf_HLG_BT2100_1(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ +eotf_HLG_BT2100_1` definition n-dimensional arrays support. + """ + + E_p = 0.212132034355964 + F_D = eotf_HLG_BT2100_1(E_p) + + E_p = np.tile(E_p, 6) + F_D = np.tile(F_D, 6) + np.testing.assert_almost_equal(eotf_HLG_BT2100_1(E_p), F_D, decimal=7) + + E_p = np.reshape(E_p, (2, 3)) + F_D = np.reshape(F_D, (2, 3)) + np.testing.assert_almost_equal(eotf_HLG_BT2100_1(E_p), F_D, decimal=7) + + E_p = np.reshape(E_p, (2, 3, 1)) + F_D = np.reshape(F_D, (2, 3, 1)) + np.testing.assert_almost_equal(eotf_HLG_BT2100_1(E_p), F_D, decimal=7) + + E_p = np.reshape(E_p, (6, 1)) + F_D = np.reshape(F_D, (6, 1)) + np.testing.assert_almost_equal(eotf_HLG_BT2100_1(E_p), F_D, decimal=7) + + E_p = np.array([0.25, 0.50, 0.75]) + F_D = np.array([12.49759413, 49.99037650, 158.94693786]) + np.testing.assert_almost_equal(eotf_HLG_BT2100_1(E_p), F_D, decimal=7) + + E_p = np.tile(E_p, (6, 1)) + F_D = np.tile(F_D, (6, 1)) + np.testing.assert_almost_equal(eotf_HLG_BT2100_1(E_p), F_D, decimal=7) + + E_p = np.reshape(E_p, (2, 3, 3)) + F_D = np.reshape(F_D, (2, 3, 3)) + np.testing.assert_almost_equal(eotf_HLG_BT2100_1(E_p), F_D, decimal=7) + + def test_domain_range_scale_eotf_HLG_BT2100_1(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ +eotf_HLG_BT2100_1` definition domain and range scale support. + """ + + E_p = 0.212132034355964 + F_D = eotf_HLG_BT2100_1(E_p) + + d_r = (('reference', 1), (1, 1), (100, 100)) + for scale, factor in d_r: + with domain_range_scale(scale): + np.testing.assert_almost_equal( + eotf_HLG_BT2100_1(E_p * factor), F_D * factor, decimal=7) + + @ignore_numpy_errors + def test_nan_eotf_HLG_BT2100_1(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ +eotf_HLG_BT2100_1` definition nan support. + """ + + eotf_HLG_BT2100_1(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + + +class TestEotf_HLG_BT2100_2(unittest.TestCase): + """ + Defines :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ +eotf_HLG_BT2100_2` definition unit tests methods. + """ + + def test_eotf_HLG_BT2100_2(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ +eotf_HLG_BT2100_2` definition. + """ + + self.assertAlmostEqual(eotf_HLG_BT2100_2(0.0), 0.0, places=7) + + self.assertAlmostEqual( + eotf_HLG_BT2100_2(0.212132034355964), 6.476039825649814, places=7) + + self.assertAlmostEqual( + eotf_HLG_BT2100_2(1.0), 1000.000032321769100, places=7) + + self.assertAlmostEqual( + eotf_HLG_BT2100_2(0.212132034355964, 0.001, 10000, 1.4), + 29.581261576946076, + places=7) + + def test_n_dimensional_eotf_HLG_BT2100_2(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -eotf_BT2100_HLG` definition n-dimensional arrays support. +eotf_HLG_BT2100_2` definition n-dimensional arrays support. """ E_p = 0.212132034355964 - F_D = eotf_BT2100_HLG(E_p) + F_D = eotf_HLG_BT2100_2(E_p) E_p = np.tile(E_p, 6) F_D = np.tile(F_D, 6) - np.testing.assert_almost_equal(eotf_BT2100_HLG(E_p), F_D, decimal=7) + np.testing.assert_almost_equal(eotf_HLG_BT2100_2(E_p), F_D, decimal=7) E_p = np.reshape(E_p, (2, 3)) F_D = np.reshape(F_D, (2, 3)) - np.testing.assert_almost_equal(eotf_BT2100_HLG(E_p), F_D, decimal=7) + np.testing.assert_almost_equal(eotf_HLG_BT2100_2(E_p), F_D, decimal=7) E_p = np.reshape(E_p, (2, 3, 1)) F_D = np.reshape(F_D, (2, 3, 1)) - np.testing.assert_almost_equal(eotf_BT2100_HLG(E_p), F_D, decimal=7) + np.testing.assert_almost_equal(eotf_HLG_BT2100_2(E_p), F_D, decimal=7) E_p = np.reshape(E_p, (6, 1)) F_D = np.reshape(F_D, (6, 1)) - np.testing.assert_almost_equal(eotf_BT2100_HLG(E_p), F_D, decimal=7) + np.testing.assert_almost_equal(eotf_HLG_BT2100_2(E_p), F_D, decimal=7) E_p = np.array([0.25, 0.50, 0.75]) - F_D = np.array([12.49759412, 49.99037650, 158.94693746]) - np.testing.assert_almost_equal(eotf_BT2100_HLG(E_p), F_D, decimal=7) + F_D = np.array([12.49759413, 49.99037650, 158.94693786]) + np.testing.assert_almost_equal(eotf_HLG_BT2100_2(E_p), F_D, decimal=7) E_p = np.tile(E_p, (6, 1)) F_D = np.tile(F_D, (6, 1)) - np.testing.assert_almost_equal(eotf_BT2100_HLG(E_p), F_D, decimal=7) + np.testing.assert_almost_equal(eotf_HLG_BT2100_2(E_p), F_D, decimal=7) E_p = np.reshape(E_p, (2, 3, 3)) F_D = np.reshape(F_D, (2, 3, 3)) - np.testing.assert_almost_equal(eotf_BT2100_HLG(E_p), F_D, decimal=7) + np.testing.assert_almost_equal(eotf_HLG_BT2100_2(E_p), F_D, decimal=7) - def test_domain_range_scale_eotf_BT2100_HLG(self): + def test_domain_range_scale_eotf_HLG_BT2100_2(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -eotf_BT2100_HLG` definition domain and range scale support. +eotf_HLG_BT2100_2` definition domain and range scale support. """ E_p = 0.212132034355964 - F_D = eotf_BT2100_HLG(E_p) + F_D = eotf_HLG_BT2100_2(E_p) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - eotf_BT2100_HLG(E_p * factor), F_D * factor, decimal=7) + eotf_HLG_BT2100_2(E_p * factor), F_D * factor, decimal=7) @ignore_numpy_errors - def test_nan_eotf_BT2100_HLG(self): + def test_nan_eotf_HLG_BT2100_2(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -eotf_BT2100_HLG` definition nan support. +eotf_HLG_BT2100_2` definition nan support. """ - eotf_BT2100_HLG(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + eotf_HLG_BT2100_2(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) -class TestEotf_reverse_BT2100_HLG(unittest.TestCase): +class TestEotf_inverse_HLG_BT2100_1(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -eotf_reverse_BT2100_HLG` definition unit tests methods. +eotf_inverse_HLG_BT2100_1` definition unit tests methods. """ - def test_eotf_reverse_BT2100_HLG(self): + def test_eotf_inverse_HLG_BT2100_1(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -eotf_reverse_BT2100_HLG` definition. +eotf_inverse_HLG_BT2100_1` definition. """ - self.assertAlmostEqual(eotf_reverse_BT2100_HLG(0.0), 0.0, places=7) + self.assertAlmostEqual(eotf_inverse_HLG_BT2100_1(0.0), 0.0, places=7) self.assertAlmostEqual( - eotf_reverse_BT2100_HLG(6.476039825649814), + eotf_inverse_HLG_BT2100_1(6.476039825649814), 0.212132034355964, places=7) self.assertAlmostEqual( - eotf_reverse_BT2100_HLG(1000.000029239784300), 1.0, places=7) + eotf_inverse_HLG_BT2100_1(1000.000032321769100), 1.0, places=7) self.assertAlmostEqual( - eotf_reverse_BT2100_HLG(6.476039825649814, 0.001, 10000, 1.4), - 0.125811012816761, + eotf_inverse_HLG_BT2100_1(27.96039175299561, 0.001, 10000, 1.4), + 0.212132034355964, places=7) - def test_n_dimensional_eotf_reverse_BT2100_HLG(self): + def test_n_dimensional_eotf_inverse_HLG_BT2100_1(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -eotf_reverse_BT2100_HLG` definition n-dimensional arrays support. +eotf_inverse_HLG_BT2100_1` definition n-dimensional arrays support. """ F_D = 6.476039825649814 - E_p = eotf_reverse_BT2100_HLG(F_D) + E_p = eotf_inverse_HLG_BT2100_1(F_D) F_D = np.tile(F_D, 6) E_p = np.tile(E_p, 6) np.testing.assert_almost_equal( - eotf_reverse_BT2100_HLG(F_D), E_p, decimal=7) + eotf_inverse_HLG_BT2100_1(F_D), E_p, decimal=7) F_D = np.reshape(F_D, (2, 3)) E_p = np.reshape(E_p, (2, 3)) np.testing.assert_almost_equal( - eotf_reverse_BT2100_HLG(F_D), E_p, decimal=7) + eotf_inverse_HLG_BT2100_1(F_D), E_p, decimal=7) F_D = np.reshape(F_D, (2, 3, 1)) E_p = np.reshape(E_p, (2, 3, 1)) np.testing.assert_almost_equal( - eotf_reverse_BT2100_HLG(F_D), E_p, decimal=7) + eotf_inverse_HLG_BT2100_1(F_D), E_p, decimal=7) F_D = np.reshape(F_D, (6, 1)) E_p = np.reshape(E_p, (6, 1)) np.testing.assert_almost_equal( - eotf_reverse_BT2100_HLG(F_D), E_p, decimal=7) + eotf_inverse_HLG_BT2100_1(F_D), E_p, decimal=7) - F_D = np.array([12.49759412, 49.99037650, 158.94693746]) + F_D = np.array([12.49759413, 49.99037650, 158.94693786]) E_p = np.array([0.25, 0.50, 0.75]) np.testing.assert_almost_equal( - eotf_reverse_BT2100_HLG(F_D), E_p, decimal=7) + eotf_inverse_HLG_BT2100_1(F_D), E_p, decimal=7) F_D = np.tile(F_D, (6, 1)) E_p = np.tile(E_p, (6, 1)) np.testing.assert_almost_equal( - eotf_reverse_BT2100_HLG(F_D), E_p, decimal=7) + eotf_inverse_HLG_BT2100_1(F_D), E_p, decimal=7) F_D = np.reshape(F_D, (2, 3, 3)) E_p = np.reshape(E_p, (2, 3, 3)) np.testing.assert_almost_equal( - eotf_reverse_BT2100_HLG(F_D), E_p, decimal=7) + eotf_inverse_HLG_BT2100_1(F_D), E_p, decimal=7) - def test_domain_range_scale_eotf_reverse_BT2100_HLG(self): + def test_domain_range_scale_eotf_inverse_HLG_BT2100_1(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -eotf_reverse_BT2100_HLG` definition domain and range scale support. +eotf_inverse_HLG_BT2100_1` definition domain and range scale support. """ F_D = 6.476039825649814 - E_p = eotf_reverse_BT2100_HLG(F_D) + E_p = eotf_inverse_HLG_BT2100_1(F_D) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - eotf_reverse_BT2100_HLG(F_D * factor), + eotf_inverse_HLG_BT2100_1(F_D * factor), E_p * factor, decimal=7) @ignore_numpy_errors - def test_nan_eotf_reverse_BT2100_HLG(self): + def test_nan_eotf_inverse_HLG_BT2100_1(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -eotf_reverse_BT2100_HLG` definition nan support. +eotf_inverse_HLG_BT2100_1` definition nan support. """ - eotf_reverse_BT2100_HLG( + eotf_inverse_HLG_BT2100_1( np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) -class TestOotf_BT2100_HLG(unittest.TestCase): +class TestEotf_inverse_HLG_BT2100_2(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -ootf_BT2100_HLG` definition unit tests methods. +eotf_inverse_HLG_BT2100_2` definition unit tests methods. """ - def test_ootf_BT2100_HLG(self): + def test_eotf_inverse_HLG_BT2100_2(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -ootf_BT2100_HLG` definition. +eotf_inverse_HLG_BT2100_2` definition. """ - self.assertAlmostEqual(ootf_BT2100_HLG(0.0), 0.0, places=7) + self.assertAlmostEqual(eotf_inverse_HLG_BT2100_2(0.0), 0.0, places=7) self.assertAlmostEqual( - ootf_BT2100_HLG(0.1), 63.095734448019336, places=7) + eotf_inverse_HLG_BT2100_2(6.476039825649814), + 0.212132034355964, + places=7) - self.assertAlmostEqual(ootf_BT2100_HLG(1.0), 1000.0, places=7) + self.assertAlmostEqual( + eotf_inverse_HLG_BT2100_2(1000.000032321769100), 1.0, places=7) self.assertAlmostEqual( - ootf_BT2100_HLG(0.1, 0.001, 10000, 1.4), + eotf_inverse_HLG_BT2100_2(29.581261576946076, 0.001, 10000, 1.4), + 0.212132034355964, + places=7) + + def test_n_dimensional_eotf_inverse_HLG_BT2100_2(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ +eotf_inverse_HLG_BT2100_2` definition n-dimensional arrays support. + """ + + F_D = 6.476039825649814 + E_p = eotf_inverse_HLG_BT2100_2(F_D) + + F_D = np.tile(F_D, 6) + E_p = np.tile(E_p, 6) + np.testing.assert_almost_equal( + eotf_inverse_HLG_BT2100_2(F_D), E_p, decimal=7) + + F_D = np.reshape(F_D, (2, 3)) + E_p = np.reshape(E_p, (2, 3)) + np.testing.assert_almost_equal( + eotf_inverse_HLG_BT2100_2(F_D), E_p, decimal=7) + + F_D = np.reshape(F_D, (2, 3, 1)) + E_p = np.reshape(E_p, (2, 3, 1)) + np.testing.assert_almost_equal( + eotf_inverse_HLG_BT2100_2(F_D), E_p, decimal=7) + + F_D = np.reshape(F_D, (6, 1)) + E_p = np.reshape(E_p, (6, 1)) + np.testing.assert_almost_equal( + eotf_inverse_HLG_BT2100_2(F_D), E_p, decimal=7) + + F_D = np.array([12.49759413, 49.99037650, 158.94693786]) + E_p = np.array([0.25, 0.50, 0.75]) + np.testing.assert_almost_equal( + eotf_inverse_HLG_BT2100_2(F_D), E_p, decimal=7) + + F_D = np.tile(F_D, (6, 1)) + E_p = np.tile(E_p, (6, 1)) + np.testing.assert_almost_equal( + eotf_inverse_HLG_BT2100_2(F_D), E_p, decimal=7) + + F_D = np.reshape(F_D, (2, 3, 3)) + E_p = np.reshape(E_p, (2, 3, 3)) + np.testing.assert_almost_equal( + eotf_inverse_HLG_BT2100_2(F_D), E_p, decimal=7) + + def test_domain_range_scale_eotf_inverse_HLG_BT2100_2(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ +eotf_inverse_HLG_BT2100_2` definition domain and range scale support. + """ + + F_D = 6.476039825649814 + E_p = eotf_inverse_HLG_BT2100_2(F_D) + + d_r = (('reference', 1), (1, 1), (100, 100)) + for scale, factor in d_r: + with domain_range_scale(scale): + np.testing.assert_almost_equal( + eotf_inverse_HLG_BT2100_2(F_D * factor), + E_p * factor, + decimal=7) + + @ignore_numpy_errors + def test_nan_eotf_inverse_HLG_BT2100_2(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ +eotf_inverse_HLG_BT2100_2` definition nan support. + """ + + eotf_inverse_HLG_BT2100_2( + np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + + +class TestOotf_HLG_BT2100_1(unittest.TestCase): + """ + Defines :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ +ootf_HLG_BT2100_1` definition unit tests methods. + """ + + def test_ootf_HLG_BT2100_1(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ +ootf_HLG_BT2100_1` definition. + """ + + self.assertAlmostEqual(ootf_HLG_BT2100_1(0.0), 0.0, places=7) + + self.assertAlmostEqual( + ootf_HLG_BT2100_1(0.1), 63.095734448019336, places=7) + + self.assertAlmostEqual(ootf_HLG_BT2100_1(1.0), 1000.0, places=7) + + self.assertAlmostEqual( + ootf_HLG_BT2100_1(0.1, 0.001, 10000, 1.4), 398.108130742780300, places=7) a = np.array( - [[45.884942278760597, 0.000000000000000, -45.884942278760597], - [-63.095734448019336, -63.095734448019336, -63.095734448019336], - [63.095734448019336, 63.095734448019336, 63.095734448019336], - [51.320396090100672, -51.320396090100672, 51.320396090100672]], - ) # yapf: disable + [[45.884942278760597, 0.000000000000000, -45.884942278760597], [ + -63.095734448019336, -63.095734448019336, -63.095734448019336 + ], [63.095734448019336, 63.095734448019336, 63.095734448019336], + [51.320396090100672, -51.320396090100672, 51.320396090100672]], ) + np.testing.assert_almost_equal( + ootf_HLG_BT2100_1( + np.array([[0.1, 0.0, -0.1], [-0.1, -0.1, -0.1], + [0.1, 0.1, 0.1], [0.1, -0.1, 0.1]])), + a, + decimal=7) + + def test_n_dimensional_ootf_HLG_BT2100_1(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ +ootf_HLG_BT2100_1` definition n-dimensional arrays support. + """ + + E = 0.1 + F_D = ootf_HLG_BT2100_1(E) + + E = np.tile(E, 6) + F_D = np.tile(F_D, 6) + np.testing.assert_almost_equal(ootf_HLG_BT2100_1(E), F_D, decimal=7) + + E = np.reshape(E, (2, 3)) + F_D = np.reshape(F_D, (2, 3)) + np.testing.assert_almost_equal(ootf_HLG_BT2100_1(E), F_D, decimal=7) + + E = np.reshape(E, (2, 3, 1)) + F_D = np.reshape(F_D, (2, 3, 1)) + np.testing.assert_almost_equal(ootf_HLG_BT2100_1(E), F_D, decimal=7) + + E = np.reshape(E, (6, 1)) + F_D = np.reshape(F_D, (6, 1)) + np.testing.assert_almost_equal(ootf_HLG_BT2100_1(E), F_D, decimal=7) + + E = np.array([0.25, 0.50, 0.75]) + F_D = np.array([213.01897444, 426.03794887, 639.05692331]) + np.testing.assert_almost_equal(ootf_HLG_BT2100_1(E), F_D, decimal=7) + + E = np.tile(E, (6, 1)) + F_D = np.tile(F_D, (6, 1)) + np.testing.assert_almost_equal(ootf_HLG_BT2100_1(E), F_D, decimal=7) + + E = np.reshape(E, (2, 3, 3)) + F_D = np.reshape(F_D, (2, 3, 3)) + np.testing.assert_almost_equal(ootf_HLG_BT2100_1(E), F_D, decimal=7) + + def test_domain_range_scale_ootf_HLG_BT2100_1(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ +ootf_HLG_BT2100_1` definition domain and range scale support. + """ + + E = 0.1 + F_D = ootf_HLG_BT2100_1(E) + + d_r = (('reference', 1), (1, 1), (100, 100)) + for scale, factor in d_r: + with domain_range_scale(scale): + np.testing.assert_almost_equal( + ootf_HLG_BT2100_1(E * factor), F_D * factor, decimal=7) + + @ignore_numpy_errors + def test_nan_ootf_HLG_BT2100_1(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ +ootf_HLG_BT2100_1` definition nan support. + """ + + ootf_HLG_BT2100_1(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + + +class TestOotf_HLG_BT2100_2(unittest.TestCase): + """ + Defines :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ +ootf_HLG_BT2100_2` definition unit tests methods. + """ + + def test_ootf_HLG_BT2100_2(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ +ootf_HLG_BT2100_2` definition. + """ + + self.assertAlmostEqual(ootf_HLG_BT2100_2(0.0), 0.0, places=7) + + self.assertAlmostEqual( + ootf_HLG_BT2100_2(0.1), 63.095734448019336, places=7) + + self.assertAlmostEqual(ootf_HLG_BT2100_2(1.0), 1000.0, places=7) + + self.assertAlmostEqual( + ootf_HLG_BT2100_2(0.1, 10000, 1.4), 398.107170553497380, places=7) + + a = np.array([ + [45.884942278760597, 0.000000000000000, -45.884942278760597], + [-63.095734448019336, -63.095734448019336, -63.095734448019336], + [63.095734448019336, 63.095734448019336, 63.095734448019336], + [51.320396090100672, -51.320396090100672, 51.320396090100672], + ], ) np.testing.assert_almost_equal( - ootf_BT2100_HLG( + ootf_HLG_BT2100_2( np.array([[0.1, 0.0, -0.1], [-0.1, -0.1, -0.1], [0.1, 0.1, 0.1], [0.1, -0.1, 0.1]])), a, decimal=7) - def test_n_dimensional_ootf_BT2100_HLG(self): + def test_n_dimensional_ootf_HLG_BT2100_2(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -ootf_BT2100_HLG` definition n-dimensional arrays support. +ootf_HLG_BT2100_2` definition n-dimensional arrays support. """ E = 0.1 - F_D = ootf_BT2100_HLG(E) + F_D = ootf_HLG_BT2100_2(E) E = np.tile(E, 6) F_D = np.tile(F_D, 6) - np.testing.assert_almost_equal(ootf_BT2100_HLG(E), F_D, decimal=7) + np.testing.assert_almost_equal(ootf_HLG_BT2100_2(E), F_D, decimal=7) E = np.reshape(E, (2, 3)) F_D = np.reshape(F_D, (2, 3)) - np.testing.assert_almost_equal(ootf_BT2100_HLG(E), F_D, decimal=7) + np.testing.assert_almost_equal(ootf_HLG_BT2100_2(E), F_D, decimal=7) E = np.reshape(E, (2, 3, 1)) F_D = np.reshape(F_D, (2, 3, 1)) - np.testing.assert_almost_equal(ootf_BT2100_HLG(E), F_D, decimal=7) + np.testing.assert_almost_equal(ootf_HLG_BT2100_2(E), F_D, decimal=7) E = np.reshape(E, (6, 1)) F_D = np.reshape(F_D, (6, 1)) - np.testing.assert_almost_equal(ootf_BT2100_HLG(E), F_D, decimal=7) + np.testing.assert_almost_equal(ootf_HLG_BT2100_2(E), F_D, decimal=7) E = np.array([0.25, 0.50, 0.75]) F_D = np.array([213.01897444, 426.03794887, 639.05692331]) - np.testing.assert_almost_equal(ootf_BT2100_HLG(E), F_D, decimal=7) + np.testing.assert_almost_equal(ootf_HLG_BT2100_2(E), F_D, decimal=7) E = np.tile(E, (6, 1)) F_D = np.tile(F_D, (6, 1)) - np.testing.assert_almost_equal(ootf_BT2100_HLG(E), F_D, decimal=7) + np.testing.assert_almost_equal(ootf_HLG_BT2100_2(E), F_D, decimal=7) E = np.reshape(E, (2, 3, 3)) F_D = np.reshape(F_D, (2, 3, 3)) - np.testing.assert_almost_equal(ootf_BT2100_HLG(E), F_D, decimal=7) + np.testing.assert_almost_equal(ootf_HLG_BT2100_2(E), F_D, decimal=7) - def test_domain_range_scale_ootf_BT2100_HLG(self): + def test_domain_range_scale_ootf_HLG_BT2100_2(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -ootf_BT2100_HLG` definition domain and range scale support. +ootf_HLG_BT2100_2` definition domain and range scale support. """ E = 0.1 - F_D = ootf_BT2100_HLG(E) + F_D = ootf_HLG_BT2100_1(E) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - ootf_BT2100_HLG(E * factor), F_D * factor, decimal=7) + ootf_HLG_BT2100_1(E * factor), F_D * factor, decimal=7) @ignore_numpy_errors - def test_nan_ootf_BT2100_HLG(self): + def test_nan_ootf_HLG_BT2100_1(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -ootf_BT2100_HLG` definition nan support. +ootf_HLG_BT2100_1` definition nan support. """ - ootf_BT2100_HLG(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + ootf_HLG_BT2100_1(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) -class TestOotf_reverse_BT2100_HLG(unittest.TestCase): +class TestOotf_inverse_HLG_BT2100_1(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -ootf_reverse_BT2100_HLG` definition unit tests methods. +ootf_inverse_HLG_BT2100_1` definition unit tests methods. """ - def test_ootf_reverse_BT2100_HLG(self): + def test_ootf_inverse_HLG_BT2100_1(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -ootf_reverse_BT2100_HLG` definition. +ootf_inverse_HLG_BT2100_1` definition. """ - self.assertAlmostEqual(ootf_reverse_BT2100_HLG(0.0), 0.0, places=7) + self.assertAlmostEqual(ootf_inverse_HLG_BT2100_1(0.0), 0.0, places=7) + + self.assertAlmostEqual( + ootf_inverse_HLG_BT2100_1(63.095734448019336), 0.1, places=7) self.assertAlmostEqual( - ootf_reverse_BT2100_HLG(63.095734448019336), 0.1, places=7) + ootf_inverse_HLG_BT2100_1(1000.0), 1.0, places=7) - self.assertAlmostEqual(ootf_reverse_BT2100_HLG(1000.0), 1.0, places=7) + self.assertAlmostEqual( + ootf_inverse_HLG_BT2100_1(398.108130742780300, 0.001, 10000, 1.4), + 0.1, + places=7) + + a = np.array( + [[45.884942278760597, 0.000000000000000, -45.884942278760597], [ + -63.095734448019336, -63.095734448019336, -63.095734448019336 + ], [63.095734448019336, 63.095734448019336, 63.095734448019336], + [51.320396090100672, -51.320396090100672, 51.320396090100672]]) + np.testing.assert_almost_equal( + ootf_inverse_HLG_BT2100_1(a), + np.array([[0.1, 0.0, -0.1], [-0.1, -0.1, -0.1], [0.1, 0.1, 0.1], + [0.1, -0.1, 0.1]]), + decimal=7) + + def test_n_dimensional_ootf_inverse_HLG_BT2100_1(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ +ootf_inverse_HLG_BT2100_1` definition n-dimensional arrays support. + """ + + F_D = 63.095734448019336 + E = ootf_inverse_HLG_BT2100_1(F_D) + + F_D = np.tile(F_D, 6) + E = np.tile(E, 6) + np.testing.assert_almost_equal( + ootf_inverse_HLG_BT2100_1(F_D), E, decimal=7) + + F_D = np.reshape(F_D, (2, 3)) + E = np.reshape(E, (2, 3)) + np.testing.assert_almost_equal( + ootf_inverse_HLG_BT2100_1(F_D), E, decimal=7) + + F_D = np.reshape(F_D, (2, 3, 1)) + E = np.reshape(E, (2, 3, 1)) + np.testing.assert_almost_equal( + ootf_inverse_HLG_BT2100_1(F_D), E, decimal=7) + + F_D = np.reshape(F_D, (6, 1)) + E = np.reshape(E, (6, 1)) + np.testing.assert_almost_equal( + ootf_inverse_HLG_BT2100_1(F_D), E, decimal=7) + + F_D = np.array([213.01897444, 426.03794887, 639.05692331]) + E = np.array([0.25, 0.50, 0.75]) + np.testing.assert_almost_equal( + ootf_inverse_HLG_BT2100_1(F_D), E, decimal=7) + + F_D = np.tile(F_D, (6, 1)) + E = np.tile(E, (6, 1)) + np.testing.assert_almost_equal( + ootf_inverse_HLG_BT2100_1(F_D), E, decimal=7) + + F_D = np.reshape(F_D, (2, 3, 3)) + E = np.reshape(E, (2, 3, 3)) + np.testing.assert_almost_equal( + ootf_inverse_HLG_BT2100_1(F_D), E, decimal=7) + + def test_domain_range_scale_ootf_inverse_HLG_BT2100_1(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ +ootf_inverse_HLG_BT2100_1` definition domain and range scale support. + """ + + F_D = 63.095734448019336 + E = ootf_inverse_HLG_BT2100_1(F_D) + + d_r = (('reference', 1), (1, 1), (100, 100)) + for scale, factor in d_r: + with domain_range_scale(scale): + np.testing.assert_almost_equal( + ootf_inverse_HLG_BT2100_1(F_D * factor), + E * factor, + decimal=7) + + @ignore_numpy_errors + def test_nan_ootf_inverse_HLG_BT2100_1(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ +ootf_inverse_HLG_BT2100_1` definition nan support. + """ + + ootf_inverse_HLG_BT2100_1( + np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + + +class TestOotf_inverse_HLG_BT2100_2(unittest.TestCase): + """ + Defines :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ +ootf_inverse_HLG_BT2100_2` definition unit tests methods. + """ + + def test_ootf_inverse_HLG_BT2100_2(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ +ootf_inverse_HLG_BT2100_2` definition. + """ + + self.assertAlmostEqual(ootf_inverse_HLG_BT2100_2(0.0), 0.0, places=7) + + self.assertAlmostEqual( + ootf_inverse_HLG_BT2100_2(63.095734448019336), 0.1, places=7) + + self.assertAlmostEqual( + ootf_inverse_HLG_BT2100_2(1000.0), 1.0, places=7) self.assertAlmostEqual( - ootf_reverse_BT2100_HLG(398.108130742780300, 0.001, 10000, 1.4), + ootf_inverse_HLG_BT2100_2(398.107170553497380, 10000, 1.4), 0.1, places=7) a = np.array( - [[45.884942278760597, 0.000000000000000, -45.884942278760597], - [-63.095734448019336, -63.095734448019336, -63.095734448019336], - [63.095734448019336, 63.095734448019336, 63.095734448019336], - [51.320396090100672, -51.320396090100672, 51.320396090100672]] - ) # yapf: disable + [[45.884942278760597, 0.000000000000000, -45.884942278760597], [ + -63.095734448019336, -63.095734448019336, -63.095734448019336 + ], [63.095734448019336, 63.095734448019336, 63.095734448019336], + [51.320396090100672, -51.320396090100672, 51.320396090100672]]) np.testing.assert_almost_equal( - ootf_reverse_BT2100_HLG(a), + ootf_inverse_HLG_BT2100_2(a), np.array([[0.1, 0.0, -0.1], [-0.1, -0.1, -0.1], [0.1, 0.1, 0.1], [0.1, -0.1, 0.1]]), decimal=7) - def test_n_dimensional_ootf_reverse_BT2100_HLG(self): + def test_n_dimensional_ootf_inverse_HLG_BT2100_2(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -ootf_reverse_BT2100_HLG` definition n-dimensional arrays support. +ootf_inverse_HLG_BT2100_2` definition n-dimensional arrays support. """ F_D = 63.095734448019336 - E = ootf_reverse_BT2100_HLG(F_D) + E = ootf_inverse_HLG_BT2100_2(F_D) F_D = np.tile(F_D, 6) E = np.tile(E, 6) np.testing.assert_almost_equal( - ootf_reverse_BT2100_HLG(F_D), E, decimal=7) + ootf_inverse_HLG_BT2100_2(F_D), E, decimal=7) F_D = np.reshape(F_D, (2, 3)) E = np.reshape(E, (2, 3)) np.testing.assert_almost_equal( - ootf_reverse_BT2100_HLG(F_D), E, decimal=7) + ootf_inverse_HLG_BT2100_2(F_D), E, decimal=7) F_D = np.reshape(F_D, (2, 3, 1)) E = np.reshape(E, (2, 3, 1)) np.testing.assert_almost_equal( - ootf_reverse_BT2100_HLG(F_D), E, decimal=7) + ootf_inverse_HLG_BT2100_2(F_D), E, decimal=7) F_D = np.reshape(F_D, (6, 1)) E = np.reshape(E, (6, 1)) np.testing.assert_almost_equal( - ootf_reverse_BT2100_HLG(F_D), E, decimal=7) + ootf_inverse_HLG_BT2100_2(F_D), E, decimal=7) F_D = np.array([213.01897444, 426.03794887, 639.05692331]) E = np.array([0.25, 0.50, 0.75]) np.testing.assert_almost_equal( - ootf_reverse_BT2100_HLG(F_D), E, decimal=7) + ootf_inverse_HLG_BT2100_2(F_D), E, decimal=7) F_D = np.tile(F_D, (6, 1)) E = np.tile(E, (6, 1)) np.testing.assert_almost_equal( - ootf_reverse_BT2100_HLG(F_D), E, decimal=7) + ootf_inverse_HLG_BT2100_2(F_D), E, decimal=7) F_D = np.reshape(F_D, (2, 3, 3)) E = np.reshape(E, (2, 3, 3)) np.testing.assert_almost_equal( - ootf_reverse_BT2100_HLG(F_D), E, decimal=7) + ootf_inverse_HLG_BT2100_2(F_D), E, decimal=7) - def test_domain_range_scale_ootf_reverse_BT2100_HLG(self): + def test_domain_range_scale_ootf_inverse_HLG_BT2100_2(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -ootf_reverse_BT2100_HLG` definition domain and range scale support. +ootf_inverse_HLG_BT2100_2` definition domain and range scale support. """ F_D = 63.095734448019336 - E = ootf_reverse_BT2100_HLG(F_D) + E = ootf_inverse_HLG_BT2100_2(F_D) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - ootf_reverse_BT2100_HLG(F_D * factor), + ootf_inverse_HLG_BT2100_2(F_D * factor), E * factor, decimal=7) @ignore_numpy_errors - def test_nan_ootf_reverse_BT2100_HLG(self): + def test_nan_ootf_inverse_HLG_BT2100_2(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ -ootf_reverse_BT2100_HLG` definition nan support. +ootf_inverse_HLG_BT2100_2` definition nan support. """ - ootf_reverse_BT2100_HLG( + ootf_inverse_HLG_BT2100_2( np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) diff --git a/colour/models/rgb/transfer_functions/tests/test_itur_bt_601.py b/colour/models/rgb/transfer_functions/tests/test_itur_bt_601.py index a532bb0ac7..b112740585 100644 --- a/colour/models/rgb/transfer_functions/tests/test_itur_bt_601.py +++ b/colour/models/rgb/transfer_functions/tests/test_itur_bt_601.py @@ -9,7 +9,7 @@ import numpy as np import unittest -from colour.models.rgb.transfer_functions import oetf_BT601, oetf_reverse_BT601 +from colour.models.rgb.transfer_functions import oetf_BT601, oetf_inverse_BT601 from colour.utilities import domain_range_scale, ignore_numpy_errors __author__ = 'Colour Developers' @@ -19,7 +19,7 @@ __email__ = 'colour-science@googlegroups.com' __status__ = 'Production' -__all__ = ['TestOetf_BT601', 'TestOetf_reverse_BT601'] +__all__ = ['TestOetf_BT601', 'TestOetf_inverse_BT601'] class TestOetf_BT601(unittest.TestCase): @@ -88,72 +88,72 @@ def test_nan_oetf_BT601(self): oetf_BT601(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) -class TestOetf_reverse_BT601(unittest.TestCase): +class TestOetf_inverse_BT601(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.itur_bt_601.\ -oetf_reverse_BT601` definition unit tests methods. +oetf_inverse_BT601` definition unit tests methods. """ - def test_oetf_reverse_BT601(self): + def test_oetf_inverse_BT601(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_601.\ -oetf_reverse_BT601` definition. +oetf_inverse_BT601` definition. """ - self.assertAlmostEqual(oetf_reverse_BT601(0.0), 0.0, places=7) + self.assertAlmostEqual(oetf_inverse_BT601(0.0), 0.0, places=7) self.assertAlmostEqual( - oetf_reverse_BT601(0.067500000000000), 0.015, places=7) + oetf_inverse_BT601(0.067500000000000), 0.015, places=7) self.assertAlmostEqual( - oetf_reverse_BT601(0.409007728864150), 0.18, places=7) + oetf_inverse_BT601(0.409007728864150), 0.18, places=7) - self.assertAlmostEqual(oetf_reverse_BT601(1.0), 1.0, places=7) + self.assertAlmostEqual(oetf_inverse_BT601(1.0), 1.0, places=7) - def test_n_dimensional_oetf_reverse_BT601(self): + def test_n_dimensional_oetf_inverse_BT601(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_601.\ -oetf_reverse_BT601` definition n-dimensional arrays support. +oetf_inverse_BT601` definition n-dimensional arrays support. """ E = 0.409007728864150 - L = oetf_reverse_BT601(E) + L = oetf_inverse_BT601(E) E = np.tile(E, 6) L = np.tile(L, 6) - np.testing.assert_almost_equal(oetf_reverse_BT601(E), L, decimal=7) + np.testing.assert_almost_equal(oetf_inverse_BT601(E), L, decimal=7) E = np.reshape(E, (2, 3)) L = np.reshape(L, (2, 3)) - np.testing.assert_almost_equal(oetf_reverse_BT601(E), L, decimal=7) + np.testing.assert_almost_equal(oetf_inverse_BT601(E), L, decimal=7) E = np.reshape(E, (2, 3, 1)) L = np.reshape(L, (2, 3, 1)) - np.testing.assert_almost_equal(oetf_reverse_BT601(E), L, decimal=7) + np.testing.assert_almost_equal(oetf_inverse_BT601(E), L, decimal=7) - def test_domain_range_scale_oetf_reverse_BT601(self): + def test_domain_range_scale_oetf_inverse_BT601(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_601.\ -oetf_reverse_BT601` definition domain and range scale support. +oetf_inverse_BT601` definition domain and range scale support. """ E = 0.409007728864150 - L = oetf_reverse_BT601(E) + L = oetf_inverse_BT601(E) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - oetf_reverse_BT601(E * factor), L * factor, decimal=7) + oetf_inverse_BT601(E * factor), L * factor, decimal=7) @ignore_numpy_errors - def test_nan_oetf_reverse_BT601(self): + def test_nan_oetf_inverse_BT601(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_601.\ -oetf_reverse_BT601` definition nan support. +oetf_inverse_BT601` definition nan support. """ - oetf_reverse_BT601(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + oetf_inverse_BT601(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) if __name__ == '__main__': diff --git a/colour/models/rgb/transfer_functions/tests/test_itur_bt_709.py b/colour/models/rgb/transfer_functions/tests/test_itur_bt_709.py index 54b5451fea..1d9a8fceae 100644 --- a/colour/models/rgb/transfer_functions/tests/test_itur_bt_709.py +++ b/colour/models/rgb/transfer_functions/tests/test_itur_bt_709.py @@ -9,7 +9,7 @@ import numpy as np import unittest -from colour.models.rgb.transfer_functions import oetf_BT709, oetf_reverse_BT709 +from colour.models.rgb.transfer_functions import oetf_BT709, oetf_inverse_BT709 from colour.utilities import domain_range_scale, ignore_numpy_errors __author__ = 'Colour Developers' @@ -19,7 +19,7 @@ __email__ = 'colour-science@googlegroups.com' __status__ = 'Production' -__all__ = ['TestOetf_BT709', 'TestOetf_reverse_BT709'] +__all__ = ['TestOetf_BT709', 'TestOetf_inverse_BT709'] class TestOetf_BT709(unittest.TestCase): @@ -88,72 +88,72 @@ def test_nan_oetf_BT709(self): oetf_BT709(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) -class TestOetf_reverse_BT709(unittest.TestCase): +class TestOetf_inverse_BT709(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.itur_bt_709.\ -oetf_reverse_BT709` definition unit tests methods. +oetf_inverse_BT709` definition unit tests methods. """ - def test_oetf_reverse_BT709(self): + def test_oetf_inverse_BT709(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_709.\ -oetf_reverse_BT709` definition. +oetf_inverse_BT709` definition. """ - self.assertAlmostEqual(oetf_reverse_BT709(0.0), 0.0, places=7) + self.assertAlmostEqual(oetf_inverse_BT709(0.0), 0.0, places=7) self.assertAlmostEqual( - oetf_reverse_BT709(0.067500000000000), 0.015, places=7) + oetf_inverse_BT709(0.067500000000000), 0.015, places=7) self.assertAlmostEqual( - oetf_reverse_BT709(0.409007728864150), 0.18, places=7) + oetf_inverse_BT709(0.409007728864150), 0.18, places=7) - self.assertAlmostEqual(oetf_reverse_BT709(1.0), 1.0, places=7) + self.assertAlmostEqual(oetf_inverse_BT709(1.0), 1.0, places=7) - def test_n_dimensional_oetf_reverse_BT709(self): + def test_n_dimensional_oetf_inverse_BT709(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_709.\ -oetf_reverse_BT709` definition n-dimensional arrays support. +oetf_inverse_BT709` definition n-dimensional arrays support. """ V = 0.409007728864150 - L = oetf_reverse_BT709(V) + L = oetf_inverse_BT709(V) V = np.tile(V, 6) L = np.tile(L, 6) - np.testing.assert_almost_equal(oetf_reverse_BT709(V), L, decimal=7) + np.testing.assert_almost_equal(oetf_inverse_BT709(V), L, decimal=7) V = np.reshape(V, (2, 3)) L = np.reshape(L, (2, 3)) - np.testing.assert_almost_equal(oetf_reverse_BT709(V), L, decimal=7) + np.testing.assert_almost_equal(oetf_inverse_BT709(V), L, decimal=7) V = np.reshape(V, (2, 3, 1)) L = np.reshape(L, (2, 3, 1)) - np.testing.assert_almost_equal(oetf_reverse_BT709(V), L, decimal=7) + np.testing.assert_almost_equal(oetf_inverse_BT709(V), L, decimal=7) - def test_domain_range_scale_oetf_reverse_BT709(self): + def test_domain_range_scale_oetf_inverse_BT709(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_709.\ -oetf_reverse_BT709` definition domain and range scale support. +oetf_inverse_BT709` definition domain and range scale support. """ V = 0.409007728864150 - L = oetf_reverse_BT709(V) + L = oetf_inverse_BT709(V) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - oetf_reverse_BT709(V * factor), L * factor, decimal=7) + oetf_inverse_BT709(V * factor), L * factor, decimal=7) @ignore_numpy_errors - def test_nan_oetf_reverse_BT709(self): + def test_nan_oetf_inverse_BT709(self): """ Tests :func:`colour.models.rgb.transfer_functions.itur_bt_709.\ -oetf_reverse_BT709` definition nan support. +oetf_inverse_BT709` definition nan support. """ - oetf_reverse_BT709(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + oetf_inverse_BT709(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) if __name__ == '__main__': diff --git a/colour/models/rgb/transfer_functions/tests/test_red_log.py b/colour/models/rgb/transfer_functions/tests/test_red_log.py index dbd94f5ed7..80cadf59fb 100644 --- a/colour/models/rgb/transfer_functions/tests/test_red_log.py +++ b/colour/models/rgb/transfer_functions/tests/test_red_log.py @@ -11,8 +11,10 @@ from colour.models.rgb.transfer_functions import ( log_encoding_REDLog, log_decoding_REDLog, log_encoding_REDLogFilm, - log_decoding_REDLogFilm, log_encoding_Log3G10, log_decoding_Log3G10, - log_encoding_Log3G12, log_decoding_Log3G12) + log_decoding_REDLogFilm, log_encoding_Log3G12, log_decoding_Log3G12) +from colour.models.rgb.transfer_functions.red_log import ( + log_encoding_Log3G10_v1, log_decoding_Log3G10_v1, log_encoding_Log3G10_v2, + log_decoding_Log3G10_v2) from colour.utilities import domain_range_scale, ignore_numpy_errors __author__ = 'Colour Developers' @@ -24,9 +26,10 @@ __all__ = [ 'TestLogEncoding_REDLog', 'TestLogDecoding_REDLog', - 'TestLogDecoding_REDLogFilm', 'TestLogDecoding_REDLogFilm', - 'TestLogDecoding_Log3G10', 'TestLogDecoding_Log3G10', - 'TestLogDecoding_Log3G12', 'TestLogDecoding_Log3G12' + 'TestLogEncoding_REDLogFilm', 'TestLogDecoding_REDLogFilm', + 'TestLogEncoding_Log3G10_v1', 'TestLogDecoding_Log3G10_v1', + 'TestLogEncoding_Log3G10_v2', 'TestLogDecoding_Log3G10_v2', + 'TestLogEncoding_Log3G12', 'TestLogDecoding_Log3G12' ] @@ -304,216 +307,286 @@ def test_nan_log_decoding_REDLogFilm(self): np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) -class TestLogEncoding_Log3G10(unittest.TestCase): +class TestLogEncoding_Log3G10_v1(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.red_log.\ -log_encoding_Log3G10` definition unit tests methods. +log_encoding_Log3G10_v1` definition unit tests methods. """ - def test_log_encoding_Log3G10(self): + def test_log_encoding_Log3G10_v1(self): """ Tests :func:`colour.models.rgb.transfer_functions.red_log.\ -log_encoding_Log3G10` definition. +log_encoding_Log3G10_v1` definition. """ self.assertAlmostEqual( - log_encoding_Log3G10(-1.0, legacy_curve=True), - -0.496483569056003, - places=7) + log_encoding_Log3G10_v1(-1.0), -0.496483569056003, places=7) - self.assertAlmostEqual( - log_encoding_Log3G10(0.0, legacy_curve=True), 0.0, places=7) + self.assertAlmostEqual(log_encoding_Log3G10_v1(0.0), 0.0, places=7) self.assertAlmostEqual( - log_encoding_Log3G10(0.18, legacy_curve=True), - 0.333333644207707, - places=7) + log_encoding_Log3G10_v1(0.18), 0.333333644207707, places=7) - self.assertAlmostEqual( - log_encoding_Log3G10(-1.0, legacy_curve=False), - -0.491512777522511, - places=7) + def test_n_dimensional_log_encoding_Log3G10_v1(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.red_log.\ +log_encoding_Log3G10_v1` definition n-dimensional arrays support. + """ + + x = 0.18 + y = log_encoding_Log3G10_v1(x) + + x = np.tile(x, 6) + y = np.tile(y, 6) + np.testing.assert_almost_equal( + log_encoding_Log3G10_v1(x), y, decimal=7) + + x = np.reshape(x, (2, 3)) + y = np.reshape(y, (2, 3)) + np.testing.assert_almost_equal( + log_encoding_Log3G10_v1(x), y, decimal=7) + + x = np.reshape(x, (2, 3, 1)) + y = np.reshape(y, (2, 3, 1)) + np.testing.assert_almost_equal( + log_encoding_Log3G10_v1(x), y, decimal=7) + + def test_domain_range_scale_log_encoding_Log3G10_v1(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.red_log.\ +log_encoding_Log3G10_v1` definition domain and range scale support. + """ + + x = 0.18 + y = log_encoding_Log3G10_v1(x) + + d_r = (('reference', 1), (1, 1), (100, 100)) + for scale, factor in d_r: + with domain_range_scale(scale): + np.testing.assert_almost_equal( + log_encoding_Log3G10_v1(x * factor), y * factor, decimal=7) + + @ignore_numpy_errors + def test_nan_log_encoding_Log3G10_v1(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.red_log.\ +log_encoding_Log3G10_v1` definition nan support. + """ + + log_encoding_Log3G10_v1( + np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + + +class TestLogDecoding_Log3G10_v1(unittest.TestCase): + """ + Defines :func:`colour.models.rgb.transfer_functions.red_log.\ +log_decoding_Log3G10_v1` definition unit tests methods. + """ + + def test_log_decoding_Log3G10_v1(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.red_log.\ +log_decoding_Log3G10_v1` definition. + """ self.assertAlmostEqual( - log_encoding_Log3G10(0.0, legacy_curve=False), - 0.091551487714745, - places=7) + log_decoding_Log3G10_v1(-0.496483569056003), -1.0, places=7) + + self.assertAlmostEqual(log_decoding_Log3G10_v1(0.0), 0.0, places=7) self.assertAlmostEqual( - log_encoding_Log3G10(0.18, legacy_curve=False), - 0.333332912025992, - places=7) + log_decoding_Log3G10_v1(0.333333644207707), 0.18, places=7) - def test_n_dimensional_log_encoding_Log3G10(self): + def test_n_dimensional_log_decoding_Log3G10_v1(self): """ Tests :func:`colour.models.rgb.transfer_functions.red_log.\ -log_encoding_Log3G10` definition n-dimensional arrays support. +log_decoding_Log3G10_v1` definition n-dimensional arrays support. """ - x = 0.18 - y_1 = log_encoding_Log3G10(x, legacy_curve=True) - y_2 = log_encoding_Log3G10(x, legacy_curve=False) + y = 0.333333644207707 + x = log_decoding_Log3G10_v1(y) + y = np.tile(y, 6) x = np.tile(x, 6) - y_1 = np.tile(y_1, 6) - y_2 = np.tile(y_2, 6) np.testing.assert_almost_equal( - log_encoding_Log3G10(x, legacy_curve=True), y_1, decimal=7) - np.testing.assert_almost_equal( - log_encoding_Log3G10(x, legacy_curve=False), y_2, decimal=7) + log_decoding_Log3G10_v1(y), x, decimal=7) + y = np.reshape(y, (2, 3)) x = np.reshape(x, (2, 3)) - y_1 = np.reshape(y_1, (2, 3)) - y_2 = np.reshape(y_2, (2, 3)) np.testing.assert_almost_equal( - log_encoding_Log3G10(x, legacy_curve=True), y_1, decimal=7) - np.testing.assert_almost_equal( - log_encoding_Log3G10(x, legacy_curve=False), y_2, decimal=7) + log_decoding_Log3G10_v1(y), x, decimal=7) + y = np.reshape(y, (2, 3, 1)) x = np.reshape(x, (2, 3, 1)) - y_1 = np.reshape(y_1, (2, 3, 1)) - y_2 = np.reshape(y_2, (2, 3, 1)) np.testing.assert_almost_equal( - log_encoding_Log3G10(x, legacy_curve=True), y_1, decimal=7) - np.testing.assert_almost_equal( - log_encoding_Log3G10(x, legacy_curve=False), y_2, decimal=7) + log_decoding_Log3G10_v1(y), x, decimal=7) - def test_domain_range_scale_log_encoding_Log3G10(self): + def test_domain_range_scale_log_decoding_Log3G10_v1(self): """ Tests :func:`colour.models.rgb.transfer_functions.red_log.\ -log_encoding_Log3G10` definition domain and range scale support. +log_decoding_Log3G10_v1` definition domain and range scale support. """ - x = 0.18 - y = log_encoding_Log3G10(x) + y = 0.333333644207707 + x = log_decoding_Log3G10_v1(y) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - log_encoding_Log3G10(x * factor), y * factor, decimal=7) + log_decoding_Log3G10_v1(y * factor), x * factor, decimal=7) @ignore_numpy_errors - def test_nan_log_encoding_Log3G10(self): + def test_nan_log_decoding_Log3G10_v1(self): """ Tests :func:`colour.models.rgb.transfer_functions.red_log.\ -log_encoding_Log3G10` definition nan support. +log_decoding_Log3G10_v1` definition nan support. """ - log_encoding_Log3G10( - np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]), - legacy_curve=True) - log_encoding_Log3G10( - np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]), - legacy_curve=False) + log_decoding_Log3G10_v1( + np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) -class TestLogDecoding_Log3G10(unittest.TestCase): +class TestLogEncoding_Log3G10_v2(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.red_log.\ -log_decoding_Log3G10` definition unit tests methods. +log_encoding_Log3G10_v2` definition unit tests methods. """ - def test_log_decoding_Log3G10(self): + def test_log_encoding_Log3G10_v2(self): """ Tests :func:`colour.models.rgb.transfer_functions.red_log.\ -log_decoding_Log3G10` definition. +log_encoding_Log3G10_v2` definition. """ self.assertAlmostEqual( - log_decoding_Log3G10(-0.496483569056003, legacy_curve=True), - -1.0, - places=7) + log_encoding_Log3G10_v2(-1.0), -0.491512777522511, places=7) self.assertAlmostEqual( - log_decoding_Log3G10(0.0, legacy_curve=True), 0.0, places=7) + log_encoding_Log3G10_v2(0.0), 0.091551487714745, places=7) self.assertAlmostEqual( - log_decoding_Log3G10(0.333333644207707, legacy_curve=True), - 0.18, - places=7) + log_encoding_Log3G10_v2(0.18), 0.333332912025992, places=7) + + def test_n_dimensional_log_encoding_Log3G10_v2(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.red_log.\ +log_encoding_Log3G10_v2` definition n-dimensional arrays support. + """ + + x = 0.18 + y = log_encoding_Log3G10_v2(x) + + x = np.tile(x, 6) + y = np.tile(y, 6) + np.testing.assert_almost_equal( + log_encoding_Log3G10_v2(x), y, decimal=7) + + x = np.reshape(x, (2, 3)) + y = np.reshape(y, (2, 3)) + np.testing.assert_almost_equal( + log_encoding_Log3G10_v2(x), y, decimal=7) + + x = np.reshape(x, (2, 3, 1)) + y = np.reshape(y, (2, 3, 1)) + np.testing.assert_almost_equal( + log_encoding_Log3G10_v2(x), y, decimal=7) + + def test_domain_range_scale_log_encoding_Log3G10_v2(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.red_log.\ +log_encoding_Log3G10_v2` definition domain and range scale support. + """ + + x = 0.18 + y = log_encoding_Log3G10_v2(x) + + d_r = (('reference', 1), (1, 1), (100, 100)) + for scale, factor in d_r: + with domain_range_scale(scale): + np.testing.assert_almost_equal( + log_encoding_Log3G10_v2(x * factor), y * factor, decimal=7) + + @ignore_numpy_errors + def test_nan_log_encoding_Log3G10_v2(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.red_log.\ +log_encoding_Log3G10_v2` definition nan support. + """ + + log_encoding_Log3G10_v2( + np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + + +class TestLogDecoding_Log3G10_v2(unittest.TestCase): + """ + Defines :func:`colour.models.rgb.transfer_functions.red_log.\ +log_decoding_Log3G10_v2` definition unit tests methods. + """ + + def test_log_decoding_Log3G10_v2(self): + """ + Tests :func:`colour.models.rgb.transfer_functions.red_log.\ +log_decoding_Log3G10_v2` definition. + """ self.assertAlmostEqual( - log_decoding_Log3G10(-0.491512777522511, legacy_curve=False), - -1.0, - places=7) + log_decoding_Log3G10_v2(-0.491512777522511), -1.0, places=7) self.assertAlmostEqual( - log_decoding_Log3G10(0.091551487714745, legacy_curve=False), - 0.0, - places=7) + log_decoding_Log3G10_v2(0.091551487714745), 0.0, places=7) self.assertAlmostEqual( - log_decoding_Log3G10(0.333332912025992, legacy_curve=False), - 0.18, - places=7) + log_decoding_Log3G10_v2(0.333332912025992), 0.18, places=7) - def test_n_dimensional_log_decoding_Log3G10(self): + def test_n_dimensional_log_decoding_Log3G10_v2(self): """ Tests :func:`colour.models.rgb.transfer_functions.red_log.\ -log_decoding_Log3G10` definition n-dimensional arrays support. +log_decoding_Log3G10_v2` definition n-dimensional arrays support. """ - y_1 = 0.333333644207707 - y_2 = 0.333332912025992 - x_1 = log_decoding_Log3G10(y_1, legacy_curve=True) - x_2 = log_decoding_Log3G10(y_2, legacy_curve=False) + y = 0.333332912025992 + x = log_decoding_Log3G10_v2(y) - y_1 = np.tile(y_1, 6) - y_2 = np.tile(y_2, 6) - x_1 = np.tile(x_1, 6) - x_2 = np.tile(x_2, 6) - np.testing.assert_almost_equal( - log_decoding_Log3G10(y_1, legacy_curve=True), x_1, decimal=7) + y = np.tile(y, 6) + x = np.tile(x, 6) np.testing.assert_almost_equal( - log_decoding_Log3G10(y_2, legacy_curve=False), x_2, decimal=7) + log_decoding_Log3G10_v2(y), x, decimal=7) - y_1 = np.reshape(y_1, (2, 3)) - y_2 = np.reshape(y_2, (2, 3)) - x_1 = np.reshape(x_1, (2, 3)) - x_2 = np.reshape(x_2, (2, 3)) - np.testing.assert_almost_equal( - log_decoding_Log3G10(y_1, legacy_curve=True), x_1, decimal=7) + y = np.reshape(y, (2, 3)) + x = np.reshape(x, (2, 3)) np.testing.assert_almost_equal( - log_decoding_Log3G10(y_2, legacy_curve=False), x_2, decimal=7) + log_decoding_Log3G10_v2(y), x, decimal=7) - y_1 = np.reshape(y_1, (2, 3, 1)) - y_2 = np.reshape(y_2, (2, 3, 1)) - x_1 = np.reshape(x_1, (2, 3, 1)) - x_2 = np.reshape(x_2, (2, 3, 1)) - np.testing.assert_almost_equal( - log_decoding_Log3G10(y_1, legacy_curve=True), x_1, decimal=7) + y = np.reshape(y, (2, 3, 1)) + x = np.reshape(x, (2, 3, 1)) np.testing.assert_almost_equal( - log_decoding_Log3G10(y_2, legacy_curve=False), x_2, decimal=7) + log_decoding_Log3G10_v2(y), x, decimal=7) - def test_domain_range_scale_log_decoding_Log3G10(self): + def test_domain_range_scale_log_decoding_Log3G10_v2(self): """ Tests :func:`colour.models.rgb.transfer_functions.red_log.\ -log_decoding_Log3G10` definition domain and range scale support. +log_decoding_Log3G10_v2` definition domain and range scale support. """ y = 0.333333644207707 - x = log_decoding_Log3G10(y) + x = log_decoding_Log3G10_v2(y) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - log_decoding_Log3G10(y * factor), x * factor, decimal=7) + log_decoding_Log3G10_v2(y * factor), x * factor, decimal=7) @ignore_numpy_errors - def test_nan_log_decoding_Log3G10(self): + def test_nan_log_decoding_Log3G10_v2(self): """ Tests :func:`colour.models.rgb.transfer_functions.red_log.\ -log_decoding_Log3G10` definition nan support. +log_decoding_Log3G10_v2` definition nan support. """ - log_decoding_Log3G10( - np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]), - legacy_curve=True) - log_decoding_Log3G10( - np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]), - legacy_curve=False) + log_decoding_Log3G10_v2( + np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) class TestLogEncoding_Log3G12(unittest.TestCase): diff --git a/colour/models/rgb/transfer_functions/tests/test_rimm_romm_rgb.py b/colour/models/rgb/transfer_functions/tests/test_rimm_romm_rgb.py index 6222a6aa13..43cf6ed31c 100644 --- a/colour/models/rgb/transfer_functions/tests/test_rimm_romm_rgb.py +++ b/colour/models/rgb/transfer_functions/tests/test_rimm_romm_rgb.py @@ -10,8 +10,8 @@ import unittest from colour.models.rgb.transfer_functions import ( - oetf_ROMMRGB, eotf_ROMMRGB, oetf_RIMMRGB, eotf_RIMMRGB, - log_encoding_ERIMMRGB, log_decoding_ERIMMRGB) + cctf_encoding_ROMMRGB, cctf_decoding_ROMMRGB, cctf_encoding_RIMMRGB, + cctf_decoding_RIMMRGB, log_encoding_ERIMMRGB, log_decoding_ERIMMRGB) from colour.utilities import domain_range_scale, ignore_numpy_errors __author__ = 'Colour Developers' @@ -22,292 +22,322 @@ __status__ = 'Production' __all__ = [ - 'TestOetf_ROMMRGB', 'TestEotf_ROMMRGB', 'TestOetf_RIMMRGB', - 'TestEotf_RIMMRGB', 'TestLog_encoding_ERIMMRGB', - 'TestLog_decoding_ERIMMRGB' + 'TestCctfEncoding_ROMMRGB', 'TestCctfDecoding_ROMMRGB', + 'TestCctfEncoding_RIMMRGB', 'TestCctfDecoding_RIMMRGB', + 'TestLog_encoding_ERIMMRGB', 'TestLog_decoding_ERIMMRGB' ] -class TestOetf_ROMMRGB(unittest.TestCase): +class TestCctfEncoding_ROMMRGB(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ -oetf_ROMMRGB` definition unit tests methods. +cctf_encoding_ROMMRGB` definition unit tests methods. """ - def test_oetf_ROMMRGB(self): + def test_cctf_encoding_ROMMRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ -oetf_ROMMRGB` definition. +cctf_encoding_ROMMRGB` definition. """ - self.assertAlmostEqual(oetf_ROMMRGB(0.0), 0.0, places=7) + self.assertAlmostEqual(cctf_encoding_ROMMRGB(0.0), 0.0, places=7) - self.assertAlmostEqual(oetf_ROMMRGB(0.18), 0.385711424751138, places=7) + self.assertAlmostEqual( + cctf_encoding_ROMMRGB(0.18), 0.385711424751138, places=7) - self.assertAlmostEqual(oetf_ROMMRGB(1.0), 1.0, places=7) + self.assertAlmostEqual(cctf_encoding_ROMMRGB(1.0), 1.0, places=7) - self.assertEqual(oetf_ROMMRGB(0.18, out_int=True), 98) + self.assertEqual(cctf_encoding_ROMMRGB(0.18, out_int=True), 98) - self.assertEqual(oetf_ROMMRGB(0.18, bit_depth=12, out_int=True), 1579) + self.assertEqual( + cctf_encoding_ROMMRGB(0.18, bit_depth=12, out_int=True), 1579) - def test_n_dimensional_oetf_ROMMRGB(self): + def test_n_dimensional_cctf_encoding_ROMMRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ -oetf_ROMMRGB` definition n-dimensional arrays support. +cctf_encoding_ROMMRGB` definition n-dimensional arrays support. """ X = 0.18 - X_ROMM = oetf_ROMMRGB(X) + X_ROMM = cctf_encoding_ROMMRGB(X) X = np.tile(X, 6) X_ROMM = np.tile(X_ROMM, 6) - np.testing.assert_almost_equal(oetf_ROMMRGB(X), X_ROMM, decimal=7) + np.testing.assert_almost_equal( + cctf_encoding_ROMMRGB(X), X_ROMM, decimal=7) X = np.reshape(X, (2, 3)) X_ROMM = np.reshape(X_ROMM, (2, 3)) - np.testing.assert_almost_equal(oetf_ROMMRGB(X), X_ROMM, decimal=7) + np.testing.assert_almost_equal( + cctf_encoding_ROMMRGB(X), X_ROMM, decimal=7) X = np.reshape(X, (2, 3, 1)) X_ROMM = np.reshape(X_ROMM, (2, 3, 1)) - np.testing.assert_almost_equal(oetf_ROMMRGB(X), X_ROMM, decimal=7) + np.testing.assert_almost_equal( + cctf_encoding_ROMMRGB(X), X_ROMM, decimal=7) - def test_domain_range_scale_oetf_ROMMRGB(self): + def test_domain_range_scale_cctf_encoding_ROMMRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ -oetf_ROMMRGB` definition domain and range scale support. +cctf_encoding_ROMMRGB` definition domain and range scale support. """ X = 0.18 - X_p = oetf_ROMMRGB(X) + X_p = cctf_encoding_ROMMRGB(X) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - oetf_ROMMRGB(X * factor), X_p * factor, decimal=7) + cctf_encoding_ROMMRGB(X * factor), X_p * factor, decimal=7) @ignore_numpy_errors - def test_nan_oetf_ROMMRGB(self): + def test_nan_cctf_encoding_ROMMRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ -oetf_ROMMRGB` definition nan support. +cctf_encoding_ROMMRGB` definition nan support. """ - oetf_ROMMRGB(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + cctf_encoding_ROMMRGB( + np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) -class TestEotf_ROMMRGB(unittest.TestCase): +class TestCctfDecoding_ROMMRGB(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb. -eotf_ROMMRGB` definition unit tests methods. +cctf_decoding_ROMMRGB` definition unit tests methods. """ - def test_eotf_ROMMRGB(self): + def test_cctf_decoding_ROMMRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ -eotf_ROMMRGB` definition. +cctf_decoding_ROMMRGB` definition. """ - self.assertAlmostEqual(eotf_ROMMRGB(0.0), 0.0, places=7) + self.assertAlmostEqual(cctf_decoding_ROMMRGB(0.0), 0.0, places=7) - self.assertAlmostEqual(eotf_ROMMRGB(0.385711424751138), 0.18, places=7) + self.assertAlmostEqual( + cctf_decoding_ROMMRGB(0.385711424751138), 0.18, places=7) - self.assertAlmostEqual(eotf_ROMMRGB(1.0), 1.0, places=7) + self.assertAlmostEqual(cctf_decoding_ROMMRGB(1.0), 1.0, places=7) np.testing.assert_allclose( - eotf_ROMMRGB(98, in_int=True), 0.18, atol=0.001, rtol=0.001) + cctf_decoding_ROMMRGB(98, in_int=True), + 0.18, + atol=0.001, + rtol=0.001) np.testing.assert_allclose( - eotf_ROMMRGB(1579, bit_depth=12, in_int=True), + cctf_decoding_ROMMRGB(1579, bit_depth=12, in_int=True), 0.18, atol=0.001, rtol=0.001) - def test_n_dimensional_eotf_ROMMRGB(self): + def test_n_dimensional_cctf_decoding_ROMMRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ -eotf_ROMMRGB` definition n-dimensional arrays support. +cctf_decoding_ROMMRGB` definition n-dimensional arrays support. """ X_p = 0.385711424751138 - X = eotf_ROMMRGB(X_p) + X = cctf_decoding_ROMMRGB(X_p) X_p = np.tile(X_p, 6) X = np.tile(X, 6) - np.testing.assert_almost_equal(eotf_ROMMRGB(X_p), X, decimal=7) + np.testing.assert_almost_equal( + cctf_decoding_ROMMRGB(X_p), X, decimal=7) X_p = np.reshape(X_p, (2, 3)) X = np.reshape(X, (2, 3)) - np.testing.assert_almost_equal(eotf_ROMMRGB(X_p), X, decimal=7) + np.testing.assert_almost_equal( + cctf_decoding_ROMMRGB(X_p), X, decimal=7) X_p = np.reshape(X_p, (2, 3, 1)) X = np.reshape(X, (2, 3, 1)) - np.testing.assert_almost_equal(eotf_ROMMRGB(X_p), X, decimal=7) + np.testing.assert_almost_equal( + cctf_decoding_ROMMRGB(X_p), X, decimal=7) - def test_domain_range_scale_eotf_ROMMRGB(self): + def test_domain_range_scale_cctf_decoding_ROMMRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ -eotf_ROMMRGB` definition domain and range scale support. +cctf_decoding_ROMMRGB` definition domain and range scale support. """ X_p = 0.385711424751138 - X = eotf_ROMMRGB(X_p) + X = cctf_decoding_ROMMRGB(X_p) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - eotf_ROMMRGB(X_p * factor), X * factor, decimal=7) + cctf_decoding_ROMMRGB(X_p * factor), X * factor, decimal=7) @ignore_numpy_errors - def test_nan_eotf_ROMMRGB(self): + def test_nan_cctf_decoding_ROMMRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ -eotf_ROMMRGB` definition nan support. +cctf_decoding_ROMMRGB` definition nan support. """ - eotf_ROMMRGB(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + cctf_decoding_ROMMRGB( + np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) -class TestOetf_RIMMRGB(unittest.TestCase): +class TestCctfEncoding_RIMMRGB(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ -oetf_RIMMRGB` definition unit tests methods. +cctf_encoding_RIMMRGB` definition unit tests methods. """ - def test_oetf_RIMMRGB(self): + def test_cctf_encoding_RIMMRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ -oetf_RIMMRGB` definition. +cctf_encoding_RIMMRGB` definition. """ - self.assertAlmostEqual(oetf_RIMMRGB(0.0), 0.0, places=7) + self.assertAlmostEqual(cctf_encoding_RIMMRGB(0.0), 0.0, places=7) - self.assertAlmostEqual(oetf_RIMMRGB(0.18), 0.291673732475746, places=7) + self.assertAlmostEqual( + cctf_encoding_RIMMRGB(0.18), 0.291673732475746, places=7) - self.assertAlmostEqual(oetf_RIMMRGB(1.0), 0.713125234297525, places=7) + self.assertAlmostEqual( + cctf_encoding_RIMMRGB(1.0), 0.713125234297525, places=7) - self.assertEqual(oetf_RIMMRGB(0.18, out_int=True), 74) + self.assertEqual(cctf_encoding_RIMMRGB(0.18, out_int=True), 74) - self.assertEqual(oetf_RIMMRGB(0.18, bit_depth=12, out_int=True), 1194) + self.assertEqual( + cctf_encoding_RIMMRGB(0.18, bit_depth=12, out_int=True), 1194) - def test_n_dimensional_oetf_RIMMRGB(self): + def test_n_dimensional_cctf_encoding_RIMMRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ -oetf_RIMMRGB` definition n-dimensional arrays support. +cctf_encoding_RIMMRGB` definition n-dimensional arrays support. """ X = 0.18 - X_p = oetf_RIMMRGB(X) + X_p = cctf_encoding_RIMMRGB(X) X = np.tile(X, 6) X_p = np.tile(X_p, 6) - np.testing.assert_almost_equal(oetf_RIMMRGB(X), X_p, decimal=7) + np.testing.assert_almost_equal( + cctf_encoding_RIMMRGB(X), X_p, decimal=7) X = np.reshape(X, (2, 3)) X_p = np.reshape(X_p, (2, 3)) - np.testing.assert_almost_equal(oetf_RIMMRGB(X), X_p, decimal=7) + np.testing.assert_almost_equal( + cctf_encoding_RIMMRGB(X), X_p, decimal=7) X = np.reshape(X, (2, 3, 1)) X_p = np.reshape(X_p, (2, 3, 1)) - np.testing.assert_almost_equal(oetf_RIMMRGB(X), X_p, decimal=7) + np.testing.assert_almost_equal( + cctf_encoding_RIMMRGB(X), X_p, decimal=7) - def test_domain_range_scale_oetf_RIMMRGB(self): + def test_domain_range_scale_cctf_encoding_RIMMRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ -oetf_RIMMRGB` definition domain and range scale support. +cctf_encoding_RIMMRGB` definition domain and range scale support. """ X = 0.18 - X_p = oetf_RIMMRGB(X) + X_p = cctf_encoding_RIMMRGB(X) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - oetf_RIMMRGB(X * factor), X_p * factor, decimal=7) + cctf_encoding_RIMMRGB(X * factor), X_p * factor, decimal=7) @ignore_numpy_errors - def test_nan_oetf_RIMMRGB(self): + def test_nan_cctf_encoding_RIMMRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ -oetf_RIMMRGB` definition nan support. +cctf_encoding_RIMMRGB` definition nan support. """ - oetf_RIMMRGB(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + cctf_encoding_RIMMRGB( + np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) -class TestEotf_RIMMRGB(unittest.TestCase): +class TestCctfDecoding_RIMMRGB(unittest.TestCase): """ Defines :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb. -eotf_RIMMRGB` definition unit tests methods. +cctf_decoding_RIMMRGB` definition unit tests methods. """ - def test_eotf_RIMMRGB(self): + def test_cctf_decoding_RIMMRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ -eotf_RIMMRGB` definition. +cctf_decoding_RIMMRGB` definition. """ - self.assertAlmostEqual(eotf_RIMMRGB(0.0), 0.0, places=7) + self.assertAlmostEqual(cctf_decoding_RIMMRGB(0.0), 0.0, places=7) - self.assertAlmostEqual(eotf_RIMMRGB(0.291673732475746), 0.18, places=7) + self.assertAlmostEqual( + cctf_decoding_RIMMRGB(0.291673732475746), 0.18, places=7) - self.assertAlmostEqual(eotf_RIMMRGB(0.713125234297525), 1.0, places=7) + self.assertAlmostEqual( + cctf_decoding_RIMMRGB(0.713125234297525), 1.0, places=7) np.testing.assert_allclose( - eotf_RIMMRGB(74, in_int=True), 0.18, atol=0.005, rtol=0.005) + cctf_decoding_RIMMRGB(74, in_int=True), + 0.18, + atol=0.005, + rtol=0.005) np.testing.assert_allclose( - eotf_RIMMRGB(1194, bit_depth=12, in_int=True), + cctf_decoding_RIMMRGB(1194, bit_depth=12, in_int=True), 0.18, atol=0.005, rtol=0.005) - def test_n_dimensional_eotf_RIMMRGB(self): + def test_n_dimensional_cctf_decoding_RIMMRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ -eotf_RIMMRGB` definition n-dimensional arrays support. +cctf_decoding_RIMMRGB` definition n-dimensional arrays support. """ X_p = 0.291673732475746 - X = eotf_RIMMRGB(X_p) + X = cctf_decoding_RIMMRGB(X_p) X_p = np.tile(X_p, 6) X = np.tile(X, 6) - np.testing.assert_almost_equal(eotf_RIMMRGB(X_p), X, decimal=7) + np.testing.assert_almost_equal( + cctf_decoding_RIMMRGB(X_p), X, decimal=7) X_p = np.reshape(X_p, (2, 3)) X = np.reshape(X, (2, 3)) - np.testing.assert_almost_equal(eotf_RIMMRGB(X_p), X, decimal=7) + np.testing.assert_almost_equal( + cctf_decoding_RIMMRGB(X_p), X, decimal=7) X_p = np.reshape(X_p, (2, 3, 1)) X = np.reshape(X, (2, 3, 1)) - np.testing.assert_almost_equal(eotf_RIMMRGB(X_p), X, decimal=7) + np.testing.assert_almost_equal( + cctf_decoding_RIMMRGB(X_p), X, decimal=7) - def test_domain_range_scale_eotf_RIMMRGB(self): + def test_domain_range_scale_cctf_decoding_RIMMRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ -eotf_RIMMRGB` definition domain and range scale support. +cctf_decoding_RIMMRGB` definition domain and range scale support. """ X_p = 0.291673732475746 - X = eotf_RIMMRGB(X_p) + X = cctf_decoding_RIMMRGB(X_p) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - eotf_RIMMRGB(X_p * factor), X * factor, decimal=7) + cctf_decoding_RIMMRGB(X_p * factor), X * factor, decimal=7) @ignore_numpy_errors - def test_nan_eotf_RIMMRGB(self): + def test_nan_cctf_decoding_RIMMRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ -eotf_RIMMRGB` definition nan support. +cctf_decoding_RIMMRGB` definition nan support. """ - eotf_RIMMRGB(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + cctf_decoding_RIMMRGB( + np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) class TestLog_encoding_ERIMMRGB(unittest.TestCase): diff --git a/colour/models/rgb/transfer_functions/tests/test_srgb.py b/colour/models/rgb/transfer_functions/tests/test_srgb.py index f8c641f02e..8d57d46a5d 100644 --- a/colour/models/rgb/transfer_functions/tests/test_srgb.py +++ b/colour/models/rgb/transfer_functions/tests/test_srgb.py @@ -9,7 +9,7 @@ import numpy as np import unittest -from colour.models.rgb.transfer_functions import oetf_sRGB, oetf_reverse_sRGB +from colour.models.rgb.transfer_functions import eotf_inverse_sRGB, eotf_sRGB from colour.utilities import domain_range_scale, ignore_numpy_errors __author__ = 'Colour Developers' @@ -19,136 +19,136 @@ __email__ = 'colour-science@googlegroups.com' __status__ = 'Production' -__all__ = ['TestOetf_sRGB', 'TestOetf_reverse_sRGB'] +__all__ = ['TestEotf_inverse_sRGB', 'TestEotf_sRGB'] -class TestOetf_sRGB(unittest.TestCase): +class TestEotf_inverse_sRGB(unittest.TestCase): """ - Defines :func:`colour.models.rgb.transfer_functions.sRGB.oetf_sRGB` + Defines :func:`colour.models.rgb.transfer_functions.sRGB.eotf_inverse_sRGB` definition unit tests methods. """ - def test_oetf_sRGB(self): + def test_eotf_inverse_sRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.sRGB.\ -oetf_sRGB` definition. +eotf_inverse_sRGB` definition. """ - self.assertAlmostEqual(oetf_sRGB(0.0), 0.0, places=7) + self.assertAlmostEqual(eotf_inverse_sRGB(0.0), 0.0, places=7) - self.assertAlmostEqual(oetf_sRGB(0.18), 0.461356129500442, places=7) + self.assertAlmostEqual( + eotf_inverse_sRGB(0.18), 0.461356129500442, places=7) - self.assertAlmostEqual(oetf_sRGB(1.0), 1.0, places=7) + self.assertAlmostEqual(eotf_inverse_sRGB(1.0), 1.0, places=7) - def test_n_dimensional_oetf_sRGB(self): + def test_n_dimensional_eotf_inverse_sRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.sRGB.\ -oetf_sRGB` definition n-dimensional arrays support. +eotf_inverse_sRGB` definition n-dimensional arrays support. """ L = 0.18 - V = oetf_sRGB(L) + V = eotf_inverse_sRGB(L) L = np.tile(L, 6) V = np.tile(V, 6) - np.testing.assert_almost_equal(oetf_sRGB(L), V, decimal=7) + np.testing.assert_almost_equal(eotf_inverse_sRGB(L), V, decimal=7) L = np.reshape(L, (2, 3)) V = np.reshape(V, (2, 3)) - np.testing.assert_almost_equal(oetf_sRGB(L), V, decimal=7) + np.testing.assert_almost_equal(eotf_inverse_sRGB(L), V, decimal=7) L = np.reshape(L, (2, 3, 1)) V = np.reshape(V, (2, 3, 1)) - np.testing.assert_almost_equal(oetf_sRGB(L), V, decimal=7) + np.testing.assert_almost_equal(eotf_inverse_sRGB(L), V, decimal=7) - def test_domain_range_scale_oetf_sRGB(self): + def test_domain_range_scale_eotf_inverse_sRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.sRGB.\ -oetf_sRGB` definition domain and range scale support. +eotf_inverse_sRGB` definition domain and range scale support. """ L = 0.18 - V = oetf_sRGB(L) + V = eotf_inverse_sRGB(L) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - oetf_sRGB(L * factor), V * factor, decimal=7) + eotf_inverse_sRGB(L * factor), V * factor, decimal=7) @ignore_numpy_errors - def test_nan_oetf_sRGB(self): + def test_nan_eotf_inverse_sRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.sRGB.\ -oetf_sRGB` definition nan support. +eotf_inverse_sRGB` definition nan support. """ - oetf_sRGB(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + eotf_inverse_sRGB(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) -class TestOetf_reverse_sRGB(unittest.TestCase): +class TestEotf_sRGB(unittest.TestCase): """ - Defines :func:`colour.models.rgb.transfer_functions.sRGB.oetf_reverse_sRGB` + Defines :func:`colour.models.rgb.transfer_functions.sRGB.eotf_sRGB` definition unit tests methods. """ - def test_oetf_reverse_sRGB(self): + def test_eotf_sRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.sRGB.\ -oetf_reverse_sRGB` definition. +eotf_sRGB` definition. """ - self.assertAlmostEqual(oetf_reverse_sRGB(0.0), 0.0, places=7) + self.assertAlmostEqual(eotf_sRGB(0.0), 0.0, places=7) - self.assertAlmostEqual( - oetf_reverse_sRGB(0.461356129500442), 0.18, places=7) + self.assertAlmostEqual(eotf_sRGB(0.461356129500442), 0.18, places=7) - self.assertAlmostEqual(oetf_reverse_sRGB(1.0), 1.0, places=7) + self.assertAlmostEqual(eotf_sRGB(1.0), 1.0, places=7) - def test_n_dimensional_oetf_reverse_sRGB(self): + def test_n_dimensional_eotf_sRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.sRGB.\ -oetf_reverse_sRGB` definition n-dimensional arrays support. +eotf_sRGB` definition n-dimensional arrays support. """ V = 0.461356129500442 - L = oetf_reverse_sRGB(V) + L = eotf_sRGB(V) V = np.tile(V, 6) L = np.tile(L, 6) - np.testing.assert_almost_equal(oetf_reverse_sRGB(V), L, decimal=7) + np.testing.assert_almost_equal(eotf_sRGB(V), L, decimal=7) V = np.reshape(V, (2, 3)) L = np.reshape(L, (2, 3)) - np.testing.assert_almost_equal(oetf_reverse_sRGB(V), L, decimal=7) + np.testing.assert_almost_equal(eotf_sRGB(V), L, decimal=7) V = np.reshape(V, (2, 3, 1)) L = np.reshape(L, (2, 3, 1)) - np.testing.assert_almost_equal(oetf_reverse_sRGB(V), L, decimal=7) + np.testing.assert_almost_equal(eotf_sRGB(V), L, decimal=7) - def test_domain_range_scale_oetf_reverse_sRGB(self): + def test_domain_range_scale_eotf_sRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.sRGB.\ -oetf_reverse_sRGB` definition domain and range scale support. +eotf_sRGB` definition domain and range scale support. """ V = 0.461356129500442 - L = oetf_reverse_sRGB(V) + L = eotf_sRGB(V) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - oetf_reverse_sRGB(V * factor), L * factor, decimal=7) + eotf_sRGB(V * factor), L * factor, decimal=7) @ignore_numpy_errors - def test_nan_oetf_reverse_sRGB(self): + def test_nan_eotf_sRGB(self): """ Tests :func:`colour.models.rgb.transfer_functions.sRGB.\ -oetf_reverse_sRGB` definition nan support. +eotf_sRGB` definition nan support. """ - oetf_reverse_sRGB(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + eotf_sRGB(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) if __name__ == '__main__': diff --git a/colour/models/rgb/transfer_functions/tests/test_st_2084.py b/colour/models/rgb/transfer_functions/tests/test_st_2084.py index cadff91228..a2cbfa5773 100644 --- a/colour/models/rgb/transfer_functions/tests/test_st_2084.py +++ b/colour/models/rgb/transfer_functions/tests/test_st_2084.py @@ -9,7 +9,8 @@ import numpy as np import unittest -from colour.models.rgb.transfer_functions import oetf_ST2084, eotf_ST2084 +from colour.models.rgb.transfer_functions import (eotf_inverse_ST2084, + eotf_ST2084) from colour.utilities import domain_range_scale, ignore_numpy_errors __author__ = 'Colour Developers' @@ -19,73 +20,77 @@ __email__ = 'colour-science@googlegroups.com' __status__ = 'Production' -__all__ = ['TestOetf_ST2084', 'TestEotf_ST2084'] +__all__ = ['TestEotf_inverse_ST2084', 'TestEotf_ST2084'] -class TestOetf_ST2084(unittest.TestCase): +class TestEotf_inverse_ST2084(unittest.TestCase): """ - Defines :func:`colour.models.rgb.transfer_functions.st_2084.oetf_ST2084` - definition unit tests methods. + Defines :func:`colour.models.rgb.transfer_functions.st_2084.\ +eotf_inverse_ST2084` definition unit tests methods. """ - def test_oetf_ST2084(self): + def test_eotf_inverse_ST2084(self): """ Tests :func:`colour.models.rgb.transfer_functions.st_2084.\ -oetf_ST2084` definition. +eotf_inverse_ST2084` definition. """ - self.assertAlmostEqual(oetf_ST2084(0.0), 0.000000730955903, places=7) + self.assertAlmostEqual( + eotf_inverse_ST2084(0.0), 0.000000730955903, places=7) - self.assertAlmostEqual(oetf_ST2084(100), 0.508078421517399, places=7) + self.assertAlmostEqual( + eotf_inverse_ST2084(100), 0.508078421517399, places=7) - self.assertAlmostEqual(oetf_ST2084(400), 0.652578597563067, places=7) + self.assertAlmostEqual( + eotf_inverse_ST2084(400), 0.652578597563067, places=7) - self.assertAlmostEqual(oetf_ST2084(5000, 5000), 1.0, places=7) + self.assertAlmostEqual(eotf_inverse_ST2084(5000, 5000), 1.0, places=7) - def test_n_dimensional_oetf_ST2084(self): + def test_n_dimensional_eotf_inverse_ST2084(self): """ Tests :func:`colour.models.rgb.transfer_functions.st_2084.\ -oetf_ST2084` definition n-dimensional arrays support. +eotf_inverse_ST2084` definition n-dimensional arrays support. """ C = 100 - N = oetf_ST2084(C) + N = eotf_inverse_ST2084(C) C = np.tile(C, 6) N = np.tile(N, 6) - np.testing.assert_almost_equal(oetf_ST2084(C), N, decimal=7) + np.testing.assert_almost_equal(eotf_inverse_ST2084(C), N, decimal=7) C = np.reshape(C, (2, 3)) N = np.reshape(N, (2, 3)) - np.testing.assert_almost_equal(oetf_ST2084(C), N, decimal=7) + np.testing.assert_almost_equal(eotf_inverse_ST2084(C), N, decimal=7) C = np.reshape(C, (2, 3, 1)) N = np.reshape(N, (2, 3, 1)) - np.testing.assert_almost_equal(oetf_ST2084(C), N, decimal=7) + np.testing.assert_almost_equal(eotf_inverse_ST2084(C), N, decimal=7) - def test_domain_range_scale_oetf_ST2084(self): + def test_domain_range_scale_eotf_inverse_ST2084(self): """ Tests :func:`colour.models.rgb.transfer_functions.st_2084.\ -oetf_ST2084` definition domain and range scale support. +eotf_inverse_ST2084` definition domain and range scale support. """ C = 100 - N = oetf_ST2084(C) + N = eotf_inverse_ST2084(C) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - oetf_ST2084(C * factor), N * factor, decimal=7) + eotf_inverse_ST2084(C * factor), N * factor, decimal=7) @ignore_numpy_errors - def test_nan_oetf_ST2084(self): + def test_nan_eotf_inverse_ST2084(self): """ Tests :func:`colour.models.rgb.transfer_functions.st_2084.\ -oetf_ST2084` definition nan support. +eotf_inverse_ST2084` definition nan support. """ - oetf_ST2084(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) + eotf_inverse_ST2084( + np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) class TestEotf_ST2084(unittest.TestCase): diff --git a/colour/models/rgb/ycbcr.py b/colour/models/rgb/ycbcr.py index eefaa409da..8dbbb558ca 100644 --- a/colour/models/rgb/ycbcr.py +++ b/colour/models/rgb/ycbcr.py @@ -224,9 +224,9 @@ def RGB_to_YCbCr(RGB, | ``YCbCr`` | [0, 1] | [0, 1] | +----------------+-----------------------+---------------+ - - \\* This definition has input and output integer switches, thus the - domain-range scale information is only given for the floating point - mode. + \\* This definition has input and output integer switches, thus the + domain-range scale information is only given for the floating point mode. + - The default arguments, ``**{'in_bits': 10, 'in_legal': False, 'in_int': False, 'out_bits': 8, 'out_legal': True, 'out_int': False}`` transform a float *R'G'B'* input array normalised to domain [0, 1] @@ -346,9 +346,9 @@ def YCbCr_to_RGB(YCbCr, in_bits : int, optional Bit depth for integer input, or used in the calculation of the denominator for legal range float values, i.e. 8-bit means the float - value for legal white is *235 / 255*. Default is *10*. + value for legal white is *235 / 255*. Default is *8*. in_legal : bool, optional - Whether to treat the input values as legal range. Default is *False*. + Whether to treat the input values as legal range. Default is *True*. in_int : bool, optional Whether to treat the input values as ``in_bits`` integer code values. Default is *False*. @@ -356,9 +356,9 @@ def YCbCr_to_RGB(YCbCr, Bit depth for integer output, or used in the calculation of the denominator for legal range float values, i.e. 8-bit means the float value for legal white is *235 / 255*. Ignored if ``out_legal`` and - ``out_int`` are both *False*. Default is *8*. + ``out_int`` are both *False*. Default is *10*. out_legal : bool, optional - Whether to return legal range values. Default is *True*. + Whether to return legal range values. Default is *False*. out_int : bool, optional Whether to return values as ``out_bits`` integer code values. Default is *False*. @@ -396,9 +396,8 @@ def YCbCr_to_RGB(YCbCr, | ``RGB`` | [0, 1] | [0, 1] | +----------------+-----------------------+---------------+ - - \\* This definition has input and output integer switches, thus the - domain-range scale information is only given for the floating point - mode. + \\* This definition has input and output integer switches, thus the + domain-range scale information is only given for the floating point mode. Warning ------- @@ -508,9 +507,8 @@ def RGB_to_YcCbcCrc(RGB, | ``YcCbcCrc`` | [0, 1] | [0, 1] | +----------------+-----------------------+---------------+ - - \\* This definition has input and output integer switches, thus the - domain-range scale information is only given for the floating point - mode. + \\* This definition has input and output integer switches, thus the + domain-range scale information is only given for the floating point mode. Warning ------- @@ -612,9 +610,8 @@ def YcCbcCrc_to_RGB(YcCbcCrc, | ``RGB`` | [0, 1] | [0, 1] | +----------------+-----------------------+---------------+ - - \\* This definition has input and output integer switches, thus the - domain-range scale information is only given for the floating point - mode. + \\* This definition has input and output integer switches, thus the + domain-range scale information is only given for the floating point mode. Warning ------- diff --git a/colour/models/tests/test_hdr_ipt.py b/colour/models/tests/test_hdr_ipt.py index c45616606b..d3e84b7653 100644 --- a/colour/models/tests/test_hdr_ipt.py +++ b/colour/models/tests/test_hdr_ipt.py @@ -105,8 +105,8 @@ def test_nan_exponent_hdr_IPT(self): class TestXYZ_to_hdr_IPT(unittest.TestCase): """ - Defines :func:`colour.models.hdr_ipt.TestXYZ_to_hdr_IPT` definition unit - tests methods. + Defines :func:`colour.models.hdr_ipt.XYZ_to_hdr_IPT` definition unit tests + methods. """ def test_XYZ_to_hdr_IPT(self): diff --git a/colour/models/tests/test_ipt.py b/colour/models/tests/test_ipt.py index 1c81d51eb9..4ea5b80344 100644 --- a/colour/models/tests/test_ipt.py +++ b/colour/models/tests/test_ipt.py @@ -24,8 +24,7 @@ class TestXYZ_to_IPT(unittest.TestCase): """ - Defines :func:`colour.models.ipt.TestXYZ_to_IPT` definition unit tests - methods. + Defines :func:`colour.models.ipt.XYZ_to_IPT` definition unit tests methods. """ def test_XYZ_to_IPT(self): diff --git a/colour/models/tests/test_osa_ucs.py b/colour/models/tests/test_osa_ucs.py index a37500502f..f94826acd8 100644 --- a/colour/models/tests/test_osa_ucs.py +++ b/colour/models/tests/test_osa_ucs.py @@ -108,19 +108,25 @@ def test_OSA_UCS_to_XYZ(self): """ np.testing.assert_allclose( - OSA_UCS_to_XYZ(np.array([-3.00499790, 2.99713697, -9.66784231])), + OSA_UCS_to_XYZ( + np.array([-3.00499790, 2.99713697, -9.66784231]), + {'disp': False}), np.array([0.20654008, 0.12197225, 0.05136952]) * 100, rtol=0.00001, atol=0.00001) np.testing.assert_allclose( - OSA_UCS_to_XYZ(np.array([-1.64657491, 4.59201565, 5.31738757])), + OSA_UCS_to_XYZ( + np.array([-1.64657491, 4.59201565, 5.31738757]), + {'disp': False}), np.array([0.14222010, 0.23042768, 0.10495772]) * 100, rtol=0.00001, atol=0.00001) np.testing.assert_allclose( - OSA_UCS_to_XYZ(np.array([-5.08589672, -7.91062749, 0.98107575])), + OSA_UCS_to_XYZ( + np.array([-5.08589672, -7.91062749, 0.98107575]), + {'disp': False}), np.array([0.07818780, 0.06157201, 0.28099326]) * 100, rtol=0.00001, atol=0.00001) diff --git a/colour/notation/__init__.py b/colour/notation/__init__.py index 74f9e2b16f..7f2193fd69 100644 --- a/colour/notation/__init__.py +++ b/colour/notation/__init__.py @@ -2,26 +2,59 @@ from __future__ import absolute_import -from .dataset import * # noqa -from . import dataset +import sys + +from colour.utilities.deprecation import ModuleAPI, build_API_changes +from colour.utilities.documentation import is_documentation_building + +from .datasets import * # noqa +from . import datasets from .munsell import MUNSELL_VALUE_METHODS from .munsell import munsell_value from .munsell import (munsell_value_Priest1920, munsell_value_Munsell1933, munsell_value_Moon1943, munsell_value_Saunderson1944, munsell_value_Ladd1955, munsell_value_McCamy1987, - munsell_value_ASTMD153508) + munsell_value_ASTMD1535) from .munsell import munsell_colour_to_xyY, xyY_to_munsell_colour from .triplet import RGB_to_HEX, HEX_to_RGB __all__ = [] -__all__ += dataset.__all__ +__all__ += datasets.__all__ __all__ += ['munsell_value'] __all__ += ['MUNSELL_VALUE_METHODS'] __all__ += [ 'munsell_value_Priest1920', 'munsell_value_Munsell1933', 'munsell_value_Moon1943', 'munsell_value_Saunderson1944', 'munsell_value_Ladd1955', 'munsell_value_McCamy1987', - 'munsell_value_ASTMD153508' + 'munsell_value_ASTMD1535' ] __all__ += ['munsell_colour_to_xyY', 'xyY_to_munsell_colour'] __all__ += ['RGB_to_HEX', 'HEX_to_RGB'] + + +# ----------------------------------------------------------------------------# +# --- API Changes and Deprecation Management ---# +# ----------------------------------------------------------------------------# +class notation(ModuleAPI): + def __getattr__(self, attribute): + return super(notation, self).__getattr__(attribute) + + +# v0.3.14 +API_CHANGES = { + 'ObjectRenamed': [[ + 'colour.notation.munsell_value_ASTMD153508', + 'colour.notation.munsell_value_ASTMD1535', + ], ] +} +""" +Defines *colour.notation* sub-package API changes. + +API_CHANGES : dict +""" + +if not is_documentation_building(): + sys.modules['colour.notation'] = notation(sys.modules['colour.notation'], + build_API_changes(API_CHANGES)) + + del ModuleAPI, is_documentation_building, build_API_changes, sys diff --git a/colour/notation/dataset/__init__.py b/colour/notation/datasets/__init__.py similarity index 100% rename from colour/notation/dataset/__init__.py rename to colour/notation/datasets/__init__.py diff --git a/colour/notation/dataset/munsell/__init__.py b/colour/notation/datasets/munsell/__init__.py similarity index 100% rename from colour/notation/dataset/munsell/__init__.py rename to colour/notation/datasets/munsell/__init__.py diff --git a/colour/notation/dataset/munsell/all.py b/colour/notation/datasets/munsell/all.py similarity index 99% rename from colour/notation/dataset/munsell/all.py rename to colour/notation/datasets/munsell/all.py index e456a5f09b..b17f3a969c 100644 --- a/colour/notation/dataset/munsell/all.py +++ b/colour/notation/datasets/munsell/all.py @@ -3,7 +3,7 @@ Munsell Renotation System Dataset - All Munsell Colours ======================================================= -Defines the *Munsell Renotation System* *All* dataset. Those are *all* +Defines the *Munsell Renotation System* *All* datasets. Those are *all* published *Munsell* colours, including the extrapolated colors. See Also diff --git a/colour/notation/dataset/munsell/experimental.py b/colour/notation/datasets/munsell/experimental.py similarity index 99% rename from colour/notation/dataset/munsell/experimental.py rename to colour/notation/datasets/munsell/experimental.py index be7d43915a..bd066a3e18 100644 --- a/colour/notation/dataset/munsell/experimental.py +++ b/colour/notation/datasets/munsell/experimental.py @@ -3,7 +3,7 @@ Munsell Renotation System Dataset - 1929 Munsell Colours ======================================================== -Defines the *Munsell Renotation System* *1929* dataset. Those are the colours +Defines the *Munsell Renotation System* *1929* datasets. Those are the colours appearing in the 1929 *Munsell Book of Color*. These data has been used in the scaling experiments leading to the 1943 renotation. diff --git a/colour/notation/dataset/munsell/real.py b/colour/notation/datasets/munsell/real.py similarity index 99% rename from colour/notation/dataset/munsell/real.py rename to colour/notation/datasets/munsell/real.py index 5692509670..111f7b1c1c 100644 --- a/colour/notation/dataset/munsell/real.py +++ b/colour/notation/datasets/munsell/real.py @@ -3,7 +3,7 @@ Munsell Renotation System Dataset - Real Munsell Colours ======================================================== -Defines the *Munsell Renotation System* *Real* dataset. Those are *real*, +Defines the *Munsell Renotation System* *Real* datasets. Those are *real*, within MacAdam limits *Munsell* colours only. They are the colours listed in the original 1943 renotation article *(Newhall, Nickerson, & Judd, 1943)*. diff --git a/colour/notation/munsell.py b/colour/notation/munsell.py index 541c36edb8..e35fe19a5d 100644 --- a/colour/notation/munsell.py +++ b/colour/notation/munsell.py @@ -22,7 +22,7 @@ method. - :func:`colour.notation.munsell_value_McCamy1987`: *Munsell* value :math:`V` computation of given *luminance* :math:`Y` using *McCamy (1987)* method. -- :func:`colour.notation.munsell_value_ASTMD153508`: *Munsell* value +- :func:`colour.notation.munsell_value_ASTMD1535`: *Munsell* value :math:`V` computation of given *luminance* :math:`Y` using *ASTM D1535-08e1* method. - :attr:`colour.MUNSELL_VALUE_METHODS`: Supported *Munsell* value @@ -127,7 +127,7 @@ from colour.algebra import (Extrapolator, LinearInterpolator, cartesian_to_cylindrical, euclidean_distance, polar_to_cartesian, spow) -from colour.colorimetry import ILLUMINANTS, luminance_ASTMD153508 +from colour.colorimetry import ILLUMINANTS, luminance_ASTMD1535 from colour.constants import (DEFAULT_FLOAT_DTYPE, DEFAULT_INT_DTYPE, INTEGER_THRESHOLD, FLOATING_POINT_NUMBER_PATTERN) from colour.models import Lab_to_LCHab, XYZ_to_Lab, XYZ_to_xy, xyY_to_XYZ @@ -159,7 +159,7 @@ 'munsell_value_Priest1920', 'munsell_value_Munsell1933', 'munsell_value_Moon1943', 'munsell_value_Saunderson1944', 'munsell_value_Ladd1955', 'munsell_value_McCamy1987', - 'munsell_value_ASTMD153508', 'MUNSELL_VALUE_METHODS', 'munsell_value', + 'munsell_value_ASTMD1535', 'MUNSELL_VALUE_METHODS', 'munsell_value', 'munsell_specification_to_xyY', 'munsell_colour_to_xyY', 'xyY_to_munsell_specification', 'xyY_to_munsell_colour', 'parse_munsell_colour', 'is_grey_munsell_colour', @@ -242,7 +242,7 @@ def _munsell_specifications(): return _MUNSELL_SPECIFICATIONS_CACHE -def _munsell_value_ASTMD153508_interpolator(): +def _munsell_value_ASTMD1535_interpolator(): """ Returns the *Munsell* value interpolator for *ASTM D1535-08e1* method and caches it if not existing. @@ -259,7 +259,7 @@ def _munsell_value_ASTMD153508_interpolator(): if _MUNSELL_VALUE_ASTM_D1535_08_INTERPOLATOR_CACHE is None: _MUNSELL_VALUE_ASTM_D1535_08_INTERPOLATOR_CACHE = Extrapolator( LinearInterpolator( - luminance_ASTMD153508(munsell_values), munsell_values)) + luminance_ASTMD1535(munsell_values), munsell_values)) return _MUNSELL_VALUE_ASTM_D1535_08_INTERPOLATOR_CACHE @@ -584,10 +584,10 @@ def munsell_value_McCamy1987(Y): return from_range_10(V) -def munsell_value_ASTMD153508(Y): +def munsell_value_ASTMD1535(Y): """ Returns the *Munsell* value :math:`V` of given *luminance* :math:`Y` using - a reverse lookup table from *ASTM D1535-08e1* method. + an inverse lookup table from *ASTM D1535-08e1* method. Parameters ---------- @@ -623,13 +623,13 @@ def munsell_value_ASTMD153508(Y): Examples -------- - >>> munsell_value_ASTMD153508(12.23634268) # doctest: +ELLIPSIS + >>> munsell_value_ASTMD1535(12.23634268) # doctest: +ELLIPSIS 4.0824437... """ Y = to_domain_100(Y) - V = _munsell_value_ASTMD153508_interpolator()(Y) + V = _munsell_value_ASTMD1535_interpolator()(Y) return from_range_10(V) @@ -641,7 +641,7 @@ def munsell_value_ASTMD153508(Y): 'Saunderson 1944': munsell_value_Saunderson1944, 'Ladd 1955': munsell_value_Ladd1955, 'McCamy 1987': munsell_value_McCamy1987, - 'ASTM D1535-08': munsell_value_ASTMD153508 + 'ASTM D1535': munsell_value_ASTMD1535 }) MUNSELL_VALUE_METHODS.__doc__ = """ Supported *Munsell* value computation methods. @@ -652,16 +652,16 @@ def munsell_value_ASTMD153508(Y): MUNSELL_VALUE_METHODS : CaseInsensitiveMapping **{'Priest 1920', 'Munsell 1933', 'Moon 1943', 'Saunderson 1944', - 'Ladd 1955', 'McCamy 1987', 'ASTM D1535-08'}** + 'Ladd 1955', 'McCamy 1987', 'ASTM D1535'}** Aliases: -- 'astm2008': 'ASTM D1535-08' +- 'astm2008': 'ASTM D1535' """ -MUNSELL_VALUE_METHODS['astm2008'] = (MUNSELL_VALUE_METHODS['ASTM D1535-08']) +MUNSELL_VALUE_METHODS['astm2008'] = (MUNSELL_VALUE_METHODS['ASTM D1535']) -def munsell_value(Y, method='ASTM D1535-08'): +def munsell_value(Y, method='ASTM D1535'): """ Returns the *Munsell* value :math:`V` of given *luminance* :math:`Y` using given method. @@ -671,7 +671,7 @@ def munsell_value(Y, method='ASTM D1535-08'): Y : numeric or array_like *luminance* :math:`Y`. method : unicode, optional - **{'ASTM D1535-08', 'Priest 1920', 'Munsell 1933', 'Moon 1943', + **{'ASTM D1535', 'Priest 1920', 'Munsell 1933', 'Moon 1943', 'Saunderson 1944', 'Ladd 1955', 'McCamy 1987'}**, Computation method. @@ -757,7 +757,7 @@ def _munsell_specification_to_xyY(specification): '[0, 10]!'.format(specification)) with domain_range_scale('ignore'): - Y = luminance_ASTMD153508(value) + Y = luminance_ASTMD1535(value) if is_integer(value): value_minus = value_plus = round(value) @@ -780,8 +780,8 @@ def _munsell_specification_to_xyY(specification): y = y_minus else: with domain_range_scale('ignore'): - Y_minus = luminance_ASTMD153508(value_minus) - Y_plus = luminance_ASTMD153508(value_plus) + Y_minus = luminance_ASTMD1535(value_minus) + Y_plus = luminance_ASTMD1535(value_plus) x = LinearInterpolator((Y_minus, Y_plus), (x_minus, x_plus))(Y) y = LinearInterpolator((Y_minus, Y_plus), (y_minus, y_plus))(Y) @@ -929,7 +929,7 @@ def _xyY_to_munsell_specification(xyY): '"{1}"!'.format(xyY, MUNSELL_DEFAULT_ILLUMINANT)) with domain_range_scale('ignore'): - value = munsell_value_ASTMD153508(Y * 100) + value = munsell_value_ASTMD1535(Y * 100) if is_integer(value): value = round(value) @@ -1000,8 +1000,13 @@ def _xyY_to_munsell_specification(xyY): iterations_inner += 1 if iterations_inner > iterations_maximum_inner: - raise RuntimeError(('Maximum inner iterations count reached ' - 'without convergence!')) + # NOTE: This exception is likely never raised in practice: + # 300K iterations with random numbers never reached this code + # path, it is kept for consistency with the reference + # implementation. + raise RuntimeError( # pragma: no cover + ('Maximum inner iterations count reached without ' + 'convergence!')) hue_angle_inner = ((hue_angle_current + iterations_inner * (phi_input - phi_current)) % 360) @@ -1065,6 +1070,11 @@ def _xyY_to_munsell_specification(xyY): specification_current) chroma_maximum = maximum_chroma_from_renotation( hue_current, value, code_current) + + # NOTE: This condition is likely never "True" while producing a valid + # "Munsell Specification" in practice: 100K iterations with random + # numbers never reached this code path while producing a valid + # "Munsell Specification". if chroma_current > chroma_maximum: chroma_current = specification_current[2] = chroma_maximum @@ -1126,7 +1136,10 @@ def _xyY_to_munsell_specification(xyY): np.array(specification_current), np.array([10, 10, chroma_scale, 10])) - raise RuntimeError( + # NOTE: This exception is likely never raised in practice: 300K iterations + # with random numbers never reached this code path, it is kept for + # consistency with the reference # implementation + raise RuntimeError( # pragma: no cover 'Maximum outside iterations count reached without convergence!') @@ -1472,8 +1485,7 @@ def munsell_specification_to_munsell_colour(specification, hue, code = 10, (code + 1) % 10 if value == 0: - return MUNSELL_GRAY_EXTENDED_FORMAT.format(specification, - value_decimals) + return MUNSELL_GRAY_EXTENDED_FORMAT.format(value, value_decimals) else: hue_letter = MUNSELL_HUE_LETTER_CODES.first_key_from_value(code) @@ -1579,6 +1591,12 @@ def bounding_hues_from_renotation(hue, code): >>> bounding_hues_from_renotation(3.2, 4) array([[ 2.5, 4. ], [ 5. , 4. ]]) + + # Coverage Doctests + + >>> bounding_hues_from_renotation(0.0, 1) + array([[ 10., 2.], + [ 10., 2.]]) """ if hue % 2.5 == 0: @@ -1800,6 +1818,9 @@ def interpolation_method_from_renotation_ovoid(specification): ASTM_hue = hue_to_ASTM_hue(hue, code) + # NOTE: The first level "else" clauses are likely never reached in + # practice, they are kept for consistency with the reference + # implementation. if value == 1: if chroma == 2: if 15 < ASTM_hue < 30 or 60 < ASTM_hue < 85: @@ -1822,11 +1843,15 @@ def interpolation_method_from_renotation_ovoid(specification): else: interpolation_method = 1 elif chroma >= 10: - if 72.5 < ASTM_hue < 77.5: + # NOTE: This condition is likely never "True" while producing a + # valid "Munsell Specification" in practice: 1M iterations with + # random numbers never reached this code path while producing a + # valid "Munsell Specification". + if 72.5 < ASTM_hue < 77.5: # pragma: no cover interpolation_method = 2 else: interpolation_method = 1 - else: + else: # pragma: no cover interpolation_method = 1 elif value == 2: if chroma == 2: @@ -1854,7 +1879,7 @@ def interpolation_method_from_renotation_ovoid(specification): interpolation_method = 2 else: interpolation_method = 1 - else: + else: # pragma: no cover interpolation_method = 1 elif value == 3: if chroma == 2: @@ -1877,7 +1902,7 @@ def interpolation_method_from_renotation_ovoid(specification): interpolation_method = 2 else: interpolation_method = 1 - else: + else: # pragma: no cover interpolation_method = 1 elif value == 4: if chroma in (2, 4): @@ -1895,7 +1920,7 @@ def interpolation_method_from_renotation_ovoid(specification): interpolation_method = 2 else: interpolation_method = 1 - else: + else: # pragma: no cover interpolation_method = 1 elif value == 5: if chroma == 2: @@ -1913,7 +1938,7 @@ def interpolation_method_from_renotation_ovoid(specification): interpolation_method = 2 else: interpolation_method = 1 - else: + else: # pragma: no cover interpolation_method = 1 elif value == 6: if chroma in (2, 4): @@ -1941,7 +1966,7 @@ def interpolation_method_from_renotation_ovoid(specification): interpolation_method = 2 else: interpolation_method = 1 - else: + else: # pragma: no cover interpolation_method = 1 elif value == 7: if chroma in (2, 4, 6): @@ -1972,7 +1997,7 @@ def interpolation_method_from_renotation_ovoid(specification): interpolation_method = 2 else: interpolation_method = 1 - else: + else: # pragma: no cover interpolation_method = 1 elif value == 8: if chroma in (2, 4, 6, 8, 10, 12): @@ -1986,7 +2011,7 @@ def interpolation_method_from_renotation_ovoid(specification): interpolation_method = 2 else: interpolation_method = 1 - else: + else: # pragma: no cover interpolation_method = 1 elif value == 9: if chroma in (2, 4): @@ -2004,7 +2029,7 @@ def interpolation_method_from_renotation_ovoid(specification): interpolation_method = 2 else: interpolation_method = 1 - else: + else: # pragma: no cover interpolation_method = 1 return interpolation_methods.get(interpolation_method) @@ -2012,9 +2037,9 @@ def interpolation_method_from_renotation_ovoid(specification): def xy_from_renotation_ovoid(specification): """ - Converts given *Munsell* *Colorlab* specification to *xy* chromaticity + Converts given *Munsell* *Colorlab* specification to *CIE xy* chromaticity coordinates on *Munsell Renotation System* ovoid. - The *xy* point will be on the ovoid about the achromatic point, + The *CIE xy* point will be on the ovoid about the achromatic point, corresponding to the *Munsell* *Colorlab* specification value and chroma. @@ -2026,7 +2051,7 @@ def xy_from_renotation_ovoid(specification): Returns ------- ndarray - *xy* chromaticity coordinates. + *CIE xy* chromaticity coordinates. Raises ------ @@ -2081,7 +2106,9 @@ def xy_from_renotation_ovoid(specification): abs(hue - 5) < threshold or abs(hue - 7.5) < threshold or abs(hue - 10) < threshold): hue = 2.5 * round(hue / 2.5) + x, y, _Y = xyY_from_renotation((hue, value, chroma, code)) + return as_float_array([x, y]) hue_cw, hue_ccw = bounding_hues_from_renotation(hue, code) @@ -2122,6 +2149,10 @@ def xy_from_renotation_ovoid(specification): interpolation_method = interpolation_method_from_renotation_ovoid( specification).lower() + assert interpolation_method is not None, ( + 'Interpolation method must be one of : "{0}"'.format(', '.join( + ['Linear', 'radial']))) + if interpolation_method == 'linear': x = LinearInterpolator((lower_hue_angle, upper_hue_angle), (x_minus, x_plus))(hue_angle) @@ -2136,9 +2167,6 @@ def xy_from_renotation_ovoid(specification): x, y = tsplit( polar_to_cartesian((rho, np.radians(theta))) + as_float_array((x_grey, y_grey))) - else: - raise ValueError('Invalid interpolation method: "{0}"'.format( - interpolation_method)) return as_float_array([x, y]) @@ -2268,9 +2296,9 @@ def maximum_chroma_from_renotation(hue, value, code): max_chroma = min(ma_limit_mcw, ma_limit_mccw, ma_limit_pcw, ma_limit_pccw) else: - L = luminance_ASTMD153508(value) - L9 = luminance_ASTMD153508(9) - L10 = luminance_ASTMD153508(10) + L = luminance_ASTMD1535(value) + L9 = luminance_ASTMD1535(9) + L10 = luminance_ASTMD1535(10) max_chroma = min( LinearInterpolator((L9, L10), (ma_limit_mcw, 0))(L), @@ -2280,7 +2308,7 @@ def maximum_chroma_from_renotation(hue, value, code): def munsell_specification_to_xy(specification): """ - Converts given *Munsell* *Colorlab* specification to *xy* chromaticity + Converts given *Munsell* *Colorlab* specification to *CIE xy* chromaticity coordinates by interpolating over *Munsell Renotation System* data. Parameters @@ -2291,7 +2319,7 @@ def munsell_specification_to_xy(specification): Returns ------- ndarray - *xy* chromaticity coordinates. + *CIE xy* chromaticity coordinates. References ---------- diff --git a/colour/notation/tests/test_munsell.py b/colour/notation/tests/test_munsell.py index 3b652d002f..d6b236f032 100644 --- a/colour/notation/tests/test_munsell.py +++ b/colour/notation/tests/test_munsell.py @@ -30,11 +30,10 @@ xyY_to_munsell_colour) from colour.notation.munsell import (munsell_specification_to_xyY, xyY_to_munsell_specification) -from colour.notation import (munsell_value_Priest1920, - munsell_value_Munsell1933, munsell_value_Moon1943, - munsell_value_Saunderson1944, - munsell_value_Ladd1955, munsell_value_McCamy1987, - munsell_value_ASTMD153508) +from colour.notation import ( + munsell_value_Priest1920, munsell_value_Munsell1933, + munsell_value_Moon1943, munsell_value_Saunderson1944, + munsell_value_Ladd1955, munsell_value_McCamy1987, munsell_value_ASTMD1535) from colour.utilities import (as_float_array, domain_range_scale, ignore_numpy_errors, tstack) @@ -53,7 +52,7 @@ 'TestMunsellValuePriest1920', 'TestMunsellValueMunsell1933', 'TestMunsellValueMoon1943', 'TestMunsellValueSaunderson1944', 'TestMunsellValueLadd1955', 'TestMunsellValueMcCamy1992', - 'TestMunsellValueASTMD153508', 'TestMunsellSpecification_to_xyY', + 'TestMunsellValueASTMD1535', 'TestMunsellSpecification_to_xyY', 'TestMunsellColour_to_xyY', 'TestxyY_to_munsell_specification', 'TestxyY_to_munsell_colour', 'TestParseMunsellColour', 'TestIsGreyMunsellColour', 'TestNormalizeMunsellSpecification', @@ -67,7 +66,7 @@ ] -def _generate_unit_tests_specifications(): +def _generate_unit_tests_specifications(): # pragma: no cover """ Generates the unit tests specifications. @@ -81,7 +80,6 @@ def _generate_unit_tests_specifications(): """ from colour.notation import MUNSELL_COLOURS - from colour.notation.munsell import xyY_to_munsell_colour np.random.seed(16) @@ -451,6 +449,7 @@ def _generate_unit_tests_specifications(): [(7.5, 5.0, 4.0, 8), [0.35150000, 0.30240000, 0.19271844]], [(7.5, 5.0, 4.0, 5), [0.38500000, 0.41200000, 0.19271844]], [(2.5, 6.0, 10.0, 7), [0.43200000, 0.31180000, 0.29301153]], + [(8.0, 2, 14.0, 1), [0.07257382, 0.10413956, 0.03048116]], ]) MUNSELL_BOUNDING_HUES = np.array([ @@ -661,7 +660,7 @@ def _generate_unit_tests_specifications(): 'Linear', 'Radial', 'Linear', 'Radial', 'Radial', 'Radial', 'Linear', 'Linear', 'Linear', 'Linear', 'Linear', 'Linear', 'Linear', 'Linear', 'Linear', 'Linear', 'Radial', 'Linear', 'Linear', 'Radial', 'Linear', - 'Radial', 'Linear' + 'Radial', 'Linear', 'Radial' ] MUNSELL_XY_FROM_RENOTATION_OVOID = [ @@ -1214,82 +1213,76 @@ def test_nan_munsell_value_McCamy1987(self): np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) -class TestMunsellValueASTMD153508(unittest.TestCase): +class TestMunsellValueASTMD1535(unittest.TestCase): """ - Defines :func:`colour.notation.munsell.munsell_value_ASTMD153508` + Defines :func:`colour.notation.munsell.munsell_value_ASTMD1535` definition unit tests methods. """ - def test_munsell_value_ASTMD153508(self): + def test_munsell_value_ASTMD1535(self): """ - Tests :func:`colour.notation.munsell.munsell_value_ASTMD153508` + Tests :func:`colour.notation.munsell.munsell_value_ASTMD1535` definition. """ self.assertAlmostEqual( - munsell_value_ASTMD153508(12.23634268), - 4.0824437076525664, - places=7) + munsell_value_ASTMD1535(12.23634268), 4.0824437076525664, places=7) self.assertAlmostEqual( - munsell_value_ASTMD153508(22.89399987), - 5.3913268228155395, - places=7) + munsell_value_ASTMD1535(22.89399987), 5.3913268228155395, places=7) self.assertAlmostEqual( - munsell_value_ASTMD153508(6.29022535), - 2.9761930839606454, - places=7) + munsell_value_ASTMD1535(6.29022535), 2.9761930839606454, places=7) - def test_n_dimensional_munsell_value_ASTMD153508(self): + def test_n_dimensional_munsell_value_ASTMD1535(self): """ - Tests :func:`colour.notation.munsell.munsell_value_ASTMD153508` + Tests :func:`colour.notation.munsell.munsell_value_ASTMD1535` definition n-dimensional arrays support. """ Y = 12.23634268 - V = munsell_value_ASTMD153508(Y) + V = munsell_value_ASTMD1535(Y) V = np.tile(V, 6) Y = np.tile(Y, 6) np.testing.assert_almost_equal( - munsell_value_ASTMD153508(Y), V, decimal=7) + munsell_value_ASTMD1535(Y), V, decimal=7) V = np.reshape(V, (2, 3)) Y = np.reshape(Y, (2, 3)) np.testing.assert_almost_equal( - munsell_value_ASTMD153508(Y), V, decimal=7) + munsell_value_ASTMD1535(Y), V, decimal=7) V = np.reshape(V, (2, 3, 1)) Y = np.reshape(Y, (2, 3, 1)) np.testing.assert_almost_equal( - munsell_value_ASTMD153508(Y), V, decimal=7) + munsell_value_ASTMD1535(Y), V, decimal=7) - def test_domain_range_scale_munsell_value_ASTMD153508(self): + def test_domain_range_scale_munsell_value_ASTMD1535(self): """ - Tests :func:`colour.notation.munsell.munsell_value_ASTMD153508` + Tests :func:`colour.notation.munsell.munsell_value_ASTMD1535` definition domain and range scale support. """ Y = 12.23634268 - V = munsell_value_ASTMD153508(Y) + V = munsell_value_ASTMD1535(Y) d_r = (('reference', 1, 1), (1, 0.01, 0.1), (100, 1, 10)) for scale, factor_a, factor_b in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( - munsell_value_ASTMD153508(Y * factor_a), + munsell_value_ASTMD1535(Y * factor_a), V * factor_b, decimal=7) @ignore_numpy_errors - def test_nan_munsell_value_ASTMD153508(self): + def test_nan_munsell_value_ASTMD1535(self): """ - Tests :func:`colour.notation.munsell.munsell_value_ASTMD153508` + Tests :func:`colour.notation.munsell.munsell_value_ASTMD1535` definition nan support. """ - munsell_value_ASTMD153508( + munsell_value_ASTMD1535( np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])) @@ -1492,6 +1485,15 @@ def test_n_dimensional_xyY_to_munsell_specification(self): np.testing.assert_almost_equal( xyY_to_munsell_specification(xyY), specification, decimal=7) + def test_raise_exception_xyY_to_munsell_specification(self): + """ + Tests :func:`colour.notation.munsell.xyY_to_munsell_specification` + definition raised exception. + """ + + self.assertRaises(RuntimeError, xyY_to_munsell_specification, + np.array([0.90615118, 0.57945103, 0.91984064])) + def test_domain_range_scale_xyY_to_munsell_specification(self): """ Tests :func:`colour.notation.munsell.xyY_to_munsell_specification` @@ -1593,6 +1595,14 @@ def test_parse_munsell_colour(self): np.array([4.2, 8.1, 5.3, 6]), decimal=7) + def test_raise_exception_parse_munsell_colour(self): + """ + Tests :func:`colour.notation.munsell.is_grey_munsell_colour` + definition raised exception. + """ + + self.assertRaises(ValueError, parse_munsell_colour, '4.2YQ 8.1/5.3') + class TestIsGreyMunsellColour(unittest.TestCase): """ @@ -1701,7 +1711,7 @@ def test_munsell_specification_to_munsell_colour(self): self.assertEqual( munsell_specification_to_munsell_colour( - np.array([10, 2.0, 4.0, 7])), '10.0R 2.0/4.0') + np.array([10.0, 2.0, 4.0, 7])), '10.0R 2.0/4.0') self.assertEqual( munsell_specification_to_munsell_colour( @@ -1715,6 +1725,14 @@ def test_munsell_specification_to_munsell_colour(self): munsell_specification_to_munsell_colour( np.array([np.nan, 5.2, np.nan, np.nan])), 'N5.2') + self.assertEqual( + munsell_specification_to_munsell_colour( + np.array([0.0, 2.0, 4.0, 7])), '10.0RP 2.0/4.0') + + self.assertEqual( + munsell_specification_to_munsell_colour( + np.array([10.0, 0.0, 4.0, 7])), 'N0.0') + class Test_xyY_fromRenotation(unittest.TestCase): """ @@ -1844,6 +1862,14 @@ def test_interpolation_method_from_renotation_ovoid(self): interpolation_method_from_renotation_ovoid(specification), MUNSELL_INTERPOLATION_METHODS[i]) + self.assertIsNone( + interpolation_method_from_renotation_ovoid( + np.array([np.nan, 5.2, np.nan, np.nan]))) + + self.assertIsNone( + interpolation_method_from_renotation_ovoid( + np.array([2.5, 10.0, 2.0, 4]))) + class Test_xy_fromRenotationOvoid(unittest.TestCase): """ @@ -1895,6 +1921,18 @@ def test_LCHab_to_munsell_specification(self): np.array([6.792550536111119, 10.0, 14.810433961999999, 10]), decimal=7) + np.testing.assert_almost_equal( + LCHab_to_munsell_specification( + np.array([100.00000000, 21.57210357, 0.00000000])), + np.array([10.000000000000000, 10.0, 4.314420714000000, 8]), + decimal=7) + + np.testing.assert_almost_equal( + LCHab_to_munsell_specification( + np.array([100.00000000, 21.57210357, 36.00000000])), + np.array([10.000000000000000, 10.0, 4.314420714000000, 7]), + decimal=7) + class TestMaximumChromaFromRenotation(unittest.TestCase): """ diff --git a/colour/plotting/__init__.py b/colour/plotting/__init__.py index 071734137f..035f26fb67 100644 --- a/colour/plotting/__init__.py +++ b/colour/plotting/__init__.py @@ -4,14 +4,14 @@ import sys -from colour.utilities.deprecation import ModuleAPI, Renamed +from colour.utilities.deprecation import ModuleAPI, build_API_changes from colour.utilities.documentation import is_documentation_building -from .dataset import * # noqa -from . import dataset +from .datasets import * # noqa +from . import datasets from .common import (COLOUR_STYLE_CONSTANTS, COLOUR_ARROW_STYLE, colour_style, override_style, XYZ_to_plotting_colourspace, ColourSwatch, - colour_cycle, artist, camera, render, wrap_label, + colour_cycle, artist, camera, render, wrap_title, label_rectangles, uniform_axes3d, filter_passthrough, filter_RGB_colourspaces, filter_cmfs, filter_illuminants, filter_colour_checkers, plot_single_colour_swatch, @@ -35,8 +35,10 @@ plot_sds_in_chromaticity_diagram_CIE1976UCS) from .corresponding import plot_corresponding_chromaticities_prediction from .geometry import quad, grid, cube +from .graph import plot_automatic_colour_conversion_graph from .models import ( - plot_pointer_gamut, plot_RGB_colourspaces_in_chromaticity_diagram_CIE1931, + common_colourspace_model_axis_reorder, plot_pointer_gamut, + plot_RGB_colourspaces_in_chromaticity_diagram_CIE1931, plot_RGB_colourspaces_in_chromaticity_diagram_CIE1960UCS, plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS, plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931, @@ -45,7 +47,7 @@ plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1931, plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1960UCS, plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS, - plot_single_cctf, plot_multi_cctfs) + plot_single_cctf, plot_multi_cctfs, plot_constant_hue_loci) from .notation import (plot_single_munsell_value_function, plot_multi_munsell_value_functions) from .phenomena import plot_single_sd_rayleigh_scattering, plot_the_blue_sky @@ -59,11 +61,11 @@ from .volume import plot_RGB_colourspaces_gamuts, plot_RGB_scatter __all__ = [] -__all__ += dataset.__all__ +__all__ += datasets.__all__ __all__ += [ 'COLOUR_STYLE_CONSTANTS', 'COLOUR_ARROW_STYLE', 'colour_style', 'override_style', 'XYZ_to_plotting_colourspace', 'ColourSwatch', - 'colour_cycle', 'artist', 'camera', 'render', 'wrap_label', + 'colour_cycle', 'artist', 'camera', 'render', 'wrap_title', 'label_rectangles', 'uniform_axes3d', 'filter_passthrough', 'filter_RGB_colourspaces', 'filter_cmfs', 'filter_illuminants', 'filter_colour_checkers', 'plot_single_colour_swatch', @@ -89,9 +91,10 @@ 'plot_sds_in_chromaticity_diagram_CIE1976UCS' ] __all__ += ['plot_corresponding_chromaticities_prediction'] +__all__ += ['plot_automatic_colour_conversion_graph'] __all__ += ['quad', 'grid', 'cube'] __all__ += [ - 'plot_pointer_gamut', + 'common_colourspace_model_axis_reorder', 'plot_pointer_gamut', 'plot_RGB_colourspaces_in_chromaticity_diagram_CIE1931', 'plot_RGB_colourspaces_in_chromaticity_diagram_CIE1960UCS', 'plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS', @@ -101,7 +104,7 @@ 'plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1931', 'plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1960UCS', 'plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS', - 'plot_single_cctf', 'plot_multi_cctfs' + 'plot_single_cctf', 'plot_multi_cctfs', 'plot_constant_hue_loci' ] __all__ += [ 'plot_single_munsell_value_function', 'plot_multi_munsell_value_functions' @@ -130,7 +133,7 @@ def __getattr__(self, attribute): # v0.3.11 API_CHANGES = { - 'Renamed': [ + 'ObjectRenamed': [ [ 'colour.plotting.CIE_1931_chromaticity_diagram_plot', 'colour.plotting.plot_chromaticity_diagram_CIE1931', @@ -196,7 +199,7 @@ def __getattr__(self, attribute): """ # v0.3.12 -API_CHANGES['Renamed'] = API_CHANGES['Renamed'] + [ +API_CHANGES['ObjectRenamed'] = API_CHANGES['ObjectRenamed'] + [ [ 'colour.plotting.RGB_chromaticity_coordinates_chromaticity_diagram_plot', # noqa 'colour.plotting.plot_RGB_chromaticities_in_chromaticity_diagram', @@ -431,29 +434,24 @@ def __getattr__(self, attribute): ], ] - -def _setup_api_changes(): - """ - Setups *Colour* API changes. - """ - - global API_CHANGES - - for renamed in API_CHANGES['Renamed']: - name, access = renamed - API_CHANGES[name.split('.')[-1]] = Renamed(name, access) # noqa - API_CHANGES.pop('Renamed') - +# v0.3.14 +API_CHANGES['ObjectRenamed'] = API_CHANGES['ObjectRenamed'] + [ + [ + 'colour.plotting.ASTM_G_173_DIRECT_CIRCUMSOLAR', + 'colour.plotting.ASTMG173_DIRECT_CIRCUMSOLAR', + ], + [ + 'colour.plotting.ASTM_G_173_ETR', + 'colour.plotting.ASTMG173_ETR', + ], + [ + 'colour.plotting.ASTM_G_173_GLOBAL_TILT', + 'colour.plotting.ASTMG173_GLOBAL_TILT', + ], +] if not is_documentation_building(): - _setup_api_changes() - - del ModuleAPI - del Renamed - del is_documentation_building - del _setup_api_changes - sys.modules['colour.plotting'] = plotting(sys.modules['colour.plotting'], - API_CHANGES) + build_API_changes(API_CHANGES)) - del sys + del ModuleAPI, is_documentation_building, build_API_changes, sys diff --git a/colour/plotting/blindness.py b/colour/plotting/blindness.py index 498dfb0929..94ffca05d6 100644 --- a/colour/plotting/blindness.py +++ b/colour/plotting/blindness.py @@ -67,7 +67,9 @@ def plot_cvd_simulation_Machado2009(RGB, -------- >>> import numpy as np >>> RGB = np.random.rand(32, 32, 3) - >>> plot_cvd_simulation_Machado2009(RGB) # doctest: +SKIP + >>> plot_cvd_simulation_Machado2009(RGB) # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_CVD_Simulation_Machado2009.png :align: center @@ -83,5 +85,5 @@ def plot_cvd_simulation_Machado2009(RGB, settings.update(kwargs) return plot_image( - COLOUR_STYLE_CONSTANTS.colour.colourspace.encoding_cctf( + COLOUR_STYLE_CONSTANTS.colour.colourspace.cctf_encoding( dot_vector(M_a, RGB)), **settings) diff --git a/colour/plotting/characterisation.py b/colour/plotting/characterisation.py index e30c2ea94a..621c7d6448 100644 --- a/colour/plotting/characterisation.py +++ b/colour/plotting/characterisation.py @@ -28,7 +28,14 @@ __all__ = ['plot_single_colour_checker', 'plot_multi_colour_checkers'] -@override_style() +@override_style( + **{ + 'axes.grid': False, + 'xtick.bottom': False, + 'ytick.left': False, + 'xtick.labelbottom': False, + 'ytick.labelleft': False, + }) def plot_single_colour_checker(colour_checker='ColorChecker 2005', **kwargs): """ Plots given colour checker. @@ -53,7 +60,9 @@ def plot_single_colour_checker(colour_checker='ColorChecker 2005', **kwargs): Examples -------- - >>> plot_single_colour_checker('ColorChecker 2005') # doctest: +SKIP + >>> plot_single_colour_checker('ColorChecker 2005') # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Single_Colour_Checker.png :align: center @@ -96,7 +105,9 @@ def plot_multi_colour_checkers(colour_checkers=None, **kwargs): Examples -------- >>> plot_multi_colour_checkers(['ColorChecker 1976', 'ColorChecker 2005']) - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Multi_Colour_Checkers.png :align: center diff --git a/colour/plotting/colorimetry.py b/colour/plotting/colorimetry.py index 3844873aec..fe02eb450a 100644 --- a/colour/plotting/colorimetry.py +++ b/colour/plotting/colorimetry.py @@ -35,7 +35,7 @@ from colour.algebra import LinearInterpolator from colour.colorimetry import ( ILLUMINANTS, ILLUMINANTS_SDS, LIGHTNESS_METHODS, LUMINANCE_METHODS, - MultiSpectralDistribution, SpectralShape, sd_blackbody, sd_ones, sd_to_XYZ, + SpectralShape, sd_blackbody, sd_ones, sd_to_XYZ, sds_and_multi_sds_to_sds, wavelength_to_XYZ) from colour.plotting import ( ColourSwatch, COLOUR_STYLE_CONSTANTS, XYZ_to_plotting_colourspace, artist, @@ -118,7 +118,9 @@ def plot_single_sd(sd, ... 600: 0.1360 ... } >>> sd = SpectralDistribution(data, name='Custom') - >>> plot_single_sd(sd) # doctest: +SKIP + >>> plot_single_sd(sd) # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Single_SD.png :align: center @@ -140,7 +142,7 @@ def plot_single_sd(sd, colours = XYZ_to_plotting_colourspace( wavelength_to_XYZ(wavelengths, cmfs), ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['E'], - apply_encoding_cctf=False) + apply_cctf_encoding=False) if not out_of_gamut_clipping: colours += np.abs(np.min(colours)) @@ -150,7 +152,7 @@ def plot_single_sd(sd, if modulate_colours_with_sd_amplitude: colours *= (values / np.max(values))[..., np.newaxis] - colours = COLOUR_STYLE_CONSTANTS.colour.colourspace.encoding_cctf(colours) + colours = COLOUR_STYLE_CONSTANTS.colour.colourspace.cctf_encoding(colours) if equalize_sd_amplitude: values = np.ones(values.shape) @@ -204,11 +206,11 @@ def plot_multi_sds(sds, Parameters ---------- - sds : array_like or MultiSpectralDistribution + sds : array_like or MultiSpectralDistributions Spectral distributions or multi-spectral distributions to plot. `sds` can be a single - :class:`colour.MultiSpectralDistribution` class instance, a list - of :class:`colour.MultiSpectralDistribution` class instances or a + :class:`colour.MultiSpectralDistributions` class instance, a list + of :class:`colour.MultiSpectralDistributions` class instances or a list of :class:`colour.SpectralDistribution` class instances. cmfs : unicode, optional Standard observer colour matching functions used for spectrum creation. @@ -249,26 +251,20 @@ def plot_multi_sds(sds, ... 550: 0.994950, ... 560: 0.995000 ... } - >>> spd1 = SpectralDistribution(data_1, name='Custom 1') - >>> spd2 = SpectralDistribution(data_2, name='Custom 2') - >>> plot_multi_sds([spd1, spd2]) # doctest: +SKIP + >>> sd_1 = SpectralDistribution(data_1, name='Custom 1') + >>> sd_2 = SpectralDistribution(data_2, name='Custom 2') + >>> plot_multi_sds([sd_1, sd_2]) # doctest: +ELLIPSIS + (
, \ +) - .. image:: ../_static/Plotting_Plot_Multi_SDs.png + .. image:: ../_static/Plotting_Plot_Multi_SDS.png :align: center :alt: plot_multi_sds """ _figure, axes = artist(**kwargs) - if isinstance(sds, MultiSpectralDistribution): - sds = sds.to_sds() - else: - sds = list(sds) - for i, sd in enumerate(sds[:]): - if isinstance(sd, MultiSpectralDistribution): - sds.remove(sd) - sds[i:i] = sd.to_sds() - + sds = sds_and_multi_sds_to_sds(sds) cmfs = first_item(filter_cmfs(cmfs).values()) illuminant = ILLUMINANTS_SDS[ @@ -337,7 +333,9 @@ def plot_single_cmfs(cmfs='CIE 1931 2 Degree Standard Observer', **kwargs): Examples -------- >>> plot_single_cmfs('CIE 1931 2 Degree Standard Observer') - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Single_CMFS.png :align: center @@ -378,7 +376,9 @@ def plot_multi_cmfs(cmfs=None, **kwargs): -------- >>> cmfs = ('CIE 1931 2 Degree Standard Observer', ... 'CIE 1964 10 Degree Standard Observer') - >>> plot_multi_cmfs(cmfs) # doctest: +SKIP + >>> plot_multi_cmfs(cmfs) # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Multi_CMFS.png :align: center @@ -471,7 +471,9 @@ def plot_single_illuminant_sd(illuminant='A', Examples -------- - >>> plot_single_illuminant_sd('A') # doctest: +SKIP + >>> plot_single_illuminant_sd('A') # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Single_Illuminant_SD.png :align: center @@ -520,9 +522,11 @@ def plot_multi_illuminant_sds(illuminants=None, **kwargs): Examples -------- - >>> plot_multi_illuminant_sds(['A', 'B', 'C']) # doctest: +SKIP + >>> plot_multi_illuminant_sds(['A', 'B', 'C']) # doctest: +ELLIPSIS + (
, \ +) - .. image:: ../_static/Plotting_Plot_Multi_Illuminant_SDs.png + .. image:: ../_static/Plotting_Plot_Multi_Illuminant_SDS.png :align: center :alt: plot_multi_illuminant_sds """ @@ -580,7 +584,9 @@ def plot_visible_spectrum(cmfs='CIE 1931 2 Degree Standard Observer', Examples -------- - >>> plot_visible_spectrum() # doctest: +SKIP + >>> plot_visible_spectrum() # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Visible_Spectrum.png :align: center @@ -640,7 +646,9 @@ def plot_single_lightness_function(function='CIE 1976', **kwargs): Examples -------- - >>> plot_single_lightness_function('CIE 1976') # doctest: +SKIP + >>> plot_single_lightness_function('CIE 1976') # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Single_Lightness_Function.png :align: center @@ -679,7 +687,9 @@ def plot_multi_lightness_functions(functions=None, **kwargs): Examples -------- >>> plot_multi_lightness_functions(['CIE 1976', 'Wyszecki 1963']) - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Multi_Lightness_Functions.png :align: center @@ -729,7 +739,9 @@ def plot_single_luminance_function(function='CIE 1976', **kwargs): Examples -------- - >>> plot_single_luminance_function('CIE 1976') # doctest: +SKIP + >>> plot_single_luminance_function('CIE 1976') # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Single_Luminance_Function.png :align: center @@ -768,7 +780,9 @@ def plot_multi_luminance_functions(functions=None, **kwargs): Examples -------- >>> plot_multi_luminance_functions(['CIE 1976', 'Newhall 1943']) - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Multi_Luminance_Functions.png :align: center @@ -827,7 +841,9 @@ def plot_blackbody_spectral_radiance( Examples -------- >>> plot_blackbody_spectral_radiance(3500, blackbody='VY Canis Major') - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Blackbody_Spectral_Radiance.png :align: center @@ -912,7 +928,10 @@ def plot_blackbody_colours( Examples -------- - >>> plot_blackbody_colours(SpectralShape(150, 12500, 50)) # doctest: +SKIP + >>> plot_blackbody_colours(SpectralShape(150, 12500, 50)) + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Blackbody_Colours.png :align: center diff --git a/colour/plotting/common.py b/colour/plotting/common.py index b0acf24ff7..a47cceacf8 100644 --- a/colour/plotting/common.py +++ b/colour/plotting/common.py @@ -55,7 +55,7 @@ __all__ = [ 'COLOUR_STYLE_CONSTANTS', 'COLOUR_ARROW_STYLE', 'colour_style', 'override_style', 'XYZ_to_plotting_colourspace', 'ColourSwatch', - 'colour_cycle', 'artist', 'camera', 'render', 'wrap_label', + 'colour_cycle', 'artist', 'camera', 'render', 'wrap_title', 'label_rectangles', 'uniform_axes3d', 'filter_passthrough', 'filter_RGB_colourspaces', 'filter_cmfs', 'filter_illuminants', 'filter_colour_checkers', 'plot_single_colour_swatch', @@ -305,7 +305,7 @@ def wrapped(*args, **kwargs): def XYZ_to_plotting_colourspace(XYZ, illuminant=RGB_COLOURSPACES['sRGB'].whitepoint, chromatic_adaptation_transform='CAT02', - apply_encoding_cctf=True): + apply_cctf_encoding=True): """ Converts from *CIE XYZ* tristimulus values to :attr:`colour.plotting.DEFAULT_PLOTTING_COLOURSPACE` colourspace. @@ -321,7 +321,7 @@ def XYZ_to_plotting_colourspace(XYZ, 'Fairchild', 'CMCCAT97', 'CMCCAT2000', 'CAT02_BRILL_CAT', 'Bianco', 'Bianco PC'}**, *Chromatic adaptation* transform. - apply_encoding_cctf : bool, optional + apply_cctf_encoding : bool, optional Apply :attr:`colour.plotting.DEFAULT_PLOTTING_COLOURSPACE` colourspace encoding colour component transfer function / opto-electronic transfer function. @@ -344,8 +344,8 @@ def XYZ_to_plotting_colourspace(XYZ, XYZ, illuminant, COLOUR_STYLE_CONSTANTS.colour.colourspace.whitepoint, COLOUR_STYLE_CONSTANTS.colour.colourspace.XYZ_to_RGB_matrix, chromatic_adaptation_transform, - COLOUR_STYLE_CONSTANTS.colour.colourspace.encoding_cctf - if apply_encoding_cctf else None) + COLOUR_STYLE_CONSTANTS.colour.colourspace.cctf_encoding + if apply_cctf_encoding else None) class ColourSwatch(namedtuple('ColourSwatch', ('name', 'RGB'))): @@ -416,7 +416,7 @@ def artist(**kwargs): Returns ------- tuple - Figure, axes. + Current figure and axes. """ width, height = plt.rcParams['figure.figsize'] @@ -438,6 +438,10 @@ def camera(**kwargs): Other Parameters ---------------- + figure : Figure, optional + Figure to apply the render elements onto. + axes : Axes, optional + Axes to apply the render elements onto. azimuth : numeric, optional Camera azimuth. camera_aspect : unicode, optional @@ -447,10 +451,11 @@ def camera(**kwargs): Returns ------- - Axes - Current axes. + tuple + Current figure and axes. """ + figure = kwargs.get('figure', plt.gcf()) axes = kwargs.get('axes', plt.gca()) settings = Structure(**{ @@ -461,11 +466,11 @@ def camera(**kwargs): settings.update(kwargs) if settings.camera_aspect == 'equal': - uniform_axes3d(axes) + uniform_axes3d(axes=axes) axes.view_init(elev=settings.elevation, azim=settings.azimuth) - return axes + return figure, axes def render(**kwargs): @@ -518,13 +523,8 @@ def render(**kwargs): Current figure and axes. """ - figure = kwargs.get('figure') - if figure is None: - figure = plt.gcf() - - axes = kwargs.get('axes') - if axes is None: - axes = plt.gca() + figure = kwargs.get('figure', plt.gcf()) + axes = kwargs.get('axes', plt.gca()) settings = Structure( **{ @@ -557,7 +557,7 @@ def render(**kwargs): if settings.title: title = settings.title if settings.wrap_title: - title = wrap_label(settings.title, + title = wrap_title(settings.title, int(plt.rcParams['figure.figsize'][0] * 10)) axes.set_title(title) if settings.x_label: @@ -585,28 +585,28 @@ def render(**kwargs): return figure, axes -def wrap_label(label, wrap_length=60): +def wrap_title(title, wrap_length=60): """ - Wraps given label at given length. + Wraps given tile at given length. The intent of this definition is to wrap long titles so that they don't overflow the figure. Parameters ---------- - label : unicode - Label to wrap. + title : unicode + Title to wrap. wrap_length : int, optional Length at which wrapping should occur. Returns ------- unicode - Wrapped label. + Wrapped title. Examples -------- - >>> wrap_label( # doctest: +SKIP + >>> wrap_title( # doctest: +SKIP ... 'This is a very long figure title that would overflow the figure ' ... 'container if it was not wrapped.') 'This is a very long figure title that would overflow the figure \ @@ -614,9 +614,9 @@ def wrap_label(label, wrap_length=60): """ if wrap_length is not None: - return '\n'.join(textwrap.wrap(label, wrap_length)) + return '\n'.join(textwrap.wrap(title, wrap_length)) else: - return label + return title def label_rectangles(labels, @@ -644,18 +644,19 @@ def label_rectangles(labels, Other Parameters ---------------- + figure : Figure, optional + Figure to apply the render elements onto. axes : Axes, optional - Axes to use for plotting. + Axes to apply the render elements onto. Returns ------- - bool - Definition success. + tuple + Current figure and axes. """ - axes = kwargs.get('axes') - if axes is None: - axes = plt.gca() + figure = kwargs.get('figure', plt.gcf()) + axes = kwargs.get('axes', plt.gca()) if offset is None: offset = (0.0, 0.025) @@ -674,31 +675,36 @@ def label_rectangles(labels, axes.text( x + width / 2 + offset[0] * width, height + offset[1] * y_m, - '{0:.1f}'.format(labels[i]), + labels[i], ha=ha, va=va, rotation=rotation, fontsize=text_size, clip_on=True) - return True + return figure, axes -def uniform_axes3d(axes): +def uniform_axes3d(**kwargs): """ Sets equal aspect ratio to given 3d axes. - Parameters - ---------- - axes : object - Axis to set the equal aspect ratio. + Other Parameters + ---------------- + figure : Figure, optional + Figure to apply the render elements onto. + axes : Axes, optional + Axes to apply the render elements onto. Returns ------- - bool - Definition success. + tuple + Current figure and axes. """ + figure = kwargs.get('figure', plt.gcf()) + axes = kwargs.get('axes', plt.gca()) + axes.set_aspect('equal') extents = np.array( @@ -711,7 +717,7 @@ def uniform_axes3d(axes): getattr(axes, 'set_{}lim'.format(axis))(center - extent / 2, center + extent / 2) - return True + return figure, axes def filter_passthrough(mapping, @@ -813,6 +819,7 @@ class instances whose type is one of the mapping element types. flags) for filterer in object_filterers: + # TODO: Consider using "MutableMapping" here. if isinstance(filterer, (dict, OrderedDict, CaseInsensitiveMapping)): for key, value in filterer.items(): filtered_mapping[key] = value @@ -1015,7 +1022,9 @@ def plot_single_colour_swatch(colour_swatch, **kwargs): Examples -------- >>> RGB = ColourSwatch(RGB=(0.45620519, 0.03081071, 0.04091952)) - >>> plot_single_colour_swatch(RGB) # doctest: +SKIP + >>> plot_single_colour_swatch(RGB) # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Single_Colour_Swatch.png :align: center @@ -1060,7 +1069,7 @@ def plot_multi_colour_swatches(colour_swatches, half of it if comparing. text_parameters : dict, optional Parameters for the :func:`plt.text` definition, ``visible`` can be - set to make the text visible,``offset`` can be set to define the text + set to make the text visible, ``offset`` can be set to define the text offset. background_colour : array_like or unicode, optional Background colour. @@ -1088,7 +1097,9 @@ def plot_multi_colour_swatches(colour_swatches, -------- >>> RGB_1 = ColourSwatch(RGB=(0.45293517, 0.31732158, 0.26414773)) >>> RGB_2 = ColourSwatch(RGB=(0.77875824, 0.57726450, 0.50453169)) - >>> plot_multi_colour_swatches([RGB_1, RGB_2]) # doctest: +SKIP + >>> plot_multi_colour_swatches([RGB_1, RGB_2]) # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Multi_Colour_Swatches.png :align: center @@ -1220,8 +1231,11 @@ def plot_single_function(function, Examples -------- + >>> from colour.models import gamma_function >>> plot_single_function(partial(gamma_function, exponent=1 / 2.2)) - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Single_Function.png :align: center @@ -1285,7 +1299,9 @@ def plot_multi_functions(functions, ... 'Gamma 2.6' : lambda x: x ** (1 / 2.6), ... } >>> plot_multi_functions(functions) - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Multi_Functions.png :align: center @@ -1301,17 +1317,17 @@ def plot_multi_functions(functions, assert log_x >= 2 and log_y >= 2, ( 'Log base must be equal or greater than 2.') - plotting_function = partial(plt.loglog, basex=log_x, basey=log_y) + plotting_function = partial(axes.loglog, basex=log_x, basey=log_y) elif log_x is not None: assert log_x >= 2, 'Log base must be equal or greater than 2.' - plotting_function = partial(plt.semilogx, basex=log_x) + plotting_function = partial(axes.semilogx, basex=log_x) elif log_y is not None: assert log_y >= 2, 'Log base must be equal or greater than 2.' - plotting_function = partial(plt.semilogy, basey=log_y) + plotting_function = partial(axes.semilogy, basey=log_y) else: - plotting_function = plt.plot + plotting_function = axes.plot if samples is None: samples = np.linspace(0, 1, 1000) @@ -1377,7 +1393,9 @@ def plot_image(image, >>> from colour import read_image >>> path = os.path.join( ... colour.__path__[0], '..', 'docs', '_static', 'Logo_Medium_001.png') - >>> plot_image(read_image(path)) # doctest: +SKIP + >>> plot_image(read_image(path)) # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Image.png :align: center diff --git a/colour/plotting/corresponding.py b/colour/plotting/corresponding.py index 6778ab7dfb..d8a709c892 100644 --- a/colour/plotting/corresponding.py +++ b/colour/plotting/corresponding.py @@ -14,6 +14,7 @@ from colour.plotting import (COLOUR_STYLE_CONSTANTS, artist, plot_chromaticity_diagram_CIE1976UCS, override_style, render) +from colour.utilities import is_numeric __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -36,8 +37,10 @@ def plot_corresponding_chromaticities_prediction(experiment=1, Parameters ---------- - experiment : int, optional - Corresponding chromaticities prediction experiment number. + experiment : integer or CorrespondingColourDataset, optional + {1, 2, 3, 4, 6, 8, 9, 11, 12} + *Breneman (1987)* experiment number or + :class:`colour.CorrespondingColourDataset` class instance. model : unicode, optional Corresponding chromaticities prediction model name. transform : unicode, optional @@ -59,7 +62,9 @@ def plot_corresponding_chromaticities_prediction(experiment=1, Examples -------- >>> plot_corresponding_chromaticities_prediction(1, 'Von Kries', 'CAT02') - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_\ Plot_Corresponding_Chromaticities_Prediction.png @@ -72,13 +77,14 @@ def plot_corresponding_chromaticities_prediction(experiment=1, _figure, axes = artist(**settings) - title = (('Corresponding Chromaticities Prediction\n{0} ({1}) - ' - 'Experiment {2}\nCIE 1976 UCS Chromaticity Diagram').format( - model, transform, experiment) + name = ('Experiment {0}'.format(experiment) + if is_numeric(experiment) else experiment.name) + title = (('Corresponding Chromaticities Prediction - {0} ({1}) - {2} - ' + 'CIE 1976 UCS Chromaticity Diagram').format( + model, transform, name) if model.lower() in ('von kries', 'vonkries') else - ('Corresponding Chromaticities Prediction\n{0} - ' - 'Experiment {1}\nCIE 1976 UCS Chromaticity Diagram').format( - model, experiment)) + ('Corresponding Chromaticities Prediction - {0} - {1} - ' + 'CIE 1976 UCS Chromaticity Diagram').format(model, name)) settings = {'axes': axes, 'title': title} settings.update(kwargs) @@ -90,18 +96,18 @@ def plot_corresponding_chromaticities_prediction(experiment=1, experiment, transform=transform) for result in results: - _name, uvp_t, uvp_m, uvp_p = result + _name, uv_t, uv_m, uv_p = result axes.arrow( - uvp_t[0], - uvp_t[1], - uvp_p[0] - uvp_t[0] - 0.1 * (uvp_p[0] - uvp_t[0]), - uvp_p[1] - uvp_t[1] - 0.1 * (uvp_p[1] - uvp_t[1]), + uv_t[0], + uv_t[1], + uv_p[0] - uv_t[0] - 0.1 * (uv_p[0] - uv_t[0]), + uv_p[1] - uv_t[1] - 0.1 * (uv_p[1] - uv_t[1]), color=COLOUR_STYLE_CONSTANTS.colour.dark, head_width=0.005, head_length=0.005) axes.plot( - uvp_t[0], - uvp_t[1], + uv_t[0], + uv_t[1], 'o', color=COLOUR_STYLE_CONSTANTS.colour.brightest, markeredgecolor=COLOUR_STYLE_CONSTANTS.colour.dark, @@ -109,8 +115,8 @@ def plot_corresponding_chromaticities_prediction(experiment=1, COLOUR_STYLE_CONSTANTS.geometry.short * 0.75), markeredgewidth=COLOUR_STYLE_CONSTANTS.geometry.short * 0.75) axes.plot( - uvp_m[0], - uvp_m[1], + uv_m[0], + uv_m[1], '^', color=COLOUR_STYLE_CONSTANTS.colour.brightest, markeredgecolor=COLOUR_STYLE_CONSTANTS.colour.dark, @@ -118,7 +124,7 @@ def plot_corresponding_chromaticities_prediction(experiment=1, COLOUR_STYLE_CONSTANTS.geometry.short * 0.75), markeredgewidth=COLOUR_STYLE_CONSTANTS.geometry.short * 0.75) axes.plot( - uvp_p[0], uvp_p[1], '^', color=COLOUR_STYLE_CONSTANTS.colour.dark) + uv_p[0], uv_p[1], '^', color=COLOUR_STYLE_CONSTANTS.colour.dark) settings.update({ 'standalone': True, diff --git a/colour/plotting/dataset/__init__.py b/colour/plotting/dataset/__init__.py deleted file mode 100644 index 0668f1975a..0000000000 --- a/colour/plotting/dataset/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- - -from __future__ import absolute_import - -from .astm_g_173 import (ASTM_G_173_ETR, ASTM_G_173_GLOBAL_TILT, - ASTM_G_173_DIRECT_CIRCUMSOLAR) - -__all__ = [ - 'ASTM_G_173_ETR', 'ASTM_G_173_GLOBAL_TILT', 'ASTM_G_173_DIRECT_CIRCUMSOLAR' -] diff --git a/colour/plotting/datasets/__init__.py b/colour/plotting/datasets/__init__.py new file mode 100644 index 0000000000..400773cce2 --- /dev/null +++ b/colour/plotting/datasets/__init__.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- + +from __future__ import absolute_import + +from .astm_g_173 import (ASTMG173_ETR, ASTMG173_GLOBAL_TILT, + ASTMG173_DIRECT_CIRCUMSOLAR) + +__all__ = [ + 'ASTMG173_ETR', 'ASTMG173_GLOBAL_TILT', 'ASTMG173_DIRECT_CIRCUMSOLAR' +] diff --git a/colour/plotting/dataset/astm_g_173.py b/colour/plotting/datasets/astm_g_173.py similarity index 99% rename from colour/plotting/dataset/astm_g_173.py rename to colour/plotting/datasets/astm_g_173.py index f57d7e5ba5..6fee0ecc76 100644 --- a/colour/plotting/dataset/astm_g_173.py +++ b/colour/plotting/datasets/astm_g_173.py @@ -27,13 +27,13 @@ __status__ = 'Production' __all__ = [ - 'ASTM_G_173_ETR_DATA', 'ASTM_G_173_GLOBAL_TILT_DATA', - 'ASTM_G_173_DIRECT_CIRCUMSOLAR_DATA', 'ASTM_G_173_ETR', - 'ASTM_G_173_GLOBAL_TILT', 'ASTM_G_173_DIRECT_CIRCUMSOLAR' + 'ASTMG173_ETR_DATA', 'ASTMG173_GLOBAL_TILT_DATA', + 'ASTMG173_DIRECT_CIRCUMSOLAR_DATA', 'ASTMG173_ETR', 'ASTMG173_GLOBAL_TILT', + 'ASTMG173_DIRECT_CIRCUMSOLAR' ] # yapf: disable -ASTM_G_173_ETR_DATA = { +ASTMG173_ETR_DATA = { 280.0: 8.2000e-02, 280.5: 9.9000e-02, 281.0: 1.5000e-01, @@ -2038,7 +2038,7 @@ 4000.0: 8.6800e-03, } -ASTM_G_173_GLOBAL_TILT_DATA = { +ASTMG173_GLOBAL_TILT_DATA = { 280.0: 4.7309e-23, 280.5: 1.2307e-21, 281.0: 5.6895e-21, @@ -4043,7 +4043,7 @@ 4000.0: 7.1043e-03, } -ASTM_G_173_DIRECT_CIRCUMSOLAR_DATA = { +ASTMG173_DIRECT_CIRCUMSOLAR_DATA = { 280.0: 2.5361e-26, 280.5: 1.0917e-24, 281.0: 6.1253e-24, @@ -6049,10 +6049,8 @@ } # yapf: enable -ASTM_G_173_ETR = SpectralDistribution( - ASTM_G_173_ETR_DATA, - name='ASTM G-173 ETR', - interpolator=LinearInterpolator) +ASTMG173_ETR = SpectralDistribution( + ASTMG173_ETR_DATA, name='ASTM G-173 ETR', interpolator=LinearInterpolator) """ Extraterrestrial Radiation (solar spectrum at top of atmosphere) at mean Earth-Sun distance. @@ -6061,11 +6059,11 @@ ---------- :cite:`RenewableResourceDataCenter2003a` -ASTM_G_173_ETR : SpectralDistribution +ASTMG173_ETR : SpectralDistribution """ -ASTM_G_173_GLOBAL_TILT = SpectralDistribution( - ASTM_G_173_GLOBAL_TILT_DATA, +ASTMG173_GLOBAL_TILT = SpectralDistribution( + ASTMG173_GLOBAL_TILT_DATA, name='ASTM G-173 Global Tilt', interpolator=LinearInterpolator) """ @@ -6076,11 +6074,11 @@ ---------- :cite:`RenewableResourceDataCenter2003a` -ASTM_G_173_GLOBAL_TILT : SpectralDistribution +ASTMG173_GLOBAL_TILT : SpectralDistribution """ -ASTM_G_173_DIRECT_CIRCUMSOLAR = SpectralDistribution( - ASTM_G_173_DIRECT_CIRCUMSOLAR_DATA, +ASTMG173_DIRECT_CIRCUMSOLAR = SpectralDistribution( + ASTMG173_DIRECT_CIRCUMSOLAR_DATA, name='ASTM G-173 Direct + Circumsolar', interpolator=LinearInterpolator) """ @@ -6095,5 +6093,5 @@ ---------- :cite:`RenewableResourceDataCenter2003a` -ASTM_G_173_DIRECT_CIRCUMSOLAR : SpectralDistribution +ASTMG173_DIRECT_CIRCUMSOLAR : SpectralDistribution """ diff --git a/colour/plotting/diagrams.py b/colour/plotting/diagrams.py index 1ebe5763fe..5fec731a2f 100644 --- a/colour/plotting/diagrams.py +++ b/colour/plotting/diagrams.py @@ -21,15 +21,14 @@ from matplotlib.patches import Polygon from colour.algebra import normalise_vector -from colour.colorimetry import sd_to_XYZ -from colour.constants import EPSILON +from colour.colorimetry import sd_to_XYZ, sds_and_multi_sds_to_sds from colour.models import (Luv_to_uv, Luv_uv_to_xy, UCS_to_uv, UCS_uv_to_xy, XYZ_to_Luv, XYZ_to_UCS, XYZ_to_xy, xy_to_XYZ) from colour.plotting import (COLOUR_STYLE_CONSTANTS, COLOUR_ARROW_STYLE, XYZ_to_plotting_colourspace, artist, filter_cmfs, override_style, render) from colour.utilities import (domain_range_scale, first_item, is_string, - normalise_maximum, tstack) + normalise_maximum, tstack, suppress_warnings) __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -88,7 +87,9 @@ def plot_spectral_locus(cmfs='CIE 1931 2 Degree Standard Observer', Examples -------- - >>> plot_spectral_locus(spectral_locus_colours='RGB') # doctest: +SKIP + >>> plot_spectral_locus(spectral_locus_colours='RGB') # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Spectral_Locus.png :align: center @@ -244,7 +245,9 @@ def plot_chromaticity_diagram_colours( Examples -------- - >>> plot_chromaticity_diagram_colours() # doctest: +SKIP + >>> plot_chromaticity_diagram_colours() # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Chromaticity_Diagram_Colours.png :align: center @@ -265,24 +268,26 @@ def plot_chromaticity_diagram_colours( ii, jj = np.meshgrid( np.linspace(0, 1, samples), np.linspace(1, 0, samples)) ij = tstack([ii, jj]) - # Avoiding zero division in later colour transformations. - ij = np.where(ij == 0, EPSILON, ij) - if method == 'CIE 1931': - XYZ = xy_to_XYZ(ij) - spectral_locus = XYZ_to_xy(cmfs.values, illuminant) - elif method == 'CIE 1960 UCS': - XYZ = xy_to_XYZ(UCS_uv_to_xy(ij)) - spectral_locus = UCS_to_uv(XYZ_to_UCS(cmfs.values)) - elif method == 'CIE 1976 UCS': - XYZ = xy_to_XYZ(Luv_uv_to_xy(ij)) - spectral_locus = Luv_to_uv( - XYZ_to_Luv(cmfs.values, illuminant), illuminant) - else: - raise ValueError( - 'Invalid method: "{0}", must be one of ' - '{{\'CIE 1931\', \'CIE 1960 UCS\', \'CIE 1976 UCS\'}}'.format( - method)) + # NOTE: Various values in the grid have potential to generate + # zero-divisions, they could be avoided by perturbing the grid, e.g. adding + # a small epsilon. It was decided instead to disable warnings. + with suppress_warnings(python_warnings=True): + if method == 'CIE 1931': + XYZ = xy_to_XYZ(ij) + spectral_locus = XYZ_to_xy(cmfs.values, illuminant) + elif method == 'CIE 1960 UCS': + XYZ = xy_to_XYZ(UCS_uv_to_xy(ij)) + spectral_locus = UCS_to_uv(XYZ_to_UCS(cmfs.values)) + elif method == 'CIE 1976 UCS': + XYZ = xy_to_XYZ(Luv_uv_to_xy(ij)) + spectral_locus = Luv_to_uv( + XYZ_to_Luv(cmfs.values, illuminant), illuminant) + else: + raise ValueError( + 'Invalid method: "{0}", must be one of ' + '{{\'CIE 1931\', \'CIE 1960 UCS\', \'CIE 1976 UCS\'}}'.format( + method)) RGB = normalise_maximum( XYZ_to_plotting_colourspace(XYZ, illuminant), axis=-1) @@ -347,7 +352,9 @@ def plot_chromaticity_diagram(cmfs='CIE 1931 2 Degree Standard Observer', Examples -------- - >>> plot_chromaticity_diagram() # doctest: +SKIP + >>> plot_chromaticity_diagram() # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Chromaticity_Diagram.png :align: center @@ -438,7 +445,9 @@ def plot_chromaticity_diagram_CIE1931( Examples -------- - >>> plot_chromaticity_diagram_CIE1931() # doctest: +SKIP + >>> plot_chromaticity_diagram_CIE1931() # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Chromaticity_Diagram_CIE1931.png :align: center @@ -486,7 +495,9 @@ def plot_chromaticity_diagram_CIE1960UCS( Examples -------- - >>> plot_chromaticity_diagram_CIE1960UCS() # doctest: +SKIP + >>> plot_chromaticity_diagram_CIE1960UCS() # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Chromaticity_Diagram_CIE1960UCS.png :align: center @@ -534,7 +545,9 @@ def plot_chromaticity_diagram_CIE1976UCS( Examples -------- - >>> plot_chromaticity_diagram_CIE1976UCS() # doctest: +SKIP + >>> plot_chromaticity_diagram_CIE1976UCS() # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Chromaticity_Diagram_CIE1976UCS.png :align: center @@ -562,8 +575,12 @@ def plot_sds_in_chromaticity_diagram( Parameters ---------- - sds : array_like, optional - Spectral distributions to plot. + sds : array_like or MultiSpectralDistributions + Spectral distributions or multi-spectral distributions to + plot. `sds` can be a single + :class:`colour.MultiSpectralDistributions` class instance, a list + of :class:`colour.MultiSpectralDistributions` class instances or a + list of :class:`colour.SpectralDistribution` class instances. cmfs : unicode, optional Standard observer colour matching functions used for *Chromaticity Diagram* bounds. @@ -598,13 +615,17 @@ def plot_sds_in_chromaticity_diagram( >>> from colour import ILLUMINANTS_SDS >>> A = ILLUMINANTS_SDS['A'] >>> D65 = ILLUMINANTS_SDS['D65'] - >>> plot_sds_in_chromaticity_diagram([A, D65]) # doctest: +SKIP + >>> plot_sds_in_chromaticity_diagram([A, D65]) # doctest: +ELLIPSIS + (
, \ +) - .. image:: ../_static/Plotting_Plot_SDs_In_Chromaticity_Diagram.png + .. image:: ../_static/Plotting_Plot_SDS_In_Chromaticity_Diagram.png :align: center :alt: plot_sds_in_chromaticity_diagram """ + sds = sds_and_multi_sds_to_sds(sds) + settings = {'uniform': True} settings.update(kwargs) @@ -724,8 +745,12 @@ def plot_sds_in_chromaticity_diagram_CIE1931( Parameters ---------- - sds : array_like, optional - Spectral distributions to plot. + sds : array_like or MultiSpectralDistributions + Spectral distributions or multi-spectral distributions to + plot. `sds` can be a single + :class:`colour.MultiSpectralDistributions` class instance, a list + of :class:`colour.MultiSpectralDistributions` class instances or a + list of :class:`colour.SpectralDistribution` class instances. cmfs : unicode, optional Standard observer colour matching functions used for *Chromaticity Diagram* bounds. @@ -757,10 +782,13 @@ def plot_sds_in_chromaticity_diagram_CIE1931( >>> from colour import ILLUMINANTS_SDS >>> A = ILLUMINANTS_SDS['A'] >>> D65 = ILLUMINANTS_SDS['D65'] - >>> plot_sds_in_chromaticity_diagram_CIE1931([A, D65]) # doctest: +SKIP + >>> plot_sds_in_chromaticity_diagram_CIE1931([A, D65]) + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_\ -Plot_SDs_In_Chromaticity_Diagram_CIE1931.png +Plot_SDS_In_Chromaticity_Diagram_CIE1931.png :align: center :alt: plot_sds_in_chromaticity_diagram_CIE1931 """ @@ -787,8 +815,12 @@ def plot_sds_in_chromaticity_diagram_CIE1960UCS( Parameters ---------- - sds : array_like, optional - Spectral distributions to plot. + sds : array_like or MultiSpectralDistributions + Spectral distributions or multi-spectral distributions to + plot. `sds` can be a single + :class:`colour.MultiSpectralDistributions` class instance, a list + of :class:`colour.MultiSpectralDistributions` class instances or a + list of :class:`colour.SpectralDistribution` class instances. cmfs : unicode, optional Standard observer colour matching functions used for *Chromaticity Diagram* bounds. @@ -822,10 +854,12 @@ def plot_sds_in_chromaticity_diagram_CIE1960UCS( >>> A = ILLUMINANTS_SDS['A'] >>> D65 = ILLUMINANTS_SDS['D65'] >>> plot_sds_in_chromaticity_diagram_CIE1960UCS([A, D65]) - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_\ -Plot_SDs_In_Chromaticity_Diagram_CIE1960UCS.png +Plot_SDS_In_Chromaticity_Diagram_CIE1960UCS.png :align: center :alt: plot_sds_in_chromaticity_diagram_CIE1960UCS """ @@ -852,8 +886,12 @@ def plot_sds_in_chromaticity_diagram_CIE1976UCS( Parameters ---------- - sds : array_like, optional - Spectral distributions to plot. + sds : array_like or MultiSpectralDistributions + Spectral distributions or multi-spectral distributions to + plot. `sds` can be a single + :class:`colour.MultiSpectralDistributions` class instance, a list + of :class:`colour.MultiSpectralDistributions` class instances or a + list of :class:`colour.SpectralDistribution` class instances. cmfs : unicode, optional Standard observer colour matching functions used for *Chromaticity Diagram* bounds. @@ -887,10 +925,12 @@ def plot_sds_in_chromaticity_diagram_CIE1976UCS( >>> A = ILLUMINANTS_SDS['A'] >>> D65 = ILLUMINANTS_SDS['D65'] >>> plot_sds_in_chromaticity_diagram_CIE1976UCS([A, D65]) - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_\ -Plot_SDs_In_Chromaticity_Diagram_CIE1976UCS.png +Plot_SDS_In_Chromaticity_Diagram_CIE1976UCS.png :align: center :alt: plot_sds_in_chromaticity_diagram_CIE1976UCS """ diff --git a/colour/plotting/graph.py b/colour/plotting/graph.py new file mode 100644 index 0000000000..15ed2f5813 --- /dev/null +++ b/colour/plotting/graph.py @@ -0,0 +1,98 @@ +# -*- coding: utf-8 -*- +""" +Automatic Colour Conversion Graph Plotting +========================================== + +Defines the automatic colour conversion graph plotting objects: + +- :func:`colour.plotting.plot_automatic_colour_conversion_graph` +""" + +from __future__ import division + +from colour.graph import CONVERSION_GRAPH, CONVERSION_GRAPH_NODE_LABELS +from colour.utilities import is_networkx_installed + +if is_networkx_installed(): # pragma: no cover + import networkx as nx + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = ['plot_automatic_colour_conversion_graph'] + + +def plot_automatic_colour_conversion_graph(filename, prog='fdp', args=''): + """ + Plots *Colour* automatic colour conversion graph using + `Graphviz `_ and + `pyraphviz `_. + + Parameters + ---------- + filename : unicode + Filename to use to save the image. + prog : unicode, optional + {'neato', 'dot', 'twopi', 'circo', 'fdp', 'nop'}, + *Graphviz* layout method. + args : unicode, optional + Additional arguments for *Graphviz*. + + Returns + ------- + AGraph + *Pyraphviz* graph. + + Notes + ----- + - This definition does not directly plot the *Colour* automatic colour + conversion graph but instead write it to an image. + + Examples + -------- + >>> import tempfile + >>> import colour + >>> from colour import read_image + >>> from colour.plotting import plot_image + >>> filename = '{0}.png'.format(tempfile.mkstemp()[-1]) + >>> _ = plot_automatic_colour_conversion_graph(filename, 'dot') + ... # doctest: +SKIP + >>> plot_image(read_image(filename)) # doctest: +SKIP + + .. image:: ../_static/Plotting_Plot_Colour_Automatic_Conversion_Graph.png + :align: center + :alt: plot_automatic_colour_conversion_graph + """ + + if is_networkx_installed(raise_exception=True): # pragma: no cover + agraph = nx.nx_agraph.to_agraph(CONVERSION_GRAPH) + + for node in agraph.nodes(): + node.attr.update(label=CONVERSION_GRAPH_NODE_LABELS[node.name]) + + agraph.node_attr.update( + style='filled', + shape='circle', + color='#2196F3FF', + fillcolor='#2196F370', + fontname='Helvetica', + fontcolor="#263238") + agraph.edge_attr.update(color='#26323870') + for node in ('CIE XYZ', 'RGB', 'Spectral Distribution'): + agraph.get_node(node.lower()).attr.update( + shape='doublecircle', + color='#673AB7FF', + fillcolor='#673AB770', + fontsize=30) + for node in ('ATD95', 'CAM16', 'CIECAM02', 'Hunt', 'LLAB', + 'Nayatani95', 'RLAB'): + agraph.get_node(node.lower()).attr.update( + color='#00BCD4FF', fillcolor='#00BCD470') + + agraph.draw(filename, prog=prog, args=args) + + return agraph diff --git a/colour/plotting/models.py b/colour/plotting/models.py index c79ccf05e5..ba65279f9b 100644 --- a/colour/plotting/models.py +++ b/colour/plotting/models.py @@ -25,11 +25,31 @@ plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS` - :func:`colour.plotting.plot_single_cctf` - :func:`colour.plotting.plot_multi_cctfs` +- :func:`colour.plotting.plot_constant_hue_loci` + +References +---------- +- :cite:`Ebner1998` : Ebner, F., & Fairchild, M. D. (1998). Finding constant + hue surfaces in color space. In G. B. Beretta & R. Eschbach (Eds.), Proc. + SPIE 3300, Color Imaging: Device-Independent Color, Color Hardcopy, and + Graphic Arts III, (2 January 1998) (pp. 107-117). doi:10.1117/12.298269 +- :cite:`Hung1995` : Hung, P.-C., & Berns, R. S. (1995). Determination of + constant Hue Loci for a CRT gamut and their predictions using color + appearance spaces. Color Research & Application, 20(5), 285-295. + doi:10.1002/col.5080200506 +- :cite:`Mansencal2019` : Mansencal, T. (2019). Colour - Datasets. + doi:10.5281/zenodo.3362520 """ from __future__ import division import numpy as np +import scipy.optimize +try: # pragma: no cover + from collections import Mapping +except ImportError: # pragma: no cover + from collections.abc import Mapping + from matplotlib.patches import Ellipse from matplotlib.path import Path @@ -37,19 +57,21 @@ from colour.algebra import (point_at_angle_on_ellipse, ellipse_coefficients_canonical_form, ellipse_fitting) +from colour.graph import convert from colour.models import ( - ENCODING_CCTFS, DECODING_CCTFS, LCHab_to_Lab, Lab_to_XYZ, Luv_to_uv, - MACADAM_1942_ELLIPSES_DATA, POINTER_GAMUT_BOUNDARIES, POINTER_GAMUT_DATA, - POINTER_GAMUT_ILLUMINANT, RGB_to_RGB, RGB_to_XYZ, UCS_to_uv, XYZ_to_Luv, - XYZ_to_UCS, XYZ_to_xy, xy_to_Luv_uv, xy_to_UCS_uv) + COLOURSPACE_MODELS_AXIS_LABELS, CCTF_ENCODINGS, CCTF_DECODINGS, + LCHab_to_Lab, Lab_to_XYZ, Luv_to_uv, MACADAM_1942_ELLIPSES_DATA, + POINTER_GAMUT_BOUNDARIES, POINTER_GAMUT_DATA, POINTER_GAMUT_ILLUMINANT, + RGB_to_RGB, RGB_to_XYZ, UCS_to_uv, XYZ_to_Luv, XYZ_to_RGB, XYZ_to_UCS, + XYZ_to_xy, xy_to_Luv_uv, xy_to_UCS_uv) from colour.plotting import ( COLOUR_STYLE_CONSTANTS, plot_chromaticity_diagram_CIE1931, artist, plot_chromaticity_diagram_CIE1960UCS, plot_chromaticity_diagram_CIE1976UCS, colour_cycle, colour_style, filter_passthrough, filter_RGB_colourspaces, filter_cmfs, plot_multi_functions, override_style, render) from colour.plotting.diagrams import plot_chromaticity_diagram -from colour.utilities import (as_float_array, domain_range_scale, first_item, - tsplit) +from colour.utilities import (as_float_array, as_int_array, domain_range_scale, + first_item, tsplit, tstack) __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -59,7 +81,8 @@ __status__ = 'Production' __all__ = [ - 'plot_pointer_gamut', 'plot_RGB_colourspaces_in_chromaticity_diagram', + 'common_colourspace_model_axis_reorder', 'plot_pointer_gamut', + 'plot_RGB_colourspaces_in_chromaticity_diagram', 'plot_RGB_colourspaces_in_chromaticity_diagram_CIE1931', 'plot_RGB_colourspaces_in_chromaticity_diagram_CIE1960UCS', 'plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS', @@ -72,10 +95,71 @@ 'plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1931', 'plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1960UCS', 'plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS', - 'plot_single_cctf', 'plot_multi_cctfs' + 'plot_single_cctf', 'plot_multi_cctfs', 'plot_constant_hue_loci' ] +def common_colourspace_model_axis_reorder(a, model=None): + """ + Reorder the axes of given colourspace model :math:`a` array according to + the most common volume plotting axes order. + + Parameters + ---------- + a : array_like + Colourspace model :math:`a` array. + model : unicode, optional + **{'CIE XYZ', 'CIE xyY', 'CIE xy', 'CIE Lab', 'CIE LCHab', 'CIE Luv', + 'CIE Luv uv', 'CIE LCHuv', 'CIE UCS', 'CIE UCS uv', 'CIE UVW', + 'DIN 99', 'Hunter Lab', 'Hunter Rdab', 'IPT', 'JzAzBz', 'OSA UCS', + 'hdr-CIELAB', 'hdr-IPT'}**, + Colourspace model. + + Returns + ------- + ndarray + Reordered colourspace model :math:`a` array. + + Examples + -------- + >>> a = np.array([0, 1, 2]) + >>> common_colourspace_model_axis_reorder(a) + array([0, 1, 2]) + >>> common_colourspace_model_axis_reorder(a, 'CIE Lab') + array([ 1., 2., 0.]) + >>> common_colourspace_model_axis_reorder(a, 'CIE LCHab') + array([ 1., 2., 0.]) + >>> common_colourspace_model_axis_reorder(a, 'CIE Luv') + array([ 1., 2., 0.]) + >>> common_colourspace_model_axis_reorder(a, 'CIE LCHab') + array([ 1., 2., 0.]) + >>> common_colourspace_model_axis_reorder(a, 'DIN 99') + array([ 1., 2., 0.]) + >>> common_colourspace_model_axis_reorder(a, 'Hunter Lab') + array([ 1., 2., 0.]) + >>> common_colourspace_model_axis_reorder(a, 'Hunter Rdab') + array([ 1., 2., 0.]) + >>> common_colourspace_model_axis_reorder(a, 'IPT') + array([ 1., 2., 0.]) + >>> common_colourspace_model_axis_reorder(a, 'JzAzBz') + array([ 1., 2., 0.]) + >>> common_colourspace_model_axis_reorder(a, 'OSA UCS') + array([ 1., 2., 0.]) + >>> common_colourspace_model_axis_reorder(a, 'hdr-CIELAB') + array([ 1., 2., 0.]) + >>> common_colourspace_model_axis_reorder(a, 'hdr-IPT') + array([ 1., 2., 0.]) + """ + + if model in ('CIE Lab', 'CIE LCHab', 'CIE Luv', 'CIE LCHuv', 'DIN 99', + 'Hunter Lab', 'Hunter Rdab', 'IPT', 'JzAzBz', 'OSA UCS', + 'hdr-CIELAB', 'hdr-IPT'): + i, j, k = tsplit(a) + a = tstack([j, k, i]) + + return a + + @override_style() def plot_pointer_gamut(method='CIE 1931', **kwargs): """ @@ -100,7 +184,9 @@ def plot_pointer_gamut(method='CIE 1931', **kwargs): Examples -------- - >>> plot_pointer_gamut() # doctest: +SKIP + >>> plot_pointer_gamut() # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Pointer_Gamut.png :align: center @@ -126,8 +212,8 @@ def XYZ_to_ij(XYZ, *args): def xy_to_ij(xy): """ - Converts given *xy* chromaticity coordinates to *ij* chromaticity - coordinates. + Converts given *CIE xy* chromaticity coordinates to *ij* + chromaticity coordinates. """ return xy @@ -144,8 +230,8 @@ def XYZ_to_ij(XYZ, *args): def xy_to_ij(xy): """ - Converts given *xy* chromaticity coordinates to *ij* chromaticity - coordinates. + Converts given *CIE xy* chromaticity coordinates to *ij* + chromaticity coordinates. """ return xy_to_UCS_uv(xy) @@ -162,8 +248,8 @@ def XYZ_to_ij(XYZ, *args): def xy_to_ij(xy): """ - Converts given *xy* chromaticity coordinates to *ij* chromaticity - coordinates. + Converts given *CIE xy* chromaticity coordinates to *ij* + chromaticity coordinates. """ return xy_to_Luv_uv(xy) @@ -248,7 +334,9 @@ def plot_RGB_colourspaces_in_chromaticity_diagram( -------- >>> plot_RGB_colourspaces_in_chromaticity_diagram( ... ['ITU-R BT.709', 'ACEScg', 'S-Gamut']) - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_\ Plot_RGB_Colourspaces_In_Chromaticity_Diagram.png @@ -291,8 +379,8 @@ def plot_RGB_colourspaces_in_chromaticity_diagram( def xy_to_ij(xy): """ - Converts given *xy* chromaticity coordinates to *ij* chromaticity - coordinates. + Converts given *CIE xy* chromaticity coordinates to *ij* + chromaticity coordinates. """ return xy @@ -303,8 +391,8 @@ def xy_to_ij(xy): def xy_to_ij(xy): """ - Converts given *xy* chromaticity coordinates to *ij* chromaticity - coordinates. + Converts given *CIE xy* chromaticity coordinates to *ij* + chromaticity coordinates. """ return xy_to_UCS_uv(xy) @@ -316,8 +404,8 @@ def xy_to_ij(xy): def xy_to_ij(xy): """ - Converts given *xy* chromaticity coordinates to *ij* chromaticity - coordinates. + Converts given *CIE xy* chromaticity coordinates to *ij* + chromaticity coordinates. """ return xy_to_Luv_uv(xy) @@ -423,7 +511,9 @@ def plot_RGB_colourspaces_in_chromaticity_diagram_CIE1931( -------- >>> plot_RGB_colourspaces_in_chromaticity_diagram_CIE1931( ... ['ITU-R BT.709', 'ACEScg', 'S-Gamut']) - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_\ Plot_RGB_Colourspaces_In_Chromaticity_Diagram_CIE1931.png @@ -474,9 +564,11 @@ def plot_RGB_colourspaces_in_chromaticity_diagram_CIE1960UCS( Examples -------- - >>> plot_RGB_colourspaces_in_chromaticity_diagram_CIE1960UCS(( + >>> plot_RGB_colourspaces_in_chromaticity_diagram_CIE1960UCS( ... ['ITU-R BT.709', 'ACEScg', 'S-Gamut']) - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_\ Plot_RGB_Colourspaces_In_Chromaticity_Diagram_CIE1960UCS.png @@ -528,9 +620,11 @@ def plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS( Examples -------- - >>> plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS(( + >>> plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS( ... ['ITU-R BT.709', 'ACEScg', 'S-Gamut']) - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_\ Plot_RGB_Colourspaces_In_Chromaticity_Diagram_CIE1976UCS.png @@ -594,10 +688,12 @@ def plot_RGB_chromaticities_in_chromaticity_diagram( >>> RGB = np.random.random((128, 128, 3)) >>> plot_RGB_chromaticities_in_chromaticity_diagram( ... RGB, 'ITU-R BT.709') - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_\ -Plot_RGB_Chromaticities_In_Chromaticity_Diagram_Plot.png +Plot_RGB_Chromaticities_In_Chromaticity_Diagram.png :align: center :alt: plot_RGB_chromaticities_in_chromaticity_diagram """ @@ -637,7 +733,7 @@ def plot_RGB_chromaticities_in_chromaticity_diagram( RGB, colourspace, COLOUR_STYLE_CONSTANTS.colour.colourspace, - apply_encoding_cctf=True).reshape(-1, 3), 0, 1) + apply_cctf_encoding=True).reshape(-1, 3), 0, 1) XYZ = RGB_to_XYZ(RGB, colourspace.whitepoint, colourspace.whitepoint, colourspace.RGB_to_XYZ_matrix) @@ -702,7 +798,9 @@ def plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931( >>> RGB = np.random.random((128, 128, 3)) >>> plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931( ... RGB, 'ITU-R BT.709') - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_\ Plot_RGB_Chromaticities_In_Chromaticity_Diagram_CIE1931.png @@ -766,7 +864,9 @@ def plot_RGB_chromaticities_in_chromaticity_diagram_CIE1960UCS( >>> RGB = np.random.random((128, 128, 3)) >>> plot_RGB_chromaticities_in_chromaticity_diagram_CIE1960UCS( ... RGB, 'ITU-R BT.709') - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_\ Plot_RGB_Chromaticities_In_Chromaticity_Diagram_CIE1960UCS.png @@ -830,7 +930,9 @@ def plot_RGB_chromaticities_in_chromaticity_diagram_CIE1976UCS( >>> RGB = np.random.random((128, 128, 3)) >>> plot_RGB_chromaticities_in_chromaticity_diagram_CIE1976UCS( ... RGB, 'ITU-R BT.709') - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_\ Plot_RGB_Chromaticities_In_Chromaticity_Diagram_CIE1976UCS.png @@ -878,8 +980,8 @@ def ellipses_MacAdam1942(method='CIE 1931'): def xy_to_ij(xy): """ - Converts given *xy* chromaticity coordinates to *ij* chromaticity - coordinates. + Converts given *CIE xy* chromaticity coordinates to *ij* + chromaticity coordinates. """ return xy @@ -888,8 +990,8 @@ def xy_to_ij(xy): def xy_to_ij(xy): """ - Converts given *xy* chromaticity coordinates to *ij* chromaticity - coordinates. + Converts given *CIE xy* chromaticity coordinates to *ij* + chromaticity coordinates. """ return xy_to_UCS_uv(xy) @@ -898,8 +1000,8 @@ def xy_to_ij(xy): def xy_to_ij(xy): """ - Converts given *xy* chromaticity coordinates to *ij* chromaticity - coordinates. + Converts given *CIE xy* chromaticity coordinates to *ij* + chromaticity coordinates. """ return xy_to_Luv_uv(xy) @@ -967,7 +1069,10 @@ def plot_ellipses_MacAdam1942_in_chromaticity_diagram( Examples -------- - >>> plot_ellipses_MacAdam1942_in_chromaticity_diagram() # doctest: +SKIP + >>> plot_ellipses_MacAdam1942_in_chromaticity_diagram() + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/\ Plotting_Plot_Ellipses_MacAdam1942_In_Chromaticity_Diagram.png @@ -1082,7 +1187,9 @@ def plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1931( Examples -------- >>> plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1931() - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/\ Plotting_Plot_Ellipses_MacAdam1942_In_Chromaticity_Diagram_CIE1931.png @@ -1143,7 +1250,9 @@ def plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1960UCS( Examples -------- >>> plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1960UCS() - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/\ Plotting_Plot_Ellipses_MacAdam1942_In_Chromaticity_Diagram_CIE1960UCS.png @@ -1204,7 +1313,9 @@ def plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS( Examples -------- >>> plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS() - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/\ Plotting_Plot_Ellipses_MacAdam1942_In_Chromaticity_Diagram_CIE1976UCS.png @@ -1223,7 +1334,7 @@ def plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS( @override_style() -def plot_single_cctf(cctf='ITU-R BT.709', decoding_cctf=False, **kwargs): +def plot_single_cctf(cctf='ITU-R BT.709', cctf_decoding=False, **kwargs): """ Plots given colourspace colour component transfer function. @@ -1231,7 +1342,7 @@ def plot_single_cctf(cctf='ITU-R BT.709', decoding_cctf=False, **kwargs): ---------- cctf : unicode, optional Colour component transfer function to plot. - decoding_cctf : bool + cctf_decoding : bool Plot the decoding colour component transfer function instead. Other Parameters @@ -1249,7 +1360,9 @@ def plot_single_cctf(cctf='ITU-R BT.709', decoding_cctf=False, **kwargs): Examples -------- - >>> plot_single_cctf('ITU-R BT.709') # doctest: +SKIP + >>> plot_single_cctf('ITU-R BT.709') # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Single_CCTF.png :align: center @@ -1259,15 +1372,15 @@ def plot_single_cctf(cctf='ITU-R BT.709', decoding_cctf=False, **kwargs): settings = { 'title': '{0} - {1} CCTF'.format( - cctf, 'Decoding' if decoding_cctf else 'Encoding') + cctf, 'Decoding' if cctf_decoding else 'Encoding') } settings.update(kwargs) - return plot_multi_cctfs([cctf], decoding_cctf, **settings) + return plot_multi_cctfs([cctf], cctf_decoding, **settings) @override_style() -def plot_multi_cctfs(cctfs=None, decoding_cctf=False, **kwargs): +def plot_multi_cctfs(cctfs=None, cctf_decoding=False, **kwargs): """ Plots given colour component transfer functions. @@ -1275,7 +1388,7 @@ def plot_multi_cctfs(cctfs=None, decoding_cctf=False, **kwargs): ---------- cctfs : array_like, optional Colour component transfer function to plot. - decoding_cctf : bool + cctf_decoding : bool Plot the decoding colour component transfer function instead. Other Parameters @@ -1293,7 +1406,9 @@ def plot_multi_cctfs(cctfs=None, decoding_cctf=False, **kwargs): Examples -------- - >>> plot_multi_cctfs(['ITU-R BT.709', 'sRGB']) # doctest: +SKIP + >>> plot_multi_cctfs(['ITU-R BT.709', 'sRGB']) # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Multi_CCTFs.png :align: center @@ -1304,19 +1419,240 @@ def plot_multi_cctfs(cctfs=None, decoding_cctf=False, **kwargs): cctfs = ('ITU-R BT.709', 'sRGB') cctfs = filter_passthrough( - DECODING_CCTFS if decoding_cctf else ENCODING_CCTFS, cctfs) + CCTF_DECODINGS if cctf_decoding else CCTF_ENCODINGS, cctfs) - mode = 'Decoding' if decoding_cctf else 'Encoding' + mode = 'Decoding' if cctf_decoding else 'Encoding' title = '{0} - {1} CCTFs'.format(', '.join([cctf for cctf in cctfs]), mode) settings = { 'bounding_box': (0, 1, 0, 1), 'legend': True, 'title': title, - 'x_label': 'Signal Value' if decoding_cctf else 'Tristimulus Value', - 'y_label': 'Tristimulus Value' if decoding_cctf else 'Signal Value', + 'x_label': 'Signal Value' if cctf_decoding else 'Tristimulus Value', + 'y_label': 'Tristimulus Value' if cctf_decoding else 'Signal Value', } settings.update(kwargs) with domain_range_scale(1): return plot_multi_functions(cctfs, **settings) + + +@override_style() +def plot_constant_hue_loci(data, model, scatter_parameters=None, **kwargs): + """ + Plots given constant hue loci colour matches data such as that from + :cite:`Hung1995` or :cite:`Ebner1998` that are easily loaded with + `Colour - Datasets `_. + + Parameters + ---------- + data : array_like + Constant hue loci colour matches data expected to be an *array_like* as + follows:: + + [ + ('name', XYZ_r, XYZ_cr, (XYZ_ct, XYZ_ct, XYZ_ct, ...), \ +{metadata}), + ('name', XYZ_r, XYZ_cr, (XYZ_ct, XYZ_ct, XYZ_ct, ...), \ +{metadata}), + ('name', XYZ_r, XYZ_cr, (XYZ_ct, XYZ_ct, XYZ_ct, ...), \ +{metadata}), + ... + ] + + where ``name`` is the hue angle or name, ``XYZ_r`` the *CIE XYZ* + tristimulus values of the reference illuminant, ``XYZ_cr`` the + *CIE XYZ* tristimulus values of the reference colour under the + reference illuminant, ``XYZ_ct`` the *CIE XYZ* tristimulus values of + the colour matches under the reference illuminant and ``metadata`` the + dataset metadata. + model : unicode, optional + **{'CIE XYZ', 'CIE xyY', 'CIE xy', 'CIE Lab', 'CIE LCHab', 'CIE Luv', + 'CIE Luv uv', 'CIE LCHuv', 'CIE UCS', 'CIE UCS uv', 'CIE UVW', + 'DIN 99', 'Hunter Lab', 'Hunter Rdab', 'IPT', 'JzAzBz', 'OSA UCS', + 'hdr-CIELAB', 'hdr-IPT'}**, + Colourspace model. + scatter_parameters : dict, optional + Parameters for the :func:`plt.scatter` definition, if ``c`` is set to + *RGB*, the scatter will use given ``RGB`` colours. + + Other Parameters + ---------------- + \\**kwargs : dict, optional + {:func:`colour.plotting.artist`, + :func:`colour.plotting.plot_multi_functions`, + :func:`colour.plotting.render`}, + Please refer to the documentation of the previously listed definitions. + + Returns + ------- + tuple + Current figure and axes. + + References + ---------- + :cite:`Ebner1998`, :cite:`Hung1995`, :cite:`Mansencal2019` + + Examples + -------- + >>> data = np.array([ + ... [ + ... None, + ... np.array([0.95010000, 1.00000000, 1.08810000]), + ... np.array([0.40920000, 0.28120000, 0.30600000]), + ... np.array([ + ... [0.02495100, 0.01908600, 0.02032900], + ... [0.10944300, 0.06235900, 0.06788100], + ... [0.27186500, 0.18418700, 0.19565300], + ... [0.48898900, 0.40749400, 0.44854600], + ... ]), + ... None, + ... ], + ... [ + ... None, + ... np.array([0.95010000, 1.00000000, 1.08810000]), + ... np.array([0.30760000, 0.48280000, 0.42770000]), + ... np.array([ + ... [0.02108000, 0.02989100, 0.02790400], + ... [0.06194700, 0.11251000, 0.09334400], + ... [0.15255800, 0.28123300, 0.23234900], + ... [0.34157700, 0.56681300, 0.47035300], + ... ]), + ... None, + ... ], + ... [ + ... None, + ... np.array([0.95010000, 1.00000000, 1.08810000]), + ... np.array([0.39530000, 0.28120000, 0.18450000]), + ... np.array([ + ... [0.02436400, 0.01908600, 0.01468800], + ... [0.10331200, 0.06235900, 0.02854600], + ... [0.26311900, 0.18418700, 0.12109700], + ... [0.43158700, 0.40749400, 0.39008600], + ... ]), + ... None, + ... ], + ... [ + ... None, + ... np.array([0.95010000, 1.00000000, 1.08810000]), + ... np.array([0.20510000, 0.18420000, 0.57130000]), + ... np.array([ + ... [0.03039800, 0.02989100, 0.06123300], + ... [0.08870000, 0.08498400, 0.21843500], + ... [0.18405800, 0.18418700, 0.40111400], + ... [0.32550100, 0.34047200, 0.50296900], + ... [0.53826100, 0.56681300, 0.80010400], + ... ]), + ... None, + ... ], + ... [ + ... None, + ... np.array([0.95010000, 1.00000000, 1.08810000]), + ... np.array([0.35770000, 0.28120000, 0.11250000]), + ... np.array([ + ... [0.03678100, 0.02989100, 0.01481100], + ... [0.17127700, 0.11251000, 0.01229900], + ... [0.30080900, 0.28123300, 0.21229800], + ... [0.52976000, 0.40749400, 0.11720000], + ... ]), + ... None, + ... ], + ... ]) + >>> plot_constant_hue_loci(data, 'IPT') # doctest: +ELLIPSIS + (
, \ +) + + .. image:: ../_static/Plotting_Plot_Constant_Hue_Loci.png + :align: center + :alt: plot_constant_hue_loci + """ + + # TODO: Filter appropriate colour models. + + data = data.values() if isinstance(data, Mapping) else data + + settings = {'uniform': True} + settings.update(kwargs) + + _figure, axes = artist(**settings) + + scatter_settings = { + 's': 40, + 'c': 'RGB', + 'marker': 'o', + 'alpha': 0.85, + } + if scatter_parameters is not None: + scatter_settings.update(scatter_parameters) + + use_RGB_colours = scatter_settings['c'].upper() == 'RGB' + + colourspace = COLOUR_STYLE_CONSTANTS.colour.colourspace + for hue_data in data: + _name, XYZ_r, XYZ_cr, XYZ_ct, _metadata = hue_data + + xy_r = XYZ_to_xy(XYZ_r) + ijk_ct = common_colourspace_model_axis_reorder( + convert(XYZ_ct, 'CIE XYZ', model, illuminant=xy_r), model) + ijk_cr = common_colourspace_model_axis_reorder( + convert(XYZ_cr, 'CIE XYZ', model, illuminant=xy_r), model) + + def _linear_equation(x, a, b): + """ + Defines the canonical linear equation for a line. + """ + + return a * x + b + + popt, _pcov = scipy.optimize.curve_fit(_linear_equation, + ijk_ct[..., 0], ijk_ct[..., 1]) + + axes.plot( + ijk_ct[..., 0], + _linear_equation(ijk_ct[..., 0], *popt), + c=COLOUR_STYLE_CONSTANTS.colour.average) + + if use_RGB_colours: + + def _XYZ_to_RGB(XYZ): + """ + Converts given *CIE XYZ* tristimulus values to + ``colour.plotting`` *RGB* colourspace. + """ + + return XYZ_to_RGB( + XYZ, + xy_r, + colourspace.whitepoint, + colourspace.XYZ_to_RGB_matrix, + cctf_encoding=colourspace.cctf_encoding) + + RGB_ct = _XYZ_to_RGB(XYZ_ct) + RGB_cr = _XYZ_to_RGB(XYZ_cr) + + scatter_settings['c'] = np.clip(RGB_ct, 0, 1) + + axes.scatter( + ijk_ct[..., 0], ijk_ct[..., 1], zorder=10, **scatter_settings) + + axes.plot( + ijk_cr[..., 0], + ijk_cr[..., 1], + 's', + zorder=10, + c=np.clip(np.ravel(RGB_cr), 0, 1), + markersize=COLOUR_STYLE_CONSTANTS.geometry.short * 8) + + labels = np.array(COLOURSPACE_MODELS_AXIS_LABELS[model])[as_int_array( + common_colourspace_model_axis_reorder([0, 1, 2], model))] + + settings = { + 'axes': axes, + 'title': 'Constant Hue Loci - ' + '{0} (Domain-Range Scale: 1)'.format(model), + 'x_label': labels[0], + 'y_label': labels[1], + } + settings.update(kwargs) + + return render(**settings) diff --git a/colour/plotting/notation.py b/colour/plotting/notation.py index 3f2bca20cf..137d6284c1 100644 --- a/colour/plotting/notation.py +++ b/colour/plotting/notation.py @@ -30,7 +30,7 @@ @override_style() -def plot_single_munsell_value_function(function='ASTM D1535-08', **kwargs): +def plot_single_munsell_value_function(function='ASTM D1535', **kwargs): """ Plots given *Lightness* function. @@ -54,7 +54,9 @@ def plot_single_munsell_value_function(function='ASTM D1535-08', **kwargs): Examples -------- - >>> plot_single_munsell_value_function('ASTM D1535-08') # doctest: +SKIP + >>> plot_single_munsell_value_function('ASTM D1535') # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Single_Munsell_Value_Function.png :align: center @@ -92,8 +94,10 @@ def plot_multi_munsell_value_functions(functions=None, **kwargs): Examples -------- - >>> plot_multi_munsell_value_functions(['ASTM D1535-08', 'McCamy 1987']) - ... # doctest: +SKIP + >>> plot_multi_munsell_value_functions(['ASTM D1535', 'McCamy 1987']) + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Multi_Munsell_Value_Functions.png :align: center @@ -101,7 +105,7 @@ def plot_multi_munsell_value_functions(functions=None, **kwargs): """ if functions is None: - functions = ('ASTM D1535-08', 'McCamy 1987') + functions = ('ASTM D1535', 'McCamy 1987') functions = filter_passthrough(MUNSELL_VALUE_METHODS, functions) diff --git a/colour/plotting/phenomena.py b/colour/plotting/phenomena.py index e32580db07..39ed39764f 100644 --- a/colour/plotting/phenomena.py +++ b/colour/plotting/phenomena.py @@ -18,7 +18,7 @@ from colour.phenomena.rayleigh import ( AVERAGE_PRESSURE_MEAN_SEA_LEVEL, DEFAULT_ALTITUDE, DEFAULT_LATITUDE, STANDARD_AIR_TEMPERATURE, STANDARD_CO2_CONCENTRATION) -from colour.plotting import (ASTM_G_173_ETR, COLOUR_STYLE_CONSTANTS, +from colour.plotting import (ASTMG173_ETR, COLOUR_STYLE_CONSTANTS, ColourSwatch, XYZ_to_plotting_colourspace, filter_cmfs, override_style, render, plot_single_colour_swatch, plot_single_sd) @@ -81,7 +81,9 @@ def plot_single_sd_rayleigh_scattering( Examples -------- - >>> plot_single_sd_rayleigh_scattering() # doctest: +SKIP + >>> plot_single_sd_rayleigh_scattering() # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Single_SD_Rayleigh_Scattering.png :align: center @@ -127,7 +129,9 @@ def plot_the_blue_sky(cmfs='CIE 1931 2 Degree Standard Observer', **kwargs): Examples -------- - >>> plot_the_blue_sky() # doctest: +SKIP + >>> plot_the_blue_sky() # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_The_Blue_Sky.png :align: center @@ -140,11 +144,11 @@ def plot_the_blue_sky(cmfs='CIE 1931 2 Degree Standard Observer', **kwargs): cmfs = first_item(filter_cmfs(cmfs).values()) - ASTM_G_173_sd = ASTM_G_173_ETR.copy() + ASTMG173_sd = ASTMG173_ETR.copy() rayleigh_sd = sd_rayleigh_scattering() - ASTM_G_173_sd.align(rayleigh_sd.shape) + ASTMG173_sd.align(rayleigh_sd.shape) - sd = rayleigh_sd * ASTM_G_173_sd + sd = rayleigh_sd * ASTMG173_sd axes = figure.add_subplot(211) diff --git a/colour/plotting/quality.py b/colour/plotting/quality.py index 588a5fb780..2764009142 100644 --- a/colour/plotting/quality.py +++ b/colour/plotting/quality.py @@ -13,11 +13,11 @@ from __future__ import division -import matplotlib.pyplot as plt import numpy as np from itertools import cycle from colour.constants import DEFAULT_FLOAT_DTYPE +from colour.colorimetry import sds_and_multi_sds_to_sds from colour.plotting import (COLOUR_STYLE_CONSTANTS, XYZ_to_plotting_colourspace, artist, label_rectangles, override_style, render) @@ -82,7 +82,9 @@ def plot_colour_quality_bars(specifications, >>> light_source = light_source.copy().align(SpectralShape(360, 830, 1)) >>> cqs_i = colour_quality_scale(illuminant, additional_data=True) >>> cqs_l = colour_quality_scale(light_source, additional_data=True) - >>> plot_colour_quality_bars([cqs_i, cqs_l]) # doctest: +SKIP + >>> plot_colour_quality_bars([cqs_i, cqs_l]) # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Colour_Quality_Bars.png :align: center @@ -116,7 +118,7 @@ def plot_colour_quality_bars(specifications, y = [s[1].Q_a for s in sorted(Q_as.items(), key=lambda s: s[0])] y = np.array([Q_a] + list(y)) - bars = plt.bar( + bars = axes.bar( x, np.abs(y), color=colours, @@ -133,12 +135,13 @@ def plot_colour_quality_bars(specifications, if labels: label_rectangles( - y, + ['{0:.1f}'.format(y_v) for y_v in y], bars, rotation='horizontal' if count_s == 1 else 'vertical', offset=(0 if count_s == 1 else 3 / 100 * count_s + 65 / 1000, 0.025), - text_size=-5 / 7 * count_s + 12.5) + text_size=-5 / 7 * count_s + 12.5, + axes=axes) axes.axhline( y=100, color=COLOUR_STYLE_CONSTANTS.colour.dark, linestyle='--') @@ -206,7 +209,9 @@ def plot_single_sd_colour_rendering_index_bars(sd, **kwargs): >>> from colour import ILLUMINANTS_SDS >>> illuminant = ILLUMINANTS_SDS['FL2'] >>> plot_single_sd_colour_rendering_index_bars(illuminant) - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_\ Plot_Single_SD_Colour_Rendering_Index_Bars.png @@ -225,9 +230,12 @@ def plot_multi_sds_colour_rendering_indexes_bars(sds, **kwargs): Parameters ---------- - sds : array_like - Array of illuminants or light sources spectral distributions to - plot the *Colour Rendering Index* (CRI). + sds : array_like or MultiSpectralDistributions + Spectral distributions or multi-spectral distributions to + plot. `sds` can be a single + :class:`colour.MultiSpectralDistributions` class instance, a list + of :class:`colour.MultiSpectralDistributions` class instances or a + list of :class:`colour.SpectralDistribution` class instances. Other Parameters ---------------- @@ -258,14 +266,18 @@ def plot_multi_sds_colour_rendering_indexes_bars(sds, **kwargs): >>> illuminant = ILLUMINANTS_SDS['FL2'] >>> light_source = LIGHT_SOURCES_SDS['Kinoton 75P'] >>> plot_multi_sds_colour_rendering_indexes_bars( - ... [illuminant, light_source]) # doctest: +SKIP + ... [illuminant, light_source]) # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_\ -Plot_Multi_SDs_Colour_Rendering_Indexes_Bars.png +Plot_Multi_SDS_Colour_Rendering_Indexes_Bars.png :align: center :alt: plot_multi_sds_colour_rendering_indexes_bars """ + sds = sds_and_multi_sds_to_sds(sds) + settings = dict(kwargs) settings.update({'standalone': False}) @@ -297,7 +309,7 @@ def plot_multi_sds_colour_rendering_indexes_bars(sds, **kwargs): @override_style() def plot_single_sd_colour_quality_scale_bars(sd, - method='NIST CQS 7.4', + method='NIST CQS 9.0', **kwargs): """ Plots the *Colour Quality Scale* (CQS) of given illuminant or light source @@ -339,7 +351,9 @@ def plot_single_sd_colour_quality_scale_bars(sd, >>> from colour import ILLUMINANTS_SDS >>> illuminant = ILLUMINANTS_SDS['FL2'] >>> plot_single_sd_colour_quality_scale_bars(illuminant) - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_\ Plot_Single_SD_Colour_Quality_Scale_Bars.png @@ -352,7 +366,7 @@ def plot_single_sd_colour_quality_scale_bars(sd, @override_style() def plot_multi_sds_colour_quality_scales_bars(sds, - method='NIST CQS 7.4', + method='NIST CQS 9.0', **kwargs): """ Plots the *Colour Quality Scale* (CQS) of given illuminants or light @@ -360,9 +374,12 @@ def plot_multi_sds_colour_quality_scales_bars(sds, Parameters ---------- - sds : array_like - Array of illuminants or light sources spectral distributions to - plot the *Colour Quality Scale* (CQS). + sds : array_like or MultiSpectralDistributions + Spectral distributions or multi-spectral distributions to + plot. `sds` can be a single + :class:`colour.MultiSpectralDistributions` class instance, a list + of :class:`colour.MultiSpectralDistributions` class instances or a + list of :class:`colour.SpectralDistribution` class instances. method : unicode, optional **{NIST CQS 7.4'}**, *Colour Quality Scale* (CQS) computation method. @@ -396,14 +413,18 @@ def plot_multi_sds_colour_quality_scales_bars(sds, >>> illuminant = ILLUMINANTS_SDS['FL2'] >>> light_source = LIGHT_SOURCES_SDS['Kinoton 75P'] >>> plot_multi_sds_colour_quality_scales_bars([illuminant, light_source]) - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_\ -Plot_Multi_SDs_Colour_Quality_Scales_Bars.png +Plot_Multi_SDS_Colour_Quality_Scales_Bars.png :align: center :alt: plot_multi_sds_colour_quality_scales_bars """ + sds = sds_and_multi_sds_to_sds(sds) + settings = dict(kwargs) settings.update({'standalone': False}) diff --git a/colour/plotting/temperature.py b/colour/plotting/temperature.py index 120e5c9e9a..88f1245e7d 100644 --- a/colour/plotting/temperature.py +++ b/colour/plotting/temperature.py @@ -14,7 +14,6 @@ from __future__ import division -import matplotlib.pyplot as plt import numpy as np from colour.colorimetry import CMFS, ILLUMINANTS @@ -35,7 +34,9 @@ __status__ = 'Production' __all__ = [ - 'plot_planckian_locus', 'plot_planckian_locus_in_chromaticity_diagram', + 'plot_planckian_locus', 'plot_planckian_locus_CIE1931', + 'plot_planckian_locus_CIE1960UCS', + 'plot_planckian_locus_in_chromaticity_diagram', 'plot_planckian_locus_in_chromaticity_diagram_CIE1931', 'plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS' ] @@ -69,7 +70,9 @@ def plot_planckian_locus(planckian_locus_colours=None, Examples -------- - >>> plot_planckian_locus() # doctest: +SKIP + >>> plot_planckian_locus() # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_Planckian_Locus.png :align: center @@ -134,11 +137,88 @@ def uv_to_ij(uv): return render(**settings) +@override_style() +def plot_planckian_locus_CIE1931(planckian_locus_colours=None, **kwargs): + """ + Plots the *Planckian Locus* according to *CIE 1931* method. + + Parameters + ---------- + planckian_locus_colours : array_like or unicode, optional + *Planckian Locus* colours. + + Other Parameters + ---------------- + \\**kwargs : dict, optional + {:func:`colour.plotting.artist`, :func:`colour.plotting.render`}, + Please refer to the documentation of the previously listed definitions. + + Returns + ------- + tuple + Current figure and axes. + + Examples + -------- + >>> plot_planckian_locus_CIE1931() # doctest: +ELLIPSIS + (
, \ +) + + .. image:: ../_static/Plotting_Plot_Planckian_Locus_CIE1931.png + :align: center + :alt: plot_planckian_locus_CIE1931 + """ + + settings = dict(kwargs) + settings.update({'method': 'CIE 1931'}) + + return plot_planckian_locus(planckian_locus_colours, **settings) + + +@override_style() +def plot_planckian_locus_CIE1960UCS(planckian_locus_colours=None, **kwargs): + """ + Plots the *Planckian Locus* according to *CIE 1960 UCS* method. + + Parameters + ---------- + planckian_locus_colours : array_like or unicode, optional + *Planckian Locus* colours. + + Other Parameters + ---------------- + \\**kwargs : dict, optional + {:func:`colour.plotting.artist`, :func:`colour.plotting.render`}, + Please refer to the documentation of the previously listed definitions. + + Returns + ------- + tuple + Current figure and axes. + + Examples + -------- + >>> plot_planckian_locus_CIE1960UCS() # doctest: +ELLIPSIS + (
, \ +) + + .. image:: ../_static/Plotting_Plot_Planckian_Locus_CIE1960UCS.png + :align: center + :alt: plot_planckian_locus_CIE1960UCS + """ + + settings = dict(kwargs) + settings.update({'method': 'CIE 1960 UCS'}) + + return plot_planckian_locus(planckian_locus_colours, **settings) + + @override_style() def plot_planckian_locus_in_chromaticity_diagram( illuminants=None, annotate_parameters=None, chromaticity_diagram_callable=plot_chromaticity_diagram, + planckian_locus_callable=plot_planckian_locus, method='CIE 1931', **kwargs): """ @@ -158,6 +238,8 @@ def plot_planckian_locus_in_chromaticity_diagram( illuminant. chromaticity_diagram_callable : callable, optional Callable responsible for drawing the *Chromaticity Diagram*. + planckian_locus_callable : callable, optional + Callable responsible for drawing the *Planckian Locus*. method : unicode, optional **{'CIE 1931', 'CIE 1960 UCS', 'CIE 1976 UCS'}**, *Chromaticity Diagram* method. @@ -179,7 +261,9 @@ def plot_planckian_locus_in_chromaticity_diagram( Examples -------- >>> plot_planckian_locus_in_chromaticity_diagram(['A', 'B', 'C']) - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_\ Plot_Planckian_Locus_In_Chromaticity_Diagram.png @@ -207,14 +291,14 @@ def plot_planckian_locus_in_chromaticity_diagram( chromaticity_diagram_callable(**settings) - plot_planckian_locus(**settings) + planckian_locus_callable(**settings) if method == 'CIE 1931': def xy_to_ij(xy): """ - Converts given *xy* chromaticity coordinates to *ij* chromaticity - coordinates. + Converts given *CIE xy* chromaticity coordinates to *ij* + chromaticity coordinates. """ return xy @@ -224,8 +308,8 @@ def xy_to_ij(xy): def xy_to_ij(xy): """ - Converts given *xy* chromaticity coordinates to *ij* chromaticity - coordinates. + Converts given *CIE xy* chromaticity coordinates to *ij* + chromaticity coordinates. """ return UCS_to_uv(XYZ_to_UCS(xy_to_XYZ(xy))) @@ -272,7 +356,7 @@ def xy_to_ij(xy): annotate_settings = annotate_settings_collection[i] annotate_settings.pop('annotate') - plt.annotate(illuminant, xy=ij, **annotate_settings) + axes.annotate(illuminant, xy=ij, **annotate_settings) title = (('{0} Illuminants - Planckian Locus\n' '{1} Chromaticity Diagram - ' @@ -298,6 +382,7 @@ def plot_planckian_locus_in_chromaticity_diagram_CIE1931( annotate_parameters=None, chromaticity_diagram_callable_CIE1931=( plot_chromaticity_diagram_CIE1931), + planckian_locus_callable_CIE1931=plot_planckian_locus_CIE1931, **kwargs): """ Plots the *Planckian Locus* and given illuminants in @@ -316,6 +401,9 @@ def plot_planckian_locus_in_chromaticity_diagram_CIE1931( illuminant. chromaticity_diagram_callable_CIE1931 : callable, optional Callable responsible for drawing the *CIE 1931 Chromaticity Diagram*. + planckian_locus_callable_CIE1931 : callable, optional + Callable responsible for drawing the *Planckian Locus* according to + *CIE 1931* method. Other Parameters ---------------- @@ -336,7 +424,9 @@ def plot_planckian_locus_in_chromaticity_diagram_CIE1931( Examples -------- >>> plot_planckian_locus_in_chromaticity_diagram_CIE1931(['A', 'B', 'C']) - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_\ Plot_Planckian_Locus_In_Chromaticity_Diagram_CIE1931.png @@ -349,7 +439,8 @@ def plot_planckian_locus_in_chromaticity_diagram_CIE1931( return plot_planckian_locus_in_chromaticity_diagram( illuminants, annotate_parameters, - chromaticity_diagram_callable_CIE1931, **settings) + chromaticity_diagram_callable_CIE1931, + planckian_locus_callable_CIE1931, **settings) @override_style() @@ -358,6 +449,7 @@ def plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS( annotate_parameters=None, chromaticity_diagram_callable_CIE1960UCS=( plot_chromaticity_diagram_CIE1960UCS), + planckian_locus_callable_CIE1960UCS=plot_planckian_locus_CIE1960UCS, **kwargs): """ Plots the *Planckian Locus* and given illuminants in @@ -377,6 +469,9 @@ def plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS( chromaticity_diagram_callable_CIE1960UCS : callable, optional Callable responsible for drawing the *CIE 1960 UCS Chromaticity Diagram*. + planckian_locus_callable_CIE1960UCS : callable, optional + Callable responsible for drawing the *Planckian Locus* according to + *CIE 1960 UCS* method. Other Parameters ---------------- @@ -397,7 +492,9 @@ def plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS( Examples -------- >>> plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS( - ... ['A', 'C', 'E']) # doctest: +SKIP + ... ['A', 'C', 'E']) # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_\ Plot_Planckian_Locus_In_Chromaticity_Diagram_CIE1960UCS.png @@ -410,4 +507,5 @@ def plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS( return plot_planckian_locus_in_chromaticity_diagram( illuminants, annotate_parameters, - chromaticity_diagram_callable_CIE1960UCS, **settings) + chromaticity_diagram_callable_CIE1960UCS, + planckian_locus_callable_CIE1960UCS, **settings) diff --git a/colour/plotting/tests/test_blindness.py b/colour/plotting/tests/test_blindness.py new file mode 100644 index 0000000000..4bf49441b2 --- /dev/null +++ b/colour/plotting/tests/test_blindness.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.plotting.blindness` module. +""" + +from __future__ import division, unicode_literals + +import numpy as np +import unittest +from matplotlib.pyplot import Axes, Figure + +from colour.plotting import plot_cvd_simulation_Machado2009 + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = ['TestPlotCvdSimulationMachado2009'] + + +class TestPlotCvdSimulationMachado2009(unittest.TestCase): + """ + Defines :func:`colour.plotting.blindness.plot_cvd_simulation_Machado2009` + definition unit tests methods. + """ + + def test_plot_cvd_simulation_Machado2009(self): + """ + Tests :func:`colour.plotting.blindness.plot_cvd_simulation_Machado2009` + definition. + """ + + figure, axes = plot_cvd_simulation_Machado2009( + np.random.rand(32, 32, 3)) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/plotting/tests/test_characterisation.py b/colour/plotting/tests/test_characterisation.py new file mode 100644 index 0000000000..02a8834ace --- /dev/null +++ b/colour/plotting/tests/test_characterisation.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.plotting.characterisation` module. +""" + +from __future__ import division, unicode_literals + +import unittest +from matplotlib.pyplot import Axes, Figure + +from colour.plotting import (plot_single_colour_checker, + plot_multi_colour_checkers) + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = ['TestPlotSingleColourChecker', 'TestPlotMultiColourCheckers'] + + +class TestPlotSingleColourChecker(unittest.TestCase): + """ + Defines :func:`colour.plotting.characterisation.plot_single_colour_checker` + definition unit tests methods. + """ + + def test_plot_single_colour_checker(self): + """ + Tests :func:`colour.plotting.characterisation.\ +plot_single_colour_checker` definition. + """ + + figure, axes = plot_single_colour_checker() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotMultiColourCheckers(unittest.TestCase): + """ + Defines :func:`colour.plotting.characterisation.plot_multi_colour_checkers` + definition unit tests methods. + """ + + def test_plot_multi_colour_checkers(self): + """ + Tests :func:`colour.plotting.characterisation.\ +plot_multi_colour_checkers` definition. + """ + + figure, axes = plot_multi_colour_checkers() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/plotting/tests/test_colorimetry.py b/colour/plotting/tests/test_colorimetry.py new file mode 100644 index 0000000000..d7d9e47b57 --- /dev/null +++ b/colour/plotting/tests/test_colorimetry.py @@ -0,0 +1,308 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.plotting.colorimetry` module. +""" + +from __future__ import division, unicode_literals + +import unittest +from matplotlib.pyplot import Axes, Figure + +from colour.colorimetry import SpectralDistribution +from colour.plotting import ( + plot_single_sd, plot_multi_sds, plot_single_cmfs, plot_multi_cmfs, + plot_single_illuminant_sd, plot_multi_illuminant_sds, + plot_visible_spectrum, plot_single_lightness_function, + plot_multi_lightness_functions, plot_single_luminance_function, + plot_multi_luminance_functions, plot_blackbody_spectral_radiance, + plot_blackbody_colours) + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = [ + 'TestPlotSingleSd', 'TestPlotMultiSds', 'TestPlotSingleCmfs', + 'TestPlotMultiCmfs', 'TestPlotSingleIlluminantSd', + 'TestPlotMultiIlluminantSds', 'TestPlotVisibleSpectrum', + 'TestPlotSingleLightnessFunction', 'TestPlotMultiLightnessFunctions', + 'TestPlotSingleLuminanceFunction', 'TestPlotMultiLuminanceFunctions', + 'TestPlotBlackbodySpectralRadiance', 'TestPlotBlackbodyColours' +] + + +class TestPlotSingleSd(unittest.TestCase): + """ + Defines :func:`colour.plotting.colorimetry.plot_single_sd` definition unit + tests methods. + """ + + def test_plot_single_colour_checker(self): + """ + Tests :func:`colour.plotting.colorimetry.plot_single_sd` definition. + """ + + sd = SpectralDistribution( + { + 500: 0.004900, + 510: 0.009300, + 520: 0.063270, + 530: 0.165500, + 540: 0.290400, + 550: 0.433450, + 560: 0.594500 + }, + name='Custom 1') + + figure, axes = plot_single_sd( + sd, + out_of_gamut_clipping=False, + modulate_colours_with_sd_amplitude=True, + equalize_sd_amplitude=True) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotMultiSds(unittest.TestCase): + """ + Defines :func:`colour.plotting.colorimetry.plot_multi_sds` definition unit + tests methods. + """ + + def test_plot_single_colour_checker(self): + """ + Tests :func:`colour.plotting.colorimetry.plot_multi_sds` definition. + """ + + sd_1 = SpectralDistribution( + { + 500: 0.004900, + 510: 0.009300, + 520: 0.063270, + 530: 0.165500, + 540: 0.290400, + 550: 0.433450, + 560: 0.594500 + }, + name='Custom 1') + sd_2 = SpectralDistribution( + { + 500: 0.323000, + 510: 0.503000, + 520: 0.710000, + 530: 0.862000, + 540: 0.954000, + 550: 0.994950, + 560: 0.995000 + }, + name='Custom 2') + + figure, axes = plot_multi_sds( + [sd_1, sd_2], use_sds_colours=True, normalise_sds_colours=True) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotSingleCmfs(unittest.TestCase): + """ + Defines :func:`colour.plotting.colorimetry.plot_single_cmfs` definition + unit tests methods. + """ + + def test_plot_single_colour_checker(self): + """ + Tests :func:`colour.plotting.colorimetry.plot_single_cmfs` definition. + """ + + figure, axes = plot_single_cmfs() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotMultiCmfs(unittest.TestCase): + """ + Defines :func:`colour.plotting.colorimetry.plot_multi_cmfs` definition unit + tests methods. + """ + + def test_plot_single_colour_checker(self): + """ + Tests :func:`colour.plotting.colorimetry.plot_multi_cmfs` definition. + """ + + figure, axes = plot_multi_cmfs() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotSingleIlluminantSd(unittest.TestCase): + """ + Defines :func:`colour.plotting.colorimetry.plot_single_illuminant_sd` + definition unit tests methods. + """ + + def test_plot_single_colour_checker(self): + """ + Tests :func:`colour.plotting.colorimetry.plot_single_illuminant_sd` + definition. + """ + + figure, axes = plot_single_illuminant_sd() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotMultiIlluminantSds(unittest.TestCase): + """ + Defines :func:`colour.plotting.colorimetry.plot_multi_illuminant_sds` + definition unit tests methods. + """ + + def test_plot_single_colour_checker(self): + """ + Tests :func:`colour.plotting.colorimetry.plot_multi_illuminant_sds` + definition. + """ + + figure, axes = plot_multi_illuminant_sds() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotVisibleSpectrum(unittest.TestCase): + """ + Defines :func:`colour.plotting.colorimetry.plot_visible_spectrum` + definition unit tests methods. + """ + + def test_plot_single_colour_checker(self): + """ + Tests :func:`colour.plotting.colorimetry.plot_visible_spectrum` + definition. + """ + + figure, axes = plot_visible_spectrum() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotSingleLightnessFunction(unittest.TestCase): + """ + Defines :func:`colour.plotting.colorimetry.plot_single_lightness_function` + definition unit tests methods. + """ + + def test_plot_single_colour_checker(self): + """ + Tests :func:`colour.plotting.colorimetry.\ +plot_single_lightness_function` definition. + """ + + figure, axes = plot_single_lightness_function() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotMultiLightnessFunctions(unittest.TestCase): + """ + Defines :func:`colour.plotting.colorimetry.plot_multi_lightness_functions` + definition unit tests methods. + """ + + def test_plot_single_colour_checker(self): + """ + Tests :func:`colour.plotting.colorimetry.\ +plot_multi_lightness_functions` definition. + """ + + figure, axes = plot_multi_lightness_functions() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotSingleLuminanceFunction(unittest.TestCase): + """ + Defines :func:`colour.plotting.colorimetry.plot_single_luminance_function` + definition unit tests methods. + """ + + def test_plot_single_colour_checker(self): + """ + Tests :func:`colour.plotting.colorimetry.\ +plot_single_luminance_function` definition. + """ + + figure, axes = plot_single_luminance_function() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotMultiLuminanceFunctions(unittest.TestCase): + """ + Defines :func:`colour.plotting.colorimetry.plot_multi_luminance_functions` + definition unit tests methods. + """ + + def test_plot_single_colour_checker(self): + """ + Tests :func:`colour.plotting.colorimetry.\ +plot_multi_luminance_functions` definition. + """ + + figure, axes = plot_multi_luminance_functions() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotBlackbodySpectralRadiance(unittest.TestCase): + """ + Defines :func:`colour.plotting.colorimetry.\ +plot_blackbody_spectral_radiance` definition unit tests methods. + """ + + def test_plot_single_colour_checker(self): + """ + Tests :func:`colour.plotting.colorimetry.\ +plot_blackbody_spectral_radiance` definition. + """ + + figure, axes = plot_blackbody_spectral_radiance() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotBlackbodyColours(unittest.TestCase): + """ + Defines :func:`colour.plotting.colorimetry.plot_blackbody_colours` + definition unit tests methods. + """ + + def test_plot_single_colour_checker(self): + """ + Tests :func:`colour.plotting.colorimetry.plot_blackbody_colours` + definition. + """ + + figure, axes = plot_blackbody_colours() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/plotting/tests/test_common.py b/colour/plotting/tests/test_common.py new file mode 100644 index 0000000000..1492a03c1b --- /dev/null +++ b/colour/plotting/tests/test_common.py @@ -0,0 +1,554 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.plotting.common` module. +""" + +from __future__ import division, unicode_literals + +import matplotlib.pyplot as plt +import numpy as np +import os +import shutil +import tempfile +import unittest +from functools import partial +from matplotlib.pyplot import Axes, Figure + +import colour +from colour.colorimetry import ILLUMINANTS_SDS +from colour.io import read_image +from colour.models import RGB_COLOURSPACES, XYZ_to_sRGB, gamma_function +from colour.plotting import ColourSwatch +from colour.plotting import ( + colour_style, override_style, XYZ_to_plotting_colourspace, colour_cycle, + artist, camera, render, wrap_title, label_rectangles, uniform_axes3d, + filter_passthrough, filter_RGB_colourspaces, filter_cmfs, + filter_illuminants, filter_colour_checkers, plot_single_colour_swatch, + plot_multi_colour_swatches, plot_single_function, plot_multi_functions, + plot_image) + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = [ + 'TestColourStyle', 'TestOverrideStyle', 'TestXyzToPlottingColourspace', + 'TestColourCycle', 'TestArtist', 'TestCamera', 'TestRender', + 'TestWrapTitle', 'TestLabelRectangles', 'TestUniformAxes3d', + 'TestFilterPassthrough', 'TestFilterRgbColourspaces', 'TestFilterCmfs', + 'TestFilterIlluminants', 'TestFilterColourCheckers', + 'TestPlotSingleColourSwatch', 'TestPlotMultiColourSwatches', + 'TestPlotSingleFunction', 'TestPlotMultiFunctions', 'TestPlotImage' +] + + +class TestColourStyle(unittest.TestCase): + """ + Defines :func:`colour.plotting.common.colour_style` definition unit tests + methods. + """ + + def test_colour_style(self): + """ + Tests :func:`colour.plotting.common.colour_style` definition. + """ + + self.assertIsInstance(colour_style(use_style=False), dict) + + +class TestOverrideStyle(unittest.TestCase): + """ + Defines :func:`colour.plotting.common.override_style` definition unit tests + methods. + """ + + def test_override_style(self): + """ + Tests :func:`colour.plotting.common.override_style` definition. + """ + + text_color = plt.rcParams['text.color'] + try: + + @override_style(**{'text.color': 'red'}) + def test_text_color_override(): + """ + Tests :func:`colour.plotting.common.override_style` definition. + """ + + assert plt.rcParams['text.color'] == 'red' + + test_text_color_override() + finally: + plt.rcParams['text.color'] = text_color + + +class TestXyzToPlottingColourspace(unittest.TestCase): + """ + Defines :func:`colour.plotting.common.XYZ_to_plotting_colourspace` + definition unit tests methods. + """ + + def test_XYZ_to_plotting_colourspace(self): + """ + Tests :func:`colour.plotting.common.XYZ_to_plotting_colourspace` + definition. + """ + + XYZ = np.random.random(3) + np.testing.assert_almost_equal( + XYZ_to_sRGB(XYZ), XYZ_to_plotting_colourspace(XYZ), decimal=7) + + +class TestColourCycle(unittest.TestCase): + """ + Defines :func:`colour.plotting.common.colour_cycle` definition unit tests + methods. + """ + + def test_colour_cycle(self): + """ + Tests :func:`colour.plotting.common.colour_cycle` definition. + """ + + cycler = colour_cycle() + + np.testing.assert_almost_equal( + next(cycler), + np.array([0.95686275, 0.26274510, 0.21176471, 1.00000000]), + decimal=7) + + np.testing.assert_almost_equal( + next(cycler), + np.array([0.61582468, 0.15423299, 0.68456747, 1.00000000]), + decimal=7) + + np.testing.assert_almost_equal( + next(cycler), + np.array([0.25564014, 0.31377163, 0.70934256, 1.00000000]), + decimal=7) + + cycler = colour_cycle(colour_cycle_map='viridis') + + np.testing.assert_almost_equal( + next(cycler), + np.array([0.26700400, 0.00487400, 0.32941500, 1.00000000]), + decimal=7) + + +class TestArtist(unittest.TestCase): + """ + Defines :func:`colour.plotting.common.artist` definition unit tests + methods. + """ + + def test_artist(self): + """ + Tests :func:`colour.plotting.common.artist` definition. + """ + + figure_1, axes_1 = artist() + + self.assertIsInstance(figure_1, Figure) + self.assertIsInstance(axes_1, Axes) + + _figure_2, axes_2 = artist(axes=axes_1, uniform=True) + self.assertIs(axes_1, axes_2) + + figure_3, _axes_3 = artist(uniform=True) + self.assertEqual(figure_3.get_figwidth(), figure_3.get_figheight()) + + +class TestCamera(unittest.TestCase): + """ + Defines :func:`colour.plotting.common.camera` definition unit tests + methods. + """ + + def test_camera(self): + """ + Tests :func:`colour.plotting.common.camera` definition. + """ + + figure, _axes = artist() + axes = figure.add_subplot(111, projection='3d') + + _figure, axes = camera(axes=axes, elevation=45, azimuth=90) + + self.assertEqual(axes.elev, 45) + self.assertEqual(axes.azim, 90) + + +class TestRender(unittest.TestCase): + """ + Defines :func:`colour.plotting.common.render` definition unit tests + methods. + """ + + def setUp(self): + """ + Initialises common tests attributes. + """ + + self._temporary_directory = tempfile.mkdtemp() + + def tearDown(self): + """ + After tests actions. + """ + + shutil.rmtree(self._temporary_directory) + + def test_render(self): + """ + Tests :func:`colour.plotting.common.render` definition. + """ + + figure, axes = artist() + + render( + figure=figure, + axes=axes, + standalone=False, + aspect='equal', + axes_visible=True, + bounding_box=[0, 1, 0, 1], + tight_layout=False, + legend=True, + legend_columns=2, + transparent_background=False, + title='Render Unit Test', + wrap_title=True, + x_label='x Label', + y_label='y Label', + x_ticker=False, + y_ticker=False, + ) + + render(standalone=True) + + render( + filename=os.path.join(self._temporary_directory, 'render.png'), + axes_visible=False) + + +class TestWrapTitle(unittest.TestCase): + """ + Defines :func:`colour.plotting.common.wrap_title` definition unit tests + methods. + """ + + def test_wrap_title(self): + """ + Tests :func:`colour.plotting.common.wrap_title` definition. + """ + + self.assertEqual( + wrap_title( + 'This is a very long figure title that would overflow the ' + 'figure container if it was not wrapped.'), + ('This is a very long figure title that would overflow the\n' + 'figure container if it was not wrapped.')) + + self.assertEqual( + wrap_title( + 'This is a very long figure title that would overflow the ' + 'figure container if it was not wrapped.', None), + ('This is a very long figure title that would overflow the ' + 'figure container if it was not wrapped.')) + + +class TestLabelRectangles(unittest.TestCase): + """ + Defines :func:`colour.plotting.common.label_rectangles` definition unit + tests methods. + """ + + def test_label_rectangles(self): + """ + Tests :func:`colour.plotting.common.label_rectangles` definition. + """ + + figure, axes = artist() + + samples = np.linspace(0, 1, 10) + + _figure, axes = label_rectangles( + samples, axes.bar(samples, 1), figure=figure, axes=axes) + + self.assertEqual(len(axes.texts), len(samples)) + + +class TestUniformAxes3d(unittest.TestCase): + """ + Defines :func:`colour.plotting.common.uniform_axes3d` definition unit tests + methods. + """ + + def test_uniform_axes3d(self): + """ + Tests :func:`colour.plotting.common.uniform_axes3d` definition. + """ + + figure, _axes = artist() + axes = figure.add_subplot(111, projection='3d') + + uniform_axes3d(axes=axes) + + self.assertEqual(axes.get_xlim(), axes.get_ylim()) + self.assertEqual(axes.get_xlim(), axes.get_zlim()) + + +class TestFilterPassthrough(unittest.TestCase): + """ + Defines :func:`colour.plotting.common.filter_passthrough` definition unit + tests methods. + """ + + def test_filter_passthrough(self): + """ + Tests :func:`colour.plotting.common.filter_passthrough` definition. + """ + + self.assertListEqual( + sorted([ + colourspace.name for colourspace in filter_passthrough( + RGB_COLOURSPACES, ['^ACES.*']).values() + ]), ['ACES2065-1', 'ACEScc', 'ACEScct', 'ACEScg', 'ACESproxy']) + + self.assertListEqual( + sorted(filter_passthrough(RGB_COLOURSPACES, ['^ACEScc$']).keys()), + ['ACEScc']) + + self.assertListEqual( + sorted(filter_passthrough(RGB_COLOURSPACES, ['^acescc$']).keys()), + ['ACEScc']) + + self.assertDictEqual( + filter_passthrough( + ILLUMINANTS_SDS, [ILLUMINANTS_SDS['D65'], { + 'Is': 'Excluded' + }], + allow_non_siblings=False), {'D65': ILLUMINANTS_SDS['D65']}) + + self.assertDictEqual( + filter_passthrough( + ILLUMINANTS_SDS, [ILLUMINANTS_SDS['D65'], { + 'Is': 'Included' + }], + allow_non_siblings=True), { + 'D65': ILLUMINANTS_SDS['D65'], + 'Is': 'Included' + }) + + self.assertListEqual( + sorted([ + element for element in filter_passthrough({ + 'John': 'Doe', + 'Luke': 'Skywalker' + }, ['John']).values() + ]), ['Doe', 'John']) + + +class TestFilterRgbColourspaces(unittest.TestCase): + """ + Defines :func:`colour.plotting.common.filter_RGB_colourspaces` definition + unit tests methods. + """ + + def test_filter_RGB_colourspaces(self): + """ + Tests :func:`colour.plotting.common.filter_RGB_colourspaces` + definition. + """ + + self.assertListEqual( + sorted([ + colourspace.name for colourspace in filter_RGB_colourspaces( + ['^ACES.*']).values() + ]), ['ACES2065-1', 'ACEScc', 'ACEScct', 'ACEScg', 'ACESproxy']) + + +class TestFilterCmfs(unittest.TestCase): + """ + Defines :func:`colour.plotting.common.filter_cmfs` definition unit tests + methods. + """ + + def test_filter_cmfs(self): + """ + Tests :func:`colour.plotting.common.filter_cmfs` definition. + """ + + self.assertListEqual( + sorted(filter_cmfs(['.*2 Degree.*']).keys()), [ + 'CIE 1931 2 Degree Standard Observer', + 'CIE 2012 2 Degree Standard Observer', + 'Stiles & Burch 1955 2 Degree RGB CMFs', + 'Stockman & Sharpe 2 Degree Cone Fundamentals', + 'Wright & Guild 1931 2 Degree RGB CMFs' + ]) + + +class TestFilterIlluminants(unittest.TestCase): + """ + Defines :func:`colour.plotting.common.filter_illuminants` definition unit + tests methods. + """ + + def test_filter_illuminants(self): + """ + Tests :func:`colour.plotting.common.filter_illuminants` definition. + """ + + self.assertListEqual( + sorted(filter_illuminants(['^D.*']).keys()), + ['D50', 'D55', 'D60', 'D65', 'D75', 'Daylight FL']) + + +class TestFilterColourCheckers(unittest.TestCase): + """ + Defines :func:`colour.plotting.common.filter_colour_checkers` definition + unit tests methods. + """ + + def test_filter_colour_checkers(self): + """ + Tests :func:`colour.plotting.common.filter_colour_checkers` definition. + """ + + self.assertListEqual( + sorted([ + colour_checker.name for colour_checker in + filter_colour_checkers(['.*24.*']).values() + ]), [ + 'ColorChecker24 - After November 2014', + 'ColorChecker24 - Before November 2014' + ]) + + +class TestPlotSingleColourSwatch(unittest.TestCase): + """ + Defines :func:`colour.plotting.common.plot_single_colour_swatch` definition + unit tests methods. + """ + + def test_plot_single_colour_swatch(self): + """ + Tests :func:`colour.plotting.common.plot_single_colour_swatch` + definition. + """ + + figure, axes = plot_single_colour_swatch( + ColourSwatch(RGB=(0.45620519, 0.03081071, 0.04091952))) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotMultiColourSwatches(unittest.TestCase): + """ + Defines :func:`colour.plotting.common.plot_multi_colour_swatches` + definition unit tests methods. + """ + + def test_plot_multi_colour_swatches(self): + """ + Tests :func:`colour.plotting.common.plot_multi_colour_swatches` + definition. + """ + + figure, axes = plot_multi_colour_swatches([ + ColourSwatch(RGB=(0.45293517, 0.31732158, 0.26414773)), + ColourSwatch(RGB=(0.77875824, 0.57726450, 0.50453169)) + ]) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotSingleFunction(unittest.TestCase): + """ + Defines :func:`colour.plotting.common.plot_single_function` definition unit + tests methods. + """ + + def test_plot_single_function(self): + """ + Tests :func:`colour.plotting.common.plot_single_function` definition. + """ + + figure, axes = plot_single_function( + partial(gamma_function, exponent=1 / 2.2)) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotMultiFunctions(unittest.TestCase): + """ + Defines :func:`colour.plotting.common.plot_multi_functions` definition unit + tests methods. + """ + + def test_plot_multi_functions(self): + """ + Tests :func:`colour.plotting.common.plot_multi_functions` definition. + """ + + functions = functions = { + 'Gamma 2.2': lambda x: x ** (1 / 2.2), + 'Gamma 2.4': lambda x: x ** (1 / 2.4), + 'Gamma 2.6': lambda x: x ** (1 / 2.6), + } + figure, axes = plot_multi_functions(functions) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + figure, axes = plot_multi_functions(functions, log_x=10, log_y=10) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + figure, axes = plot_multi_functions(functions, log_x=10) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + figure, axes = plot_multi_functions(functions, log_y=10) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotImage(unittest.TestCase): + """ + Defines :func:`colour.plotting.common.plot_image` definition unit tests + methods. + """ + + def test_plot_image(self): + """ + Tests :func:`colour.plotting.common.plot_image` definition. + """ + + path = os.path.join(colour.__path__[0], '..', 'docs', '_static', + 'Logo_Medium_001.png') + + # Distribution does not ship the documentation thus we are skipping + # this unit test if the image does not exist. + if not os.path.exists(path): # noqa + return + + figure, axes = plot_image(read_image(path)) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/plotting/tests/test_corresponding.py b/colour/plotting/tests/test_corresponding.py new file mode 100644 index 0000000000..e72d10be0f --- /dev/null +++ b/colour/plotting/tests/test_corresponding.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.plotting.corresponding` module. +""" + +from __future__ import division, unicode_literals + +import unittest +from matplotlib.pyplot import Axes, Figure + +from colour.plotting import plot_corresponding_chromaticities_prediction + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = ['TestPlotCorrespondingChromaticitiesPrediction'] + + +class TestPlotCorrespondingChromaticitiesPrediction(unittest.TestCase): + """ + Defines :func:`colour.plotting.corresponding.\ +plot_corresponding_chromaticities_prediction` definition unit tests methods. + """ + + def test_plot_corresponding_chromaticities_prediction(self): + """ + Tests :func:`colour.plotting.corresponding.\ +plot_corresponding_chromaticities_prediction` definition. + """ + + figure, axes = plot_corresponding_chromaticities_prediction() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/plotting/tests/test_diagrams.py b/colour/plotting/tests/test_diagrams.py new file mode 100644 index 0000000000..0eaaa8929e --- /dev/null +++ b/colour/plotting/tests/test_diagrams.py @@ -0,0 +1,295 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.plotting.diagrams` module. +""" + +from __future__ import division, unicode_literals + +import unittest +from matplotlib.pyplot import Axes, Figure + +from colour.colorimetry import ILLUMINANTS_SDS +from colour.plotting import (plot_chromaticity_diagram_CIE1931, + plot_chromaticity_diagram_CIE1960UCS, + plot_chromaticity_diagram_CIE1976UCS, + plot_sds_in_chromaticity_diagram_CIE1931, + plot_sds_in_chromaticity_diagram_CIE1960UCS, + plot_sds_in_chromaticity_diagram_CIE1976UCS) +from colour.plotting.diagrams import ( + plot_spectral_locus, plot_chromaticity_diagram_colours, + plot_chromaticity_diagram, plot_sds_in_chromaticity_diagram) + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = [ + 'TestPlotSpectralLocus', 'TestPlotChromaticityDiagramColours', + 'TestPlotChromaticityDiagram', 'TestPlotChromaticityDiagramCIE1931', + 'TestPlotChromaticityDiagramCIE1960UCS', + 'TestPlotChromaticityDiagramCIE1976UCS', + 'TestPlotSdsInChromaticityDiagram', + 'TestPlotSdsInChromaticityDiagramCIE1931', + 'TestPlotSdsInChromaticityDiagramCIE1960UCS', + 'TestPlotSdsInChromaticityDiagramCIE1976UCS' +] + + +class TestPlotSpectralLocus(unittest.TestCase): + """ + Defines :func:`colour.plotting.diagrams.plot_spectral_locus` definition + unit tests methods. + """ + + def test_plot_spectral_locus(self): + """ + Tests :func:`colour.plotting.diagrams.plot_spectral_locus` definition. + """ + + figure, axes = plot_spectral_locus() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + figure, axes = plot_spectral_locus(spectral_locus_colours='RGB') + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + figure, axes = plot_spectral_locus( + method='CIE 1960 UCS', spectral_locus_colours='RGB') + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + figure, axes = plot_spectral_locus( + method='CIE 1976 UCS', spectral_locus_colours='RGB') + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + self.assertRaises( + ValueError, lambda: plot_spectral_locus(method='Undefined')) + + +class TestPlotChromaticityDiagramColours(unittest.TestCase): + """ + Defines :func:`colour.plotting.diagrams.plot_chromaticity_diagram_colours` + definition unit tests methods. + """ + + def test_plot_chromaticity_diagram_colours(self): + """ + Tests :func:`colour.plotting.diagrams.\ +plot_chromaticity_diagram_colours` definition. + """ + + figure, axes = plot_chromaticity_diagram_colours() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + self.assertRaises( + ValueError, + lambda: plot_chromaticity_diagram_colours(method='Undefined')) + + +class TestPlotChromaticityDiagram(unittest.TestCase): + """ + Defines :func:`colour.plotting.diagrams.plot_chromaticity_diagram` + definition unit tests methods. + """ + + def test_plot_chromaticity_diagram(self): + """ + Tests :func:`colour.plotting.diagrams.plot_chromaticity_diagram` + definition. + """ + + figure, axes = plot_chromaticity_diagram() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + figure, axes = plot_chromaticity_diagram(method='CIE 1960 UCS') + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + figure, axes = plot_chromaticity_diagram(method='CIE 1976 UCS') + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + self.assertRaises( + ValueError, lambda: plot_chromaticity_diagram( + method='Undefined', + show_diagram_colours=False, + show_spectral_locus=False) + ) + + +class TestPlotChromaticityDiagramCIE1931(unittest.TestCase): + """ + Defines :func:`colour.plotting.diagrams.plot_chromaticity_diagram_CIE1931` + definition unit tests methods. + """ + + def test_plot_chromaticity_diagram_CIE1931(self): + """ + Tests :func:`colour.plotting.diagrams.\ +plot_chromaticity_diagram_CIE1931` definition. + """ + + figure, axes = plot_chromaticity_diagram_CIE1931() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotChromaticityDiagramCIE1960UCS(unittest.TestCase): + """ + Defines :func:`colour.plotting.diagrams.\ +plot_chromaticity_diagram_CIE1960UCS` definition unit tests methods. + """ + + def test_plot_chromaticity_diagram_CIE1960UCS(self): + """ + Tests :func:`colour.plotting.diagrams.\ +plot_chromaticity_diagram_CIE1960UCS` definition. + """ + + figure, axes = plot_chromaticity_diagram_CIE1960UCS() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotChromaticityDiagramCIE1976UCS(unittest.TestCase): + """ + Defines :func:`colour.plotting.diagrams.\ +plot_chromaticity_diagram_CIE1976UCS` definition unit tests methods. + """ + + def test_plot_chromaticity_diagram_CIE1976UCS(self): + """ + Tests :func:`colour.plotting.diagrams.\ +plot_chromaticity_diagram_CIE1976UCS` definition. + """ + + figure, axes = plot_chromaticity_diagram_CIE1976UCS() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotSdsInChromaticityDiagram(unittest.TestCase): + """ + Defines :func:`colour.plotting.diagrams.\ +plot_sds_in_chromaticity_diagram` definition unit tests methods. + """ + + def test_plot_sds_in_chromaticity_diagram(self): + """ + Tests :func:`colour.plotting.diagrams.plot_sds_in_chromaticity_diagram` + definition. + """ + + figure, axes = plot_sds_in_chromaticity_diagram( + [ILLUMINANTS_SDS['A'], ILLUMINANTS_SDS['D65']], + annotate_parameters={'arrowprops': { + 'width': 10 + }}) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + figure, axes = plot_sds_in_chromaticity_diagram( + [ILLUMINANTS_SDS['A'], ILLUMINANTS_SDS['D65']], + annotate_parameters=[ + { + 'arrowprops': { + 'width': 10 + } + }, + { + 'arrowprops': { + 'width': 10 + } + }, + ]) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + self.assertRaises( + ValueError, + lambda: plot_sds_in_chromaticity_diagram( + [ILLUMINANTS_SDS['A'], ILLUMINANTS_SDS['D65']], + chromaticity_diagram_callable=lambda **x: x, + method='Undefined') + ) + + +class TestPlotSdsInChromaticityDiagramCIE1931(unittest.TestCase): + """ + Defines :func:`colour.plotting.diagrams.\ +plot_sds_in_chromaticity_diagram_CIE1931` definition unit tests methods. + """ + + def test_plot_sds_in_chromaticity_diagram_CIE1931(self): + """ + Tests :func:`colour.plotting.diagrams.\ +plot_sds_in_chromaticity_diagram_CIE1931` definition. + """ + + figure, axes = plot_sds_in_chromaticity_diagram_CIE1931( + [ILLUMINANTS_SDS['A'], ILLUMINANTS_SDS['D65']]) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotSdsInChromaticityDiagramCIE1960UCS(unittest.TestCase): + """ + Defines :func:`colour.plotting.diagrams.\ +plot_sds_in_chromaticity_diagram_CIE1960UCS` definition unit tests methods. + """ + + def test_plot_sds_in_chromaticity_diagram_CIE1960UCS(self): + """ + Tests :func:`colour.plotting.diagrams.\ +plot_sds_in_chromaticity_diagram_CIE1960UCS` definition. + """ + + figure, axes = plot_sds_in_chromaticity_diagram_CIE1960UCS( + [ILLUMINANTS_SDS['A'], ILLUMINANTS_SDS['D65']]) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotSdsInChromaticityDiagramCIE1976UCS(unittest.TestCase): + """ + Defines :func:`colour.plotting.diagrams.\ +plot_sds_in_chromaticity_diagram_CIE1976UCS` definition unit tests methods. + """ + + def test_plot_sds_in_chromaticity_diagram_CIE1976UCS(self): + """ + Tests :func:`colour.plotting.diagrams.\ +plot_sds_in_chromaticity_diagram_CIE1976UCS` definition. + """ + + figure, axes = plot_sds_in_chromaticity_diagram_CIE1976UCS( + [ILLUMINANTS_SDS['A'], ILLUMINANTS_SDS['D65']]) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/plotting/tests/test_geometry.py b/colour/plotting/tests/test_geometry.py index 64942ea6e0..2d30aabb92 100644 --- a/colour/plotting/tests/test_geometry.py +++ b/colour/plotting/tests/test_geometry.py @@ -68,6 +68,8 @@ def test_quad(self): [-0.4, -0.8, -0.6], [-0.2, -0.8, -0.6]]), decimal=7) + self.assertRaises(ValueError, lambda: quad(plane='Undefined')) + class TestGrid(unittest.TestCase): """ diff --git a/colour/plotting/tests/test_graph.py b/colour/plotting/tests/test_graph.py new file mode 100644 index 0000000000..ab9b8daf24 --- /dev/null +++ b/colour/plotting/tests/test_graph.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.plotting.graph` module. +""" + +from __future__ import division, unicode_literals + +import tempfile +import unittest + +from colour.plotting import plot_automatic_colour_conversion_graph +from colour.utilities import is_networkx_installed + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = ['TestPlotAutomaticColourConversionGraph'] + + +class TestPlotAutomaticColourConversionGraph(unittest.TestCase): + """ + Defines :func:`colour.plotting.graph.\ +plot_automatic_colour_conversion_graph` definition unit tests methods. + """ + + def test_plot_automatic_colour_conversion_graph(self): + """ + Tests :func:`colour.plotting.graph.\ +plot_automatic_colour_conversion_graph` definition. + """ + + if is_networkx_installed(raise_exception=True): # pragma: no cover + return + + plot_automatic_colour_conversion_graph( # pragma: no cover + '{0}.png'.format(tempfile.mkstemp()[-1])) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/plotting/tests/test_models.py b/colour/plotting/tests/test_models.py new file mode 100644 index 0000000000..5b17448a0a --- /dev/null +++ b/colour/plotting/tests/test_models.py @@ -0,0 +1,564 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.plotting.models` module. +""" + +from __future__ import division, unicode_literals + +import numpy as np +import unittest +from matplotlib.pyplot import Axes, Figure + +from colour.plotting import ( + common_colourspace_model_axis_reorder, plot_pointer_gamut, + plot_RGB_colourspaces_in_chromaticity_diagram_CIE1931, + plot_RGB_colourspaces_in_chromaticity_diagram_CIE1960UCS, + plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS, + plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931, + plot_RGB_chromaticities_in_chromaticity_diagram_CIE1960UCS, + plot_RGB_chromaticities_in_chromaticity_diagram_CIE1976UCS, + plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1931, + plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1960UCS, + plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS, + plot_single_cctf, plot_multi_cctfs, plot_constant_hue_loci) +from colour.plotting.models import ( + plot_RGB_colourspaces_in_chromaticity_diagram, + plot_RGB_chromaticities_in_chromaticity_diagram, ellipses_MacAdam1942, + plot_ellipses_MacAdam1942_in_chromaticity_diagram) + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = [ + 'TestCommonColourspaceModelAxisReorder', 'TestPlotPointerGamut', + 'TestPlotRGBColourspacesInChromaticityDiagram', + 'TestPlotRGBColourspacesInChromaticityDiagramCIE1931', + 'TestPlotRGBColourspacesInChromaticityDiagramCIE1960UCS', + 'TestPlotRGBColourspacesInChromaticityDiagramCIE1976UCS', + 'TestPlotRGBChromaticitiesInChromaticityDiagram', + 'TestPlotRGBChromaticitiesInChromaticityDiagramCIE1931', + 'TestPlotRGBChromaticitiesInChromaticityDiagramCIE1960UCS', + 'TestPlotRGBChromaticitiesInChromaticityDiagramCIE1976UCS', + 'TestPlotEllipsesMacAdam1942InChromaticityDiagram', + 'TestPlotEllipsesMacAdam1942InChromaticityDiagramCIE1931', + 'TestPlotEllipsesMacAdam1942InChromaticityDiagramCIE1960UCS', + 'TestPlotEllipsesMacAdam1942InChromaticityDiagramCIE1976UCS', + 'TestPlotSingleCctf', 'TestPlotMultiCctfs', 'TestPlotConstantHueLoci' +] + + +class TestCommonColourspaceModelAxisReorder(unittest.TestCase): + """ + Defines :func:`colour.plotting.models.\ +common_colourspace_model_axis_reorder` definition unit tests methods. + """ + + def test_common_colourspace_model_axis_reorder(self): + """ + Tests :func:`colour.plotting.models.\ +common_colourspace_model_axis_reorder` definition. + """ + + a = np.array([0, 1, 2]) + + np.testing.assert_almost_equal( + common_colourspace_model_axis_reorder(a), + np.array([0, 1, 2]), + decimal=7) + + np.testing.assert_almost_equal( + common_colourspace_model_axis_reorder(a, 'CIE Lab'), + np.array([1, 2, 0]), + decimal=7) + + np.testing.assert_almost_equal( + common_colourspace_model_axis_reorder(a, 'CIE LCHab'), + np.array([1, 2, 0]), + decimal=7) + + np.testing.assert_almost_equal( + common_colourspace_model_axis_reorder(a, 'CIE Luv'), + np.array([1, 2, 0]), + decimal=7) + + np.testing.assert_almost_equal( + common_colourspace_model_axis_reorder(a, 'CIE LCHab'), + np.array([1, 2, 0]), + decimal=7) + + np.testing.assert_almost_equal( + common_colourspace_model_axis_reorder(a, 'DIN 99'), + np.array([1, 2, 0]), + decimal=7) + + np.testing.assert_almost_equal( + common_colourspace_model_axis_reorder(a, 'Hunter Lab'), + np.array([1, 2, 0]), + decimal=7) + + np.testing.assert_almost_equal( + common_colourspace_model_axis_reorder(a, 'Hunter Rdab'), + np.array([1, 2, 0]), + decimal=7) + + np.testing.assert_almost_equal( + common_colourspace_model_axis_reorder(a, 'IPT'), + np.array([1, 2, 0]), + decimal=7) + + np.testing.assert_almost_equal( + common_colourspace_model_axis_reorder(a, 'JzAzBz'), + np.array([1, 2, 0]), + decimal=7) + + np.testing.assert_almost_equal( + common_colourspace_model_axis_reorder(a, 'OSA UCS'), + np.array([1, 2, 0]), + decimal=7) + + np.testing.assert_almost_equal( + common_colourspace_model_axis_reorder(a, 'hdr-CIELAB'), + np.array([1, 2, 0]), + decimal=7) + + np.testing.assert_almost_equal( + common_colourspace_model_axis_reorder(a, 'hdr-IPT'), + np.array([1, 2, 0]), + decimal=7) + + +class TestPlotPointerGamut(unittest.TestCase): + """ + Defines :func:`colour.plotting.models.plot_pointer_gamut` definition unit + tests methods. + """ + + def test_plot_pointer_gamut(self): + """ + Tests :func:`colour.plotting.models.plot_pointer_gamut` definition. + """ + + figure, axes = plot_pointer_gamut() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + figure, axes = plot_pointer_gamut(method='CIE 1960 UCS') + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + figure, axes = plot_pointer_gamut(method='CIE 1976 UCS') + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + self.assertRaises( + ValueError, lambda: plot_pointer_gamut(method='Undefined')) + + +class TestPlotRGBColourspacesInChromaticityDiagram(unittest.TestCase): + """ + Defines :func:`colour.plotting.models.\ +plot_RGB_colourspaces_in_chromaticity_diagram` definition unit tests methods. + """ + + def test_plot_RGB_colourspaces_in_chromaticity_diagram(self): + """ + Tests :func:`colour.plotting.models.\ +plot_RGB_colourspaces_in_chromaticity_diagram` definition. + """ + + figure, axes = plot_RGB_colourspaces_in_chromaticity_diagram( + show_pointer_gamut=True) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + self.assertRaises( + ValueError, + lambda: plot_RGB_colourspaces_in_chromaticity_diagram( + chromaticity_diagram_callable=lambda **x: x, + method='Undefined') + ) + + +class TestPlotRGBColourspacesInChromaticityDiagramCIE1931(unittest.TestCase): + """ + Defines :func:`colour.plotting.models.\ +plot_RGB_colourspaces_in_chromaticity_diagram_CIE1931` definition unit tests + methods. + """ + + def test_plot_RGB_colourspaces_in_chromaticity_diagram_CIE1931(self): + """ + Tests :func:`colour.plotting.models.\ +plot_RGB_colourspaces_in_chromaticity_diagram_CIE1931` definition. + """ + + figure, axes = plot_RGB_colourspaces_in_chromaticity_diagram_CIE1931() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotRGBColourspacesInChromaticityDiagramCIE1960UCS( + unittest.TestCase): + """ + Defines :func:`colour.plotting.models.\ +plot_RGB_colourspaces_in_chromaticity_diagram_CIE1960UCS` definition unit tests + methods. + """ + + def test_plot_RGB_colourspaces_in_chromaticity_diagram_CIE1960UCS(self): + """ + Tests :func:`colour.plotting.models.\ +plot_RGB_colourspaces_in_chromaticity_diagram_CIE1960UCS` definition. + """ + + figure, axes = ( + plot_RGB_colourspaces_in_chromaticity_diagram_CIE1960UCS()) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotRGBColourspacesInChromaticityDiagramCIE1976UCS( + unittest.TestCase): + """ + Defines :func:`colour.plotting.models.\ +plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS` definition unit tests + methods. + """ + + def test_plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS(self): + """ + Tests :func:`colour.plotting.models.\ +plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS` definition. + """ + + figure, axes = ( + plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS()) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotRGBChromaticitiesInChromaticityDiagram(unittest.TestCase): + """ + Defines :func:`colour.plotting.models.\ +plot_RGB_chromaticities_in_chromaticity_diagram` definition unit tests methods. + """ + + def test_plot_RGB_chromaticities_in_chromaticity_diagram(self): + """ + Tests :func:`colour.plotting.models.\ +plot_RGB_chromaticities_in_chromaticity_diagram` definition. + """ + + figure, axes = plot_RGB_chromaticities_in_chromaticity_diagram( + np.random.random((128, 128, 3)), + scatter_parameters={'marker': 'v'}) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotRGBChromaticitiesInChromaticityDiagramCIE1931(unittest.TestCase): + """ + Defines :func:`colour.plotting.models.\ +plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931` definition unit tests + methods. + """ + + def test_plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931(self): + """ + Tests :func:`colour.plotting.models.\ +plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931` definition. + """ + + figure, axes = plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931( + np.random.random((128, 128, 3))) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotRGBChromaticitiesInChromaticityDiagramCIE1960UCS( + unittest.TestCase): + """ + Defines :func:`colour.plotting.models.\ +plot_RGB_chromaticities_in_chromaticity_diagram_CIE1960UCS` definition unit + tests methods. + """ + + def test_plot_RGB_chromaticities_in_chromaticity_diagram_CIE1960UCS(self): + """ + Tests :func:`colour.plotting.models.\ +plot_RGB_chromaticities_in_chromaticity_diagram_CIE1960UCS` definition. + """ + + figure, axes = ( + plot_RGB_chromaticities_in_chromaticity_diagram_CIE1960UCS( + np.random.random((128, 128, 3)))) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotRGBChromaticitiesInChromaticityDiagramCIE1976UCS( + unittest.TestCase): + """ + Defines :func:`colour.plotting.models.\ +plot_RGB_chromaticities_in_chromaticity_diagram_CIE1976UCS` definition unit + tests methods. + """ + + def test_plot_RGB_chromaticities_in_chromaticity_diagram_CIE1976UCS(self): + """ + Tests :func:`colour.plotting.models.\ +plot_RGB_chromaticities_in_chromaticity_diagram_CIE1976UCS` definition. + """ + + figure, axes = ( + plot_RGB_chromaticities_in_chromaticity_diagram_CIE1976UCS( + np.random.random((128, 128, 3)))) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestEllipsesMacAdam1942(unittest.TestCase): + """ + Defines :func:`colour.plotting.models.ellipses_MacAdam1942` definition unit + tests methods. + """ + + def test_ellipses_MacAdam1942(self): + """ + Tests :func:`colour.plotting.models.ellipses_MacAdam1942` definition. + """ + + self.assertEqual(len(ellipses_MacAdam1942()), 25) + + self.assertRaises( + ValueError, lambda: ellipses_MacAdam1942(method='Undefined')) + + +class TestPlotEllipsesMacAdam1942InChromaticityDiagram(unittest.TestCase): + """ + Defines :func:`colour.plotting.models.\ +plot_ellipses_MacAdam1942_in_chromaticity_diagram` definition unit tests + methods. + """ + + def test_plot_ellipses_MacAdam1942_in_chromaticity_diagram(self): + """ + Tests :func:`colour.plotting.models.\ +plot_ellipses_MacAdam1942_in_chromaticity_diagram` definition. + """ + + figure, axes = plot_ellipses_MacAdam1942_in_chromaticity_diagram( + chromaticity_diagram_clipping=True, + ellipse_parameters={'color': 'k'}) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + figure, axes = plot_ellipses_MacAdam1942_in_chromaticity_diagram( + chromaticity_diagram_clipping=True, + ellipse_parameters=[{ + 'color': 'k' + }] * 25) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotEllipsesMacAdam1942InChromaticityDiagramCIE1931( + unittest.TestCase): + """ + Defines :func:`colour.plotting.models.\ +plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1931` definition unit + tests methods. + """ + + def test_plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1931(self): + """ + Tests :func:`colour.plotting.models.\ +plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1931` definition. + """ + + figure, axes = ( + plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1931()) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotEllipsesMacAdam1942InChromaticityDiagramCIE1960UCS( + unittest.TestCase): + """ + Defines :func:`colour.plotting.models.\ +plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1960UCS` definition unit + tests methods. + """ + + def test_plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1960UCS( + self): + """ + Tests :func:`colour.plotting.models.\ +plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1960UCS` definition. + """ + + figure, axes = ( + plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1960UCS()) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotEllipsesMacAdam1942InChromaticityDiagramCIE1976UCS( + unittest.TestCase): + """ + Defines :func:`colour.plotting.models.\ +plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS` definition unit + tests methods. + """ + + def test_plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS( + self): + """ + Tests :func:`colour.plotting.models.\ +plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS` definition. + """ + + figure, axes = ( + plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS()) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotSingleCctf(unittest.TestCase): + """ + Defines :func:`colour.plotting.models.plot_single_cctf` definition unit + tests methods. + """ + + def test_plot_single_cctf(self): + """ + Tests :func:`colour.plotting.models.plot_single_cctf` definition. + """ + + figure, axes = plot_single_cctf() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotMultiCctfs(unittest.TestCase): + """ + Defines :func:`colour.plotting.models.plot_multi_cctfs` definition unit + tests methods. + """ + + def test_plot_multi_cctfs(self): + """ + Tests :func:`colour.plotting.models.plot_multi_cctfs` definition. + """ + + figure, axes = plot_multi_cctfs() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotConstantHueLoci(unittest.TestCase): + """ + Defines :func:`colour.plotting.models.plot_constant_hue_loci` definition + unit tests methods. + """ + + def test_plot_constant_hue_loci(self): + """ + Tests :func:`colour.plotting.models.plot_constant_hue_loci` definition. + """ + + data = np.array([ + [ + None, + np.array([0.95010000, 1.00000000, 1.08810000]), + np.array([0.40920000, 0.28120000, 0.30600000]), + np.array([ + [0.02495100, 0.01908600, 0.02032900], + [0.10944300, 0.06235900, 0.06788100], + [0.27186500, 0.18418700, 0.19565300], + [0.48898900, 0.40749400, 0.44854600], + ]), + None, + ], + [ + None, + np.array([0.95010000, 1.00000000, 1.08810000]), + np.array([0.30760000, 0.48280000, 0.42770000]), + np.array([ + [0.02108000, 0.02989100, 0.02790400], + [0.06194700, 0.11251000, 0.09334400], + [0.15255800, 0.28123300, 0.23234900], + [0.34157700, 0.56681300, 0.47035300], + ]), + None, + ], + [ + None, + np.array([0.95010000, 1.00000000, 1.08810000]), + np.array([0.39530000, 0.28120000, 0.18450000]), + np.array([ + [0.02436400, 0.01908600, 0.01468800], + [0.10331200, 0.06235900, 0.02854600], + [0.26311900, 0.18418700, 0.12109700], + [0.43158700, 0.40749400, 0.39008600], + ]), + None, + ], + [ + None, + np.array([0.95010000, 1.00000000, 1.08810000]), + np.array([0.20510000, 0.18420000, 0.57130000]), + np.array([ + [0.03039800, 0.02989100, 0.06123300], + [0.08870000, 0.08498400, 0.21843500], + [0.18405800, 0.18418700, 0.40111400], + [0.32550100, 0.34047200, 0.50296900], + [0.53826100, 0.56681300, 0.80010400], + ]), + None, + ], + [ + None, + np.array([0.95010000, 1.00000000, 1.08810000]), + np.array([0.35770000, 0.28120000, 0.11250000]), + np.array([ + [0.03678100, 0.02989100, 0.01481100], + [0.17127700, 0.11251000, 0.01229900], + [0.30080900, 0.28123300, 0.21229800], + [0.52976000, 0.40749400, 0.11720000], + ]), + None, + ], + ]) + + figure, axes = plot_constant_hue_loci( + data, 'IPT', scatter_parameters={'marker': 'v'}) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/plotting/tests/test_notation.py b/colour/plotting/tests/test_notation.py new file mode 100644 index 0000000000..31c5f99367 --- /dev/null +++ b/colour/plotting/tests/test_notation.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.plotting.notation` module. +""" + +from __future__ import division, unicode_literals + +import unittest +from matplotlib.pyplot import Axes, Figure + +from colour.plotting import (plot_single_munsell_value_function, + plot_multi_munsell_value_functions) + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = [ + 'TestPlotSingleMunsellValueFunction', 'TestPlotMultiMunsellValueFunctions' +] + + +class TestPlotSingleMunsellValueFunction(unittest.TestCase): + """ + Defines :func:`colour.plotting.notation.plot_single_munsell_value_function` + definition unit tests methods. + """ + + def test_plot_single_munsell_value_function(self): + """ + Tests :func:`colour.plotting.notation.\ +plot_single_munsell_value_function` definition. + """ + + figure, axes = plot_single_munsell_value_function() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotMultiMunsellValueFunctions(unittest.TestCase): + """ + Defines :func:`colour.plotting.notation.plot_multi_munsell_value_functions` + definition unit tests methods. + """ + + def test_plot_multi_munsell_value_functions(self): + """ + Tests :func:`colour.plotting.notation.\ +plot_multi_munsell_value_functions` definition. + """ + + figure, axes = plot_multi_munsell_value_functions() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/plotting/tests/test_phenomena.py b/colour/plotting/tests/test_phenomena.py new file mode 100644 index 0000000000..651beaf89f --- /dev/null +++ b/colour/plotting/tests/test_phenomena.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.plotting.phenomena` module. +""" + +from __future__ import division, unicode_literals + +import unittest +from matplotlib.pyplot import Axes, Figure + +from colour.plotting import (plot_single_sd_rayleigh_scattering, + plot_the_blue_sky) + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = ['TestPlotSingleSdRayleighScattering', 'TestPlotTheBlueSky'] + + +class TestPlotSingleSdRayleighScattering(unittest.TestCase): + """ + Defines :func:`colour.plotting.phenomena.\ +plot_single_sd_rayleigh_scattering` definition unit tests methods. + """ + + def test_plot_single_sd_rayleigh_scattering(self): + """ + Tests :func:`colour.plotting.phenomena.\ +plot_single_sd_rayleigh_scattering` definition. + """ + + figure, axes = plot_single_sd_rayleigh_scattering() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotTheBlueSky(unittest.TestCase): + """ + Defines :func:`colour.plotting.phenomena.plot_the_blue_sky` definition unit + tests methods. + """ + + def test_plot_the_blue_sky(self): + """ + Tests :func:`colour.plotting.phenomena.plot_the_blue_sky` definition. + """ + + figure, axes = plot_the_blue_sky() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/plotting/tests/test_quality.py b/colour/plotting/tests/test_quality.py new file mode 100644 index 0000000000..2692e35af8 --- /dev/null +++ b/colour/plotting/tests/test_quality.py @@ -0,0 +1,136 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.plotting.quality` module. +""" + +from __future__ import division, unicode_literals + +import unittest +from matplotlib.pyplot import Axes, Figure + +from colour.colorimetry import (ILLUMINANTS_SDS, LIGHT_SOURCES_SDS, + SpectralShape) +from colour.plotting import (plot_single_sd_colour_rendering_index_bars, + plot_multi_sds_colour_rendering_indexes_bars, + plot_single_sd_colour_quality_scale_bars, + plot_multi_sds_colour_quality_scales_bars) +from colour.plotting.quality import plot_colour_quality_bars +from colour.quality import colour_quality_scale + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = [ + 'TestPlotColourQualityBars', 'TestPlotSingleSdColourRenderingIndexBars', + 'TestPlotMultiSdsColourRenderingIndexesBars', + 'TestPlotSingleSdColourQualityScaleBars', + 'TestPlotMultiSdsColourQualityScalesBars' +] + + +class TestPlotColourQualityBars(unittest.TestCase): + """ + Defines :func:`colour.plotting.quality.plot_colour_quality_bars` definition + unit tests methods. + """ + + def test_plot_colour_quality_bars(self): + """ + Tests :func:`colour.plotting.quality.plot_colour_quality_bars` + definition. + """ + + illuminant = ILLUMINANTS_SDS['FL2'] + light_source = LIGHT_SOURCES_SDS['Kinoton 75P'] + light_source = light_source.copy().align(SpectralShape(360, 830, 1)) + cqs_i = colour_quality_scale(illuminant, additional_data=True) + cqs_l = colour_quality_scale(light_source, additional_data=True) + + figure, axes = plot_colour_quality_bars([cqs_i, cqs_l]) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotSingleSdColourRenderingIndexBars(unittest.TestCase): + """ + Defines :func:`colour.plotting.quality.\ +plot_single_sd_colour_rendering_index_bars` definition unit tests methods. + """ + + def test_plot_single_sd_colour_rendering_index_bars(self): + """ + Tests :func:`colour.plotting.quality.\ +plot_single_sd_colour_rendering_index_bars` definition. + """ + + figure, axes = plot_single_sd_colour_rendering_index_bars( + ILLUMINANTS_SDS['FL2']) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotMultiSdsColourRenderingIndexesBars(unittest.TestCase): + """ + Defines :func:`colour.plotting.quality.\ +plot_multi_sds_colour_rendering_indexes_bars` definition unit tests methods. + """ + + def test_plot_multi_sds_colour_rendering_indexes_bars(self): + """ + Tests :func:`colour.plotting.quality.\ +plot_multi_sds_colour_rendering_indexes_bars` definition. + """ + + figure, axes = plot_multi_sds_colour_rendering_indexes_bars( + [ILLUMINANTS_SDS['FL2'], LIGHT_SOURCES_SDS['Kinoton 75P']]) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotSingleSdColourQualityScaleBars(unittest.TestCase): + """ + Defines :func:`colour.plotting.quality.\ +plot_single_sd_colour_quality_scale_bars` definition unit tests methods. + """ + + def test_plot_single_sd_colour_quality_scale_bars(self): + """ + Tests :func:`colour.plotting.quality.\ +plot_single_sd_colour_quality_scale_bars` definition. + """ + + figure, axes = plot_single_sd_colour_quality_scale_bars( + ILLUMINANTS_SDS['FL2']) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotMultiSdsColourQualityScalesBars(unittest.TestCase): + """ + Defines :func:`colour.plotting.quality.\ +plot_multi_sds_colour_quality_scales_bars` definition unit tests methods. + """ + + def test_plot_multi_sds_colour_quality_scales_bars(self): + """ + Tests :func:`colour.plotting.quality.\ +plot_multi_sds_colour_quality_scales_bars` definition. + """ + + figure, axes = plot_multi_sds_colour_quality_scales_bars( + [ILLUMINANTS_SDS['FL2'], LIGHT_SOURCES_SDS['Kinoton 75P']]) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/plotting/tests/test_temperature.py b/colour/plotting/tests/test_temperature.py new file mode 100644 index 0000000000..e7a703c2b1 --- /dev/null +++ b/colour/plotting/tests/test_temperature.py @@ -0,0 +1,181 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.plotting.temperature` module. +""" + +from __future__ import division, unicode_literals + +import unittest +from matplotlib.pyplot import Axes, Figure + +from colour.plotting import ( + plot_planckian_locus_in_chromaticity_diagram_CIE1931, + plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS) +from colour.plotting.temperature import ( + plot_planckian_locus, plot_planckian_locus_CIE1931, + plot_planckian_locus_CIE1960UCS, + plot_planckian_locus_in_chromaticity_diagram) + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = [ + 'TestPlotPlanckianLocus', 'TestPlotPlanckianLocusCIE1931', + 'TestPlotPlanckianLocusCIE1960UCS', + 'TestPlotPlanckianLocusInChromaticityDiagram', + 'TestPlotPlanckianLocusInChromaticityDiagramCIE1931', + 'TestPlotPlanckianLocusInChromaticityDiagramCIE1960UCS' +] + + +class TestPlotPlanckianLocus(unittest.TestCase): + """ + Defines :func:`colour.plotting.temperature.plot_planckian_locus` definition + unit tests methods. + """ + + def test_plot_planckian_locus(self): + """ + Tests :func:`colour.plotting.temperature.plot_planckian_locus` + definition. + """ + + figure, axes = plot_planckian_locus() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + self.assertRaises( + ValueError, lambda: plot_planckian_locus(method='Undefined')) + + +class TestPlotPlanckianLocusCIE1931(unittest.TestCase): + """ + Defines :func:`colour.plotting.temperature.plot_planckian_locus_CIE1931` + definition unit tests methods. + """ + + def test_plot_planckian_locus(self): + """ + Tests :func:`colour.plotting.temperature.plot_planckian_locus_CIE1931` + definition. + """ + + figure, axes = plot_planckian_locus_CIE1931() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotPlanckianLocusCIE1960UCS(unittest.TestCase): + """ + Defines :func:`colour.plotting.temperature.plot_planckian_locus_CIE1960UCS` + definition unit tests methods. + """ + + def test_plot_planckian_locus(self): + """ + Tests :func:`colour.plotting.temperature.\ +plot_planckian_locus_CIE1960UCS` definition. + """ + + figure, axes = plot_planckian_locus_CIE1960UCS() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotPlanckianLocusInChromaticityDiagram(unittest.TestCase): + """ + Defines :func:`colour.plotting.temperature.\ +plot_planckian_locus_in_chromaticity_diagram` definition unit tests methods. + """ + + def test_plot_planckian_locus_in_chromaticity_diagram(self): + """ + Tests :func:`colour.plotting.temperature.\ +plot_planckian_locus_in_chromaticity_diagram` definition. + """ + + figure, axes = plot_planckian_locus_in_chromaticity_diagram( + annotate_parameters={'arrowprops': { + 'width': 10 + }}) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + figure, axes = plot_planckian_locus_in_chromaticity_diagram( + annotate_parameters=[ + { + 'arrowprops': { + 'width': 10 + } + }, + { + 'arrowprops': { + 'width': 10 + } + }, + { + 'arrowprops': { + 'width': 10 + } + }, + ]) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + self.assertRaises( + ValueError, lambda: plot_planckian_locus_in_chromaticity_diagram( + chromaticity_diagram_callable=lambda **x: x, + planckian_locus_callable=lambda **x: x, + method='Undefined')) + + +class TestPlotPlanckianLocusInChromaticityDiagramCIE1931(unittest.TestCase): + """ + Defines :func:`colour.plotting.temperature.\ +plot_planckian_locus_in_chromaticity_diagram_CIE1931` definition unit tests + methods. + """ + + def test_plot_planckian_locus_in_chromaticity_diagram_CIE1931(self): + """ + Tests :func:`colour.plotting.temperature.\ +plot_planckian_locus_in_chromaticity_diagram_CIE1931` definition. + """ + + figure, axes = plot_planckian_locus_in_chromaticity_diagram_CIE1931() + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotPlanckianLocusInChromaticityDiagramCIE1960UCS(unittest.TestCase): + """ + Defines :func:`colour.plotting.temperature.\ +plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS` definition unit tests + methods. + """ + + def test_plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS(self): + """ + Tests :func:`colour.plotting.temperature.\ +plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS` definition. + """ + + figure, axes = plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS( + ) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/plotting/tests/test_volume.py b/colour/plotting/tests/test_volume.py new file mode 100644 index 0000000000..cd402d6a3e --- /dev/null +++ b/colour/plotting/tests/test_volume.py @@ -0,0 +1,222 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.plotting.volume` module. +""" + +from __future__ import division, unicode_literals + +import numpy as np +import unittest +from matplotlib.pyplot import Axes, Figure + +from colour.plotting import plot_RGB_colourspaces_gamuts, plot_RGB_scatter +from colour.plotting.volume import nadir_grid, RGB_identity_cube + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = [ + 'TestNadirGrid', 'TestRGBIdentityCube', 'TestPlotRGBColourspacesGamuts', + 'TestPlotRGBScatter' +] + + +class TestNadirGrid(unittest.TestCase): + """ + Defines :func:`colour.plotting.volume.nadir_grid` definition unit tests + methods. + """ + + def test_nadir_grid(self): + """ + Tests :func:`colour.plotting.volume.nadir_grid` definition. + """ + + quads, faces_colours, edges_colours = nadir_grid(segments=1) + + np.testing.assert_almost_equal( + quads, + np.array([ + [ + [-1.00000000, -1.00000000, 0.00000000], + [1.00000000, -1.00000000, 0.00000000], + [1.00000000, 1.00000000, 0.00000000], + [-1.00000000, 1.00000000, 0.00000000], + ], + [ + [-1.00000000, -1.00000000, 0.00000000], + [0.00000000, -1.00000000, 0.00000000], + [0.00000000, 0.00000000, 0.00000000], + [-1.00000000, 0.00000000, 0.00000000], + ], + [ + [-1.00000000, 0.00000000, 0.00000000], + [0.00000000, 0.00000000, 0.00000000], + [0.00000000, 1.00000000, 0.00000000], + [-1.00000000, 1.00000000, 0.00000000], + ], + [ + [0.00000000, -1.00000000, 0.00000000], + [1.00000000, -1.00000000, 0.00000000], + [1.00000000, 0.00000000, 0.00000000], + [0.00000000, 0.00000000, 0.00000000], + ], + [ + [0.00000000, 0.00000000, 0.00000000], + [1.00000000, 0.00000000, 0.00000000], + [1.00000000, 1.00000000, 0.00000000], + [0.00000000, 1.00000000, 0.00000000], + ], + [ + [-1.00000000, -0.00100000, 0.00000000], + [1.00000000, -0.00100000, 0.00000000], + [1.00000000, 0.00100000, 0.00000000], + [-1.00000000, 0.00100000, 0.00000000], + ], + [ + [-0.00100000, -1.00000000, 0.00000000], + [0.00100000, -1.00000000, 0.00000000], + [0.00100000, 1.00000000, 0.00000000], + [-0.00100000, 1.00000000, 0.00000000], + ], + ]), + decimal=7) + + np.testing.assert_almost_equal( + faces_colours, + np.array([ + [0.25000000, 0.25000000, 0.25000000, 0.10000000], + [0.00000000, 0.00000000, 0.00000000, 0.00000000], + [0.00000000, 0.00000000, 0.00000000, 0.00000000], + [0.00000000, 0.00000000, 0.00000000, 0.00000000], + [0.00000000, 0.00000000, 0.00000000, 0.00000000], + [0.00000000, 0.00000000, 0.00000000, 1.00000000], + [0.00000000, 0.00000000, 0.00000000, 1.00000000], + ]), + decimal=7) + + np.testing.assert_almost_equal( + edges_colours, + np.array([ + [0.50000000, 0.50000000, 0.50000000, 0.50000000], + [0.75000000, 0.75000000, 0.75000000, 0.25000000], + [0.75000000, 0.75000000, 0.75000000, 0.25000000], + [0.75000000, 0.75000000, 0.75000000, 0.25000000], + [0.75000000, 0.75000000, 0.75000000, 0.25000000], + [0.00000000, 0.00000000, 0.00000000, 1.00000000], + [0.00000000, 0.00000000, 0.00000000, 1.00000000], + ]), + decimal=7) + + +class TestRGBIdentityCube(unittest.TestCase): + """ + Defines :func:`colour.plotting.volume.RGB_identity_cube` definition unit + tests methods. + """ + + def test_RGB_identity_cube(self): + """ + Tests :func:`colour.plotting.volume.RGB_identity_cube` definition. + """ + + vertices, RGB = RGB_identity_cube(None, 1, 1, 1) + + np.testing.assert_almost_equal( + vertices, + np.array([ + [ + [0.00000000, 0.00000000, 0.00000000], + [1.00000000, 0.00000000, 0.00000000], + [1.00000000, 1.00000000, 0.00000000], + [0.00000000, 1.00000000, 0.00000000], + ], + [ + [0.00000000, 0.00000000, 1.00000000], + [1.00000000, 0.00000000, 1.00000000], + [1.00000000, 1.00000000, 1.00000000], + [0.00000000, 1.00000000, 1.00000000], + ], + [ + [0.00000000, 0.00000000, 0.00000000], + [1.00000000, 0.00000000, 0.00000000], + [1.00000000, 0.00000000, 1.00000000], + [0.00000000, 0.00000000, 1.00000000], + ], + [ + [0.00000000, 1.00000000, 0.00000000], + [1.00000000, 1.00000000, 0.00000000], + [1.00000000, 1.00000000, 1.00000000], + [0.00000000, 1.00000000, 1.00000000], + ], + [ + [0.00000000, 0.00000000, 0.00000000], + [0.00000000, 1.00000000, 0.00000000], + [0.00000000, 1.00000000, 1.00000000], + [0.00000000, 0.00000000, 1.00000000], + ], + [ + [1.00000000, 0.00000000, 0.00000000], + [1.00000000, 1.00000000, 0.00000000], + [1.00000000, 1.00000000, 1.00000000], + [1.00000000, 0.00000000, 1.00000000], + ], + ]), + decimal=7) + + np.testing.assert_almost_equal( + RGB, + np.array([ + [0.50000000, 0.50000000, 0.00000000], + [0.50000000, 0.50000000, 1.00000000], + [0.50000000, 0.00000000, 0.50000000], + [0.50000000, 1.00000000, 0.50000000], + [0.00000000, 0.50000000, 0.50000000], + [1.00000000, 0.50000000, 0.50000000], + ]), + decimal=7) + + +class TestPlotRGBColourspacesGamuts(unittest.TestCase): + """ + Defines :func:`colour.plotting.volume.plot_RGB_colourspaces_gamuts` + definition unit tests methods. + """ + + def test_plot_RGB_colourspaces_gamuts(self): + """ + Tests :func:`colour.plotting.volume.plot_RGB_colourspaces_gamuts` + definition. + """ + + figure, axes = plot_RGB_colourspaces_gamuts( + show_spectral_locus=True, face_colours=[0.18, 0.18]) + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +class TestPlotRGBScatter(unittest.TestCase): + """ + Defines :func:`colour.plotting.volume.plot_RGB_scatter` definition unit + tests methods. + """ + + def test_plot_RGB_scatter(self): + """ + Tests :func:`colour.plotting.volume.plot_RGB_scatter` definition. + """ + + figure, axes = plot_RGB_scatter( + np.random.random((128, 128, 3)), 'ITU-R BT.709') + + self.assertIsInstance(figure, Figure) + self.assertIsInstance(axes, Axes) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/plotting/volume.py b/colour/plotting/volume.py index 68667744b5..8e9c04c048 100644 --- a/colour/plotting/volume.py +++ b/colour/plotting/volume.py @@ -17,13 +17,13 @@ from colour.constants import DEFAULT_FLOAT_DTYPE, DEFAULT_INT_DTYPE from colour.models import RGB_to_XYZ -from colour.models.common import (COLOURSPACE_MODELS_LABELS, +from colour.models.common import (COLOURSPACE_MODELS_AXIS_LABELS, XYZ_to_colourspace_model) -from colour.plotting import (COLOUR_STYLE_CONSTANTS, cube, - filter_RGB_colourspaces, filter_cmfs, grid, - override_style, render) -from colour.utilities import (Structure, as_float_array, first_item, tsplit, - tstack) +from colour.plotting import ( + COLOUR_STYLE_CONSTANTS, common_colourspace_model_axis_reorder, cube, + filter_RGB_colourspaces, filter_cmfs, grid, override_style, render) +from colour.utilities import (Structure, as_float_array, as_int_array, + first_item) __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -33,75 +33,14 @@ __status__ = 'Production' __all__ = [ - 'common_colourspace_model_axis_reorder', 'nadir_grid', 'RGB_identity_cube', - 'plot_RGB_colourspaces_gamuts', 'plot_RGB_scatter' + 'nadir_grid', 'RGB_identity_cube', 'plot_RGB_colourspaces_gamuts', + 'plot_RGB_scatter' ] -def common_colourspace_model_axis_reorder(a, model=None): - """ - Reorder the axes of given colourspace model :math:`a` array according to - the most common volume plotting axes order. - - Parameters - ---------- - a : array_like - Colourspace model :math:`a` array. - model : unicode, optional - **{'CIE XYZ', 'CIE xyY', 'CIE xy', 'CIE Lab', 'CIE LCHab', 'CIE Luv', - 'CIE Luv uv', 'CIE LCHuv', 'CIE UCS', 'CIE UCS uv', 'CIE UVW', - 'DIN 99', 'Hunter Lab', 'Hunter Rdab', 'IPT', 'JzAzBz', 'OSA UCS', - 'hdr-CIELAB', 'hdr-IPT'}**, - Colourspace model. - - Returns - ------- - ndarray - Reordered colourspace model :math:`a` array. - - Examples - -------- - >>> a = np.array([0, 1, 2]) - >>> common_colourspace_model_axis_reorder(a) - array([0, 1, 2]) - >>> common_colourspace_model_axis_reorder(a, 'CIE Lab') - array([ 1., 2., 0.]) - >>> common_colourspace_model_axis_reorder(a, 'CIE LCHab') - array([ 1., 2., 0.]) - >>> common_colourspace_model_axis_reorder(a, 'CIE Luv') - array([ 1., 2., 0.]) - >>> common_colourspace_model_axis_reorder(a, 'CIE LCHab') - array([ 1., 2., 0.]) - >>> common_colourspace_model_axis_reorder(a, 'DIN 99') - array([ 1., 2., 0.]) - >>> common_colourspace_model_axis_reorder(a, 'Hunter Lab') - array([ 1., 2., 0.]) - >>> common_colourspace_model_axis_reorder(a, 'Hunter Rdab') - array([ 1., 2., 0.]) - >>> common_colourspace_model_axis_reorder(a, 'IPT') - array([ 1., 2., 0.]) - >>> common_colourspace_model_axis_reorder(a, 'JzAzBz') - array([ 1., 2., 0.]) - >>> common_colourspace_model_axis_reorder(a, 'OSA UCS') - array([ 1., 2., 0.]) - >>> common_colourspace_model_axis_reorder(a, 'hdr-CIELAB') - array([ 1., 2., 0.]) - >>> common_colourspace_model_axis_reorder(a, 'hdr-IPT') - array([ 1., 2., 0.]) - """ - - if model in ('CIE Lab', 'CIE LCHab', 'CIE Luv', 'CIE LCHuv', 'DIN 99', - 'Hunter Lab', 'Hunter Rdab', 'IPT', 'JzAzBz', 'OSA UCS', - 'hdr-CIELAB', 'hdr-IPT'): - i, j, k = tsplit(a) - a = tstack([j, k, i]) - - return a - - def nadir_grid(limits=None, segments=10, labels=None, axes=None, **kwargs): """ - Returns a grid on *xy* plane made of quad geometric elements and its + Returns a grid on *CIE xy* plane made of quad geometric elements and its associated faces and edges colours. Ticks and labels are added to the given axes according to the extended grid settings. @@ -482,7 +421,9 @@ def plot_RGB_colourspaces_gamuts(colourspaces=None, Examples -------- >>> plot_RGB_colourspaces_gamuts(['ITU-R BT.709', 'ACEScg', 'S-Gamut']) - ... # doctest: +SKIP + ... # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_RGB_Colourspaces_Gamuts.png :align: center @@ -531,12 +472,12 @@ def plot_RGB_colourspaces_gamuts(colourspaces=None, if spectral_locus_colour is None else spectral_locus_colour) axes.plot( - points[..., 0], points[..., 1], points[..., 2], color=c, zorder=1) + points[..., 0], points[..., 1], points[..., 2], color=c, zorder=10) axes.plot( (points[-1][0], points[0][0]), (points[-1][1], points[0][1]), (points[-1][2], points[0][2]), color=c, - zorder=1) + zorder=10) quads, RGB_f, RGB_e = [], [], [] for i, colourspace in enumerate(colourspaces): @@ -589,21 +530,15 @@ def plot_RGB_colourspaces_gamuts(colourspaces=None, max_a = max(np.max(quads[..., i]), np.max(points[..., i])) getattr(axes, 'set_{}lim'.format(axis))((min_a, max_a)) - labels = COLOURSPACE_MODELS_LABELS[reference_colourspace] + labels = np.array( + COLOURSPACE_MODELS_AXIS_LABELS[reference_colourspace])[as_int_array( + common_colourspace_model_axis_reorder([0, 1, 2], + reference_colourspace))] for i, axis in enumerate('xyz'): getattr(axes, 'set_{}label'.format(axis))(labels[i]) if show_grid: - if reference_colourspace == 'CIE Lab': - limits = np.array([[-450, 450], [-450, 450]]) - elif reference_colourspace == 'CIE Luv': - limits = np.array([[-650, 650], [-650, 650]]) - elif reference_colourspace == 'CIE UVW': - limits = np.array([[-850, 850], [-850, 850]]) - elif reference_colourspace in ('Hunter Lab', 'Hunter Rdab'): - limits = np.array([[-250, 250], [-250, 250]]) - else: - limits = np.array([[-1.5, 1.5], [-1.5, 1.5]]) + limits = np.array([[-1.5, 1.5], [-1.5, 1.5]]) quads_g, RGB_gf, RGB_ge = nadir_grid(limits, grid_segments, labels, axes, **settings) @@ -687,7 +622,9 @@ def plot_RGB_scatter(RGB, Examples -------- >>> RGB = np.random.random((128, 128, 3)) - >>> plot_RGB_scatter(RGB, 'ITU-R BT.709') # doctest: +SKIP + >>> plot_RGB_scatter(RGB, 'ITU-R BT.709') # doctest: +ELLIPSIS + (
, \ +) .. image:: ../_static/Plotting_Plot_RGB_Scatter.png :align: center diff --git a/colour/quality/__init__.py b/colour/quality/__init__.py index aefb03e96a..bbc42a7c34 100644 --- a/colour/quality/__init__.py +++ b/colour/quality/__init__.py @@ -2,14 +2,14 @@ from __future__ import absolute_import -from .dataset import * # noqa -from . import dataset +from .datasets import * # noqa +from . import datasets from .cri import CRI_Specification, colour_rendering_index from .cqs import (CQS_Specification, COLOUR_QUALITY_SCALE_METHODS, colour_quality_scale) __all__ = [] -__all__ += dataset.__all__ +__all__ += datasets.__all__ __all__ += ['CRI_Specification', 'colour_rendering_index'] __all__ += [ 'CQS_Specification', 'COLOUR_QUALITY_SCALE_METHODS', 'colour_quality_scale' diff --git a/colour/quality/cqs.py b/colour/quality/cqs.py index 595657fc1b..cd2713538d 100644 --- a/colour/quality/cqs.py +++ b/colour/quality/cqs.py @@ -33,9 +33,9 @@ from colour.algebra import euclidean_distance from colour.colorimetry import ( - ASTME30815_PRACTISE_SHAPE, sd_CIE_illuminant_D_series, ILLUMINANTS, + DEFAULT_SPECTRAL_SHAPE, sd_CIE_illuminant_D_series, ILLUMINANTS, STANDARD_OBSERVERS_CMFS, sd_blackbody, sd_to_XYZ) -from colour.quality.dataset.vs import VS_INDEXES_TO_NAMES, VS_SDS +from colour.quality.datasets.vs import VS_INDEXES_TO_NAMES, VS_SDS from colour.models import (Lab_to_LCHab, UCS_to_uv, XYZ_to_Lab, XYZ_to_UCS, XYZ_to_xy, xy_to_XYZ) from colour.temperature import CCT_to_xy_CIE_D, uv_to_CCT_Ohno2013 @@ -170,7 +170,7 @@ def colour_quality_scale(sd_test, additional_data=False, method, COLOUR_QUALITY_SCALE_METHODS)) cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'].copy( - ).trim(ASTME30815_PRACTISE_SHAPE) + ).trim(DEFAULT_SPECTRAL_SHAPE) shape = cmfs.shape sd_test = sd_test.copy().align(shape) @@ -471,7 +471,7 @@ def colour_quality_scales(test_data, reference_data, scaling_f, CCT_f): else: D_Ep_ab = D_E_ab - Q_a = scale_conversion(D_Ep_ab, scaling_f, CCT_f) + Q_a = scale_conversion(D_Ep_ab, CCT_f, scaling_f) Q_as[i + 1] = VS_ColourQualityScaleData(test_data[i].name, Q_a, D_C_ab, D_E_ab, D_Ep_ab) diff --git a/colour/quality/cri.py b/colour/quality/cri.py index 394af330e5..44e6f01222 100644 --- a/colour/quality/cri.py +++ b/colour/quality/cri.py @@ -28,9 +28,9 @@ from colour.algebra import euclidean_distance, spow from colour.colorimetry import ( - ASTME30815_PRACTISE_SHAPE, sd_CIE_illuminant_D_series, + DEFAULT_SPECTRAL_SHAPE, sd_CIE_illuminant_D_series, STANDARD_OBSERVERS_CMFS, sd_blackbody, sd_to_XYZ) -from colour.quality.dataset.tcs import TCS_INDEXES_TO_NAMES, TCS_SDS +from colour.quality.datasets.tcs import TCS_INDEXES_TO_NAMES, TCS_SDS from colour.models import UCS_to_uv, XYZ_to_UCS, XYZ_to_xyY from colour.temperature import CCT_to_xy_CIE_D, uv_to_CCT_Robertson1968 from colour.utilities import domain_range_scale @@ -117,7 +117,7 @@ def colour_rendering_index(sd_test, additional_data=False): """ cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'].copy( - ).trim(ASTME30815_PRACTISE_SHAPE) + ).trim(DEFAULT_SPECTRAL_SHAPE) shape = cmfs.shape sd_test = sd_test.copy().align(shape) diff --git a/colour/quality/dataset/__init__.py b/colour/quality/datasets/__init__.py similarity index 100% rename from colour/quality/dataset/__init__.py rename to colour/quality/datasets/__init__.py diff --git a/colour/quality/dataset/tcs.py b/colour/quality/datasets/tcs.py similarity index 100% rename from colour/quality/dataset/tcs.py rename to colour/quality/datasets/tcs.py diff --git a/colour/quality/dataset/vs.py b/colour/quality/datasets/vs.py similarity index 100% rename from colour/quality/dataset/vs.py rename to colour/quality/datasets/vs.py diff --git a/colour/quality/tests/test_cqs.py b/colour/quality/tests/test_cqs.py index 0fe8949154..9791516497 100644 --- a/colour/quality/tests/test_cqs.py +++ b/colour/quality/tests/test_cqs.py @@ -5,10 +5,12 @@ from __future__ import division, unicode_literals +import numpy as np import unittest -from colour.quality import colour_quality_scale +from colour.quality import CQS_Specification, colour_quality_scale from colour.colorimetry import ILLUMINANTS_SDS, LIGHT_SOURCES_SDS +from colour.quality.cqs import VS_ColorimetryData, VS_ColourQualityScaleData __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -101,6 +103,576 @@ def test_colour_quality_scale(self): 84.879524259605077, places=7) + specification_r = CQS_Specification( + name='FL1', + Q_a=75.332008182589348, + Q_f=76.339439008799872, + Q_p=74.235391056498486, + Q_g=84.222748330112054, + Q_d=84.126957016581841, + Q_as={ + 1: + VS_ColourQualityScaleData( + name='VS1', + Q_a=77.680854801718439, + D_C_ab=-1.411454116288503, + D_E_ab=7.191809380490093, + D_Ep_ab=7.191809380490093), + 2: + VS_ColourQualityScaleData( + name='VS2', + Q_a=98.449964521835454, + D_C_ab=2.416949235948934, + D_E_ab=2.468031951275495, + D_Ep_ab=0.499537889816771), + 3: + VS_ColourQualityScaleData( + name='VS3', + Q_a=85.128488974188656, + D_C_ab=2.051673516490851, + D_E_ab=5.212485950404579, + D_Ep_ab=4.791726783206154), + 4: + VS_ColourQualityScaleData( + name='VS4', + Q_a=75.929101405967231, + D_C_ab=-1.544244803829976, + D_E_ab=7.756423964663330, + D_Ep_ab=7.756423964663330), + 5: + VS_ColourQualityScaleData( + name='VS5', + Q_a=76.560036127768228, + D_C_ab=-5.962959343458696, + D_E_ab=7.553059580932679, + D_Ep_ab=7.553059580932679), + 6: + VS_ColourQualityScaleData( + name='VS6', + Q_a=75.674875949078682, + D_C_ab=-7.785240663276603, + D_E_ab=7.838368326299190, + D_Ep_ab=7.838368326299190), + 7: + VS_ColourQualityScaleData( + name='VS7', + Q_a=74.856012003857145, + D_C_ab=-6.773721961614541, + D_E_ab=8.102319790027652, + D_Ep_ab=8.102319790027652), + 8: + VS_ColourQualityScaleData( + name='VS8', + Q_a=85.007243427918965, + D_C_ab=-0.684332522268967, + D_E_ab=4.830795743950247, + D_Ep_ab=4.830795743950247), + 9: + VS_ColourQualityScaleData( + name='VS9', + Q_a=95.600642739549912, + D_C_ab=3.245002214218772, + D_E_ab=3.541112179773836, + D_Ep_ab=1.417545801537952), + 10: + VS_ColourQualityScaleData( + name='VS10', + Q_a=84.897394198279201, + D_C_ab=3.2779983437733051, + D_E_ab=5.867290950207070, + D_Ep_ab=4.866192551944616), + 11: + VS_ColourQualityScaleData( + name='VS11', + Q_a=76.652664070814652, + D_C_ab=0.889135877229947, + D_E_ab=7.575563455510737, + D_Ep_ab=7.523204042181251), + 12: + VS_ColourQualityScaleData( + name='VS12', + Q_a=74.392341352838727, + D_C_ab=-1.950461685183292, + D_E_ab=8.251784061375552, + D_Ep_ab=8.251784061375552), + 13: + VS_ColourQualityScaleData( + name='VS13', + Q_a=71.733157403665416, + D_C_ab=-5.748914457790455, + D_E_ab=9.109057119322612, + D_Ep_ab=9.109057119322612), + 14: + VS_ColourQualityScaleData( + name='VS14', + Q_a=53.322108325530110, + D_C_ab=-14.642967562714134, + D_E_ab=15.053589749938459, + D_Ep_ab=15.053589749938459), + 15: + VS_ColourQualityScaleData( + name='VS15', + Q_a=62.611167146423085, + D_C_ab=-10.071676496831763, + D_E_ab=12.051527779341935, + D_Ep_ab=12.051527779341935) + }, + colorimetry_data=([ + VS_ColorimetryData( + name='VS1', + XYZ=np.array([0.13184562, 0.09885158, 0.22533524]), + Lab=np.array([37.63552369, 27.62126274, -26.23567072]), + C=38.095204070389400), + VS_ColorimetryData( + name='VS2', + XYZ=np.array([0.13066767, 0.10335651, 0.30768635]), + Lab=np.array([38.43822294, 23.38828386, -37.84013645]), + C=44.484691170961092), + VS_ColorimetryData( + name='VS3', + XYZ=np.array([0.10087152, 0.09197794, 0.32255009]), + Lab=np.array([36.36236009, 11.00844158, -43.50665998]), + C=44.877781233091532), + VS_ColorimetryData( + name='VS4', + XYZ=np.array([0.13339874, 0.15690626, 0.38428052]), + Lab=np.array([46.56595565, -9.85969969, -33.955993]), + C=35.358494572170223), + VS_ColorimetryData( + name='VS5', + XYZ=np.array([0.18662805, 0.24704107, 0.40046308]), + Lab=np.array([56.78597632, -23.14117043, -18.29881674]), + C=29.501872194883592), + VS_ColorimetryData( + name='VS6', + XYZ=np.array([0.15841746, 0.24152639, 0.26931454]), + Lab=np.array([56.24029681, -36.23772023, -1.42733778]), + C=36.265819453020534), + VS_ColorimetryData( + name='VS7', + XYZ=np.array([0.14989922, 0.24926212, 0.138238]), + Lab=np.array([57.003456, -44.54988402, 24.99942371]), + C=51.084864212342254), + VS_ColorimetryData( + name='VS8', + XYZ=np.array([0.26139991, 0.36817885, 0.11429053]), + Lab=np.array([67.14017484, -33.23131783, 48.67413212]), + C=58.936335329004450), + VS_ColorimetryData( + name='VS9', + XYZ=np.array([0.42407924, 0.5285824, 0.11437796]), + Lab=np.array([77.791228, -22.23481066, 67.01388225]), + C=70.606283139833707), + VS_ColorimetryData( + name='VS10', + XYZ=np.array([0.553588, 0.62024037, 0.09664934]), + Lab=np.array([82.9262011, -8.87753163, 81.03696819]), + C=81.521781025372348), + VS_ColorimetryData( + name='VS11', + XYZ=np.array([0.39748223, 0.39523993, 0.0573943]), + Lab=np.array([69.1291429, 6.94195834, 71.52497069]), + C=71.861061901342111), + VS_ColorimetryData( + name='VS12', + XYZ=np.array([0.43749683, 0.38968504, 0.08635639]), + Lab=np.array([68.72844451, 20.81629234, 59.85617607]), + C=63.372548004889417), + VS_ColorimetryData( + name='VS13', + XYZ=np.array([0.34652079, 0.27550838, 0.08903238]), + Lab=np.array([59.48075943, 31.8153513, 43.0302754]), + C=53.514681906739007), + VS_ColorimetryData( + name='VS14', + XYZ=np.array([0.14262899, 0.09104011, 0.04951868]), + Lab=np.array([36.18378646, 40.75048676, 18.33518283]), + C=44.685356670534020), + VS_ColorimetryData( + name='VS15', + XYZ=np.array([0.13589052, 0.092129, 0.11599991]), + Lab=np.array([36.39100967, 35.60560293, -4.81131533]), + C=35.929204214045100) + ], [ + VS_ColorimetryData( + name='VS1', + XYZ=np.array([0.15204948, 0.10842571, 0.21637094]), + Lab=np.array([39.31404365, 32.98305053, -21.74613572]), + C=39.506658186677903), + VS_ColorimetryData( + name='VS2', + XYZ=np.array([0.13188419, 0.10619651, 0.29958251]), + Lab=np.array([38.93233648, 22.05678627, -35.82168464]), + C=42.067741935012158), + VS_ColorimetryData( + name='VS3', + XYZ=np.array([0.10125948, 0.09854418, 0.32974284]), + Lab=np.array([37.57986983, 6.06363078, -42.39466811]), + C=42.826107716600681), + VS_ColorimetryData( + name='VS4', + XYZ=np.array([0.13147324, 0.16804591, 0.39334981]), + Lab=np.array([48.01287105, -17.35257125, -32.5683964]), + C=36.902739376000198), + VS_ColorimetryData( + name='VS5', + XYZ=np.array([0.18148174, 0.25847203, 0.41337803]), + Lab=np.array([57.89173056, -30.60333248, -17.92178331]), + C=35.464831538342288), + VS_ColorimetryData( + name='VS6', + XYZ=np.array([0.15185555, 0.25077644, 0.28171886]), + Lab=np.array([57.15099451, -44.01579207, -1.76236936]), + C=44.051060116297137), + VS_ColorimetryData( + name='VS7', + XYZ=np.array([0.1395656, 0.25329693, 0.1447564]), + Lab=np.array([57.39525164, -52.59411951, 24.11378416]), + C=57.858586173956795), + VS_ColorimetryData( + name='VS8', + XYZ=np.array([0.24671064, 0.36211041, 0.11980564]), + Lab=np.array([66.68086148, -37.45951248, 46.3832832]), + C=59.620667851273417), + VS_ColorimetryData( + name='VS9', + XYZ=np.array([0.4081725, 0.508617, 0.11898838]), + Lab=np.array([76.59515888, -21.91694258, 63.69607363]), + C=67.361280925614935), + VS_ColorimetryData( + name='VS10', + XYZ=np.array([0.56031473, 0.60567807, 0.10172838]), + Lab=np.array([82.14584971, -3.82960002, 78.15000763]), + C=78.243782681599043), + VS_ColorimetryData( + name='VS11', + XYZ=np.array([0.40536278, 0.38001713, 0.05756101]), + Lab=np.array([68.02187691, 14.16935995, 69.5431055]), + C=70.971926024112165), + VS_ColorimetryData( + name='VS12', + XYZ=np.array([0.45402541, 0.37917641, 0.08624766]), + Lab=np.array([67.95987006, 28.93047228, 58.56725509]), + C=65.323009690072709), + VS_ColorimetryData( + name='VS13', + XYZ=np.array([0.37202687, 0.27411307, 0.08885905]), + Lab=np.array([59.35311972, 40.9220464, 42.86677002]), + C=59.263596364529462), + VS_ColorimetryData( + name='VS14', + XYZ=np.array([0.19305452, 0.11049115, 0.04885402]), + Lab=np.array([39.66307016, 53.96236134, 24.65590426]), + C=59.328324233248154), + VS_ColorimetryData( + name='VS15', + XYZ=np.array([0.17304703, 0.10699393, 0.11285076]), + Lab=np.array([39.0694885, 45.99591907, 0.67561493]), + C=46.000880710876864) + ])) + + specification_t = colour_quality_scale( + ILLUMINANTS_SDS['FL1'], + additional_data=True, + method='NIST CQS 7.4') + + np.testing.assert_almost_equal( + [ + data.Q_a + for _index, data in sorted(specification_r.Q_as.items()) + ], + [ + data.Q_a + for _index, data in sorted(specification_t.Q_as.items()) + ], + decimal=7, + ) + + specification_r = CQS_Specification( + name='FL1', + Q_a=74.933405395713152, + Q_f=75.895019131814692, + Q_p=None, + Q_g=83.859802969126989, + Q_d=None, + Q_as={ + 1: + VS_ColourQualityScaleData( + name='VS1', + Q_a=51.884484734774539, + D_C_ab=-14.642964823527400, + D_E_ab=15.053586922553365, + D_Ep_ab=15.053586922553365), + 2: + VS_ColourQualityScaleData( + name='VS2', + Q_a=70.859386580835093, + D_C_ab=-5.748912901584454, + D_E_ab=9.109057753686301, + D_Ep_ab=9.109057753686301), + 3: + VS_ColourQualityScaleData( + name='VS3', + Q_a=74.615079552044733, + D_C_ab=-0.199055128982607, + D_E_ab=7.934584371287040, + D_Ep_ab=7.934584371287040), + 4: + VS_ColourQualityScaleData( + name='VS4', + Q_a=85.470454126502858, + D_C_ab=2.620284036804321, + D_E_ab=5.242841277796065, + D_Ep_ab=4.541089762450278), + 5: + VS_ColourQualityScaleData( + name='VS5', + Q_a=95.464568465261436, + D_C_ab=3.244999121708176, + D_E_ab=3.541109287718627, + D_Ep_ab=1.417545656294811), + 6: + VS_ColourQualityScaleData( + name='VS6', + Q_a=84.543583902150289, + D_C_ab=-0.684333146377760, + D_E_ab=4.830795633277699, + D_Ep_ab=4.830795633277699), + 7: + VS_ColourQualityScaleData( + name='VS7', + Q_a=74.078633444044030, + D_C_ab=-6.773727982269591, + D_E_ab=8.102322827150674, + D_Ep_ab=8.102322827150674), + 8: + VS_ColourQualityScaleData( + name='VS8', + Q_a=74.922760174879087, + D_C_ab=-7.785252182726744, + D_E_ab=7.838379721335357, + D_Ep_ab=7.838379721335357), + 9: + VS_ColourQualityScaleData( + name='VS9', + Q_a=75.835254560528938, + D_C_ab=-5.962964833116001, + D_E_ab=7.553073243258186, + D_Ep_ab=7.553073243258186), + 10: + VS_ColourQualityScaleData( + name='VS10', + Q_a=75.184803574188905, + D_C_ab=-1.544240934167505, + D_E_ab=7.756446084611037, + D_Ep_ab=7.756446084611037), + 11: + VS_ColourQualityScaleData( + name='VS11', + Q_a=78.089782546668729, + D_C_ab=1.745770231264103, + D_E_ab=7.067228869124241, + D_Ep_ab=6.848212189193262), + 12: + VS_ColourQualityScaleData( + name='VS12', + Q_a=91.955688469006077, + D_C_ab=2.855869216256835, + D_E_ab=3.804866911398577, + D_Ep_ab=2.514164519893699), + 13: + VS_ColourQualityScaleData( + name='VS13', + Q_a=81.468184220490429, + D_C_ab=0.030402986778803, + D_E_ab=5.792177528304779, + D_Ep_ab=5.792097735518090), + 14: + VS_ColourQualityScaleData( + name='VS14', + Q_a=76.482628265932789, + D_C_ab=-5.080750395110528, + D_E_ab=7.350669246766205, + D_Ep_ab=7.350669246766205), + 15: + VS_ColourQualityScaleData( + name='VS15', + Q_a=65.370026142948518, + D_C_ab=-9.509238816066890, + D_E_ab=10.826397690468854, + D_Ep_ab=10.826397690468854) + }, + colorimetry_data=([ + VS_ColorimetryData( + name='VS1', + XYZ=np.array([0.14262899, 0.09104012, 0.04951869]), + Lab=np.array([36.18378647, 40.75048793, 18.33517831]), + C=44.685355882758152), + VS_ColorimetryData( + name='VS2', + XYZ=np.array([0.3465208, 0.27550838, 0.08903238]), + Lab=np.array([59.48075944, 31.81535155, 43.03027426]), + C=53.514681133664730), + VS_ColorimetryData( + name='VS3', + XYZ=np.array([0.41042219, 0.38688299, 0.06618968]), + Lab=np.array([68.5248742, 13.56049316, 66.82043633]), + C=68.182532115437340), + VS_ColorimetryData( + name='VS4', + XYZ=np.array([0.45420723, 0.50405653, 0.08194422]), + Lab=np.array([76.31757819, -7.04196646, 74.43516148]), + C=74.767523404153394), + VS_ColorimetryData( + name='VS5', + XYZ=np.array([0.42407924, 0.5285824, 0.11437796]), + Lab=np.array([77.79122799, -22.23481106, 67.01388407]), + C=70.606284995201392), + VS_ColorimetryData( + name='VS6', + XYZ=np.array([0.26139991, 0.36817885, 0.11429053]), + Lab=np.array([67.14017484, -33.23131787, 48.67413226]), + C=58.936335472298275), + VS_ColorimetryData( + name='VS7', + XYZ=np.array([0.14989922, 0.24926212, 0.13823798]), + Lab=np.array([57.00345599, -44.54988535, 24.99942632]), + C=51.084866649348065), + VS_ColorimetryData( + name='VS8', + XYZ=np.array([0.15841745, 0.24152639, 0.2693145]), + Lab=np.array([56.24029678, -36.23772472, -1.42733192]), + C=36.265823711788478), + VS_ColorimetryData( + name='VS9', + XYZ=np.array([0.18662804, 0.24704107, 0.40046303]), + Lab=np.array([56.78597628, -23.14117544, -18.29881115]), + C=29.501872653031871), + VS_ColorimetryData( + name='VS10', + XYZ=np.array([0.13339873, 0.15690626, 0.38428046]), + Lab=np.array([46.56595559, -9.85970727, -33.95598605]), + C=35.358490015776226), + VS_ColorimetryData( + name='VS11', + XYZ=np.array([0.09902437, 0.09951361, 0.32046526]), + Lab=np.array([37.75499466, 3.55194161, -40.81669619]), + C=40.970952848102279), + VS_ColorimetryData( + name='VS12', + XYZ=np.array([0.11579654, 0.09612863, 0.31943786]), + Lab=np.array([37.1384526, 18.80505207, -41.7368833]), + C=45.777695561949436), + VS_ColorimetryData( + name='VS13', + XYZ=np.array([0.20977187, 0.16844709, 0.37299873]), + Lab=np.array([48.06376988, 26.00174066, -29.97180426]), + C=39.678704214193381), + VS_ColorimetryData( + name='VS14', + XYZ=np.array([0.32294822, 0.2416386, 0.3623672]), + Lab=np.array([56.25148226, 37.44488177, -14.50799142]), + C=40.157203412534642), + VS_ColorimetryData( + name='VS15', + XYZ=np.array([0.22031646, 0.15367587, 0.17564225]), + Lab=np.array([46.13360422, 39.30141636, -2.12353664]), + C=39.358744081490819) + ], [ + VS_ColorimetryData( + name='VS1', + XYZ=np.array([0.19305453, 0.11049115, 0.04885406]), + Lab=np.array([39.6630702, 53.96236472, 24.65588837]), + C=59.328320706285552), + VS_ColorimetryData( + name='VS2', + XYZ=np.array([0.37202688, 0.27411307, 0.08885906]), + Lab=np.array([59.35311972, 40.92204723, 42.86676601]), + C=59.263594035249184), + VS_ColorimetryData( + name='VS3', + XYZ=np.array([0.42075427, 0.37269638, 0.06621283]), + Lab=np.array([67.47883546, 21.21408713, 65.00772248]), + C=68.381587244419947), + VS_ColorimetryData( + name='VS4', + XYZ=np.array([0.4619684, 0.49480415, 0.08591535]), + Lab=np.array([75.74923125, -2.37840511, 72.10802547]), + C=72.147239367349073), + VS_ColorimetryData( + name='VS5', + XYZ=np.array([0.40817249, 0.508617, 0.11898836]), + Lab=np.array([76.59515887, -21.91694373, 63.69607847]), + C=67.361285873493216), + VS_ColorimetryData( + name='VS6', + XYZ=np.array([0.24671064, 0.36211041, 0.11980563]), + Lab=np.array([66.68086148, -37.45951274, 46.38328397]), + C=59.620668618676035), + VS_ColorimetryData( + name='VS7', + XYZ=np.array([0.1395656, 0.25329693, 0.14475636]), + Lab=np.array([57.39525162, -52.59412462, 24.11379331]), + C=57.858594631617656), + VS_ColorimetryData( + name='VS8', + XYZ=np.array([0.15185552, 0.25077644, 0.28171872]), + Lab=np.array([57.15099443, -44.01580867, -1.76234921]), + C=44.051075894515222), + VS_ColorimetryData( + name='VS9', + XYZ=np.array([0.1814817, 0.25847202, 0.41337786]), + Lab=np.array([57.89173046, -30.60335063, -17.92176409]), + C=35.464837486147871), + VS_ColorimetryData( + name='VS10', + XYZ=np.array([0.1314732, 0.16804591, 0.39334961]), + Lab=np.array([48.0128709, -17.35259857, -32.5683723]), + C=36.902730949943731), + VS_ColorimetryData( + name='VS11', + XYZ=np.array([0.0972772, 0.10656633, 0.32348741]), + Lab=np.array([38.99602774, -3.18915863, -39.09532221]), + C=39.225182616838175), + VS_ColorimetryData( + name='VS12', + XYZ=np.array([0.11499913, 0.09966411, 0.31524145]), + Lab=np.array([37.78207842, 15.46056944, -40.04065396]), + C=42.921826345692601), + VS_ColorimetryData( + name='VS13', + XYZ=np.array([0.23126112, 0.17972713, 0.36052054]), + Lab=np.array([49.46299499, 29.95421157, -25.97562318]), + C=39.648301227414578), + VS_ColorimetryData( + name='VS14', + XYZ=np.array([0.35886253, 0.2560872, 0.35532873]), + Lab=np.array([57.66377054, 43.8380947, -11.16664308]), + C=45.237953807645169), + VS_ColorimetryData( + name='VS15', + XYZ=np.array([0.26550827, 0.17191964, 0.17308227]), + Lab=np.array([48.50100521, 48.80442473, 2.49156155]), + C=48.86798289755771) + ])) + + specification_t = colour_quality_scale( + ILLUMINANTS_SDS['FL1'], + additional_data=True, + method='NIST CQS 9.0') + + np.testing.assert_almost_equal( + [ + data.Q_a + for _index, data in sorted(specification_r.Q_as.items()) + ], + [ + data.Q_a + for _index, data in sorted(specification_t.Q_as.items()) + ], + decimal=7, + ) + if __name__ == '__main__': unittest.main() diff --git a/colour/quality/tests/test_cri.py b/colour/quality/tests/test_cri.py index 8cc7db5fb9..1645a7656e 100644 --- a/colour/quality/tests/test_cri.py +++ b/colour/quality/tests/test_cri.py @@ -5,10 +5,12 @@ from __future__ import division, unicode_literals +import numpy as np import unittest -from colour.quality import colour_rendering_index -from colour.colorimetry import (ILLUMINANTS_SDS, SpectralDistribution) +from colour.quality import CRI_Specification, colour_rendering_index +from colour.colorimetry import ILLUMINANTS_SDS, SpectralDistribution +from colour.quality.cri import TCS_ColorimetryData, TCS_ColourQualityScaleData __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -115,6 +117,11 @@ def test_colour_rendering_index(self): Tests :func:`colour.quality.cri.colour_rendering_index` definition. """ + self.assertAlmostEqual( + colour_rendering_index(ILLUMINANTS_SDS['FL1']), + 75.821550491976069, + places=7) + self.assertAlmostEqual( colour_rendering_index(ILLUMINANTS_SDS['FL2']), 64.151520202968015, @@ -130,6 +137,212 @@ def test_colour_rendering_index(self): 70.813839034481575, places=7) + specification_r = CRI_Specification( + name='FL1', + Q_a=75.821550491976069, + Q_as={ + 1: + TCS_ColourQualityScaleData( + name='TCS01', Q_a=69.146993939830651), + 2: + TCS_ColourQualityScaleData( + name='TCS02', Q_a=83.621259237346464), + 3: + TCS_ColourQualityScaleData( + name='TCS03', Q_a=92.103176674726171), + 4: + TCS_ColourQualityScaleData( + name='TCS04', Q_a=72.659091884741599), + 5: + TCS_ColourQualityScaleData( + name='TCS05', Q_a=73.875477056438399), + 6: + TCS_ColourQualityScaleData( + name='TCS06', Q_a=79.561558275578435), + 7: + TCS_ColourQualityScaleData( + name='TCS07', Q_a=82.238690395582836), + 8: + TCS_ColourQualityScaleData( + name='TCS08', Q_a=53.366156471564040), + 9: + TCS_ColourQualityScaleData( + name='TCS09', Q_a=-47.429377845680563), + 10: + TCS_ColourQualityScaleData( + name='TCS10', Q_a=61.459446471229136), + 11: + TCS_ColourQualityScaleData( + name='TCS11', Q_a=67.488681008259860), + 12: + TCS_ColourQualityScaleData( + name='TCS12', Q_a=74.912512331077920), + 13: + TCS_ColourQualityScaleData( + name='TCS13', Q_a=72.752285379884341), + 14: + TCS_ColourQualityScaleData( + name='TCS14', Q_a=94.874668874605561) + }, + colorimetry_data=([ + TCS_ColorimetryData( + name='TCS01', + XYZ=np.array([31.20331782, 29.74794094, 23.46699878]), + uv=np.array([0.22783485, 0.32581236]), + UVW=np.array([25.41292946, 8.7380799, 60.46264324])), + TCS_ColorimetryData( + name='TCS02', + XYZ=np.array([26.7148606, 29.25905082, 14.00052658]), + uv=np.array([0.21051808, 0.34585016]), + UVW=np.array([11.89933381, 24.70828029, 60.03594595])), + TCS_ColorimetryData( + name='TCS03', + XYZ=np.array([24.20882878, 31.45657446, 9.19966949]), + uv=np.array([0.18492146, 0.36042609]), + UVW=np.array([-8.1256375, 37.50367669, 61.91819636])), + TCS_ColorimetryData( + name='TCS04', + XYZ=np.array([20.75294445, 29.43766611, 19.42067879]), + uv=np.array([0.15946018, 0.33928696]), + UVW=np.array([-27.55034027, 19.3247759, 60.19238635])), + TCS_ColorimetryData( + name='TCS05', + XYZ=np.array([25.10593837, 30.60666903, 37.97182815]), + uv=np.array([0.1678986, 0.30702797]), + UVW=np.array([-21.29395798, -6.63937802, 61.20095038])), + TCS_ColorimetryData( + name='TCS06', + XYZ=np.array([27.45144596, 28.84090621, 55.21254008]), + uv=np.array([0.17549196, 0.27656177]), + UVW=np.array([-14.89855536, -30.53194048, 59.66720711])), + TCS_ColorimetryData( + name='TCS07', + XYZ=np.array([31.31828342, 28.49717267, 51.6262295]), + uv=np.array([0.20414276, 0.27863076]), + UVW=np.array([6.89004159, -28.68174855, 59.36140901])), + TCS_ColorimetryData( + name='TCS08', + XYZ=np.array([33.82293106, 29.92724727, 44.13391542]), + uv=np.array([0.21993884, 0.29190983]), + UVW=np.array([19.28664162, -18.59403459, 60.61796747])), + TCS_ColorimetryData( + name='TCS09', + XYZ=np.array([14.74628552, 9.07383027, 4.24660598]), + uv=np.array([0.36055908, 0.33279417]), + UVW=np.array([74.80963996, 8.5929104, 35.14390587])), + TCS_ColorimetryData( + name='TCS10', + XYZ=np.array([53.38914901, 60.57766887, 10.90608553]), + uv=np.array([0.21467884, 0.36537604]), + UVW=np.array([20.46081762, 54.70909846, 81.18478519])), + TCS_ColorimetryData( + name='TCS11', + XYZ=np.array([12.25740399, 19.77026703, 14.05795099]), + uv=np.array([0.13969138, 0.33796747]), + UVW=np.array([-35.99235266, 15.30093833, 50.59960948])), + TCS_ColorimetryData( + name='TCS12', + XYZ=np.array([5.7789513, 5.68760485, 24.7298429]), + uv=np.array([0.13985629, 0.20646843]), + UVW=np.array([-19.30294902, -39.56090075, 27.62550537])), + TCS_ColorimetryData( + name='TCS13', + XYZ=np.array([56.63907549, 57.50545374, 39.17805]), + uv=np.array([0.21852443, 0.33280062]), + UVW=np.array([23.92148732, 18.87040227, 79.49608348])), + TCS_ColorimetryData( + name='TCS14', + XYZ=np.array([9.42594992, 12.07064446, 5.06612415]), + uv=np.array([0.18330936, 0.35211232]), + UVW=np.array([-6.1238664, 19.9332886, 40.34780872])) + ], [ + TCS_ColorimetryData( + name='TCS01', + XYZ=np.array([33.04406274, 29.80722965, 24.25677014]), + uv=np.array([0.23905009, 0.32345089]), + UVW=np.array([32.11150701, 8.4025005, 60.51407102])), + TCS_ColorimetryData( + name='TCS02', + XYZ=np.array([27.53323581, 28.90793444, 14.76248032]), + uv=np.array([0.21789532, 0.34316182]), + UVW=np.array([15.26809231, 23.59761128, 59.72655443])), + TCS_ColorimetryData( + name='TCS03', + XYZ=np.array([23.95435019, 30.44568852, 9.80615507]), + uv=np.array([0.18785584, 0.35814374]), + UVW=np.array([-8.23625903, 36.01892099, 61.06360597])), + TCS_ColorimetryData( + name='TCS04', + XYZ=np.array([20.43638681, 29.46870454, 21.05101191]), + uv=np.array([0.15552214, 0.33638794]), + UVW=np.array([-33.43495759, 18.48941724, 60.21950681])), + TCS_ColorimetryData( + name='TCS05', + XYZ=np.array([24.95728556, 30.82110743, 39.94366077]), + uv=np.array([0.16443476, 0.30460412]), + UVW=np.array([-26.96894169, -6.51619473, 61.38315768])), + TCS_ColorimetryData( + name='TCS06', + XYZ=np.array([28.15012994, 29.75806707, 57.21213255]), + uv=np.array([0.17426171, 0.27632333]), + UVW=np.array([-18.84311713, -28.6517426, 60.4714316])), + TCS_ColorimetryData( + name='TCS07', + XYZ=np.array([33.29875981, 29.36956806, 52.57688943]), + uv=np.array([0.21089415, 0.27901355]), + UVW=np.array([9.89894512, -26.38829247, 60.13281743])), + TCS_ColorimetryData( + name='TCS08', + XYZ=np.array([37.64824851, 31.35309879, 44.88145951]), + uv=np.array([0.23435348, 0.29275098]), + UVW=np.array([29.03544464, -16.09146766, 61.83156811])), + TCS_ColorimetryData( + name='TCS09', + XYZ=np.array([20.68888349, 11.28578196, 4.29031293]), + uv=np.array([0.40797112, 0.33382225]), + UVW=np.array([106.54776544, 10.69454868, 39.07688665])), + TCS_ColorimetryData( + name='TCS10', + XYZ=np.array([55.03120276, 59.04411929, 11.87116937]), + uv=np.array([0.22546691, 0.36286219]), + UVW=np.array([28.44874091, 52.32328834, 80.34916371])), + TCS_ColorimetryData( + name='TCS11', + XYZ=np.array([12.13121967, 20.3541437, 15.18142797]), + uv=np.array([0.1336819, 0.33644357]), + UVW=np.array([-43.01323833, 15.77519367, 51.25863839])), + TCS_ColorimetryData( + name='TCS12', + XYZ=np.array([6.19245638, 6.41273455, 27.30815071]), + uv=np.array([0.13439371, 0.20876154]), + UVW=np.array([-24.4374163, -39.8151001, 29.44665364])), + TCS_ColorimetryData( + name='TCS13', + XYZ=np.array([58.97285728, 57.14500933, 40.86401249]), + uv=np.array([0.22709381, 0.33008264]), + UVW=np.array([29.75220364, 17.84629845, 79.29404816])), + TCS_ColorimetryData( + name='TCS14', + XYZ=np.array([9.34392028, 11.70931454, 5.33816006]), + uv=np.array([0.1859504, 0.34953505]), + UVW=np.array([-6.3492713, 19.0078073, 39.7697741])) + ])) + + specification_t = colour_rendering_index( + ILLUMINANTS_SDS['FL1'], additional_data=True) + + np.testing.assert_almost_equal( + [ + data.Q_a + for _index, data in sorted(specification_r.Q_as.items()) + ], + [ + data.Q_a + for _index, data in sorted(specification_t.Q_as.items()) + ], + decimal=7, + ) + if __name__ == '__main__': unittest.main() diff --git a/colour/recovery/__init__.py b/colour/recovery/__init__.py index f1c089945a..58c087289c 100644 --- a/colour/recovery/__init__.py +++ b/colour/recovery/__init__.py @@ -15,13 +15,13 @@ from colour.utilities import (CaseInsensitiveMapping, as_float_array, filter_kwargs) -from .dataset import * # noqa -from . import dataset +from .datasets import * # noqa +from . import datasets from .meng2015 import XYZ_to_sd_Meng2015 from .smits1999 import RGB_to_sd_Smits1999 __all__ = [] -__all__ += dataset.__all__ +__all__ += datasets.__all__ __all__ += ['XYZ_to_sd_Meng2015'] __all__ += ['RGB_to_sd_Smits1999'] @@ -97,66 +97,66 @@ def XYZ_to_sd(XYZ, method='Meng 2015', **kwargs): >>> import numpy as np >>> from colour.utilities import numpy_print_options - >>> from colour.colorimetry import sd_to_XYZ_integration + >>> from colour.colorimetry import ( + ... STANDARD_OBSERVERS_CMFS, SpectralShape, sd_to_XYZ_integration) >>> XYZ = np.array([0.21781186, 0.12541048, 0.04697113]) - >>> sd = XYZ_to_sd(XYZ, interval=10) + >>> cmfs = ( + ... STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer']. + ... copy().align(SpectralShape(360, 780, 10)) + ... ) + >>> sd = XYZ_to_sd(XYZ, cmfs=cmfs) >>> with numpy_print_options(suppress=True): ... # Doctests skip for Python 2.x compatibility. ... sd # doctest: +SKIP - SpectralDistribution([[ 360. , 0.0741540...], - [ 370. , 0.0741409...], - [ 380. , 0.0741287...], - [ 390. , 0.0740876...], - [ 400. , 0.0740215...], - [ 410. , 0.0738692...], - [ 420. , 0.0731412...], - [ 430. , 0.0705798...], - [ 440. , 0.0647359...], - [ 450. , 0.0551962...], - [ 460. , 0.0425597...], - [ 470. , 0.0283678...], - [ 480. , 0.0147370...], - [ 490. , 0.0044271...], - [ 500. , 0.0000302...], + SpectralDistribution([[ 360. , 0.0780114...], + [ 370. , 0.0780316...], + [ 380. , 0.0780471...], + [ 390. , 0.0780351...], + [ 400. , 0.0779702...], + [ 410. , 0.0778033...], + [ 420. , 0.0770958...], + [ 430. , 0.0748008...], + [ 440. , 0.0693230...], + [ 450. , 0.0601136...], + [ 460. , 0.0477407...], + [ 470. , 0.0334964...], + [ 480. , 0.0193352...], + [ 490. , 0.0074858...], + [ 500. , 0.0001225...], [ 510. , 0. ...], [ 520. , 0. ...], [ 530. , 0. ...], - [ 540. , 0.0051962...], - [ 550. , 0.0289516...], - [ 560. , 0.0687006...], - [ 570. , 0.1204130...], - [ 580. , 0.1789378...], - [ 590. , 0.2383451...], - [ 600. , 0.2930157...], - [ 610. , 0.3387433...], - [ 620. , 0.3734033...], - [ 630. , 0.3972820...], - [ 640. , 0.4125508...], - [ 650. , 0.4215782...], - [ 660. , 0.4265503...], - [ 670. , 0.4292647...], - [ 680. , 0.4307000...], - [ 690. , 0.4313993...], - [ 700. , 0.4316316...], - [ 710. , 0.4317109...], - [ 720. , 0.4317684...], - [ 730. , 0.4317864...], - [ 740. , 0.4317972...], - [ 750. , 0.4318385...], - [ 760. , 0.4318576...], - [ 770. , 0.4318455...], - [ 780. , 0.4317877...], - [ 790. , 0.4318119...], - [ 800. , 0.4318070...], - [ 810. , 0.4318089...], - [ 820. , 0.4317781...], - [ 830. , 0.4317733...]], + [ 540. , 0.0124896...], + [ 550. , 0.0389831...], + [ 560. , 0.0775105...], + [ 570. , 0.1247947...], + [ 580. , 0.1765339...], + [ 590. , 0.2281918...], + [ 600. , 0.2751347...], + [ 610. , 0.3140115...], + [ 620. , 0.3433561...], + [ 630. , 0.3635777...], + [ 640. , 0.3765428...], + [ 650. , 0.3841726...], + [ 660. , 0.3883633...], + [ 670. , 0.3905415...], + [ 680. , 0.3916742...], + [ 690. , 0.3922554...], + [ 700. , 0.3925427...], + [ 710. , 0.3926783...], + [ 720. , 0.3927330...], + [ 730. , 0.3927586...], + [ 740. , 0.3927548...], + [ 750. , 0.3927681...], + [ 760. , 0.3927813...], + [ 770. , 0.3927840...], + [ 780. , 0.3927536...]], interpolator=SpragueInterpolator, interpolator_args={}, extrapolator=Extrapolator, extrapolator_args={...}) >>> sd_to_XYZ_integration(sd) / 100 # doctest: +ELLIPSIS - array([ 0.2178552..., 0.1254142..., 0.0470105...]) + array([ 0.2178545..., 0.1254141..., 0.0470095...]) *Smits (1999)* reflectance recovery: @@ -178,7 +178,7 @@ def XYZ_to_sd(XYZ, method='Meng 2015', **kwargs): extrapolator=Extrapolator, extrapolator_args={...}) >>> sd_to_XYZ_integration(sd) / 100 # doctest: +ELLIPSIS - array([ 0.2004540..., 0.1105632..., 0.0420963...]) + array([ 0.2004523..., 0.1105627..., 0.0420964...]) """ a = as_float_array(XYZ) diff --git a/colour/recovery/dataset/__init__.py b/colour/recovery/datasets/__init__.py similarity index 100% rename from colour/recovery/dataset/__init__.py rename to colour/recovery/datasets/__init__.py diff --git a/colour/recovery/dataset/smits1999.py b/colour/recovery/datasets/smits1999.py similarity index 98% rename from colour/recovery/dataset/smits1999.py rename to colour/recovery/datasets/smits1999.py index 1c1e653776..604b5fb710 100644 --- a/colour/recovery/dataset/smits1999.py +++ b/colour/recovery/datasets/smits1999.py @@ -3,7 +3,7 @@ Smits (1999) - Reflectance Recovery Dataset =========================================== -Defines the dataset for reflectance recovery using *Smits (1999)* method. +Defines the datasets for reflectance recovery using *Smits (1999)* method. References ---------- diff --git a/colour/recovery/meng2015.py b/colour/recovery/meng2015.py index a46718798a..bc8dca1678 100644 --- a/colour/recovery/meng2015.py +++ b/colour/recovery/meng2015.py @@ -28,7 +28,7 @@ from colour.colorimetry import (STANDARD_OBSERVERS_CMFS, SpectralDistribution, SpectralShape, sd_ones, sd_to_XYZ_integration) -from colour.utilities import to_domain_1, from_range_100 +from colour.utilities import to_domain_1, from_range_100, runtime_warning __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -37,13 +37,22 @@ __email__ = 'colour-science@googlegroups.com' __status__ = 'Production' -__all__ = ['XYZ_to_sd_Meng2015'] +__all__ = ['DEFAULT_SPECTRAL_SHAPE_MENG_2015', 'XYZ_to_sd_Meng2015'] + +DEFAULT_SPECTRAL_SHAPE_MENG_2015 = SpectralShape(360, 780, 5) +""" +Default spectral shape according to *ASTM E308-15* practise shape but using an +interval of 5. + +DEFAULT_SPECTRAL_SHAPE_MENG_2015 : SpectralShape +""" def XYZ_to_sd_Meng2015( XYZ, - cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'], - interval=5, + cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] + .copy().align(DEFAULT_SPECTRAL_SHAPE_MENG_2015), + illuminant=sd_ones(DEFAULT_SPECTRAL_SHAPE_MENG_2015), optimisation_parameters=None): """ Recovers the spectral distribution of given *CIE XYZ* tristimulus values @@ -54,10 +63,12 @@ def XYZ_to_sd_Meng2015( XYZ : array_like, (3,) *CIE XYZ* tristimulus values to recover the spectral distribution from. cmfs : XYZ_ColourMatchingFunctions - Standard observer colour matching functions. - interval : numeric, optional - Wavelength :math:`\\lambda_{i}` range interval in nm. The smaller - ``interval`` is, the longer the computations will be. + Standard observer colour matching functions. The wavelength + :math:`\\lambda_{i}` range interval of the colour matching functions + affects directly the time the computations take. The current default + interval of 5 is a good compromise between precision and time spent. + illuminant : SpectralDistribution, optional + Illuminant spectral distribution. optimisation_parameters : dict_like, optional Parameters for :func:`scipy.optimize.minimize` definition. @@ -78,7 +89,7 @@ def XYZ_to_sd_Meng2015( - The definition used to convert spectrum to *CIE XYZ* tristimulus values is :func:`colour.colorimetry.spectral_to_XYZ_integration` definition because it processes any measurement interval opposed to - :func:`colour.colorimetry.sd_to_XYZ_ASTME30815` definition that + :func:`colour.colorimetry.sd_to_XYZ_ASTME308` definition that handles only measurement interval of 1, 5, 10 or 20nm. References @@ -89,71 +100,74 @@ def XYZ_to_sd_Meng2015( -------- >>> from colour.utilities import numpy_print_options >>> XYZ = np.array([0.20654008, 0.12197225, 0.05136952]) - >>> sd = XYZ_to_sd_Meng2015(XYZ, interval=10) + >>> cmfs = ( + ... STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer']. + ... copy().align(SpectralShape(360, 780, 10)) + ... ) + >>> sd = XYZ_to_sd_Meng2015(XYZ, cmfs) >>> with numpy_print_options(suppress=True): ... # Doctests skip for Python 2.x compatibility. ... sd # doctest: +SKIP - SpectralDistribution([[ 360. , 0.0780368...], - [ 370. , 0.0780387...], - [ 380. , 0.0780469...], - [ 390. , 0.0780894...], - [ 400. , 0.0780285...], - [ 410. , 0.0777034...], - [ 420. , 0.0769175...], - [ 430. , 0.0746243...], - [ 440. , 0.0691410...], - [ 450. , 0.0599949...], - [ 460. , 0.04779 ...], - [ 470. , 0.0337270...], - [ 480. , 0.0196952...], - [ 490. , 0.0078056...], - [ 500. , 0.0004368...], - [ 510. , 0.0000065...], + SpectralDistribution([[ 360. , 0.0780114...], + [ 370. , 0.0780316...], + [ 380. , 0.0780471...], + [ 390. , 0.0780351...], + [ 400. , 0.0779702...], + [ 410. , 0.0778033...], + [ 420. , 0.0770958...], + [ 430. , 0.0748008...], + [ 440. , 0.0693230...], + [ 450. , 0.0601136...], + [ 460. , 0.0477407...], + [ 470. , 0.0334964...], + [ 480. , 0.0193352...], + [ 490. , 0.0074858...], + [ 500. , 0.0001225...], + [ 510. , 0. ...], [ 520. , 0. ...], [ 530. , 0. ...], - [ 540. , 0.0124283...], - [ 550. , 0.0389186...], - [ 560. , 0.0774087...], - [ 570. , 0.1246716...], - [ 580. , 0.1765055...], - [ 590. , 0.2281652...], - [ 600. , 0.2751726...], - [ 610. , 0.3141208...], - [ 620. , 0.3434564...], - [ 630. , 0.3636521...], - [ 640. , 0.3765182...], - [ 650. , 0.3841561...], - [ 660. , 0.3884648...], - [ 670. , 0.3906975...], - [ 680. , 0.3918679...], - [ 690. , 0.3924590...], - [ 700. , 0.3927439...], - [ 710. , 0.3928570...], - [ 720. , 0.3928867...], - [ 730. , 0.3929099...], - [ 740. , 0.3928997...], - [ 750. , 0.3928827...], - [ 760. , 0.3928579...], - [ 770. , 0.3927857...], - [ 780. , 0.3927272...], - [ 790. , 0.3926867...], - [ 800. , 0.3926441...], - [ 810. , 0.3926385...], - [ 820. , 0.3926247...], - [ 830. , 0.3926105...]], + [ 540. , 0.0124896...], + [ 550. , 0.0389831...], + [ 560. , 0.0775105...], + [ 570. , 0.1247947...], + [ 580. , 0.1765339...], + [ 590. , 0.2281918...], + [ 600. , 0.2751347...], + [ 610. , 0.3140115...], + [ 620. , 0.3433561...], + [ 630. , 0.3635777...], + [ 640. , 0.3765428...], + [ 650. , 0.3841726...], + [ 660. , 0.3883633...], + [ 670. , 0.3905415...], + [ 680. , 0.3916742...], + [ 690. , 0.3922554...], + [ 700. , 0.3925427...], + [ 710. , 0.3926783...], + [ 720. , 0.3927330...], + [ 730. , 0.3927586...], + [ 740. , 0.3927548...], + [ 750. , 0.3927681...], + [ 760. , 0.3927813...], + [ 770. , 0.3927840...], + [ 780. , 0.3927536...]], interpolator=SpragueInterpolator, interpolator_args={}, extrapolator=Extrapolator, extrapolator_args={...}) >>> sd_to_XYZ_integration(sd) / 100 # doctest: +ELLIPSIS - array([ 0.2065817..., 0.1219754..., 0.0514131...]) + array([ 0.2065812..., 0.1219752..., 0.0514132...]) """ XYZ = to_domain_1(XYZ) - shape = SpectralShape(cmfs.shape.start, cmfs.shape.end, interval) - cmfs = cmfs.copy().align(shape) - illuminant = sd_ones(shape) - sd = sd_ones(shape) + + if illuminant.shape != cmfs.shape: + runtime_warning( + 'Aligning "{0}" illuminant shape to "{1}" colour matching ' + 'functions shape.'.format(illuminant.name, cmfs.name)) + illuminant = illuminant.copy().align(cmfs.shape) + + sd = sd_ones(cmfs.shape) def objective_function(a): """ @@ -183,7 +197,6 @@ def constraint_function(a): 'bounds': np.tile(np.array([0, 1000]), (bins, 1)), 'options': { 'ftol': 1e-10, - 'maxiter': 2000 }, } if optimisation_parameters is not None: diff --git a/colour/recovery/smits1999.py b/colour/recovery/smits1999.py index 18f7cfb924..2e33fe5a0c 100644 --- a/colour/recovery/smits1999.py +++ b/colour/recovery/smits1999.py @@ -94,7 +94,7 @@ def XYZ_to_RGB_Smits1999(XYZ): SMITS1999_WHITEPOINT, SMITS1999_WHITEPOINT, SMITS1999_XYZ_TO_RGB_MATRIX, - encoding_cctf=None) + cctf_encoding=None) def RGB_to_sd_Smits1999(RGB): diff --git a/colour/recovery/tests/test__init__.py b/colour/recovery/tests/test__init__.py index 9b71fcdb99..b5f348997d 100644 --- a/colour/recovery/tests/test__init__.py +++ b/colour/recovery/tests/test__init__.py @@ -10,8 +10,9 @@ import unittest from six.moves import zip -from colour.colorimetry import sd_to_XYZ_integration +from colour.colorimetry import STANDARD_OBSERVERS_CMFS, sd_to_XYZ_integration from colour.recovery import XYZ_to_sd +from colour.recovery.meng2015 import DEFAULT_SPECTRAL_SHAPE_MENG_2015 from colour.utilities import domain_range_scale __author__ = 'Colour Developers' @@ -36,9 +37,14 @@ def test_domain_range_scale_XYZ_to_sd(self): and range scale support. """ + cmfs = (STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] + .copy().align(DEFAULT_SPECTRAL_SHAPE_MENG_2015)) + XYZ = np.array([0.20654008, 0.12197225, 0.05136952]) m = ('Smits 1999', 'Meng 2015') - v = [sd_to_XYZ_integration(XYZ_to_sd(XYZ, method)) for method in m] + v = [ + sd_to_XYZ_integration(XYZ_to_sd(XYZ, method), cmfs) for method in m + ] d_r = (('reference', 1, 1), (1, 1, 0.01), (100, 100, 1)) for method, value in zip(m, v): @@ -46,7 +52,7 @@ def test_domain_range_scale_XYZ_to_sd(self): with domain_range_scale(scale): np.testing.assert_almost_equal( sd_to_XYZ_integration( - XYZ_to_sd(XYZ * factor_a, method=method)), + XYZ_to_sd(XYZ * factor_a, method), cmfs), value * factor_b, decimal=7) diff --git a/colour/recovery/tests/test_meng2015.py b/colour/recovery/tests/test_meng2015.py index e06b8833fd..07863268b6 100644 --- a/colour/recovery/tests/test_meng2015.py +++ b/colour/recovery/tests/test_meng2015.py @@ -8,8 +8,9 @@ import numpy as np import unittest -from colour.colorimetry import (STANDARD_OBSERVERS_CMFS, SpectralShape, - sd_to_XYZ_integration) +from colour.colorimetry import (DEFAULT_SPECTRAL_SHAPE, + STANDARD_OBSERVERS_CMFS, SpectralShape, + ILLUMINANTS_SDS, sd_to_XYZ_integration) from colour.recovery import XYZ_to_sd_Meng2015 from colour.utilities import domain_range_scale @@ -35,22 +36,31 @@ def test_XYZ_to_sd_Meng2015(self): definition. """ - cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] + cmfs = (STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] + .copy().trim(DEFAULT_SPECTRAL_SHAPE)) shape = SpectralShape(cmfs.shape.start, cmfs.shape.end, 5) cmfs_c = cmfs.copy().align(shape) XYZ = np.array([0.21781186, 0.12541048, 0.04697113]) np.testing.assert_almost_equal( - sd_to_XYZ_integration(XYZ_to_sd_Meng2015(XYZ), cmfs=cmfs_c) / 100, + sd_to_XYZ_integration(XYZ_to_sd_Meng2015(XYZ, cmfs_c), cmfs_c) / + 100, XYZ, decimal=7) shape = SpectralShape(cmfs.shape.start, cmfs.shape.end, 10) cmfs_c = cmfs.copy().align(shape) + np.testing.assert_almost_equal( + sd_to_XYZ_integration(XYZ_to_sd_Meng2015(XYZ, cmfs_c), cmfs_c) / + 100, + XYZ, + decimal=7) + np.testing.assert_almost_equal( sd_to_XYZ_integration( - XYZ_to_sd_Meng2015(XYZ, interval=10), cmfs=cmfs_c) / 100, + XYZ_to_sd_Meng2015(XYZ, cmfs_c, ILLUMINANTS_SDS['D65']), + cmfs_c, ILLUMINANTS_SDS['D65']) / 100, XYZ, decimal=7) @@ -58,25 +68,37 @@ def test_XYZ_to_sd_Meng2015(self): sd_to_XYZ_integration( XYZ_to_sd_Meng2015( XYZ, - interval=10, - optimisation_parameters={ - 'options': { - 'ftol': 1e-10, - 'maxiter': 2000 - } - }), - cmfs=cmfs_c) / 100, + cmfs_c, + optimisation_parameters={'options': { + 'ftol': 1e-10, + }}), cmfs_c) / 100, XYZ, decimal=7) shape = SpectralShape(400, 700, 5) cmfs_c = cmfs.copy().align(shape) np.testing.assert_almost_equal( - sd_to_XYZ_integration( - XYZ_to_sd_Meng2015(XYZ, cmfs=cmfs_c), cmfs=cmfs_c) / 100, + sd_to_XYZ_integration(XYZ_to_sd_Meng2015(XYZ, cmfs_c), cmfs_c) / + 100, XYZ, decimal=7) + def test_raise_exception_XYZ_to_sd_Meng2015(self): + """ + Tests :func:`colour.recovery.meng2015.XYZ_to_sd_Meng2015` + definition raised exception. + """ + + self.assertRaises( + RuntimeError, + XYZ_to_sd_Meng2015, + np.array([0.0, 0.0, 1.0]), + optimisation_parameters={ + 'options': { + 'maxiter': 10 + }, + }) + def test_domain_range_scale_XYZ_to_sd_Meng2015(self): """ Tests :func:`colour.recovery.meng2015.XYZ_to_sd_Meng2015` diff --git a/colour/recovery/tests/test_smits1999.py b/colour/recovery/tests/test_smits1999.py index 08a9e70c2c..72a9ec3467 100644 --- a/colour/recovery/tests/test_smits1999.py +++ b/colour/recovery/tests/test_smits1999.py @@ -65,6 +65,33 @@ def test_RGB_to_sd_Smits1999(self): ]), decimal=7) + np.testing.assert_almost_equal( + RGB_to_sd_Smits1999( + XYZ_to_RGB_Smits1999(np.array([0.0, 1.0, 0.0]))).values, + np.array([ + -0.2549796, -0.2848386, -0.1634905, 1.5254829, 1.9800433, + 1.8510762, -0.7327702, -1.2758621, -1.2758621, -1.2703551 + ]), + decimal=7) + + np.testing.assert_almost_equal( + RGB_to_sd_Smits1999( + XYZ_to_RGB_Smits1999(np.array([1.0, 1.0, 0.0]))).values, + np.array([ + -0.1168428, -0.1396982, -0.0414535, 0.581391, 0.9563091, + 0.9562111, 1.3366949, 1.3742666, 1.3853491, 1.4027005 + ]), + decimal=7) + + np.testing.assert_almost_equal( + RGB_to_sd_Smits1999( + XYZ_to_RGB_Smits1999(np.array([0.5, 0.0, 1.0]))).values, + np.array([ + 1.1938776, 1.1938776, 1.1213867, -0.067889, -0.4668587, + -0.4030985, 0.703056, 0.9407334, 0.9437298, 0.9383386 + ]), + decimal=7) + def test_domain_range_scale_RGB_to_sd_Smits1999(self): """ Tests :func:`colour.recovery.smits1999.RGB_to_sd_Smits1999` diff --git a/colour/temperature/__init__.py b/colour/temperature/__init__.py index d0ab0c531e..b09363e257 100644 --- a/colour/temperature/__init__.py +++ b/colour/temperature/__init__.py @@ -2,23 +2,330 @@ from __future__ import absolute_import -from .cct import CCT_TO_UV_METHODS, UV_TO_CCT_METHODS -from .cct import CCT_to_uv -from .cct import (CCT_to_uv_Ohno2013, CCT_to_uv_Robertson1968, - CCT_to_uv_Krystek1985) -from .cct import uv_to_CCT -from .cct import uv_to_CCT_Ohno2013, uv_to_CCT_Robertson1968 -from .cct import CCT_TO_XY_METHODS, XY_TO_CCT_METHODS -from .cct import CCT_to_xy -from .cct import CCT_to_xy_Kang2002, CCT_to_xy_CIE_D -from .cct import xy_to_CCT -from .cct import xy_to_CCT_McCamy1992, xy_to_CCT_Hernandez1999 - -__all__ = [ - 'CCT_TO_UV_METHODS', 'UV_TO_CCT_METHODS', 'CCT_to_uv', - 'CCT_to_uv_Ohno2013', 'CCT_to_uv_Robertson1968', 'CCT_to_uv_Krystek1985', - 'uv_to_CCT', 'uv_to_CCT_Ohno2013', 'uv_to_CCT_Robertson1968', - 'CCT_TO_XY_METHODS', 'XY_TO_CCT_METHODS', 'CCT_to_xy', - 'CCT_to_xy_Kang2002', 'CCT_to_xy_CIE_D', 'xy_to_CCT', - 'xy_to_CCT_McCamy1992', 'xy_to_CCT_Hernandez1999' -] +from colour.utilities import CaseInsensitiveMapping, filter_kwargs + +from .cie_d import xy_to_CCT_CIE_D, CCT_to_xy_CIE_D +from .hernandez1999 import xy_to_CCT_Hernandez1999, CCT_to_xy_Hernandez1999 +from .kang2002 import xy_to_CCT_Kang2002, CCT_to_xy_Kang2002 +from .krystek1985 import uv_to_CCT_Krystek1985, CCT_to_uv_Krystek1985 +from .mccamy1992 import xy_to_CCT_McCamy1992, CCT_to_xy_McCamy1992 +from .ohno2013 import uv_to_CCT_Ohno2013, CCT_to_uv_Ohno2013 +from .robertson1968 import uv_to_CCT_Robertson1968, CCT_to_uv_Robertson1968 + +__all__ = ['xy_to_CCT_CIE_D', 'CCT_to_xy_CIE_D'] +__all__ += ['xy_to_CCT_Hernandez1999', 'CCT_to_xy_Hernandez1999'] +__all__ += ['xy_to_CCT_Kang2002', 'CCT_to_xy_Kang2002'] +__all__ += ['uv_to_CCT_Krystek1985', 'CCT_to_uv_Krystek1985'] +__all__ += ['xy_to_CCT_McCamy1992', 'CCT_to_xy_McCamy1992'] +__all__ += ['uv_to_CCT_Ohno2013', 'CCT_to_uv_Ohno2013'] +__all__ += ['uv_to_CCT_Robertson1968', 'CCT_to_uv_Robertson1968'] + +UV_TO_CCT_METHODS = CaseInsensitiveMapping({ + 'Krystek 1985': uv_to_CCT_Krystek1985, + 'Ohno 2013': uv_to_CCT_Ohno2013, + 'Robertson 1968': uv_to_CCT_Robertson1968 +}) +UV_TO_CCT_METHODS.__doc__ = """ +Supported *CIE UCS* colourspace *uv* chromaticity coordinates to correlated +colour temperature :math:`T_{cp}` computation methods. + +References +---------- +:cite:`AdobeSystems2013`, :cite:`AdobeSystems2013a`, :cite:`Ohno2014a`, +:cite:`Wyszecki2000y` + +UV_TO_CCT_METHODS : CaseInsensitiveMapping + **{'Ohno 2013', 'Krystek 1985, 'Robertson 1968'}** + +Aliases: + +- 'ohno2013': 'Ohno 2013' +- 'robertson1968': 'Robertson 1968' +""" +UV_TO_CCT_METHODS['ohno2013'] = UV_TO_CCT_METHODS['Ohno 2013'] +UV_TO_CCT_METHODS['robertson1968'] = UV_TO_CCT_METHODS['Robertson 1968'] + + +def uv_to_CCT(uv, method='Ohno 2013', **kwargs): + """ + Returns the correlated colour temperature :math:`T_{cp}` and + :math:`\\Delta_{uv}` from given *CIE UCS* colourspace *uv* chromaticity + coordinates using given method. + + Parameters + ---------- + uv : array_like + *CIE UCS* colourspace *uv* chromaticity coordinates. + method : unicode, optional + **{'Ohno 2013', 'Krystek 1985, 'Robertson 1968'}**, + Computation method. + + Other Parameters + ---------------- + cmfs : XYZ_ColourMatchingFunctions, optional + {:func:`colour.temperature.uv_to_CCT_Ohno2013`}, + Standard observer colour matching functions. + start : numeric, optional + {:func:`colour.temperature.uv_to_CCT_Ohno2013`}, + Temperature range start in kelvins. + end : numeric, optional + {:func:`colour.temperature.uv_to_CCT_Ohno2013`}, + Temperature range end in kelvins. + count : int, optional + {:func:`colour.temperature.uv_to_CCT_Ohno2013`}, + Temperatures count in the planckian tables. + iterations : int, optional + {:func:`colour.temperature.uv_to_CCT_Ohno2013`}, + Number of planckian tables to generate. + optimisation_parameters : dict_like, optional + {:func:`colour.temperature.uv_to_CCT_Krystek1985`}, + Parameters for :func:`scipy.optimize.minimize` definition. + + Returns + ------- + ndarray + Correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}`. + + References + ---------- + :cite:`AdobeSystems2013`, :cite:`AdobeSystems2013a`, :cite:`Krystek1985b`, + :cite:`Ohno2014a`, :cite:`Wyszecki2000y` + + Examples + -------- + >>> import numpy as np + >>> uv = np.array([0.1978, 0.3122]) + >>> uv_to_CCT(uv) # doctest: +ELLIPSIS + array([ 6.5074738...e+03, 3.2233461...e-03]) + """ + + function = UV_TO_CCT_METHODS[method] + + return function(uv, **filter_kwargs(function, **kwargs)) + + +CCT_TO_UV_METHODS = CaseInsensitiveMapping({ + 'Krystek 1985': CCT_to_uv_Krystek1985, + 'Ohno 2013': CCT_to_uv_Ohno2013, + 'Robertson 1968': CCT_to_uv_Robertson1968 +}) +CCT_TO_UV_METHODS.__doc__ = """ +Supported correlated colour temperature :math:`T_{cp}` to *CIE UCS* colourspace +*uv* chromaticity coordinates computation methods. + +References +---------- +:cite:`AdobeSystems2013`, :cite:`AdobeSystems2013a`, :cite:`Krystek1985b`, +:cite:`Ohno2014a`, :cite:`Wyszecki2000y` + +CCT_TO_UV_METHODS : CaseInsensitiveMapping + **{'Ohno 2013', 'Krystek 1985, 'Robertson 1968'}** + +Aliases: + +- 'ohno2013': 'Ohno 2013' +- 'robertson1968': 'Robertson 1968' +""" +CCT_TO_UV_METHODS['ohno2013'] = CCT_TO_UV_METHODS['Ohno 2013'] +CCT_TO_UV_METHODS['robertson1968'] = CCT_TO_UV_METHODS['Robertson 1968'] + + +def CCT_to_uv(CCT_D_uv, method='Ohno 2013', **kwargs): + """ + Returns the *CIE UCS* colourspace *uv* chromaticity coordinates from given + correlated colour temperature :math:`T_{cp}` using given method. + + Parameters + ---------- + CCT_D_uv : ndarray + Correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}`. + method : unicode, optional + **{'Ohno 2013', 'Robertson 1968', 'Krystek 1985}**, + Computation method. + + Other Parameters + ---------------- + cmfs : XYZ_ColourMatchingFunctions, optional + {:func:`colour.temperature.CCT_to_uv_Ohno2013`}, + Standard observer colour matching functions. + + Returns + ------- + ndarray + *CIE UCS* colourspace *uv* chromaticity coordinates. + + References + ---------- + :cite:`AdobeSystems2013`, :cite:`AdobeSystems2013a`, :cite:`Krystek1985b`, + :cite:`Ohno2014a`, :cite:`Wyszecki2000y` + + Examples + -------- + >>> import numpy as np + >>> CCT_D_uv = np.array([6507.47380460, 0.00322335]) + >>> CCT_to_uv(CCT_D_uv) # doctest: +ELLIPSIS + array([ 0.1977999..., 0.3121999...]) + """ + + function = CCT_TO_UV_METHODS[method] + + return function(CCT_D_uv, **filter_kwargs(function, **kwargs)) + + +__all__ += ['UV_TO_CCT_METHODS', 'uv_to_CCT'] +__all__ += ['CCT_TO_UV_METHODS', 'CCT_to_uv'] + +XY_TO_CCT_METHODS = CaseInsensitiveMapping({ + 'CIE Illuminant D Series': xy_to_CCT_CIE_D, + 'Hernandez 1999': xy_to_CCT_Hernandez1999, + 'Kang 2002': xy_to_CCT_Kang2002, + 'McCamy 1992': xy_to_CCT_McCamy1992, +}) +XY_TO_CCT_METHODS.__doc__ = """ +Supported *CIE xy* chromaticity coordinates to correlated colour temperature +:math:`T_{cp}` computation methods. + +References +---------- +:cite:`Hernandez-Andres1999a`, :cite:`Kang2002a`, :cite:`Wikipedia2001`, +:cite:`Wikipedia2001a`, +:cite:`Wyszecki2000z` + +XY_TO_CCT_METHODS : CaseInsensitiveMapping + **{'McCamy 1992', 'CIE Illuminant D Series, 'Kang 2002', + 'Hernandez 1999'}** + +Aliases: + +- 'daylight': 'CIE Illuminant D Series' +- 'kang2002': 'Kang 2002' +- 'mccamy1992': 'McCamy 1992' +- 'hernandez1999': 'Hernandez 1999' +""" +XY_TO_CCT_METHODS['daylight'] = XY_TO_CCT_METHODS['CIE Illuminant D Series'] +XY_TO_CCT_METHODS['kang2002'] = XY_TO_CCT_METHODS['Kang 2002'] +XY_TO_CCT_METHODS['mccamy1992'] = XY_TO_CCT_METHODS['McCamy 1992'] +XY_TO_CCT_METHODS['hernandez1999'] = XY_TO_CCT_METHODS['Hernandez 1999'] + + +def xy_to_CCT(xy, method='CIE Illuminant D Series'): + """ + Returns the correlated colour temperature :math:`T_{cp}` from given + *CIE xy* chromaticity coordinates using given method. + + Parameters + ---------- + xy : array_like + *CIE xy* chromaticity coordinates. + method : unicode, optional + **{'CIE Illuminant D Series', 'Kang 2002', 'Hernandez 1999', + 'McCamy 1992'}**, + Computation method. + + Other Parameters + ---------------- + optimisation_parameters : dict_like, optional + {:func:`colour.temperature.xy_to_CCT_CIE_D`, + :func:`colour.temperature.xy_to_CCT_Kang2002`}, + Parameters for :func:`scipy.optimize.minimize` definition. + + Returns + ------- + numeric or ndarray + Correlated colour temperature :math:`T_{cp}`. + + References + ---------- + :cite:`Hernandez-Andres1999a`, :cite:`Kang2002a`, :cite:`Wikipedia2001`, + :cite:`Wikipedia2001a`, :cite:`Wyszecki2000z` + + Examples + -------- + >>> import numpy as np + >>> xy_to_CCT(np.array([0.31270, 0.32900])) # doctest: +ELLIPSIS + 6508.1175148... + >>> xy_to_CCT(np.array([0.31270, 0.32900]), 'Hernandez 1999') + ... # doctest: +ELLIPSIS + 6500.7420431... + """ + + return XY_TO_CCT_METHODS.get(method)(xy) + + +CCT_TO_XY_METHODS = CaseInsensitiveMapping({ + 'CIE Illuminant D Series': CCT_to_xy_CIE_D, + 'Hernandez 1999': CCT_to_xy_Hernandez1999, + 'Kang 2002': CCT_to_xy_Kang2002, + 'McCamy 1992': CCT_to_xy_McCamy1992, +}) +CCT_TO_XY_METHODS.__doc__ = """ +Supported correlated colour temperature :math:`T_{cp}` to *CIE xy* chromaticity +coordinates computation methods. + +References +---------- +:cite:`Hernandez-Andres1999a`, :cite:`Kang2002a`, :cite:`Wikipedia2001`, +:cite:`Wikipedia2001a`, :cite:`Wyszecki2000z` + +CCT_TO_XY_METHODS : CaseInsensitiveMapping + **{'Kang 2002', 'CIE Illuminant D Series', 'Hernandez 1999', + 'McCamy 1992'}** + +Aliases: + +- 'daylight': 'CIE Illuminant D Series' +- 'kang2002': 'Kang 2002' +- 'mccamy1992': 'McCamy 1992' +- 'hernandez1999': 'Hernandez 1999' +""" +CCT_TO_XY_METHODS['daylight'] = CCT_TO_XY_METHODS['CIE Illuminant D Series'] +CCT_TO_XY_METHODS['kang2002'] = CCT_TO_XY_METHODS['Kang 2002'] +CCT_TO_XY_METHODS['mccamy1992'] = CCT_TO_XY_METHODS['McCamy 1992'] +CCT_TO_XY_METHODS['hernandez1999'] = CCT_TO_XY_METHODS['Hernandez 1999'] + + +def CCT_to_xy(CCT, method='CIE Illuminant D Series'): + """ + Returns the *CIE xy* chromaticity coordinates from given correlated colour + temperature :math:`T_{cp}` using given method. + + Parameters + ---------- + CCT : numeric or array_like + Correlated colour temperature :math:`T_{cp}`. + method : unicode, optional + **{'CIE Illuminant D Series', 'Hernandez 1999', 'Kang 2002', + 'McCamy 1992'}**, + Computation method. + + Other Parameters + ---------------- + optimisation_parameters : dict_like, optional + {:func:`colour.temperature.CCT_to_xy_Hernandez1999`, + :func:`colour.temperature.CCT_to_xy_McCamy1992`}, + Parameters for :func:`scipy.optimize.minimize` definition. + + Returns + ------- + ndarray + *CIE xy* chromaticity coordinates. + + References + ---------- + :cite:`Hernandez-Andres1999a`, :cite:`Kang2002a`, :cite:`Wikipedia2001`, + :cite:`Wikipedia2001a`, :cite:`Wyszecki2000z` + + Examples + -------- + >>> CCT_to_xy(6504.38938305) # doctest: +ELLIPSIS + array([ 0.3127077..., 0.3291128...]) + >>> CCT_to_xy(6504.38938305, 'Kang 2002') + ... # doctest: +ELLIPSIS + array([ 0.313426 ..., 0.3235959...]) + """ + + return CCT_TO_XY_METHODS.get(method)(CCT) + + +__all__ += ['XY_TO_CCT_METHODS', 'xy_to_CCT'] +__all__ += ['CCT_TO_XY_METHODS', 'CCT_to_xy'] diff --git a/colour/temperature/cct.py b/colour/temperature/cct.py deleted file mode 100644 index 3491963950..0000000000 --- a/colour/temperature/cct.py +++ /dev/null @@ -1,1230 +0,0 @@ -# -*- coding: utf-8 -*- -""" -Correlated Colour Temperature :math:`T_{cp}` -============================================ - -Defines correlated colour temperature :math:`T_{cp}` computations objects: - -- :func:`colour.temperature.uv_to_CCT_Ohno2013`: Correlated colour - temperature :math:`T_{cp}` and :math:`\\Delta_{uv}` computation of given - *CIE UCS* colourspace *uv* chromaticity coordinates using *Ohno (2013)* - method. -- :func:`colour.temperature.CCT_to_uv_Ohno2013`: *CIE UCS* colourspace *uv* - chromaticity coordinates computation of given correlated colour temperature - :math:`T_{cp}`, :math:`\\Delta_{uv}` using *Ohno (2013)* method. -- :func:`colour.temperature.uv_to_CCT_Robertson1968`: Correlated colour - temperature :math:`T_{cp}` and :math:`\\Delta_{uv}` computation of given - *CIE UCS* colourspace *uv* chromaticity coordinates using - *Robertson (1968)* method. -- :func:`colour.temperature.CCT_to_uv_Robertson1968`: *CIE UCS* colourspace - *uv* chromaticity coordinates computation of given correlated colour - temperature :math:`T_{cp}` and :math:`\\Delta_{uv}` using - *Robertson (1968)* method. -- :attr:`colour.UV_TO_CCT_METHODS`: Supported *CIE UCS* colourspace *uv* - chromaticity coordinates to correlated colour temperature :math:`T_{cp}` - computation methods. -- :func:`colour.uv_to_CCT`: Correlated colour temperature :math:`T_{cp}` and - :math:`\\Delta_{uv}` computation from given *CIE UCS* colourspace *uv* - chromaticity coordinates using given method. -- :attr:`colour.CCT_TO_UV_METHODS`: Supported correlated colour temperature - :math:`T_{cp}` to *CIE UCS* colourspace *uv* chromaticity coordinates - computation methods. -- :func:`colour.CCT_to_uv`: *CIE UCS* colourspace *uv* chromaticity - coordinates computation from given correlated colour temperature - :math:`T_{cp}` using given method. -- :func:`colour.temperature.CCT_to_uv_Krystek1985`: *CIE UCS* colourspace - *uv* chromaticity coordinates computation of given correlated colour - temperature :math:`T_{cp}` using *Krystek (1985)* method. -- :func:`colour.temperature.xy_to_CCT_McCamy1992`: Correlated colour - temperature :math:`T_{cp}` computation of given *CIE XYZ* tristimulus - values *xy* chromaticity coordinates using *McCamy (1992)* method. -- :func:`colour.temperature.xy_to_CCT_Hernandez1999`: Correlated colour - temperature :math:`T_{cp}` computation of given *CIE XYZ* tristimulus - values *xy* chromaticity coordinates using - *Hernandez-Andres, Lee and Romero (1999)* method. -- :func:`colour.temperature.CCT_to_xy_Kang2002`: *CIE XYZ* tristimulus - values *xy* chromaticity coordinates computation of given correlated colour - temperature :math:`T_{cp}` using - *Kang, Moon, Hong, Lee, Cho and Kim (2002)* method. -- :func:`colour.temperature.CCT_to_xy_CIE_D`: *CIE XYZ* tristimulus values - *xy* chromaticity coordinates computation of *CIE Illuminant D Series* from - given correlated colour temperature :math:`T_{cp}` of that - *CIE Illuminant D Series*. -- :attr:`colour.XY_TO_CCT_METHODS`: Supported *CIE XYZ* tristimulus values - *xy* chromaticity coordinates to correlated colour temperature - :math:`T_{cp}` computation methods. -- :func:`colour.xy_to_CCT`: Correlated colour temperature :math:`T_{cp}` - computation from given *CIE XYZ* tristimulus values *xy* chromaticity - coordinates using given method. -- :attr:`colour.CCT_TO_XY_METHODS`: Supported correlated colour temperature - :math:`T_{cp}` to *CIE XYZ* tristimulus values *xy* chromaticity - coordinates computation methods. -- :func:`colour.CCT_to_xy`: *CIE XYZ* tristimulus values *xy* chromaticity - coordinates computation from given correlated colour temperature - :math:`T_{cp}` using given method. - -See Also --------- -`Colour Temperature & Correlated Colour Temperature Jupyter Notebook -`_ - -References ----------- -- :cite:`AdobeSystems2013` : Adobe Systems. (2013). Adobe DNG Software - Development Kit (SDK) - 1.3.0.0 - dng_sdk_1_3/dng_sdk/source/\ -dng_temperature.cpp::dng_temperature::Set_xy_coord. Retrieved from - https://www.adobe.com/support/downloads/dng/dng_sdk.html -- :cite:`AdobeSystems2013a` : Adobe Systems. (2013). Adobe DNG Software - Development Kit (SDK) - 1.3.0.0 - dng_sdk_1_3/dng_sdk/source/\ -dng_temperature.cpp::dng_temperature::xy_coord. Retrieved from - https://www.adobe.com/support/downloads/dng/dng_sdk.html -- :cite:`Hernandez-Andres1999a` : Hernandez-Andres, J., Lee, R. L., & - Romero, J. (1999). Calculating correlated color temperatures across the - entire gamut of daylight and skylight chromaticities. Applied Optics, - 38(27), 5703. doi:10.1364/AO.38.005703 -- :cite:`Kang2002a` : Kang, B., Moon, O., Hong, C., Lee, H., Cho, B., & - Kim, Y. (2002). Design of advanced color: Temperature control system for - HDTV applications. Journal of the Korean Physical Society, 41(6), 865-871. - Retrieved from http://cat.inist.fr/?aModele=afficheN&cpsidt=14448733 -- :cite:`Krystek1985b` : Krystek, M. (1985). An algorithm to calculate - correlated colour temperature. Color Research & Application, 10(1), - 38-40. doi:10.1002/col.5080100109 -- :cite:`Ohno2014a` : Ohno, Y. (2014). Practical Use and Calculation of CCT - and Duv. LEUKOS, 10(1), 47-55. doi:10.1080/15502724.2014.839020 -- :cite:`Wikipedia2001` : Wikipedia. (2001). Approximation. Retrieved June - 28, 2014, from http://en.wikipedia.org/wiki/Color_temperature#Approximation -- :cite:`Wikipedia2001a` : Wikipedia. (2001). Color temperature. Retrieved - June 28, 2014, from http://en.wikipedia.org/wiki/Color_temperature -- :cite:`Wyszecki2000x` : Wyszecki, G., & Stiles, W. S. (2000). Table 1(3.11) - Isotemperature Lines. In Color Science: Concepts and Methods, Quantitative - Data and Formulae (p. 228). Wiley. ISBN:978-0471399186 -- :cite:`Wyszecki2000y` : Wyszecki, G., & Stiles, W. S. (2000). DISTRIBUTION - TEMPERATURE, COLOR TEMPERATURE, AND CORRELATED COLOR TEMPERATURE. In - Color Science: Concepts and Methods, Quantitative Data and Formulae - (pp. 224-229). Wiley. ISBN:978-0471399186 -- :cite:`Wyszecki2000z` : Wyszecki, G., & Stiles, W. S. (2000). CIE Method of - Calculating D-Illuminants. In Color Science: Concepts and Methods, - Quantitative Data and Formulae (pp. 145-146). Wiley. ISBN:978-0471399186 -""" - -from __future__ import division, unicode_literals - -import numpy as np -from collections import namedtuple - -from colour.colorimetry import ( - ASTME30815_PRACTISE_SHAPE, STANDARD_OBSERVERS_CMFS, - daylight_locus_function, sd_blackbody, sd_to_XYZ) -from colour.models import UCS_to_uv, XYZ_to_UCS -from colour.utilities import (CaseInsensitiveMapping, as_float_array, as_float, - filter_kwargs, runtime_warning, tsplit, tstack, - usage_warning) - -__author__ = 'Colour Developers' -__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' -__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' -__maintainer__ = 'Colour Developers' -__email__ = 'colour-science@googlegroups.com' -__status__ = 'Production' - -__all__ = [ - 'PLANCKIAN_TABLE_TUVD', 'CCT_MINIMAL', 'CCT_MAXIMAL', 'CCT_SAMPLES', - 'CCT_CALCULATION_ITERATIONS', 'ROBERTSON_ISOTEMPERATURE_LINES_DATA', - 'ROBERTSON_ISOTEMPERATURE_LINES_RUVT', 'ROBERTSON_ISOTEMPERATURE_LINES', - 'planckian_table', 'planckian_table_minimal_distance_index', - 'uv_to_CCT_Ohno2013', 'CCT_to_uv_Ohno2013', 'uv_to_CCT_Robertson1968', - 'CCT_to_uv_Robertson1968', 'CCT_to_uv_Krystek1985', 'UV_TO_CCT_METHODS', - 'uv_to_CCT', 'CCT_TO_UV_METHODS', 'CCT_to_uv', 'xy_to_CCT_McCamy1992', - 'xy_to_CCT_Hernandez1999', 'CCT_to_xy_Kang2002', 'CCT_to_xy_CIE_D', - 'XY_TO_CCT_METHODS', 'xy_to_CCT', 'CCT_TO_XY_METHODS', 'CCT_to_xy' -] - -PLANCKIAN_TABLE_TUVD = namedtuple('PlanckianTable_Tuvdi', - ('Ti', 'ui', 'vi', 'di')) - -CCT_MINIMAL = 1000 -CCT_MAXIMAL = 100000 -CCT_SAMPLES = 10 -CCT_CALCULATION_ITERATIONS = 6 - -ROBERTSON_ISOTEMPERATURE_LINES_DATA = ( - (0, 0.18006, 0.26352, -0.24341), - (10, 0.18066, 0.26589, -0.25479), - (20, 0.18133, 0.26846, -0.26876), - (30, 0.18208, 0.27119, -0.28539), - (40, 0.18293, 0.27407, -0.30470), - (50, 0.18388, 0.27709, -0.32675), - (60, 0.18494, 0.28021, -0.35156), - (70, 0.18611, 0.28342, -0.37915), - (80, 0.18740, 0.28668, -0.40955), - (90, 0.18880, 0.28997, -0.44278), - (100, 0.19032, 0.29326, -0.47888), - (125, 0.19462, 0.30141, -0.58204), - (150, 0.19962, 0.30921, -0.70471), - (175, 0.20525, 0.31647, -0.84901), - (200, 0.21142, 0.32312, -1.0182), - (225, 0.21807, 0.32909, -1.2168), - (250, 0.22511, 0.33439, -1.4512), - (275, 0.23247, 0.33904, -1.7298), - (300, 0.24010, 0.34308, -2.0637), - (325, 0.24792, 0.34655, -2.4681), # 0.24702 ---> 0.24792 Bruce Lindbloom - (350, 0.25591, 0.34951, -2.9641), - (375, 0.26400, 0.35200, -3.5814), - (400, 0.27218, 0.35407, -4.3633), - (425, 0.28039, 0.35577, -5.3762), - (450, 0.28863, 0.35714, -6.7262), - (475, 0.29685, 0.35823, -8.5955), - (500, 0.30505, 0.35907, -11.324), - (525, 0.31320, 0.35968, -15.628), - (550, 0.32129, 0.36011, -23.325), - (575, 0.32931, 0.36038, -40.770), - (600, 0.33724, 0.36051, -116.45)) -""" -*Robertson (1968)* iso-temperature lines. - -ROBERTSON_ISOTEMPERATURE_LINES_DATA : tuple - (Reciprocal Megakelvin, - CIE 1960 Chromaticity Coordinate *u*, - CIE 1960 Chromaticity Coordinate *v*, - Slope) - -Notes ------ -- A correction has been done by Lindbloom for *325* Megakelvin - temperature: 0.24702 ---> 0.24792 - -References ----------- -:cite:`Wyszecki2000x` -""" - -ROBERTSON_ISOTEMPERATURE_LINES_RUVT = namedtuple('WyszeckiRobertson_ruvt', - ('r', 'u', 'v', 't')) - -ROBERTSON_ISOTEMPERATURE_LINES = [ - ROBERTSON_ISOTEMPERATURE_LINES_RUVT(*x) - for x in ROBERTSON_ISOTEMPERATURE_LINES_DATA -] - - -def planckian_table(uv, cmfs, start, end, count): - """ - Returns a planckian table from given *CIE UCS* colourspace *uv* - chromaticity coordinates, colour matching functions and temperature range - using *Ohno (2013)* method. - - Parameters - ---------- - uv : array_like - *uv* chromaticity coordinates. - cmfs : XYZ_ColourMatchingFunctions - Standard observer colour matching functions. - start : numeric - Temperature range start in kelvins. - end : numeric - Temperature range end in kelvins. - count : int - Temperatures count in the planckian table. - - Returns - ------- - list - Planckian table. - - Examples - -------- - >>> from colour import STANDARD_OBSERVERS_CMFS - >>> from pprint import pprint - >>> cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] - >>> uv = np.array([0.1978, 0.3122]) - >>> pprint(planckian_table(uv, cmfs, 1000, 1010, 10)) - ... # doctest: +ELLIPSIS - [PlanckianTable_Tuvdi(Ti=1000.0, \ -ui=0.4479628..., vi=0.3546296..., di=0.2537355...), - PlanckianTable_Tuvdi(Ti=1001.1111111..., \ -ui=0.4477030..., vi=0.3546521..., di=0.2534831...), - PlanckianTable_Tuvdi(Ti=1002.2222222..., \ -ui=0.4474434..., vi=0.3546746..., di=0.2532310...), - PlanckianTable_Tuvdi(Ti=1003.3333333..., \ -ui=0.4471842..., vi=0.3546970..., di=0.2529792...), - PlanckianTable_Tuvdi(Ti=1004.4444444..., \ -ui=0.4469252..., vi=0.3547194..., di=0.2527277...), - PlanckianTable_Tuvdi(Ti=1005.5555555..., \ -ui=0.4466666..., vi=0.3547417..., di=0.2524765...), - PlanckianTable_Tuvdi(Ti=1006.6666666..., \ -ui=0.4464083..., vi=0.3547640..., di=0.2522256...), - PlanckianTable_Tuvdi(Ti=1007.7777777..., \ -ui=0.4461502..., vi=0.3547862..., di=0.2519751...), - PlanckianTable_Tuvdi(Ti=1008.8888888..., \ -ui=0.4458925..., vi=0.3548084..., di=0.2517248...), - PlanckianTable_Tuvdi(Ti=1010.0, \ -ui=0.4456351..., vi=0.3548306..., di=0.2514749...)] - """ - - ux, vx = uv - - cmfs = cmfs.copy().trim(ASTME30815_PRACTISE_SHAPE) - - shape = cmfs.shape - - table = [] - for Ti in np.linspace(start, end, count): - sd = sd_blackbody(Ti, shape) - XYZ = sd_to_XYZ(sd, cmfs) - XYZ /= np.max(XYZ) - UVW = XYZ_to_UCS(XYZ) - ui, vi = UCS_to_uv(UVW) - di = np.hypot(ux - ui, vx - vi) - table.append(PLANCKIAN_TABLE_TUVD(Ti, ui, vi, di)) - - return table - - -def planckian_table_minimal_distance_index(planckian_table_): - """ - Returns the shortest distance index in given planckian table using - *Ohno (2013)* method. - - Parameters - ---------- - planckian_table_ : list - Planckian table. - - Returns - ------- - int - Shortest distance index. - - Examples - -------- - >>> from colour import STANDARD_OBSERVERS_CMFS - >>> cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] - >>> uv = np.array([0.1978, 0.3122]) - >>> table = planckian_table(uv, cmfs, 1000, 1010, 10) - >>> planckian_table_minimal_distance_index(table) - 9 - """ - - distances = [x.di for x in planckian_table_] - return distances.index(min(distances)) - - -def _uv_to_CCT_Ohno2013( - uv, - cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'], - start=CCT_MINIMAL, - end=CCT_MAXIMAL, - count=CCT_SAMPLES, - iterations=CCT_CALCULATION_ITERATIONS): - """ - Returns the correlated colour temperature :math:`T_{cp}` and - :math:`\\Delta_{uv}` from given *CIE UCS* colourspace *uv* chromaticity - coordinates, colour matching functions and temperature range using - *Ohno (2013)* method. - - The iterations parameter defines the calculations precision: The higher its - value, the more planckian tables will be generated through cascade - expansion in order to converge to the exact solution. - - Parameters - ---------- - uv : array_like - *CIE UCS* colourspace *uv* chromaticity coordinates. - cmfs : XYZ_ColourMatchingFunctions, optional - Standard observer colour matching functions. - start : numeric, optional - Temperature range start in kelvins. - end : numeric, optional - Temperature range end in kelvins. - count : int, optional - Temperatures count in the planckian tables. - iterations : int, optional - Number of planckian tables to generate. - - Returns - ------- - ndarray - Correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}`. - """ - - # Ensuring we do at least one iteration to initialise variables. - iterations = max(iterations, 1) - - # Planckian table creation through cascade expansion. - for _i in range(iterations): - table = planckian_table(uv, cmfs, start, end, count) - index = planckian_table_minimal_distance_index(table) - if index == 0: - runtime_warning( - ('Minimal distance index is on lowest planckian table bound, ' - 'unpredictable results may occur!')) - index += 1 - elif index == len(table) - 1: - runtime_warning( - ('Minimal distance index is on highest planckian table bound, ' - 'unpredictable results may occur!')) - index -= 1 - - start = table[index - 1].Ti - end = table[index + 1].Ti - - _ux, vx = uv - - Tuvdip, Tuvdi, Tuvdin = (table[index - 1], table[index], table[index + 1]) - Tip, uip, vip, dip = Tuvdip.Ti, Tuvdip.ui, Tuvdip.vi, Tuvdip.di - Ti, di = Tuvdi.Ti, Tuvdi.di - Tin, uin, vin, din = Tuvdin.Ti, Tuvdin.ui, Tuvdin.vi, Tuvdin.di - - # Triangular solution. - l = np.hypot(uin - uip, vin - vip) # noqa - x = (dip ** 2 - din ** 2 + l ** 2) / (2 * l) - T = Tip + (Tin - Tip) * (x / l) - - vtx = vip + (vin - vip) * (x / l) - sign = 1 if vx - vtx >= 0 else -1 - D_uv = (dip ** 2 - x ** 2) ** (1 / 2) * sign - - # Parabolic solution. - if np.abs(D_uv) >= 0.002: - X = (Tin - Ti) * (Tip - Tin) * (Ti - Tip) - a = (Tip * (din - di) + Ti * (dip - din) + Tin * (di - dip)) * X ** -1 - b = (-(Tip ** 2 * (din - di) + Ti ** 2 * (dip - din) + Tin ** 2 * - (di - dip)) * X ** -1) - c = ( - -(dip * (Tin - Ti) * Ti * Tin + di * - (Tip - Tin) * Tip * Tin + din * (Ti - Tip) * Tip * Ti) * X ** -1) - - T = -b / (2 * a) - - D_uv = sign * (a * T ** 2 + b * T + c) - - return np.array([T, D_uv]) - - -def uv_to_CCT_Ohno2013( - uv, - cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'], - start=CCT_MINIMAL, - end=CCT_MAXIMAL, - count=CCT_SAMPLES, - iterations=CCT_CALCULATION_ITERATIONS): - """ - Returns the correlated colour temperature :math:`T_{cp}` and - :math:`\\Delta_{uv}` from given *CIE UCS* colourspace *uv* chromaticity - coordinates, colour matching functions and temperature range using - *Ohno (2013)* method. - - The iterations parameter defines the calculations precision: The higher its - value, the more planckian tables will be generated through cascade - expansion in order to converge to the exact solution. - - Parameters - ---------- - uv : array_like - *CIE UCS* colourspace *uv* chromaticity coordinates. - cmfs : XYZ_ColourMatchingFunctions, optional - Standard observer colour matching functions. - start : numeric, optional - Temperature range start in kelvins. - end : numeric, optional - Temperature range end in kelvins. - count : int, optional - Temperatures count in the planckian tables. - iterations : int, optional - Number of planckian tables to generate. - - Returns - ------- - ndarray - Correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}`. - - References - ---------- - :cite:`Ohno2014a` - - Examples - -------- - >>> from colour import STANDARD_OBSERVERS_CMFS - >>> cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] - >>> uv = np.array([0.1978, 0.3122]) - >>> uv_to_CCT_Ohno2013(uv, cmfs) # doctest: +ELLIPSIS - array([ 6.5074738...e+03, 3.2233461...e-03]) - """ - - uv = as_float_array(uv) - - CCT_D_uv = [ - _uv_to_CCT_Ohno2013(a, cmfs, start, end, count, iterations) - for a in np.reshape(uv, (-1, 2)) - ] - - return as_float_array(CCT_D_uv).reshape(uv.shape) - - -def _CCT_to_uv_Ohno2013( - CCT_D_uv, - cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer']): - """ - Returns the *CIE UCS* colourspace *uv* chromaticity coordinates from given - correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}` and - colour matching functions using *Ohno (2013)* method. - - Parameters - ---------- - CCT_D_uv : ndarray - Correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}`. - cmfs : XYZ_ColourMatchingFunctions, optional - Standard observer colour matching functions. - - Returns - ------- - ndarray - *CIE UCS* colourspace *uv* chromaticity coordinates. - """ - - CCT, D_uv = tsplit(CCT_D_uv) - - cmfs = cmfs.copy().trim(ASTME30815_PRACTISE_SHAPE) - - shape = cmfs.shape - - delta = 0.01 - - sd = sd_blackbody(CCT, shape) - XYZ = sd_to_XYZ(sd, cmfs) - XYZ *= 1 / np.max(XYZ) - UVW = XYZ_to_UCS(XYZ) - u0, v0 = UCS_to_uv(UVW) - - if D_uv == 0: - return np.array([u0, v0]) - else: - sd = sd_blackbody(CCT + delta, shape) - XYZ = sd_to_XYZ(sd, cmfs) - XYZ *= 1 / np.max(XYZ) - UVW = XYZ_to_UCS(XYZ) - u1, v1 = UCS_to_uv(UVW) - - du = u0 - u1 - dv = v0 - v1 - - u = u0 - D_uv * (dv / np.hypot(du, dv)) - v = v0 + D_uv * (du / np.hypot(du, dv)) - - return np.array([u, v]) - - -def CCT_to_uv_Ohno2013( - CCT_D_uv, - cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer']): - """ - Returns the *CIE UCS* colourspace *uv* chromaticity coordinates from given - correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}` and - colour matching functions using *Ohno (2013)* method. - - Parameters - ---------- - CCT_D_uv : ndarray - Correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}`. - cmfs : XYZ_ColourMatchingFunctions, optional - Standard observer colour matching functions. - - Returns - ------- - ndarray - *CIE UCS* colourspace *uv* chromaticity coordinates. - - References - ---------- - :cite:`Ohno2014a` - - Examples - -------- - >>> from colour import STANDARD_OBSERVERS_CMFS - >>> cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] - >>> CCT_D_uv = np.array([6507.4342201047066, 0.003223690901513]) - >>> CCT_to_uv_Ohno2013(CCT_D_uv, cmfs) # doctest: +ELLIPSIS - array([ 0.1977999..., 0.3122004...]) - """ - - CCT_D_uv = as_float_array(CCT_D_uv) - - uv = [_CCT_to_uv_Ohno2013(a, cmfs) for a in np.reshape(CCT_D_uv, (-1, 2))] - - return as_float_array(uv).reshape(CCT_D_uv.shape) - - -def _uv_to_CCT_Robertson1968(uv): - """ - Returns the correlated colour temperature :math:`T_{cp}` and - :math:`\\Delta_{uv}` from given *CIE UCS* colourspace *uv* chromaticity - coordinates using *Roberston (1968)* method. - - Parameters - ---------- - uv : array_like - *CIE UCS* colourspace *uv* chromaticity coordinates. - - Returns - ------- - ndarray - Correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}`. - """ - - u, v = uv - - last_dt = last_dv = last_du = 0 - - for i in range(1, 31): - wr_ruvt = ROBERTSON_ISOTEMPERATURE_LINES[i] - wr_ruvt_previous = ROBERTSON_ISOTEMPERATURE_LINES[i - 1] - - du = 1 - dv = wr_ruvt.t - - length = np.hypot(1, dv) - - du /= length - dv /= length - - uu = u - wr_ruvt.u - vv = v - wr_ruvt.v - - dt = -uu * dv + vv * du - - if dt <= 0 or i == 30: - if dt > 0: - dt = 0 - - dt = -dt - - f = 0 if i == 1 else dt / (last_dt + dt) - - T = 1.0e6 / (wr_ruvt_previous.r * f + wr_ruvt.r * (1 - f)) - - uu = u - (wr_ruvt_previous.u * f + wr_ruvt.u * (1 - f)) - vv = v - (wr_ruvt_previous.v * f + wr_ruvt.v * (1 - f)) - - du = du * (1 - f) + last_du * f - dv = dv * (1 - f) + last_dv * f - - length = np.hypot(du, dv) - - du /= length - dv /= length - - D_uv = uu * du + vv * dv - - break - - last_dt = dt - last_du = du - last_dv = dv - - return np.array([T, -D_uv]) - - -def uv_to_CCT_Robertson1968(uv): - """ - Returns the correlated colour temperature :math:`T_{cp}` and - :math:`\\Delta_{uv}` from given *CIE UCS* colourspace *uv* chromaticity - coordinates using *Roberston (1968)* method. - - Parameters - ---------- - uv : array_like - *CIE UCS* colourspace *uv* chromaticity coordinates. - - Returns - ------- - ndarray - Correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}`. - - References - ---------- - :cite:`AdobeSystems2013`, :cite:`Wyszecki2000y` - - Examples - -------- - >>> uv = np.array([0.193741375998230, 0.315221043940594]) - >>> uv_to_CCT_Robertson1968(uv) # doctest: +ELLIPSIS - array([ 6.5000162...e+03, 8.3333289...e-03]) - """ - - uv = as_float_array(uv) - - CCT_D_uv = [_uv_to_CCT_Robertson1968(a) for a in np.reshape(uv, (-1, 2))] - - return as_float_array(CCT_D_uv).reshape(uv.shape) - - -def _CCT_to_uv_Robertson1968(CCT_D_uv): - """ - Returns the *CIE UCS* colourspace *uv* chromaticity coordinates from given - correlated colour temperature :math:`T_{cp}` and :math:`\\Delta_{uv}` using - *Roberston (1968)* method. - - Parameters - ---------- - CCT_D_uv : ndarray - Correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}`. - - Returns - ------- - ndarray - *CIE UCS* colourspace *uv* chromaticity coordinates. - """ - - CCT, D_uv = tsplit(CCT_D_uv) - - r = 1.0e6 / CCT - - for i in range(30): - wr_ruvt = ROBERTSON_ISOTEMPERATURE_LINES[i] - wr_ruvt_next = ROBERTSON_ISOTEMPERATURE_LINES[i + 1] - - if r < wr_ruvt_next.r or i == 29: - f = (wr_ruvt_next.r - r) / (wr_ruvt_next.r - wr_ruvt.r) - - u = wr_ruvt.u * f + wr_ruvt_next.u * (1 - f) - v = wr_ruvt.v * f + wr_ruvt_next.v * (1 - f) - - uu1 = uu2 = 1.0 - vv1, vv2 = wr_ruvt.t, wr_ruvt_next.t - - length1 = np.hypot(1, vv1) - length2 = np.hypot(1, vv2) - - uu1 /= length1 - vv1 /= length1 - - uu2 /= length2 - vv2 /= length2 - - uu3 = uu1 * f + uu2 * (1 - f) - vv3 = vv1 * f + vv2 * (1 - f) - - len3 = np.sqrt(uu3 * uu3 + vv3 * vv3) - - uu3 /= len3 - vv3 /= len3 - - u += uu3 * -D_uv - v += vv3 * -D_uv - - return np.array([u, v]) - - -def CCT_to_uv_Robertson1968(CCT_D_uv): - """ - Returns the *CIE UCS* colourspace *uv* chromaticity coordinates from given - correlated colour temperature :math:`T_{cp}` and :math:`\\Delta_{uv}` using - *Roberston (1968)* method. - - Parameters - ---------- - CCT_D_uv : ndarray - Correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}`. - - Returns - ------- - ndarray - *CIE UCS* colourspace *uv* chromaticity coordinates. - - References - ---------- - :cite:`AdobeSystems2013a`, :cite:`Wyszecki2000y` - - Examples - -------- - >>> CCT_D_uv = np.array([6500.0081378199056, 0.008333331244225]) - >>> CCT_to_uv_Robertson1968(CCT_D_uv) # doctest: +ELLIPSIS - array([ 0.1937413..., 0.3152210...]) - """ - - CCT_D_uv = as_float_array(CCT_D_uv) - - uv = [_CCT_to_uv_Robertson1968(a) for a in np.reshape(CCT_D_uv, (-1, 2))] - - return as_float_array(uv).reshape(CCT_D_uv.shape) - - -def CCT_to_uv_Krystek1985(CCT): - """ - Returns the *CIE UCS* colourspace *uv* chromaticity coordinates from given - correlated colour temperature :math:`T_{cp}` using *Krystek (1985)* method. - - Parameters - ---------- - CCT : numeric - Correlated colour temperature :math:`T_{cp}`. - - Returns - ------- - ndarray - *CIE UCS* colourspace *uv* chromaticity coordinates. - - Notes - ----- - - *Krystek (1985)* method computations are valid for correlated colour - temperature :math:`T_{cp}` normalised to domain [1000, 15000]. - - References - ---------- - :cite:`Krystek1985b` - - Examples - -------- - >>> CCT_to_uv_Krystek1985(6504.38938305) # doctest: +ELLIPSIS - array([ 0.1837669..., 0.3093443...]) - """ - - T = as_float_array(CCT) - - u = ((0.860117757 + 1.54118254 * 10e-4 * T + 1.28641212 * 10e-7 * T ** 2) / - (1 + 8.42420235 * 10e-4 * T + 7.08145163 * 10e-7 * T ** 2)) - v = ((0.317398726 + 4.22806245 * 10e-5 * T + 4.20481691 * 10e-8 * T ** 2) / - (1 - 2.89741816 * 10e-5 * T + 1.61456053 * 10e-7 * T ** 2)) - - return tstack([u, v]) - - -UV_TO_CCT_METHODS = CaseInsensitiveMapping({ - 'Ohno 2013': uv_to_CCT_Ohno2013, - 'Robertson 1968': uv_to_CCT_Robertson1968 -}) -UV_TO_CCT_METHODS.__doc__ = """ -Supported *CIE UCS* colourspace *uv* chromaticity coordinates to correlated -colour temperature :math:`T_{cp}` computation methods. - -References ----------- -:cite:`AdobeSystems2013`, :cite:`AdobeSystems2013a`, :cite:`Ohno2014a`, -:cite:`Wyszecki2000y` - -UV_TO_CCT_METHODS : CaseInsensitiveMapping - **{'Ohno 2013', 'Robertson 1968'}** - -Aliases: - -- 'ohno2013': 'Ohno 2013' -- 'robertson1968': 'Robertson 1968' -""" -UV_TO_CCT_METHODS['ohno2013'] = UV_TO_CCT_METHODS['Ohno 2013'] -UV_TO_CCT_METHODS['robertson1968'] = UV_TO_CCT_METHODS['Robertson 1968'] - - -def uv_to_CCT(uv, method='Ohno 2013', **kwargs): - """ - Returns the correlated colour temperature :math:`T_{cp}` and - :math:`\\Delta_{uv}` from given *CIE UCS* colourspace *uv* chromaticity - coordinates using given method. - - Parameters - ---------- - uv : array_like - *CIE UCS* colourspace *uv* chromaticity coordinates. - method : unicode, optional - **{'Ohno 2013', 'Robertson 1968'}**, - Computation method. - - Other Parameters - ---------------- - cmfs : XYZ_ColourMatchingFunctions, optional - {:func:`colour.temperature.uv_to_CCT_Ohno2013`}, - Standard observer colour matching functions. - start : numeric, optional - {:func:`colour.temperature.uv_to_CCT_Ohno2013`}, - Temperature range start in kelvins. - end : numeric, optional - {:func:`colour.temperature.uv_to_CCT_Ohno2013`}, - Temperature range end in kelvins. - count : int, optional - {:func:`colour.temperature.uv_to_CCT_Ohno2013`}, - Temperatures count in the planckian tables. - iterations : int, optional - {:func:`colour.temperature.uv_to_CCT_Ohno2013`}, - Number of planckian tables to generate. - - Returns - ------- - ndarray - Correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}`. - - References - ---------- - :cite:`AdobeSystems2013`, :cite:`AdobeSystems2013a`, :cite:`Ohno2014a`, - :cite:`Wyszecki2000y` - - Examples - -------- - >>> from colour import STANDARD_OBSERVERS_CMFS - >>> cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] - >>> uv = np.array([0.1978, 0.3122]) - >>> uv_to_CCT(uv, cmfs=cmfs) # doctest: +ELLIPSIS - array([ 6.5074738...e+03, 3.2233461...e-03]) - """ - - function = UV_TO_CCT_METHODS[method] - - return function(uv, **filter_kwargs(function, **kwargs)) - - -CCT_TO_UV_METHODS = CaseInsensitiveMapping({ - 'Ohno 2013': CCT_to_uv_Ohno2013, - 'Robertson 1968': CCT_to_uv_Robertson1968, - 'Krystek 1985': CCT_to_uv_Krystek1985 -}) -CCT_TO_UV_METHODS.__doc__ = """ -Supported correlated colour temperature :math:`T_{cp}` to *CIE UCS* colourspace -*uv* chromaticity coordinates computation methods. - -References ----------- -:cite:`AdobeSystems2013`, :cite:`AdobeSystems2013a`, :cite:`Krystek1985b`, -:cite:`Ohno2014a`, :cite:`Wyszecki2000y` - -CCT_TO_UV_METHODS : CaseInsensitiveMapping - **{'Ohno 2013', 'Robertson 1968', 'Krystek 1985}** - -Aliases: - -- 'ohno2013': 'Ohno 2013' -- 'robertson1968': 'Robertson 1968' -""" -CCT_TO_UV_METHODS['ohno2013'] = CCT_TO_UV_METHODS['Ohno 2013'] -CCT_TO_UV_METHODS['robertson1968'] = CCT_TO_UV_METHODS['Robertson 1968'] - - -def CCT_to_uv(CCT_D_uv, method='Ohno 2013', **kwargs): - """ - Returns the *CIE UCS* colourspace *uv* chromaticity coordinates from given - correlated colour temperature :math:`T_{cp}` using given method. - - Parameters - ---------- - CCT_D_uv : ndarray - Correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}`. - method : unicode, optional - **{'Ohno 2013', 'Robertson 1968', 'Krystek 1985}**, - Computation method. - - Other Parameters - ---------------- - cmfs : XYZ_ColourMatchingFunctions, optional - {:func:`colour.temperature.CCT_to_uv_Ohno2013`}, - Standard observer colour matching functions. - - Returns - ------- - ndarray - *CIE UCS* colourspace *uv* chromaticity coordinates. - - References - ---------- - :cite:`AdobeSystems2013`, :cite:`AdobeSystems2013a`, :cite:`Krystek1985b`, - :cite:`Ohno2014a`, :cite:`Wyszecki2000y` - - Examples - -------- - >>> from colour import STANDARD_OBSERVERS_CMFS - >>> cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] - >>> CCT_D_uv = np.array([6507.47380460, 0.00322335]) - >>> CCT_to_uv(CCT_D_uv, cmfs=cmfs) # doctest: +ELLIPSIS - array([ 0.1977999..., 0.3121999...]) - """ - - function = CCT_TO_UV_METHODS[method] - - return function(CCT_D_uv, **filter_kwargs(function, **kwargs)) - - -def xy_to_CCT_McCamy1992(xy): - """ - Returns the correlated colour temperature :math:`T_{cp}` from given - *CIE XYZ* tristimulus values *xy* chromaticity coordinates using - *McCamy (1992)* method. - - Parameters - ---------- - xy : array_like - *xy* chromaticity coordinates. - - Returns - ------- - numeric or ndarray - Correlated colour temperature :math:`T_{cp}`. - - References - ---------- - :cite:`Wikipedia2001` - - Examples - -------- - >>> xy = np.array([0.31270, 0.32900]) - >>> xy_to_CCT_McCamy1992(xy) # doctest: +ELLIPSIS - 6505.0805913... - """ - - x, y = tsplit(xy) - - n = (x - 0.3320) / (y - 0.1858) - CCT = -449 * n ** 3 + 3525 * n ** 2 - 6823.3 * n + 5520.33 - - return CCT - - -def xy_to_CCT_Hernandez1999(xy): - """ - Returns the correlated colour temperature :math:`T_{cp}` from given - *CIE XYZ* tristimulus values *xy* chromaticity coordinates using - *Hernandez-Andres et al. (1999)* method. - - Parameters - ---------- - xy : array_like - *xy* chromaticity coordinates. - - Returns - ------- - numeric - Correlated colour temperature :math:`T_{cp}`. - - References - ---------- - :cite:`Hernandez-Andres1999a` - - Examples - -------- - >>> xy = np.array([0.31270, 0.32900]) - >>> xy_to_CCT_Hernandez1999(xy) # doctest: +ELLIPSIS - 6500.7420431... - """ - - x, y = tsplit(xy) - - n = (x - 0.3366) / (y - 0.1735) - CCT = (-949.86315 + 6253.80338 * np.exp(-n / 0.92159) + - 28.70599 * np.exp(-n / 0.20039) + 0.00004 * np.exp(-n / 0.07125)) - - n = np.where(CCT > 50000, (x - 0.3356) / (y - 0.1691), n) - - CCT = np.where( - CCT > 50000, - 36284.48953 + 0.00228 * np.exp(-n / 0.07861) + - 5.4535e-36 * np.exp(-n / 0.01543), - CCT, - ) - - return as_float(CCT) - - -def CCT_to_xy_Kang2002(CCT): - """ - Returns the *CIE XYZ* tristimulus values *xy* chromaticity coordinates from - given correlated colour temperature :math:`T_{cp}` using - *Kang et al. (2002)* method. - - Parameters - ---------- - CCT : numeric or array_like - Correlated colour temperature :math:`T_{cp}`. - - Returns - ------- - ndarray - *xy* chromaticity coordinates. - - Raises - ------ - ValueError - If the correlated colour temperature is not in appropriate domain. - - References - ---------- - :cite:`Kang2002a` - - Examples - -------- - >>> CCT_to_xy_Kang2002(6504.38938305) # doctest: +ELLIPSIS - array([ 0.313426 ..., 0.3235959...]) - """ - - CCT = as_float_array(CCT) - - if np.any(CCT[np.asarray(np.logical_or(CCT < 1667, CCT > 25000))]): - usage_warning(('Correlated colour temperature must be in domain ' - '[1667, 25000], unpredictable results may occur!')) - - x = np.where( - CCT <= 4000, - -0.2661239 * 10 ** 9 / CCT ** 3 - 0.2343589 * 10 ** 6 / CCT ** 2 + - 0.8776956 * 10 ** 3 / CCT + 0.179910, - -3.0258469 * 10 ** 9 / CCT ** 3 + 2.1070379 * 10 ** 6 / CCT ** 2 + - 0.2226347 * 10 ** 3 / CCT + 0.24039, - ) - - cnd_l = [CCT <= 2222, np.logical_and(CCT > 2222, CCT <= 4000), CCT > 4000] - i = -1.1063814 * x ** 3 - 1.34811020 * x ** 2 + 2.18555832 * x - 0.20219683 - j = -0.9549476 * x ** 3 - 1.37418593 * x ** 2 + 2.09137015 * x - 0.16748867 - k = 3.0817580 * x ** 3 - 5.8733867 * x ** 2 + 3.75112997 * x - 0.37001483 - y = np.select(cnd_l, [i, j, k]) - - xy = tstack([x, y]) - - return xy - - -def CCT_to_xy_CIE_D(CCT): - """ - Converts from the correlated colour temperature :math:`T_{cp}` of a - *CIE Illuminant D Series* to the chromaticity of that - *CIE Illuminant D Series* illuminant. - - Parameters - ---------- - CCT : numeric or array_like - Correlated colour temperature :math:`T_{cp}`. - - Returns - ------- - ndarray - *xy* chromaticity coordinates. - - Raises - ------ - ValueError - If the correlated colour temperature is not in appropriate domain. - - References - ---------- - :cite:`Wyszecki2000z` - - Examples - -------- - >>> CCT_to_xy_CIE_D(6504.38938305) # doctest: +ELLIPSIS - array([ 0.3127077..., 0.3291128...]) - """ - - CCT = as_float_array(CCT) - - if np.any(CCT[np.asarray(np.logical_or(CCT < 4000, CCT > 25000))]): - usage_warning(('Correlated colour temperature must be in domain ' - '[4000, 25000], unpredictable results may occur!')) - - x = np.where( - CCT <= 7000, - -4.607 * 10 ** 9 / CCT ** 3 + 2.9678 * 10 ** 6 / CCT ** 2 + - 0.09911 * 10 ** 3 / CCT + 0.244063, - -2.0064 * 10 ** 9 / CCT ** 3 + 1.9018 * 10 ** 6 / CCT ** 2 + - 0.24748 * 10 ** 3 / CCT + 0.23704, - ) - - y = daylight_locus_function(x) - - xy = tstack([x, y]) - - return xy - - -XY_TO_CCT_METHODS = CaseInsensitiveMapping({ - 'McCamy 1992': xy_to_CCT_McCamy1992, - 'Hernandez 1999': xy_to_CCT_Hernandez1999 -}) -XY_TO_CCT_METHODS.__doc__ = """ -Supported *CIE XYZ* tristimulus values *xy* chromaticity coordinates to -correlated colour temperature :math:`T_{cp}` computation methods. - -References ----------- -:cite:`Hernandez-Andres1999a`, :cite:`Wikipedia2001`, :cite:`Wikipedia2001a` - -XY_TO_CCT_METHODS : CaseInsensitiveMapping - **{'McCamy 1992', 'Hernandez 1999'}** - -Aliases: - -- 'mccamy1992': 'McCamy 1992' -- 'hernandez1999': 'Hernandez 1999' -""" -XY_TO_CCT_METHODS['mccamy1992'] = XY_TO_CCT_METHODS['McCamy 1992'] -XY_TO_CCT_METHODS['hernandez1999'] = XY_TO_CCT_METHODS['Hernandez 1999'] - - -def xy_to_CCT(xy, method='McCamy 1992'): - """ - Returns the correlated colour temperature :math:`T_{cp}` from given - *CIE XYZ* tristimulus values *xy* chromaticity coordinates using given - method. - - Parameters - ---------- - xy : array_like - *xy* chromaticity coordinates. - method : unicode, optional - **{'McCamy 1992', 'Hernandez 1999'}**, - Computation method. - - Returns - ------- - numeric or ndarray - Correlated colour temperature :math:`T_{cp}`. - - References - ---------- - :cite:`Hernandez-Andres1999a`, :cite:`Wikipedia2001`, - :cite:`Wikipedia2001a` - """ - - return XY_TO_CCT_METHODS.get(method)(xy) - - -CCT_TO_XY_METHODS = CaseInsensitiveMapping({ - 'Kang 2002': CCT_to_xy_Kang2002, - 'CIE Illuminant D Series': CCT_to_xy_CIE_D -}) -CCT_TO_XY_METHODS.__doc__ = """ -Supported correlated colour temperature :math:`T_{cp}` to *CIE XYZ* tristimulus -values *xy* chromaticity coordinates computation methods. - -References ----------- -:cite:`Kang2002a`, :cite:`Wikipedia2001a`, :cite:`Wyszecki2000z` - -CCT_TO_XY_METHODS : CaseInsensitiveMapping - **{'Kang 2002', 'CIE Illuminant D Series'}** - -Aliases: - -- 'kang2002': 'Kang 2002' -- 'cie_d': 'Hernandez 1999' -""" -CCT_TO_XY_METHODS['kang2002'] = CCT_TO_XY_METHODS['Kang 2002'] -CCT_TO_XY_METHODS['cie_d'] = CCT_TO_XY_METHODS['CIE Illuminant D Series'] - - -def CCT_to_xy(CCT, method='Kang 2002'): - """ - Returns the *CIE XYZ* tristimulus values *xy* chromaticity coordinates from - given correlated colour temperature :math:`T_{cp}` using given method. - - Parameters - ---------- - CCT : numeric or array_like - Correlated colour temperature :math:`T_{cp}`. - method : unicode, optional - **{'Kang 2002', 'CIE Illuminant D Series'}**, - Computation method. - - Returns - ------- - ndarray - *xy* chromaticity coordinates. - - References - ---------- - :cite:`Kang2002a`, :cite:`Wikipedia2001a`, :cite:`Wyszecki2000z` - """ - - return CCT_TO_XY_METHODS.get(method)(CCT) diff --git a/colour/temperature/cie_d.py b/colour/temperature/cie_d.py new file mode 100644 index 0000000000..a601e4d84e --- /dev/null +++ b/colour/temperature/cie_d.py @@ -0,0 +1,165 @@ +# -*- coding: utf-8 -*- +""" +CIE Illuminant D Series Correlated Colour Temperature +===================================================== + +Defines *CIE Illuminant D Series* correlated colour temperature :math:`T_{cp} +computations objects: + +- :func:`colour.temperature.xy_to_CCT_CIE_D`: Correlated colour temperature + :math:`T_{cp}` computation of a *CIE Illuminant D Series* from its *CIE xy* + chromaticity coordinates. +- :func:`colour.temperature.CCT_to_xy_CIE_D`: *CIE xy* chromaticity + coordinates computation of a *CIE Illuminant D Series* from its correlated + colour temperature :math:`T_{cp}`. + +See Also +-------- +`Colour Temperature & Correlated Colour Temperature Jupyter Notebook +`_ + +References +---------- +- :cite:`Wyszecki2000z` : Wyszecki, G., & Stiles, W. S. (2000). CIE Method of + Calculating D-Illuminants. In Color Science: Concepts and Methods, + Quantitative Data and Formulae (pp. 145-146). Wiley. ISBN:978-0471399186 +""" + +from __future__ import division, unicode_literals + +import numpy as np +from scipy.optimize import minimize + +from colour.colorimetry import daylight_locus_function +from colour.utilities import as_float_array, as_numeric, tstack, usage_warning + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = ['xy_to_CCT_CIE_D', 'CCT_to_xy_CIE_D'] + + +def xy_to_CCT_CIE_D(xy, optimisation_parameters=None): + """ + Returns the correlated colour temperature :math:`T_{cp}` of a + *CIE Illuminant D Series* from its *CIE xy* chromaticity coordinates. + + Parameters + ---------- + xy : array_like + *CIE xy* chromaticity coordinates. + optimisation_parameters : dict_like, optional + Parameters for :func:`scipy.optimize.minimize` definition. + + Returns + ------- + ndarray + Correlated colour temperature :math:`T_{cp}`. + + Warnings + -------- + The *CIE Illuminant D Series* method does not give an analytical inverse + transformation to compute the correlated colour temperature :math:`T_{cp}` + from given *CIE xy* chromaticity coordinates, the current implementation + relies on optimization using :func:`scipy.optimize.minimize` definition and + thus has reduced precision and poor performance. + + References + ---------- + :cite:`Wyszecki2000z` + + Examples + -------- + >>> xy_to_CCT_CIE_D(np.array([0.31270775, 0.32911283])) + ... # doctest: +ELLIPSIS + 6504.3895840... + """ + + xy = as_float_array(xy) + shape = xy.shape + xy = np.atleast_1d(xy.reshape([-1, 2])) + + def objective_function(CCT, xy): + """ + Objective function. + """ + + objective = np.linalg.norm(CCT_to_xy_CIE_D(CCT) - xy) + + return objective + + optimisation_settings = { + 'method': 'Nelder-Mead', + 'options': { + 'fatol': 1e-10, + }, + } + if optimisation_parameters is not None: + optimisation_settings.update(optimisation_parameters) + + CCT = as_float_array([ + minimize( + objective_function, + x0=6500, + args=(xy_i, ), + **optimisation_settings).x for xy_i in xy + ]) + + return as_numeric(CCT.reshape(shape[:-1])) + + +def CCT_to_xy_CIE_D(CCT): + """ + Returns the *CIE xy* chromaticity coordinates of a + *CIE Illuminant D Series* from its correlated colour temperature + :math:`T_{cp}`. + + Parameters + ---------- + CCT : numeric or array_like + Correlated colour temperature :math:`T_{cp}`. + + Returns + ------- + ndarray + *CIE xy* chromaticity coordinates. + + Raises + ------ + ValueError + If the correlated colour temperature is not in appropriate domain. + + References + ---------- + :cite:`Wyszecki2000z` + + Examples + -------- + >>> CCT_to_xy_CIE_D(6504.38938305) # doctest: +ELLIPSIS + array([ 0.3127077..., 0.3291128...]) + """ + + CCT = as_float_array(CCT) + + if np.any(CCT[np.asarray(np.logical_or(CCT < 4000, CCT > 25000))]): + usage_warning(('Correlated colour temperature must be in domain ' + '[4000, 25000], unpredictable results may occur!')) + + x = np.where( + CCT <= 7000, + -4.607 * 10 ** 9 / CCT ** 3 + 2.9678 * 10 ** 6 / CCT ** 2 + + 0.09911 * 10 ** 3 / CCT + 0.244063, + -2.0064 * 10 ** 9 / CCT ** 3 + 1.9018 * 10 ** 6 / CCT ** 2 + + 0.24748 * 10 ** 3 / CCT + 0.23704, + ) + + y = daylight_locus_function(x) + + xy = tstack([x, y]) + + return xy diff --git a/colour/temperature/hernandez1999.py b/colour/temperature/hernandez1999.py new file mode 100644 index 0000000000..fb666934b3 --- /dev/null +++ b/colour/temperature/hernandez1999.py @@ -0,0 +1,168 @@ +# -*- coding: utf-8 -*- +""" +Hernandez-Andres, Lee and Romero (1999) Correlated Colour Temperature +===================================================================== + +Defines *Hernandez-Andres et al. (1999)* correlated colour temperature +:math:`T_{cp}` computations objects: + +- :func:`colour.temperature.xy_to_CCT_Hernandez1999`: Correlated colour + temperature :math:`T_{cp}` computation of given *CIE xy* chromaticity + coordinates using *Hernandez-Andres, Lee and Romero (1999)* method. +- :func:`colour.temperature.CCT_to_xy_Hernandez1999`: *CIE xy* chromaticity + coordinates computation of given correlated colour temperature + :math:`T_{cp}` using *Hernandez-Andres, Lee and Romero (1999)* method. + +See Also +-------- +`Colour Temperature & Correlated Colour Temperature Jupyter Notebook +`_ + +References +---------- +- :cite:`Hernandez-Andres1999a` : Hernandez-Andres, J., Lee, R. L., & + Romero, J. (1999). Calculating correlated color temperatures across the + entire gamut of daylight and skylight chromaticities. Applied Optics, + 38(27), 5703. doi:10.1364/AO.38.005703 +""" + +from __future__ import division, unicode_literals + +import numpy as np +from scipy.optimize import minimize + +from colour.colorimetry import ILLUMINANTS +from colour.utilities import as_float_array, as_numeric, tsplit, usage_warning + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = ['xy_to_CCT_Hernandez1999', 'CCT_to_xy_Hernandez1999'] + + +def xy_to_CCT_Hernandez1999(xy): + """ + Returns the correlated colour temperature :math:`T_{cp}` from given + *CIE xy* chromaticity coordinates using *Hernandez-Andres et al. (1999)* + method. + + Parameters + ---------- + xy : array_like + *CIE xy* chromaticity coordinates. + + Returns + ------- + numeric + Correlated colour temperature :math:`T_{cp}`. + + References + ---------- + :cite:`Hernandez-Andres1999a` + + Examples + -------- + >>> xy = np.array([0.31270, 0.32900]) + >>> xy_to_CCT_Hernandez1999(xy) # doctest: +ELLIPSIS + 6500.7420431... + """ + + x, y = tsplit(xy) + + n = (x - 0.3366) / (y - 0.1735) + CCT = (-949.86315 + 6253.80338 * np.exp(-n / 0.92159) + + 28.70599 * np.exp(-n / 0.20039) + 0.00004 * np.exp(-n / 0.07125)) + + n = np.where(CCT > 50000, (x - 0.3356) / (y - 0.1691), n) + + CCT = np.where( + CCT > 50000, + 36284.48953 + 0.00228 * np.exp(-n / 0.07861) + + 5.4535e-36 * np.exp(-n / 0.01543), + CCT, + ) + + return as_numeric(CCT) + + +def CCT_to_xy_Hernandez1999(CCT, optimisation_parameters=None): + """ + Returns the *CIE xy* chromaticity coordinates from given correlated colour + temperature :math:`T_{cp}` using *Hernandez-Andres et al. (1999)* method. + + Parameters + ---------- + CCT : numeric or array_like + Correlated colour temperature :math:`T_{cp}`. + optimisation_parameters : dict_like, optional + Parameters for :func:`scipy.optimize.minimize` definition. + + Returns + ------- + ndarray + *CIE xy* chromaticity coordinates. + + Warnings + -------- + *Hernandez-Andres et al. (1999)* method for computing *CIE xy* chromaticity + coordinates from given correlated colour temperature is not a bijective + function and might produce unexpected results. It is given for consistency + with other correlated colour temperature computation methods but should be + avoided for practical applications. The current implementation relies on + optimization using :func:`scipy.optimize.minimize` definition and thus has + reduced precision and poor performance. + + References + ---------- + :cite:`Hernandez-Andres1999a` + + Examples + -------- + >>> CCT_to_xy_Hernandez1999(6500.7420431786531) # doctest: +ELLIPSIS + array([ 0.3127..., 0.329...]) + """ + + usage_warning('"Hernandez-Andres et al. (1999)" method for computing ' + '"CIE xy" chromaticity coordinates from given correlated ' + 'colour temperature is not a bijective function and and' + 'might produce unexpected results. It is given for ' + 'consistency with other correlated colour temperature ' + 'computation methods but should be avoided for practical ' + 'applications.') + + CCT = as_float_array(CCT) + shape = list(CCT.shape) + CCT = np.atleast_1d(CCT.reshape([-1, 1])) + + def objective_function(xy, CCT): + """ + Objective function. + """ + + objective = np.linalg.norm(xy_to_CCT_Hernandez1999(xy) - CCT) + + return objective + + optimisation_settings = { + 'method': 'Nelder-Mead', + 'options': { + 'fatol': 1e-10, + }, + } + if optimisation_parameters is not None: + optimisation_settings.update(optimisation_parameters) + + CCT = as_float_array([ + minimize( + objective_function, + x0=ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D65'], + args=(CCT_i, ), + **optimisation_settings).x for CCT_i in CCT + ]) + + return as_numeric(CCT.reshape(shape + [2])) diff --git a/colour/temperature/kang2002.py b/colour/temperature/kang2002.py new file mode 100644 index 0000000000..84aa7f17fc --- /dev/null +++ b/colour/temperature/kang2002.py @@ -0,0 +1,168 @@ +# -*- coding: utf-8 -*- +""" +Kang, Moon, Hong, Lee, Cho and Kim (2002) Correlated Colour Temperature +======================================================================= + +Defines *Kang et al. (2002)* correlated colour temperature :math:`T_{cp}` +computations objects: + +- :func:`colour.temperature.xy_to_CCT_Kang2002`: Correlated colour + temperature :math:`T_{cp}` of given *CIE xy* chromaticity coordinates + computation using *Kang, Moon, Hong, Lee, Cho and Kim (2002)* method. +- :func:`colour.temperature.CCT_to_xy_Kang2002`: *CIE xy* chromaticity + coordinates computation of given correlated colour temperature + :math:`T_{cp}` using *Kang, Moon, Hong, Lee, Cho and Kim (2002)* method. + +See Also +-------- +`Colour Temperature & Correlated Colour Temperature Jupyter Notebook +`_ + +References +---------- +- :cite:`Kang2002a` : Kang, B., Moon, O., Hong, C., Lee, H., Cho, B., & + Kim, Y. (2002). Design of advanced color: Temperature control system for + HDTV applications. Journal of the Korean Physical Society, 41(6), 865-871. + Retrieved from http://cat.inist.fr/?aModele=afficheN&cpsidt=14448733 +""" + +from __future__ import division, unicode_literals + +import numpy as np +from scipy.optimize import minimize + +from colour.utilities import as_float_array, as_numeric, tstack, usage_warning + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = ['xy_to_CCT_Kang2002', 'CCT_to_xy_Kang2002'] + + +def xy_to_CCT_Kang2002(xy, optimisation_parameters=None): + """ + Returns the correlated colour temperature :math:`T_{cp}` from given + *CIE xy* chromaticity coordinates using *Kang et al. (2002)* method. + + Parameters + ---------- + xy : array_like + *CIE xy* chromaticity coordinates. + optimisation_parameters : dict_like, optional + Parameters for :func:`scipy.optimize.minimize` definition. + + Returns + ------- + ndarray + Correlated colour temperature :math:`T_{cp}`. + + Warnings + -------- + *Kang et al. (2002)* does not give an analytical inverse transformation to + compute the correlated colour temperature :math:`T_{cp}` from given + *CIE xy* chromaticity coordinates, the current implementation relies on + optimization using :func:`scipy.optimize.minimize` definition and thus has + reduced precision and poor performance. + + References + ---------- + :cite:`Kang2002a` + + Examples + -------- + >>> xy_to_CCT_Kang2002(np.array([0.31342600, 0.32359597])) + ... # doctest: +ELLIPSIS + 6504.3893128... + """ + + xy = as_float_array(xy) + shape = xy.shape + xy = np.atleast_1d(xy.reshape([-1, 2])) + + def objective_function(CCT, xy): + """ + Objective function. + """ + + objective = np.linalg.norm(CCT_to_xy_Kang2002(CCT) - xy) + + return objective + + optimisation_settings = { + 'method': 'Nelder-Mead', + 'options': { + 'fatol': 1e-10, + }, + } + if optimisation_parameters is not None: + optimisation_settings.update(optimisation_parameters) + + CCT = as_float_array([ + minimize( + objective_function, + x0=6500, + args=(xy_i, ), + **optimisation_settings).x for xy_i in xy + ]) + + return as_numeric(CCT.reshape(shape[:-1])) + + +def CCT_to_xy_Kang2002(CCT): + """ + Returns the *CIE xy* chromaticity coordinates from given correlated colour + temperature :math:`T_{cp}` using *Kang et al. (2002)* method. + + Parameters + ---------- + CCT : numeric or array_like + Correlated colour temperature :math:`T_{cp}`. + + Returns + ------- + ndarray + *CIE xy* chromaticity coordinates. + + Raises + ------ + ValueError + If the correlated colour temperature is not in appropriate domain. + + References + ---------- + :cite:`Kang2002a` + + Examples + -------- + >>> CCT_to_xy_Kang2002(6504.38938305) # doctest: +ELLIPSIS + array([ 0.313426 ..., 0.3235959...]) + """ + + CCT = as_float_array(CCT) + + if np.any(CCT[np.asarray(np.logical_or(CCT < 1667, CCT > 25000))]): + usage_warning(('Correlated colour temperature must be in domain ' + '[1667, 25000], unpredictable results may occur!')) + + x = np.where( + CCT <= 4000, + -0.2661239 * 10 ** 9 / CCT ** 3 - 0.2343589 * 10 ** 6 / CCT ** 2 + + 0.8776956 * 10 ** 3 / CCT + 0.179910, + -3.0258469 * 10 ** 9 / CCT ** 3 + 2.1070379 * 10 ** 6 / CCT ** 2 + + 0.2226347 * 10 ** 3 / CCT + 0.24039, + ) + + cnd_l = [CCT <= 2222, np.logical_and(CCT > 2222, CCT <= 4000), CCT > 4000] + i = -1.1063814 * x ** 3 - 1.34811020 * x ** 2 + 2.18555832 * x - 0.20219683 + j = -0.9549476 * x ** 3 - 1.37418593 * x ** 2 + 2.09137015 * x - 0.16748867 + k = 3.0817580 * x ** 3 - 5.8733867 * x ** 2 + 3.75112997 * x - 0.37001483 + y = np.select(cnd_l, [i, j, k]) + + xy = tstack([x, y]) + + return xy diff --git a/colour/temperature/krystek1985.py b/colour/temperature/krystek1985.py new file mode 100644 index 0000000000..124db63f43 --- /dev/null +++ b/colour/temperature/krystek1985.py @@ -0,0 +1,158 @@ +# -*- coding: utf-8 -*- +""" +Krystek (1985) Correlated Colour Temperature +============================================ + +Defines *Krystek (1985)* correlated colour temperature :math:`T_{cp}` +computations objects: + +- :func:`colour.temperature.uv_to_CCT_Krystek1985`: Correlated colour + temperature :math:`T_{cp}` computation of given *CIE UCS* colourspace *uv* + chromaticity coordinates using *Krystek (1985)* method. +- :func:`colour.temperature.CCT_to_uv_Krystek1985`: *CIE UCS* colourspace + *uv* chromaticity coordinates computation of given correlated colour + temperature :math:`T_{cp}` using *Krystek (1985)* method. + +See Also +-------- +`Colour Temperature & Correlated Colour Temperature Jupyter Notebook +`_ + +References +---------- +- :cite:`Krystek1985b` : Krystek, M. (1985). An algorithm to calculate + correlated colour temperature. Color Research & Application, 10(1), + 38-40. doi:10.1002/col.5080100109 +""" + +from __future__ import division, unicode_literals + +import numpy as np +from scipy.optimize import minimize + +from colour.utilities import as_float_array, as_numeric, tstack + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = ['uv_to_CCT_Krystek1985', 'CCT_to_uv_Krystek1985'] + + +def uv_to_CCT_Krystek1985(uv, optimisation_parameters=None): + """ + Returns the correlated colour temperature :math:`T_{cp}` from given + *CIE UCS* colourspace *uv* chromaticity coordinates using *Krystek (1985)* + method. + + Parameters + ---------- + uv : array_like + *CIE UCS* colourspace *uv* chromaticity coordinates. + optimisation_parameters : dict_like, optional + Parameters for :func:`scipy.optimize.minimize` definition. + + Returns + ------- + ndarray + Correlated colour temperature :math:`T_{cp}`. + + Warnings + -------- + *Krystek (1985)* does not give an analytical inverse transformation to + compute the correlated colour temperature :math:`T_{cp}` from given + *CIE UCS* colourspace *uv* chromaticity coordinates, the current + implementation relies on optimization using :func:`scipy.optimize.minimize` + definition and thus has reduced precision and poor performance. + + Notes + ----- + - *Krystek (1985)* method computations are valid for correlated colour + temperature :math:`T_{cp}` normalised to domain [1000, 15000]. + + References + ---------- + :cite:`Krystek1985b` + + Examples + -------- + >>> uv_to_CCT_Krystek1985(np.array([0.18376696, 0.30934437])) + ... # doctest: +ELLIPSIS + 6504.3896615... + """ + + uv = as_float_array(uv) + shape = uv.shape + uv = np.atleast_1d(uv.reshape([-1, 2])) + + def objective_function(CCT, uv): + """ + Objective function. + """ + + objective = np.linalg.norm(CCT_to_uv_Krystek1985(CCT) - uv) + + return objective + + optimisation_settings = { + 'method': 'Nelder-Mead', + 'options': { + 'fatol': 1e-10, + }, + } + if optimisation_parameters is not None: + optimisation_settings.update(optimisation_parameters) + + CCT = as_float_array([ + minimize( + objective_function, + x0=6500, + args=(uv_i, ), + **optimisation_settings).x for uv_i in uv + ]) + + return as_numeric(CCT.reshape(shape[:-1])) + + +def CCT_to_uv_Krystek1985(CCT): + """ + Returns the *CIE UCS* colourspace *uv* chromaticity coordinates from given + correlated colour temperature :math:`T_{cp}` using *Krystek (1985)* method. + + Parameters + ---------- + CCT : array_like + Correlated colour temperature :math:`T_{cp}`. + + Returns + ------- + ndarray + *CIE UCS* colourspace *uv* chromaticity coordinates. + + Notes + ----- + - *Krystek (1985)* method computations are valid for correlated colour + temperature :math:`T_{cp}` normalised to domain [1000, 15000]. + + References + ---------- + :cite:`Krystek1985b` + + Examples + -------- + >>> CCT_to_uv_Krystek1985(6504.38938305) # doctest: +ELLIPSIS + array([ 0.1837669..., 0.3093443...]) + """ + + T = as_float_array(CCT) + + u = ((0.860117757 + 1.54118254 * 10e-4 * T + 1.28641212 * 10e-7 * T ** 2) / + (1 + 8.42420235 * 10e-4 * T + 7.08145163 * 10e-7 * T ** 2)) + v = ((0.317398726 + 4.22806245 * 10e-5 * T + 4.20481691 * 10e-8 * T ** 2) / + (1 - 2.89741816 * 10e-5 * T + 1.61456053 * 10e-7 * T ** 2)) + + return tstack([u, v]) diff --git a/colour/temperature/mccamy1992.py b/colour/temperature/mccamy1992.py new file mode 100644 index 0000000000..db7f52d68b --- /dev/null +++ b/colour/temperature/mccamy1992.py @@ -0,0 +1,155 @@ +# -*- coding: utf-8 -*- +""" +McCamy (1992) Correlated Colour Temperature +=========================================== + +Defines *McCamy (1992)* correlated colour temperature :math:`T_{cp}` +computations objects: + +- :func:`colour.temperature.xy_to_CCT_McCamy1992`: Correlated colour + temperature :math:`T_{cp}` computation of given *CIE xy* chromaticity + coordinates using *McCamy (1992)* method. +- :func:`colour.temperature.xy_to_CCT_McCamy1992`: *CIE xy* chromaticity + coordinates computation of given correlated colour temperature + :math:`T_{cp}` using *McCamy (1992)* method. + +See Also +-------- +`Colour Temperature & Correlated Colour Temperature Jupyter Notebook +`_ + +References +---------- +- :cite:`Wikipedia2001` : Wikipedia. (2001). Approximation. Retrieved June + 28, 2014, from http://en.wikipedia.org/wiki/Color_temperature#Approximation +""" + +from __future__ import division, unicode_literals + +import numpy as np +from scipy.optimize import minimize + +from colour.colorimetry import ILLUMINANTS +from colour.utilities import as_float_array, as_numeric, tsplit, usage_warning + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = ['xy_to_CCT_McCamy1992', 'CCT_to_xy_McCamy1992'] + + +def xy_to_CCT_McCamy1992(xy): + """ + Returns the correlated colour temperature :math:`T_{cp}` from given + *CIE xy* chromaticity coordinates using *McCamy (1992)* method. + + Parameters + ---------- + xy : array_like + *CIE xy* chromaticity coordinates. + + Returns + ------- + numeric or ndarray + Correlated colour temperature :math:`T_{cp}`. + + References + ---------- + :cite:`Wikipedia2001` + + Examples + -------- + >>> import numpy as np + >>> xy = np.array([0.31270, 0.32900]) + >>> xy_to_CCT_McCamy1992(xy) # doctest: +ELLIPSIS + 6505.0805913... + """ + + x, y = tsplit(xy) + + n = (x - 0.3320) / (y - 0.1858) + CCT = -449 * n ** 3 + 3525 * n ** 2 - 6823.3 * n + 5520.33 + + return CCT + + +def CCT_to_xy_McCamy1992(CCT, optimisation_parameters=None): + """ + Returns the *CIE xy* chromaticity coordinates from given correlated colour + temperature :math:`T_{cp}` using *McCamy (1992)* method. + + Parameters + ---------- + CCT : numeric or array_like + Correlated colour temperature :math:`T_{cp}`. + optimisation_parameters : dict_like, optional + Parameters for :func:`scipy.optimize.minimize` definition. + + Returns + ------- + ndarray + *CIE xy* chromaticity coordinates. + + Warnings + -------- + *McCamy (1992)* method for computing *CIE xy* chromaticity coordinates + from given correlated colour temperature is a bijective function and might + produce unexpected results. It is given for consistency with other + correlated colour temperature computation methods but should be avoided + for practical applications.The current implementation relies on + optimization using :func:`scipy.optimize.minimize` definition and thus has + reduced precision and poor performance. + + References + ---------- + :cite:`Wikipedia2001` + + Examples + -------- + >>> CCT_to_xy_McCamy1992(6505.0805913074782) # doctest: +ELLIPSIS + array([ 0.3127..., 0.329...]) + """ + + usage_warning('"*McCamy (1992)" method for computing "CIE xy" ' + 'chromaticity coordinates from given correlated colour ' + 'temperature is not a bijective function and might produce ' + 'unexpected results. It is given for consistency with other ' + 'correlated colour temperature computation methods but ' + 'should be avoided for practical applications.') + + CCT = as_float_array(CCT) + shape = list(CCT.shape) + CCT = np.atleast_1d(CCT.reshape([-1, 1])) + + def objective_function(xy, CCT): + """ + Objective function. + """ + + objective = np.linalg.norm(xy_to_CCT_McCamy1992(xy) - CCT) + + return objective + + optimisation_settings = { + 'method': 'Nelder-Mead', + 'options': { + 'fatol': 1e-10, + }, + } + if optimisation_parameters is not None: + optimisation_settings.update(optimisation_parameters) + + CCT = as_float_array([ + minimize( + objective_function, + x0=ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D65'], + args=(CCT_i, ), + **optimisation_settings).x for CCT_i in CCT + ]) + + return as_numeric(CCT.reshape(shape + [2])) diff --git a/colour/temperature/ohno2013.py b/colour/temperature/ohno2013.py new file mode 100644 index 0000000000..c782246647 --- /dev/null +++ b/colour/temperature/ohno2013.py @@ -0,0 +1,419 @@ +# -*- coding: utf-8 -*- +""" +Ohno (2013) Correlated Colour Temperature +========================================= + +Defines *Ohno (2013)* correlated colour temperature :math:`T_{cp}` computations +objects: + +- :func:`colour.temperature.uv_to_CCT_Ohno2013`: Correlated colour + temperature :math:`T_{cp}` and :math:`\\Delta_{uv}` computation of given + *CIE UCS* colourspace *uv* chromaticity coordinates using *Ohno (2013)* + method. +- :func:`colour.temperature.CCT_to_uv_Ohno2013`: *CIE UCS* colourspace *uv* + chromaticity coordinates computation of given correlated colour temperature + :math:`T_{cp}`, :math:`\\Delta_{uv}` using *Ohno (2013)* method. + +See Also +-------- +`Colour Temperature & Correlated Colour Temperature Jupyter Notebook +`_ + +References +---------- +- :cite:`Ohno2014a` : Ohno, Y. (2014). Practical Use and Calculation of CCT + and Duv. LEUKOS, 10(1), 47-55. doi:10.1080/15502724.2014.839020 +""" + +from __future__ import division, unicode_literals + +import numpy as np +from collections import namedtuple + +from colour.colorimetry import ( + DEFAULT_SPECTRAL_SHAPE, STANDARD_OBSERVERS_CMFS, sd_blackbody, sd_to_XYZ) +from colour.models import UCS_to_uv, XYZ_to_UCS +from colour.utilities import as_float_array, runtime_warning, tsplit + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = [ + 'PLANCKIAN_TABLE_TUVD', 'CCT_MINIMAL', 'CCT_MAXIMAL', 'CCT_SAMPLES', + 'CCT_CALCULATION_ITERATIONS', 'planckian_table', + 'planckian_table_minimal_distance_index', 'uv_to_CCT_Ohno2013', + 'CCT_to_uv_Ohno2013' +] + +PLANCKIAN_TABLE_TUVD = namedtuple('PlanckianTable_Tuvdi', + ('Ti', 'ui', 'vi', 'di')) + +CCT_MINIMAL = 1000 +CCT_MAXIMAL = 100000 +CCT_SAMPLES = 10 +CCT_CALCULATION_ITERATIONS = 6 + + +def planckian_table(uv, cmfs, start, end, count): + """ + Returns a planckian table from given *CIE UCS* colourspace *uv* + chromaticity coordinates, colour matching functions and temperature range + using *Ohno (2013)* method. + + Parameters + ---------- + uv : array_like + *uv* chromaticity coordinates. + cmfs : XYZ_ColourMatchingFunctions + Standard observer colour matching functions. + start : numeric + Temperature range start in kelvins. + end : numeric + Temperature range end in kelvins. + count : int + Temperatures count in the planckian table. + + Returns + ------- + list + Planckian table. + + Examples + -------- + >>> from colour import DEFAULT_SPECTRAL_SHAPE, STANDARD_OBSERVERS_CMFS + >>> from pprint import pprint + >>> cmfs = ( + ... STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer']. + ... copy().align(DEFAULT_SPECTRAL_SHAPE) + ... ) + >>> uv = np.array([0.1978, 0.3122]) + >>> pprint(planckian_table(uv, cmfs, 1000, 1010, 10)) + ... # doctest: +ELLIPSIS + [PlanckianTable_Tuvdi(Ti=1000.0, \ +ui=0.4479628..., vi=0.3546296..., di=0.2537355...), + PlanckianTable_Tuvdi(Ti=1001.1111111..., \ +ui=0.4477030..., vi=0.3546521..., di=0.2534831...), + PlanckianTable_Tuvdi(Ti=1002.2222222..., \ +ui=0.4474434..., vi=0.3546746..., di=0.2532310...), + PlanckianTable_Tuvdi(Ti=1003.3333333..., \ +ui=0.4471842..., vi=0.3546970..., di=0.2529792...), + PlanckianTable_Tuvdi(Ti=1004.4444444..., \ +ui=0.4469252..., vi=0.3547194..., di=0.2527277...), + PlanckianTable_Tuvdi(Ti=1005.5555555..., \ +ui=0.4466666..., vi=0.3547417..., di=0.2524765...), + PlanckianTable_Tuvdi(Ti=1006.6666666..., \ +ui=0.4464083..., vi=0.3547640..., di=0.2522256...), + PlanckianTable_Tuvdi(Ti=1007.7777777..., \ +ui=0.4461502..., vi=0.3547862..., di=0.2519751...), + PlanckianTable_Tuvdi(Ti=1008.8888888..., \ +ui=0.4458925..., vi=0.3548084..., di=0.2517248...), + PlanckianTable_Tuvdi(Ti=1010.0, \ +ui=0.4456351..., vi=0.3548306..., di=0.2514749...)] + """ + + ux, vx = uv + + cmfs = cmfs.copy().trim(DEFAULT_SPECTRAL_SHAPE) + + shape = cmfs.shape + + table = [] + for Ti in np.linspace(start, end, count): + sd = sd_blackbody(Ti, shape) + XYZ = sd_to_XYZ(sd, cmfs) + XYZ /= np.max(XYZ) + UVW = XYZ_to_UCS(XYZ) + ui, vi = UCS_to_uv(UVW) + di = np.hypot(ux - ui, vx - vi) + table.append(PLANCKIAN_TABLE_TUVD(Ti, ui, vi, di)) + + return table + + +def planckian_table_minimal_distance_index(planckian_table_): + """ + Returns the shortest distance index in given planckian table using + *Ohno (2013)* method. + + Parameters + ---------- + planckian_table_ : list + Planckian table. + + Returns + ------- + int + Shortest distance index. + + Examples + -------- + >>> from colour import DEFAULT_SPECTRAL_SHAPE, STANDARD_OBSERVERS_CMFS + >>> cmfs = ( + ... STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer']. + ... copy().align(DEFAULT_SPECTRAL_SHAPE) + ... ) + >>> uv = np.array([0.1978, 0.3122]) + >>> table = planckian_table(uv, cmfs, 1000, 1010, 10) + >>> planckian_table_minimal_distance_index(table) + 9 + """ + + distances = [x.di for x in planckian_table_] + return distances.index(min(distances)) + + +def _uv_to_CCT_Ohno2013( + uv, + cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] + .copy().trim(DEFAULT_SPECTRAL_SHAPE), + start=CCT_MINIMAL, + end=CCT_MAXIMAL, + count=CCT_SAMPLES, + iterations=CCT_CALCULATION_ITERATIONS): + """ + Returns the correlated colour temperature :math:`T_{cp}` and + :math:`\\Delta_{uv}` from given *CIE UCS* colourspace *uv* chromaticity + coordinates, colour matching functions and temperature range using + *Ohno (2013)* method. + + The iterations parameter defines the calculations precision: The higher its + value, the more planckian tables will be generated through cascade + expansion in order to converge to the exact solution. + + Parameters + ---------- + uv : array_like + *CIE UCS* colourspace *uv* chromaticity coordinates. + cmfs : XYZ_ColourMatchingFunctions, optional + Standard observer colour matching functions. + start : numeric, optional + Temperature range start in kelvins. + end : numeric, optional + Temperature range end in kelvins. + count : int, optional + Temperatures count in the planckian tables. + iterations : int, optional + Number of planckian tables to generate. + + Returns + ------- + ndarray + Correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}`. + """ + + # Ensuring we do at least one iteration to initialise variables. + iterations = max(iterations, 1) + + # Planckian table creation through cascade expansion. + for _i in range(iterations): + table = planckian_table(uv, cmfs, start, end, count) + index = planckian_table_minimal_distance_index(table) + if index == 0: + runtime_warning( + ('Minimal distance index is on lowest planckian table bound, ' + 'unpredictable results may occur!')) + index += 1 + elif index == len(table) - 1: + runtime_warning( + ('Minimal distance index is on highest planckian table bound, ' + 'unpredictable results may occur!')) + index -= 1 + + start = table[index - 1].Ti + end = table[index + 1].Ti + + _ux, vx = uv + + Tuvdip, Tuvdi, Tuvdin = (table[index - 1], table[index], table[index + 1]) + Tip, uip, vip, dip = Tuvdip.Ti, Tuvdip.ui, Tuvdip.vi, Tuvdip.di + Ti, di = Tuvdi.Ti, Tuvdi.di + Tin, uin, vin, din = Tuvdin.Ti, Tuvdin.ui, Tuvdin.vi, Tuvdin.di + + # Triangular solution. + l = np.hypot(uin - uip, vin - vip) # noqa + x = (dip ** 2 - din ** 2 + l ** 2) / (2 * l) + T = Tip + (Tin - Tip) * (x / l) + + vtx = vip + (vin - vip) * (x / l) + sign = 1 if vx - vtx >= 0 else -1 + D_uv = (dip ** 2 - x ** 2) ** (1 / 2) * sign + + # Parabolic solution. + if np.abs(D_uv) >= 0.002: + X = (Tin - Ti) * (Tip - Tin) * (Ti - Tip) + a = (Tip * (din - di) + Ti * (dip - din) + Tin * (di - dip)) * X ** -1 + b = (-(Tip ** 2 * (din - di) + Ti ** 2 * (dip - din) + Tin ** 2 * + (di - dip)) * X ** -1) + c = ( + -(dip * (Tin - Ti) * Ti * Tin + di * + (Tip - Tin) * Tip * Tin + din * (Ti - Tip) * Tip * Ti) * X ** -1) + + T = -b / (2 * a) + + D_uv = sign * (a * T ** 2 + b * T + c) + + return np.array([T, D_uv]) + + +def uv_to_CCT_Ohno2013( + uv, + cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'], + start=CCT_MINIMAL, + end=CCT_MAXIMAL, + count=CCT_SAMPLES, + iterations=CCT_CALCULATION_ITERATIONS): + """ + Returns the correlated colour temperature :math:`T_{cp}` and + :math:`\\Delta_{uv}` from given *CIE UCS* colourspace *uv* chromaticity + coordinates, colour matching functions and temperature range using + *Ohno (2013)* method. + + The iterations parameter defines the calculations precision: The higher its + value, the more planckian tables will be generated through cascade + expansion in order to converge to the exact solution. + + Parameters + ---------- + uv : array_like + *CIE UCS* colourspace *uv* chromaticity coordinates. + cmfs : XYZ_ColourMatchingFunctions, optional + Standard observer colour matching functions. + start : numeric, optional + Temperature range start in kelvins. + end : numeric, optional + Temperature range end in kelvins. + count : int, optional + Temperatures count in the planckian tables. + iterations : int, optional + Number of planckian tables to generate. + + Returns + ------- + ndarray + Correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}`. + + References + ---------- + :cite:`Ohno2014a` + + Examples + -------- + >>> from colour import DEFAULT_SPECTRAL_SHAPE, STANDARD_OBSERVERS_CMFS + >>> cmfs = ( + ... STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer']. + ... copy().align(DEFAULT_SPECTRAL_SHAPE) + ... ) + >>> uv = np.array([0.1978, 0.3122]) + >>> uv_to_CCT_Ohno2013(uv, cmfs) # doctest: +ELLIPSIS + array([ 6.5074738...e+03, 3.2233461...e-03]) + """ + + uv = as_float_array(uv) + + CCT_D_uv = [ + _uv_to_CCT_Ohno2013(a, cmfs, start, end, count, iterations) + for a in np.reshape(uv, (-1, 2)) + ] + + return as_float_array(CCT_D_uv).reshape(uv.shape) + + +def _CCT_to_uv_Ohno2013( + CCT_D_uv, + cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer']): + """ + Returns the *CIE UCS* colourspace *uv* chromaticity coordinates from given + correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}` and + colour matching functions using *Ohno (2013)* method. + + Parameters + ---------- + CCT_D_uv : ndarray + Correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}`. + cmfs : XYZ_ColourMatchingFunctions, optional + Standard observer colour matching functions. + + Returns + ------- + ndarray + *CIE UCS* colourspace *uv* chromaticity coordinates. + """ + + CCT, D_uv = tsplit(CCT_D_uv) + + cmfs = cmfs.copy().trim(DEFAULT_SPECTRAL_SHAPE) + + shape = cmfs.shape + + delta = 0.01 + + sd = sd_blackbody(CCT, shape) + XYZ = sd_to_XYZ(sd, cmfs) + XYZ *= 1 / np.max(XYZ) + UVW = XYZ_to_UCS(XYZ) + u0, v0 = UCS_to_uv(UVW) + + if D_uv == 0: + return np.array([u0, v0]) + else: + sd = sd_blackbody(CCT + delta, shape) + XYZ = sd_to_XYZ(sd, cmfs) + XYZ *= 1 / np.max(XYZ) + UVW = XYZ_to_UCS(XYZ) + u1, v1 = UCS_to_uv(UVW) + + du = u0 - u1 + dv = v0 - v1 + + u = u0 - D_uv * (dv / np.hypot(du, dv)) + v = v0 + D_uv * (du / np.hypot(du, dv)) + + return np.array([u, v]) + + +def CCT_to_uv_Ohno2013( + CCT_D_uv, + cmfs=STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer']): + """ + Returns the *CIE UCS* colourspace *uv* chromaticity coordinates from given + correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}` and + colour matching functions using *Ohno (2013)* method. + + Parameters + ---------- + CCT_D_uv : ndarray + Correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}`. + cmfs : XYZ_ColourMatchingFunctions, optional + Standard observer colour matching functions. + + Returns + ------- + ndarray + *CIE UCS* colourspace *uv* chromaticity coordinates. + + References + ---------- + :cite:`Ohno2014a` + + Examples + -------- + >>> from colour import DEFAULT_SPECTRAL_SHAPE, STANDARD_OBSERVERS_CMFS + >>> cmfs = ( + ... STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer']. + ... copy().align(DEFAULT_SPECTRAL_SHAPE) + ... ) + >>> CCT_D_uv = np.array([6507.4342201047066, 0.003223690901513]) + >>> CCT_to_uv_Ohno2013(CCT_D_uv, cmfs) # doctest: +ELLIPSIS + array([ 0.1977999..., 0.3122004...]) + """ + + CCT_D_uv = as_float_array(CCT_D_uv) + + uv = [_CCT_to_uv_Ohno2013(a, cmfs) for a in np.reshape(CCT_D_uv, (-1, 2))] + + return as_float_array(uv).reshape(CCT_D_uv.shape) diff --git a/colour/temperature/robertson1968.py b/colour/temperature/robertson1968.py new file mode 100644 index 0000000000..095beecace --- /dev/null +++ b/colour/temperature/robertson1968.py @@ -0,0 +1,315 @@ +# -*- coding: utf-8 -*- +""" +Robertson (1968) Correlated Colour Temperature +============================================== + +Defines *Robertson (1968)* correlated colour temperature :math:`T_{cp}` +computations objects: + +- :func:`colour.temperature.uv_to_CCT_Robertson1968`: Correlated colour + temperature :math:`T_{cp}` and :math:`\\Delta_{uv}` computation of given + *CIE UCS* colourspace *uv* chromaticity coordinates using + *Robertson (1968)* method. +- :func:`colour.temperature.CCT_to_uv_Robertson1968`: *CIE UCS* colourspace + *uv* chromaticity coordinates computation of given correlated colour + temperature :math:`T_{cp}` and :math:`\\Delta_{uv}` using + *Robertson (1968)* method. + +See Also +-------- +`Colour Temperature & Correlated Colour Temperature Jupyter Notebook +`_ + +References +---------- +- :cite:`AdobeSystems2013` : Adobe Systems. (2013). Adobe DNG Software + Development Kit (SDK) - 1.3.0.0 - dng_sdk_1_3/dng_sdk/source/\ +dng_temperature.cpp::dng_temperature::Set_xy_coord. Retrieved from + https://www.adobe.com/support/downloads/dng/dng_sdk.html +- :cite:`AdobeSystems2013a` : Adobe Systems. (2013). Adobe DNG Software + Development Kit (SDK) - 1.3.0.0 - dng_sdk_1_3/dng_sdk/source/\ +dng_temperature.cpp::dng_temperature::xy_coord. Retrieved from + https://www.adobe.com/support/downloads/dng/dng_sdk.html +- :cite:`Wyszecki2000x` : Wyszecki, G., & Stiles, W. S. (2000). Table 1(3.11) + Isotemperature Lines. In Color Science: Concepts and Methods, Quantitative + Data and Formulae (p. 228). Wiley. ISBN:978-0471399186 +- :cite:`Wyszecki2000y` : Wyszecki, G., & Stiles, W. S. (2000). DISTRIBUTION + TEMPERATURE, COLOR TEMPERATURE, AND CORRELATED COLOR TEMPERATURE. In + Color Science: Concepts and Methods, Quantitative Data and Formulae + (pp. 224-229). Wiley. ISBN:978-0471399186 +""" + +from __future__ import division, unicode_literals + +import numpy as np +from collections import namedtuple + +from colour.utilities import as_float_array, tsplit + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = [ + 'ROBERTSON_ISOTEMPERATURE_LINES_DATA', + 'ROBERTSON_ISOTEMPERATURE_LINES_RUVT', 'ROBERTSON_ISOTEMPERATURE_LINES', + 'uv_to_CCT_Robertson1968', 'CCT_to_uv_Robertson1968' +] + +ROBERTSON_ISOTEMPERATURE_LINES_DATA = ( + (0, 0.18006, 0.26352, -0.24341), + (10, 0.18066, 0.26589, -0.25479), + (20, 0.18133, 0.26846, -0.26876), + (30, 0.18208, 0.27119, -0.28539), + (40, 0.18293, 0.27407, -0.30470), + (50, 0.18388, 0.27709, -0.32675), + (60, 0.18494, 0.28021, -0.35156), + (70, 0.18611, 0.28342, -0.37915), + (80, 0.18740, 0.28668, -0.40955), + (90, 0.18880, 0.28997, -0.44278), + (100, 0.19032, 0.29326, -0.47888), + (125, 0.19462, 0.30141, -0.58204), + (150, 0.19962, 0.30921, -0.70471), + (175, 0.20525, 0.31647, -0.84901), + (200, 0.21142, 0.32312, -1.0182), + (225, 0.21807, 0.32909, -1.2168), + (250, 0.22511, 0.33439, -1.4512), + (275, 0.23247, 0.33904, -1.7298), + (300, 0.24010, 0.34308, -2.0637), + (325, 0.24792, 0.34655, -2.4681), # 0.24702 ---> 0.24792 Bruce Lindbloom + (350, 0.25591, 0.34951, -2.9641), + (375, 0.26400, 0.35200, -3.5814), + (400, 0.27218, 0.35407, -4.3633), + (425, 0.28039, 0.35577, -5.3762), + (450, 0.28863, 0.35714, -6.7262), + (475, 0.29685, 0.35823, -8.5955), + (500, 0.30505, 0.35907, -11.324), + (525, 0.31320, 0.35968, -15.628), + (550, 0.32129, 0.36011, -23.325), + (575, 0.32931, 0.36038, -40.770), + (600, 0.33724, 0.36051, -116.45)) +""" +*Robertson (1968)* iso-temperature lines. + +ROBERTSON_ISOTEMPERATURE_LINES_DATA : tuple + (Reciprocal Megakelvin, + CIE 1960 Chromaticity Coordinate *u*, + CIE 1960 Chromaticity Coordinate *v*, + Slope) + +Notes +----- +- A correction has been done by Lindbloom for *325* Megakelvin + temperature: 0.24702 ---> 0.24792 + +References +---------- +:cite:`Wyszecki2000x` +""" + +ROBERTSON_ISOTEMPERATURE_LINES_RUVT = namedtuple('WyszeckiRobertson_ruvt', + ('r', 'u', 'v', 't')) + +ROBERTSON_ISOTEMPERATURE_LINES = [ + ROBERTSON_ISOTEMPERATURE_LINES_RUVT(*x) + for x in ROBERTSON_ISOTEMPERATURE_LINES_DATA +] + + +def _uv_to_CCT_Robertson1968(uv): + """ + Returns the correlated colour temperature :math:`T_{cp}` and + :math:`\\Delta_{uv}` from given *CIE UCS* colourspace *uv* chromaticity + coordinates using *Roberston (1968)* method. + + Parameters + ---------- + uv : array_like + *CIE UCS* colourspace *uv* chromaticity coordinates. + + Returns + ------- + ndarray + Correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}`. + """ + + u, v = uv + + last_dt = last_dv = last_du = 0 + + for i in range(1, 31): + wr_ruvt = ROBERTSON_ISOTEMPERATURE_LINES[i] + wr_ruvt_previous = ROBERTSON_ISOTEMPERATURE_LINES[i - 1] + + du = 1 + dv = wr_ruvt.t + + length = np.hypot(1, dv) + + du /= length + dv /= length + + uu = u - wr_ruvt.u + vv = v - wr_ruvt.v + + dt = -uu * dv + vv * du + + if dt <= 0 or i == 30: + if dt > 0: + dt = 0 + + dt = -dt + + f = 0 if i == 1 else dt / (last_dt + dt) + + T = 1.0e6 / (wr_ruvt_previous.r * f + wr_ruvt.r * (1 - f)) + + uu = u - (wr_ruvt_previous.u * f + wr_ruvt.u * (1 - f)) + vv = v - (wr_ruvt_previous.v * f + wr_ruvt.v * (1 - f)) + + du = du * (1 - f) + last_du * f + dv = dv * (1 - f) + last_dv * f + + length = np.hypot(du, dv) + + du /= length + dv /= length + + D_uv = uu * du + vv * dv + + break + + last_dt = dt + last_du = du + last_dv = dv + + return np.array([T, -D_uv]) + + +def uv_to_CCT_Robertson1968(uv): + """ + Returns the correlated colour temperature :math:`T_{cp}` and + :math:`\\Delta_{uv}` from given *CIE UCS* colourspace *uv* chromaticity + coordinates using *Roberston (1968)* method. + + Parameters + ---------- + uv : array_like + *CIE UCS* colourspace *uv* chromaticity coordinates. + + Returns + ------- + ndarray + Correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}`. + + References + ---------- + :cite:`AdobeSystems2013`, :cite:`Wyszecki2000y` + + Examples + -------- + >>> uv = np.array([0.193741375998230, 0.315221043940594]) + >>> uv_to_CCT_Robertson1968(uv) # doctest: +ELLIPSIS + array([ 6.5000162...e+03, 8.3333289...e-03]) + """ + + uv = as_float_array(uv) + + CCT_D_uv = [_uv_to_CCT_Robertson1968(a) for a in np.reshape(uv, (-1, 2))] + + return as_float_array(CCT_D_uv).reshape(uv.shape) + + +def _CCT_to_uv_Robertson1968(CCT_D_uv): + """ + Returns the *CIE UCS* colourspace *uv* chromaticity coordinates from given + correlated colour temperature :math:`T_{cp}` and :math:`\\Delta_{uv}` using + *Roberston (1968)* method. + + Parameters + ---------- + CCT_D_uv : ndarray + Correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}`. + + Returns + ------- + ndarray + *CIE UCS* colourspace *uv* chromaticity coordinates. + """ + + CCT, D_uv = tsplit(CCT_D_uv) + + r = 1.0e6 / CCT + + for i in range(30): + wr_ruvt = ROBERTSON_ISOTEMPERATURE_LINES[i] + wr_ruvt_next = ROBERTSON_ISOTEMPERATURE_LINES[i + 1] + + if r < wr_ruvt_next.r or i == 29: + f = (wr_ruvt_next.r - r) / (wr_ruvt_next.r - wr_ruvt.r) + + u = wr_ruvt.u * f + wr_ruvt_next.u * (1 - f) + v = wr_ruvt.v * f + wr_ruvt_next.v * (1 - f) + + uu1 = uu2 = 1.0 + vv1, vv2 = wr_ruvt.t, wr_ruvt_next.t + + length1 = np.hypot(1, vv1) + length2 = np.hypot(1, vv2) + + uu1 /= length1 + vv1 /= length1 + + uu2 /= length2 + vv2 /= length2 + + uu3 = uu1 * f + uu2 * (1 - f) + vv3 = vv1 * f + vv2 * (1 - f) + + len3 = np.sqrt(uu3 * uu3 + vv3 * vv3) + + uu3 /= len3 + vv3 /= len3 + + u += uu3 * -D_uv + v += vv3 * -D_uv + + return np.array([u, v]) + + +def CCT_to_uv_Robertson1968(CCT_D_uv): + """ + Returns the *CIE UCS* colourspace *uv* chromaticity coordinates from given + correlated colour temperature :math:`T_{cp}` and :math:`\\Delta_{uv}` using + *Roberston (1968)* method. + + Parameters + ---------- + CCT_D_uv : ndarray + Correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}`. + + Returns + ------- + ndarray + *CIE UCS* colourspace *uv* chromaticity coordinates. + + References + ---------- + :cite:`AdobeSystems2013a`, :cite:`Wyszecki2000y` + + Examples + -------- + >>> CCT_D_uv = np.array([6500.0081378199056, 0.008333331244225]) + >>> CCT_to_uv_Robertson1968(CCT_D_uv) # doctest: +ELLIPSIS + array([ 0.1937413..., 0.3152210...]) + """ + + CCT_D_uv = as_float_array(CCT_D_uv) + + uv = [_CCT_to_uv_Robertson1968(a) for a in np.reshape(CCT_D_uv, (-1, 2))] + + return as_float_array(uv).reshape(CCT_D_uv.shape) diff --git a/colour/temperature/tests/test_cct.py b/colour/temperature/tests/test_cct.py deleted file mode 100644 index ceba5a393f..0000000000 --- a/colour/temperature/tests/test_cct.py +++ /dev/null @@ -1,709 +0,0 @@ -# -*- coding: utf-8 -*- -""" -Defines unit tests for :mod:`colour.temperature.cct` module. -""" - -from __future__ import division, unicode_literals - -import numpy as np -import unittest -from itertools import permutations - -from colour.colorimetry import STANDARD_OBSERVERS_CMFS -from colour.temperature import ( - CCT_to_uv_Ohno2013, CCT_to_uv_Robertson1968, CCT_to_uv_Krystek1985, - uv_to_CCT_Ohno2013, uv_to_CCT_Robertson1968, CCT_to_xy_Kang2002, - CCT_to_xy_CIE_D, xy_to_CCT_McCamy1992, xy_to_CCT_Hernandez1999) -from colour.temperature.cct import (planckian_table, - planckian_table_minimal_distance_index) -from colour.utilities import disable_multiprocessing, ignore_numpy_errors - -__author__ = 'Colour Developers' -__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' -__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' -__maintainer__ = 'Colour Developers' -__email__ = 'colour-science@googlegroups.com' -__status__ = 'Production' - -__all__ = [ - 'TestPlanckianTable', 'TestPlanckianTableMinimalDistanceIndex', - 'Testuv_to_CCT_Ohno2013', 'TestCCT_to_uv_Ohno2013', - 'Testuv_to_CCT_Robertson1968', 'TestCCT_to_uv_Robertson1968', - 'TestCCT_to_uv_Krystek1985', 'Testxy_to_CCT_McCamy1992', - 'Testxy_to_CCT_Hernandez1999', 'TestCCT_to_xy_Kang2002', - 'TestCCT_to_xy_CIE_D' -] - -PLANCKIAN_TABLE = np.array([ - [1000.00000000, 0.44796288, 0.35462962, 0.25373557], - [1001.11111111, 0.44770303, 0.35465214, 0.25348315], - [1002.22222222, 0.44744348, 0.35467461, 0.25323104], - [1003.33333333, 0.44718423, 0.35469704, 0.25297924], - [1004.44444444, 0.44692529, 0.35471942, 0.25272774], - [1005.55555556, 0.44666666, 0.35474175, 0.25247656], - [1006.66666667, 0.44640833, 0.35476404, 0.25222569], - [1007.77777778, 0.44615030, 0.35478628, 0.25197512], - [1008.88888889, 0.44589258, 0.35480848, 0.25172487], - [1010.00000000, 0.44563516, 0.35483063, 0.25147492], -]) - -TEMPERATURE_DUV_TO_UV = { - (2000, -0.0500): np.array([0.309448284638118, 0.309263824757947]), - (2000, -0.0250): np.array([0.307249142319059, 0.334166912378974]), - (2000, 0.0000): np.array([0.305050000000000, 0.359070000000000]), - (2000, 0.0250): np.array([0.302850857680941, 0.383973087621026]), - (2000, 0.0500): np.array([0.300651715361882, 0.408876175242053]), - (4500, -0.0500): np.array([0.249455133366328, 0.290111562671684]), - (4500, -0.0250): np.array([0.233393122238719, 0.309269114669175]), - (4500, 0.0000): np.array([0.217331111111111, 0.328426666666667]), - (4500, 0.0250): np.array([0.201269099983503, 0.347584218664158]), - (4500, 0.0500): np.array([0.185207088855895, 0.366741770661649]), - (7000, -0.0500): np.array([0.239763542240142, 0.279200871249525]), - (7000, -0.0250): np.array([0.218977485405785, 0.293091149910477]), - (7000, 0.0000): np.array([0.198191428571429, 0.306981428571429]), - (7000, 0.0250): np.array([0.177405371737072, 0.320871707232380]), - (7000, 0.0500): np.array([0.156619314902715, 0.334761985893332]), - (9500, -0.0500): np.array([0.235948844766320, 0.272619554367689]), - (9500, -0.0250): np.array([0.213587053962107, 0.283797671920686]), - (9500, 0.0000): np.array([0.191225263157895, 0.294975789473684]), - (9500, 0.0250): np.array([0.168863472353682, 0.306153907026682]), - (9500, 0.0500): np.array([0.146501681549470, 0.317332024579680]), - (12000, -0.0500): np.array([0.233956908310164, 0.268393952067210]), - (12000, -0.0250): np.array([0.210911787488415, 0.278085309366938]), - (12000, 0.0000): np.array([0.187866666666667, 0.287776666666667]), - (12000, 0.0250): np.array([0.164821545844918, 0.297468023966395]), - (12000, 0.0500): np.array([0.141776425023169, 0.307159381266124]), - (14500, -0.0500): np.array([0.232785809380768, 0.265479540863524]), - (14500, -0.0250): np.array([0.209387387449005, 0.274283735949003]), - (14500, 0.0000): np.array([0.185988965517241, 0.283087931034483]), - (14500, 0.0250): np.array([0.162590543585478, 0.291892126119962]), - (14500, 0.0500): np.array([0.139192121653715, 0.300696321205442]), - (17000, -0.0500): np.array([0.232028466821727, 0.263383405240889]), - (17000, -0.0250): np.array([0.208421880469687, 0.271613173208680]), - (17000, 0.0000): np.array([0.184815294117647, 0.279842941176471]), - (17000, 0.0250): np.array([0.161208707765607, 0.288072709144261]), - (17000, 0.0500): np.array([0.137602121413567, 0.296302477112052]), - (19500, -0.0500): np.array([0.231498602829451, 0.261824985205592]), - (19500, -0.0250): np.array([0.207757250132674, 0.269657492602796]), - (19500, 0.0000): np.array([0.184015897435897, 0.277490000000000]), - (19500, 0.0250): np.array([0.160274544739121, 0.285322507397204]), - (19500, 0.0500): np.array([0.136533192042344, 0.293155014794408]), - (22000, -0.0500): np.array([0.231114936519607, 0.260621561540512]), - (22000, -0.0250): np.array([0.207281559168895, 0.268169417133892]), - (22000, 0.0000): np.array([0.183448181818182, 0.275717272727273]), - (22000, 0.0250): np.array([0.159614804467469, 0.283265128320653]), - (22000, 0.0500): np.array([0.135781427116756, 0.290812983914034]), - (24500, -0.0500): np.array([0.230812633988541, 0.259664771591227]), - (24500, -0.0250): np.array([0.206910092504474, 0.266990651101736]), - (24500, 0.0000): np.array([0.183007551020408, 0.274316530612245]), - (24500, 0.0250): np.array([0.159105009536342, 0.281642410122754]), - (24500, 0.0500): np.array([0.135202468052276, 0.288968289633262]), - (27000, -0.0500): np.array([0.230583187091274, 0.258895100975109]), - (27000, -0.0250): np.array([0.206630667619711, 0.266055883820888]), - (27000, 0.0000): np.array([0.182678148148148, 0.273216666666667]), - (27000, 0.0250): np.array([0.158725628676585, 0.280377449512446]), - (27000, 0.0500): np.array([0.134773109205022, 0.287538232358225]), - (29500, -0.0500): np.array([0.230395500499851, 0.258258464459758]), - (29500, -0.0250): np.array([0.206403428216027, 0.265285588162082]), - (29500, 0.0000): np.array([0.182411355932203, 0.272312711864407]), - (29500, 0.0250): np.array([0.158419283648380, 0.279339835566731]), - (29500, 0.0500): np.array([0.134427211364556, 0.286366959269056]), - (32000, -0.0500): np.array([0.230235978654155, 0.257721638699323]), - (32000, -0.0250): np.array([0.206211114327078, 0.264635819349661]), - (32000, 0.0000): np.array([0.182186250000000, 0.271550000000000]), - (32000, 0.0250): np.array([0.158161385672923, 0.278464180650339]), - (32000, 0.0500): np.array([0.134136521345845, 0.285378361300677]), - (34500, -0.0500): np.array([0.230105666168844, 0.257266749246258]), - (34500, -0.0250): np.array([0.206054789606161, 0.264089896362260]), - (34500, 0.0000): np.array([0.182003913043478, 0.270913043478261]), - (34500, 0.0250): np.array([0.157953036480796, 0.277736190594262]), - (34500, 0.0500): np.array([0.133902159918113, 0.284559337710263]), - (37000, -0.0500): np.array([0.229999835834901, 0.256877639136083]), - (37000, -0.0250): np.array([0.205928431430964, 0.263628008757231]), - (37000, 0.0000): np.array([0.181857027027027, 0.270378378378378]), - (37000, 0.0250): np.array([0.157785622623090, 0.277128747999526]), - (37000, 0.0500): np.array([0.133714218219153, 0.283879117620674]), - (39500, -0.0500): np.array([0.229907042065651, 0.256537886918202]), - (39500, -0.0250): np.array([0.205817888121433, 0.263224639661633]), - (39500, 0.0000): np.array([0.181728734177215, 0.269911392405063]), - (39500, 0.0250): np.array([0.157639580232997, 0.276598145148494]), - (39500, 0.0500): np.array([0.133550426288780, 0.283284897891924]), - (42000, -0.0500): np.array([0.229825016678223, 0.256238659086365]), - (42000, -0.0250): np.array([0.205720365481969, 0.262869329543182]), - (42000, 0.0000): np.array([0.181615714285714, 0.269500000000000]), - (42000, 0.0250): np.array([0.157511063089460, 0.276130670456817]), - (42000, 0.0500): np.array([0.133406411893206, 0.282761340913635]), - (44500, -0.0500): np.array([0.229751988653572, 0.255973111790163]), - (44500, -0.0250): np.array([0.205633690955999, 0.262553971625419]), - (44500, 0.0000): np.array([0.181515393258427, 0.269134831460674]), - (44500, 0.0250): np.array([0.157397095560855, 0.275715691295930]), - (44500, 0.0500): np.array([0.133278797863282, 0.282296551131185]), - (47000, -0.0500): np.array([0.229686555034366, 0.255735860408829]), - (47000, -0.0250): np.array([0.205556149857609, 0.262272185523563]), - (47000, 0.0000): np.array([0.181425744680851, 0.268808510638298]), - (47000, 0.0250): np.array([0.157295339504093, 0.275344835753032]), - (47000, 0.0500): np.array([0.133164934327336, 0.281881160867767]), - (49500, -0.0500): np.array([0.229627590056716, 0.255522610251793]), - (49500, -0.0250): np.array([0.205486370785934, 0.262018880883472]), - (49500, 0.0000): np.array([0.181345151515151, 0.268515151515151]), - (49500, 0.0250): np.array([0.157203932244369, 0.275011422146831]), - (49500, 0.0500): np.array([0.133062712973587, 0.281507692778510]) -} - - -class TestPlanckianTable(unittest.TestCase): - """ - Defines :func:`colour.temperature.cct.planckian_table` definition units - tests methods. - """ - - def test_planckian_table(self): - """ - Tests :func:`colour.temperature.cct.planckian_table` definition. - """ - - cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] - - np.testing.assert_almost_equal( - [(x.Ti, x.ui, x.vi, x.di) for x in planckian_table( - np.array([0.1978, 0.3122]), cmfs, 1000, 1010, 10)], - PLANCKIAN_TABLE) - - -class TestPlanckianTableMinimalDistanceIndex(unittest.TestCase): - """ - Defines :func:`colour.temperature.cct.\ -planckian_table_minimal_distance_index` definition unit tests methods. - """ - - def test_planckian_table_minimal_distance_index(self): - """ - Tests :func:`colour.temperature.cct.\ -planckian_table_minimal_distance_index` definition. - """ - - cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] - self.assertEqual( - planckian_table_minimal_distance_index( - planckian_table( - np.array([0.1978, 0.3122]), cmfs, 1000, 1010, 10)), 9) - - -class Testuv_to_CCT_Ohno2013(unittest.TestCase): - """ - Defines :func:`colour.temperature.cct.uv_to_CCT_Ohno2013` definition units - tests methods. - """ - - def test_uv_to_CCT_Ohno2013(self): - """ - Tests :func:`colour.temperature.cct.uv_to_CCT_Ohno2013` definition. - """ - - cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] - np.testing.assert_almost_equal( - uv_to_CCT_Ohno2013(np.array([0.1978, 0.3122]), cmfs), - np.array([6507.47380460, 0.00322335]), - decimal=7) - - np.testing.assert_almost_equal( - uv_to_CCT_Ohno2013(np.array([0.4328, 0.2883]), cmfs), - np.array([1041.68315360, -0.06737802]), - decimal=7) - - np.testing.assert_almost_equal( - uv_to_CCT_Ohno2013(np.array([0.2927, 0.2722]), cmfs, iterations=4), - np.array([2452.15316417, -0.08437064]), - decimal=7) - - def test_n_dimensional_uv_to_CCT_Ohno2013(self): - """ - Tests :func:`colour.temperature.cct.uv_to_CCT_Ohno2013` definition - n-dimensional arrays support. - """ - - uv = np.array([0.1978, 0.3122]) - CCT_D_uv = uv_to_CCT_Ohno2013(uv) - - uv = np.tile(uv, (6, 1)) - CCT_D_uv = np.tile(CCT_D_uv, (6, 1)) - np.testing.assert_almost_equal( - uv_to_CCT_Ohno2013(uv), CCT_D_uv, decimal=7) - - uv = np.reshape(uv, (2, 3, 2)) - CCT_D_uv = np.reshape(CCT_D_uv, (2, 3, 2)) - np.testing.assert_almost_equal( - uv_to_CCT_Ohno2013(uv), CCT_D_uv, decimal=7) - - @ignore_numpy_errors - @disable_multiprocessing() - def test_nan_uv_to_CCT_Ohno2013(self): - """ - Tests :func:`colour.temperature.cct.uv_to_CCT_Ohno2013` definition nan - support. - """ - - cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] - cases = set(permutations(cases * 3, r=2)) - for case in cases: - uv = np.array(case) - uv_to_CCT_Ohno2013(uv) - - -class TestCCT_to_uv_Ohno2013(unittest.TestCase): - """ - Defines :func:`colour.temperature.cct.CCT_to_uv_Ohno2013` definition units - tests methods. - """ - - def test_CCT_to_uv_Ohno2013(self): - """ - Tests :func:`colour.temperature.cct.CCT_to_uv_Ohno2013` definition. - """ - - cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] - np.testing.assert_almost_equal( - CCT_to_uv_Ohno2013(np.array([6507.47380460, 0.00322335]), cmfs), - np.array([0.19779997, 0.31219997]), - decimal=7) - - np.testing.assert_almost_equal( - CCT_to_uv_Ohno2013(np.array([1041.68315360, -0.06737802]), cmfs), - np.array([0.43279885, 0.28830013]), - decimal=7) - - np.testing.assert_almost_equal( - CCT_to_uv_Ohno2013(np.array([2452.15316417, -0.08437064]), cmfs), - np.array([0.29247364, 0.27215157]), - decimal=7) - - def test_n_dimensional_CCT_to_uv_Ohno2013(self): - """ - Tests :func:`colour.temperature.cct.CCT_to_uv_Ohno2013` definition - n-dimensional arrays support. - """ - - cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] - CCT_D_uv = np.array([6507.47380460, 0.00322335]) - uv = CCT_to_uv_Ohno2013(CCT_D_uv, cmfs) - - CCT_D_uv = np.tile(CCT_D_uv, (6, 1)) - uv = np.tile(uv, (6, 1)) - np.testing.assert_almost_equal( - CCT_to_uv_Ohno2013(CCT_D_uv, cmfs), uv, decimal=7) - - CCT_D_uv = np.reshape(CCT_D_uv, (2, 3, 2)) - uv = np.reshape(uv, (2, 3, 2)) - np.testing.assert_almost_equal( - CCT_to_uv_Ohno2013(CCT_D_uv, cmfs), uv, decimal=7) - - @ignore_numpy_errors - @disable_multiprocessing() - def test_nan_CCT_to_uv_Ohno2013(self): - """ - Tests :func:`colour.temperature.cct.CCT_to_uv_Ohno2013` definition nan - support. - """ - - cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] - cases = set(permutations(cases * 3, r=2)) - for case in cases: - CCT_D_uv = np.array(case) - CCT_to_uv_Ohno2013(CCT_D_uv) - - -class Testuv_to_CCT_Robertson1968(unittest.TestCase): - """ - Defines :func:`colour.temperature.cct.uv_to_CCT_Robertson1968` definition - unit tests methods. - """ - - def test_uv_to_CCT_Robertson1968(self): - """ - Tests :func:`colour.temperature.cct.uv_to_CCT_Robertson1968` - definition. - """ - - for key, value in TEMPERATURE_DUV_TO_UV.items(): - np.testing.assert_allclose( - uv_to_CCT_Robertson1968(value), key, atol=0.25) - - def test_n_dimensional_uv_to_CCT_Robertson1968(self): - """ - Tests :func:`colour.temperature.cct.uv_to_CCT_Robertson1968` definition - n-dimensional arrays support. - """ - - uv = np.array([0.1978, 0.3122]) - CCT_D_uv = uv_to_CCT_Robertson1968(uv) - - uv = np.tile(uv, (6, 1)) - CCT_D_uv = np.tile(CCT_D_uv, (6, 1)) - np.testing.assert_almost_equal( - uv_to_CCT_Robertson1968(uv), CCT_D_uv, decimal=7) - - uv = np.reshape(uv, (2, 3, 2)) - CCT_D_uv = np.reshape(CCT_D_uv, (2, 3, 2)) - np.testing.assert_almost_equal( - uv_to_CCT_Robertson1968(uv), CCT_D_uv, decimal=7) - - @ignore_numpy_errors - @disable_multiprocessing() - def test_nan_uv_to_CCT_Robertson1968(self): - """ - Tests :func:`colour.temperature.cct.uv_to_CCT_Robertson1968` definition - nan support. - """ - - cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] - cases = set(permutations(cases * 3, r=2)) - for case in cases: - uv = np.array(case) - uv_to_CCT_Robertson1968(uv) - - -class TestCCT_to_uv_Robertson1968(unittest.TestCase): - """ - Defines :func:`colour.temperature.cct.CCT_to_uv_Robertson1968` definition - unit tests methods. - """ - - def test_CCT_to_uv_Robertson1968(self): - """ - Tests :func:`colour.temperature.cct.CCT_to_uv_Robertson1968` - definition. - """ - - for key, value in TEMPERATURE_DUV_TO_UV.items(): - np.testing.assert_almost_equal( - CCT_to_uv_Robertson1968(key), value, decimal=7) - - def test_n_dimensional_CCT_to_uv_Robertson1968(self): - """ - Tests :func:`colour.temperature.cct.CCT_to_uv_Robertson1968` definition - n-dimensional arrays support. - """ - - CCT_D_uv = np.array([4500, 0.0250]) - uv = CCT_to_uv_Robertson1968(CCT_D_uv) - - CCT_D_uv = np.tile(CCT_D_uv, (6, 1)) - uv = np.tile(uv, (6, 1)) - np.testing.assert_almost_equal( - CCT_to_uv_Robertson1968(CCT_D_uv), uv, decimal=7) - - CCT_D_uv = np.reshape(CCT_D_uv, (2, 3, 2)) - uv = np.reshape(uv, (2, 3, 2)) - np.testing.assert_almost_equal( - CCT_to_uv_Robertson1968(CCT_D_uv), uv, decimal=7) - - @ignore_numpy_errors - @disable_multiprocessing() - def test_nan_CCT_to_uv_Robertson1968(self): - """ - Tests :func:`colour.temperature.cct.CCT_to_uv_Robertson1968` definition - nan support. - """ - - cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] - cases = set(permutations(cases * 3, r=2)) - for case in cases: - CCT_D_uv = np.array(case) - CCT_to_uv_Robertson1968(CCT_D_uv) - - -class TestCCT_to_uv_Krystek1985(unittest.TestCase): - """ - Defines :func:`colour.temperature.cct.CCT_to_uv_Krystek1985` definition - units tests methods. - """ - - def test_CCT_to_uv_Krystek1985(self): - """ - Tests :func:`colour.temperature.cct.CCT_to_uv_Krystek1985` definition. - """ - - np.testing.assert_almost_equal( - CCT_to_uv_Krystek1985(1000), - np.array([0.223421163527869, 0.499258998136231]), - decimal=7) - - np.testing.assert_almost_equal( - CCT_to_uv_Krystek1985(7000), - np.array([0.183513095046506, 0.305827773965731]), - decimal=7) - - np.testing.assert_almost_equal( - CCT_to_uv_Krystek1985(15000), - np.array([0.182148234861937, 0.281354360914682]), - decimal=7) - - def test_n_dimensional_CCT_to_uv_Krystek1985(self): - """ - Tests :func:`colour.temperature.cct.CCT_to_uv_Krystek1985` definition - n-dimensional arrays support. - """ - - CCT = 7000 - xy = CCT_to_uv_Krystek1985(CCT) - - CCT = np.tile(CCT, 6) - xy = np.tile(xy, (6, 1)) - np.testing.assert_almost_equal( - CCT_to_uv_Krystek1985(CCT), xy, decimal=7) - - CCT = np.reshape(CCT, (2, 3)) - xy = np.reshape(xy, (2, 3, 2)) - np.testing.assert_almost_equal( - CCT_to_uv_Krystek1985(CCT), xy, decimal=7) - - @ignore_numpy_errors - def test_nan_CCT_to_uv_Krystek1985(self): - """ - Tests :func:`colour.temperature.cct.CCT_to_uv_Krystek1985` definition - nan support. - """ - - cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] - cases = set(permutations(cases * 3, r=2)) - for case in cases: - CCT_to_uv_Krystek1985(case) - - -class Testxy_to_CCT_McCamy1992(unittest.TestCase): - """ - Defines :func:`colour.temperature.cct.xy_to_CCT_McCamy1992` definition - unit tests methods. - """ - - def test_xy_to_CCT_McCamy1992(self): - """ - Tests :func:`colour.temperature.cct.xy_to_CCT_McCamy1992` definition. - """ - - self.assertAlmostEqual( - xy_to_CCT_McCamy1992(np.array([0.31270, 0.32900])), - 6505.08059131, - places=7) - - self.assertAlmostEqual( - xy_to_CCT_McCamy1992(np.array([0.44757, 0.40745])), - 2857.28961266, - places=7) - - self.assertAlmostEqual( - xy_to_CCT_McCamy1992( - np.array([0.252520939374083, 0.252220883926284])), - 19501.61953130, - places=7) - - def test_n_dimensional_xy_to_CCT_McCamy1992(self): - """ - Tests :func:`colour.temperature.cct.xy_to_CCT_McCamy1992` definition - n-dimensional arrays support. - """ - - xy = np.array([0.31270, 0.32900]) - CCT = xy_to_CCT_McCamy1992(xy) - - xy = np.tile(xy, (6, 1)) - CCT = np.tile(CCT, 6) - np.testing.assert_almost_equal( - xy_to_CCT_McCamy1992(xy), CCT, decimal=7) - - xy = np.reshape(xy, (2, 3, 2)) - CCT = np.reshape(CCT, (2, 3)) - np.testing.assert_almost_equal( - xy_to_CCT_McCamy1992(xy), CCT, decimal=7) - - @ignore_numpy_errors - def test_nan_xy_to_CCT_McCamy1992(self): - """ - Tests :func:`colour.temperature.cct.xy_to_CCT_McCamy1992` definition - nan support. - """ - - cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] - cases = set(permutations(cases * 3, r=2)) - for case in cases: - xy_to_CCT_McCamy1992(case) - - -class Testxy_to_CCT_Hernandez1999(unittest.TestCase): - """ - Defines :func:`colour.temperature.cct.xy_to_CCT_Hernandez1999` definition - unit tests methods. - """ - - def test_xy_to_CCT_Hernandez1999(self): - """ - Tests :func:`colour.temperature.cct.xy_to_CCT_McCamy1992` definition. - """ - - self.assertAlmostEqual( - xy_to_CCT_Hernandez1999(np.array([0.31270, 0.32900])), - 6500.74204318, - places=7) - - self.assertAlmostEqual( - xy_to_CCT_Hernandez1999(np.array([0.44757, 0.40745])), - 2790.64222533, - places=7) - - self.assertAlmostEqual( - xy_to_CCT_Hernandez1999( - np.array([0.244162248213914, 0.240333674758318])), - 64448.11092565, - places=7) - - def test_n_dimensional_xy_to_CCT_Hernandez1999(self): - """ - Tests :func:`colour.temperature.cct.xy_to_CCT_Hernandez1999` definition - n-dimensional arrays support. - """ - - xy = np.array([0.31270, 0.32900]) - CCT = xy_to_CCT_Hernandez1999(xy) - - xy = np.tile(xy, (6, 1)) - CCT = np.tile(CCT, 6) - np.testing.assert_almost_equal( - xy_to_CCT_Hernandez1999(xy), CCT, decimal=7) - - xy = np.reshape(xy, (2, 3, 2)) - CCT = np.reshape(CCT, (2, 3)) - np.testing.assert_almost_equal( - xy_to_CCT_Hernandez1999(xy), CCT, decimal=7) - - @ignore_numpy_errors - def test_nan_xy_to_CCT_Hernandez1999(self): - """ - Tests :func:`colour.temperature.cct.xy_to_CCT_Hernandez1999` definition - nan support. - """ - - cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] - cases = set(permutations(cases * 3, r=2)) - for case in cases: - xy_to_CCT_Hernandez1999(case) - - -class TestCCT_to_xy_Kang2002(unittest.TestCase): - """ - Defines :func:`colour.temperature.cct.CCT_to_xy_Kang2002` definition units - tests methods. - """ - - def test_CCT_to_xy_Kang2002(self): - """ - Tests :func:`colour.temperature.cct.CCT_to_xy_Kang2002` definition. - """ - - np.testing.assert_almost_equal( - CCT_to_xy_Kang2002(4000), - np.array([0.380528282812500, 0.376733530961114]), - decimal=7) - - np.testing.assert_almost_equal( - CCT_to_xy_Kang2002(7000), - np.array([0.306374019533528, 0.316552869726577]), - decimal=7) - - np.testing.assert_almost_equal( - CCT_to_xy_Kang2002(25000), - np.array([0.25247299, 0.252254791243654]), - decimal=7) - - def test_n_dimensional_CCT_to_xy_Kang2002(self): - """ - Tests :func:`colour.temperature.cct.CCT_to_xy_Kang2002` definition - n-dimensional arrays support. - """ - - CCT = 4000 - xy = CCT_to_xy_Kang2002(CCT) - - CCT = np.tile(CCT, 6) - xy = np.tile(xy, (6, 1)) - np.testing.assert_almost_equal(CCT_to_xy_Kang2002(CCT), xy, decimal=7) - - CCT = np.reshape(CCT, (2, 3)) - xy = np.reshape(xy, (2, 3, 2)) - np.testing.assert_almost_equal(CCT_to_xy_Kang2002(CCT), xy, decimal=7) - - @ignore_numpy_errors - def test_nan_CCT_to_xy_Kang2002(self): - """ - Tests :func:`colour.temperature.cct.CCT_to_xy_Kang2002` definition - nan support. - """ - - cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] - cases = set(permutations(cases * 3, r=2)) - for case in cases: - CCT_to_xy_Kang2002(case) - - -class TestCCT_to_xy_CIE_D(unittest.TestCase): - """ - Defines :func:`colour.temperature.cct.CCT_to_xy_CIE_D` definition - unit tests methods. - """ - - def test_CCT_to_xy_CIE_D(self): - """ - Tests :func:`colour.temperature.cct.CCT_to_xy_CIE_D` definition. - """ - - np.testing.assert_almost_equal( - CCT_to_xy_CIE_D(4000.0), - np.array([0.382343625000000, 0.383766261015578]), - decimal=7) - - np.testing.assert_almost_equal( - CCT_to_xy_CIE_D(4000), - np.array([0.382343625000000, 0.383766261015578]), - decimal=7) - - np.testing.assert_almost_equal( - CCT_to_xy_CIE_D(7000), - np.array([0.305357431486880, 0.321646345474552]), - decimal=7) - - np.testing.assert_almost_equal( - CCT_to_xy_CIE_D(25000), - np.array([0.24985367, 0.254799464210944]), - decimal=7) - - def test_n_dimensional_CCT_to_xy_CIE_D(self): - """ - Tests :func:`colour.temperature.cct.CCT_to_xy_CIE_D` definition - n-dimensional arrays support. - """ - - CCT = 4000 - xy = CCT_to_xy_CIE_D(CCT) - - CCT = np.tile(CCT, 6) - xy = np.tile(xy, (6, 1)) - np.testing.assert_almost_equal(CCT_to_xy_CIE_D(CCT), xy, decimal=7) - - CCT = np.reshape(CCT, (2, 3)) - xy = np.reshape(xy, (2, 3, 2)) - np.testing.assert_almost_equal(CCT_to_xy_CIE_D(CCT), xy, decimal=7) - - @ignore_numpy_errors - def test_nan_CCT_to_xy_CIE_D(self): - """ - Tests :func:`colour.temperature.cct.CCT_to_xy_CIE_D` definition - nan support. - """ - - cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] - cases = set(permutations(cases * 3, r=2)) - for case in cases: - CCT_to_xy_CIE_D(case) - - -if __name__ == '__main__': - unittest.main() diff --git a/colour/temperature/tests/test_cie_d.py b/colour/temperature/tests/test_cie_d.py new file mode 100644 index 0000000000..7919cad8d8 --- /dev/null +++ b/colour/temperature/tests/test_cie_d.py @@ -0,0 +1,147 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.temperature.cie_d` module. +""" + +from __future__ import division, unicode_literals + +import numpy as np +import unittest +from itertools import permutations + +from colour.temperature import xy_to_CCT_CIE_D, CCT_to_xy_CIE_D +from colour.utilities import ignore_numpy_errors + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = ['TestXy_to_CCT_CIE_D', 'TestCCT_to_xy_CIE_D'] + + +class TestXy_to_CCT_CIE_D(unittest.TestCase): + """ + Defines :func:`colour.temperature.cie_d.xy_to_CCT_CIE_D` definition units + tests methods. + """ + + def test_xy_to_CCT_CIE_D(self): + """ + Tests :func:`colour.temperature.cie_d.xy_to_CCT_CIE_D` definition. + """ + + np.testing.assert_allclose( + xy_to_CCT_CIE_D( + np.array([0.382343625000000, 0.383766261015578]), + {'method': 'Nelder-Mead'}), + 4000, + rtol=0.0000001, + atol=0.0000001) + + np.testing.assert_allclose( + xy_to_CCT_CIE_D( + np.array([0.305357431486880, 0.321646345474552]), + {'method': 'Nelder-Mead'}), + 7000, + rtol=0.0000001, + atol=0.0000001) + + np.testing.assert_allclose( + xy_to_CCT_CIE_D( + np.array([0.24985367, 0.254799464210944]), + {'method': 'Nelder-Mead'}), + 25000, + rtol=0.0000001, + atol=0.0000001) + + def test_n_dimensional_xy_to_CCT_CIE_D(self): + """ + Tests :func:`colour.temperature.cie_d.xy_to_CCT_CIE_D` definition + n-dimensional arrays support. + """ + + xy = np.array([0.382343625000000, 0.383766261015578]) + CCT = xy_to_CCT_CIE_D(xy) + + xy = np.tile(xy, (6, 1)) + CCT = np.tile(CCT, 6) + np.testing.assert_almost_equal(xy_to_CCT_CIE_D(xy), CCT, decimal=7) + + xy = np.reshape(xy, (2, 3, 2)) + CCT = np.reshape(CCT, (2, 3)) + np.testing.assert_almost_equal(xy_to_CCT_CIE_D(xy), CCT, decimal=7) + + @ignore_numpy_errors + def test_nan_xy_to_CCT_CIE_D(self): + """ + Tests :func:`colour.temperature.cie_d.xy_to_CCT_CIE_D` definition nan + support. + """ + + cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] + cases = set(permutations(cases * 3, r=2)) + for case in cases: + xy_to_CCT_CIE_D(case) + + +class TestCCT_to_xy_CIE_D(unittest.TestCase): + """ + Defines :func:`colour.temperature.cie_d.CCT_to_xy_CIE_D` definition + unit tests methods. + """ + + def test_CCT_to_xy_CIE_D(self): + """ + Tests :func:`colour.temperature.cie_d.CCT_to_xy_CIE_D` definition. + """ + + np.testing.assert_almost_equal( + CCT_to_xy_CIE_D(4000), + np.array([0.382343625000000, 0.383766261015578]), + decimal=7) + + np.testing.assert_almost_equal( + CCT_to_xy_CIE_D(7000), + np.array([0.305357431486880, 0.321646345474552]), + decimal=7) + + np.testing.assert_almost_equal( + CCT_to_xy_CIE_D(25000), + np.array([0.24985367, 0.254799464210944]), + decimal=7) + + def test_n_dimensional_CCT_to_xy_CIE_D(self): + """ + Tests :func:`colour.temperature.cie_d.CCT_to_xy_CIE_D` definition + n-dimensional arrays support. + """ + + CCT = 4000 + xy = CCT_to_xy_CIE_D(CCT) + + CCT = np.tile(CCT, 6) + xy = np.tile(xy, (6, 1)) + np.testing.assert_almost_equal(CCT_to_xy_CIE_D(CCT), xy, decimal=7) + + CCT = np.reshape(CCT, (2, 3)) + xy = np.reshape(xy, (2, 3, 2)) + np.testing.assert_almost_equal(CCT_to_xy_CIE_D(CCT), xy, decimal=7) + + @ignore_numpy_errors + def test_nan_CCT_to_xy_CIE_D(self): + """ + Tests :func:`colour.temperature.cie_d.CCT_to_xy_CIE_D` definition + nan support. + """ + + cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] + cases = set(permutations(cases * 3, r=2)) + for case in cases: + CCT_to_xy_CIE_D(case) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/temperature/tests/test_hernandez1999.py b/colour/temperature/tests/test_hernandez1999.py new file mode 100644 index 0000000000..547fe92c12 --- /dev/null +++ b/colour/temperature/tests/test_hernandez1999.py @@ -0,0 +1,145 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.temperature.hernandez1999` module. +""" + +from __future__ import division, unicode_literals + +import numpy as np +import unittest +from itertools import permutations + +from colour.temperature import xy_to_CCT_Hernandez1999, CCT_to_xy_Hernandez1999 +from colour.utilities import ignore_numpy_errors + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = ['Testxy_to_CCT_Hernandez1999', 'TestCCT_to_xy_Hernandez1999'] + + +class Testxy_to_CCT_Hernandez1999(unittest.TestCase): + """ + Defines :func:`colour.temperature.hernandez1999.xy_to_CCT_Hernandez1999` + definition unit tests methods. + """ + + def test_xy_to_CCT_Hernandez1999(self): + """ + Tests :func:`colour.temperature.hernandez1999.xy_to_CCT_McCamy1992` + definition. + """ + + self.assertAlmostEqual( + xy_to_CCT_Hernandez1999(np.array([0.31270, 0.32900])), + 6500.74204318, + places=7) + + self.assertAlmostEqual( + xy_to_CCT_Hernandez1999(np.array([0.44757, 0.40745])), + 2790.64222533, + places=7) + + self.assertAlmostEqual( + xy_to_CCT_Hernandez1999( + np.array([0.244162248213914, 0.240333674758318])), + 64448.11092565, + places=7) + + def test_n_dimensional_xy_to_CCT_Hernandez1999(self): + """ + Tests :func:`colour.temperature.hernandez1999.xy_to_CCT_Hernandez1999` + definition n-dimensional arrays support. + """ + + xy = np.array([0.31270, 0.32900]) + CCT = xy_to_CCT_Hernandez1999(xy) + + xy = np.tile(xy, (6, 1)) + CCT = np.tile(CCT, 6) + np.testing.assert_almost_equal( + xy_to_CCT_Hernandez1999(xy), CCT, decimal=7) + + xy = np.reshape(xy, (2, 3, 2)) + CCT = np.reshape(CCT, (2, 3)) + np.testing.assert_almost_equal( + xy_to_CCT_Hernandez1999(xy), CCT, decimal=7) + + @ignore_numpy_errors + def test_nan_xy_to_CCT_Hernandez1999(self): + """ + Tests :func:`colour.temperature.hernandez1999.xy_to_CCT_Hernandez1999` + definition nan support. + """ + + cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] + cases = set(permutations(cases * 3, r=2)) + for case in cases: + xy_to_CCT_Hernandez1999(case) + + +class TestCCT_to_xy_Hernandez1999(unittest.TestCase): + """ + Defines :func:`colour.temperature.hernandez1999.CCT_to_xy_Hernandez1999` + definition units tests methods. + """ + + def test_CCT_to_xy_Hernandez1999(self): + """ + Tests :func:`colour.temperature.hernandez1999.CCT_to_xy_Hernandez1999` + definition. + """ + + np.testing.assert_almost_equal( + CCT_to_xy_Hernandez1999(6500.74204318, {'method': 'Nelder-Mead'}), + np.array([0.31269943, 0.32900373]), + decimal=7) + + np.testing.assert_almost_equal( + CCT_to_xy_Hernandez1999(2790.64222533, {'method': 'Nelder-Mead'}), + np.array([0.42864308, 0.36754776]), + decimal=7) + + np.testing.assert_almost_equal( + CCT_to_xy_Hernandez1999(64448.11092565, {'method': 'Nelder-Mead'}), + np.array([0.08269106, 0.36612620]), + decimal=7) + + def test_n_dimensional_CCT_to_xy_Hernandez1999(self): + """ + Tests :func:`colour.temperature.hernandez1999.CCT_to_xy_Hernandez1999` + definition n-dimensional arrays support. + """ + + CCT = 6500.74204318 + xy = CCT_to_xy_Hernandez1999(CCT) + + CCT = np.tile(CCT, 6) + xy = np.tile(xy, (6, 1)) + np.testing.assert_almost_equal( + CCT_to_xy_Hernandez1999(CCT), xy, decimal=7) + + CCT = np.reshape(CCT, (2, 3)) + xy = np.reshape(xy, (2, 3, 2)) + np.testing.assert_almost_equal( + CCT_to_xy_Hernandez1999(CCT), xy, decimal=7) + + @ignore_numpy_errors + def test_nan_CCT_to_xy_Hernandez1999(self): + """ + Tests :func:`colour.temperature.hernandez1999.CCT_to_xy_Hernandez1999` + definition nan support. + """ + + cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] + cases = set(permutations(cases * 3, r=2)) + for case in cases: + CCT_to_xy_Hernandez1999(case) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/temperature/tests/test_kang2002.py b/colour/temperature/tests/test_kang2002.py new file mode 100644 index 0000000000..042d2bc09e --- /dev/null +++ b/colour/temperature/tests/test_kang2002.py @@ -0,0 +1,149 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.temperature.kang2002` module. +""" + +from __future__ import division, unicode_literals + +import numpy as np +import unittest +from itertools import permutations + +from colour.temperature import xy_to_CCT_Kang2002, CCT_to_xy_Kang2002 +from colour.utilities import ignore_numpy_errors + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = ['TestXy_to_CCT_Kang2002', 'TestCCT_to_xy_Kang2002'] + + +class TestXy_to_CCT_Kang2002(unittest.TestCase): + """ + Defines :func:`colour.temperature.kang2002.xy_to_CCT_Kang2002` + definition units tests methods. + """ + + def test_xy_to_CCT_Kang2002(self): + """ + Tests :func:`colour.temperature.kang2002.xy_to_CCT_Kang2002` + definition. + """ + + np.testing.assert_allclose( + xy_to_CCT_Kang2002( + np.array([0.380528282812500, 0.376733530961114]), + {'method': 'Nelder-Mead'}), + 4000, + rtol=0.0000001, + atol=0.0000001) + + np.testing.assert_allclose( + xy_to_CCT_Kang2002( + np.array([0.306374019533528, 0.316552869726577]), + {'method': 'Nelder-Mead'}), + 7000, + rtol=0.0000001, + atol=0.0000001) + + np.testing.assert_allclose( + xy_to_CCT_Kang2002( + np.array([0.252472994438400, 0.252254791243654]), + {'method': 'Nelder-Mead'}), + 25000, + rtol=0.0000001, + atol=0.0000001) + + def test_n_dimensional_xy_to_CCT_Kang2002(self): + """ + Tests :func:`colour.temperature.kang2002.xy_to_CCT_Kang2002` + definition n-dimensional arrays support. + """ + + uv = np.array([0.380528282812500, 0.376733530961114]) + CCT = xy_to_CCT_Kang2002(uv) + + uv = np.tile(uv, (6, 1)) + CCT = np.tile(CCT, 6) + np.testing.assert_almost_equal(xy_to_CCT_Kang2002(uv), CCT, decimal=7) + + uv = np.reshape(uv, (2, 3, 2)) + CCT = np.reshape(CCT, (2, 3)) + np.testing.assert_almost_equal(xy_to_CCT_Kang2002(uv), CCT, decimal=7) + + @ignore_numpy_errors + def test_nan_xy_to_CCT_Kang2002(self): + """ + Tests :func:`colour.temperature.kang2002.xy_to_CCT_Kang2002` + definition nan support. + """ + + cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] + cases = set(permutations(cases * 3, r=2)) + for case in cases: + xy_to_CCT_Kang2002(case) + + +class TestCCT_to_xy_Kang2002(unittest.TestCase): + """ + Defines :func:`colour.temperature.kang2002.CCT_to_xy_Kang2002` definition + units tests methods. + """ + + def test_CCT_to_xy_Kang2002(self): + """ + Tests :func:`colour.temperature.kang2002.CCT_to_xy_Kang2002` + definition. + """ + + np.testing.assert_almost_equal( + CCT_to_xy_Kang2002(4000), + np.array([0.380528282812500, 0.376733530961114]), + decimal=7) + + np.testing.assert_almost_equal( + CCT_to_xy_Kang2002(7000), + np.array([0.306374019533528, 0.316552869726577]), + decimal=7) + + np.testing.assert_almost_equal( + CCT_to_xy_Kang2002(25000), + np.array([0.252472994438400, 0.252254791243654]), + decimal=7) + + def test_n_dimensional_CCT_to_xy_Kang2002(self): + """ + Tests :func:`colour.temperature.kang2002.CCT_to_xy_Kang2002` definition + n-dimensional arrays support. + """ + + CCT = 4000 + xy = CCT_to_xy_Kang2002(CCT) + + CCT = np.tile(CCT, 6) + xy = np.tile(xy, (6, 1)) + np.testing.assert_almost_equal(CCT_to_xy_Kang2002(CCT), xy, decimal=7) + + CCT = np.reshape(CCT, (2, 3)) + xy = np.reshape(xy, (2, 3, 2)) + np.testing.assert_almost_equal(CCT_to_xy_Kang2002(CCT), xy, decimal=7) + + @ignore_numpy_errors + def test_nan_CCT_to_xy_Kang2002(self): + """ + Tests :func:`colour.temperature.kang2002.CCT_to_xy_Kang2002` definition + nan support. + """ + + cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] + cases = set(permutations(cases * 3, r=2)) + for case in cases: + CCT_to_xy_Kang2002(case) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/temperature/tests/test_krystek1985.py b/colour/temperature/tests/test_krystek1985.py new file mode 100644 index 0000000000..721b71ce1c --- /dev/null +++ b/colour/temperature/tests/test_krystek1985.py @@ -0,0 +1,153 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.temperature.krystek1985` module. +""" + +from __future__ import division, unicode_literals + +import numpy as np +import unittest +from itertools import permutations + +from colour.temperature import uv_to_CCT_Krystek1985, CCT_to_uv_Krystek1985 +from colour.utilities import ignore_numpy_errors + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = ['TestUv_to_CCT_Krystek1985'] + + +class TestUv_to_CCT_Krystek1985(unittest.TestCase): + """ + Defines :func:`colour.temperature.krystek1985.uv_to_CCT_Krystek1985` + definition units tests methods. + """ + + def test_uv_to_CCT_Krystek1985(self): + """ + Tests :func:`colour.temperature.krystek1985.uv_to_CCT_Krystek1985` + definition. + """ + + np.testing.assert_allclose( + uv_to_CCT_Krystek1985( + np.array([0.223421163527869, 0.499258998136231]), + {'method': 'Nelder-Mead'}), + 1000, + rtol=0.0000001, + atol=0.0000001) + + np.testing.assert_allclose( + uv_to_CCT_Krystek1985( + np.array([0.183513095046506, 0.305827773965731]), + {'method': 'Nelder-Mead'}), + 7000, + rtol=0.0000001, + atol=0.0000001) + + np.testing.assert_allclose( + uv_to_CCT_Krystek1985( + np.array([0.182148234861937, 0.281354360914682]), + {'method': 'Nelder-Mead'}), + 15000, + rtol=0.0000001, + atol=0.0000001) + + def test_n_dimensional_uv_to_CCT_Krystek1985(self): + """ + Tests :func:`colour.temperature.krystek1985.uv_to_CCT_Krystek1985` + definition n-dimensional arrays support. + """ + + uv = np.array([0.183513095046506, 0.305827773965731]) + CCT = uv_to_CCT_Krystek1985(uv) + + uv = np.tile(uv, (6, 1)) + CCT = np.tile(CCT, 6) + np.testing.assert_almost_equal( + uv_to_CCT_Krystek1985(uv), CCT, decimal=7) + + uv = np.reshape(uv, (2, 3, 2)) + CCT = np.reshape(CCT, (2, 3)) + np.testing.assert_almost_equal( + uv_to_CCT_Krystek1985(uv), CCT, decimal=7) + + @ignore_numpy_errors + def test_nan_uv_to_CCT_Krystek1985(self): + """ + Tests :func:`colour.temperature.krystek1985.uv_to_CCT_Krystek1985` + definition nan support. + """ + + cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] + cases = set(permutations(cases * 3, r=2)) + for case in cases: + uv_to_CCT_Krystek1985(case) + + +class TestCCT_to_uv_Krystek1985(unittest.TestCase): + """ + Defines :func:`colour.temperature.krystek1985.CCT_to_uv_Krystek1985` + definition units tests methods. + """ + + def test_CCT_to_uv_Krystek1985(self): + """ + Tests :func:`colour.temperature.krystek1985.CCT_to_uv_Krystek1985` + definition. + """ + + np.testing.assert_almost_equal( + CCT_to_uv_Krystek1985(1000), + np.array([0.223421163527869, 0.499258998136231]), + decimal=7) + + np.testing.assert_almost_equal( + CCT_to_uv_Krystek1985(7000), + np.array([0.183513095046506, 0.305827773965731]), + decimal=7) + + np.testing.assert_almost_equal( + CCT_to_uv_Krystek1985(15000), + np.array([0.182148234861937, 0.281354360914682]), + decimal=7) + + def test_n_dimensional_CCT_to_uv_Krystek1985(self): + """ + Tests :func:`colour.temperature.krystek1985.CCT_to_uv_Krystek1985` + definition n-dimensional arrays support. + """ + + CCT = 7000 + uv = CCT_to_uv_Krystek1985(CCT) + + CCT = np.tile(CCT, 6) + uv = np.tile(uv, (6, 1)) + np.testing.assert_almost_equal( + CCT_to_uv_Krystek1985(CCT), uv, decimal=7) + + CCT = np.reshape(CCT, (2, 3)) + uv = np.reshape(uv, (2, 3, 2)) + np.testing.assert_almost_equal( + CCT_to_uv_Krystek1985(CCT), uv, decimal=7) + + @ignore_numpy_errors + def test_nan_CCT_to_uv_Krystek1985(self): + """ + Tests :func:`colour.temperature.krystek1985.CCT_to_uv_Krystek1985` + definition nan support. + """ + + cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] + cases = set(permutations(cases * 3, r=1)) + for case in cases: + CCT_to_uv_Krystek1985(case) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/temperature/tests/test_mccamy1992.py b/colour/temperature/tests/test_mccamy1992.py new file mode 100644 index 0000000000..4da8041137 --- /dev/null +++ b/colour/temperature/tests/test_mccamy1992.py @@ -0,0 +1,145 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.temperature.mccamy1992` module. +""" + +from __future__ import division, unicode_literals + +import numpy as np +import unittest +from itertools import permutations + +from colour.temperature import xy_to_CCT_McCamy1992, CCT_to_xy_McCamy1992 +from colour.utilities import ignore_numpy_errors + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = ['Testxy_to_CCT_McCamy1992', 'TestCCT_to_xy_McCamy1992'] + + +class Testxy_to_CCT_McCamy1992(unittest.TestCase): + """ + Defines :func:`colour.temperature.mccamy1992.xy_to_CCT_McCamy1992` + definition unit tests methods. + """ + + def test_xy_to_CCT_McCamy1992(self): + """ + Tests :func:`colour.temperature.mccamy1992.xy_to_CCT_McCamy1992` + definition. + """ + + self.assertAlmostEqual( + xy_to_CCT_McCamy1992(np.array([0.31270, 0.32900])), + 6505.08059131, + places=7) + + self.assertAlmostEqual( + xy_to_CCT_McCamy1992(np.array([0.44757, 0.40745])), + 2857.28961266, + places=7) + + self.assertAlmostEqual( + xy_to_CCT_McCamy1992( + np.array([0.252520939374083, 0.252220883926284])), + 19501.61953130, + places=7) + + def test_n_dimensional_xy_to_CCT_McCamy1992(self): + """ + Tests :func:`colour.temperature.mccamy1992.xy_to_CCT_McCamy1992` + definition n-dimensional arrays support. + """ + + xy = np.array([0.31270, 0.32900]) + CCT = xy_to_CCT_McCamy1992(xy) + + xy = np.tile(xy, (6, 1)) + CCT = np.tile(CCT, 6) + np.testing.assert_almost_equal( + xy_to_CCT_McCamy1992(xy), CCT, decimal=7) + + xy = np.reshape(xy, (2, 3, 2)) + CCT = np.reshape(CCT, (2, 3)) + np.testing.assert_almost_equal( + xy_to_CCT_McCamy1992(xy), CCT, decimal=7) + + @ignore_numpy_errors + def test_nan_xy_to_CCT_McCamy1992(self): + """ + Tests :func:`colour.temperature.mccamy1992.xy_to_CCT_McCamy1992` + definition nan support. + """ + + cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] + cases = set(permutations(cases * 3, r=2)) + for case in cases: + xy_to_CCT_McCamy1992(case) + + +class TestCCT_to_xy_McCamy1992(unittest.TestCase): + """ + Defines :func:`colour.temperature.mccamy1992.CCT_to_xy_McCamy1992` + definition units tests methods. + """ + + def test_CCT_to_xy_McCamy1992(self): + """ + Tests :func:`colour.temperature.mccamy1992.CCT_to_xy_McCamy1992` + definition. + """ + + np.testing.assert_almost_equal( + CCT_to_xy_McCamy1992(6505.08059131, {'method': 'Nelder-Mead'}), + np.array([0.31269945, 0.32900411]), + decimal=7) + + np.testing.assert_almost_equal( + CCT_to_xy_McCamy1992(2857.28961266, {'method': 'Nelder-Mead'}), + np.array([0.42350314, 0.36129253]), + decimal=7) + + np.testing.assert_almost_equal( + CCT_to_xy_McCamy1992(19501.61953130, {'method': 'Nelder-Mead'}), + np.array([0.11173782, 0.36987375]), + decimal=7) + + def test_n_dimensional_CCT_to_xy_McCamy1992(self): + """ + Tests :func:`colour.temperature.mccamy1992.CCT_to_xy_McCamy1992` + definition n-dimensional arrays support. + """ + + CCT = 6505.08059131 + xy = CCT_to_xy_McCamy1992(CCT) + + CCT = np.tile(CCT, 6) + xy = np.tile(xy, (6, 1)) + np.testing.assert_almost_equal( + CCT_to_xy_McCamy1992(CCT), xy, decimal=7) + + CCT = np.reshape(CCT, (2, 3)) + xy = np.reshape(xy, (2, 3, 2)) + np.testing.assert_almost_equal( + CCT_to_xy_McCamy1992(CCT), xy, decimal=7) + + @ignore_numpy_errors + def test_nan_CCT_to_xy_McCamy1992(self): + """ + Tests :func:`colour.temperature.mccamy1992.CCT_to_xy_McCamy1992` + definition nan support. + """ + + cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] + cases = set(permutations(cases * 3, r=2)) + for case in cases: + CCT_to_xy_McCamy1992(case) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/temperature/tests/test_ohno2013.py b/colour/temperature/tests/test_ohno2013.py new file mode 100644 index 0000000000..d1c247d838 --- /dev/null +++ b/colour/temperature/tests/test_ohno2013.py @@ -0,0 +1,206 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.temperature.ohno2013` module. +""" + +from __future__ import division, unicode_literals + +import numpy as np +import unittest +from itertools import permutations + +from colour.colorimetry import STANDARD_OBSERVERS_CMFS +from colour.temperature import CCT_to_uv_Ohno2013, uv_to_CCT_Ohno2013 +from colour.temperature.ohno2013 import ( + planckian_table, planckian_table_minimal_distance_index) +from colour.utilities import ignore_numpy_errors + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = [ + 'TestPlanckianTable', 'TestPlanckianTableMinimalDistanceIndex', + 'Testuv_to_CCT_Ohno2013', 'TestCCT_to_uv_Ohno2013' +] + +PLANCKIAN_TABLE = np.array([ + [1000.00000000, 0.44796288, 0.35462962, 0.25373557], + [1001.11111111, 0.44770303, 0.35465214, 0.25348315], + [1002.22222222, 0.44744348, 0.35467461, 0.25323104], + [1003.33333333, 0.44718423, 0.35469704, 0.25297924], + [1004.44444444, 0.44692529, 0.35471942, 0.25272774], + [1005.55555556, 0.44666666, 0.35474175, 0.25247656], + [1006.66666667, 0.44640833, 0.35476404, 0.25222569], + [1007.77777778, 0.44615030, 0.35478628, 0.25197512], + [1008.88888889, 0.44589258, 0.35480848, 0.25172487], + [1010.00000000, 0.44563516, 0.35483063, 0.25147492], +]) + + +class TestPlanckianTable(unittest.TestCase): + """ + Defines :func:`colour.temperature.ohno2013.planckian_table` definition + units tests methods. + """ + + def test_planckian_table(self): + """ + Tests :func:`colour.temperature.ohno2013.planckian_table` definition. + """ + + cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] + + np.testing.assert_almost_equal( + [(x.Ti, x.ui, x.vi, x.di) for x in planckian_table( + np.array([0.1978, 0.3122]), cmfs, 1000, 1010, 10)], + PLANCKIAN_TABLE) + + +class TestPlanckianTableMinimalDistanceIndex(unittest.TestCase): + """ + Defines :func:`colour.temperature.ohno2013.\ +planckian_table_minimal_distance_index` definition unit tests methods. + """ + + def test_planckian_table_minimal_distance_index(self): + """ + Tests :func:`colour.temperature.ohno2013.\ +planckian_table_minimal_distance_index` definition. + """ + + cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] + self.assertEqual( + planckian_table_minimal_distance_index( + planckian_table( + np.array([0.1978, 0.3122]), cmfs, 1000, 1010, 10)), 9) + + +class Testuv_to_CCT_Ohno2013(unittest.TestCase): + """ + Defines :func:`colour.temperature.ohno2013.uv_to_CCT_Ohno2013` definition + units tests methods. + """ + + def test_uv_to_CCT_Ohno2013(self): + """ + Tests :func:`colour.temperature.ohno2013.uv_to_CCT_Ohno2013` + definition. + """ + + cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] + np.testing.assert_almost_equal( + uv_to_CCT_Ohno2013(np.array([0.1978, 0.3122]), cmfs), + np.array([6507.47380460, 0.00322335]), + decimal=7) + + np.testing.assert_almost_equal( + uv_to_CCT_Ohno2013(np.array([0.4328, 0.2883]), cmfs), + np.array([1041.68315360, -0.06737802]), + decimal=7) + + np.testing.assert_almost_equal( + uv_to_CCT_Ohno2013(np.array([0.2927, 0.2722]), cmfs, iterations=4), + np.array([2452.15316417, -0.08437064]), + decimal=7) + + def test_n_dimensional_uv_to_CCT_Ohno2013(self): + """ + Tests :func:`colour.temperature.ohno2013.uv_to_CCT_Ohno2013` definition + n-dimensional arrays support. + """ + + uv = np.array([0.1978, 0.3122]) + CCT_D_uv = uv_to_CCT_Ohno2013(uv) + + uv = np.tile(uv, (6, 1)) + CCT_D_uv = np.tile(CCT_D_uv, (6, 1)) + np.testing.assert_almost_equal( + uv_to_CCT_Ohno2013(uv), CCT_D_uv, decimal=7) + + uv = np.reshape(uv, (2, 3, 2)) + CCT_D_uv = np.reshape(CCT_D_uv, (2, 3, 2)) + np.testing.assert_almost_equal( + uv_to_CCT_Ohno2013(uv), CCT_D_uv, decimal=7) + + @ignore_numpy_errors + def test_nan_uv_to_CCT_Ohno2013(self): + """ + Tests :func:`colour.temperature.ohno2013.uv_to_CCT_Ohno2013` definition + nan support. + """ + + cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] + cases = set(permutations(cases * 3, r=2)) + for case in cases: + uv = np.array(case) + uv_to_CCT_Ohno2013(uv) + + +class TestCCT_to_uv_Ohno2013(unittest.TestCase): + """ + Defines :func:`colour.temperature.ohno2013.CCT_to_uv_Ohno2013` definition + units tests methods. + """ + + def test_CCT_to_uv_Ohno2013(self): + """ + Tests :func:`colour.temperature.ohno2013.CCT_to_uv_Ohno2013` + definition. + """ + + cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] + np.testing.assert_almost_equal( + CCT_to_uv_Ohno2013(np.array([6507.47380460, 0.00322335]), cmfs), + np.array([0.19779997, 0.31219997]), + decimal=7) + + np.testing.assert_almost_equal( + CCT_to_uv_Ohno2013(np.array([1041.68315360, -0.06737802]), cmfs), + np.array([0.43279885, 0.28830013]), + decimal=7) + + np.testing.assert_almost_equal( + CCT_to_uv_Ohno2013(np.array([2452.15316417, -0.08437064]), cmfs), + np.array([0.29247364, 0.27215157]), + decimal=7) + + def test_n_dimensional_CCT_to_uv_Ohno2013(self): + """ + Tests :func:`colour.temperature.ohno2013.CCT_to_uv_Ohno2013` definition + n-dimensional arrays support. + """ + + cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] + CCT_D_uv = np.array([6507.47380460, 0.00322335]) + uv = CCT_to_uv_Ohno2013(CCT_D_uv, cmfs) + + CCT_D_uv = np.tile(CCT_D_uv, (6, 1)) + uv = np.tile(uv, (6, 1)) + np.testing.assert_almost_equal( + CCT_to_uv_Ohno2013(CCT_D_uv, cmfs), uv, decimal=7) + + CCT_D_uv = np.reshape(CCT_D_uv, (2, 3, 2)) + uv = np.reshape(uv, (2, 3, 2)) + np.testing.assert_almost_equal( + CCT_to_uv_Ohno2013(CCT_D_uv, cmfs), uv, decimal=7) + + @ignore_numpy_errors + def test_nan_CCT_to_uv_Ohno2013(self): + """ + Tests :func:`colour.temperature.ohno2013.CCT_to_uv_Ohno2013` definition + nan support. + """ + + cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] + cases = set(permutations(cases * 3, r=2)) + for case in cases: + CCT_D_uv = np.array(case) + CCT_to_uv_Ohno2013(CCT_D_uv) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/temperature/tests/test_robertson1968.py b/colour/temperature/tests/test_robertson1968.py new file mode 100644 index 0000000000..58ed519c8b --- /dev/null +++ b/colour/temperature/tests/test_robertson1968.py @@ -0,0 +1,227 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.temperature.robertson1968` module. +""" + +from __future__ import division, unicode_literals + +import numpy as np +import unittest +from itertools import permutations + +from colour.temperature import CCT_to_uv_Robertson1968, uv_to_CCT_Robertson1968 +from colour.utilities import ignore_numpy_errors + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = ['Testuv_to_CCT_Robertson1968', 'TestCCT_to_uv_Robertson1968'] + +TEMPERATURE_DUV_TO_UV = { + (2000, -0.0500): np.array([0.309448284638118, 0.309263824757947]), + (2000, -0.0250): np.array([0.307249142319059, 0.334166912378974]), + (2000, 0.0000): np.array([0.305050000000000, 0.359070000000000]), + (2000, 0.0250): np.array([0.302850857680941, 0.383973087621026]), + (2000, 0.0500): np.array([0.300651715361882, 0.408876175242053]), + (4500, -0.0500): np.array([0.249455133366328, 0.290111562671684]), + (4500, -0.0250): np.array([0.233393122238719, 0.309269114669175]), + (4500, 0.0000): np.array([0.217331111111111, 0.328426666666667]), + (4500, 0.0250): np.array([0.201269099983503, 0.347584218664158]), + (4500, 0.0500): np.array([0.185207088855895, 0.366741770661649]), + (7000, -0.0500): np.array([0.239763542240142, 0.279200871249525]), + (7000, -0.0250): np.array([0.218977485405785, 0.293091149910477]), + (7000, 0.0000): np.array([0.198191428571429, 0.306981428571429]), + (7000, 0.0250): np.array([0.177405371737072, 0.320871707232380]), + (7000, 0.0500): np.array([0.156619314902715, 0.334761985893332]), + (9500, -0.0500): np.array([0.235948844766320, 0.272619554367689]), + (9500, -0.0250): np.array([0.213587053962107, 0.283797671920686]), + (9500, 0.0000): np.array([0.191225263157895, 0.294975789473684]), + (9500, 0.0250): np.array([0.168863472353682, 0.306153907026682]), + (9500, 0.0500): np.array([0.146501681549470, 0.317332024579680]), + (12000, -0.0500): np.array([0.233956908310164, 0.268393952067210]), + (12000, -0.0250): np.array([0.210911787488415, 0.278085309366938]), + (12000, 0.0000): np.array([0.187866666666667, 0.287776666666667]), + (12000, 0.0250): np.array([0.164821545844918, 0.297468023966395]), + (12000, 0.0500): np.array([0.141776425023169, 0.307159381266124]), + (14500, -0.0500): np.array([0.232785809380768, 0.265479540863524]), + (14500, -0.0250): np.array([0.209387387449005, 0.274283735949003]), + (14500, 0.0000): np.array([0.185988965517241, 0.283087931034483]), + (14500, 0.0250): np.array([0.162590543585478, 0.291892126119962]), + (14500, 0.0500): np.array([0.139192121653715, 0.300696321205442]), + (17000, -0.0500): np.array([0.232028466821727, 0.263383405240889]), + (17000, -0.0250): np.array([0.208421880469687, 0.271613173208680]), + (17000, 0.0000): np.array([0.184815294117647, 0.279842941176471]), + (17000, 0.0250): np.array([0.161208707765607, 0.288072709144261]), + (17000, 0.0500): np.array([0.137602121413567, 0.296302477112052]), + (19500, -0.0500): np.array([0.231498602829451, 0.261824985205592]), + (19500, -0.0250): np.array([0.207757250132674, 0.269657492602796]), + (19500, 0.0000): np.array([0.184015897435897, 0.277490000000000]), + (19500, 0.0250): np.array([0.160274544739121, 0.285322507397204]), + (19500, 0.0500): np.array([0.136533192042344, 0.293155014794408]), + (22000, -0.0500): np.array([0.231114936519607, 0.260621561540512]), + (22000, -0.0250): np.array([0.207281559168895, 0.268169417133892]), + (22000, 0.0000): np.array([0.183448181818182, 0.275717272727273]), + (22000, 0.0250): np.array([0.159614804467469, 0.283265128320653]), + (22000, 0.0500): np.array([0.135781427116756, 0.290812983914034]), + (24500, -0.0500): np.array([0.230812633988541, 0.259664771591227]), + (24500, -0.0250): np.array([0.206910092504474, 0.266990651101736]), + (24500, 0.0000): np.array([0.183007551020408, 0.274316530612245]), + (24500, 0.0250): np.array([0.159105009536342, 0.281642410122754]), + (24500, 0.0500): np.array([0.135202468052276, 0.288968289633262]), + (27000, -0.0500): np.array([0.230583187091274, 0.258895100975109]), + (27000, -0.0250): np.array([0.206630667619711, 0.266055883820888]), + (27000, 0.0000): np.array([0.182678148148148, 0.273216666666667]), + (27000, 0.0250): np.array([0.158725628676585, 0.280377449512446]), + (27000, 0.0500): np.array([0.134773109205022, 0.287538232358225]), + (29500, -0.0500): np.array([0.230395500499851, 0.258258464459758]), + (29500, -0.0250): np.array([0.206403428216027, 0.265285588162082]), + (29500, 0.0000): np.array([0.182411355932203, 0.272312711864407]), + (29500, 0.0250): np.array([0.158419283648380, 0.279339835566731]), + (29500, 0.0500): np.array([0.134427211364556, 0.286366959269056]), + (32000, -0.0500): np.array([0.230235978654155, 0.257721638699323]), + (32000, -0.0250): np.array([0.206211114327078, 0.264635819349661]), + (32000, 0.0000): np.array([0.182186250000000, 0.271550000000000]), + (32000, 0.0250): np.array([0.158161385672923, 0.278464180650339]), + (32000, 0.0500): np.array([0.134136521345845, 0.285378361300677]), + (34500, -0.0500): np.array([0.230105666168844, 0.257266749246258]), + (34500, -0.0250): np.array([0.206054789606161, 0.264089896362260]), + (34500, 0.0000): np.array([0.182003913043478, 0.270913043478261]), + (34500, 0.0250): np.array([0.157953036480796, 0.277736190594262]), + (34500, 0.0500): np.array([0.133902159918113, 0.284559337710263]), + (37000, -0.0500): np.array([0.229999835834901, 0.256877639136083]), + (37000, -0.0250): np.array([0.205928431430964, 0.263628008757231]), + (37000, 0.0000): np.array([0.181857027027027, 0.270378378378378]), + (37000, 0.0250): np.array([0.157785622623090, 0.277128747999526]), + (37000, 0.0500): np.array([0.133714218219153, 0.283879117620674]), + (39500, -0.0500): np.array([0.229907042065651, 0.256537886918202]), + (39500, -0.0250): np.array([0.205817888121433, 0.263224639661633]), + (39500, 0.0000): np.array([0.181728734177215, 0.269911392405063]), + (39500, 0.0250): np.array([0.157639580232997, 0.276598145148494]), + (39500, 0.0500): np.array([0.133550426288780, 0.283284897891924]), + (42000, -0.0500): np.array([0.229825016678223, 0.256238659086365]), + (42000, -0.0250): np.array([0.205720365481969, 0.262869329543182]), + (42000, 0.0000): np.array([0.181615714285714, 0.269500000000000]), + (42000, 0.0250): np.array([0.157511063089460, 0.276130670456817]), + (42000, 0.0500): np.array([0.133406411893206, 0.282761340913635]), + (44500, -0.0500): np.array([0.229751988653572, 0.255973111790163]), + (44500, -0.0250): np.array([0.205633690955999, 0.262553971625419]), + (44500, 0.0000): np.array([0.181515393258427, 0.269134831460674]), + (44500, 0.0250): np.array([0.157397095560855, 0.275715691295930]), + (44500, 0.0500): np.array([0.133278797863282, 0.282296551131185]), + (47000, -0.0500): np.array([0.229686555034366, 0.255735860408829]), + (47000, -0.0250): np.array([0.205556149857609, 0.262272185523563]), + (47000, 0.0000): np.array([0.181425744680851, 0.268808510638298]), + (47000, 0.0250): np.array([0.157295339504093, 0.275344835753032]), + (47000, 0.0500): np.array([0.133164934327336, 0.281881160867767]), + (49500, -0.0500): np.array([0.229627590056716, 0.255522610251793]), + (49500, -0.0250): np.array([0.205486370785934, 0.262018880883472]), + (49500, 0.0000): np.array([0.181345151515151, 0.268515151515151]), + (49500, 0.0250): np.array([0.157203932244369, 0.275011422146831]), + (49500, 0.0500): np.array([0.133062712973587, 0.281507692778510]) +} + + +class Testuv_to_CCT_Robertson1968(unittest.TestCase): + """ + Defines :func:`colour.temperature.robertson1968.uv_to_CCT_Robertson1968` + definition unit tests methods. + """ + + def test_uv_to_CCT_Robertson1968(self): + """ + Tests :func:`colour.temperature.robertson1968.uv_to_CCT_Robertson1968` + definition. + """ + + for key, value in TEMPERATURE_DUV_TO_UV.items(): + np.testing.assert_allclose( + uv_to_CCT_Robertson1968(value), key, atol=0.25) + + def test_n_dimensional_uv_to_CCT_Robertson1968(self): + """ + Tests :func:`colour.temperature.robertson1968.uv_to_CCT_Robertson1968` + definition n-dimensional arrays support. + """ + + uv = np.array([0.1978, 0.3122]) + CCT_D_uv = uv_to_CCT_Robertson1968(uv) + + uv = np.tile(uv, (6, 1)) + CCT_D_uv = np.tile(CCT_D_uv, (6, 1)) + np.testing.assert_almost_equal( + uv_to_CCT_Robertson1968(uv), CCT_D_uv, decimal=7) + + uv = np.reshape(uv, (2, 3, 2)) + CCT_D_uv = np.reshape(CCT_D_uv, (2, 3, 2)) + np.testing.assert_almost_equal( + uv_to_CCT_Robertson1968(uv), CCT_D_uv, decimal=7) + + @ignore_numpy_errors + def test_nan_uv_to_CCT_Robertson1968(self): + """ + Tests :func:`colour.temperature.robertson1968.uv_to_CCT_Robertson1968` + definition nan support. + """ + + cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] + cases = set(permutations(cases * 3, r=2)) + for case in cases: + uv = np.array(case) + uv_to_CCT_Robertson1968(uv) + + +class TestCCT_to_uv_Robertson1968(unittest.TestCase): + """ + Defines :func:`colour.temperature.robertson1968.CCT_to_uv_Robertson1968` + definition unit tests methods. + """ + + def test_CCT_to_uv_Robertson1968(self): + """ + Tests :func:`colour.temperature.robertson1968.CCT_to_uv_Robertson1968` + definition. + """ + + for key, value in TEMPERATURE_DUV_TO_UV.items(): + np.testing.assert_almost_equal( + CCT_to_uv_Robertson1968(key), value, decimal=7) + + def test_n_dimensional_CCT_to_uv_Robertson1968(self): + """ + Tests :func:`colour.temperature.robertson1968.CCT_to_uv_Robertson1968` + definition n-dimensional arrays support. + """ + + CCT_D_uv = np.array([4500, 0.0250]) + uv = CCT_to_uv_Robertson1968(CCT_D_uv) + + CCT_D_uv = np.tile(CCT_D_uv, (6, 1)) + uv = np.tile(uv, (6, 1)) + np.testing.assert_almost_equal( + CCT_to_uv_Robertson1968(CCT_D_uv), uv, decimal=7) + + CCT_D_uv = np.reshape(CCT_D_uv, (2, 3, 2)) + uv = np.reshape(uv, (2, 3, 2)) + np.testing.assert_almost_equal( + CCT_to_uv_Robertson1968(CCT_D_uv), uv, decimal=7) + + @ignore_numpy_errors + def test_nan_CCT_to_uv_Robertson1968(self): + """ + Tests :func:`colour.temperature.robertson1968.CCT_to_uv_Robertson1968` + definition nan support. + """ + + cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] + cases = set(permutations(cases * 3, r=2)) + for case in cases: + CCT_D_uv = np.array(case) + CCT_to_uv_Robertson1968(CCT_D_uv) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/utilities/__init__.py b/colour/utilities/__init__.py index 514e8bde37..b35678b8d2 100644 --- a/colour/utilities/__init__.py +++ b/colour/utilities/__init__.py @@ -6,34 +6,34 @@ from .common import ( handle_numpy_errors, ignore_numpy_errors, raise_numpy_errors, print_numpy_errors, warn_numpy_errors, ignore_python_warnings, batch, - disable_multiprocessing, multiprocessing_pool, is_openimageio_installed, - is_pandas_installed, is_iterable, is_string, is_numeric, is_integer, - is_sibling, filter_kwargs, filter_mapping, first_item, - get_domain_range_scale, set_domain_range_scale, domain_range_scale, - to_domain_1, to_domain_10, to_domain_100, to_domain_degrees, to_domain_int, - from_range_1, from_range_10, from_range_100, from_range_degrees, - from_range_int) + disable_multiprocessing, multiprocessing_pool, is_networkx_installed, + is_openimageio_installed, is_pandas_installed, is_iterable, is_string, + is_numeric, is_integer, is_sibling, filter_kwargs, filter_mapping, + first_item, get_domain_range_scale, set_domain_range_scale, + domain_range_scale, to_domain_1, to_domain_10, to_domain_100, + to_domain_degrees, to_domain_int, from_range_1, from_range_10, + from_range_100, from_range_degrees, from_range_int) from .array import (as_array, as_int_array, as_float_array, as_numeric, as_int, as_float, as_namedtuple, closest_indexes, closest, normalise_maximum, interval, is_uniform, in_array, tstack, tsplit, row_as_diagonal, dot_vector, dot_matrix, orient, centroid, linear_conversion, lerp, fill_nan, ndarray_write) from .metrics import metric_mse, metric_psnr -from .verbose import (ColourWarning, ColourUsageWarning, ColourRuntimeWarning, - message_box, show_warning, warning, runtime_warning, - usage_warning, filter_warnings, suppress_warnings, - numpy_print_options, ANCILLARY_COLOUR_SCIENCE_PACKAGES, - ANCILLARY_RUNTIME_PACKAGES, - ANCILLARY_DEVELOPMENT_PACKAGES, describe_environment) +from .verbose import ( + ColourWarning, ColourUsageWarning, ColourRuntimeWarning, message_box, + show_warning, warning, runtime_warning, usage_warning, filter_warnings, + suppress_warnings, numpy_print_options, ANCILLARY_COLOUR_SCIENCE_PACKAGES, + ANCILLARY_RUNTIME_PACKAGES, ANCILLARY_DEVELOPMENT_PACKAGES, + ANCILLARY_EXTRAS_PACKAGES, describe_environment) __all__ = ['Lookup', 'Structure', 'CaseInsensitiveMapping'] __all__ += [ 'handle_numpy_errors', 'ignore_numpy_errors', 'raise_numpy_errors', 'print_numpy_errors', 'warn_numpy_errors', 'ignore_python_warnings', 'batch', 'disable_multiprocessing', 'multiprocessing_pool', - 'is_openimageio_installed', 'is_pandas_installed', 'is_iterable', - 'is_string', 'is_numeric', 'is_integer', 'is_sibling', 'filter_kwargs', - 'filter_mapping', 'first_item', 'get_domain_range_scale', + 'is_networkx_installed', 'is_openimageio_installed', 'is_pandas_installed', + 'is_iterable', 'is_string', 'is_numeric', 'is_integer', 'is_sibling', + 'filter_kwargs', 'filter_mapping', 'first_item', 'get_domain_range_scale', 'set_domain_range_scale', 'domain_range_scale', 'to_domain_1', 'to_domain_10', 'to_domain_100', 'to_domain_degrees', 'to_domain_int', 'from_range_1', 'from_range_10', 'from_range_100', 'from_range_degrees', @@ -53,5 +53,5 @@ 'usage_warning', 'filter_warnings', 'suppress_warnings', 'numpy_print_options', 'ANCILLARY_COLOUR_SCIENCE_PACKAGES', 'ANCILLARY_RUNTIME_PACKAGES', 'ANCILLARY_DEVELOPMENT_PACKAGES', - 'describe_environment' + 'ANCILLARY_EXTRAS_PACKAGES', 'describe_environment' ] diff --git a/colour/utilities/array.py b/colour/utilities/array.py index 6032c4b8fd..6affb2f911 100644 --- a/colour/utilities/array.py +++ b/colour/utilities/array.py @@ -20,9 +20,12 @@ from __future__ import division, unicode_literals import numpy as np -from collections import Mapping -from contextlib import contextmanager +try: # pragma: no cover + from collections import Mapping +except ImportError: # pragma: no cover + from collections.abc import Mapping +from contextlib import contextmanager from colour.constants import DEFAULT_FLOAT_DTYPE, DEFAULT_INT_DTYPE, EPSILON __author__ = 'Colour Developers' @@ -143,7 +146,7 @@ def as_numeric(a, dtype=DEFAULT_FLOAT_DTYPE): try: return dtype(a) - except TypeError: + except (TypeError, ValueError): return a @@ -221,10 +224,7 @@ def as_float(a): array([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.]) """ - try: - return DEFAULT_FLOAT_DTYPE(a) - except TypeError: - return as_float_array(a) + return DEFAULT_FLOAT_DTYPE(a) def as_namedtuple(a, named_tuple): @@ -990,6 +990,7 @@ def ndarray_write(a): a.setflags(write=True) - yield a - - a.setflags(write=False) + try: + yield a + finally: + a.setflags(write=False) diff --git a/colour/utilities/common.py b/colour/utilities/common.py index 6f13f624b6..7e73b64826 100644 --- a/colour/utilities/common.py +++ b/colour/utilities/common.py @@ -21,10 +21,11 @@ import functools import numpy as np import re +import six import warnings from contextlib import contextmanager from collections import OrderedDict -from copy import deepcopy +from copy import copy from six import integer_types, string_types from colour.constants import INTEGER_THRESHOLD, DEFAULT_FLOAT_DTYPE @@ -41,9 +42,9 @@ 'handle_numpy_errors', 'ignore_numpy_errors', 'raise_numpy_errors', 'print_numpy_errors', 'warn_numpy_errors', 'ignore_python_warnings', 'batch', 'disable_multiprocessing', 'multiprocessing_pool', - 'is_openimageio_installed', 'is_pandas_installed', 'is_iterable', - 'is_string', 'is_numeric', 'is_integer', 'is_sibling', 'filter_kwargs', - 'filter_mapping', 'first_item', 'get_domain_range_scale', + 'is_networkx_installed', 'is_openimageio_installed', 'is_pandas_installed', + 'is_iterable', 'is_string', 'is_numeric', 'is_integer', 'is_sibling', + 'filter_kwargs', 'filter_mapping', 'first_item', 'get_domain_range_scale', 'set_domain_range_scale', 'domain_range_scale', 'to_domain_1', 'to_domain_10', 'to_domain_100', 'to_domain_degrees', 'to_domain_int', 'from_range_1', 'from_range_10', 'from_range_100', 'from_range_degrees', @@ -226,7 +227,9 @@ def _initializer(kwargs): global _DOMAIN_RANGE_SCALE - _DOMAIN_RANGE_SCALE = kwargs.get('scale', 'reference') + # NOTE: No coverage information is available as this code is executed in + # sub-processes. + _DOMAIN_RANGE_SCALE = kwargs.get('scale', 'reference') # pragma: no cover @contextmanager @@ -291,9 +294,42 @@ def terminate(self): pool = pool_factory(*args, **kwargs) - yield pool + try: + yield pool + finally: + pool.terminate() + + +def is_networkx_installed(raise_exception=False): + """ + Returns if *NetworkX* is installed and available. + + Parameters + ---------- + raise_exception : bool + Raise exception if *NetworkX* is unavailable. + + Returns + ------- + bool + Is *NetworkX* installed. + + Raises + ------ + ImportError + If *NetworkX* is not installed. + """ - pool.terminate() + try: # pragma: no cover + import networkx # noqa + + return True + except ImportError as error: # pragma: no cover + if raise_exception: + raise ImportError(('"NetworkX" related API features, e.g. ' + 'the automatic colour conversion graph, ' + 'are not available: "{0}".').format(error)) + return False def is_openimageio_installed(raise_exception=False): @@ -316,13 +352,13 @@ def is_openimageio_installed(raise_exception=False): If *OpenImageIO* is not installed. """ - try: + try: # pragma: no cover import OpenImageIO # noqa return True - except ImportError as error: + except ImportError as error: # pragma: no cover if raise_exception: - raise ImportError(('"OpenImageIO" related Api features ' + raise ImportError(('"OpenImageIO" related API features ' 'are not available: "{0}".').format(error)) return False @@ -347,13 +383,13 @@ def is_pandas_installed(raise_exception=False): If *Pandas* is not installed. """ - try: + try: # pragma: no cover import pandas # noqa return True - except ImportError as error: + except ImportError as error: # pragma: no cover if raise_exception: - raise ImportError(('"Pandas" related Api features ' + raise ImportError(('"Pandas" related API features ' 'are not available: "{0}".').format(error)) return False @@ -507,6 +543,12 @@ def filter_kwargs(function, **kwargs): dict Filtered keyword arguments. + Warnings + -------- + Python 2.7 does not support inspecting the signature of *partial* + functions, this could cause unexpected behaviour when using this + definition. + Examples -------- >>> def fn_a(a): @@ -523,8 +565,19 @@ def filter_kwargs(function, **kwargs): (1, 2, 3) """ - kwargs = deepcopy(kwargs) - args, _varargs, _keywords, _defaults = inspect.getargspec(function) + kwargs = copy(kwargs) + + # TODO: Remove when dropping Python 2.7. + if six.PY2: # pragma: no cover + try: + args, _varargs, _keywords, _defaults = inspect.getargspec(function) + except (TypeError, ValueError): + return {} + else: # pragma: no cover + try: + args = list(inspect.signature(function).parameters.keys()) + except ValueError: + return {} args = set(kwargs.keys()) - set(args) for key in args: diff --git a/colour/utilities/data_structures.py b/colour/utilities/data_structures.py index 24206817b1..c5e8739fe7 100644 --- a/colour/utilities/data_structures.py +++ b/colour/utilities/data_structures.py @@ -27,7 +27,10 @@ from __future__ import division, unicode_literals -from collections import Mapping, MutableMapping +try: # pragma: no cover + from collections import Mapping, MutableMapping +except ImportError: # pragma: no cover + from collections.abc import Mapping, MutableMapping __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -41,7 +44,7 @@ class Structure(dict): """ - Defines an object similar to C/C++ structured type. + Defines a dict-like object allowing to access key values using dot syntax. Other Parameters ---------------- @@ -138,10 +141,7 @@ def first_key_from_value(self, value): Key. """ - try: - return self.keys_from_value(value)[0] - except IndexError: - pass + return self.keys_from_value(value)[0] class CaseInsensitiveMapping(MutableMapping): @@ -325,11 +325,13 @@ def __eq__(self, item): """ if isinstance(item, Mapping): - item = CaseInsensitiveMapping(item) + item_mapping = CaseInsensitiveMapping(item) else: - return NotImplemented + raise ValueError( + 'Impossible to test equality with "{0}" class type!'.format( + item.__class__.__name__)) - return dict(self.lower_items()) == dict(item.lower_items()) + return dict(self.lower_items()) == dict(item_mapping.lower_items()) def __ne__(self, item): """ diff --git a/colour/utilities/deprecation.py b/colour/utilities/deprecation.py index 533789a035..6f3e15b583 100644 --- a/colour/utilities/deprecation.py +++ b/colour/utilities/deprecation.py @@ -23,12 +23,15 @@ __status__ = 'Production' __all__ = [ - 'Renamed', 'Removed', 'FutureRename', 'FutureRemove', 'FutureAccessChange', - 'FutureAccessRemove', 'ModuleAPI', 'get_attribute' + 'ObjectRenamed', 'ObjectRemoved', 'ObjectFutureRename', + 'ObjectFutureRemove', 'ObjectFutureAccessChange', + 'ObjectFutureAccessRemove', 'ModuleAPI', 'ArgumentRenamed', + 'ArgumentRemoved', 'ArgumentFutureRename', 'ArgumentFutureRemove', + 'get_attribute', 'build_API_changes', 'handle_arguments_deprecation' ] -class Renamed(namedtuple('Renamed', ('name', 'new_name'))): +class ObjectRenamed(namedtuple('ObjectRenamed', ('name', 'new_name'))): """ A class used for an object that has been renamed. @@ -54,7 +57,7 @@ def __str__(self): self.name, self.new_name)) -class Removed(namedtuple('Removed', ('name', ))): +class ObjectRemoved(namedtuple('ObjectRemoved', ('name', ))): """ A class used for an object that has been removed. @@ -77,7 +80,8 @@ def __str__(self): return '"{0}" object has been removed from the API.'.format(self.name) -class FutureRename(namedtuple('FutureRename', ('name', 'new_name'))): +class ObjectFutureRename( + namedtuple('ObjectFutureRename', ('name', 'new_name'))): """ A class used for future object name deprecation, i.e. object name will change in a future release. @@ -104,7 +108,7 @@ def __str__(self): 'in a future release.'.format(self.name, self.new_name)) -class FutureRemove(namedtuple('FutureRemove', ('name', 'access'))): +class ObjectFutureRemove(namedtuple('ObjectFutureRemove', ('name', ))): """ A class used for future object removal. @@ -112,8 +116,6 @@ class FutureRemove(namedtuple('FutureRemove', ('name', 'access'))): ---------- name : unicode Object name that will be removed in a future release. - access : unicode - Object current access. """ def __str__(self): @@ -130,8 +132,8 @@ def __str__(self): 'in a future release.'.format(self.name)) -class FutureAccessChange( - namedtuple('FutureAccessChange', ('access', 'new_access'))): +class ObjectFutureAccessChange( + namedtuple('ObjectFutureAccessChange', ('access', 'new_access'))): """ A class used for future object access deprecation, i.e. object access will change in a future release. @@ -159,7 +161,8 @@ def __str__(self): self.new_access)) -class FutureAccessRemove(namedtuple('FutureAccessRemove', ('name', 'access'))): +class ObjectFutureAccessRemove( + namedtuple('ObjectFutureAccessRemove', ('name', ))): """ A class used for future object access removal, i.e. object access will be removed in a future release. @@ -168,8 +171,6 @@ class FutureAccessRemove(namedtuple('FutureAccessRemove', ('name', 'access'))): ---------- name : unicode Object name whose access will removed in a future release. - access : unicode - Object access that will be removed in a future release. """ def __str__(self): @@ -187,6 +188,108 @@ def __str__(self): self.name)) +class ArgumentRenamed(namedtuple('ArgumentRenamed', ('name', 'new_name'))): + """ + A class used for an argument that has been renamed. + + Parameters + ---------- + name : unicode + Argument name that changed. + new_name : unicode + Argument new name. + """ + + def __str__(self): + """ + Returns a formatted string representation of the class. + + Returns + ------- + unicode + Formatted string representation. + """ + + return ('"{0}" argument has been renamed to "{1}".'.format( + self.name, self.new_name)) + + +class ArgumentRemoved(namedtuple('ArgumentRemoved', ('name', ))): + """ + A class used for an argument that has been removed. + + Parameters + ---------- + name : unicode + Argument name that has been removed. + """ + + def __str__(self): + """ + Returns a formatted string representation of the class. + + Returns + ------- + unicode + Formatted string representation. + """ + + return '"{0}" argument has been removed from the API.'.format( + self.name) + + +class ArgumentFutureRename( + namedtuple('ArgumentFutureRename', ('name', 'new_name'))): + """ + A class used for future argument name deprecation, i.e. argument name will + change in a future release. + + Parameters + ---------- + name : unicode + Argument name that will change in a future release. + new_name : unicode + Argument future release name. + """ + + def __str__(self): + """ + Returns a formatted string representation of the deprecation type. + + Returns + ------- + unicode + Formatted string representation. + """ + + return ('"{0}" argument is deprecated and will be renamed to "{1}" ' + 'in a future release.'.format(self.name, self.new_name)) + + +class ArgumentFutureRemove(namedtuple('ArgumentFutureRemove', ('name', ))): + """ + A class used for future argument removal. + + Parameters + ---------- + name : unicode + Argument name that will be removed in a future release. + """ + + def __str__(self): + """ + Returns a formatted string representation of the deprecation type. + + Returns + ------- + unicode + Formatted string representation. + """ + + return ('"{0}" argument is deprecated and will be removed ' + 'in a future release.'.format(self.name)) + + class ModuleAPI(object): """ Define a class that allows customisation of module attributes access with @@ -236,9 +339,12 @@ def __getattr__(self, attribute): change = self._changes.get(attribute) if change is not None: - if not isinstance(change, Removed): + if not isinstance(change, ObjectRemoved): + usage_warning(str(change)) - return get_attribute(change[1]) + + return (getattr(self._module, attribute) if isinstance( + change, ObjectFutureRemove) else get_attribute(change[1])) else: raise AttributeError(str(change)) @@ -286,13 +392,139 @@ def get_attribute(attribute): assert '.' in attribute, '"{0}" attribute has no namespace!' - module, attribute = attribute.split('.', 1) + module_name, attribute = attribute.rsplit('.', 1) - module = sys.modules.get(module) + module = sys.modules.get(module_name) if module is None: - module = import_module(module) + module = import_module(module_name) assert module is not None, ( - '"{0}" module does not exists or is not imported!') + '"{0}" module does not exists or cannot be imported!'.format( + module_name)) return attrgetter(attribute)(module) + + +def build_API_changes(changes): + """ + Builds the effective API changes for a desired API changes mapping. + + Parameters + ---------- + changes : dict + Dictionary of desired API changes. + + Returns + ------- + dict + API changes + + Examples + -------- + >>> from pprint import pprint + >>> changes = { + ... 'ObjectRenamed': [[ + ... 'module.object_1_name', + ... 'module.object_1_new_name', + ... ]], + ... 'ObjectFutureRename': [[ + ... 'module.object_2_name', + ... 'module.object_2_new_name', + ... ]], + ... 'ObjectFutureAccessChange': [[ + ... 'module.object_3_access', + ... 'module.sub_module.object_3_new_access', + ... ]], + ... 'ObjectRemoved': ['module.object_4_name'], + ... 'ObjectFutureRemove': ['module.object_5_name'], + ... 'ObjectFutureAccessRemove': ['module.object_6_access'], + ... } + >>> pprint(build_API_changes(changes)) # doctest: +SKIP + {'object_1_name': ObjectRenamed(name='module.object_1_name', \ +new_name='module.object_1_new_name'), + 'object_2_name': ObjectFutureRename(name='module.object_2_name', \ +new_name='module.object_2_new_name'), + 'object_3_access': ObjectFutureAccessChange(\ +access='module.object_3_access', \ +new_access='module.sub_module.object_3_new_access'), + 'object_4_name': ObjectRemoved(name='module.object_4_name'), + 'object_5_name': ObjectFutureRemove(name='module.object_5_name'), + 'object_6_access': ObjectFutureAccessRemove(\ +name='module.object_6_access')} + """ + + for change_type in (ObjectRenamed, ObjectFutureRename, + ObjectFutureAccessChange, ArgumentRenamed, + ArgumentFutureRename): + for change in changes.pop(change_type.__name__, []): + changes[change[0].split('.')[-1]] = change_type(*change) # noqa + + for change_type in (ObjectRemoved, ObjectFutureRemove, + ObjectFutureAccessRemove, ArgumentRemoved, + ArgumentFutureRemove): + for change in changes.pop(change_type.__name__, []): + changes[change.split('.')[-1]] = change_type(change) # noqa + + return changes + + +def handle_arguments_deprecation(changes, **kwargs): + """ + Handles arguments deprecation according to desired API changes mapping. + + Parameters + ---------- + changes : dict + Dictionary of desired API changes. + + Other Parameters + ---------------- + \\**kwargs : dict, optional + Keywords arguments to handle. + + Returns + ------- + dict + Handled keywords arguments. + + Examples + -------- + >>> changes = { + ... 'ArgumentRenamed': [[ + ... 'argument_1_name', + ... 'argument_1_new_name', + ... ]], + ... 'ArgumentFutureRename': [[ + ... 'argument_2_name', + ... 'argument_2_new_name', + ... ]], + ... 'ArgumentRemoved': ['argument_3_name'], + ... 'ArgumentFutureRemove': ['argument_4_name'], + ... } + >>> handle_arguments_deprecation(changes, argument_1_name=True, + ... argument_2_name=True, argument_4_name=True) + ... # doctest: +SKIP + {'argument_4_name': True, 'argument_1_new_name': True, \ +'argument_2_new_name': True} + """ + + changes = build_API_changes(changes) + + for kwarg in kwargs: + change = changes.get(kwarg) + + if change is None: + continue + + if not isinstance(change, ArgumentRemoved): + + usage_warning(str(change)) + + if isinstance(change, ArgumentFutureRemove): + continue + else: + kwargs[change[1]] = kwargs.pop(kwarg) + else: + raise ValueError(str(change)) + + return kwargs diff --git a/colour/utilities/tests/test_array.py b/colour/utilities/tests/test_array.py index cda82dab50..a2b41cdbf2 100644 --- a/colour/utilities/tests/test_array.py +++ b/colour/utilities/tests/test_array.py @@ -110,6 +110,10 @@ def test_as_numeric(self): self.assertIsInstance(as_numeric(1, int), int) + self.assertListEqual(as_numeric(['John', 'Doe']), ['John', 'Doe']) + + self.assertEqual(as_numeric('John Doe'), 'John Doe') + class TestAsInt(unittest.TestCase): """ diff --git a/colour/utilities/tests/test_common.py b/colour/utilities/tests/test_common.py index 6b1e777fbd..6756358d6a 100644 --- a/colour/utilities/tests/test_common.py +++ b/colour/utilities/tests/test_common.py @@ -7,6 +7,7 @@ import numpy as np import unittest +import six from collections import OrderedDict from functools import partial @@ -78,7 +79,9 @@ def _add(a, b): Addition result. """ - return a + b + # NOTE: No coverage information is available as this code is executed in + # sub-processes. + return a + b # pragma: no cover class TestMultiprocessingPool(unittest.TestCase): @@ -272,6 +275,12 @@ def fn_c(a, b=0, c=0): self.assertTupleEqual((1, 2, 3), fn_c(1, **filter_kwargs(fn_c, b=2, c=3))) + if six.PY2: # pragma: no cover + self.assertDictEqual(filter_kwargs(partial(fn_c, b=1), b=1), {}) + else: # pragma: no cover + self.assertDictEqual( + filter_kwargs(partial(fn_c, b=1), b=1), {'b': 1}) + class TestFilterMapping(unittest.TestCase): """ @@ -435,7 +444,7 @@ def test_domain_range_scale(self): self.assertEqual(get_domain_range_scale(), 'reference') - def _domain_range_change(a): + def fn_a(a): """ Helper definition performing domain-range scale. """ @@ -451,19 +460,33 @@ def _domain_range_change(a): with domain_range_scale('100'): with domain_range_scale('Ignore'): self.assertEqual(get_domain_range_scale(), 'ignore') - self.assertEqual(_domain_range_change(4), 8) + self.assertEqual(fn_a(4), 8) self.assertEqual(get_domain_range_scale(), '100') - self.assertEqual(_domain_range_change(40), 8) + self.assertEqual(fn_a(40), 8) self.assertEqual(get_domain_range_scale(), '1') - self.assertEqual(_domain_range_change(0.4), 0.08) + self.assertEqual(fn_a(0.4), 0.08) self.assertEqual(get_domain_range_scale(), 'reference') - self.assertEqual(_domain_range_change(4), 8) + self.assertEqual(fn_a(4), 8) self.assertEqual(get_domain_range_scale(), 'reference') + @domain_range_scale(1) + def fn_b(a): + """ + Helper definition performing domain-range scale. + """ + + b = to_domain_10(a) + + b *= 2 + + return from_range_100(b) + + self.assertEqual(fn_b(10), 2.0) + class TestToDomain1(unittest.TestCase): """ diff --git a/colour/utilities/tests/test_data_structures.py b/colour/utilities/tests/test_data_structures.py index 37a53f6083..6aa089fb3c 100644 --- a/colour/utilities/tests/test_data_structures.py +++ b/colour/utilities/tests/test_data_structures.py @@ -6,6 +6,7 @@ from __future__ import division, unicode_literals import numpy as np +import operator import pickle import unittest @@ -127,6 +128,14 @@ def test_first_key_from_value(self): C=np.array([2, 3, 4])) self.assertEqual('A', lookup.first_key_from_value(np.array([0, 1, 2]))) + def test_raise_exception_first_key_from_value(self): + """ + Tests :meth:`colour.utilities.data_structures.\ +Lookup.first_key_from_value` method raised exception. + """ + + self.assertRaises(IndexError, Lookup().first_key_from_value, 'John') + class TestCaseInsensitiveMapping(unittest.TestCase): """ @@ -134,6 +143,16 @@ class TestCaseInsensitiveMapping(unittest.TestCase): class unit tests methods. """ + def test_required_attributes(self): + """ + Tests presence of required attributes. + """ + + required_attributes = ('data', ) + + for attribute in required_attributes: + self.assertIn(attribute, dir(CaseInsensitiveMapping)) + def test_required_methods(self): """ Tests presence of required methods. @@ -146,6 +165,21 @@ def test_required_methods(self): for method in required_methods: self.assertIn(method, dir(CaseInsensitiveMapping)) + def test_data(self): + """ + Tests :meth:`colour.utilities.data_structures.\ +CaseInsensitiveMapping.data` property. + """ + + self.assertDictEqual( + CaseInsensitiveMapping({ + 'John': 'Doe', + 'Jane': 'Doe' + }).data, { + 'jane': ('Jane', 'Doe'), + 'john': ('John', 'Doe') + }) + def test__setitem__(self): """ Tests :meth:`colour.utilities.data_structures.\ @@ -240,6 +274,16 @@ def test__eq__(self): self.assertEqual(mapping2, mapping3) + def test_raise_exception__eq__(self): + """ + Tests :meth:`colour.utilities.data_structures.\ +CaseInsensitiveMapping.__eq__` method raised exception. + """ + + self.assertRaises(ValueError, operator.eq, + CaseInsensitiveMapping(John='Doe', Jane='Doe'), + ['John', 'Doe', 'Jane', 'Doe']) + def test__ne__(self): """ Tests :meth:`colour.utilities.data_structures.\ @@ -251,6 +295,16 @@ def test__ne__(self): self.assertNotEqual(mapping1, mapping2) + def test_raise_exception__ne__(self): + """ + Tests :meth:`colour.utilities.data_structures.\ +CaseInsensitiveMapping.__ne__` method raised exception. + """ + + self.assertRaises(ValueError, operator.ne, + CaseInsensitiveMapping(John='Doe', Jane='Doe'), + ['John', 'Doe', 'Jane', 'Doe']) + def test_copy(self): """ Tests :meth:`colour.utilities.data_structures.\ diff --git a/colour/utilities/tests/test_deprecated.py b/colour/utilities/tests/test_deprecated.py new file mode 100644 index 0000000000..de9c1e9e28 --- /dev/null +++ b/colour/utilities/tests/test_deprecated.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- + +from __future__ import absolute_import + +import sys +from colour.utilities.deprecation import (ModuleAPI, ObjectRenamed, + ObjectRemoved) + + +class deprecated(ModuleAPI): + def __getattr__(self, attribute): + return super(deprecated, self).__getattr__(attribute) + + +NAME = None +""" +An non-deprecated module attribute. + +NAME : object +""" + +NEW_NAME = None +""" +A module attribute with a new name. + +NAME : object +""" + +sys.modules['colour.utilities.tests.test_deprecated'] = (deprecated( + sys.modules['colour.utilities.tests.test_deprecated'], { + 'OLD_NAME': + ObjectRenamed( + name='colour.utilities.tests.test_deprecated.OLD_NAME', + new_name='colour.utilities.tests.test_deprecated.NEW_NAME'), + 'REMOVED': + ObjectRemoved(name='colour.utilities.tests.test_deprecated.REMOVED' + ) + })) + +del ModuleAPI +del ObjectRenamed +del ObjectRemoved +del sys diff --git a/colour/utilities/tests/test_deprecation.py b/colour/utilities/tests/test_deprecation.py index 80cfe2a017..9c70c60fe4 100644 --- a/colour/utilities/tests/test_deprecation.py +++ b/colour/utilities/tests/test_deprecation.py @@ -5,9 +5,14 @@ from __future__ import division, unicode_literals +import sys import unittest -from colour.utilities.deprecation import get_attribute +from colour.utilities.deprecation import ( + ObjectRenamed, ObjectRemoved, ObjectFutureRename, ObjectFutureRemove, + ObjectFutureAccessChange, ObjectFutureAccessRemove, ArgumentRenamed, + ArgumentRemoved, ArgumentFutureRename, ArgumentFutureRemove, ModuleAPI, + get_attribute, build_API_changes, handle_arguments_deprecation) __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -16,7 +21,317 @@ __email__ = 'colour-science@googlegroups.com' __status__ = 'Production' -__all__ = ['TestGetAttribute'] +__all__ = [ + 'TestObjectRenamed', 'TestObjectRemoved', 'TestObjectFutureRename', + 'TestObjectFutureRemove', 'TestObjectFutureAccessChange', + 'TestObjectFutureAccessRemove', 'TestArgumentRenamed', + 'TestArgumentRemoved', 'TestArgumentFutureRename', + 'TestArgumentFutureRemove', 'TestModuleAPI', 'TestGetAttribute', + 'TestBuildAPIChanges', 'TestHandleArgumentsDeprecation' +] + + +class TestObjectRenamed(unittest.TestCase): + """ + Defines :class:`colour.utilities.deprecation.ObjectRenamed` class unit + tests methods. + """ + + def test_required_methods(self): + """ + Tests presence of required methods. + """ + + required_methods = ('__str__', ) + + for method in required_methods: + self.assertIn(method, dir(ObjectRenamed)) + + def test__str__(self): + """ + Tests :meth:`colour.utilities.deprecation.ObjectRenamed.__str__` + method. + """ + + self.assertIn('name', str(ObjectRenamed('name', 'new_name'))) + self.assertIn('new_name', str(ObjectRenamed('name', 'new_name'))) + + +class TestObjectRemoved(unittest.TestCase): + """ + Defines :class:`colour.utilities.deprecation.ObjectRemoved` class unit + tests methods. + """ + + def test_required_methods(self): + """ + Tests presence of required methods. + """ + + required_methods = ('__str__', ) + + for method in required_methods: + self.assertIn(method, dir(ObjectRemoved)) + + def test__str__(self): + """ + Tests :meth:`colour.utilities.deprecation.ObjectRemoved.__str__` + method. + """ + + self.assertIn('name', str(ObjectRemoved('name'))) + + +class TestObjectFutureRename(unittest.TestCase): + """ + Defines :class:`colour.utilities.deprecation.ObjectFutureRename` class unit + tests methods. + """ + + def test_required_methods(self): + """ + Tests presence of required methods. + """ + + required_methods = ('__str__', ) + + for method in required_methods: + self.assertIn(method, dir(ObjectFutureRename)) + + def test__str__(self): + """ + Tests :meth:`colour.utilities.deprecation.ObjectFutureRename.__str__` + method. + """ + + self.assertIn('name', str(ObjectFutureRename('name', 'new_name'))) + self.assertIn('new_name', str(ObjectFutureRename('name', 'new_name'))) + + +class TestObjectFutureRemove(unittest.TestCase): + """ + Defines :class:`colour.utilities.deprecation.ObjectFutureRemove` class unit + tests methods. + """ + + def test_required_methods(self): + """ + Tests presence of required methods. + """ + + required_methods = ('__str__', ) + + for method in required_methods: + self.assertIn(method, dir(ObjectFutureRemove)) + + def test__str__(self): + """ + Tests :meth:`colour.utilities.deprecation.ObjectFutureRemove.__str__` + method. + """ + + self.assertIn('name', str(ObjectFutureRemove('name', ))) + + +class TestObjectFutureAccessChange(unittest.TestCase): + """ + Defines :class:`colour.utilities.deprecation.ObjectFutureAccessChange` + class unit tests methods. + """ + + def test_required_methods(self): + """ + Tests presence of required methods. + """ + + required_methods = ('__str__', ) + + for method in required_methods: + self.assertIn(method, dir(ObjectFutureAccessChange)) + + def test__str__(self): + """ + Tests :meth:`colour.utilities.deprecation.\ +ObjectFutureAccessChange.__str__` method. + """ + + self.assertIn('name', + str(ObjectFutureAccessChange('name', 'new_access'))) + self.assertIn('new_access', + str(ObjectFutureAccessChange('name', 'new_access'))) + + +class TestObjectFutureAccessRemove(unittest.TestCase): + """ + Defines :class:`colour.utilities.deprecation.ObjectFutureAccessRemove` + class unit tests methods. + """ + + def test_required_methods(self): + """ + Tests presence of required methods. + """ + + required_methods = ('__str__', ) + + for method in required_methods: + self.assertIn(method, dir(ObjectFutureAccessRemove)) + + def test__str__(self): + """ + Tests :meth:`colour.utilities.deprecation.\ +ObjectFutureAccessRemove.__str__` method. + """ + + self.assertIn('name', str(ObjectFutureAccessRemove('name', ))) + + +class TestArgumentRenamed(unittest.TestCase): + """ + Defines :class:`colour.utilities.deprecation.ArgumentRenamed` class unit + tests methods. + """ + + def test_required_methods(self): + """ + Tests presence of required methods. + """ + + required_methods = ('__str__', ) + + for method in required_methods: + self.assertIn(method, dir(ArgumentRenamed)) + + def test__str__(self): + """ + Tests :meth:`colour.utilities.deprecation.ArgumentRenamed.__str__` + method. + """ + + self.assertIn('name', str(ArgumentRenamed('name', 'new_name'))) + self.assertIn('new_name', str(ArgumentRenamed('name', 'new_name'))) + + +class TestArgumentRemoved(unittest.TestCase): + """ + Defines :class:`colour.utilities.deprecation.ArgumentRemoved` class unit + tests methods. + """ + + def test_required_methods(self): + """ + Tests presence of required methods. + """ + + required_methods = ('__str__', ) + + for method in required_methods: + self.assertIn(method, dir(ArgumentRemoved)) + + def test__str__(self): + """ + Tests :meth:`colour.utilities.deprecation.ArgumentRemoved.__str__` + method. + """ + + self.assertIn('name', str(ArgumentRemoved('name'))) + + +class TestArgumentFutureRename(unittest.TestCase): + """ + Defines :class:`colour.utilities.deprecation.ArgumentFutureRename` class + unit tests methods. + """ + + def test_required_methods(self): + """ + Tests presence of required methods. + """ + + required_methods = ('__str__', ) + + for method in required_methods: + self.assertIn(method, dir(ArgumentFutureRename)) + + def test__str__(self): + """ + Tests :meth:`colour.utilities.deprecation.\ + ArgumentFutureRename.__str__` method. + """ + + self.assertIn('name', str(ArgumentFutureRename('name', 'new_name'))) + self.assertIn('new_name', str( + ArgumentFutureRename('name', 'new_name'))) + + +class TestArgumentFutureRemove(unittest.TestCase): + """ + Defines :class:`colour.utilities.deprecation.ArgumentFutureRemove` class + unit tests methods. + """ + + def test_required_methods(self): + """ + Tests presence of required methods. + """ + + required_methods = ('__str__', ) + + for method in required_methods: + self.assertIn(method, dir(ArgumentFutureRemove)) + + def test__str__(self): + """ + Tests :meth:`colour.utilities.deprecation.\ +ArgumentFutureRemove.__str__` method. + """ + + self.assertIn('name', str(ArgumentFutureRemove('name', ))) + + +class TestModuleAPI(unittest.TestCase): + """ + Defines :class:`colour.utilities.deprecation.ModuleAPI` class unit tests + methods. + """ + + def test_required_methods(self): + """ + Tests presence of required methods. + """ + + required_methods = ('__init__', '__getattr__', '__dir__') + + for method in required_methods: + self.assertIn(method, dir(ModuleAPI)) + + def test__getattr__(self): + """ + Tests :func:`colour.utilities.deprecation.ModuleAPI.__getattr__` + method. + """ + + import colour.utilities.tests.test_deprecated + + self.assertIsNone(colour.utilities.tests.test_deprecated.NAME) + + # TODO: Use "assertWarns" when dropping Python 2.7. + getattr(colour.utilities.tests.test_deprecated, 'OLD_NAME') + + del sys.modules['colour.utilities.tests.test_deprecated'] + + def test_raise_exception__getattr__(self): + """ + Tests :func:`colour.utilities.deprecation.ModuleAPI.__getattr__` + method raised exception. + """ + + import colour.utilities.tests.test_deprecated + + self.assertRaises(AttributeError, getattr, + colour.utilities.tests.test_deprecated, 'REMOVED') + + del sys.modules['colour.utilities.tests.test_deprecated'] class TestGetAttribute(unittest.TestCase): @@ -33,13 +348,121 @@ def test_get_attribute(self): from colour import adaptation self.assertIs(get_attribute('colour.adaptation'), adaptation) - from colour.models import oetf_sRGB - self.assertIs(get_attribute('colour.models.oetf_sRGB'), oetf_sRGB) + from colour.models import eotf_inverse_sRGB + self.assertIs( + get_attribute('colour.models.eotf_inverse_sRGB'), + eotf_inverse_sRGB) from colour.utilities.array import as_numeric self.assertIs( get_attribute('colour.utilities.array.as_numeric'), as_numeric) + if 'colour.utilities.tests.test_deprecated' in sys.modules: + del sys.modules['colour.utilities.tests.test_deprecated'] + attribute = get_attribute( + 'colour.utilities.tests.test_deprecated.NEW_NAME') + import colour.utilities.tests.test_deprecated + self.assertIs(attribute, + colour.utilities.tests.test_deprecated.NEW_NAME) + del sys.modules['colour.utilities.tests.test_deprecated'] + + +class TestBuildAPIChanges(unittest.TestCase): + """ + Defines :func:`colour.utilities.deprecation.build_API_changes` definition + unit tests methods. + """ + + def test_build_API_changes(self): + """ + Tests :func:`colour.utilities.deprecation.build_API_changes` + definition. + """ + + changes = build_API_changes({ + 'ObjectRenamed': [[ + 'module.object_1_name', + 'module.object_1_new_name', + ]], + 'ObjectFutureRename': [[ + 'module.object_2_name', + 'module.object_2_new_name', + ]], + 'ObjectFutureAccessChange': [[ + 'module.object_3_access', + 'module.sub_module.object_3_new_access', + ]], + 'ObjectRemoved': ['module.object_4_name'], + 'ObjectFutureRemove': ['module.object_5_name'], + 'ObjectFutureAccessRemove': ['module.object_6_access'], + 'ArgumentRenamed': [[ + 'argument_1_name', + 'argument_1_new_name', + ]], + 'ArgumentFutureRename': [[ + 'argument_2_name', + 'argument_2_new_name', + ]], + 'ArgumentRemoved': ['argument_3_name'], + 'ArgumentFutureRemove': ['argument_4_name'], + }) + for name, change_type in ( + ('object_1_name', ObjectRenamed), + ('object_2_name', ObjectFutureRename), + ('object_3_access', ObjectFutureAccessChange), + ('object_4_name', ObjectRemoved), + ('object_5_name', ObjectFutureRemove), + ('object_6_access', ObjectFutureAccessRemove), + ('argument_1_name', ArgumentRenamed), + ('argument_2_name', ArgumentFutureRename), + ('argument_3_name', ArgumentRemoved), + ('argument_4_name', ArgumentFutureRemove), + ): + self.assertIsInstance(changes[name], change_type) + + +class TestHandleArgumentsDeprecation(unittest.TestCase): + """ + Defines :func:`colour.utilities.deprecation.handle_arguments_deprecation` + definition unit tests methods. + """ + + def test_handle_arguments_deprecation(self): + """ + Tests :func:`colour.utilities.deprecation.handle_arguments_deprecation` + definition. + """ + + changes = { + 'ArgumentRenamed': [[ + 'argument_1_name', + 'argument_1_new_name', + ]], + 'ArgumentFutureRename': [[ + 'argument_2_name', + 'argument_2_new_name', + ]], + 'ArgumentRemoved': ['argument_3_name'], + 'ArgumentFutureRemove': ['argument_4_name'], + } + + self.assertDictEqual( + handle_arguments_deprecation( + changes, + argument_1_name=True, + argument_2_name=True, + argument_4_name=True), { + 'argument_1_new_name': True, + 'argument_2_new_name': True, + 'argument_4_name': True + }) + + self.assertRaises( + ValueError, + lambda: handle_arguments_deprecation( + changes, argument_3_name=True), + ) + if __name__ == '__main__': unittest.main() diff --git a/colour/utilities/tests/test_documentation.py b/colour/utilities/tests/test_documentation.py index 7767dd6e87..e3bb497e3d 100644 --- a/colour/utilities/tests/test_documentation.py +++ b/colour/utilities/tests/test_documentation.py @@ -53,7 +53,7 @@ def test_is_documentation_building(self): del os.environ['COLOUR_SCIENCE_DOCUMENTATION_BUILD'] self.assertFalse(is_documentation_building()) - finally: + finally: # pragma: no cover if os.environ.get('READTHEDOCS'): del os.environ['READTHEDOCS'] diff --git a/colour/utilities/tests/test_verbose.py b/colour/utilities/tests/test_verbose.py new file mode 100644 index 0000000000..f63416f5cd --- /dev/null +++ b/colour/utilities/tests/test_verbose.py @@ -0,0 +1,100 @@ +# -*- coding: utf-8 -*- +""" +Defines unit tests for :mod:`colour.utilities.verbose` module. +""" + +from __future__ import division, unicode_literals + +import os +import sys +import unittest + +from colour.utilities import (show_warning, suppress_warnings, + describe_environment) +from colour.utilities import warning + +__author__ = 'Colour Developers' +__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = [ + 'TestShowWarning', 'TestSuppressWarnings', 'TestDescribeEnvironment' +] + + +class TestShowWarning(unittest.TestCase): + """ + Defines :func:`colour.utilities.verbose.show_warning` definition unit tests + methods. + """ + + def test_show_warning(self): + """ + Tests :func:`colour.utilities.verbose.show_warning` definition. + """ + + show_warning('This is a unit test warning!', Warning, None, None) + + with open(os.devnull) as dev_null: + show_warning('This is a unit test warning!', Warning, None, None, + dev_null) + + stderr = sys.stderr + try: + sys.stderr = None + show_warning('This is a unit test warning!', Warning, None, None) + finally: + sys.stderr = stderr + + +class TestSuppressWarnings(unittest.TestCase): + """ + Defines :func:`colour.utilities.verbose.suppress_warnings` definition unit + tests methods. + """ + + def test_suppress_warnings(self): + """ + Tests :func:`colour.utilities.verbose.suppress_warnings` definition. + """ + + with suppress_warnings(): + warning('This is a suppressed unit test warning!') + + +class TestDescribeEnvironment(unittest.TestCase): + """ + Defines :func:`colour.utilities.verbose.describe_environment` definition + unit tests methods. + """ + + def test_describe_environment(self): + """ + Tests :func:`colour.utilities.verbose.describe_environment` definition. + """ + + environment = describe_environment() + self.assertIsInstance(environment, dict) + self.assertListEqual( + sorted(environment.keys()), + ['Interpreter', 'Runtime', 'colour-science.org']) + + environment = describe_environment(development_packages=True) + self.assertListEqual( + sorted(environment.keys()), + ['Development', 'Interpreter', 'Runtime', 'colour-science.org']) + + environment = describe_environment( + development_packages=True, extras_packages=True) + self.assertListEqual( + sorted(environment.keys()), [ + 'Development', 'Extras', 'Interpreter', 'Runtime', + 'colour-science.org' + ]) + + +if __name__ == '__main__': + unittest.main() diff --git a/colour/utilities/verbose.py b/colour/utilities/verbose.py index ce0af04cab..43c18a2f82 100644 --- a/colour/utilities/verbose.py +++ b/colour/utilities/verbose.py @@ -32,7 +32,7 @@ 'usage_warning', 'filter_warnings', 'suppress_warnings', 'numpy_print_options', 'ANCILLARY_COLOUR_SCIENCE_PACKAGES', 'ANCILLARY_RUNTIME_PACKAGES', 'ANCILLARY_DEVELOPMENT_PACKAGES', - 'describe_environment' + 'ANCILLARY_EXTRAS_PACKAGES', 'describe_environment' ] @@ -144,11 +144,15 @@ def show_warning(message, line, file_=None, code=None, - frame_range=(1, 2)): + frame_range=(1, None)): """ - Replaces :func:`warnings.showwarning` definition to allow traceback + Alternative :func:`warnings.showwarning` definition that allows traceback printing. + This definition is expected to be used by setting the + *COLOUR_SCIENCE__COLOUR__SHOW_WARNINGS_WITH_TRACEBACK* environment variable + prior to importing *colour*. + Parameters ---------- message : unicode @@ -166,6 +170,14 @@ def show_warning(message, Source code to be included in the warning message. frame_range : array_like, optional Traceback frame range, i.e first frame and numbers of frame above it. + + Notes + ----- + - Setting the *COLOUR_SCIENCE__COLOUR__SHOW_WARNINGS_WITH_TRACEBACK* + environment variable will result in the :func:`warnings.showwarning` + definition to be replaced with the + :func:`colour.utilities.show_warning` definition and thus providing + complete traceback from the point where the warning occurred. """ if file_ is None: @@ -192,7 +204,9 @@ def show_warning(message, pass -warnings.showwarning = show_warning +if os.environ.get( # pragma: no cover + 'COLOUR_SCIENCE__COLOUR__SHOW_WARNINGS_WITH_TRACEBACK'): + warnings.showwarning = show_warning def warning(*args, **kwargs): @@ -433,9 +447,17 @@ def numpy_print_options(*args, **kwargs): ANCILLARY_DEVELOPMENT_PACKAGES : OrderedDict """ +ANCILLARY_EXTRAS_PACKAGES = OrderedDict() +""" +Ancillary extras packages to describe. + +ANCILLARY_EXTRAS_PACKAGES : OrderedDict +""" + def describe_environment(runtime_packages=True, development_packages=False, + extras_packages=False, print_environment=True, **kwargs): """ @@ -448,6 +470,8 @@ def describe_environment(runtime_packages=True, Whether to return the runtime packages versions. development_packages : bool, optional Whether to return the development packages versions. + extras_packages : bool, optional + Whether to return the extras packages versions. print_environment : bool, optional Whether to print the environment. @@ -474,56 +498,66 @@ def describe_environment(runtime_packages=True, =========================================================================== * * * Interpreter : * - * python : 2.7.14 | packaged by conda-forge | (default, Dec 25 * - * 2017, 01:18:54) * - * [GCC 4.2.1 Compatible Apple LLVM 6.1.0 * - * (clang-602.0.53)] * + * python : 3.7.4 (default, Sep 7 2019, 18:27:02) * + * [Clang 10.0.1 (clang-1001.0.46.4)] * * * * colour-science.org : * - * colour : v0.3.11-323-g380c1838 * + * colour : v0.3.13-293-gecf1dc8a * * * * Runtime : * - * numpy : 1.14.3 * - * scipy : 1.0.0 * - * pandas : 0.22.0 * - * matplotlib : 2.2.2 * - * notebook : 5.4.0 * - * ipywidgets : 7.2.1 * + * imageio : 2.6.1 * + * numpy : 1.17.2 * + * scipy : 1.3.1 * + * six : 1.12.0 * + * pandas : 0.24.2 * + * matplotlib : 3.0.3 * + * networkx : 2.3 * + * pygraphviz : 1.5 * * * =========================================================================== - >>> environment = describe_environment(True, True, width=75) + >>> environment = describe_environment(True, True, True, width=75) ... # doctest: +SKIP =========================================================================== * * * Interpreter : * - * python : 2.7.14 | packaged by conda-forge | (default, Dec 25 * - * 2017, 01:18:54) * - * [GCC 4.2.1 Compatible Apple LLVM 6.1.0 * - * (clang-602.0.53)] * + * python : 3.7.4 (default, Sep 7 2019, 18:27:02) * + * [Clang 10.0.1 (clang-1001.0.46.4)] * * * * colour-science.org : * - * colour : v0.3.11-323-g380c1838 * + * colour : v0.3.13-293-gecf1dc8a * * * * Runtime : * - * numpy : 1.14.3 * - * scipy : 1.0.0 * - * pandas : 0.22.0 * - * matplotlib : 2.2.2 * - * notebook : 5.4.0 * - * ipywidgets : 7.2.1 * + * imageio : 2.6.1 * + * numpy : 1.17.2 * + * scipy : 1.3.1 * + * six : 1.12.0 * + * pandas : 0.24.2 * + * matplotlib : 3.0.3 * + * networkx : 2.3 * + * pygraphviz : 1.5 * * * * Development : * - * coverage : 4.5.1 * - * flake8 : 3.5.0 * - * invoke : 0.22.1 * - * mock : 2.0.0 * + * biblib-simple : 0.1.1 * + * coverage : 4.5.4 * + * coveralls : 1.8.2 * + * flake8 : 3.7.8 * + * invoke : 1.3.0 * + * jupyter : 1.0.0 * + * mock : 3.0.5 * * nose : 1.3.7 * - * restructuredtext_lint : 1.1.3 * - * six : 1.11.0 * - * sphinx : 1.7.5 * - * sphinx_rtd_theme : 0.2.4 * - * twine : 1.10.0 * - * yapf : 0.20.2 * + * pre-commit : 1.18.3 * + * pytest : 5.2.1 * + * restructuredtext-lint : 1.3.0 * + * sphinx : 2.2.0 * + * sphinx_rtd_theme : 0.4.3 * + * sphinxcontrib-bibtex : 1.0.0 * + * toml : 0.10.0 * + * twine : 1.15.0 * + * yapf : 0.23.0 * + * * + * Extras : * + * ipywidgets : 7.5.1 * + * notebook : 6.0.1 * * * =========================================================================== """ @@ -536,19 +570,28 @@ def describe_environment(runtime_packages=True, import colour - try: + # TODO: Implement support for "pyproject.toml" file whenever "TOML" is + # supported in the standard library. + + # NOTE: A few clauses are not reached and a few packages are not available + # during continuous integration and are thus ignored for coverage. + try: # pragma: no cover version = subprocess.check_output( # nosec - ['git', 'describe'], cwd=colour.__path__[0]).strip() + ['git', 'describe'], + cwd=colour.__path__[0], + stderr=subprocess.STDOUT).strip() version = version.decode('utf-8') - except Exception: + except Exception: # pragma: no cover version = colour.__version__ environment['colour-science.org']['colour'] = version environment['colour-science.org'].update(ANCILLARY_COLOUR_SCIENCE_PACKAGES) if runtime_packages: - for package in ('numpy', 'scipy', 'pandas', 'matplotlib', 'notebook', - 'ipywidgets'): + for package in [ + 'imageio', 'matplotlib', 'networkx', 'numpy', 'pandas', + 'pygraphviz', 'scipy', 'six' + ]: try: namespace = __import__(package) environment['Runtime'][package] = namespace.__version__ @@ -556,47 +599,74 @@ def describe_environment(runtime_packages=True, continue # OpenImageIO - try: + try: # pragma: no cover namespace = __import__('OpenImageIO') environment['Runtime']['OpenImageIO'] = namespace.VERSION_STRING - except ImportError: + except ImportError: # pragma: no cover pass environment['Runtime'].update(ANCILLARY_RUNTIME_PACKAGES) + def _get_package_version(package, mapping): + """ + Returns given package version. + """ + + namespace = __import__(package) + + if package in mapping: + import pkg_resources + + distributions = [ + distribution for distribution in pkg_resources.working_set + ] + + for distribution in distributions: + if distribution.project_name == mapping[package]: + return distribution.version + + return namespace.__version__ + if development_packages: - for package in ('coverage', 'flake8', 'invoke', 'mock', 'nose', - 'restructuredtext_lint', 'six', 'sphinx', - 'sphinxcontrib.bibtex', 'sphinx_rtd_theme', 'twine', - 'yapf'): + mapping = { + 'biblib.bib': 'biblib-simple', + 'pre_commit': 'pre-commit', + 'restructuredtext_lint': 'restructuredtext-lint', + 'sphinxcontrib.bibtex': 'sphinxcontrib-bibtex' + } + for package in [ + 'biblib.bib', 'coverage', 'coveralls', 'flake8', 'invoke', + 'jupyter', 'mock', 'nose', 'pre_commit', 'pytest', + 'restructuredtext_lint', 'sphinx', 'sphinx_rtd_theme', + 'sphinxcontrib.bibtex', 'toml', 'twine', 'yapf' + ]: try: - namespace = __import__(package) - if package == 'restructuredtext_lint': - with open( - os.path.join( - os.path.dirname(namespace.__file__), - 'VERSION'), 'r') as version_file: - version = version_file.read().strip() - elif package == 'sphinxcontrib.bibtex': - import pip - - for distribution in pip.get_installed_distributions(): - if distribution.name == package: - version = distribution.version - break - else: - version = namespace.__version__ + version = _get_package_version(package, mapping) + package = mapping.get(package, package) environment['Development'][package] = version - except (AttributeError, ImportError): + except Exception: continue environment['Development'].update(ANCILLARY_DEVELOPMENT_PACKAGES) + if extras_packages: + mapping = {} + for package in ['ipywidgets', 'notebook']: + try: + version = _get_package_version(package, mapping) + package = mapping.get(package, package) + + environment['Extras'][package] = version + except Exception: + continue + + environment['Extras'].update(ANCILLARY_EXTRAS_PACKAGES) + if print_environment: message = str() for category in ('Interpreter', 'colour-science.org', 'Runtime', - 'Development'): + 'Development', 'Extras'): elements = environment.get(category) if not elements: continue diff --git a/colour/volume/__init__.py b/colour/volume/__init__.py index f2aad05bde..e0111912e3 100644 --- a/colour/volume/__init__.py +++ b/colour/volume/__init__.py @@ -2,8 +2,8 @@ from __future__ import absolute_import -from .dataset import * # noqa -from . import dataset +from .datasets import * # noqa +from . import datasets from .macadam_limits import is_within_macadam_limits from .mesh import is_within_mesh_volume from .pointer_gamut import is_within_pointer_gamut @@ -15,7 +15,7 @@ RGB_colourspace_visible_spectrum_coverage_MonteCarlo) __all__ = [] -__all__ += dataset.__all__ +__all__ += datasets.__all__ __all__ += ['is_within_macadam_limits'] __all__ += ['is_within_mesh_volume'] __all__ += ['is_within_pointer_gamut'] diff --git a/colour/volume/dataset/__init__.py b/colour/volume/datasets/__init__.py similarity index 100% rename from colour/volume/dataset/__init__.py rename to colour/volume/datasets/__init__.py diff --git a/colour/volume/dataset/optimal_colour_stimuli.py b/colour/volume/datasets/optimal_colour_stimuli.py similarity index 100% rename from colour/volume/dataset/optimal_colour_stimuli.py rename to colour/volume/datasets/optimal_colour_stimuli.py diff --git a/colour/volume/rgb.py b/colour/volume/rgb.py index adc2ee0385..1ad9d1b3bd 100644 --- a/colour/volume/rgb.py +++ b/colour/volume/rgb.py @@ -77,8 +77,8 @@ def sample_RGB_colourspace_volume_MonteCarlo( random_generator=random_triplet_generator, random_state=None): """ - Randomly samples the *Lab* colourspace volume and returns the ratio of - samples within the given *RGB* colourspace volume. + Randomly samples the *CIE L\\*a\\*b\\** colourspace volume and returns the + ratio of samples within the given *RGB* colourspace volume. Parameters ---------- @@ -87,17 +87,17 @@ def sample_RGB_colourspace_volume_MonteCarlo( samples : numeric, optional Samples count. limits : array_like, optional - *Lab* colourspace volume. + *CIE L\\*a\\*b\\** colourspace volume. illuminant_Lab : array_like, optional - *Lab* colourspace *illuminant* chromaticity coordinates. + *CIE L\\*a\\*b\\** colourspace *illuminant* chromaticity coordinates. chromatic_adaptation_method : unicode, optional **{'CAT02', 'XYZ Scaling', 'Von Kries', 'Bradford', 'Sharp', 'Fairchild', 'CMCCAT97', 'CMCCAT2000', 'CAT02_BRILL_CAT', 'Bianco', 'Bianco PC'}**, *Chromatic adaptation* method. random_generator : generator, optional - Random triplet generator providing the random samples within the *Lab* - colourspace volume. + Random triplet generator providing the random samples within the + *CIE L\\*a\\*b\\** colourspace volume. random_state : RandomState, optional Mersenne Twister pseudo-random number generator to use in the random number generator. @@ -147,14 +147,15 @@ def RGB_colourspace_limits( colourspace, illuminant=ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D65']): """ - Computes given *RGB* colourspace volume limits in *Lab* colourspace. + Computes given *RGB* colourspace volume limits in *CIE L\\*a\\*b\\** + colourspace. Parameters ---------- colourspace : RGB_Colourspace *RGB* colourspace to compute the volume of. illuminant : array_like, optional - *Lab* colourspace *illuminant* chromaticity coordinates. + *CIE L\\*a\\*b\\** colourspace *illuminant* chromaticity coordinates. Returns ------- @@ -205,17 +206,17 @@ def RGB_colourspace_volume_MonteCarlo( samples : numeric, optional Samples count. limits : array_like, optional - *Lab* colourspace volume. + *CIE L\\*a\\*b\\** colourspace volume. illuminant_Lab : array_like, optional - *Lab* colourspace *illuminant* chromaticity coordinates. + *CIE L\\*a\\*b\\** colourspace *illuminant* chromaticity coordinates. chromatic_adaptation_method : unicode, optional **{'CAT02', 'XYZ Scaling', 'Von Kries', 'Bradford', 'Sharp', 'Fairchild', 'CMCCAT97', 'CMCCAT2000', 'CAT02_BRILL_CAT', 'Bianco', 'Bianco PC'}**, *Chromatic adaptation* method. random_generator : generator, optional - Random triplet generator providing the random samples within the *Lab* - colourspace volume. + Random triplet generator providing the random samples within the + *CIE L\\*a\\*b\\** colourspace volume. random_state : RandomState, optional Mersenne Twister pseudo-random number generator to use in the random number generator. diff --git a/colour/volume/spectrum.py b/colour/volume/spectrum.py index 6eac1fd918..6ea1aa5a07 100644 --- a/colour/volume/spectrum.py +++ b/colour/volume/spectrum.py @@ -206,8 +206,8 @@ def XYZ_outer_surface( values.append( NearestNeighbourInterpolator(wavelengths, wave)(domain)) - XYZ = multi_sds_to_XYZ_integration(values, DEFAULT_SPECTRAL_SHAPE, - cmfs, illuminant) + XYZ = multi_sds_to_XYZ_integration( + values, cmfs, illuminant, shape=DEFAULT_SPECTRAL_SHAPE) XYZ = XYZ / np.max(XYZ[-1, 1]) diff --git a/colour/volume/tests/test_macadam_limits.py b/colour/volume/tests/test_macadam_limits.py index 3268e57120..2c678261f3 100644 --- a/colour/volume/tests/test_macadam_limits.py +++ b/colour/volume/tests/test_macadam_limits.py @@ -63,6 +63,15 @@ def test_n_dimensional_is_within_macadam_limits(self): b = np.reshape(b, (2, 3)) np.testing.assert_almost_equal(is_within_macadam_limits(a, 'A'), b) + def test_raise_exception_is_within_macadam_limits(self): + """ + Tests :func:`colour.volume.macadam_limits.is_within_macadam_limits` + definition raised exception. + """ + + self.assertRaises(KeyError, is_within_macadam_limits, + np.array([0.3205, 0.4131, 0.5100]), 'B') + @ignore_numpy_errors def test_nan_is_within_macadam_limits(self): """ diff --git a/docs/_static/Basics_Logo_Small_001_CIE_XYZ.png b/docs/_static/Basics_Logo_Small_001_CIE_XYZ.png deleted file mode 100644 index bb84088f89..0000000000 Binary files a/docs/_static/Basics_Logo_Small_001_CIE_XYZ.png and /dev/null differ diff --git a/docs/_static/Examples_Plotting_BabelColor_Average.png b/docs/_static/Examples_Plotting_BabelColor_Average.png deleted file mode 100644 index 0e77006b8c..0000000000 Binary files a/docs/_static/Examples_Plotting_BabelColor_Average.png and /dev/null differ diff --git a/docs/_static/Examples_Plotting_Blackbodies.png b/docs/_static/Examples_Plotting_Blackbodies.png deleted file mode 100644 index 48d377eb16..0000000000 Binary files a/docs/_static/Examples_Plotting_Blackbodies.png and /dev/null differ diff --git a/docs/_static/Examples_Plotting_CCT_CIE_1960_UCS_Chromaticity_Diagram.png b/docs/_static/Examples_Plotting_CCT_CIE_1960_UCS_Chromaticity_Diagram.png deleted file mode 100644 index ef9da72bc0..0000000000 Binary files a/docs/_static/Examples_Plotting_CCT_CIE_1960_UCS_Chromaticity_Diagram.png and /dev/null differ diff --git a/docs/_static/Examples_Plotting_CRI.png b/docs/_static/Examples_Plotting_CRI.png deleted file mode 100644 index 66b3704839..0000000000 Binary files a/docs/_static/Examples_Plotting_CRI.png and /dev/null differ diff --git a/docs/_static/Examples_Plotting_Chromaticities_CIE_1931_Chromaticity_Diagram.png b/docs/_static/Examples_Plotting_Chromaticities_CIE_1931_Chromaticity_Diagram.png deleted file mode 100644 index c1a1a616ca..0000000000 Binary files a/docs/_static/Examples_Plotting_Chromaticities_CIE_1931_Chromaticity_Diagram.png and /dev/null differ diff --git a/docs/_static/Examples_Plotting_Chromaticities_Prediction.png b/docs/_static/Examples_Plotting_Chromaticities_Prediction.png deleted file mode 100644 index 1337793727..0000000000 Binary files a/docs/_static/Examples_Plotting_Chromaticities_Prediction.png and /dev/null differ diff --git a/docs/_static/Examples_Plotting_ColorChecker_2005.png b/docs/_static/Examples_Plotting_ColorChecker_2005.png deleted file mode 100644 index 04446f4a45..0000000000 Binary files a/docs/_static/Examples_Plotting_ColorChecker_2005.png and /dev/null differ diff --git a/docs/_static/Examples_Plotting_Cone_Fundamentals.png b/docs/_static/Examples_Plotting_Cone_Fundamentals.png deleted file mode 100644 index d02b9ad61c..0000000000 Binary files a/docs/_static/Examples_Plotting_Cone_Fundamentals.png and /dev/null differ diff --git a/docs/_static/Examples_Plotting_Illuminant_F1_SD.png b/docs/_static/Examples_Plotting_Illuminant_F1_SD.png deleted file mode 100644 index c8bda50da0..0000000000 Binary files a/docs/_static/Examples_Plotting_Illuminant_F1_SD.png and /dev/null differ diff --git a/docs/_static/Examples_Plotting_Luminous_Efficiency.png b/docs/_static/Examples_Plotting_Luminous_Efficiency.png deleted file mode 100644 index 5c3ca0c30e..0000000000 Binary files a/docs/_static/Examples_Plotting_Luminous_Efficiency.png and /dev/null differ diff --git a/docs/_static/Examples_Plotting_Visible_Spectrum.png b/docs/_static/Examples_Plotting_Visible_Spectrum.png deleted file mode 100644 index f92f11d192..0000000000 Binary files a/docs/_static/Examples_Plotting_Visible_Spectrum.png and /dev/null differ diff --git a/docs/_static/Logo_Medium_001.png b/docs/_static/Logo_Medium_001.png index 40cd1da08d..17acc66039 100644 Binary files a/docs/_static/Logo_Medium_001.png and b/docs/_static/Logo_Medium_001.png differ diff --git a/docs/_static/Logo_Small_001.png b/docs/_static/Logo_Small_001.png index 50fae32053..d5231d3610 100644 Binary files a/docs/_static/Logo_Small_001.png and b/docs/_static/Logo_Small_001.png differ diff --git a/docs/_static/Plotting_Plot_Blackbody_Colours.png b/docs/_static/Plotting_Plot_Blackbody_Colours.png deleted file mode 100644 index 3726f3f391..0000000000 Binary files a/docs/_static/Plotting_Plot_Blackbody_Colours.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Blackbody_Spectral_Radiance.png b/docs/_static/Plotting_Plot_Blackbody_Spectral_Radiance.png deleted file mode 100644 index d0ba0c1803..0000000000 Binary files a/docs/_static/Plotting_Plot_Blackbody_Spectral_Radiance.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_CVD_Simulation_Machado2009.png b/docs/_static/Plotting_Plot_CVD_Simulation_Machado2009.png deleted file mode 100644 index a048fee3d0..0000000000 Binary files a/docs/_static/Plotting_Plot_CVD_Simulation_Machado2009.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Chromaticity_Diagram.png b/docs/_static/Plotting_Plot_Chromaticity_Diagram.png deleted file mode 100644 index 84b359a123..0000000000 Binary files a/docs/_static/Plotting_Plot_Chromaticity_Diagram.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Chromaticity_Diagram_CIE1931.png b/docs/_static/Plotting_Plot_Chromaticity_Diagram_CIE1931.png deleted file mode 100644 index 84b359a123..0000000000 Binary files a/docs/_static/Plotting_Plot_Chromaticity_Diagram_CIE1931.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Chromaticity_Diagram_CIE1960UCS.png b/docs/_static/Plotting_Plot_Chromaticity_Diagram_CIE1960UCS.png deleted file mode 100644 index fcf3953221..0000000000 Binary files a/docs/_static/Plotting_Plot_Chromaticity_Diagram_CIE1960UCS.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Chromaticity_Diagram_CIE1976UCS.png b/docs/_static/Plotting_Plot_Chromaticity_Diagram_CIE1976UCS.png deleted file mode 100644 index aa1b449222..0000000000 Binary files a/docs/_static/Plotting_Plot_Chromaticity_Diagram_CIE1976UCS.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Chromaticity_Diagram_Colours.png b/docs/_static/Plotting_Plot_Chromaticity_Diagram_Colours.png deleted file mode 100644 index 90e437a611..0000000000 Binary files a/docs/_static/Plotting_Plot_Chromaticity_Diagram_Colours.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Colour_Quality_Bars.png b/docs/_static/Plotting_Plot_Colour_Quality_Bars.png deleted file mode 100644 index 3cd866e679..0000000000 Binary files a/docs/_static/Plotting_Plot_Colour_Quality_Bars.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Corresponding_Chromaticities_Prediction.png b/docs/_static/Plotting_Plot_Corresponding_Chromaticities_Prediction.png deleted file mode 100644 index 106e5e3870..0000000000 Binary files a/docs/_static/Plotting_Plot_Corresponding_Chromaticities_Prediction.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Ellipses_MacAdam1942_In_Chromaticity_Diagram.png b/docs/_static/Plotting_Plot_Ellipses_MacAdam1942_In_Chromaticity_Diagram.png deleted file mode 100644 index 4563497593..0000000000 Binary files a/docs/_static/Plotting_Plot_Ellipses_MacAdam1942_In_Chromaticity_Diagram.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Ellipses_MacAdam1942_In_Chromaticity_Diagram_CIE1931.png b/docs/_static/Plotting_Plot_Ellipses_MacAdam1942_In_Chromaticity_Diagram_CIE1931.png deleted file mode 100644 index 4563497593..0000000000 Binary files a/docs/_static/Plotting_Plot_Ellipses_MacAdam1942_In_Chromaticity_Diagram_CIE1931.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Ellipses_MacAdam1942_In_Chromaticity_Diagram_CIE1960UCS.png b/docs/_static/Plotting_Plot_Ellipses_MacAdam1942_In_Chromaticity_Diagram_CIE1960UCS.png deleted file mode 100644 index 67d240437b..0000000000 Binary files a/docs/_static/Plotting_Plot_Ellipses_MacAdam1942_In_Chromaticity_Diagram_CIE1960UCS.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Ellipses_MacAdam1942_In_Chromaticity_Diagram_CIE1976UCS.png b/docs/_static/Plotting_Plot_Ellipses_MacAdam1942_In_Chromaticity_Diagram_CIE1976UCS.png deleted file mode 100644 index 245cd69b16..0000000000 Binary files a/docs/_static/Plotting_Plot_Ellipses_MacAdam1942_In_Chromaticity_Diagram_CIE1976UCS.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Image.png b/docs/_static/Plotting_Plot_Image.png deleted file mode 100644 index 6cdc33d536..0000000000 Binary files a/docs/_static/Plotting_Plot_Image.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Multi_CCTFs.png b/docs/_static/Plotting_Plot_Multi_CCTFs.png deleted file mode 100644 index 42c16e5b4c..0000000000 Binary files a/docs/_static/Plotting_Plot_Multi_CCTFs.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Multi_CMFS.png b/docs/_static/Plotting_Plot_Multi_CMFS.png deleted file mode 100644 index ebbd8351ba..0000000000 Binary files a/docs/_static/Plotting_Plot_Multi_CMFS.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Multi_Colour_Checkers.png b/docs/_static/Plotting_Plot_Multi_Colour_Checkers.png deleted file mode 100644 index 3654737bb7..0000000000 Binary files a/docs/_static/Plotting_Plot_Multi_Colour_Checkers.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Multi_Colour_Swatches.png b/docs/_static/Plotting_Plot_Multi_Colour_Swatches.png deleted file mode 100644 index fb7103dd18..0000000000 Binary files a/docs/_static/Plotting_Plot_Multi_Colour_Swatches.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Multi_Functions.png b/docs/_static/Plotting_Plot_Multi_Functions.png deleted file mode 100644 index 043fa4cdb7..0000000000 Binary files a/docs/_static/Plotting_Plot_Multi_Functions.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Multi_Illuminant_SDs.png b/docs/_static/Plotting_Plot_Multi_Illuminant_SDs.png deleted file mode 100644 index 4dca1f2ec2..0000000000 Binary files a/docs/_static/Plotting_Plot_Multi_Illuminant_SDs.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Multi_Lightness_Functions.png b/docs/_static/Plotting_Plot_Multi_Lightness_Functions.png deleted file mode 100644 index dbd9a8f2a3..0000000000 Binary files a/docs/_static/Plotting_Plot_Multi_Lightness_Functions.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Multi_Luminance_Functions.png b/docs/_static/Plotting_Plot_Multi_Luminance_Functions.png deleted file mode 100644 index 039ca592b8..0000000000 Binary files a/docs/_static/Plotting_Plot_Multi_Luminance_Functions.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Multi_Munsell_Value_Functions.png b/docs/_static/Plotting_Plot_Multi_Munsell_Value_Functions.png deleted file mode 100644 index acb4fdafaf..0000000000 Binary files a/docs/_static/Plotting_Plot_Multi_Munsell_Value_Functions.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Multi_SDs.png b/docs/_static/Plotting_Plot_Multi_SDs.png deleted file mode 100644 index f776a85b48..0000000000 Binary files a/docs/_static/Plotting_Plot_Multi_SDs.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Multi_SDs_Colour_Quality_Scales_Bars.png b/docs/_static/Plotting_Plot_Multi_SDs_Colour_Quality_Scales_Bars.png deleted file mode 100644 index d836a4834a..0000000000 Binary files a/docs/_static/Plotting_Plot_Multi_SDs_Colour_Quality_Scales_Bars.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Multi_SDs_Colour_Rendering_Indexes_Bars.png b/docs/_static/Plotting_Plot_Multi_SDs_Colour_Rendering_Indexes_Bars.png deleted file mode 100644 index 47c4267ae1..0000000000 Binary files a/docs/_static/Plotting_Plot_Multi_SDs_Colour_Rendering_Indexes_Bars.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Planckian_Locus.png b/docs/_static/Plotting_Plot_Planckian_Locus.png deleted file mode 100644 index 8df22b69f8..0000000000 Binary files a/docs/_static/Plotting_Plot_Planckian_Locus.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Planckian_Locus_In_Chromaticity_Diagram.png b/docs/_static/Plotting_Plot_Planckian_Locus_In_Chromaticity_Diagram.png deleted file mode 100644 index aab0c20d9a..0000000000 Binary files a/docs/_static/Plotting_Plot_Planckian_Locus_In_Chromaticity_Diagram.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Planckian_Locus_In_Chromaticity_Diagram_CIE1931.png b/docs/_static/Plotting_Plot_Planckian_Locus_In_Chromaticity_Diagram_CIE1931.png deleted file mode 100644 index aab0c20d9a..0000000000 Binary files a/docs/_static/Plotting_Plot_Planckian_Locus_In_Chromaticity_Diagram_CIE1931.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Planckian_Locus_In_Chromaticity_Diagram_CIE1960UCS.png b/docs/_static/Plotting_Plot_Planckian_Locus_In_Chromaticity_Diagram_CIE1960UCS.png deleted file mode 100644 index ef9da72bc0..0000000000 Binary files a/docs/_static/Plotting_Plot_Planckian_Locus_In_Chromaticity_Diagram_CIE1960UCS.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Pointer_Gamut.png b/docs/_static/Plotting_Plot_Pointer_Gamut.png deleted file mode 100644 index d29c685c9d..0000000000 Binary files a/docs/_static/Plotting_Plot_Pointer_Gamut.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_RGB_Chromaticities_In_Chromaticity_Diagram.png b/docs/_static/Plotting_Plot_RGB_Chromaticities_In_Chromaticity_Diagram.png deleted file mode 100644 index 1f91185dda..0000000000 Binary files a/docs/_static/Plotting_Plot_RGB_Chromaticities_In_Chromaticity_Diagram.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_RGB_Chromaticities_In_Chromaticity_Diagram_CIE1931.png b/docs/_static/Plotting_Plot_RGB_Chromaticities_In_Chromaticity_Diagram_CIE1931.png deleted file mode 100644 index f85494dfcb..0000000000 Binary files a/docs/_static/Plotting_Plot_RGB_Chromaticities_In_Chromaticity_Diagram_CIE1931.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_RGB_Chromaticities_In_Chromaticity_Diagram_CIE1960UCS.png b/docs/_static/Plotting_Plot_RGB_Chromaticities_In_Chromaticity_Diagram_CIE1960UCS.png deleted file mode 100644 index 2dcef5b20b..0000000000 Binary files a/docs/_static/Plotting_Plot_RGB_Chromaticities_In_Chromaticity_Diagram_CIE1960UCS.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_RGB_Chromaticities_In_Chromaticity_Diagram_CIE1976UCS.png b/docs/_static/Plotting_Plot_RGB_Chromaticities_In_Chromaticity_Diagram_CIE1976UCS.png deleted file mode 100644 index 1f4e8677df..0000000000 Binary files a/docs/_static/Plotting_Plot_RGB_Chromaticities_In_Chromaticity_Diagram_CIE1976UCS.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_RGB_Chromaticities_In_Chromaticity_Diagram_Plot.png b/docs/_static/Plotting_Plot_RGB_Chromaticities_In_Chromaticity_Diagram_Plot.png deleted file mode 100644 index f85494dfcb..0000000000 Binary files a/docs/_static/Plotting_Plot_RGB_Chromaticities_In_Chromaticity_Diagram_Plot.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_RGB_Colourspaces_Gamuts.png b/docs/_static/Plotting_Plot_RGB_Colourspaces_Gamuts.png deleted file mode 100644 index 6a24989d7d..0000000000 Binary files a/docs/_static/Plotting_Plot_RGB_Colourspaces_Gamuts.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_RGB_Colourspaces_In_Chromaticity_Diagram.png b/docs/_static/Plotting_Plot_RGB_Colourspaces_In_Chromaticity_Diagram.png deleted file mode 100644 index 793c494e50..0000000000 Binary files a/docs/_static/Plotting_Plot_RGB_Colourspaces_In_Chromaticity_Diagram.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_RGB_Colourspaces_In_Chromaticity_Diagram_CIE1931.png b/docs/_static/Plotting_Plot_RGB_Colourspaces_In_Chromaticity_Diagram_CIE1931.png deleted file mode 100644 index 793c494e50..0000000000 Binary files a/docs/_static/Plotting_Plot_RGB_Colourspaces_In_Chromaticity_Diagram_CIE1931.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_RGB_Colourspaces_In_Chromaticity_Diagram_CIE1960UCS.png b/docs/_static/Plotting_Plot_RGB_Colourspaces_In_Chromaticity_Diagram_CIE1960UCS.png deleted file mode 100644 index 1e6293ca8d..0000000000 Binary files a/docs/_static/Plotting_Plot_RGB_Colourspaces_In_Chromaticity_Diagram_CIE1960UCS.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_RGB_Colourspaces_In_Chromaticity_Diagram_CIE1976UCS.png b/docs/_static/Plotting_Plot_RGB_Colourspaces_In_Chromaticity_Diagram_CIE1976UCS.png deleted file mode 100644 index 1bbaa15249..0000000000 Binary files a/docs/_static/Plotting_Plot_RGB_Colourspaces_In_Chromaticity_Diagram_CIE1976UCS.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_RGB_Scatter.png b/docs/_static/Plotting_Plot_RGB_Scatter.png deleted file mode 100644 index 90195a3e01..0000000000 Binary files a/docs/_static/Plotting_Plot_RGB_Scatter.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_SDs_In_Chromaticity_Diagram.png b/docs/_static/Plotting_Plot_SDs_In_Chromaticity_Diagram.png deleted file mode 100644 index bb654ca5bb..0000000000 Binary files a/docs/_static/Plotting_Plot_SDs_In_Chromaticity_Diagram.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_SDs_In_Chromaticity_Diagram_CIE1931.png b/docs/_static/Plotting_Plot_SDs_In_Chromaticity_Diagram_CIE1931.png deleted file mode 100644 index bb654ca5bb..0000000000 Binary files a/docs/_static/Plotting_Plot_SDs_In_Chromaticity_Diagram_CIE1931.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_SDs_In_Chromaticity_Diagram_CIE1960UCS.png b/docs/_static/Plotting_Plot_SDs_In_Chromaticity_Diagram_CIE1960UCS.png deleted file mode 100644 index a928a8ea33..0000000000 Binary files a/docs/_static/Plotting_Plot_SDs_In_Chromaticity_Diagram_CIE1960UCS.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_SDs_In_Chromaticity_Diagram_CIE1976UCS.png b/docs/_static/Plotting_Plot_SDs_In_Chromaticity_Diagram_CIE1976UCS.png deleted file mode 100644 index 303d68822a..0000000000 Binary files a/docs/_static/Plotting_Plot_SDs_In_Chromaticity_Diagram_CIE1976UCS.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Single_CCTF.png b/docs/_static/Plotting_Plot_Single_CCTF.png deleted file mode 100644 index bd7046f7c6..0000000000 Binary files a/docs/_static/Plotting_Plot_Single_CCTF.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Single_CMFS.png b/docs/_static/Plotting_Plot_Single_CMFS.png deleted file mode 100644 index 7bc6992e3a..0000000000 Binary files a/docs/_static/Plotting_Plot_Single_CMFS.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Single_Colour_Checker.png b/docs/_static/Plotting_Plot_Single_Colour_Checker.png deleted file mode 100644 index 0ca7659853..0000000000 Binary files a/docs/_static/Plotting_Plot_Single_Colour_Checker.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Single_Colour_Swatch.png b/docs/_static/Plotting_Plot_Single_Colour_Swatch.png deleted file mode 100644 index 1502232c64..0000000000 Binary files a/docs/_static/Plotting_Plot_Single_Colour_Swatch.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Single_Function.png b/docs/_static/Plotting_Plot_Single_Function.png deleted file mode 100644 index 9fb350abc7..0000000000 Binary files a/docs/_static/Plotting_Plot_Single_Function.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Single_Illuminant_SD.png b/docs/_static/Plotting_Plot_Single_Illuminant_SD.png deleted file mode 100644 index 061dde3ef5..0000000000 Binary files a/docs/_static/Plotting_Plot_Single_Illuminant_SD.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Single_Lightness_Function.png b/docs/_static/Plotting_Plot_Single_Lightness_Function.png deleted file mode 100644 index 51bc6b1c34..0000000000 Binary files a/docs/_static/Plotting_Plot_Single_Lightness_Function.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Single_Luminance_Function.png b/docs/_static/Plotting_Plot_Single_Luminance_Function.png deleted file mode 100644 index 355b7c7a9c..0000000000 Binary files a/docs/_static/Plotting_Plot_Single_Luminance_Function.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Single_Munsell_Value_Function.png b/docs/_static/Plotting_Plot_Single_Munsell_Value_Function.png deleted file mode 100644 index 726208979b..0000000000 Binary files a/docs/_static/Plotting_Plot_Single_Munsell_Value_Function.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Single_SD.png b/docs/_static/Plotting_Plot_Single_SD.png deleted file mode 100644 index f2f1e7dfb1..0000000000 Binary files a/docs/_static/Plotting_Plot_Single_SD.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Single_SD_Colour_Quality_Scale_Bars.png b/docs/_static/Plotting_Plot_Single_SD_Colour_Quality_Scale_Bars.png deleted file mode 100644 index 553de0053e..0000000000 Binary files a/docs/_static/Plotting_Plot_Single_SD_Colour_Quality_Scale_Bars.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Single_SD_Colour_Rendering_Index_Bars.png b/docs/_static/Plotting_Plot_Single_SD_Colour_Rendering_Index_Bars.png deleted file mode 100644 index 66b3704839..0000000000 Binary files a/docs/_static/Plotting_Plot_Single_SD_Colour_Rendering_Index_Bars.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Single_SD_Rayleigh_Scattering.png b/docs/_static/Plotting_Plot_Single_SD_Rayleigh_Scattering.png deleted file mode 100644 index 27c513a7f6..0000000000 Binary files a/docs/_static/Plotting_Plot_Single_SD_Rayleigh_Scattering.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Spectral_Locus.png b/docs/_static/Plotting_Plot_Spectral_Locus.png deleted file mode 100644 index 1efc191946..0000000000 Binary files a/docs/_static/Plotting_Plot_Spectral_Locus.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_The_Blue_Sky.png b/docs/_static/Plotting_Plot_The_Blue_Sky.png deleted file mode 100644 index cdbe683039..0000000000 Binary files a/docs/_static/Plotting_Plot_The_Blue_Sky.png and /dev/null differ diff --git a/docs/_static/Plotting_Plot_Visible_Spectrum.png b/docs/_static/Plotting_Plot_Visible_Spectrum.png deleted file mode 100644 index f92f11d192..0000000000 Binary files a/docs/_static/Plotting_Plot_Visible_Spectrum.png and /dev/null differ diff --git a/docs/_static/Tutorial_CIE_1931_Chromaticity_Diagram.png b/docs/_static/Tutorial_CIE_1931_Chromaticity_Diagram.png deleted file mode 100644 index 145cd2e591..0000000000 Binary files a/docs/_static/Tutorial_CIE_1931_Chromaticity_Diagram.png and /dev/null differ diff --git a/docs/_static/Tutorial_Colour_Checker.png b/docs/_static/Tutorial_Colour_Checker.png deleted file mode 100644 index 04446f4a45..0000000000 Binary files a/docs/_static/Tutorial_Colour_Checker.png and /dev/null differ diff --git a/docs/_static/Tutorial_Neutral5.png b/docs/_static/Tutorial_Neutral5.png deleted file mode 100644 index e58a74d486..0000000000 Binary files a/docs/_static/Tutorial_Neutral5.png and /dev/null differ diff --git a/docs/_static/Tutorial_SD_Interpolation.png b/docs/_static/Tutorial_SD_Interpolation.png deleted file mode 100644 index 05c9b3d97d..0000000000 Binary files a/docs/_static/Tutorial_SD_Interpolation.png and /dev/null differ diff --git a/docs/_static/Tutorial_Sample_SD.png b/docs/_static/Tutorial_Sample_SD.png deleted file mode 100644 index 54e9f17992..0000000000 Binary files a/docs/_static/Tutorial_Sample_SD.png and /dev/null differ diff --git a/docs/_static/Tutorial_Sample_Swatch.png b/docs/_static/Tutorial_Sample_Swatch.png deleted file mode 100644 index 0810e4c63f..0000000000 Binary files a/docs/_static/Tutorial_Sample_Swatch.png and /dev/null differ diff --git a/docs/_static/Tutorial_Visible_Spectrum.png b/docs/_static/Tutorial_Visible_Spectrum.png deleted file mode 100644 index f92f11d192..0000000000 Binary files a/docs/_static/Tutorial_Visible_Spectrum.png and /dev/null differ diff --git a/docs/advanced.rst b/docs/advanced.rst new file mode 100644 index 0000000000..eff1250523 --- /dev/null +++ b/docs/advanced.rst @@ -0,0 +1,71 @@ +Advanced +======== + +Environment +----------- + +Various environment variables can be used to modify **Colour** behaviour at +runtime: + +- `COLOUR_SCIENCE__COLOUR__SHOW_WARNINGS_WITH_TRACEBACK`: result in the + :func:`warnings.showwarning` definition to be replaced with the + :func:`colour.utilities.show_warning` definition and thus providing + complete traceback from the point where the warning occurred. + +Using Colour without Scipy +-------------------------- + +With the release of `Colour 0.3.8 `__, +`SciPy `__ became a requirement. + +**Scipy** is notoriously hard to compile, especially +`on Windows `__. +Some Digital Content Creation (DCC) applications are shipping Python interpreters +compiled with versions of +`Visual Studio `__ such as 2011 or 2015. +Those are incompatible with the Python Wheels commonly built with +`Visual Studio 2008 (Python 2.7) or Visual Studio 2017 (Python 3.6) `__. + +It is however possible to use **Colour** in a partially broken and mock **Scipy** +by using the `mock_for_colour.py `__ +module. + +Assuming it is available for import, a typical usage would be as follows: + +.. code-block:: python + + import sys + from mock_for_colour import MockModule + + for module in ('scipy', 'scipy.interpolate', 'scipy.spatial', + 'scipy.spatial.distance', 'scipy.optimize'): + sys.modules[str(module)] = MockModule(str(module)) + + import colour + + xyY = (0.4316, 0.3777, 0.1008) + colour.xyY_to_XYZ(xyY) + +.. code-block:: text + + array([ 0.11518475, 0.1008 , 0.05089373]) + +Or directly using the ``mock_scipy_for_colour`` definition: + +.. code-block:: python + + from mock_for_colour import mock_scipy_for_colour + + mock_scipy_for_colour() + + import colour + + xyY = (0.4316, 0.3777, 0.1008) + colour.xyY_to_XYZ(xyY) + +.. code-block:: text + + array([ 0.11518475, 0.1008 , 0.05089373]) + +Anything relying on the spectral code will be unusable, but a great amount of +useful functionality will still be available. diff --git a/docs/basics.rst b/docs/basics.rst index 80f26c69a6..7f0f179233 100644 --- a/docs/basics.rst +++ b/docs/basics.rst @@ -161,16 +161,18 @@ Scale - 1 - *Scalars* in domain-range `[0, 10]`, e.g *Munsell Value* are scaled by *10*. - *Percentages* in domain-range `[0, 100]` are scaled by *100*. -- *Degrees* in domain-range `[0, 360]` are scaled by *100*. +- *Degrees* in domain-range `[0, 360]` are scaled by *360*. - *Integers* in domain-range `[0, 2**n -1]` where `n` is the bit depth are scaled by *2**n -1*. .. warning:: The conversion to **'1'** domain-range scale is a *soft* normalisation and - similarly to the **'Reference'** domain-range scale it is normal that you + similarly to the **'Reference'** domain-range scale it is normal to encounter values exceeding *1*, e.g. High Dynamic Range Imagery (HDRI) or - negative values, e.g. out-of-gamut RGB colourspace values. + negative values, e.g. out-of-gamut RGB colourspace values. Some definitions + such as :func:`colour.models.eotf_ST2084` which decodes absolute luminance + values are not affected by any domain-range scales. Understanding the Domain-Range Scale of an Object ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -302,11 +304,11 @@ scale value: Multiprocessing on Windows with Domain-Range Scales ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Windows does not have a `fork `_ system call, +Windows does not have a `fork `__ system call, a consequence is that child processes do not necessarily -`inherit from changes made to global variables `_. +`inherit from changes made to global variables `__. -It has crucial `consequences `_ +It has crucial `consequences `__ as **Colour** stores the current domain-range scale into a global variable. The solution is to define an initialisation definition that defines the diff --git a/docs/colour.adaptation.rst b/docs/colour.adaptation.rst index 7a757329cd..653b590de6 100644 --- a/docs/colour.adaptation.rst +++ b/docs/colour.adaptation.rst @@ -71,7 +71,7 @@ CMCCAT2000 :toctree: generated/ chromatic_adaptation_forward_CMCCAT2000 - chromatic_adaptation_reverse_CMCCAT2000 + chromatic_adaptation_inverse_CMCCAT2000 CMCCAT2000_InductionFactors Von Kries diff --git a/docs/colour.colorimetry.rst b/docs/colour.colorimetry.rst index cdc6665ad6..fa9f93b589 100644 --- a/docs/colour.colorimetry.rst +++ b/docs/colour.colorimetry.rst @@ -15,9 +15,9 @@ Spectral Data Structure SpectralShape SpectralDistribution - MultiSpectralDistribution + MultiSpectralDistributions DEFAULT_SPECTRAL_SHAPE - ASTME30815_PRACTISE_SHAPE + ASTME308_PRACTISE_SHAPE Spectral Data Generation ------------------------ @@ -51,11 +51,23 @@ Spectral Data Generation blackbody_spectral_radiance daylight_locus_function - planck_law + sd_gaussian_normal sd_gaussian_fwhm sd_single_led_Ohno2005 sd_multi_leds_Ohno2005 + sds_and_multi_sds_to_sds + +**Aliases** + +``colour.colorimetry`` + +.. currentmodule:: colour.colorimetry + +.. autosummary:: + :toctree: generated/ + + planck_law Conversion to Tristimulus Values -------------------------------- @@ -83,7 +95,8 @@ ASTM E308-15 .. autosummary:: :toctree: generated/ - sd_to_XYZ_ASTME30815 + sd_to_XYZ_ASTME308 + multi_sds_to_XYZ_ASTME308 **Ancillary Objects** @@ -94,10 +107,10 @@ ASTM E308-15 .. autosummary:: :toctree: generated/ - sd_to_XYZ_tristimulus_weighting_factors_ASTME30815 - adjust_tristimulus_weighting_factors_ASTME30815 - lagrange_coefficients_ASTME202211 - tristimulus_weighting_factors_ASTME202211 + sd_to_XYZ_tristimulus_weighting_factors_ASTME308 + adjust_tristimulus_weighting_factors_ASTME308 + lagrange_coefficients_ASTME2022 + tristimulus_weighting_factors_ASTME2022 Integration ~~~~~~~~~~~ @@ -363,7 +376,7 @@ ASTM D1535-08e1 .. autosummary:: :toctree: generated/ - luminance_ASTMD153508 + luminance_ASTMD1535 Fairchild and Wyble (2010) ~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/colour.continuous.rst b/docs/colour.continuous.rst index 96fa6ffa87..f64b10b294 100644 --- a/docs/colour.continuous.rst +++ b/docs/colour.continuous.rst @@ -15,4 +15,4 @@ Continuous Signal AbstractContinuousFunction Signal - MultiSignal \ No newline at end of file + MultiSignals \ No newline at end of file diff --git a/docs/colour.corresponding.rst b/docs/colour.corresponding.rst index e9c384a068..b14023f631 100644 --- a/docs/colour.corresponding.rst +++ b/docs/colour.corresponding.rst @@ -15,6 +15,8 @@ Prediction corresponding_chromaticities_prediction CORRESPONDING_CHROMATICITIES_PREDICTION_MODELS + CorrespondingColourDataset + CorrespondingChromaticitiesPrediction **Dataset** diff --git a/docs/colour.graph.rst b/docs/colour.graph.rst new file mode 100644 index 0000000000..ad03a58ec3 --- /dev/null +++ b/docs/colour.graph.rst @@ -0,0 +1,17 @@ +Automatic Colour Conversion Graph +================================= + +.. contents:: :local: + +Conversion +---------- + +``colour`` + +.. currentmodule:: colour + +.. autosummary:: + :toctree: generated/ + + convert + describe_conversion_path diff --git a/docs/colour.io.rst b/docs/colour.io.rst index 78cd07738b..a5bfe0df9e 100644 --- a/docs/colour.io.rst +++ b/docs/colour.io.rst @@ -13,7 +13,9 @@ Image Data .. autosummary:: :toctree: generated/ + READ_IMAGE_METHODS read_image + WRITE_IMAGE_METHODS write_image **Ancillary Objects** @@ -26,6 +28,11 @@ Image Data :toctree: generated/ ImageAttribute_Specification + convert_bit_depth + read_image_OpenImageIO + write_image_OpenImageIO + read_image_Imageio + write_image_Imageio Look Up Table (LUT) Data ------------------------ diff --git a/docs/colour.models.rst b/docs/colour.models.rst index 0ddf4bbc82..17294d697d 100644 --- a/docs/colour.models.rst +++ b/docs/colour.models.rst @@ -312,9 +312,11 @@ RGB Colourspaces DON_RGB_4_COLOURSPACE ECI_RGB_V2_COLOURSPACE EKTA_SPACE_PS_5_COLOURSPACE + F_GAMUT_COLOURSPACE PROTUNE_NATIVE_COLOURSPACE MAX_RGB_COLOURSPACE - NTSC_COLOURSPACE + NTSC_1953_COLOURSPACE + NTSC_1987_COLOURSPACE P3_D65_COLOURSPACE PAL_SECAM_COLOURSPACE RED_COLOR_COLOURSPACE @@ -330,6 +332,7 @@ RGB Colourspaces PROPHOTO_RGB_COLOURSPACE RUSSELL_RGB_COLOURSPACE SMPTE_240M_COLOURSPACE + SMPTE_C_COLOURSPACE S_GAMUT_COLOURSPACE S_GAMUT3_COLOURSPACE S_GAMUT3_CINE_COLOURSPACE @@ -347,10 +350,34 @@ Colour Component Transfer Functions .. autosummary:: :toctree: generated/ - encoding_cctf - ENCODING_CCTFS - decoding_cctf - DECODING_CCTFS + cctf_encoding + CCTF_ENCODINGS + cctf_decoding + CCTF_DECODINGS + +``colour.models`` + +.. currentmodule:: colour.models + +.. autosummary:: + :toctree: generated/ + + cctf_encoding_ROMMRGB + cctf_decoding_ROMMRGB + cctf_encoding_RIMMRGB + cctf_decoding_RIMMRGB + +**Aliases** + +``colour.models`` + +.. currentmodule:: colour.models + +.. autosummary:: + :toctree: generated/ + + cctf_encoding_ProPhotoRGB + cctf_decoding_ProPhotoRGB Opto-Electronic Transfer Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -364,8 +391,8 @@ Opto-Electronic Transfer Functions oetf OETFS - oetf_reverse - OETFS_REVERSE + oetf_inverse + OETF_INVERSES ``colour.models`` @@ -375,24 +402,17 @@ Opto-Electronic Transfer Functions :toctree: generated/ oetf_ARIBSTDB67 - oetf_reverse_ARIBSTDB67 - oetf_DICOMGSDF + oetf_inverse_ARIBSTDB67 oetf_BT2020 - oetf_BT2100_HLG - oetf_reverse_BT2100_HLG - oetf_BT2100_PQ - oetf_reverse_BT2100_PQ + oetf_HLG_BT2100 + oetf_inverse_HLG_BT2100 + oetf_PQ_BT2100 + oetf_inverse_PQ_BT2100 oetf_BT601 - oetf_reverse_BT601 + oetf_inverse_BT601 oetf_BT709 - oetf_reverse_BT709 - oetf_ProPhotoRGB - oetf_RIMMRGB - oetf_ROMMRGB + oetf_inverse_BT709 oetf_SMPTE240M - oetf_ST2084 - oetf_sRGB - oetf_reverse_sRGB **Ancillary Objects** @@ -418,8 +438,8 @@ Electro-Optical Transfer Functions eotf EOTFS - eotf_reverse - EOTFS_REVERSE + eotf_inverse + EOTF_INVERSES ``colour.models`` @@ -429,20 +449,23 @@ Electro-Optical Transfer Functions :toctree: generated/ eotf_DCDM - eotf_reverse_DCDM + eotf_inverse_DCDM eotf_DICOMGSDF + eotf_inverse_DICOMGSDF eotf_BT1886 - eotf_reverse_BT1886 + eotf_inverse_BT1886 eotf_BT2020 - eotf_BT2100_HLG - eotf_reverse_BT2100_HLG - eotf_BT2100_PQ - eotf_reverse_BT2100_PQ - eotf_ProPhotoRGB - eotf_RIMMRGB - eotf_ROMMRGB + BT2100_HLG_EOTF_METHODS + eotf_HLG_BT2100 + BT2100_HLG_EOTF_INVERSE_METHODS + eotf_inverse_HLG_BT2100 + eotf_PQ_BT2100 + eotf_inverse_PQ_BT2100 eotf_SMPTE240M eotf_ST2084 + eotf_inverse_ST2084 + eotf_sRGB + eotf_inverse_sRGB Opto-Optical Transfer Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -456,8 +479,8 @@ Opto-Optical Transfer Functions ootf OOTFS - ootf_reverse - OOTFS_REVERSE + ootf_inverse + OOTF_INVERSES ``colour.models`` @@ -467,13 +490,15 @@ Opto-Optical Transfer Functions .. autosummary:: :toctree: generated/ - ootf_BT2100_HLG - ootf_reverse_BT2100_HLG - ootf_BT2100_PQ - ootf_reverse_BT2100_PQ + BT2100_HLG_OOTF_METHODS + ootf_HLG_BT2100 + BT2100_HLG_OOTF_INVERSE_METHODS + ootf_inverse_HLG_BT2100 + ootf_PQ_BT2100 + ootf_inverse_PQ_BT2100 -Log Encoding and Decoding Curves -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Log Encoding and Decoding +~~~~~~~~~~~~~~~~~~~~~~~~~ ``colour`` @@ -482,10 +507,10 @@ Log Encoding and Decoding Curves .. autosummary:: :toctree: generated/ - log_encoding_curve - LOG_ENCODING_CURVES - log_decoding_curve - LOG_DECODING_CURVES + log_encoding + LOG_ENCODINGS + log_decoding + LOG_DECODINGS ``colour.models`` @@ -512,7 +537,11 @@ Log Encoding and Decoding Curves log_decoding_Cineon log_encoding_ERIMMRGB log_decoding_ERIMMRGB + log_encoding_FLog + log_decoding_FLog + LOG3G10_ENCODING_METHODS log_encoding_Log3G10 + LOG3G10_DECODING_METHODS log_decoding_Log3G10 log_encoding_Log3G12 log_decoding_Log3G12 diff --git a/docs/colour.notation.rst b/docs/colour.notation.rst index ec1f05a4fb..cc6256542d 100644 --- a/docs/colour.notation.rst +++ b/docs/colour.notation.rst @@ -122,7 +122,7 @@ ASTM D1535-08e1 .. autosummary:: :toctree: generated/ - munsell_value_ASTMD153508 + munsell_value_ASTMD1535 Hexadecimal Triplet Notation ---------------------------- diff --git a/docs/colour.plotting.rst b/docs/colour.plotting.rst index 1059eae160..0e92dd33d9 100644 --- a/docs/colour.plotting.rst +++ b/docs/colour.plotting.rst @@ -140,6 +140,7 @@ Colour Models plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS plot_single_cctf plot_multi_cctfs + plot_constant_hue_loci **Ancillary Objects** @@ -150,6 +151,7 @@ Colour Models .. autosummary:: :toctree: generated/ + common_colourspace_model_axis_reorder plot_pointer_gamut plot_RGB_colourspaces_in_chromaticity_diagram plot_RGB_chromaticities_in_chromaticity_diagram @@ -229,6 +231,8 @@ Colour Temperature & Correlated Colour Temperature :toctree: generated/ plot_planckian_locus + plot_planckian_locus_CIE1931 + plot_planckian_locus_CIE1960UCS plot_planckian_locus_in_chromaticity_diagram Colour Models Volume @@ -256,4 +260,16 @@ Geometry Plotting Utilities quad grid - cube \ No newline at end of file + cube + +Automatic Colour Conversion Graph +--------------------------------- + +``colour.plotting`` + +.. currentmodule:: colour.plotting + +.. autosummary:: + :toctree: generated/ + + plot_automatic_colour_conversion_graph \ No newline at end of file diff --git a/docs/colour.rst b/docs/colour.rst index 9ad4e6cc92..902cc47343 100644 --- a/docs/colour.rst +++ b/docs/colour.rst @@ -16,6 +16,7 @@ Colour colour.continuous colour.corresponding colour.difference + colour.graph colour.io colour.models colour.notation diff --git a/docs/colour.temperature.rst b/docs/colour.temperature.rst index d8523570e5..6425cb2f77 100644 --- a/docs/colour.temperature.rst +++ b/docs/colour.temperature.rst @@ -13,14 +13,14 @@ Correlated Colour Temperature .. autosummary:: :toctree: generated/ - CCT_to_uv - CCT_TO_UV_METHODS uv_to_CCT UV_TO_CCT_METHODS - CCT_to_xy - CCT_TO_XY_METHODS + CCT_to_uv + CCT_TO_UV_METHODS xy_to_CCT XY_TO_CCT_METHODS + CCT_to_xy + CCT_TO_XY_METHODS Robertson (1968) ~~~~~~~~~~~~~~~~ @@ -32,8 +32,8 @@ Robertson (1968) .. autosummary:: :toctree: generated/ - CCT_to_uv_Robertson1968 uv_to_CCT_Robertson1968 + CCT_to_uv_Robertson1968 Krystek (1985) ~~~~~~~~~~~~~~ @@ -45,6 +45,7 @@ Krystek (1985) .. autosummary:: :toctree: generated/ + uv_to_CCT_Krystek1985 CCT_to_uv_Krystek1985 Ohno (2013) @@ -57,8 +58,21 @@ Ohno (2013) .. autosummary:: :toctree: generated/ - CCT_to_uv_Ohno2013 uv_to_CCT_Ohno2013 + CCT_to_uv_Ohno2013 + +McCamy (1992) +~~~~~~~~~~~~~ + +``colour.temperature`` + +.. currentmodule:: colour.temperature + +.. autosummary:: + :toctree: generated/ + + xy_to_CCT_McCamy1992 + CCT_to_xy_McCamy1992 Hernandez-Andres, Lee and Romero (1999) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -71,6 +85,7 @@ Hernandez-Andres, Lee and Romero (1999) :toctree: generated/ xy_to_CCT_Hernandez1999 + CCT_to_xy_Hernandez1999 Kang, Moon, Hong, Lee, Cho and Kim (2002) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -82,6 +97,7 @@ Kang, Moon, Hong, Lee, Cho and Kim (2002) .. autosummary:: :toctree: generated/ + xy_to_CCT_Kang2002 CCT_to_xy_Kang2002 CIE Illuminant D Series @@ -94,4 +110,5 @@ CIE Illuminant D Series .. autosummary:: :toctree: generated/ + xy_to_CCT_CIE_D CCT_to_xy_CIE_D diff --git a/docs/colour.utilities.rst b/docs/colour.utilities.rst index 34a281b8a3..f962c2ef48 100644 --- a/docs/colour.utilities.rst +++ b/docs/colour.utilities.rst @@ -34,6 +34,7 @@ Common batch disable_multiprocessing multiprocessing_pool + is_networkx_installed is_openimageio_installed is_pandas_installed is_iterable diff --git a/docs/conf.py b/docs/conf.py index 29214f38a0..10f0659f1a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,7 +13,9 @@ # serve to show the default. import functools +import os import re +import sys def no_op_wraps(function): @@ -34,9 +36,9 @@ def wrapper(*args): functools._wraps = functools.wraps functools.wraps = no_op_wraps -import colour as package +import colour as package # noqa -basename = re.sub('_(\w)', lambda x: x.group(1).upper(), +basename = re.sub('_(\\w)', lambda x: x.group(1).upper(), package.__name__.title()) autosummary_generate = True @@ -49,6 +51,15 @@ def wrapper(*args): 'scipy.optimize', 'scipy.spatial', 'scipy.spatial.distance' ] +if os.environ.get('READTHEDOCS') == 'True': + utilities_directory = os.path.abspath( + os.path.join(os.getcwd(), '..', 'utilities')) + static_directory = os.path.abspath(os.path.join(os.getcwd(), '_static')) + sys.path.append(utilities_directory) + from generate_plots import generate_documentation_plots + + generate_documentation_plots(static_directory) + # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. @@ -125,7 +136,7 @@ def wrapper(*args): # show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = 'lovelace' # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] @@ -224,7 +235,7 @@ def wrapper(*args): latex_elements = { # The paper size ('letterpaper' or 'a4paper'). 'papersize': - 'letterpaper', + 'a4paper', # The font size ('10pt', '11pt' or '12pt'). 'pointsize': @@ -311,10 +322,10 @@ def wrapper(*args): # The basename for the epub file. It defaults to the project name. # epub_basename = basename -# The HTML theme for the epub output. Since the default themes are not optimized -# for small screen space, using the same theme for HTML and epub output is -# usually not wise. This defaults to 'epub', a theme designed to save visual -# space. +# The HTML theme for the epub output. Since the default themes are not +# optimized for small screen space, using the same theme for HTML and epub +# output is usually not wise. This defaults to 'epub', a theme designed to save +# visual space. # epub_theme = 'epub' # The language of the text. It defaults to the language option @@ -403,7 +414,7 @@ def _continuous_signal_repr(self): package.colorimetry.SpectralDistribution.__repr__ = (_continuous_signal_repr) -package.colorimetry.MultiSpectralDistribution.__repr__ = ( +package.colorimetry.MultiSpectralDistributions.__repr__ = ( _continuous_signal_repr) diff --git a/docs/generated/colour.ASTME30815_PRACTISE_SHAPE.rst b/docs/generated/colour.ASTME30815_PRACTISE_SHAPE.rst deleted file mode 100644 index 69135f9ec3..0000000000 --- a/docs/generated/colour.ASTME30815_PRACTISE_SHAPE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.ASTME30815\_PRACTISE\_SHAPE -================================== - -.. currentmodule:: colour - -.. autodata:: ASTME30815_PRACTISE_SHAPE \ No newline at end of file diff --git a/docs/generated/colour.ATD95_Specification.rst b/docs/generated/colour.ATD95_Specification.rst deleted file mode 100644 index 735e32dbcc..0000000000 --- a/docs/generated/colour.ATD95_Specification.rst +++ /dev/null @@ -1,37 +0,0 @@ -colour.ATD95\_Specification -=========================== - -.. currentmodule:: colour - -.. autoclass:: ATD95_Specification - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~ATD95_Specification.count - ~ATD95_Specification.index - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~ATD95_Specification.A_1 - ~ATD95_Specification.A_2 - ~ATD95_Specification.C - ~ATD95_Specification.D_1 - ~ATD95_Specification.D_2 - ~ATD95_Specification.Q - ~ATD95_Specification.T_1 - ~ATD95_Specification.T_2 - ~ATD95_Specification.h - - \ No newline at end of file diff --git a/docs/generated/colour.BANDPASS_CORRECTION_METHODS.rst b/docs/generated/colour.BANDPASS_CORRECTION_METHODS.rst deleted file mode 100644 index 72cc6c7013..0000000000 --- a/docs/generated/colour.BANDPASS_CORRECTION_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.BANDPASS\_CORRECTION\_METHODS -==================================== - -.. currentmodule:: colour - -.. autodata:: BANDPASS_CORRECTION_METHODS \ No newline at end of file diff --git a/docs/generated/colour.BRENEMAN_EXPERIMENTS.rst b/docs/generated/colour.BRENEMAN_EXPERIMENTS.rst deleted file mode 100644 index e3b24b55b8..0000000000 --- a/docs/generated/colour.BRENEMAN_EXPERIMENTS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.BRENEMAN\_EXPERIMENTS -============================ - -.. currentmodule:: colour - -.. autodata:: BRENEMAN_EXPERIMENTS \ No newline at end of file diff --git a/docs/generated/colour.BRENEMAN_EXPERIMENTS_PRIMARIES_CHROMATICITIES.rst b/docs/generated/colour.BRENEMAN_EXPERIMENTS_PRIMARIES_CHROMATICITIES.rst deleted file mode 100644 index d0a51b08c8..0000000000 --- a/docs/generated/colour.BRENEMAN_EXPERIMENTS_PRIMARIES_CHROMATICITIES.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.BRENEMAN\_EXPERIMENTS\_PRIMARIES\_CHROMATICITIES -======================================================= - -.. currentmodule:: colour - -.. autodata:: BRENEMAN_EXPERIMENTS_PRIMARIES_CHROMATICITIES \ No newline at end of file diff --git a/docs/generated/colour.CAM02LCD_to_JMh_CIECAM02.rst b/docs/generated/colour.CAM02LCD_to_JMh_CIECAM02.rst deleted file mode 100644 index 7e2f49619d..0000000000 --- a/docs/generated/colour.CAM02LCD_to_JMh_CIECAM02.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CAM02LCD\_to\_JMh\_CIECAM02 -================================== - -.. currentmodule:: colour - -.. autofunction:: CAM02LCD_to_JMh_CIECAM02 \ No newline at end of file diff --git a/docs/generated/colour.CAM02SCD_to_JMh_CIECAM02.rst b/docs/generated/colour.CAM02SCD_to_JMh_CIECAM02.rst deleted file mode 100644 index 5010acfda9..0000000000 --- a/docs/generated/colour.CAM02SCD_to_JMh_CIECAM02.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CAM02SCD\_to\_JMh\_CIECAM02 -================================== - -.. currentmodule:: colour - -.. autofunction:: CAM02SCD_to_JMh_CIECAM02 \ No newline at end of file diff --git a/docs/generated/colour.CAM02UCS_to_JMh_CIECAM02.rst b/docs/generated/colour.CAM02UCS_to_JMh_CIECAM02.rst deleted file mode 100644 index a215601c40..0000000000 --- a/docs/generated/colour.CAM02UCS_to_JMh_CIECAM02.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CAM02UCS\_to\_JMh\_CIECAM02 -================================== - -.. currentmodule:: colour - -.. autofunction:: CAM02UCS_to_JMh_CIECAM02 \ No newline at end of file diff --git a/docs/generated/colour.CAM16LCD_to_JMh_CAM16.rst b/docs/generated/colour.CAM16LCD_to_JMh_CAM16.rst deleted file mode 100644 index 97ff785936..0000000000 --- a/docs/generated/colour.CAM16LCD_to_JMh_CAM16.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CAM16LCD\_to\_JMh\_CAM16 -=============================== - -.. currentmodule:: colour - -.. autofunction:: CAM16LCD_to_JMh_CAM16 \ No newline at end of file diff --git a/docs/generated/colour.CAM16SCD_to_JMh_CAM16.rst b/docs/generated/colour.CAM16SCD_to_JMh_CAM16.rst deleted file mode 100644 index 1bab357f56..0000000000 --- a/docs/generated/colour.CAM16SCD_to_JMh_CAM16.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CAM16SCD\_to\_JMh\_CAM16 -=============================== - -.. currentmodule:: colour - -.. autofunction:: CAM16SCD_to_JMh_CAM16 \ No newline at end of file diff --git a/docs/generated/colour.CAM16UCS_to_JMh_CAM16.rst b/docs/generated/colour.CAM16UCS_to_JMh_CAM16.rst deleted file mode 100644 index ccbf03b7ad..0000000000 --- a/docs/generated/colour.CAM16UCS_to_JMh_CAM16.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CAM16UCS\_to\_JMh\_CAM16 -=============================== - -.. currentmodule:: colour - -.. autofunction:: CAM16UCS_to_JMh_CAM16 \ No newline at end of file diff --git a/docs/generated/colour.CAM16_Specification.rst b/docs/generated/colour.CAM16_Specification.rst deleted file mode 100644 index 8451805546..0000000000 --- a/docs/generated/colour.CAM16_Specification.rst +++ /dev/null @@ -1,36 +0,0 @@ -colour.CAM16\_Specification -=========================== - -.. currentmodule:: colour - -.. autoclass:: CAM16_Specification - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~CAM16_Specification.count - ~CAM16_Specification.index - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~CAM16_Specification.C - ~CAM16_Specification.H - ~CAM16_Specification.HC - ~CAM16_Specification.J - ~CAM16_Specification.M - ~CAM16_Specification.Q - ~CAM16_Specification.h - ~CAM16_Specification.s - - \ No newline at end of file diff --git a/docs/generated/colour.CAM16_VIEWING_CONDITIONS.rst b/docs/generated/colour.CAM16_VIEWING_CONDITIONS.rst deleted file mode 100644 index c73e743841..0000000000 --- a/docs/generated/colour.CAM16_VIEWING_CONDITIONS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CAM16\_VIEWING\_CONDITIONS -================================= - -.. currentmodule:: colour - -.. autodata:: CAM16_VIEWING_CONDITIONS \ No newline at end of file diff --git a/docs/generated/colour.CAM16_to_XYZ.rst b/docs/generated/colour.CAM16_to_XYZ.rst deleted file mode 100644 index b1474e35c2..0000000000 --- a/docs/generated/colour.CAM16_to_XYZ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CAM16\_to\_XYZ -===================== - -.. currentmodule:: colour - -.. autofunction:: CAM16_to_XYZ \ No newline at end of file diff --git a/docs/generated/colour.CAMERAS_RGB_SPECTRAL_SENSITIVITIES.rst b/docs/generated/colour.CAMERAS_RGB_SPECTRAL_SENSITIVITIES.rst deleted file mode 100644 index 716395608b..0000000000 --- a/docs/generated/colour.CAMERAS_RGB_SPECTRAL_SENSITIVITIES.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CAMERAS\_RGB\_SPECTRAL\_SENSITIVITIES -============================================ - -.. currentmodule:: colour - -.. autodata:: CAMERAS_RGB_SPECTRAL_SENSITIVITIES \ No newline at end of file diff --git a/docs/generated/colour.CCT_TO_UV_METHODS.rst b/docs/generated/colour.CCT_TO_UV_METHODS.rst deleted file mode 100644 index 2bcaee82d9..0000000000 --- a/docs/generated/colour.CCT_TO_UV_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CCT\_TO\_UV\_METHODS -=========================== - -.. currentmodule:: colour - -.. autodata:: CCT_TO_UV_METHODS \ No newline at end of file diff --git a/docs/generated/colour.CCT_TO_XY_METHODS.rst b/docs/generated/colour.CCT_TO_XY_METHODS.rst deleted file mode 100644 index 8dd25e9110..0000000000 --- a/docs/generated/colour.CCT_TO_XY_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CCT\_TO\_XY\_METHODS -=========================== - -.. currentmodule:: colour - -.. autodata:: CCT_TO_XY_METHODS \ No newline at end of file diff --git a/docs/generated/colour.CCT_to_uv.rst b/docs/generated/colour.CCT_to_uv.rst deleted file mode 100644 index 7e187bea4e..0000000000 --- a/docs/generated/colour.CCT_to_uv.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CCT\_to\_uv -================== - -.. currentmodule:: colour - -.. autofunction:: CCT_to_uv \ No newline at end of file diff --git a/docs/generated/colour.CCT_to_xy.rst b/docs/generated/colour.CCT_to_xy.rst deleted file mode 100644 index 7b034aed23..0000000000 --- a/docs/generated/colour.CCT_to_xy.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CCT\_to\_xy -================== - -.. currentmodule:: colour - -.. autofunction:: CCT_to_xy \ No newline at end of file diff --git a/docs/generated/colour.CHROMATIC_ADAPTATION_METHODS.rst b/docs/generated/colour.CHROMATIC_ADAPTATION_METHODS.rst deleted file mode 100644 index c02b7e4842..0000000000 --- a/docs/generated/colour.CHROMATIC_ADAPTATION_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CHROMATIC\_ADAPTATION\_METHODS -===================================== - -.. currentmodule:: colour - -.. autodata:: CHROMATIC_ADAPTATION_METHODS \ No newline at end of file diff --git a/docs/generated/colour.CHROMATIC_ADAPTATION_TRANSFORMS.rst b/docs/generated/colour.CHROMATIC_ADAPTATION_TRANSFORMS.rst deleted file mode 100644 index ea26ccde6d..0000000000 --- a/docs/generated/colour.CHROMATIC_ADAPTATION_TRANSFORMS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CHROMATIC\_ADAPTATION\_TRANSFORMS -======================================== - -.. currentmodule:: colour - -.. autodata:: CHROMATIC_ADAPTATION_TRANSFORMS \ No newline at end of file diff --git a/docs/generated/colour.CIECAM02_Specification.rst b/docs/generated/colour.CIECAM02_Specification.rst deleted file mode 100644 index 997ad73180..0000000000 --- a/docs/generated/colour.CIECAM02_Specification.rst +++ /dev/null @@ -1,36 +0,0 @@ -colour.CIECAM02\_Specification -============================== - -.. currentmodule:: colour - -.. autoclass:: CIECAM02_Specification - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~CIECAM02_Specification.count - ~CIECAM02_Specification.index - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~CIECAM02_Specification.C - ~CIECAM02_Specification.H - ~CIECAM02_Specification.HC - ~CIECAM02_Specification.J - ~CIECAM02_Specification.M - ~CIECAM02_Specification.Q - ~CIECAM02_Specification.h - ~CIECAM02_Specification.s - - \ No newline at end of file diff --git a/docs/generated/colour.CIECAM02_VIEWING_CONDITIONS.rst b/docs/generated/colour.CIECAM02_VIEWING_CONDITIONS.rst deleted file mode 100644 index c008063c8d..0000000000 --- a/docs/generated/colour.CIECAM02_VIEWING_CONDITIONS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CIECAM02\_VIEWING\_CONDITIONS -==================================== - -.. currentmodule:: colour - -.. autodata:: CIECAM02_VIEWING_CONDITIONS \ No newline at end of file diff --git a/docs/generated/colour.CIECAM02_to_XYZ.rst b/docs/generated/colour.CIECAM02_to_XYZ.rst deleted file mode 100644 index 986954d4a0..0000000000 --- a/docs/generated/colour.CIECAM02_to_XYZ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CIECAM02\_to\_XYZ -======================== - -.. currentmodule:: colour - -.. autofunction:: CIECAM02_to_XYZ \ No newline at end of file diff --git a/docs/generated/colour.CMCCAT2000_VIEWING_CONDITIONS.rst b/docs/generated/colour.CMCCAT2000_VIEWING_CONDITIONS.rst deleted file mode 100644 index 2ba417f070..0000000000 --- a/docs/generated/colour.CMCCAT2000_VIEWING_CONDITIONS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CMCCAT2000\_VIEWING\_CONDITIONS -====================================== - -.. currentmodule:: colour - -.. autodata:: CMCCAT2000_VIEWING_CONDITIONS \ No newline at end of file diff --git a/docs/generated/colour.CMFS.rst b/docs/generated/colour.CMFS.rst deleted file mode 100644 index ebed27c223..0000000000 --- a/docs/generated/colour.CMFS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CMFS -=========== - -.. currentmodule:: colour - -.. autodata:: CMFS \ No newline at end of file diff --git a/docs/generated/colour.CMYK_to_CMY.rst b/docs/generated/colour.CMYK_to_CMY.rst deleted file mode 100644 index 8e06b400a3..0000000000 --- a/docs/generated/colour.CMYK_to_CMY.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CMYK\_to\_CMY -==================== - -.. currentmodule:: colour - -.. autofunction:: CMYK_to_CMY \ No newline at end of file diff --git a/docs/generated/colour.CMY_to_CMYK.rst b/docs/generated/colour.CMY_to_CMYK.rst deleted file mode 100644 index 66411a2935..0000000000 --- a/docs/generated/colour.CMY_to_CMYK.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CMY\_to\_CMYK -==================== - -.. currentmodule:: colour - -.. autofunction:: CMY_to_CMYK \ No newline at end of file diff --git a/docs/generated/colour.CMY_to_RGB.rst b/docs/generated/colour.CMY_to_RGB.rst deleted file mode 100644 index abdcf4c831..0000000000 --- a/docs/generated/colour.CMY_to_RGB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CMY\_to\_RGB -=================== - -.. currentmodule:: colour - -.. autofunction:: CMY_to_RGB \ No newline at end of file diff --git a/docs/generated/colour.COLOURCHECKERS.rst b/docs/generated/colour.COLOURCHECKERS.rst deleted file mode 100644 index 67b489edce..0000000000 --- a/docs/generated/colour.COLOURCHECKERS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.COLOURCHECKERS -===================== - -.. currentmodule:: colour - -.. autodata:: COLOURCHECKERS \ No newline at end of file diff --git a/docs/generated/colour.COLOURCHECKERS_SDS.rst b/docs/generated/colour.COLOURCHECKERS_SDS.rst deleted file mode 100644 index 763cf20278..0000000000 --- a/docs/generated/colour.COLOURCHECKERS_SDS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.COLOURCHECKERS\_SDS -========================== - -.. currentmodule:: colour - -.. autodata:: COLOURCHECKERS_SDS \ No newline at end of file diff --git a/docs/generated/colour.COLOUR_CORRECTION_MATRIX_METHODS.rst b/docs/generated/colour.COLOUR_CORRECTION_MATRIX_METHODS.rst deleted file mode 100644 index 69360e2aeb..0000000000 --- a/docs/generated/colour.COLOUR_CORRECTION_MATRIX_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.COLOUR\_CORRECTION\_MATRIX\_METHODS -========================================== - -.. currentmodule:: colour - -.. autodata:: COLOUR_CORRECTION_MATRIX_METHODS \ No newline at end of file diff --git a/docs/generated/colour.COLOUR_CORRECTION_METHODS.rst b/docs/generated/colour.COLOUR_CORRECTION_METHODS.rst deleted file mode 100644 index fab8d6ed5b..0000000000 --- a/docs/generated/colour.COLOUR_CORRECTION_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.COLOUR\_CORRECTION\_METHODS -================================== - -.. currentmodule:: colour - -.. autodata:: COLOUR_CORRECTION_METHODS \ No newline at end of file diff --git a/docs/generated/colour.COLOUR_QUALITY_SCALE_METHODS.rst b/docs/generated/colour.COLOUR_QUALITY_SCALE_METHODS.rst deleted file mode 100644 index 3a069b0248..0000000000 --- a/docs/generated/colour.COLOUR_QUALITY_SCALE_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.COLOUR\_QUALITY\_SCALE\_METHODS -====================================== - -.. currentmodule:: colour - -.. autodata:: COLOUR_QUALITY_SCALE_METHODS \ No newline at end of file diff --git a/docs/generated/colour.CONTRAST_SENSITIVITY_METHODS.rst b/docs/generated/colour.CONTRAST_SENSITIVITY_METHODS.rst deleted file mode 100644 index d3c7b27d0b..0000000000 --- a/docs/generated/colour.CONTRAST_SENSITIVITY_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CONTRAST\_SENSITIVITY\_METHODS -===================================== - -.. currentmodule:: colour - -.. autodata:: CONTRAST_SENSITIVITY_METHODS \ No newline at end of file diff --git a/docs/generated/colour.CORRESPONDING_CHROMATICITIES_PREDICTION_MODELS.rst b/docs/generated/colour.CORRESPONDING_CHROMATICITIES_PREDICTION_MODELS.rst deleted file mode 100644 index 69de0d64bc..0000000000 --- a/docs/generated/colour.CORRESPONDING_CHROMATICITIES_PREDICTION_MODELS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CORRESPONDING\_CHROMATICITIES\_PREDICTION\_MODELS -======================================================== - -.. currentmodule:: colour - -.. autodata:: CORRESPONDING_CHROMATICITIES_PREDICTION_MODELS \ No newline at end of file diff --git a/docs/generated/colour.CVD_MATRICES_MACHADO2010.rst b/docs/generated/colour.CVD_MATRICES_MACHADO2010.rst deleted file mode 100644 index 2de615a949..0000000000 --- a/docs/generated/colour.CVD_MATRICES_MACHADO2010.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CVD\_MATRICES\_MACHADO2010 -================================= - -.. currentmodule:: colour - -.. autodata:: CVD_MATRICES_MACHADO2010 \ No newline at end of file diff --git a/docs/generated/colour.CV_range.rst b/docs/generated/colour.CV_range.rst deleted file mode 100644 index ea3baa3c4f..0000000000 --- a/docs/generated/colour.CV_range.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.CV\_range -================ - -.. currentmodule:: colour - -.. autofunction:: CV_range \ No newline at end of file diff --git a/docs/generated/colour.DECODING_CCTFS.rst b/docs/generated/colour.DECODING_CCTFS.rst deleted file mode 100644 index a08f40ce48..0000000000 --- a/docs/generated/colour.DECODING_CCTFS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.DECODING\_CCTFS -====================== - -.. currentmodule:: colour - -.. autodata:: DECODING_CCTFS \ No newline at end of file diff --git a/docs/generated/colour.DEFAULT_SPECTRAL_SHAPE.rst b/docs/generated/colour.DEFAULT_SPECTRAL_SHAPE.rst deleted file mode 100644 index dd62f8bd49..0000000000 --- a/docs/generated/colour.DEFAULT_SPECTRAL_SHAPE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.DEFAULT\_SPECTRAL\_SHAPE -=============================== - -.. currentmodule:: colour - -.. autodata:: DEFAULT_SPECTRAL_SHAPE \ No newline at end of file diff --git a/docs/generated/colour.DELTA_E_METHODS.rst b/docs/generated/colour.DELTA_E_METHODS.rst deleted file mode 100644 index 7ad9ea4993..0000000000 --- a/docs/generated/colour.DELTA_E_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.DELTA\_E\_METHODS -======================== - -.. currentmodule:: colour - -.. autodata:: DELTA_E_METHODS \ No newline at end of file diff --git a/docs/generated/colour.DIN99_to_Lab.rst b/docs/generated/colour.DIN99_to_Lab.rst deleted file mode 100644 index f36baa29c2..0000000000 --- a/docs/generated/colour.DIN99_to_Lab.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.DIN99\_to\_Lab -===================== - -.. currentmodule:: colour - -.. autofunction:: DIN99_to_Lab \ No newline at end of file diff --git a/docs/generated/colour.DISPLAYS_RGB_PRIMARIES.rst b/docs/generated/colour.DISPLAYS_RGB_PRIMARIES.rst deleted file mode 100644 index 11acc777a3..0000000000 --- a/docs/generated/colour.DISPLAYS_RGB_PRIMARIES.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.DISPLAYS\_RGB\_PRIMARIES -=============================== - -.. currentmodule:: colour - -.. autodata:: DISPLAYS_RGB_PRIMARIES \ No newline at end of file diff --git a/docs/generated/colour.ENCODING_CCTFS.rst b/docs/generated/colour.ENCODING_CCTFS.rst deleted file mode 100644 index 1c54c33fbb..0000000000 --- a/docs/generated/colour.ENCODING_CCTFS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.ENCODING\_CCTFS -====================== - -.. currentmodule:: colour - -.. autodata:: ENCODING_CCTFS \ No newline at end of file diff --git a/docs/generated/colour.EOTFS.rst b/docs/generated/colour.EOTFS.rst deleted file mode 100644 index 934c41ef8b..0000000000 --- a/docs/generated/colour.EOTFS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.EOTFS -============ - -.. currentmodule:: colour - -.. autodata:: EOTFS \ No newline at end of file diff --git a/docs/generated/colour.EOTFS_REVERSE.rst b/docs/generated/colour.EOTFS_REVERSE.rst deleted file mode 100644 index 3b86c76129..0000000000 --- a/docs/generated/colour.EOTFS_REVERSE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.EOTFS\_REVERSE -===================== - -.. currentmodule:: colour - -.. autodata:: EOTFS_REVERSE \ No newline at end of file diff --git a/docs/generated/colour.Extrapolator.rst b/docs/generated/colour.Extrapolator.rst deleted file mode 100644 index 11f219b59d..0000000000 --- a/docs/generated/colour.Extrapolator.rst +++ /dev/null @@ -1,31 +0,0 @@ -colour.Extrapolator -=================== - -.. currentmodule:: colour - -.. autoclass:: Extrapolator - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~Extrapolator.__init__ - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~Extrapolator.interpolator - ~Extrapolator.left - ~Extrapolator.method - ~Extrapolator.right - - \ No newline at end of file diff --git a/docs/generated/colour.HDR_CIELAB_METHODS.rst b/docs/generated/colour.HDR_CIELAB_METHODS.rst deleted file mode 100644 index 720d495317..0000000000 --- a/docs/generated/colour.HDR_CIELAB_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.HDR\_CIELAB\_METHODS -=========================== - -.. currentmodule:: colour - -.. autodata:: HDR_CIELAB_METHODS \ No newline at end of file diff --git a/docs/generated/colour.HDR_IPT_METHODS.rst b/docs/generated/colour.HDR_IPT_METHODS.rst deleted file mode 100644 index 300825ecbe..0000000000 --- a/docs/generated/colour.HDR_IPT_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.HDR\_IPT\_METHODS -======================== - -.. currentmodule:: colour - -.. autodata:: HDR_IPT_METHODS \ No newline at end of file diff --git a/docs/generated/colour.HSL_to_RGB.rst b/docs/generated/colour.HSL_to_RGB.rst deleted file mode 100644 index f90e25718b..0000000000 --- a/docs/generated/colour.HSL_to_RGB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.HSL\_to\_RGB -=================== - -.. currentmodule:: colour - -.. autofunction:: HSL_to_RGB \ No newline at end of file diff --git a/docs/generated/colour.HSV_to_RGB.rst b/docs/generated/colour.HSV_to_RGB.rst deleted file mode 100644 index 66dbe16821..0000000000 --- a/docs/generated/colour.HSV_to_RGB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.HSV\_to\_RGB -=================== - -.. currentmodule:: colour - -.. autofunction:: HSV_to_RGB \ No newline at end of file diff --git a/docs/generated/colour.HUNTERLAB_ILLUMINANTS.rst b/docs/generated/colour.HUNTERLAB_ILLUMINANTS.rst deleted file mode 100644 index 0cd04f0115..0000000000 --- a/docs/generated/colour.HUNTERLAB_ILLUMINANTS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.HUNTERLAB\_ILLUMINANTS -============================= - -.. currentmodule:: colour - -.. autodata:: HUNTERLAB_ILLUMINANTS \ No newline at end of file diff --git a/docs/generated/colour.HUNT_VIEWING_CONDITIONS.rst b/docs/generated/colour.HUNT_VIEWING_CONDITIONS.rst deleted file mode 100644 index f990f06386..0000000000 --- a/docs/generated/colour.HUNT_VIEWING_CONDITIONS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.HUNT\_VIEWING\_CONDITIONS -================================ - -.. currentmodule:: colour - -.. autodata:: HUNT_VIEWING_CONDITIONS \ No newline at end of file diff --git a/docs/generated/colour.Hunt_Specification.rst b/docs/generated/colour.Hunt_Specification.rst deleted file mode 100644 index 96093bd57c..0000000000 --- a/docs/generated/colour.Hunt_Specification.rst +++ /dev/null @@ -1,36 +0,0 @@ -colour.Hunt\_Specification -========================== - -.. currentmodule:: colour - -.. autoclass:: Hunt_Specification - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~Hunt_Specification.count - ~Hunt_Specification.index - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~Hunt_Specification.C - ~Hunt_Specification.H - ~Hunt_Specification.HC - ~Hunt_Specification.J - ~Hunt_Specification.M - ~Hunt_Specification.Q - ~Hunt_Specification.h - ~Hunt_Specification.s - - \ No newline at end of file diff --git a/docs/generated/colour.Hunter_Lab_to_XYZ.rst b/docs/generated/colour.Hunter_Lab_to_XYZ.rst deleted file mode 100644 index 4482b346ea..0000000000 --- a/docs/generated/colour.Hunter_Lab_to_XYZ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.Hunter\_Lab\_to\_XYZ -=========================== - -.. currentmodule:: colour - -.. autofunction:: Hunter_Lab_to_XYZ \ No newline at end of file diff --git a/docs/generated/colour.Hunter_Rdab_to_XYZ.rst b/docs/generated/colour.Hunter_Rdab_to_XYZ.rst deleted file mode 100644 index 538f8c26c6..0000000000 --- a/docs/generated/colour.Hunter_Rdab_to_XYZ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.Hunter\_Rdab\_to\_XYZ -============================ - -.. currentmodule:: colour - -.. autofunction:: Hunter_Rdab_to_XYZ \ No newline at end of file diff --git a/docs/generated/colour.ICTCP_to_RGB.rst b/docs/generated/colour.ICTCP_to_RGB.rst deleted file mode 100644 index f99e1c076e..0000000000 --- a/docs/generated/colour.ICTCP_to_RGB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.ICTCP\_to\_RGB -===================== - -.. currentmodule:: colour - -.. autofunction:: ICTCP_to_RGB \ No newline at end of file diff --git a/docs/generated/colour.ILLUMINANTS.rst b/docs/generated/colour.ILLUMINANTS.rst deleted file mode 100644 index 6227e33353..0000000000 --- a/docs/generated/colour.ILLUMINANTS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.ILLUMINANTS -================== - -.. currentmodule:: colour - -.. autodata:: ILLUMINANTS \ No newline at end of file diff --git a/docs/generated/colour.ILLUMINANTS_OPTIMAL_COLOUR_STIMULI.rst b/docs/generated/colour.ILLUMINANTS_OPTIMAL_COLOUR_STIMULI.rst deleted file mode 100644 index c4a3b615ac..0000000000 --- a/docs/generated/colour.ILLUMINANTS_OPTIMAL_COLOUR_STIMULI.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.ILLUMINANTS\_OPTIMAL\_COLOUR\_STIMULI -============================================ - -.. currentmodule:: colour - -.. autodata:: ILLUMINANTS_OPTIMAL_COLOUR_STIMULI \ No newline at end of file diff --git a/docs/generated/colour.ILLUMINANTS_SDS.rst b/docs/generated/colour.ILLUMINANTS_SDS.rst deleted file mode 100644 index 44345aa2f0..0000000000 --- a/docs/generated/colour.ILLUMINANTS_SDS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.ILLUMINANTS\_SDS -======================= - -.. currentmodule:: colour - -.. autodata:: ILLUMINANTS_SDS \ No newline at end of file diff --git a/docs/generated/colour.IPT_hue_angle.rst b/docs/generated/colour.IPT_hue_angle.rst deleted file mode 100644 index dd859364df..0000000000 --- a/docs/generated/colour.IPT_hue_angle.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.IPT\_hue\_angle -====================== - -.. currentmodule:: colour - -.. autofunction:: IPT_hue_angle \ No newline at end of file diff --git a/docs/generated/colour.IPT_to_XYZ.rst b/docs/generated/colour.IPT_to_XYZ.rst deleted file mode 100644 index cf07c08337..0000000000 --- a/docs/generated/colour.IPT_to_XYZ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.IPT\_to\_XYZ -=================== - -.. currentmodule:: colour - -.. autofunction:: IPT_to_XYZ \ No newline at end of file diff --git a/docs/generated/colour.JMh_CAM16_to_CAM16LCD.rst b/docs/generated/colour.JMh_CAM16_to_CAM16LCD.rst deleted file mode 100644 index c94afd635c..0000000000 --- a/docs/generated/colour.JMh_CAM16_to_CAM16LCD.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.JMh\_CAM16\_to\_CAM16LCD -=============================== - -.. currentmodule:: colour - -.. autofunction:: JMh_CAM16_to_CAM16LCD \ No newline at end of file diff --git a/docs/generated/colour.JMh_CAM16_to_CAM16SCD.rst b/docs/generated/colour.JMh_CAM16_to_CAM16SCD.rst deleted file mode 100644 index 764af051eb..0000000000 --- a/docs/generated/colour.JMh_CAM16_to_CAM16SCD.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.JMh\_CAM16\_to\_CAM16SCD -=============================== - -.. currentmodule:: colour - -.. autofunction:: JMh_CAM16_to_CAM16SCD \ No newline at end of file diff --git a/docs/generated/colour.JMh_CAM16_to_CAM16UCS.rst b/docs/generated/colour.JMh_CAM16_to_CAM16UCS.rst deleted file mode 100644 index fde3fa0d40..0000000000 --- a/docs/generated/colour.JMh_CAM16_to_CAM16UCS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.JMh\_CAM16\_to\_CAM16UCS -=============================== - -.. currentmodule:: colour - -.. autofunction:: JMh_CAM16_to_CAM16UCS \ No newline at end of file diff --git a/docs/generated/colour.JMh_CIECAM02_to_CAM02LCD.rst b/docs/generated/colour.JMh_CIECAM02_to_CAM02LCD.rst deleted file mode 100644 index 8d8dabd381..0000000000 --- a/docs/generated/colour.JMh_CIECAM02_to_CAM02LCD.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.JMh\_CIECAM02\_to\_CAM02LCD -================================== - -.. currentmodule:: colour - -.. autofunction:: JMh_CIECAM02_to_CAM02LCD \ No newline at end of file diff --git a/docs/generated/colour.JMh_CIECAM02_to_CAM02SCD.rst b/docs/generated/colour.JMh_CIECAM02_to_CAM02SCD.rst deleted file mode 100644 index 2d5eda6889..0000000000 --- a/docs/generated/colour.JMh_CIECAM02_to_CAM02SCD.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.JMh\_CIECAM02\_to\_CAM02SCD -================================== - -.. currentmodule:: colour - -.. autofunction:: JMh_CIECAM02_to_CAM02SCD \ No newline at end of file diff --git a/docs/generated/colour.JMh_CIECAM02_to_CAM02UCS.rst b/docs/generated/colour.JMh_CIECAM02_to_CAM02UCS.rst deleted file mode 100644 index ce4d99da7a..0000000000 --- a/docs/generated/colour.JMh_CIECAM02_to_CAM02UCS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.JMh\_CIECAM02\_to\_CAM02UCS -================================== - -.. currentmodule:: colour - -.. autofunction:: JMh_CIECAM02_to_CAM02UCS \ No newline at end of file diff --git a/docs/generated/colour.JzAzBz_to_XYZ.rst b/docs/generated/colour.JzAzBz_to_XYZ.rst deleted file mode 100644 index 50ba38ee77..0000000000 --- a/docs/generated/colour.JzAzBz_to_XYZ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.JzAzBz\_to\_XYZ -====================== - -.. currentmodule:: colour - -.. autofunction:: JzAzBz_to_XYZ \ No newline at end of file diff --git a/docs/generated/colour.KernelInterpolator.rst b/docs/generated/colour.KernelInterpolator.rst deleted file mode 100644 index c4236a9913..0000000000 --- a/docs/generated/colour.KernelInterpolator.rst +++ /dev/null @@ -1,33 +0,0 @@ -colour.KernelInterpolator -========================= - -.. currentmodule:: colour - -.. autoclass:: KernelInterpolator - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~KernelInterpolator.__init__ - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~KernelInterpolator.kernel - ~KernelInterpolator.kernel_args - ~KernelInterpolator.padding_args - ~KernelInterpolator.window - ~KernelInterpolator.x - ~KernelInterpolator.y - - \ No newline at end of file diff --git a/docs/generated/colour.LCHab_to_Lab.rst b/docs/generated/colour.LCHab_to_Lab.rst deleted file mode 100644 index 0b5f9ee7dc..0000000000 --- a/docs/generated/colour.LCHab_to_Lab.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.LCHab\_to\_Lab -===================== - -.. currentmodule:: colour - -.. autofunction:: LCHab_to_Lab \ No newline at end of file diff --git a/docs/generated/colour.LCHuv_to_Luv.rst b/docs/generated/colour.LCHuv_to_Luv.rst deleted file mode 100644 index 50f9909e33..0000000000 --- a/docs/generated/colour.LCHuv_to_Luv.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.LCHuv\_to\_Luv -===================== - -.. currentmodule:: colour - -.. autofunction:: LCHuv_to_Luv \ No newline at end of file diff --git a/docs/generated/colour.LEFS.rst b/docs/generated/colour.LEFS.rst deleted file mode 100644 index c247b5d659..0000000000 --- a/docs/generated/colour.LEFS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.LEFS -=========== - -.. currentmodule:: colour - -.. autodata:: LEFS \ No newline at end of file diff --git a/docs/generated/colour.LIGHTNESS_METHODS.rst b/docs/generated/colour.LIGHTNESS_METHODS.rst deleted file mode 100644 index 64182bb206..0000000000 --- a/docs/generated/colour.LIGHTNESS_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.LIGHTNESS\_METHODS -========================= - -.. currentmodule:: colour - -.. autodata:: LIGHTNESS_METHODS \ No newline at end of file diff --git a/docs/generated/colour.LIGHT_SOURCES.rst b/docs/generated/colour.LIGHT_SOURCES.rst deleted file mode 100644 index 3acb5fb39d..0000000000 --- a/docs/generated/colour.LIGHT_SOURCES.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.LIGHT\_SOURCES -===================== - -.. currentmodule:: colour - -.. autodata:: LIGHT_SOURCES \ No newline at end of file diff --git a/docs/generated/colour.LIGHT_SOURCES_SDS.rst b/docs/generated/colour.LIGHT_SOURCES_SDS.rst deleted file mode 100644 index bdc5a1cf45..0000000000 --- a/docs/generated/colour.LIGHT_SOURCES_SDS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.LIGHT\_SOURCES\_SDS -========================== - -.. currentmodule:: colour - -.. autodata:: LIGHT_SOURCES_SDS \ No newline at end of file diff --git a/docs/generated/colour.LLAB_Specification.rst b/docs/generated/colour.LLAB_Specification.rst deleted file mode 100644 index e0f8b5e3cd..0000000000 --- a/docs/generated/colour.LLAB_Specification.rst +++ /dev/null @@ -1,36 +0,0 @@ -colour.LLAB\_Specification -========================== - -.. currentmodule:: colour - -.. autoclass:: LLAB_Specification - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~LLAB_Specification.count - ~LLAB_Specification.index - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~LLAB_Specification.C - ~LLAB_Specification.HC - ~LLAB_Specification.J - ~LLAB_Specification.M - ~LLAB_Specification.a - ~LLAB_Specification.b - ~LLAB_Specification.h - ~LLAB_Specification.s - - \ No newline at end of file diff --git a/docs/generated/colour.LLAB_VIEWING_CONDITIONS.rst b/docs/generated/colour.LLAB_VIEWING_CONDITIONS.rst deleted file mode 100644 index bf53923e7e..0000000000 --- a/docs/generated/colour.LLAB_VIEWING_CONDITIONS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.LLAB\_VIEWING\_CONDITIONS -================================ - -.. currentmodule:: colour - -.. autodata:: LLAB_VIEWING_CONDITIONS \ No newline at end of file diff --git a/docs/generated/colour.LMS_CMFS.rst b/docs/generated/colour.LMS_CMFS.rst deleted file mode 100644 index 4a027ae6e2..0000000000 --- a/docs/generated/colour.LMS_CMFS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.LMS\_CMFS -================ - -.. currentmodule:: colour - -.. autodata:: LMS_CMFS \ No newline at end of file diff --git a/docs/generated/colour.LOG_DECODING_CURVES.rst b/docs/generated/colour.LOG_DECODING_CURVES.rst deleted file mode 100644 index 8972c7b485..0000000000 --- a/docs/generated/colour.LOG_DECODING_CURVES.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.LOG\_DECODING\_CURVES -============================ - -.. currentmodule:: colour - -.. autodata:: LOG_DECODING_CURVES \ No newline at end of file diff --git a/docs/generated/colour.LOG_ENCODING_CURVES.rst b/docs/generated/colour.LOG_ENCODING_CURVES.rst deleted file mode 100644 index b76f0c8972..0000000000 --- a/docs/generated/colour.LOG_ENCODING_CURVES.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.LOG\_ENCODING\_CURVES -============================ - -.. currentmodule:: colour - -.. autodata:: LOG_ENCODING_CURVES \ No newline at end of file diff --git a/docs/generated/colour.LUMINANCE_METHODS.rst b/docs/generated/colour.LUMINANCE_METHODS.rst deleted file mode 100644 index 7b004bac2e..0000000000 --- a/docs/generated/colour.LUMINANCE_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.LUMINANCE\_METHODS -========================= - -.. currentmodule:: colour - -.. autodata:: LUMINANCE_METHODS \ No newline at end of file diff --git a/docs/generated/colour.LUT1D.rst b/docs/generated/colour.LUT1D.rst deleted file mode 100644 index fbf180c947..0000000000 --- a/docs/generated/colour.LUT1D.rst +++ /dev/null @@ -1,39 +0,0 @@ -colour.LUT1D -============ - -.. currentmodule:: colour - -.. autoclass:: LUT1D - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~LUT1D.__init__ - ~LUT1D.apply - ~LUT1D.arithmetical_operation - ~LUT1D.as_LUT - ~LUT1D.copy - ~LUT1D.is_domain_explicit - ~LUT1D.linear_table - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~LUT1D.comments - ~LUT1D.dimensions - ~LUT1D.domain - ~LUT1D.name - ~LUT1D.size - ~LUT1D.table - - \ No newline at end of file diff --git a/docs/generated/colour.LUT3D.rst b/docs/generated/colour.LUT3D.rst deleted file mode 100644 index a8b97bf06b..0000000000 --- a/docs/generated/colour.LUT3D.rst +++ /dev/null @@ -1,39 +0,0 @@ -colour.LUT3D -============ - -.. currentmodule:: colour - -.. autoclass:: LUT3D - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~LUT3D.__init__ - ~LUT3D.apply - ~LUT3D.arithmetical_operation - ~LUT3D.as_LUT - ~LUT3D.copy - ~LUT3D.is_domain_explicit - ~LUT3D.linear_table - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~LUT3D.comments - ~LUT3D.dimensions - ~LUT3D.domain - ~LUT3D.name - ~LUT3D.size - ~LUT3D.table - - \ No newline at end of file diff --git a/docs/generated/colour.LUT3x1D.rst b/docs/generated/colour.LUT3x1D.rst deleted file mode 100644 index eb9645f97f..0000000000 --- a/docs/generated/colour.LUT3x1D.rst +++ /dev/null @@ -1,39 +0,0 @@ -colour.LUT3x1D -============== - -.. currentmodule:: colour - -.. autoclass:: LUT3x1D - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~LUT3x1D.__init__ - ~LUT3x1D.apply - ~LUT3x1D.arithmetical_operation - ~LUT3x1D.as_LUT - ~LUT3x1D.copy - ~LUT3x1D.is_domain_explicit - ~LUT3x1D.linear_table - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~LUT3x1D.comments - ~LUT3x1D.dimensions - ~LUT3x1D.domain - ~LUT3x1D.name - ~LUT3x1D.size - ~LUT3x1D.table - - \ No newline at end of file diff --git a/docs/generated/colour.LUTSequence.rst b/docs/generated/colour.LUTSequence.rst deleted file mode 100644 index 286fe04036..0000000000 --- a/docs/generated/colour.LUTSequence.rst +++ /dev/null @@ -1,39 +0,0 @@ -colour.LUTSequence -================== - -.. currentmodule:: colour - -.. autoclass:: LUTSequence - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~LUTSequence.__init__ - ~LUTSequence.append - ~LUTSequence.apply - ~LUTSequence.clear - ~LUTSequence.copy - ~LUTSequence.count - ~LUTSequence.extend - ~LUTSequence.index - ~LUTSequence.insert - ~LUTSequence.pop - ~LUTSequence.remove - ~LUTSequence.reverse - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~LUTSequence.sequence - - \ No newline at end of file diff --git a/docs/generated/colour.Lab_to_DIN99.rst b/docs/generated/colour.Lab_to_DIN99.rst deleted file mode 100644 index 775579f90c..0000000000 --- a/docs/generated/colour.Lab_to_DIN99.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.Lab\_to\_DIN99 -===================== - -.. currentmodule:: colour - -.. autofunction:: Lab_to_DIN99 \ No newline at end of file diff --git a/docs/generated/colour.Lab_to_LCHab.rst b/docs/generated/colour.Lab_to_LCHab.rst deleted file mode 100644 index 9a5130816e..0000000000 --- a/docs/generated/colour.Lab_to_LCHab.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.Lab\_to\_LCHab -===================== - -.. currentmodule:: colour - -.. autofunction:: Lab_to_LCHab \ No newline at end of file diff --git a/docs/generated/colour.Lab_to_XYZ.rst b/docs/generated/colour.Lab_to_XYZ.rst deleted file mode 100644 index bfcabbb78f..0000000000 --- a/docs/generated/colour.Lab_to_XYZ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.Lab\_to\_XYZ -=================== - -.. currentmodule:: colour - -.. autofunction:: Lab_to_XYZ \ No newline at end of file diff --git a/docs/generated/colour.LinearInterpolator.rst b/docs/generated/colour.LinearInterpolator.rst deleted file mode 100644 index 9bc6589fe6..0000000000 --- a/docs/generated/colour.LinearInterpolator.rst +++ /dev/null @@ -1,29 +0,0 @@ -colour.LinearInterpolator -========================= - -.. currentmodule:: colour - -.. autoclass:: LinearInterpolator - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~LinearInterpolator.__init__ - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~LinearInterpolator.x - ~LinearInterpolator.y - - \ No newline at end of file diff --git a/docs/generated/colour.Luv_to_LCHuv.rst b/docs/generated/colour.Luv_to_LCHuv.rst deleted file mode 100644 index 23d20866d2..0000000000 --- a/docs/generated/colour.Luv_to_LCHuv.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.Luv\_to\_LCHuv -===================== - -.. currentmodule:: colour - -.. autofunction:: Luv_to_LCHuv \ No newline at end of file diff --git a/docs/generated/colour.Luv_to_XYZ.rst b/docs/generated/colour.Luv_to_XYZ.rst deleted file mode 100644 index dc40c181d3..0000000000 --- a/docs/generated/colour.Luv_to_XYZ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.Luv\_to\_XYZ -=================== - -.. currentmodule:: colour - -.. autofunction:: Luv_to_XYZ \ No newline at end of file diff --git a/docs/generated/colour.Luv_to_uv.rst b/docs/generated/colour.Luv_to_uv.rst deleted file mode 100644 index ddd9bfe3c3..0000000000 --- a/docs/generated/colour.Luv_to_uv.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.Luv\_to\_uv -================== - -.. currentmodule:: colour - -.. autofunction:: Luv_to_uv \ No newline at end of file diff --git a/docs/generated/colour.Luv_uv_to_xy.rst b/docs/generated/colour.Luv_uv_to_xy.rst deleted file mode 100644 index aa9d4bbff7..0000000000 --- a/docs/generated/colour.Luv_uv_to_xy.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.Luv\_uv\_to\_xy -====================== - -.. currentmodule:: colour - -.. autofunction:: Luv_uv_to_xy \ No newline at end of file diff --git a/docs/generated/colour.MULTI_SD_TO_XYZ_METHODS.rst b/docs/generated/colour.MULTI_SD_TO_XYZ_METHODS.rst deleted file mode 100644 index d853fc6766..0000000000 --- a/docs/generated/colour.MULTI_SD_TO_XYZ_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.MULTI\_SD\_TO\_XYZ\_METHODS -================================== - -.. currentmodule:: colour - -.. autodata:: MULTI_SD_TO_XYZ_METHODS \ No newline at end of file diff --git a/docs/generated/colour.MUNSELL_COLOURS.rst b/docs/generated/colour.MUNSELL_COLOURS.rst deleted file mode 100644 index 220aed53c4..0000000000 --- a/docs/generated/colour.MUNSELL_COLOURS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.MUNSELL\_COLOURS -======================= - -.. currentmodule:: colour - -.. autodata:: MUNSELL_COLOURS \ No newline at end of file diff --git a/docs/generated/colour.MUNSELL_VALUE_METHODS.rst b/docs/generated/colour.MUNSELL_VALUE_METHODS.rst deleted file mode 100644 index 3483fedb9a..0000000000 --- a/docs/generated/colour.MUNSELL_VALUE_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.MUNSELL\_VALUE\_METHODS -============================== - -.. currentmodule:: colour - -.. autodata:: MUNSELL_VALUE_METHODS \ No newline at end of file diff --git a/docs/generated/colour.MultiSpectralDistribution.rst b/docs/generated/colour.MultiSpectralDistribution.rst deleted file mode 100644 index ea24bee14c..0000000000 --- a/docs/generated/colour.MultiSpectralDistribution.rst +++ /dev/null @@ -1,68 +0,0 @@ -colour.MultiSpectralDistribution -================================ - -.. currentmodule:: colour - -.. autoclass:: MultiSpectralDistribution - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~MultiSpectralDistribution.__init__ - ~MultiSpectralDistribution.align - ~MultiSpectralDistribution.arithmetical_operation - ~MultiSpectralDistribution.clone - ~MultiSpectralDistribution.copy - ~MultiSpectralDistribution.domain_distance - ~MultiSpectralDistribution.extrapolate - ~MultiSpectralDistribution.fill_nan - ~MultiSpectralDistribution.get - ~MultiSpectralDistribution.interpolate - ~MultiSpectralDistribution.is_uniform - ~MultiSpectralDistribution.multi_signal_unpack_data - ~MultiSpectralDistribution.normalise - ~MultiSpectralDistribution.to_dataframe - ~MultiSpectralDistribution.to_sds - ~MultiSpectralDistribution.trim - ~MultiSpectralDistribution.trim_wavelengths - ~MultiSpectralDistribution.zeros - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~MultiSpectralDistribution.data - ~MultiSpectralDistribution.domain - ~MultiSpectralDistribution.dtype - ~MultiSpectralDistribution.extrapolator - ~MultiSpectralDistribution.extrapolator_args - ~MultiSpectralDistribution.function - ~MultiSpectralDistribution.interpolator - ~MultiSpectralDistribution.interpolator_args - ~MultiSpectralDistribution.items - ~MultiSpectralDistribution.labels - ~MultiSpectralDistribution.mapping - ~MultiSpectralDistribution.name - ~MultiSpectralDistribution.range - ~MultiSpectralDistribution.shape - ~MultiSpectralDistribution.signal_type - ~MultiSpectralDistribution.signals - ~MultiSpectralDistribution.strict_labels - ~MultiSpectralDistribution.strict_name - ~MultiSpectralDistribution.title - ~MultiSpectralDistribution.values - ~MultiSpectralDistribution.wavelengths - ~MultiSpectralDistribution.x - ~MultiSpectralDistribution.y - ~MultiSpectralDistribution.z - - \ No newline at end of file diff --git a/docs/generated/colour.Nayatani95_Specification.rst b/docs/generated/colour.Nayatani95_Specification.rst deleted file mode 100644 index ba6d3d1b21..0000000000 --- a/docs/generated/colour.Nayatani95_Specification.rst +++ /dev/null @@ -1,37 +0,0 @@ -colour.Nayatani95\_Specification -================================ - -.. currentmodule:: colour - -.. autoclass:: Nayatani95_Specification - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~Nayatani95_Specification.count - ~Nayatani95_Specification.index - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~Nayatani95_Specification.C - ~Nayatani95_Specification.H - ~Nayatani95_Specification.HC - ~Nayatani95_Specification.L_star_N - ~Nayatani95_Specification.L_star_P - ~Nayatani95_Specification.M - ~Nayatani95_Specification.Q - ~Nayatani95_Specification.h - ~Nayatani95_Specification.s - - \ No newline at end of file diff --git a/docs/generated/colour.NearestNeighbourInterpolator.rst b/docs/generated/colour.NearestNeighbourInterpolator.rst deleted file mode 100644 index b7fc55d1ec..0000000000 --- a/docs/generated/colour.NearestNeighbourInterpolator.rst +++ /dev/null @@ -1,33 +0,0 @@ -colour.NearestNeighbourInterpolator -=================================== - -.. currentmodule:: colour - -.. autoclass:: NearestNeighbourInterpolator - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~NearestNeighbourInterpolator.__init__ - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~NearestNeighbourInterpolator.kernel - ~NearestNeighbourInterpolator.kernel_args - ~NearestNeighbourInterpolator.padding_args - ~NearestNeighbourInterpolator.window - ~NearestNeighbourInterpolator.x - ~NearestNeighbourInterpolator.y - - \ No newline at end of file diff --git a/docs/generated/colour.NullInterpolator.rst b/docs/generated/colour.NullInterpolator.rst deleted file mode 100644 index 6c523d0167..0000000000 --- a/docs/generated/colour.NullInterpolator.rst +++ /dev/null @@ -1,32 +0,0 @@ -colour.NullInterpolator -======================= - -.. currentmodule:: colour - -.. autoclass:: NullInterpolator - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~NullInterpolator.__init__ - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~NullInterpolator.absolute_tolerance - ~NullInterpolator.default - ~NullInterpolator.relative_tolerance - ~NullInterpolator.x - ~NullInterpolator.y - - \ No newline at end of file diff --git a/docs/generated/colour.OETFS.rst b/docs/generated/colour.OETFS.rst deleted file mode 100644 index b7f8ab1b15..0000000000 --- a/docs/generated/colour.OETFS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.OETFS -============ - -.. currentmodule:: colour - -.. autodata:: OETFS \ No newline at end of file diff --git a/docs/generated/colour.OETFS_REVERSE.rst b/docs/generated/colour.OETFS_REVERSE.rst deleted file mode 100644 index 8671a66949..0000000000 --- a/docs/generated/colour.OETFS_REVERSE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.OETFS\_REVERSE -===================== - -.. currentmodule:: colour - -.. autodata:: OETFS_REVERSE \ No newline at end of file diff --git a/docs/generated/colour.OOTFS.rst b/docs/generated/colour.OOTFS.rst deleted file mode 100644 index 793b23e25f..0000000000 --- a/docs/generated/colour.OOTFS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.OOTFS -============ - -.. currentmodule:: colour - -.. autodata:: OOTFS \ No newline at end of file diff --git a/docs/generated/colour.OOTFS_REVERSE.rst b/docs/generated/colour.OOTFS_REVERSE.rst deleted file mode 100644 index bea267a2e7..0000000000 --- a/docs/generated/colour.OOTFS_REVERSE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.OOTFS\_REVERSE -===================== - -.. currentmodule:: colour - -.. autodata:: OOTFS_REVERSE \ No newline at end of file diff --git a/docs/generated/colour.OSA_UCS_to_XYZ.rst b/docs/generated/colour.OSA_UCS_to_XYZ.rst deleted file mode 100644 index 873530ecbf..0000000000 --- a/docs/generated/colour.OSA_UCS_to_XYZ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.OSA\_UCS\_to\_XYZ -======================== - -.. currentmodule:: colour - -.. autofunction:: OSA_UCS_to_XYZ \ No newline at end of file diff --git a/docs/generated/colour.PHOTOPIC_LEFS.rst b/docs/generated/colour.PHOTOPIC_LEFS.rst deleted file mode 100644 index 91f5c7cecc..0000000000 --- a/docs/generated/colour.PHOTOPIC_LEFS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.PHOTOPIC\_LEFS -===================== - -.. currentmodule:: colour - -.. autodata:: PHOTOPIC_LEFS \ No newline at end of file diff --git a/docs/generated/colour.POINTER_GAMUT_BOUNDARIES.rst b/docs/generated/colour.POINTER_GAMUT_BOUNDARIES.rst deleted file mode 100644 index 72efd1738e..0000000000 --- a/docs/generated/colour.POINTER_GAMUT_BOUNDARIES.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.POINTER\_GAMUT\_BOUNDARIES -================================= - -.. currentmodule:: colour - -.. autodata:: POINTER_GAMUT_BOUNDARIES \ No newline at end of file diff --git a/docs/generated/colour.POINTER_GAMUT_DATA.rst b/docs/generated/colour.POINTER_GAMUT_DATA.rst deleted file mode 100644 index 5089fb0487..0000000000 --- a/docs/generated/colour.POINTER_GAMUT_DATA.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.POINTER\_GAMUT\_DATA -=========================== - -.. currentmodule:: colour - -.. autodata:: POINTER_GAMUT_DATA \ No newline at end of file diff --git a/docs/generated/colour.POINTER_GAMUT_ILLUMINANT.rst b/docs/generated/colour.POINTER_GAMUT_ILLUMINANT.rst deleted file mode 100644 index 895db76227..0000000000 --- a/docs/generated/colour.POINTER_GAMUT_ILLUMINANT.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.POINTER\_GAMUT\_ILLUMINANT -================================= - -.. currentmodule:: colour - -.. autodata:: POINTER_GAMUT_ILLUMINANT \ No newline at end of file diff --git a/docs/generated/colour.POLYNOMIAL_EXPANSION_METHODS.rst b/docs/generated/colour.POLYNOMIAL_EXPANSION_METHODS.rst deleted file mode 100644 index 94801a1607..0000000000 --- a/docs/generated/colour.POLYNOMIAL_EXPANSION_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.POLYNOMIAL\_EXPANSION\_METHODS -===================================== - -.. currentmodule:: colour - -.. autodata:: POLYNOMIAL_EXPANSION_METHODS \ No newline at end of file diff --git a/docs/generated/colour.PchipInterpolator.rst b/docs/generated/colour.PchipInterpolator.rst deleted file mode 100644 index 527528623b..0000000000 --- a/docs/generated/colour.PchipInterpolator.rst +++ /dev/null @@ -1,40 +0,0 @@ -colour.PchipInterpolator -======================== - -.. currentmodule:: colour - -.. autoclass:: PchipInterpolator - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~PchipInterpolator.__init__ - ~PchipInterpolator.antiderivative - ~PchipInterpolator.construct_fast - ~PchipInterpolator.derivative - ~PchipInterpolator.extend - ~PchipInterpolator.from_derivatives - ~PchipInterpolator.from_power_basis - ~PchipInterpolator.integrate - ~PchipInterpolator.roots - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~PchipInterpolator.axis - ~PchipInterpolator.c - ~PchipInterpolator.extrapolate - ~PchipInterpolator.x - ~PchipInterpolator.y - - \ No newline at end of file diff --git a/docs/generated/colour.Prismatic_to_RGB.rst b/docs/generated/colour.Prismatic_to_RGB.rst deleted file mode 100644 index 431b556542..0000000000 --- a/docs/generated/colour.Prismatic_to_RGB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.Prismatic\_to\_RGB -========================= - -.. currentmodule:: colour - -.. autofunction:: Prismatic_to_RGB \ No newline at end of file diff --git a/docs/generated/colour.RGB_CMFS.rst b/docs/generated/colour.RGB_CMFS.rst deleted file mode 100644 index 899adcb0fc..0000000000 --- a/docs/generated/colour.RGB_CMFS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.RGB\_CMFS -================ - -.. currentmodule:: colour - -.. autodata:: RGB_CMFS \ No newline at end of file diff --git a/docs/generated/colour.RGB_COLOURSPACES.rst b/docs/generated/colour.RGB_COLOURSPACES.rst deleted file mode 100644 index 1963d0795e..0000000000 --- a/docs/generated/colour.RGB_COLOURSPACES.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.RGB\_COLOURSPACES -======================== - -.. currentmodule:: colour - -.. autodata:: RGB_COLOURSPACES \ No newline at end of file diff --git a/docs/generated/colour.RGB_Colourspace.rst b/docs/generated/colour.RGB_Colourspace.rst deleted file mode 100644 index 28001bdc86..0000000000 --- a/docs/generated/colour.RGB_Colourspace.rst +++ /dev/null @@ -1,41 +0,0 @@ -colour.RGB\_Colourspace -======================= - -.. currentmodule:: colour - -.. autoclass:: RGB_Colourspace - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~RGB_Colourspace.__init__ - ~RGB_Colourspace.chromatically_adapt - ~RGB_Colourspace.copy - ~RGB_Colourspace.use_derived_transformation_matrices - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~RGB_Colourspace.RGB_to_XYZ_matrix - ~RGB_Colourspace.XYZ_to_RGB_matrix - ~RGB_Colourspace.decoding_cctf - ~RGB_Colourspace.encoding_cctf - ~RGB_Colourspace.illuminant - ~RGB_Colourspace.name - ~RGB_Colourspace.primaries - ~RGB_Colourspace.use_derived_RGB_to_XYZ_matrix - ~RGB_Colourspace.use_derived_XYZ_to_RGB_matrix - ~RGB_Colourspace.whitepoint - ~RGB_Colourspace.whitepoint_name - - \ No newline at end of file diff --git a/docs/generated/colour.RGB_colourspace_limits.rst b/docs/generated/colour.RGB_colourspace_limits.rst deleted file mode 100644 index b36b9e4fe6..0000000000 --- a/docs/generated/colour.RGB_colourspace_limits.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.RGB\_colourspace\_limits -=============================== - -.. currentmodule:: colour - -.. autofunction:: RGB_colourspace_limits \ No newline at end of file diff --git a/docs/generated/colour.RGB_colourspace_pointer_gamut_coverage_MonteCarlo.rst b/docs/generated/colour.RGB_colourspace_pointer_gamut_coverage_MonteCarlo.rst deleted file mode 100644 index 874adff6cb..0000000000 --- a/docs/generated/colour.RGB_colourspace_pointer_gamut_coverage_MonteCarlo.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.RGB\_colourspace\_pointer\_gamut\_coverage\_MonteCarlo -============================================================= - -.. currentmodule:: colour - -.. autofunction:: RGB_colourspace_pointer_gamut_coverage_MonteCarlo \ No newline at end of file diff --git a/docs/generated/colour.RGB_colourspace_visible_spectrum_coverage_MonteCarlo.rst b/docs/generated/colour.RGB_colourspace_visible_spectrum_coverage_MonteCarlo.rst deleted file mode 100644 index fe39f62d1f..0000000000 --- a/docs/generated/colour.RGB_colourspace_visible_spectrum_coverage_MonteCarlo.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.RGB\_colourspace\_visible\_spectrum\_coverage\_MonteCarlo -================================================================ - -.. currentmodule:: colour - -.. autofunction:: RGB_colourspace_visible_spectrum_coverage_MonteCarlo \ No newline at end of file diff --git a/docs/generated/colour.RGB_colourspace_volume_MonteCarlo.rst b/docs/generated/colour.RGB_colourspace_volume_MonteCarlo.rst deleted file mode 100644 index 62e0ec8173..0000000000 --- a/docs/generated/colour.RGB_colourspace_volume_MonteCarlo.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.RGB\_colourspace\_volume\_MonteCarlo -=========================================== - -.. currentmodule:: colour - -.. autofunction:: RGB_colourspace_volume_MonteCarlo \ No newline at end of file diff --git a/docs/generated/colour.RGB_colourspace_volume_coverage_MonteCarlo.rst b/docs/generated/colour.RGB_colourspace_volume_coverage_MonteCarlo.rst deleted file mode 100644 index 5c467e2f14..0000000000 --- a/docs/generated/colour.RGB_colourspace_volume_coverage_MonteCarlo.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.RGB\_colourspace\_volume\_coverage\_MonteCarlo -===================================================== - -.. currentmodule:: colour - -.. autofunction:: RGB_colourspace_volume_coverage_MonteCarlo \ No newline at end of file diff --git a/docs/generated/colour.RGB_luminance.rst b/docs/generated/colour.RGB_luminance.rst deleted file mode 100644 index 631b9dc58f..0000000000 --- a/docs/generated/colour.RGB_luminance.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.RGB\_luminance -===================== - -.. currentmodule:: colour - -.. autofunction:: RGB_luminance \ No newline at end of file diff --git a/docs/generated/colour.RGB_luminance_equation.rst b/docs/generated/colour.RGB_luminance_equation.rst deleted file mode 100644 index dc648c4b98..0000000000 --- a/docs/generated/colour.RGB_luminance_equation.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.RGB\_luminance\_equation -=============================== - -.. currentmodule:: colour - -.. autofunction:: RGB_luminance_equation \ No newline at end of file diff --git a/docs/generated/colour.RGB_to_CMY.rst b/docs/generated/colour.RGB_to_CMY.rst deleted file mode 100644 index ec672033db..0000000000 --- a/docs/generated/colour.RGB_to_CMY.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.RGB\_to\_CMY -=================== - -.. currentmodule:: colour - -.. autofunction:: RGB_to_CMY \ No newline at end of file diff --git a/docs/generated/colour.RGB_to_HSL.rst b/docs/generated/colour.RGB_to_HSL.rst deleted file mode 100644 index 37d2b6181d..0000000000 --- a/docs/generated/colour.RGB_to_HSL.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.RGB\_to\_HSL -=================== - -.. currentmodule:: colour - -.. autofunction:: RGB_to_HSL \ No newline at end of file diff --git a/docs/generated/colour.RGB_to_HSV.rst b/docs/generated/colour.RGB_to_HSV.rst deleted file mode 100644 index 0a98002026..0000000000 --- a/docs/generated/colour.RGB_to_HSV.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.RGB\_to\_HSV -=================== - -.. currentmodule:: colour - -.. autofunction:: RGB_to_HSV \ No newline at end of file diff --git a/docs/generated/colour.RGB_to_ICTCP.rst b/docs/generated/colour.RGB_to_ICTCP.rst deleted file mode 100644 index 6b0ad060f4..0000000000 --- a/docs/generated/colour.RGB_to_ICTCP.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.RGB\_to\_ICTCP -===================== - -.. currentmodule:: colour - -.. autofunction:: RGB_to_ICTCP \ No newline at end of file diff --git a/docs/generated/colour.RGB_to_Prismatic.rst b/docs/generated/colour.RGB_to_Prismatic.rst deleted file mode 100644 index b34b7c6562..0000000000 --- a/docs/generated/colour.RGB_to_Prismatic.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.RGB\_to\_Prismatic -========================= - -.. currentmodule:: colour - -.. autofunction:: RGB_to_Prismatic \ No newline at end of file diff --git a/docs/generated/colour.RGB_to_RGB.rst b/docs/generated/colour.RGB_to_RGB.rst deleted file mode 100644 index 11a33a5a00..0000000000 --- a/docs/generated/colour.RGB_to_RGB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.RGB\_to\_RGB -=================== - -.. currentmodule:: colour - -.. autofunction:: RGB_to_RGB \ No newline at end of file diff --git a/docs/generated/colour.RGB_to_RGB_matrix.rst b/docs/generated/colour.RGB_to_RGB_matrix.rst deleted file mode 100644 index e2e8b40dda..0000000000 --- a/docs/generated/colour.RGB_to_RGB_matrix.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.RGB\_to\_RGB\_matrix -=========================== - -.. currentmodule:: colour - -.. autofunction:: RGB_to_RGB_matrix \ No newline at end of file diff --git a/docs/generated/colour.RGB_to_XYZ.rst b/docs/generated/colour.RGB_to_XYZ.rst deleted file mode 100644 index 9923670b32..0000000000 --- a/docs/generated/colour.RGB_to_XYZ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.RGB\_to\_XYZ -=================== - -.. currentmodule:: colour - -.. autofunction:: RGB_to_XYZ \ No newline at end of file diff --git a/docs/generated/colour.RGB_to_YCbCr.rst b/docs/generated/colour.RGB_to_YCbCr.rst deleted file mode 100644 index 35b495d837..0000000000 --- a/docs/generated/colour.RGB_to_YCbCr.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.RGB\_to\_YCbCr -===================== - -.. currentmodule:: colour - -.. autofunction:: RGB_to_YCbCr \ No newline at end of file diff --git a/docs/generated/colour.RGB_to_YCoCg.rst b/docs/generated/colour.RGB_to_YCoCg.rst deleted file mode 100644 index 63430fd146..0000000000 --- a/docs/generated/colour.RGB_to_YCoCg.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.RGB\_to\_YCoCg -===================== - -.. currentmodule:: colour - -.. autofunction:: RGB_to_YCoCg \ No newline at end of file diff --git a/docs/generated/colour.RGB_to_YcCbcCrc.rst b/docs/generated/colour.RGB_to_YcCbcCrc.rst deleted file mode 100644 index 1abefcb3b7..0000000000 --- a/docs/generated/colour.RGB_to_YcCbcCrc.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.RGB\_to\_YcCbcCrc -======================== - -.. currentmodule:: colour - -.. autofunction:: RGB_to_YcCbcCrc \ No newline at end of file diff --git a/docs/generated/colour.RLAB_D_FACTOR.rst b/docs/generated/colour.RLAB_D_FACTOR.rst deleted file mode 100644 index be78d0842e..0000000000 --- a/docs/generated/colour.RLAB_D_FACTOR.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.RLAB\_D\_FACTOR -====================== - -.. currentmodule:: colour - -.. autodata:: RLAB_D_FACTOR \ No newline at end of file diff --git a/docs/generated/colour.RLAB_Specification.rst b/docs/generated/colour.RLAB_Specification.rst deleted file mode 100644 index f894d00171..0000000000 --- a/docs/generated/colour.RLAB_Specification.rst +++ /dev/null @@ -1,35 +0,0 @@ -colour.RLAB\_Specification -========================== - -.. currentmodule:: colour - -.. autoclass:: RLAB_Specification - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~RLAB_Specification.count - ~RLAB_Specification.index - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~RLAB_Specification.C - ~RLAB_Specification.HC - ~RLAB_Specification.J - ~RLAB_Specification.a - ~RLAB_Specification.b - ~RLAB_Specification.h - ~RLAB_Specification.s - - \ No newline at end of file diff --git a/docs/generated/colour.RLAB_VIEWING_CONDITIONS.rst b/docs/generated/colour.RLAB_VIEWING_CONDITIONS.rst deleted file mode 100644 index 90f7f0d29e..0000000000 --- a/docs/generated/colour.RLAB_VIEWING_CONDITIONS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.RLAB\_VIEWING\_CONDITIONS -================================ - -.. currentmodule:: colour - -.. autodata:: RLAB_VIEWING_CONDITIONS \ No newline at end of file diff --git a/docs/generated/colour.SCOTOPIC_LEFS.rst b/docs/generated/colour.SCOTOPIC_LEFS.rst deleted file mode 100644 index 19d2cf9b48..0000000000 --- a/docs/generated/colour.SCOTOPIC_LEFS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.SCOTOPIC\_LEFS -===================== - -.. currentmodule:: colour - -.. autodata:: SCOTOPIC_LEFS \ No newline at end of file diff --git a/docs/generated/colour.SD_GAUSSIAN_METHODS.rst b/docs/generated/colour.SD_GAUSSIAN_METHODS.rst deleted file mode 100644 index a7e7d77f53..0000000000 --- a/docs/generated/colour.SD_GAUSSIAN_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.SD\_GAUSSIAN\_METHODS -============================ - -.. currentmodule:: colour - -.. autodata:: SD_GAUSSIAN_METHODS \ No newline at end of file diff --git a/docs/generated/colour.SD_MULTI_LEDS_METHODS.rst b/docs/generated/colour.SD_MULTI_LEDS_METHODS.rst deleted file mode 100644 index a005d7de47..0000000000 --- a/docs/generated/colour.SD_MULTI_LEDS_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.SD\_MULTI\_LEDS\_METHODS -=============================== - -.. currentmodule:: colour - -.. autodata:: SD_MULTI_LEDS_METHODS \ No newline at end of file diff --git a/docs/generated/colour.SD_SINGLE_LED_METHODS.rst b/docs/generated/colour.SD_SINGLE_LED_METHODS.rst deleted file mode 100644 index 40bedf6368..0000000000 --- a/docs/generated/colour.SD_SINGLE_LED_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.SD\_SINGLE\_LED\_METHODS -=============================== - -.. currentmodule:: colour - -.. autodata:: SD_SINGLE_LED_METHODS \ No newline at end of file diff --git a/docs/generated/colour.SD_TO_XYZ_METHODS.rst b/docs/generated/colour.SD_TO_XYZ_METHODS.rst deleted file mode 100644 index 8bedfb6d74..0000000000 --- a/docs/generated/colour.SD_TO_XYZ_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.SD\_TO\_XYZ\_METHODS -=========================== - -.. currentmodule:: colour - -.. autodata:: SD_TO_XYZ_METHODS \ No newline at end of file diff --git a/docs/generated/colour.STANDARD_OBSERVERS_CMFS.rst b/docs/generated/colour.STANDARD_OBSERVERS_CMFS.rst deleted file mode 100644 index 55d5de367f..0000000000 --- a/docs/generated/colour.STANDARD_OBSERVERS_CMFS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.STANDARD\_OBSERVERS\_CMFS -================================ - -.. currentmodule:: colour - -.. autodata:: STANDARD_OBSERVERS_CMFS \ No newline at end of file diff --git a/docs/generated/colour.SpectralDistribution.rst b/docs/generated/colour.SpectralDistribution.rst deleted file mode 100644 index 9d6a8ce877..0000000000 --- a/docs/generated/colour.SpectralDistribution.rst +++ /dev/null @@ -1,59 +0,0 @@ -colour.SpectralDistribution -=========================== - -.. currentmodule:: colour - -.. autoclass:: SpectralDistribution - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~SpectralDistribution.__init__ - ~SpectralDistribution.align - ~SpectralDistribution.arithmetical_operation - ~SpectralDistribution.clone - ~SpectralDistribution.copy - ~SpectralDistribution.domain_distance - ~SpectralDistribution.extrapolate - ~SpectralDistribution.fill_nan - ~SpectralDistribution.get - ~SpectralDistribution.interpolate - ~SpectralDistribution.is_uniform - ~SpectralDistribution.normalise - ~SpectralDistribution.signal_unpack_data - ~SpectralDistribution.to_series - ~SpectralDistribution.trim - ~SpectralDistribution.trim_wavelengths - ~SpectralDistribution.zeros - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~SpectralDistribution.data - ~SpectralDistribution.domain - ~SpectralDistribution.dtype - ~SpectralDistribution.extrapolator - ~SpectralDistribution.extrapolator_args - ~SpectralDistribution.function - ~SpectralDistribution.interpolator - ~SpectralDistribution.interpolator_args - ~SpectralDistribution.items - ~SpectralDistribution.name - ~SpectralDistribution.range - ~SpectralDistribution.shape - ~SpectralDistribution.strict_name - ~SpectralDistribution.title - ~SpectralDistribution.values - ~SpectralDistribution.wavelengths - - \ No newline at end of file diff --git a/docs/generated/colour.SpectralDistribution_IESTM2714.rst b/docs/generated/colour.SpectralDistribution_IESTM2714.rst deleted file mode 100644 index 456c0f75b4..0000000000 --- a/docs/generated/colour.SpectralDistribution_IESTM2714.rst +++ /dev/null @@ -1,69 +0,0 @@ -colour.SpectralDistribution\_IESTM2714 -====================================== - -.. currentmodule:: colour - -.. autoclass:: SpectralDistribution_IESTM2714 - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~SpectralDistribution_IESTM2714.__init__ - ~SpectralDistribution_IESTM2714.align - ~SpectralDistribution_IESTM2714.arithmetical_operation - ~SpectralDistribution_IESTM2714.clone - ~SpectralDistribution_IESTM2714.copy - ~SpectralDistribution_IESTM2714.domain_distance - ~SpectralDistribution_IESTM2714.extrapolate - ~SpectralDistribution_IESTM2714.fill_nan - ~SpectralDistribution_IESTM2714.get - ~SpectralDistribution_IESTM2714.interpolate - ~SpectralDistribution_IESTM2714.is_uniform - ~SpectralDistribution_IESTM2714.normalise - ~SpectralDistribution_IESTM2714.read - ~SpectralDistribution_IESTM2714.signal_unpack_data - ~SpectralDistribution_IESTM2714.to_series - ~SpectralDistribution_IESTM2714.trim - ~SpectralDistribution_IESTM2714.trim_wavelengths - ~SpectralDistribution_IESTM2714.write - ~SpectralDistribution_IESTM2714.zeros - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~SpectralDistribution_IESTM2714.bandwidth_FWHM - ~SpectralDistribution_IESTM2714.bandwidth_corrected - ~SpectralDistribution_IESTM2714.data - ~SpectralDistribution_IESTM2714.domain - ~SpectralDistribution_IESTM2714.dtype - ~SpectralDistribution_IESTM2714.extrapolator - ~SpectralDistribution_IESTM2714.extrapolator_args - ~SpectralDistribution_IESTM2714.function - ~SpectralDistribution_IESTM2714.header - ~SpectralDistribution_IESTM2714.interpolator - ~SpectralDistribution_IESTM2714.interpolator_args - ~SpectralDistribution_IESTM2714.items - ~SpectralDistribution_IESTM2714.mapping - ~SpectralDistribution_IESTM2714.name - ~SpectralDistribution_IESTM2714.path - ~SpectralDistribution_IESTM2714.range - ~SpectralDistribution_IESTM2714.reflection_geometry - ~SpectralDistribution_IESTM2714.shape - ~SpectralDistribution_IESTM2714.spectral_quantity - ~SpectralDistribution_IESTM2714.strict_name - ~SpectralDistribution_IESTM2714.title - ~SpectralDistribution_IESTM2714.transmission_geometry - ~SpectralDistribution_IESTM2714.values - ~SpectralDistribution_IESTM2714.wavelengths - - \ No newline at end of file diff --git a/docs/generated/colour.SpectralShape.rst b/docs/generated/colour.SpectralShape.rst deleted file mode 100644 index d34d2ec6d7..0000000000 --- a/docs/generated/colour.SpectralShape.rst +++ /dev/null @@ -1,32 +0,0 @@ -colour.SpectralShape -==================== - -.. currentmodule:: colour - -.. autoclass:: SpectralShape - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~SpectralShape.__init__ - ~SpectralShape.range - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~SpectralShape.boundaries - ~SpectralShape.end - ~SpectralShape.interval - ~SpectralShape.start - - \ No newline at end of file diff --git a/docs/generated/colour.SpragueInterpolator.rst b/docs/generated/colour.SpragueInterpolator.rst deleted file mode 100644 index a37a98b73c..0000000000 --- a/docs/generated/colour.SpragueInterpolator.rst +++ /dev/null @@ -1,30 +0,0 @@ -colour.SpragueInterpolator -========================== - -.. currentmodule:: colour - -.. autoclass:: SpragueInterpolator - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~SpragueInterpolator.__init__ - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~SpragueInterpolator.SPRAGUE_C_COEFFICIENTS - ~SpragueInterpolator.x - ~SpragueInterpolator.y - - \ No newline at end of file diff --git a/docs/generated/colour.TABLE_INTERPOLATION_METHODS.rst b/docs/generated/colour.TABLE_INTERPOLATION_METHODS.rst deleted file mode 100644 index 6b64dea6b5..0000000000 --- a/docs/generated/colour.TABLE_INTERPOLATION_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.TABLE\_INTERPOLATION\_METHODS -==================================== - -.. currentmodule:: colour - -.. autodata:: TABLE_INTERPOLATION_METHODS \ No newline at end of file diff --git a/docs/generated/colour.UCS_to_XYZ.rst b/docs/generated/colour.UCS_to_XYZ.rst deleted file mode 100644 index d6af141902..0000000000 --- a/docs/generated/colour.UCS_to_XYZ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.UCS\_to\_XYZ -=================== - -.. currentmodule:: colour - -.. autofunction:: UCS_to_XYZ \ No newline at end of file diff --git a/docs/generated/colour.UCS_to_uv.rst b/docs/generated/colour.UCS_to_uv.rst deleted file mode 100644 index aaee0a53f5..0000000000 --- a/docs/generated/colour.UCS_to_uv.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.UCS\_to\_uv -================== - -.. currentmodule:: colour - -.. autofunction:: UCS_to_uv \ No newline at end of file diff --git a/docs/generated/colour.UCS_uv_to_xy.rst b/docs/generated/colour.UCS_uv_to_xy.rst deleted file mode 100644 index e685a34886..0000000000 --- a/docs/generated/colour.UCS_uv_to_xy.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.UCS\_uv\_to\_xy -====================== - -.. currentmodule:: colour - -.. autofunction:: UCS_uv_to_xy \ No newline at end of file diff --git a/docs/generated/colour.UVW_to_XYZ.rst b/docs/generated/colour.UVW_to_XYZ.rst deleted file mode 100644 index 8ed5027301..0000000000 --- a/docs/generated/colour.UVW_to_XYZ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.UVW\_to\_XYZ -=================== - -.. currentmodule:: colour - -.. autofunction:: UVW_to_XYZ \ No newline at end of file diff --git a/docs/generated/colour.UV_TO_CCT_METHODS.rst b/docs/generated/colour.UV_TO_CCT_METHODS.rst deleted file mode 100644 index 3602cf5905..0000000000 --- a/docs/generated/colour.UV_TO_CCT_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.UV\_TO\_CCT\_METHODS -=========================== - -.. currentmodule:: colour - -.. autodata:: UV_TO_CCT_METHODS \ No newline at end of file diff --git a/docs/generated/colour.WHITENESS_METHODS.rst b/docs/generated/colour.WHITENESS_METHODS.rst deleted file mode 100644 index 233b44fb85..0000000000 --- a/docs/generated/colour.WHITENESS_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.WHITENESS\_METHODS -========================= - -.. currentmodule:: colour - -.. autodata:: WHITENESS_METHODS \ No newline at end of file diff --git a/docs/generated/colour.XYZ_TO_SD_METHODS.rst b/docs/generated/colour.XYZ_TO_SD_METHODS.rst deleted file mode 100644 index d45e498531..0000000000 --- a/docs/generated/colour.XYZ_TO_SD_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_TO\_SD\_METHODS -=========================== - -.. currentmodule:: colour - -.. autodata:: XYZ_TO_SD_METHODS \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_ATD95.rst b/docs/generated/colour.XYZ_to_ATD95.rst deleted file mode 100644 index 8b1c2d21bc..0000000000 --- a/docs/generated/colour.XYZ_to_ATD95.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_ATD95 -===================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_ATD95 \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_CAM16.rst b/docs/generated/colour.XYZ_to_CAM16.rst deleted file mode 100644 index 9290b45cd1..0000000000 --- a/docs/generated/colour.XYZ_to_CAM16.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_CAM16 -===================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_CAM16 \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_CIECAM02.rst b/docs/generated/colour.XYZ_to_CIECAM02.rst deleted file mode 100644 index eea54aad74..0000000000 --- a/docs/generated/colour.XYZ_to_CIECAM02.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_CIECAM02 -======================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_CIECAM02 \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_Hunt.rst b/docs/generated/colour.XYZ_to_Hunt.rst deleted file mode 100644 index 1f41b4d43b..0000000000 --- a/docs/generated/colour.XYZ_to_Hunt.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_Hunt -==================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_Hunt \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_Hunter_Lab.rst b/docs/generated/colour.XYZ_to_Hunter_Lab.rst deleted file mode 100644 index 70640ee313..0000000000 --- a/docs/generated/colour.XYZ_to_Hunter_Lab.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_Hunter\_Lab -=========================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_Hunter_Lab \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_Hunter_Rdab.rst b/docs/generated/colour.XYZ_to_Hunter_Rdab.rst deleted file mode 100644 index f4313dc509..0000000000 --- a/docs/generated/colour.XYZ_to_Hunter_Rdab.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_Hunter\_Rdab -============================ - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_Hunter_Rdab \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_IPT.rst b/docs/generated/colour.XYZ_to_IPT.rst deleted file mode 100644 index 80608b37ad..0000000000 --- a/docs/generated/colour.XYZ_to_IPT.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_IPT -=================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_IPT \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_JzAzBz.rst b/docs/generated/colour.XYZ_to_JzAzBz.rst deleted file mode 100644 index ec6d5a2550..0000000000 --- a/docs/generated/colour.XYZ_to_JzAzBz.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_JzAzBz -====================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_JzAzBz \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_K_ab_HunterLab1966.rst b/docs/generated/colour.XYZ_to_K_ab_HunterLab1966.rst deleted file mode 100644 index b055fa3c19..0000000000 --- a/docs/generated/colour.XYZ_to_K_ab_HunterLab1966.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_K\_ab\_HunterLab1966 -==================================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_K_ab_HunterLab1966 \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_LLAB.rst b/docs/generated/colour.XYZ_to_LLAB.rst deleted file mode 100644 index 9bdab7ab45..0000000000 --- a/docs/generated/colour.XYZ_to_LLAB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_LLAB -==================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_LLAB \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_Lab.rst b/docs/generated/colour.XYZ_to_Lab.rst deleted file mode 100644 index 2406599bf5..0000000000 --- a/docs/generated/colour.XYZ_to_Lab.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_Lab -=================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_Lab \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_Luv.rst b/docs/generated/colour.XYZ_to_Luv.rst deleted file mode 100644 index 568700e2f1..0000000000 --- a/docs/generated/colour.XYZ_to_Luv.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_Luv -=================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_Luv \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_Nayatani95.rst b/docs/generated/colour.XYZ_to_Nayatani95.rst deleted file mode 100644 index 0b52977a41..0000000000 --- a/docs/generated/colour.XYZ_to_Nayatani95.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_Nayatani95 -========================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_Nayatani95 \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_OSA_UCS.rst b/docs/generated/colour.XYZ_to_OSA_UCS.rst deleted file mode 100644 index 60d398d77d..0000000000 --- a/docs/generated/colour.XYZ_to_OSA_UCS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_OSA\_UCS -======================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_OSA_UCS \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_RGB.rst b/docs/generated/colour.XYZ_to_RGB.rst deleted file mode 100644 index 7cabe988f8..0000000000 --- a/docs/generated/colour.XYZ_to_RGB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_RGB -=================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_RGB \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_RLAB.rst b/docs/generated/colour.XYZ_to_RLAB.rst deleted file mode 100644 index e7f7af626d..0000000000 --- a/docs/generated/colour.XYZ_to_RLAB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_RLAB -==================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_RLAB \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_UCS.rst b/docs/generated/colour.XYZ_to_UCS.rst deleted file mode 100644 index 8e5d871a5d..0000000000 --- a/docs/generated/colour.XYZ_to_UCS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_UCS -=================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_UCS \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_UVW.rst b/docs/generated/colour.XYZ_to_UVW.rst deleted file mode 100644 index 2fe0684b7a..0000000000 --- a/docs/generated/colour.XYZ_to_UVW.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_UVW -=================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_UVW \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_hdr_CIELab.rst b/docs/generated/colour.XYZ_to_hdr_CIELab.rst deleted file mode 100644 index 46d23637e0..0000000000 --- a/docs/generated/colour.XYZ_to_hdr_CIELab.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_hdr\_CIELab -=========================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_hdr_CIELab \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_hdr_IPT.rst b/docs/generated/colour.XYZ_to_hdr_IPT.rst deleted file mode 100644 index 8be0f07fe8..0000000000 --- a/docs/generated/colour.XYZ_to_hdr_IPT.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_hdr\_IPT -======================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_hdr_IPT \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_sRGB.rst b/docs/generated/colour.XYZ_to_sRGB.rst deleted file mode 100644 index 39c3bbbee8..0000000000 --- a/docs/generated/colour.XYZ_to_sRGB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_sRGB -==================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_sRGB \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_sd.rst b/docs/generated/colour.XYZ_to_sd.rst deleted file mode 100644 index 2d7b702aca..0000000000 --- a/docs/generated/colour.XYZ_to_sd.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_sd -================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_sd \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_xy.rst b/docs/generated/colour.XYZ_to_xy.rst deleted file mode 100644 index fb69f72ecc..0000000000 --- a/docs/generated/colour.XYZ_to_xy.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_xy -================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_xy \ No newline at end of file diff --git a/docs/generated/colour.XYZ_to_xyY.rst b/docs/generated/colour.XYZ_to_xyY.rst deleted file mode 100644 index ee8c661656..0000000000 --- a/docs/generated/colour.XYZ_to_xyY.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XYZ\_to\_xyY -=================== - -.. currentmodule:: colour - -.. autofunction:: XYZ_to_xyY \ No newline at end of file diff --git a/docs/generated/colour.XY_TO_CCT_METHODS.rst b/docs/generated/colour.XY_TO_CCT_METHODS.rst deleted file mode 100644 index 0d36abe187..0000000000 --- a/docs/generated/colour.XY_TO_CCT_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.XY\_TO\_CCT\_METHODS -=========================== - -.. currentmodule:: colour - -.. autodata:: XY_TO_CCT_METHODS \ No newline at end of file diff --git a/docs/generated/colour.YCBCR_WEIGHTS.rst b/docs/generated/colour.YCBCR_WEIGHTS.rst deleted file mode 100644 index 53c376fbcc..0000000000 --- a/docs/generated/colour.YCBCR_WEIGHTS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.YCBCR\_WEIGHTS -===================== - -.. currentmodule:: colour - -.. autodata:: YCBCR_WEIGHTS \ No newline at end of file diff --git a/docs/generated/colour.YCbCr_to_RGB.rst b/docs/generated/colour.YCbCr_to_RGB.rst deleted file mode 100644 index acbd594e6a..0000000000 --- a/docs/generated/colour.YCbCr_to_RGB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.YCbCr\_to\_RGB -===================== - -.. currentmodule:: colour - -.. autofunction:: YCbCr_to_RGB \ No newline at end of file diff --git a/docs/generated/colour.YCoCg_to_RGB.rst b/docs/generated/colour.YCoCg_to_RGB.rst deleted file mode 100644 index a12bad8122..0000000000 --- a/docs/generated/colour.YCoCg_to_RGB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.YCoCg\_to\_RGB -===================== - -.. currentmodule:: colour - -.. autofunction:: YCoCg_to_RGB \ No newline at end of file diff --git a/docs/generated/colour.YELLOWNESS_METHODS.rst b/docs/generated/colour.YELLOWNESS_METHODS.rst deleted file mode 100644 index 45b8777335..0000000000 --- a/docs/generated/colour.YELLOWNESS_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.YELLOWNESS\_METHODS -========================== - -.. currentmodule:: colour - -.. autodata:: YELLOWNESS_METHODS \ No newline at end of file diff --git a/docs/generated/colour.YcCbcCrc_to_RGB.rst b/docs/generated/colour.YcCbcCrc_to_RGB.rst deleted file mode 100644 index 3b2713b522..0000000000 --- a/docs/generated/colour.YcCbcCrc_to_RGB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.YcCbcCrc\_to\_RGB -======================== - -.. currentmodule:: colour - -.. autofunction:: YcCbcCrc_to_RGB \ No newline at end of file diff --git a/docs/generated/colour.adaptation.BRADFORD_CAT.rst b/docs/generated/colour.adaptation.BRADFORD_CAT.rst deleted file mode 100644 index de20a77fa2..0000000000 --- a/docs/generated/colour.adaptation.BRADFORD_CAT.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.adaptation.BRADFORD\_CAT -=============================== - -.. currentmodule:: colour.adaptation - -.. autodata:: BRADFORD_CAT \ No newline at end of file diff --git a/docs/generated/colour.adaptation.BS_CAT.rst b/docs/generated/colour.adaptation.BS_CAT.rst deleted file mode 100644 index 75d690329f..0000000000 --- a/docs/generated/colour.adaptation.BS_CAT.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.adaptation.BS\_CAT -========================= - -.. currentmodule:: colour.adaptation - -.. autodata:: BS_CAT \ No newline at end of file diff --git a/docs/generated/colour.adaptation.BS_PC_CAT.rst b/docs/generated/colour.adaptation.BS_PC_CAT.rst deleted file mode 100644 index d26fcb1d8e..0000000000 --- a/docs/generated/colour.adaptation.BS_PC_CAT.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.adaptation.BS\_PC\_CAT -============================= - -.. currentmodule:: colour.adaptation - -.. autodata:: BS_PC_CAT \ No newline at end of file diff --git a/docs/generated/colour.adaptation.CAT02_BRILL_CAT.rst b/docs/generated/colour.adaptation.CAT02_BRILL_CAT.rst deleted file mode 100644 index df4602c5c0..0000000000 --- a/docs/generated/colour.adaptation.CAT02_BRILL_CAT.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.adaptation.CAT02\_BRILL\_CAT -=================================== - -.. currentmodule:: colour.adaptation - -.. autodata:: CAT02_BRILL_CAT \ No newline at end of file diff --git a/docs/generated/colour.adaptation.CAT02_CAT.rst b/docs/generated/colour.adaptation.CAT02_CAT.rst deleted file mode 100644 index 44e354a830..0000000000 --- a/docs/generated/colour.adaptation.CAT02_CAT.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.adaptation.CAT02\_CAT -============================ - -.. currentmodule:: colour.adaptation - -.. autodata:: CAT02_CAT \ No newline at end of file diff --git a/docs/generated/colour.adaptation.CHROMATIC_ADAPTATION_TRANSFORMS.rst b/docs/generated/colour.adaptation.CHROMATIC_ADAPTATION_TRANSFORMS.rst deleted file mode 100644 index 1fae847a86..0000000000 --- a/docs/generated/colour.adaptation.CHROMATIC_ADAPTATION_TRANSFORMS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.adaptation.CHROMATIC\_ADAPTATION\_TRANSFORMS -=================================================== - -.. currentmodule:: colour.adaptation - -.. autodata:: CHROMATIC_ADAPTATION_TRANSFORMS \ No newline at end of file diff --git a/docs/generated/colour.adaptation.CMCCAT2000_CAT.rst b/docs/generated/colour.adaptation.CMCCAT2000_CAT.rst deleted file mode 100644 index a56237d177..0000000000 --- a/docs/generated/colour.adaptation.CMCCAT2000_CAT.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.adaptation.CMCCAT2000\_CAT -================================= - -.. currentmodule:: colour.adaptation - -.. autodata:: CMCCAT2000_CAT \ No newline at end of file diff --git a/docs/generated/colour.adaptation.CMCCAT2000_InductionFactors.rst b/docs/generated/colour.adaptation.CMCCAT2000_InductionFactors.rst deleted file mode 100644 index 132fa00ee9..0000000000 --- a/docs/generated/colour.adaptation.CMCCAT2000_InductionFactors.rst +++ /dev/null @@ -1,29 +0,0 @@ -colour.adaptation.CMCCAT2000\_InductionFactors -============================================== - -.. currentmodule:: colour.adaptation - -.. autoclass:: CMCCAT2000_InductionFactors - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~CMCCAT2000_InductionFactors.count - ~CMCCAT2000_InductionFactors.index - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~CMCCAT2000_InductionFactors.F - - \ No newline at end of file diff --git a/docs/generated/colour.adaptation.CMCCAT2000_VIEWING_CONDITIONS.rst b/docs/generated/colour.adaptation.CMCCAT2000_VIEWING_CONDITIONS.rst deleted file mode 100644 index 2b0e9a1c83..0000000000 --- a/docs/generated/colour.adaptation.CMCCAT2000_VIEWING_CONDITIONS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.adaptation.CMCCAT2000\_VIEWING\_CONDITIONS -================================================= - -.. currentmodule:: colour.adaptation - -.. autodata:: CMCCAT2000_VIEWING_CONDITIONS \ No newline at end of file diff --git a/docs/generated/colour.adaptation.CMCCAT97_CAT.rst b/docs/generated/colour.adaptation.CMCCAT97_CAT.rst deleted file mode 100644 index 6ee44f48b3..0000000000 --- a/docs/generated/colour.adaptation.CMCCAT97_CAT.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.adaptation.CMCCAT97\_CAT -=============================== - -.. currentmodule:: colour.adaptation - -.. autodata:: CMCCAT97_CAT \ No newline at end of file diff --git a/docs/generated/colour.adaptation.FAIRCHILD_CAT.rst b/docs/generated/colour.adaptation.FAIRCHILD_CAT.rst deleted file mode 100644 index 7420c1a98a..0000000000 --- a/docs/generated/colour.adaptation.FAIRCHILD_CAT.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.adaptation.FAIRCHILD\_CAT -================================ - -.. currentmodule:: colour.adaptation - -.. autodata:: FAIRCHILD_CAT \ No newline at end of file diff --git a/docs/generated/colour.adaptation.SHARP_CAT.rst b/docs/generated/colour.adaptation.SHARP_CAT.rst deleted file mode 100644 index b68e6f6474..0000000000 --- a/docs/generated/colour.adaptation.SHARP_CAT.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.adaptation.SHARP\_CAT -============================ - -.. currentmodule:: colour.adaptation - -.. autodata:: SHARP_CAT \ No newline at end of file diff --git a/docs/generated/colour.adaptation.VON_KRIES_CAT.rst b/docs/generated/colour.adaptation.VON_KRIES_CAT.rst deleted file mode 100644 index 2b1adea7ed..0000000000 --- a/docs/generated/colour.adaptation.VON_KRIES_CAT.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.adaptation.VON\_KRIES\_CAT -================================= - -.. currentmodule:: colour.adaptation - -.. autodata:: VON_KRIES_CAT \ No newline at end of file diff --git a/docs/generated/colour.adaptation.XYZ_SCALING_CAT.rst b/docs/generated/colour.adaptation.XYZ_SCALING_CAT.rst deleted file mode 100644 index 93be2cff32..0000000000 --- a/docs/generated/colour.adaptation.XYZ_SCALING_CAT.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.adaptation.XYZ\_SCALING\_CAT -=================================== - -.. currentmodule:: colour.adaptation - -.. autodata:: XYZ_SCALING_CAT \ No newline at end of file diff --git a/docs/generated/colour.adaptation.chromatic_adaptation_CIE1994.rst b/docs/generated/colour.adaptation.chromatic_adaptation_CIE1994.rst deleted file mode 100644 index 1fd0876320..0000000000 --- a/docs/generated/colour.adaptation.chromatic_adaptation_CIE1994.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.adaptation.chromatic\_adaptation\_CIE1994 -================================================ - -.. currentmodule:: colour.adaptation - -.. autofunction:: chromatic_adaptation_CIE1994 \ No newline at end of file diff --git a/docs/generated/colour.adaptation.chromatic_adaptation_CMCCAT2000.rst b/docs/generated/colour.adaptation.chromatic_adaptation_CMCCAT2000.rst deleted file mode 100644 index 615010dad5..0000000000 --- a/docs/generated/colour.adaptation.chromatic_adaptation_CMCCAT2000.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.adaptation.chromatic\_adaptation\_CMCCAT2000 -=================================================== - -.. currentmodule:: colour.adaptation - -.. autofunction:: chromatic_adaptation_CMCCAT2000 \ No newline at end of file diff --git a/docs/generated/colour.adaptation.chromatic_adaptation_Fairchild1990.rst b/docs/generated/colour.adaptation.chromatic_adaptation_Fairchild1990.rst deleted file mode 100644 index 3232e2eeb6..0000000000 --- a/docs/generated/colour.adaptation.chromatic_adaptation_Fairchild1990.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.adaptation.chromatic\_adaptation\_Fairchild1990 -====================================================== - -.. currentmodule:: colour.adaptation - -.. autofunction:: chromatic_adaptation_Fairchild1990 \ No newline at end of file diff --git a/docs/generated/colour.adaptation.chromatic_adaptation_VonKries.rst b/docs/generated/colour.adaptation.chromatic_adaptation_VonKries.rst deleted file mode 100644 index 6e9065533b..0000000000 --- a/docs/generated/colour.adaptation.chromatic_adaptation_VonKries.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.adaptation.chromatic\_adaptation\_VonKries -================================================= - -.. currentmodule:: colour.adaptation - -.. autofunction:: chromatic_adaptation_VonKries \ No newline at end of file diff --git a/docs/generated/colour.adaptation.chromatic_adaptation_forward_CMCCAT2000.rst b/docs/generated/colour.adaptation.chromatic_adaptation_forward_CMCCAT2000.rst deleted file mode 100644 index e41569da70..0000000000 --- a/docs/generated/colour.adaptation.chromatic_adaptation_forward_CMCCAT2000.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.adaptation.chromatic\_adaptation\_forward\_CMCCAT2000 -============================================================ - -.. currentmodule:: colour.adaptation - -.. autofunction:: chromatic_adaptation_forward_CMCCAT2000 \ No newline at end of file diff --git a/docs/generated/colour.adaptation.chromatic_adaptation_matrix_VonKries.rst b/docs/generated/colour.adaptation.chromatic_adaptation_matrix_VonKries.rst deleted file mode 100644 index ff3c092b52..0000000000 --- a/docs/generated/colour.adaptation.chromatic_adaptation_matrix_VonKries.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.adaptation.chromatic\_adaptation\_matrix\_VonKries -========================================================= - -.. currentmodule:: colour.adaptation - -.. autofunction:: chromatic_adaptation_matrix_VonKries \ No newline at end of file diff --git a/docs/generated/colour.adaptation.chromatic_adaptation_reverse_CMCCAT2000.rst b/docs/generated/colour.adaptation.chromatic_adaptation_reverse_CMCCAT2000.rst deleted file mode 100644 index 7e6266d105..0000000000 --- a/docs/generated/colour.adaptation.chromatic_adaptation_reverse_CMCCAT2000.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.adaptation.chromatic\_adaptation\_reverse\_CMCCAT2000 -============================================================ - -.. currentmodule:: colour.adaptation - -.. autofunction:: chromatic_adaptation_reverse_CMCCAT2000 \ No newline at end of file diff --git a/docs/generated/colour.algebra.ELLIPSE_FITTING_METHODS.rst b/docs/generated/colour.algebra.ELLIPSE_FITTING_METHODS.rst deleted file mode 100644 index e166b1a307..0000000000 --- a/docs/generated/colour.algebra.ELLIPSE_FITTING_METHODS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.ELLIPSE\_FITTING\_METHODS -======================================== - -.. currentmodule:: colour.algebra - -.. autodata:: ELLIPSE_FITTING_METHODS \ No newline at end of file diff --git a/docs/generated/colour.algebra.LineSegmentsIntersections_Specification.rst b/docs/generated/colour.algebra.LineSegmentsIntersections_Specification.rst deleted file mode 100644 index a31938df3b..0000000000 --- a/docs/generated/colour.algebra.LineSegmentsIntersections_Specification.rst +++ /dev/null @@ -1,32 +0,0 @@ -colour.algebra.LineSegmentsIntersections\_Specification -======================================================= - -.. currentmodule:: colour.algebra - -.. autoclass:: LineSegmentsIntersections_Specification - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~LineSegmentsIntersections_Specification.count - ~LineSegmentsIntersections_Specification.index - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~LineSegmentsIntersections_Specification.coincident - ~LineSegmentsIntersections_Specification.intersect - ~LineSegmentsIntersections_Specification.parallel - ~LineSegmentsIntersections_Specification.xy - - \ No newline at end of file diff --git a/docs/generated/colour.algebra.cartesian_to_cylindrical.rst b/docs/generated/colour.algebra.cartesian_to_cylindrical.rst deleted file mode 100644 index 95547e3af9..0000000000 --- a/docs/generated/colour.algebra.cartesian_to_cylindrical.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.cartesian\_to\_cylindrical -========================================= - -.. currentmodule:: colour.algebra - -.. autofunction:: cartesian_to_cylindrical \ No newline at end of file diff --git a/docs/generated/colour.algebra.cartesian_to_polar.rst b/docs/generated/colour.algebra.cartesian_to_polar.rst deleted file mode 100644 index a78f639766..0000000000 --- a/docs/generated/colour.algebra.cartesian_to_polar.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.cartesian\_to\_polar -=================================== - -.. currentmodule:: colour.algebra - -.. autofunction:: cartesian_to_polar \ No newline at end of file diff --git a/docs/generated/colour.algebra.cartesian_to_spherical.rst b/docs/generated/colour.algebra.cartesian_to_spherical.rst deleted file mode 100644 index 826dd9ab88..0000000000 --- a/docs/generated/colour.algebra.cartesian_to_spherical.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.cartesian\_to\_spherical -======================================= - -.. currentmodule:: colour.algebra - -.. autofunction:: cartesian_to_spherical \ No newline at end of file diff --git a/docs/generated/colour.algebra.cylindrical_to_cartesian.rst b/docs/generated/colour.algebra.cylindrical_to_cartesian.rst deleted file mode 100644 index 074c896047..0000000000 --- a/docs/generated/colour.algebra.cylindrical_to_cartesian.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.cylindrical\_to\_cartesian -========================================= - -.. currentmodule:: colour.algebra - -.. autofunction:: cylindrical_to_cartesian \ No newline at end of file diff --git a/docs/generated/colour.algebra.ellipse_coefficients_canonical_form.rst b/docs/generated/colour.algebra.ellipse_coefficients_canonical_form.rst deleted file mode 100644 index 5362bad1a1..0000000000 --- a/docs/generated/colour.algebra.ellipse_coefficients_canonical_form.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.ellipse\_coefficients\_canonical\_form -===================================================== - -.. currentmodule:: colour.algebra - -.. autofunction:: ellipse_coefficients_canonical_form \ No newline at end of file diff --git a/docs/generated/colour.algebra.ellipse_coefficients_general_form.rst b/docs/generated/colour.algebra.ellipse_coefficients_general_form.rst deleted file mode 100644 index e8a4efa455..0000000000 --- a/docs/generated/colour.algebra.ellipse_coefficients_general_form.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.ellipse\_coefficients\_general\_form -=================================================== - -.. currentmodule:: colour.algebra - -.. autofunction:: ellipse_coefficients_general_form \ No newline at end of file diff --git a/docs/generated/colour.algebra.ellipse_fitting.rst b/docs/generated/colour.algebra.ellipse_fitting.rst deleted file mode 100644 index 05670c8675..0000000000 --- a/docs/generated/colour.algebra.ellipse_fitting.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.ellipse\_fitting -=============================== - -.. currentmodule:: colour.algebra - -.. autofunction:: ellipse_fitting \ No newline at end of file diff --git a/docs/generated/colour.algebra.ellipse_fitting_Halir1998.rst b/docs/generated/colour.algebra.ellipse_fitting_Halir1998.rst deleted file mode 100644 index 1d34512246..0000000000 --- a/docs/generated/colour.algebra.ellipse_fitting_Halir1998.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.ellipse\_fitting\_Halir1998 -========================================== - -.. currentmodule:: colour.algebra - -.. autofunction:: ellipse_fitting_Halir1998 \ No newline at end of file diff --git a/docs/generated/colour.algebra.euclidean_distance.rst b/docs/generated/colour.algebra.euclidean_distance.rst deleted file mode 100644 index 7e45c89b12..0000000000 --- a/docs/generated/colour.algebra.euclidean_distance.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.euclidean\_distance -================================== - -.. currentmodule:: colour.algebra - -.. autofunction:: euclidean_distance \ No newline at end of file diff --git a/docs/generated/colour.algebra.extend_line_segment.rst b/docs/generated/colour.algebra.extend_line_segment.rst deleted file mode 100644 index cf21957202..0000000000 --- a/docs/generated/colour.algebra.extend_line_segment.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.extend\_line\_segment -==================================== - -.. currentmodule:: colour.algebra - -.. autofunction:: extend_line_segment \ No newline at end of file diff --git a/docs/generated/colour.algebra.intersect_line_segments.rst b/docs/generated/colour.algebra.intersect_line_segments.rst deleted file mode 100644 index 6ae9c44faf..0000000000 --- a/docs/generated/colour.algebra.intersect_line_segments.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.intersect\_line\_segments -======================================== - -.. currentmodule:: colour.algebra - -.. autofunction:: intersect_line_segments \ No newline at end of file diff --git a/docs/generated/colour.algebra.is_identity.rst b/docs/generated/colour.algebra.is_identity.rst deleted file mode 100644 index a55a11f8cf..0000000000 --- a/docs/generated/colour.algebra.is_identity.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.is\_identity -=========================== - -.. currentmodule:: colour.algebra - -.. autofunction:: is_identity \ No newline at end of file diff --git a/docs/generated/colour.algebra.is_spow_enabled.rst b/docs/generated/colour.algebra.is_spow_enabled.rst deleted file mode 100644 index 0bd601c2a9..0000000000 --- a/docs/generated/colour.algebra.is_spow_enabled.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.is\_spow\_enabled -================================ - -.. currentmodule:: colour.algebra - -.. autofunction:: is_spow_enabled \ No newline at end of file diff --git a/docs/generated/colour.algebra.least_square_mapping_MoorePenrose.rst b/docs/generated/colour.algebra.least_square_mapping_MoorePenrose.rst deleted file mode 100644 index 22082f9827..0000000000 --- a/docs/generated/colour.algebra.least_square_mapping_MoorePenrose.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.least\_square\_mapping\_MoorePenrose -=================================================== - -.. currentmodule:: colour.algebra - -.. autofunction:: least_square_mapping_MoorePenrose \ No newline at end of file diff --git a/docs/generated/colour.algebra.normalise_vector.rst b/docs/generated/colour.algebra.normalise_vector.rst deleted file mode 100644 index dc3a0a9d16..0000000000 --- a/docs/generated/colour.algebra.normalise_vector.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.normalise\_vector -================================ - -.. currentmodule:: colour.algebra - -.. autofunction:: normalise_vector \ No newline at end of file diff --git a/docs/generated/colour.algebra.point_at_angle_on_ellipse.rst b/docs/generated/colour.algebra.point_at_angle_on_ellipse.rst deleted file mode 100644 index 1062dc38b2..0000000000 --- a/docs/generated/colour.algebra.point_at_angle_on_ellipse.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.point\_at\_angle\_on\_ellipse -============================================ - -.. currentmodule:: colour.algebra - -.. autofunction:: point_at_angle_on_ellipse \ No newline at end of file diff --git a/docs/generated/colour.algebra.polar_to_cartesian.rst b/docs/generated/colour.algebra.polar_to_cartesian.rst deleted file mode 100644 index 9be7cacde2..0000000000 --- a/docs/generated/colour.algebra.polar_to_cartesian.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.polar\_to\_cartesian -=================================== - -.. currentmodule:: colour.algebra - -.. autofunction:: polar_to_cartesian \ No newline at end of file diff --git a/docs/generated/colour.algebra.random_triplet_generator.rst b/docs/generated/colour.algebra.random_triplet_generator.rst deleted file mode 100644 index abba4aabe6..0000000000 --- a/docs/generated/colour.algebra.random_triplet_generator.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.random\_triplet\_generator -========================================= - -.. currentmodule:: colour.algebra - -.. autofunction:: random_triplet_generator \ No newline at end of file diff --git a/docs/generated/colour.algebra.set_spow_enable.rst b/docs/generated/colour.algebra.set_spow_enable.rst deleted file mode 100644 index 2633bef3cf..0000000000 --- a/docs/generated/colour.algebra.set_spow_enable.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.set\_spow\_enable -================================ - -.. currentmodule:: colour.algebra - -.. autofunction:: set_spow_enable \ No newline at end of file diff --git a/docs/generated/colour.algebra.spherical_to_cartesian.rst b/docs/generated/colour.algebra.spherical_to_cartesian.rst deleted file mode 100644 index eba0eeb933..0000000000 --- a/docs/generated/colour.algebra.spherical_to_cartesian.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.spherical\_to\_cartesian -======================================= - -.. currentmodule:: colour.algebra - -.. autofunction:: spherical_to_cartesian \ No newline at end of file diff --git a/docs/generated/colour.algebra.spow.rst b/docs/generated/colour.algebra.spow.rst deleted file mode 100644 index ec73e1d11c..0000000000 --- a/docs/generated/colour.algebra.spow.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.spow -=================== - -.. currentmodule:: colour.algebra - -.. autofunction:: spow \ No newline at end of file diff --git a/docs/generated/colour.algebra.spow_enable.rst b/docs/generated/colour.algebra.spow_enable.rst deleted file mode 100644 index a6f3570833..0000000000 --- a/docs/generated/colour.algebra.spow_enable.rst +++ /dev/null @@ -1,22 +0,0 @@ -colour.algebra.spow\_enable -=========================== - -.. currentmodule:: colour.algebra - -.. autoclass:: spow_enable - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~spow_enable.__init__ - - - - - - \ No newline at end of file diff --git a/docs/generated/colour.algebra.table_interpolation_tetrahedral.rst b/docs/generated/colour.algebra.table_interpolation_tetrahedral.rst deleted file mode 100644 index 50ba41d8c6..0000000000 --- a/docs/generated/colour.algebra.table_interpolation_tetrahedral.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.table\_interpolation\_tetrahedral -================================================ - -.. currentmodule:: colour.algebra - -.. autofunction:: table_interpolation_tetrahedral \ No newline at end of file diff --git a/docs/generated/colour.algebra.table_interpolation_trilinear.rst b/docs/generated/colour.algebra.table_interpolation_trilinear.rst deleted file mode 100644 index 6c96f2c01e..0000000000 --- a/docs/generated/colour.algebra.table_interpolation_trilinear.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.algebra.table\_interpolation\_trilinear -============================================== - -.. currentmodule:: colour.algebra - -.. autofunction:: table_interpolation_trilinear \ No newline at end of file diff --git a/docs/generated/colour.anomalous_trichromacy_cmfs_Machado2009.rst b/docs/generated/colour.anomalous_trichromacy_cmfs_Machado2009.rst deleted file mode 100644 index f0a52d74e6..0000000000 --- a/docs/generated/colour.anomalous_trichromacy_cmfs_Machado2009.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.anomalous\_trichromacy\_cmfs\_Machado2009 -================================================ - -.. currentmodule:: colour - -.. autofunction:: anomalous_trichromacy_cmfs_Machado2009 \ No newline at end of file diff --git a/docs/generated/colour.anomalous_trichromacy_matrix_Machado2009.rst b/docs/generated/colour.anomalous_trichromacy_matrix_Machado2009.rst deleted file mode 100644 index ac8a7373af..0000000000 --- a/docs/generated/colour.anomalous_trichromacy_matrix_Machado2009.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.anomalous\_trichromacy\_matrix\_Machado2009 -================================================== - -.. currentmodule:: colour - -.. autofunction:: anomalous_trichromacy_matrix_Machado2009 \ No newline at end of file diff --git a/docs/generated/colour.appearance.CAM16_InductionFactors.rst b/docs/generated/colour.appearance.CAM16_InductionFactors.rst deleted file mode 100644 index 1235ca4201..0000000000 --- a/docs/generated/colour.appearance.CAM16_InductionFactors.rst +++ /dev/null @@ -1,31 +0,0 @@ -colour.appearance.CAM16\_InductionFactors -========================================= - -.. currentmodule:: colour.appearance - -.. autoclass:: CAM16_InductionFactors - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~CAM16_InductionFactors.count - ~CAM16_InductionFactors.index - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~CAM16_InductionFactors.F - ~CAM16_InductionFactors.N_c - ~CAM16_InductionFactors.c - - \ No newline at end of file diff --git a/docs/generated/colour.appearance.CIECAM02_InductionFactors.rst b/docs/generated/colour.appearance.CIECAM02_InductionFactors.rst deleted file mode 100644 index 1c12399669..0000000000 --- a/docs/generated/colour.appearance.CIECAM02_InductionFactors.rst +++ /dev/null @@ -1,31 +0,0 @@ -colour.appearance.CIECAM02\_InductionFactors -============================================ - -.. currentmodule:: colour.appearance - -.. autoclass:: CIECAM02_InductionFactors - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~CIECAM02_InductionFactors.count - ~CIECAM02_InductionFactors.index - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~CIECAM02_InductionFactors.F - ~CIECAM02_InductionFactors.N_c - ~CIECAM02_InductionFactors.c - - \ No newline at end of file diff --git a/docs/generated/colour.appearance.LLAB_InductionFactors.rst b/docs/generated/colour.appearance.LLAB_InductionFactors.rst deleted file mode 100644 index 1f34f0b90d..0000000000 --- a/docs/generated/colour.appearance.LLAB_InductionFactors.rst +++ /dev/null @@ -1,32 +0,0 @@ -colour.appearance.LLAB\_InductionFactors -======================================== - -.. currentmodule:: colour.appearance - -.. autoclass:: LLAB_InductionFactors - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~LLAB_InductionFactors.count - ~LLAB_InductionFactors.index - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~LLAB_InductionFactors.D - ~LLAB_InductionFactors.F_C - ~LLAB_InductionFactors.F_L - ~LLAB_InductionFactors.F_S - - \ No newline at end of file diff --git a/docs/generated/colour.bandpass_correction.rst b/docs/generated/colour.bandpass_correction.rst deleted file mode 100644 index 72b82b531e..0000000000 --- a/docs/generated/colour.bandpass_correction.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.bandpass\_correction -=========================== - -.. currentmodule:: colour - -.. autofunction:: bandpass_correction \ No newline at end of file diff --git a/docs/generated/colour.biochemistry.reaction_rate_MichealisMenten.rst b/docs/generated/colour.biochemistry.reaction_rate_MichealisMenten.rst deleted file mode 100644 index a2a8b29b71..0000000000 --- a/docs/generated/colour.biochemistry.reaction_rate_MichealisMenten.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.biochemistry.reaction\_rate\_MichealisMenten -=================================================== - -.. currentmodule:: colour.biochemistry - -.. autofunction:: reaction_rate_MichealisMenten \ No newline at end of file diff --git a/docs/generated/colour.biochemistry.substrate_concentration_MichealisMenten.rst b/docs/generated/colour.biochemistry.substrate_concentration_MichealisMenten.rst deleted file mode 100644 index 68283358f7..0000000000 --- a/docs/generated/colour.biochemistry.substrate_concentration_MichealisMenten.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.biochemistry.substrate\_concentration\_MichealisMenten -============================================================= - -.. currentmodule:: colour.biochemistry - -.. autofunction:: substrate_concentration_MichealisMenten \ No newline at end of file diff --git a/docs/generated/colour.characterisation.ColourChecker.rst b/docs/generated/colour.characterisation.ColourChecker.rst deleted file mode 100644 index 589d7ec7e5..0000000000 --- a/docs/generated/colour.characterisation.ColourChecker.rst +++ /dev/null @@ -1,31 +0,0 @@ -colour.characterisation.ColourChecker -===================================== - -.. currentmodule:: colour.characterisation - -.. autoclass:: ColourChecker - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~ColourChecker.count - ~ColourChecker.index - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~ColourChecker.data - ~ColourChecker.illuminant - ~ColourChecker.name - - \ No newline at end of file diff --git a/docs/generated/colour.characterisation.RGB_DisplayPrimaries.rst b/docs/generated/colour.characterisation.RGB_DisplayPrimaries.rst deleted file mode 100644 index 1664615043..0000000000 --- a/docs/generated/colour.characterisation.RGB_DisplayPrimaries.rst +++ /dev/null @@ -1,68 +0,0 @@ -colour.characterisation.RGB\_DisplayPrimaries -============================================= - -.. currentmodule:: colour.characterisation - -.. autoclass:: RGB_DisplayPrimaries - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~RGB_DisplayPrimaries.__init__ - ~RGB_DisplayPrimaries.align - ~RGB_DisplayPrimaries.arithmetical_operation - ~RGB_DisplayPrimaries.clone - ~RGB_DisplayPrimaries.copy - ~RGB_DisplayPrimaries.domain_distance - ~RGB_DisplayPrimaries.extrapolate - ~RGB_DisplayPrimaries.fill_nan - ~RGB_DisplayPrimaries.get - ~RGB_DisplayPrimaries.interpolate - ~RGB_DisplayPrimaries.is_uniform - ~RGB_DisplayPrimaries.multi_signal_unpack_data - ~RGB_DisplayPrimaries.normalise - ~RGB_DisplayPrimaries.to_dataframe - ~RGB_DisplayPrimaries.to_sds - ~RGB_DisplayPrimaries.trim - ~RGB_DisplayPrimaries.trim_wavelengths - ~RGB_DisplayPrimaries.zeros - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~RGB_DisplayPrimaries.data - ~RGB_DisplayPrimaries.domain - ~RGB_DisplayPrimaries.dtype - ~RGB_DisplayPrimaries.extrapolator - ~RGB_DisplayPrimaries.extrapolator_args - ~RGB_DisplayPrimaries.function - ~RGB_DisplayPrimaries.interpolator - ~RGB_DisplayPrimaries.interpolator_args - ~RGB_DisplayPrimaries.items - ~RGB_DisplayPrimaries.labels - ~RGB_DisplayPrimaries.mapping - ~RGB_DisplayPrimaries.name - ~RGB_DisplayPrimaries.range - ~RGB_DisplayPrimaries.shape - ~RGB_DisplayPrimaries.signal_type - ~RGB_DisplayPrimaries.signals - ~RGB_DisplayPrimaries.strict_labels - ~RGB_DisplayPrimaries.strict_name - ~RGB_DisplayPrimaries.title - ~RGB_DisplayPrimaries.values - ~RGB_DisplayPrimaries.wavelengths - ~RGB_DisplayPrimaries.x - ~RGB_DisplayPrimaries.y - ~RGB_DisplayPrimaries.z - - \ No newline at end of file diff --git a/docs/generated/colour.characterisation.RGB_SpectralSensitivities.rst b/docs/generated/colour.characterisation.RGB_SpectralSensitivities.rst deleted file mode 100644 index a6bbbbb88b..0000000000 --- a/docs/generated/colour.characterisation.RGB_SpectralSensitivities.rst +++ /dev/null @@ -1,68 +0,0 @@ -colour.characterisation.RGB\_SpectralSensitivities -================================================== - -.. currentmodule:: colour.characterisation - -.. autoclass:: RGB_SpectralSensitivities - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~RGB_SpectralSensitivities.__init__ - ~RGB_SpectralSensitivities.align - ~RGB_SpectralSensitivities.arithmetical_operation - ~RGB_SpectralSensitivities.clone - ~RGB_SpectralSensitivities.copy - ~RGB_SpectralSensitivities.domain_distance - ~RGB_SpectralSensitivities.extrapolate - ~RGB_SpectralSensitivities.fill_nan - ~RGB_SpectralSensitivities.get - ~RGB_SpectralSensitivities.interpolate - ~RGB_SpectralSensitivities.is_uniform - ~RGB_SpectralSensitivities.multi_signal_unpack_data - ~RGB_SpectralSensitivities.normalise - ~RGB_SpectralSensitivities.to_dataframe - ~RGB_SpectralSensitivities.to_sds - ~RGB_SpectralSensitivities.trim - ~RGB_SpectralSensitivities.trim_wavelengths - ~RGB_SpectralSensitivities.zeros - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~RGB_SpectralSensitivities.data - ~RGB_SpectralSensitivities.domain - ~RGB_SpectralSensitivities.dtype - ~RGB_SpectralSensitivities.extrapolator - ~RGB_SpectralSensitivities.extrapolator_args - ~RGB_SpectralSensitivities.function - ~RGB_SpectralSensitivities.interpolator - ~RGB_SpectralSensitivities.interpolator_args - ~RGB_SpectralSensitivities.items - ~RGB_SpectralSensitivities.labels - ~RGB_SpectralSensitivities.mapping - ~RGB_SpectralSensitivities.name - ~RGB_SpectralSensitivities.range - ~RGB_SpectralSensitivities.shape - ~RGB_SpectralSensitivities.signal_type - ~RGB_SpectralSensitivities.signals - ~RGB_SpectralSensitivities.strict_labels - ~RGB_SpectralSensitivities.strict_name - ~RGB_SpectralSensitivities.title - ~RGB_SpectralSensitivities.values - ~RGB_SpectralSensitivities.wavelengths - ~RGB_SpectralSensitivities.x - ~RGB_SpectralSensitivities.y - ~RGB_SpectralSensitivities.z - - \ No newline at end of file diff --git a/docs/generated/colour.characterisation.augmented_matrix_Cheung2004.rst b/docs/generated/colour.characterisation.augmented_matrix_Cheung2004.rst deleted file mode 100644 index c0f5984192..0000000000 --- a/docs/generated/colour.characterisation.augmented_matrix_Cheung2004.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.characterisation.augmented\_matrix\_Cheung2004 -===================================================== - -.. currentmodule:: colour.characterisation - -.. autofunction:: augmented_matrix_Cheung2004 \ No newline at end of file diff --git a/docs/generated/colour.characterisation.colour_correction_Cheung2004.rst b/docs/generated/colour.characterisation.colour_correction_Cheung2004.rst deleted file mode 100644 index 060d377815..0000000000 --- a/docs/generated/colour.characterisation.colour_correction_Cheung2004.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.characterisation.colour\_correction\_Cheung2004 -====================================================== - -.. currentmodule:: colour.characterisation - -.. autofunction:: colour_correction_Cheung2004 \ No newline at end of file diff --git a/docs/generated/colour.characterisation.colour_correction_Finlayson2015.rst b/docs/generated/colour.characterisation.colour_correction_Finlayson2015.rst deleted file mode 100644 index 9e43e17039..0000000000 --- a/docs/generated/colour.characterisation.colour_correction_Finlayson2015.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.characterisation.colour\_correction\_Finlayson2015 -========================================================= - -.. currentmodule:: colour.characterisation - -.. autofunction:: colour_correction_Finlayson2015 \ No newline at end of file diff --git a/docs/generated/colour.characterisation.colour_correction_Vandermonde.rst b/docs/generated/colour.characterisation.colour_correction_Vandermonde.rst deleted file mode 100644 index 748fd46382..0000000000 --- a/docs/generated/colour.characterisation.colour_correction_Vandermonde.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.characterisation.colour\_correction\_Vandermonde -======================================================= - -.. currentmodule:: colour.characterisation - -.. autofunction:: colour_correction_Vandermonde \ No newline at end of file diff --git a/docs/generated/colour.characterisation.colour_correction_matrix_Cheung2004.rst b/docs/generated/colour.characterisation.colour_correction_matrix_Cheung2004.rst deleted file mode 100644 index 4c04b4e6a3..0000000000 --- a/docs/generated/colour.characterisation.colour_correction_matrix_Cheung2004.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.characterisation.colour\_correction\_matrix\_Cheung2004 -============================================================== - -.. currentmodule:: colour.characterisation - -.. autofunction:: colour_correction_matrix_Cheung2004 \ No newline at end of file diff --git a/docs/generated/colour.characterisation.colour_correction_matrix_Finlayson2015.rst b/docs/generated/colour.characterisation.colour_correction_matrix_Finlayson2015.rst deleted file mode 100644 index 15db521794..0000000000 --- a/docs/generated/colour.characterisation.colour_correction_matrix_Finlayson2015.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.characterisation.colour\_correction\_matrix\_Finlayson2015 -================================================================= - -.. currentmodule:: colour.characterisation - -.. autofunction:: colour_correction_matrix_Finlayson2015 \ No newline at end of file diff --git a/docs/generated/colour.characterisation.colour_correction_matrix_Vandermonde.rst b/docs/generated/colour.characterisation.colour_correction_matrix_Vandermonde.rst deleted file mode 100644 index a10abe57aa..0000000000 --- a/docs/generated/colour.characterisation.colour_correction_matrix_Vandermonde.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.characterisation.colour\_correction\_matrix\_Vandermonde -=============================================================== - -.. currentmodule:: colour.characterisation - -.. autofunction:: colour_correction_matrix_Vandermonde \ No newline at end of file diff --git a/docs/generated/colour.characterisation.polynomial_expansion_Finlayson2015.rst b/docs/generated/colour.characterisation.polynomial_expansion_Finlayson2015.rst deleted file mode 100644 index 24db8a1fcc..0000000000 --- a/docs/generated/colour.characterisation.polynomial_expansion_Finlayson2015.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.characterisation.polynomial\_expansion\_Finlayson2015 -============================================================ - -.. currentmodule:: colour.characterisation - -.. autofunction:: polynomial_expansion_Finlayson2015 \ No newline at end of file diff --git a/docs/generated/colour.characterisation.polynomial_expansion_Vandermonde.rst b/docs/generated/colour.characterisation.polynomial_expansion_Vandermonde.rst deleted file mode 100644 index c8b97e8a5a..0000000000 --- a/docs/generated/colour.characterisation.polynomial_expansion_Vandermonde.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.characterisation.polynomial\_expansion\_Vandermonde -========================================================== - -.. currentmodule:: colour.characterisation - -.. autofunction:: polynomial_expansion_Vandermonde \ No newline at end of file diff --git a/docs/generated/colour.chromatic_adaptation.rst b/docs/generated/colour.chromatic_adaptation.rst deleted file mode 100644 index 29d7f347bf..0000000000 --- a/docs/generated/colour.chromatic_adaptation.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.chromatic\_adaptation -============================ - -.. currentmodule:: colour - -.. autofunction:: chromatic_adaptation \ No newline at end of file diff --git a/docs/generated/colour.chromatically_adapted_primaries.rst b/docs/generated/colour.chromatically_adapted_primaries.rst deleted file mode 100644 index 5b4d22c1fa..0000000000 --- a/docs/generated/colour.chromatically_adapted_primaries.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.chromatically\_adapted\_primaries -======================================== - -.. currentmodule:: colour - -.. autofunction:: chromatically_adapted_primaries \ No newline at end of file diff --git a/docs/generated/colour.colorimetric_purity.rst b/docs/generated/colour.colorimetric_purity.rst deleted file mode 100644 index 87bfb11bdb..0000000000 --- a/docs/generated/colour.colorimetric_purity.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetric\_purity -=========================== - -.. currentmodule:: colour - -.. autofunction:: colorimetric_purity \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.LMS_10_degree_cmfs_to_XYZ_10_degree_cmfs.rst b/docs/generated/colour.colorimetry.LMS_10_degree_cmfs_to_XYZ_10_degree_cmfs.rst deleted file mode 100644 index 2ccd2c14a1..0000000000 --- a/docs/generated/colour.colorimetry.LMS_10_degree_cmfs_to_XYZ_10_degree_cmfs.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.LMS\_10\_degree\_cmfs\_to\_XYZ\_10\_degree\_cmfs -=================================================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: LMS_10_degree_cmfs_to_XYZ_10_degree_cmfs \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs.rst b/docs/generated/colour.colorimetry.LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs.rst deleted file mode 100644 index 3ebe6ad0f7..0000000000 --- a/docs/generated/colour.colorimetry.LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.LMS\_2\_degree\_cmfs\_to\_XYZ\_2\_degree\_cmfs -================================================================= - -.. currentmodule:: colour.colorimetry - -.. autofunction:: LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.LMS_ConeFundamentals.rst b/docs/generated/colour.colorimetry.LMS_ConeFundamentals.rst deleted file mode 100644 index 6c08c2d638..0000000000 --- a/docs/generated/colour.colorimetry.LMS_ConeFundamentals.rst +++ /dev/null @@ -1,68 +0,0 @@ -colour.colorimetry.LMS\_ConeFundamentals -======================================== - -.. currentmodule:: colour.colorimetry - -.. autoclass:: LMS_ConeFundamentals - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~LMS_ConeFundamentals.__init__ - ~LMS_ConeFundamentals.align - ~LMS_ConeFundamentals.arithmetical_operation - ~LMS_ConeFundamentals.clone - ~LMS_ConeFundamentals.copy - ~LMS_ConeFundamentals.domain_distance - ~LMS_ConeFundamentals.extrapolate - ~LMS_ConeFundamentals.fill_nan - ~LMS_ConeFundamentals.get - ~LMS_ConeFundamentals.interpolate - ~LMS_ConeFundamentals.is_uniform - ~LMS_ConeFundamentals.multi_signal_unpack_data - ~LMS_ConeFundamentals.normalise - ~LMS_ConeFundamentals.to_dataframe - ~LMS_ConeFundamentals.to_sds - ~LMS_ConeFundamentals.trim - ~LMS_ConeFundamentals.trim_wavelengths - ~LMS_ConeFundamentals.zeros - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~LMS_ConeFundamentals.data - ~LMS_ConeFundamentals.domain - ~LMS_ConeFundamentals.dtype - ~LMS_ConeFundamentals.extrapolator - ~LMS_ConeFundamentals.extrapolator_args - ~LMS_ConeFundamentals.function - ~LMS_ConeFundamentals.interpolator - ~LMS_ConeFundamentals.interpolator_args - ~LMS_ConeFundamentals.items - ~LMS_ConeFundamentals.labels - ~LMS_ConeFundamentals.mapping - ~LMS_ConeFundamentals.name - ~LMS_ConeFundamentals.range - ~LMS_ConeFundamentals.shape - ~LMS_ConeFundamentals.signal_type - ~LMS_ConeFundamentals.signals - ~LMS_ConeFundamentals.strict_labels - ~LMS_ConeFundamentals.strict_name - ~LMS_ConeFundamentals.title - ~LMS_ConeFundamentals.values - ~LMS_ConeFundamentals.wavelengths - ~LMS_ConeFundamentals.x - ~LMS_ConeFundamentals.y - ~LMS_ConeFundamentals.z - - \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.RGB_10_degree_cmfs_to_LMS_10_degree_cmfs.rst b/docs/generated/colour.colorimetry.RGB_10_degree_cmfs_to_LMS_10_degree_cmfs.rst deleted file mode 100644 index 1d905b3d74..0000000000 --- a/docs/generated/colour.colorimetry.RGB_10_degree_cmfs_to_LMS_10_degree_cmfs.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.RGB\_10\_degree\_cmfs\_to\_LMS\_10\_degree\_cmfs -=================================================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: RGB_10_degree_cmfs_to_LMS_10_degree_cmfs \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.RGB_10_degree_cmfs_to_XYZ_10_degree_cmfs.rst b/docs/generated/colour.colorimetry.RGB_10_degree_cmfs_to_XYZ_10_degree_cmfs.rst deleted file mode 100644 index a1f9d0a92e..0000000000 --- a/docs/generated/colour.colorimetry.RGB_10_degree_cmfs_to_XYZ_10_degree_cmfs.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.RGB\_10\_degree\_cmfs\_to\_XYZ\_10\_degree\_cmfs -=================================================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: RGB_10_degree_cmfs_to_XYZ_10_degree_cmfs \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.RGB_2_degree_cmfs_to_XYZ_2_degree_cmfs.rst b/docs/generated/colour.colorimetry.RGB_2_degree_cmfs_to_XYZ_2_degree_cmfs.rst deleted file mode 100644 index 34140318ef..0000000000 --- a/docs/generated/colour.colorimetry.RGB_2_degree_cmfs_to_XYZ_2_degree_cmfs.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.RGB\_2\_degree\_cmfs\_to\_XYZ\_2\_degree\_cmfs -================================================================= - -.. currentmodule:: colour.colorimetry - -.. autofunction:: RGB_2_degree_cmfs_to_XYZ_2_degree_cmfs \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.RGB_ColourMatchingFunctions.rst b/docs/generated/colour.colorimetry.RGB_ColourMatchingFunctions.rst deleted file mode 100644 index 40fa4a321e..0000000000 --- a/docs/generated/colour.colorimetry.RGB_ColourMatchingFunctions.rst +++ /dev/null @@ -1,68 +0,0 @@ -colour.colorimetry.RGB\_ColourMatchingFunctions -=============================================== - -.. currentmodule:: colour.colorimetry - -.. autoclass:: RGB_ColourMatchingFunctions - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~RGB_ColourMatchingFunctions.__init__ - ~RGB_ColourMatchingFunctions.align - ~RGB_ColourMatchingFunctions.arithmetical_operation - ~RGB_ColourMatchingFunctions.clone - ~RGB_ColourMatchingFunctions.copy - ~RGB_ColourMatchingFunctions.domain_distance - ~RGB_ColourMatchingFunctions.extrapolate - ~RGB_ColourMatchingFunctions.fill_nan - ~RGB_ColourMatchingFunctions.get - ~RGB_ColourMatchingFunctions.interpolate - ~RGB_ColourMatchingFunctions.is_uniform - ~RGB_ColourMatchingFunctions.multi_signal_unpack_data - ~RGB_ColourMatchingFunctions.normalise - ~RGB_ColourMatchingFunctions.to_dataframe - ~RGB_ColourMatchingFunctions.to_sds - ~RGB_ColourMatchingFunctions.trim - ~RGB_ColourMatchingFunctions.trim_wavelengths - ~RGB_ColourMatchingFunctions.zeros - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~RGB_ColourMatchingFunctions.data - ~RGB_ColourMatchingFunctions.domain - ~RGB_ColourMatchingFunctions.dtype - ~RGB_ColourMatchingFunctions.extrapolator - ~RGB_ColourMatchingFunctions.extrapolator_args - ~RGB_ColourMatchingFunctions.function - ~RGB_ColourMatchingFunctions.interpolator - ~RGB_ColourMatchingFunctions.interpolator_args - ~RGB_ColourMatchingFunctions.items - ~RGB_ColourMatchingFunctions.labels - ~RGB_ColourMatchingFunctions.mapping - ~RGB_ColourMatchingFunctions.name - ~RGB_ColourMatchingFunctions.range - ~RGB_ColourMatchingFunctions.shape - ~RGB_ColourMatchingFunctions.signal_type - ~RGB_ColourMatchingFunctions.signals - ~RGB_ColourMatchingFunctions.strict_labels - ~RGB_ColourMatchingFunctions.strict_name - ~RGB_ColourMatchingFunctions.title - ~RGB_ColourMatchingFunctions.values - ~RGB_ColourMatchingFunctions.wavelengths - ~RGB_ColourMatchingFunctions.x - ~RGB_ColourMatchingFunctions.y - ~RGB_ColourMatchingFunctions.z - - \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.XYZ_ColourMatchingFunctions.rst b/docs/generated/colour.colorimetry.XYZ_ColourMatchingFunctions.rst deleted file mode 100644 index 6e55186552..0000000000 --- a/docs/generated/colour.colorimetry.XYZ_ColourMatchingFunctions.rst +++ /dev/null @@ -1,68 +0,0 @@ -colour.colorimetry.XYZ\_ColourMatchingFunctions -=============================================== - -.. currentmodule:: colour.colorimetry - -.. autoclass:: XYZ_ColourMatchingFunctions - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~XYZ_ColourMatchingFunctions.__init__ - ~XYZ_ColourMatchingFunctions.align - ~XYZ_ColourMatchingFunctions.arithmetical_operation - ~XYZ_ColourMatchingFunctions.clone - ~XYZ_ColourMatchingFunctions.copy - ~XYZ_ColourMatchingFunctions.domain_distance - ~XYZ_ColourMatchingFunctions.extrapolate - ~XYZ_ColourMatchingFunctions.fill_nan - ~XYZ_ColourMatchingFunctions.get - ~XYZ_ColourMatchingFunctions.interpolate - ~XYZ_ColourMatchingFunctions.is_uniform - ~XYZ_ColourMatchingFunctions.multi_signal_unpack_data - ~XYZ_ColourMatchingFunctions.normalise - ~XYZ_ColourMatchingFunctions.to_dataframe - ~XYZ_ColourMatchingFunctions.to_sds - ~XYZ_ColourMatchingFunctions.trim - ~XYZ_ColourMatchingFunctions.trim_wavelengths - ~XYZ_ColourMatchingFunctions.zeros - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~XYZ_ColourMatchingFunctions.data - ~XYZ_ColourMatchingFunctions.domain - ~XYZ_ColourMatchingFunctions.dtype - ~XYZ_ColourMatchingFunctions.extrapolator - ~XYZ_ColourMatchingFunctions.extrapolator_args - ~XYZ_ColourMatchingFunctions.function - ~XYZ_ColourMatchingFunctions.interpolator - ~XYZ_ColourMatchingFunctions.interpolator_args - ~XYZ_ColourMatchingFunctions.items - ~XYZ_ColourMatchingFunctions.labels - ~XYZ_ColourMatchingFunctions.mapping - ~XYZ_ColourMatchingFunctions.name - ~XYZ_ColourMatchingFunctions.range - ~XYZ_ColourMatchingFunctions.shape - ~XYZ_ColourMatchingFunctions.signal_type - ~XYZ_ColourMatchingFunctions.signals - ~XYZ_ColourMatchingFunctions.strict_labels - ~XYZ_ColourMatchingFunctions.strict_name - ~XYZ_ColourMatchingFunctions.title - ~XYZ_ColourMatchingFunctions.values - ~XYZ_ColourMatchingFunctions.wavelengths - ~XYZ_ColourMatchingFunctions.x - ~XYZ_ColourMatchingFunctions.y - ~XYZ_ColourMatchingFunctions.z - - \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.adjust_tristimulus_weighting_factors_ASTME30815.rst b/docs/generated/colour.colorimetry.adjust_tristimulus_weighting_factors_ASTME30815.rst deleted file mode 100644 index cf25fa2c26..0000000000 --- a/docs/generated/colour.colorimetry.adjust_tristimulus_weighting_factors_ASTME30815.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.adjust\_tristimulus\_weighting\_factors\_ASTME30815 -====================================================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: adjust_tristimulus_weighting_factors_ASTME30815 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.bandpass_correction_Stearns1988.rst b/docs/generated/colour.colorimetry.bandpass_correction_Stearns1988.rst deleted file mode 100644 index d7a113ef86..0000000000 --- a/docs/generated/colour.colorimetry.bandpass_correction_Stearns1988.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.bandpass\_correction\_Stearns1988 -==================================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: bandpass_correction_Stearns1988 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.blackbody_spectral_radiance.rst b/docs/generated/colour.colorimetry.blackbody_spectral_radiance.rst deleted file mode 100644 index 96c4b34048..0000000000 --- a/docs/generated/colour.colorimetry.blackbody_spectral_radiance.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.blackbody\_spectral\_radiance -================================================ - -.. currentmodule:: colour.colorimetry - -.. autofunction:: blackbody_spectral_radiance \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.daylight_locus_function.rst b/docs/generated/colour.colorimetry.daylight_locus_function.rst deleted file mode 100644 index 2bcbcfd892..0000000000 --- a/docs/generated/colour.colorimetry.daylight_locus_function.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.daylight\_locus\_function -============================================ - -.. currentmodule:: colour.colorimetry - -.. autofunction:: daylight_locus_function \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.intermediate_lightness_function_CIE1976.rst b/docs/generated/colour.colorimetry.intermediate_lightness_function_CIE1976.rst deleted file mode 100644 index 6fbe8e1fb0..0000000000 --- a/docs/generated/colour.colorimetry.intermediate_lightness_function_CIE1976.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.intermediate\_lightness\_function\_CIE1976 -============================================================= - -.. currentmodule:: colour.colorimetry - -.. autofunction:: intermediate_lightness_function_CIE1976 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.intermediate_luminance_function_CIE1976.rst b/docs/generated/colour.colorimetry.intermediate_luminance_function_CIE1976.rst deleted file mode 100644 index afd50138bb..0000000000 --- a/docs/generated/colour.colorimetry.intermediate_luminance_function_CIE1976.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.intermediate\_luminance\_function\_CIE1976 -============================================================= - -.. currentmodule:: colour.colorimetry - -.. autofunction:: intermediate_luminance_function_CIE1976 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.lagrange_coefficients_ASTME202211.rst b/docs/generated/colour.colorimetry.lagrange_coefficients_ASTME202211.rst deleted file mode 100644 index a64360aaf5..0000000000 --- a/docs/generated/colour.colorimetry.lagrange_coefficients_ASTME202211.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.lagrange\_coefficients\_ASTME202211 -====================================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: lagrange_coefficients_ASTME202211 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.lightness_CIE1976.rst b/docs/generated/colour.colorimetry.lightness_CIE1976.rst deleted file mode 100644 index 44f71d3def..0000000000 --- a/docs/generated/colour.colorimetry.lightness_CIE1976.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.lightness\_CIE1976 -===================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: lightness_CIE1976 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.lightness_Fairchild2010.rst b/docs/generated/colour.colorimetry.lightness_Fairchild2010.rst deleted file mode 100644 index c3559d70f1..0000000000 --- a/docs/generated/colour.colorimetry.lightness_Fairchild2010.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.lightness\_Fairchild2010 -=========================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: lightness_Fairchild2010 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.lightness_Fairchild2011.rst b/docs/generated/colour.colorimetry.lightness_Fairchild2011.rst deleted file mode 100644 index b575141be7..0000000000 --- a/docs/generated/colour.colorimetry.lightness_Fairchild2011.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.lightness\_Fairchild2011 -=========================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: lightness_Fairchild2011 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.lightness_Glasser1958.rst b/docs/generated/colour.colorimetry.lightness_Glasser1958.rst deleted file mode 100644 index d7d455c1c3..0000000000 --- a/docs/generated/colour.colorimetry.lightness_Glasser1958.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.lightness\_Glasser1958 -========================================= - -.. currentmodule:: colour.colorimetry - -.. autofunction:: lightness_Glasser1958 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.lightness_Wyszecki1963.rst b/docs/generated/colour.colorimetry.lightness_Wyszecki1963.rst deleted file mode 100644 index e5bb483db4..0000000000 --- a/docs/generated/colour.colorimetry.lightness_Wyszecki1963.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.lightness\_Wyszecki1963 -========================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: lightness_Wyszecki1963 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.luminance_ASTMD153508.rst b/docs/generated/colour.colorimetry.luminance_ASTMD153508.rst deleted file mode 100644 index 74d0b06f54..0000000000 --- a/docs/generated/colour.colorimetry.luminance_ASTMD153508.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.luminance\_ASTMD153508 -========================================= - -.. currentmodule:: colour.colorimetry - -.. autofunction:: luminance_ASTMD153508 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.luminance_CIE1976.rst b/docs/generated/colour.colorimetry.luminance_CIE1976.rst deleted file mode 100644 index 2ac3662a62..0000000000 --- a/docs/generated/colour.colorimetry.luminance_CIE1976.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.luminance\_CIE1976 -===================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: luminance_CIE1976 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.luminance_Fairchild2010.rst b/docs/generated/colour.colorimetry.luminance_Fairchild2010.rst deleted file mode 100644 index d4de306195..0000000000 --- a/docs/generated/colour.colorimetry.luminance_Fairchild2010.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.luminance\_Fairchild2010 -=========================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: luminance_Fairchild2010 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.luminance_Fairchild2011.rst b/docs/generated/colour.colorimetry.luminance_Fairchild2011.rst deleted file mode 100644 index 91763b5dd5..0000000000 --- a/docs/generated/colour.colorimetry.luminance_Fairchild2011.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.luminance\_Fairchild2011 -=========================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: luminance_Fairchild2011 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.luminance_Newhall1943.rst b/docs/generated/colour.colorimetry.luminance_Newhall1943.rst deleted file mode 100644 index 4d5671516c..0000000000 --- a/docs/generated/colour.colorimetry.luminance_Newhall1943.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.luminance\_Newhall1943 -========================================= - -.. currentmodule:: colour.colorimetry - -.. autofunction:: luminance_Newhall1943 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.multi_sds_to_XYZ_integration.rst b/docs/generated/colour.colorimetry.multi_sds_to_XYZ_integration.rst deleted file mode 100644 index fefd7025bc..0000000000 --- a/docs/generated/colour.colorimetry.multi_sds_to_XYZ_integration.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.multi\_sds\_to\_XYZ\_integration -=================================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: multi_sds_to_XYZ_integration \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.planck_law.rst b/docs/generated/colour.colorimetry.planck_law.rst deleted file mode 100644 index 471fc358ba..0000000000 --- a/docs/generated/colour.colorimetry.planck_law.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.planck\_law -============================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: planck_law \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.sd_gaussian_fwhm.rst b/docs/generated/colour.colorimetry.sd_gaussian_fwhm.rst deleted file mode 100644 index a5641dbab3..0000000000 --- a/docs/generated/colour.colorimetry.sd_gaussian_fwhm.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.sd\_gaussian\_fwhm -===================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: sd_gaussian_fwhm \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.sd_gaussian_normal.rst b/docs/generated/colour.colorimetry.sd_gaussian_normal.rst deleted file mode 100644 index 5d1fce2626..0000000000 --- a/docs/generated/colour.colorimetry.sd_gaussian_normal.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.sd\_gaussian\_normal -======================================= - -.. currentmodule:: colour.colorimetry - -.. autofunction:: sd_gaussian_normal \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.sd_multi_leds_Ohno2005.rst b/docs/generated/colour.colorimetry.sd_multi_leds_Ohno2005.rst deleted file mode 100644 index 36d0b3c754..0000000000 --- a/docs/generated/colour.colorimetry.sd_multi_leds_Ohno2005.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.sd\_multi\_leds\_Ohno2005 -============================================ - -.. currentmodule:: colour.colorimetry - -.. autofunction:: sd_multi_leds_Ohno2005 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.sd_single_led_Ohno2005.rst b/docs/generated/colour.colorimetry.sd_single_led_Ohno2005.rst deleted file mode 100644 index 35b45b1f10..0000000000 --- a/docs/generated/colour.colorimetry.sd_single_led_Ohno2005.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.sd\_single\_led\_Ohno2005 -============================================ - -.. currentmodule:: colour.colorimetry - -.. autofunction:: sd_single_led_Ohno2005 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.sd_to_XYZ_ASTME30815.rst b/docs/generated/colour.colorimetry.sd_to_XYZ_ASTME30815.rst deleted file mode 100644 index 4cccbfad88..0000000000 --- a/docs/generated/colour.colorimetry.sd_to_XYZ_ASTME30815.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.sd\_to\_XYZ\_ASTME30815 -========================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: sd_to_XYZ_ASTME30815 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.sd_to_XYZ_integration.rst b/docs/generated/colour.colorimetry.sd_to_XYZ_integration.rst deleted file mode 100644 index a89632b4df..0000000000 --- a/docs/generated/colour.colorimetry.sd_to_XYZ_integration.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.sd\_to\_XYZ\_integration -=========================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: sd_to_XYZ_integration \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.sd_to_XYZ_tristimulus_weighting_factors_ASTME30815.rst b/docs/generated/colour.colorimetry.sd_to_XYZ_tristimulus_weighting_factors_ASTME30815.rst deleted file mode 100644 index de396eb037..0000000000 --- a/docs/generated/colour.colorimetry.sd_to_XYZ_tristimulus_weighting_factors_ASTME30815.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.sd\_to\_XYZ\_tristimulus\_weighting\_factors\_ASTME30815 -=========================================================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: sd_to_XYZ_tristimulus_weighting_factors_ASTME30815 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.tristimulus_weighting_factors_ASTME202211.rst b/docs/generated/colour.colorimetry.tristimulus_weighting_factors_ASTME202211.rst deleted file mode 100644 index 87aaea244c..0000000000 --- a/docs/generated/colour.colorimetry.tristimulus_weighting_factors_ASTME202211.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.tristimulus\_weighting\_factors\_ASTME202211 -=============================================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: tristimulus_weighting_factors_ASTME202211 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.whiteness_ASTME313.rst b/docs/generated/colour.colorimetry.whiteness_ASTME313.rst deleted file mode 100644 index d47bc8a3ea..0000000000 --- a/docs/generated/colour.colorimetry.whiteness_ASTME313.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.whiteness\_ASTME313 -====================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: whiteness_ASTME313 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.whiteness_Berger1959.rst b/docs/generated/colour.colorimetry.whiteness_Berger1959.rst deleted file mode 100644 index 98dcb15061..0000000000 --- a/docs/generated/colour.colorimetry.whiteness_Berger1959.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.whiteness\_Berger1959 -======================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: whiteness_Berger1959 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.whiteness_CIE2004.rst b/docs/generated/colour.colorimetry.whiteness_CIE2004.rst deleted file mode 100644 index b6d55ef90d..0000000000 --- a/docs/generated/colour.colorimetry.whiteness_CIE2004.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.whiteness\_CIE2004 -===================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: whiteness_CIE2004 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.whiteness_Ganz1979.rst b/docs/generated/colour.colorimetry.whiteness_Ganz1979.rst deleted file mode 100644 index 1addcfb859..0000000000 --- a/docs/generated/colour.colorimetry.whiteness_Ganz1979.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.whiteness\_Ganz1979 -====================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: whiteness_Ganz1979 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.whiteness_Stensby1968.rst b/docs/generated/colour.colorimetry.whiteness_Stensby1968.rst deleted file mode 100644 index 86d90c7693..0000000000 --- a/docs/generated/colour.colorimetry.whiteness_Stensby1968.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.whiteness\_Stensby1968 -========================================= - -.. currentmodule:: colour.colorimetry - -.. autofunction:: whiteness_Stensby1968 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.whiteness_Taube1960.rst b/docs/generated/colour.colorimetry.whiteness_Taube1960.rst deleted file mode 100644 index 898931f427..0000000000 --- a/docs/generated/colour.colorimetry.whiteness_Taube1960.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.whiteness\_Taube1960 -======================================= - -.. currentmodule:: colour.colorimetry - -.. autofunction:: whiteness_Taube1960 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.yellowness_ASTMD1925.rst b/docs/generated/colour.colorimetry.yellowness_ASTMD1925.rst deleted file mode 100644 index 6fdc7ff5c8..0000000000 --- a/docs/generated/colour.colorimetry.yellowness_ASTMD1925.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.yellowness\_ASTMD1925 -======================================== - -.. currentmodule:: colour.colorimetry - -.. autofunction:: yellowness_ASTMD1925 \ No newline at end of file diff --git a/docs/generated/colour.colorimetry.yellowness_ASTME313.rst b/docs/generated/colour.colorimetry.yellowness_ASTME313.rst deleted file mode 100644 index ad75078ed5..0000000000 --- a/docs/generated/colour.colorimetry.yellowness_ASTME313.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colorimetry.yellowness\_ASTME313 -======================================= - -.. currentmodule:: colour.colorimetry - -.. autofunction:: yellowness_ASTME313 \ No newline at end of file diff --git a/docs/generated/colour.colour_correction.rst b/docs/generated/colour.colour_correction.rst deleted file mode 100644 index 6610253f25..0000000000 --- a/docs/generated/colour.colour_correction.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colour\_correction -========================= - -.. currentmodule:: colour - -.. autofunction:: colour_correction \ No newline at end of file diff --git a/docs/generated/colour.colour_correction_matrix.rst b/docs/generated/colour.colour_correction_matrix.rst deleted file mode 100644 index 29240fc598..0000000000 --- a/docs/generated/colour.colour_correction_matrix.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colour\_correction\_matrix -================================= - -.. currentmodule:: colour - -.. autofunction:: colour_correction_matrix \ No newline at end of file diff --git a/docs/generated/colour.colour_quality_scale.rst b/docs/generated/colour.colour_quality_scale.rst deleted file mode 100644 index 784079c997..0000000000 --- a/docs/generated/colour.colour_quality_scale.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colour\_quality\_scale -============================= - -.. currentmodule:: colour - -.. autofunction:: colour_quality_scale \ No newline at end of file diff --git a/docs/generated/colour.colour_rendering_index.rst b/docs/generated/colour.colour_rendering_index.rst deleted file mode 100644 index 5c14bb5a2d..0000000000 --- a/docs/generated/colour.colour_rendering_index.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.colour\_rendering\_index -=============================== - -.. currentmodule:: colour - -.. autofunction:: colour_rendering_index \ No newline at end of file diff --git a/docs/generated/colour.complementary_wavelength.rst b/docs/generated/colour.complementary_wavelength.rst deleted file mode 100644 index 560e84f1db..0000000000 --- a/docs/generated/colour.complementary_wavelength.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.complementary\_wavelength -================================ - -.. currentmodule:: colour - -.. autofunction:: complementary_wavelength \ No newline at end of file diff --git a/docs/generated/colour.constants.AVOGADRO_CONSTANT.rst b/docs/generated/colour.constants.AVOGADRO_CONSTANT.rst deleted file mode 100644 index c51e5bdad6..0000000000 --- a/docs/generated/colour.constants.AVOGADRO_CONSTANT.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.constants.AVOGADRO\_CONSTANT -=================================== - -.. currentmodule:: colour.constants - -.. autodata:: AVOGADRO_CONSTANT \ No newline at end of file diff --git a/docs/generated/colour.constants.BOLTZMANN_CONSTANT.rst b/docs/generated/colour.constants.BOLTZMANN_CONSTANT.rst deleted file mode 100644 index 8c27b4d166..0000000000 --- a/docs/generated/colour.constants.BOLTZMANN_CONSTANT.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.constants.BOLTZMANN\_CONSTANT -==================================== - -.. currentmodule:: colour.constants - -.. autodata:: BOLTZMANN_CONSTANT \ No newline at end of file diff --git a/docs/generated/colour.constants.DEFAULT_FLOAT_DTYPE.rst b/docs/generated/colour.constants.DEFAULT_FLOAT_DTYPE.rst deleted file mode 100644 index d8fae8f4f2..0000000000 --- a/docs/generated/colour.constants.DEFAULT_FLOAT_DTYPE.rst +++ /dev/null @@ -1,97 +0,0 @@ -colour.constants.DEFAULT\_FLOAT\_DTYPE -====================================== - -.. currentmodule:: colour.constants - -.. autoclass:: DEFAULT_FLOAT_DTYPE - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~DEFAULT_FLOAT_DTYPE.all - ~DEFAULT_FLOAT_DTYPE.any - ~DEFAULT_FLOAT_DTYPE.argmax - ~DEFAULT_FLOAT_DTYPE.argmin - ~DEFAULT_FLOAT_DTYPE.argsort - ~DEFAULT_FLOAT_DTYPE.as_integer_ratio - ~DEFAULT_FLOAT_DTYPE.astype - ~DEFAULT_FLOAT_DTYPE.byteswap - ~DEFAULT_FLOAT_DTYPE.choose - ~DEFAULT_FLOAT_DTYPE.clip - ~DEFAULT_FLOAT_DTYPE.compress - ~DEFAULT_FLOAT_DTYPE.conj - ~DEFAULT_FLOAT_DTYPE.conjugate - ~DEFAULT_FLOAT_DTYPE.copy - ~DEFAULT_FLOAT_DTYPE.cumprod - ~DEFAULT_FLOAT_DTYPE.cumsum - ~DEFAULT_FLOAT_DTYPE.diagonal - ~DEFAULT_FLOAT_DTYPE.dump - ~DEFAULT_FLOAT_DTYPE.dumps - ~DEFAULT_FLOAT_DTYPE.fill - ~DEFAULT_FLOAT_DTYPE.flatten - ~DEFAULT_FLOAT_DTYPE.fromhex - ~DEFAULT_FLOAT_DTYPE.getfield - ~DEFAULT_FLOAT_DTYPE.hex - ~DEFAULT_FLOAT_DTYPE.is_integer - ~DEFAULT_FLOAT_DTYPE.item - ~DEFAULT_FLOAT_DTYPE.itemset - ~DEFAULT_FLOAT_DTYPE.max - ~DEFAULT_FLOAT_DTYPE.mean - ~DEFAULT_FLOAT_DTYPE.min - ~DEFAULT_FLOAT_DTYPE.newbyteorder - ~DEFAULT_FLOAT_DTYPE.nonzero - ~DEFAULT_FLOAT_DTYPE.prod - ~DEFAULT_FLOAT_DTYPE.ptp - ~DEFAULT_FLOAT_DTYPE.put - ~DEFAULT_FLOAT_DTYPE.ravel - ~DEFAULT_FLOAT_DTYPE.repeat - ~DEFAULT_FLOAT_DTYPE.reshape - ~DEFAULT_FLOAT_DTYPE.resize - ~DEFAULT_FLOAT_DTYPE.round - ~DEFAULT_FLOAT_DTYPE.searchsorted - ~DEFAULT_FLOAT_DTYPE.setfield - ~DEFAULT_FLOAT_DTYPE.setflags - ~DEFAULT_FLOAT_DTYPE.sort - ~DEFAULT_FLOAT_DTYPE.squeeze - ~DEFAULT_FLOAT_DTYPE.std - ~DEFAULT_FLOAT_DTYPE.sum - ~DEFAULT_FLOAT_DTYPE.swapaxes - ~DEFAULT_FLOAT_DTYPE.take - ~DEFAULT_FLOAT_DTYPE.tobytes - ~DEFAULT_FLOAT_DTYPE.tofile - ~DEFAULT_FLOAT_DTYPE.tolist - ~DEFAULT_FLOAT_DTYPE.tostring - ~DEFAULT_FLOAT_DTYPE.trace - ~DEFAULT_FLOAT_DTYPE.transpose - ~DEFAULT_FLOAT_DTYPE.var - ~DEFAULT_FLOAT_DTYPE.view - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~DEFAULT_FLOAT_DTYPE.T - ~DEFAULT_FLOAT_DTYPE.base - ~DEFAULT_FLOAT_DTYPE.data - ~DEFAULT_FLOAT_DTYPE.dtype - ~DEFAULT_FLOAT_DTYPE.flags - ~DEFAULT_FLOAT_DTYPE.flat - ~DEFAULT_FLOAT_DTYPE.imag - ~DEFAULT_FLOAT_DTYPE.itemsize - ~DEFAULT_FLOAT_DTYPE.nbytes - ~DEFAULT_FLOAT_DTYPE.ndim - ~DEFAULT_FLOAT_DTYPE.real - ~DEFAULT_FLOAT_DTYPE.shape - ~DEFAULT_FLOAT_DTYPE.size - ~DEFAULT_FLOAT_DTYPE.strides - - \ No newline at end of file diff --git a/docs/generated/colour.constants.EPSILON.rst b/docs/generated/colour.constants.EPSILON.rst deleted file mode 100644 index 9cf36f2330..0000000000 --- a/docs/generated/colour.constants.EPSILON.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.constants.EPSILON -======================== - -.. currentmodule:: colour.constants - -.. autodata:: EPSILON \ No newline at end of file diff --git a/docs/generated/colour.constants.FLOATING_POINT_NUMBER_PATTERN.rst b/docs/generated/colour.constants.FLOATING_POINT_NUMBER_PATTERN.rst deleted file mode 100644 index 79544cc9b7..0000000000 --- a/docs/generated/colour.constants.FLOATING_POINT_NUMBER_PATTERN.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.constants.FLOATING\_POINT\_NUMBER\_PATTERN -================================================= - -.. currentmodule:: colour.constants - -.. autodata:: FLOATING_POINT_NUMBER_PATTERN \ No newline at end of file diff --git a/docs/generated/colour.constants.INTEGER_THRESHOLD.rst b/docs/generated/colour.constants.INTEGER_THRESHOLD.rst deleted file mode 100644 index 712df53d8c..0000000000 --- a/docs/generated/colour.constants.INTEGER_THRESHOLD.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.constants.INTEGER\_THRESHOLD -=================================== - -.. currentmodule:: colour.constants - -.. autodata:: INTEGER_THRESHOLD \ No newline at end of file diff --git a/docs/generated/colour.constants.KP_M.rst b/docs/generated/colour.constants.KP_M.rst deleted file mode 100644 index ea71e1398c..0000000000 --- a/docs/generated/colour.constants.KP_M.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.constants.KP\_M -====================== - -.. currentmodule:: colour.constants - -.. autodata:: KP_M \ No newline at end of file diff --git a/docs/generated/colour.constants.K_M.rst b/docs/generated/colour.constants.K_M.rst deleted file mode 100644 index b888169df1..0000000000 --- a/docs/generated/colour.constants.K_M.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.constants.K\_M -===================== - -.. currentmodule:: colour.constants - -.. autodata:: K_M \ No newline at end of file diff --git a/docs/generated/colour.constants.LIGHT_SPEED.rst b/docs/generated/colour.constants.LIGHT_SPEED.rst deleted file mode 100644 index 4f9228af37..0000000000 --- a/docs/generated/colour.constants.LIGHT_SPEED.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.constants.LIGHT\_SPEED -============================= - -.. currentmodule:: colour.constants - -.. autodata:: LIGHT_SPEED \ No newline at end of file diff --git a/docs/generated/colour.constants.PLANCK_CONSTANT.rst b/docs/generated/colour.constants.PLANCK_CONSTANT.rst deleted file mode 100644 index dd59c7c8fa..0000000000 --- a/docs/generated/colour.constants.PLANCK_CONSTANT.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.constants.PLANCK\_CONSTANT -================================= - -.. currentmodule:: colour.constants - -.. autodata:: PLANCK_CONSTANT \ No newline at end of file diff --git a/docs/generated/colour.continuous.AbstractContinuousFunction.rst b/docs/generated/colour.continuous.AbstractContinuousFunction.rst deleted file mode 100644 index 02ac7d1d2c..0000000000 --- a/docs/generated/colour.continuous.AbstractContinuousFunction.rst +++ /dev/null @@ -1,40 +0,0 @@ -colour.continuous.AbstractContinuousFunction -============================================ - -.. currentmodule:: colour.continuous - -.. autoclass:: AbstractContinuousFunction - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~AbstractContinuousFunction.__init__ - ~AbstractContinuousFunction.arithmetical_operation - ~AbstractContinuousFunction.copy - ~AbstractContinuousFunction.domain_distance - ~AbstractContinuousFunction.fill_nan - ~AbstractContinuousFunction.is_uniform - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~AbstractContinuousFunction.domain - ~AbstractContinuousFunction.extrapolator - ~AbstractContinuousFunction.extrapolator_args - ~AbstractContinuousFunction.function - ~AbstractContinuousFunction.interpolator - ~AbstractContinuousFunction.interpolator_args - ~AbstractContinuousFunction.name - ~AbstractContinuousFunction.range - - \ No newline at end of file diff --git a/docs/generated/colour.continuous.MultiSignal.rst b/docs/generated/colour.continuous.MultiSignal.rst deleted file mode 100644 index 7977a5d137..0000000000 --- a/docs/generated/colour.continuous.MultiSignal.rst +++ /dev/null @@ -1,46 +0,0 @@ -colour.continuous.MultiSignal -============================= - -.. currentmodule:: colour.continuous - -.. autoclass:: MultiSignal - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~MultiSignal.__init__ - ~MultiSignal.arithmetical_operation - ~MultiSignal.copy - ~MultiSignal.domain_distance - ~MultiSignal.fill_nan - ~MultiSignal.is_uniform - ~MultiSignal.multi_signal_unpack_data - ~MultiSignal.to_dataframe - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~MultiSignal.domain - ~MultiSignal.dtype - ~MultiSignal.extrapolator - ~MultiSignal.extrapolator_args - ~MultiSignal.function - ~MultiSignal.interpolator - ~MultiSignal.interpolator_args - ~MultiSignal.labels - ~MultiSignal.name - ~MultiSignal.range - ~MultiSignal.signal_type - ~MultiSignal.signals - - \ No newline at end of file diff --git a/docs/generated/colour.continuous.Signal.rst b/docs/generated/colour.continuous.Signal.rst deleted file mode 100644 index 395bb2389f..0000000000 --- a/docs/generated/colour.continuous.Signal.rst +++ /dev/null @@ -1,43 +0,0 @@ -colour.continuous.Signal -======================== - -.. currentmodule:: colour.continuous - -.. autoclass:: Signal - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~Signal.__init__ - ~Signal.arithmetical_operation - ~Signal.copy - ~Signal.domain_distance - ~Signal.fill_nan - ~Signal.is_uniform - ~Signal.signal_unpack_data - ~Signal.to_series - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~Signal.domain - ~Signal.dtype - ~Signal.extrapolator - ~Signal.extrapolator_args - ~Signal.function - ~Signal.interpolator - ~Signal.interpolator_args - ~Signal.name - ~Signal.range - - \ No newline at end of file diff --git a/docs/generated/colour.contrast.contrast_sensitivity_function_Barten1999.rst b/docs/generated/colour.contrast.contrast_sensitivity_function_Barten1999.rst deleted file mode 100644 index ca82733a67..0000000000 --- a/docs/generated/colour.contrast.contrast_sensitivity_function_Barten1999.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.contrast.contrast\_sensitivity\_function\_Barten1999 -=========================================================== - -.. currentmodule:: colour.contrast - -.. autofunction:: contrast_sensitivity_function_Barten1999 \ No newline at end of file diff --git a/docs/generated/colour.contrast.maximum_angular_size_Barten1999.rst b/docs/generated/colour.contrast.maximum_angular_size_Barten1999.rst deleted file mode 100644 index 6d3a8a2a4a..0000000000 --- a/docs/generated/colour.contrast.maximum_angular_size_Barten1999.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.contrast.maximum\_angular\_size\_Barten1999 -================================================== - -.. currentmodule:: colour.contrast - -.. autofunction:: maximum_angular_size_Barten1999 \ No newline at end of file diff --git a/docs/generated/colour.contrast.optical_MTF_Barten1999.rst b/docs/generated/colour.contrast.optical_MTF_Barten1999.rst deleted file mode 100644 index 940ebf1262..0000000000 --- a/docs/generated/colour.contrast.optical_MTF_Barten1999.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.contrast.optical\_MTF\_Barten1999 -======================================== - -.. currentmodule:: colour.contrast - -.. autofunction:: optical_MTF_Barten1999 \ No newline at end of file diff --git a/docs/generated/colour.contrast.pupil_diameter_Barten1999.rst b/docs/generated/colour.contrast.pupil_diameter_Barten1999.rst deleted file mode 100644 index 3a3ab4b18c..0000000000 --- a/docs/generated/colour.contrast.pupil_diameter_Barten1999.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.contrast.pupil\_diameter\_Barten1999 -=========================================== - -.. currentmodule:: colour.contrast - -.. autofunction:: pupil_diameter_Barten1999 \ No newline at end of file diff --git a/docs/generated/colour.contrast.retinal_illuminance_Barten1999.rst b/docs/generated/colour.contrast.retinal_illuminance_Barten1999.rst deleted file mode 100644 index 801fa97051..0000000000 --- a/docs/generated/colour.contrast.retinal_illuminance_Barten1999.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.contrast.retinal\_illuminance\_Barten1999 -================================================ - -.. currentmodule:: colour.contrast - -.. autofunction:: retinal_illuminance_Barten1999 \ No newline at end of file diff --git a/docs/generated/colour.contrast.sigma_Barten1999.rst b/docs/generated/colour.contrast.sigma_Barten1999.rst deleted file mode 100644 index cb83686704..0000000000 --- a/docs/generated/colour.contrast.sigma_Barten1999.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.contrast.sigma\_Barten1999 -================================= - -.. currentmodule:: colour.contrast - -.. autofunction:: sigma_Barten1999 \ No newline at end of file diff --git a/docs/generated/colour.contrast_sensitivity_function.rst b/docs/generated/colour.contrast_sensitivity_function.rst deleted file mode 100644 index f9cd3cd764..0000000000 --- a/docs/generated/colour.contrast_sensitivity_function.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.contrast\_sensitivity\_function -====================================== - -.. currentmodule:: colour - -.. autofunction:: contrast_sensitivity_function \ No newline at end of file diff --git a/docs/generated/colour.corresponding.corresponding_chromaticities_prediction_CIE1994.rst b/docs/generated/colour.corresponding.corresponding_chromaticities_prediction_CIE1994.rst deleted file mode 100644 index 393efc647c..0000000000 --- a/docs/generated/colour.corresponding.corresponding_chromaticities_prediction_CIE1994.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.corresponding.corresponding\_chromaticities\_prediction\_CIE1994 -======================================================================= - -.. currentmodule:: colour.corresponding - -.. autofunction:: corresponding_chromaticities_prediction_CIE1994 \ No newline at end of file diff --git a/docs/generated/colour.corresponding.corresponding_chromaticities_prediction_CMCCAT2000.rst b/docs/generated/colour.corresponding.corresponding_chromaticities_prediction_CMCCAT2000.rst deleted file mode 100644 index 78edfec4ab..0000000000 --- a/docs/generated/colour.corresponding.corresponding_chromaticities_prediction_CMCCAT2000.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.corresponding.corresponding\_chromaticities\_prediction\_CMCCAT2000 -========================================================================== - -.. currentmodule:: colour.corresponding - -.. autofunction:: corresponding_chromaticities_prediction_CMCCAT2000 \ No newline at end of file diff --git a/docs/generated/colour.corresponding.corresponding_chromaticities_prediction_Fairchild1990.rst b/docs/generated/colour.corresponding.corresponding_chromaticities_prediction_Fairchild1990.rst deleted file mode 100644 index 1712904f79..0000000000 --- a/docs/generated/colour.corresponding.corresponding_chromaticities_prediction_Fairchild1990.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.corresponding.corresponding\_chromaticities\_prediction\_Fairchild1990 -============================================================================= - -.. currentmodule:: colour.corresponding - -.. autofunction:: corresponding_chromaticities_prediction_Fairchild1990 \ No newline at end of file diff --git a/docs/generated/colour.corresponding.corresponding_chromaticities_prediction_VonKries.rst b/docs/generated/colour.corresponding.corresponding_chromaticities_prediction_VonKries.rst deleted file mode 100644 index 5f70d6c3a2..0000000000 --- a/docs/generated/colour.corresponding.corresponding_chromaticities_prediction_VonKries.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.corresponding.corresponding\_chromaticities\_prediction\_VonKries -======================================================================== - -.. currentmodule:: colour.corresponding - -.. autofunction:: corresponding_chromaticities_prediction_VonKries \ No newline at end of file diff --git a/docs/generated/colour.corresponding_chromaticities_prediction.rst b/docs/generated/colour.corresponding_chromaticities_prediction.rst deleted file mode 100644 index 57f0a91dcf..0000000000 --- a/docs/generated/colour.corresponding_chromaticities_prediction.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.corresponding\_chromaticities\_prediction -================================================ - -.. currentmodule:: colour - -.. autofunction:: corresponding_chromaticities_prediction \ No newline at end of file diff --git a/docs/generated/colour.cvd_matrix_Machado2009.rst b/docs/generated/colour.cvd_matrix_Machado2009.rst deleted file mode 100644 index ea59e2e90e..0000000000 --- a/docs/generated/colour.cvd_matrix_Machado2009.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.cvd\_matrix\_Machado2009 -=============================== - -.. currentmodule:: colour - -.. autofunction:: cvd_matrix_Machado2009 \ No newline at end of file diff --git a/docs/generated/colour.decoding_cctf.rst b/docs/generated/colour.decoding_cctf.rst deleted file mode 100644 index fb16af7cb4..0000000000 --- a/docs/generated/colour.decoding_cctf.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.decoding\_cctf -===================== - -.. currentmodule:: colour - -.. autofunction:: decoding_cctf \ No newline at end of file diff --git a/docs/generated/colour.delta_E.rst b/docs/generated/colour.delta_E.rst deleted file mode 100644 index fa6483798f..0000000000 --- a/docs/generated/colour.delta_E.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.delta\_E -=============== - -.. currentmodule:: colour - -.. autofunction:: delta_E \ No newline at end of file diff --git a/docs/generated/colour.difference.delta_E_CAM02LCD.rst b/docs/generated/colour.difference.delta_E_CAM02LCD.rst deleted file mode 100644 index 58a15f5b2f..0000000000 --- a/docs/generated/colour.difference.delta_E_CAM02LCD.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.difference.delta\_E\_CAM02LCD -==================================== - -.. currentmodule:: colour.difference - -.. autofunction:: delta_E_CAM02LCD \ No newline at end of file diff --git a/docs/generated/colour.difference.delta_E_CAM02SCD.rst b/docs/generated/colour.difference.delta_E_CAM02SCD.rst deleted file mode 100644 index a6d569c7bd..0000000000 --- a/docs/generated/colour.difference.delta_E_CAM02SCD.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.difference.delta\_E\_CAM02SCD -==================================== - -.. currentmodule:: colour.difference - -.. autofunction:: delta_E_CAM02SCD \ No newline at end of file diff --git a/docs/generated/colour.difference.delta_E_CAM02UCS.rst b/docs/generated/colour.difference.delta_E_CAM02UCS.rst deleted file mode 100644 index c72456c33a..0000000000 --- a/docs/generated/colour.difference.delta_E_CAM02UCS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.difference.delta\_E\_CAM02UCS -==================================== - -.. currentmodule:: colour.difference - -.. autofunction:: delta_E_CAM02UCS \ No newline at end of file diff --git a/docs/generated/colour.difference.delta_E_CAM16LCD.rst b/docs/generated/colour.difference.delta_E_CAM16LCD.rst deleted file mode 100644 index a7065a5df0..0000000000 --- a/docs/generated/colour.difference.delta_E_CAM16LCD.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.difference.delta\_E\_CAM16LCD -==================================== - -.. currentmodule:: colour.difference - -.. autofunction:: delta_E_CAM16LCD \ No newline at end of file diff --git a/docs/generated/colour.difference.delta_E_CAM16SCD.rst b/docs/generated/colour.difference.delta_E_CAM16SCD.rst deleted file mode 100644 index aee2634cd7..0000000000 --- a/docs/generated/colour.difference.delta_E_CAM16SCD.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.difference.delta\_E\_CAM16SCD -==================================== - -.. currentmodule:: colour.difference - -.. autofunction:: delta_E_CAM16SCD \ No newline at end of file diff --git a/docs/generated/colour.difference.delta_E_CAM16UCS.rst b/docs/generated/colour.difference.delta_E_CAM16UCS.rst deleted file mode 100644 index 5287083c92..0000000000 --- a/docs/generated/colour.difference.delta_E_CAM16UCS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.difference.delta\_E\_CAM16UCS -==================================== - -.. currentmodule:: colour.difference - -.. autofunction:: delta_E_CAM16UCS \ No newline at end of file diff --git a/docs/generated/colour.difference.delta_E_CIE1976.rst b/docs/generated/colour.difference.delta_E_CIE1976.rst deleted file mode 100644 index d22d0a8a94..0000000000 --- a/docs/generated/colour.difference.delta_E_CIE1976.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.difference.delta\_E\_CIE1976 -=================================== - -.. currentmodule:: colour.difference - -.. autofunction:: delta_E_CIE1976 \ No newline at end of file diff --git a/docs/generated/colour.difference.delta_E_CIE1994.rst b/docs/generated/colour.difference.delta_E_CIE1994.rst deleted file mode 100644 index 78f59c7a95..0000000000 --- a/docs/generated/colour.difference.delta_E_CIE1994.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.difference.delta\_E\_CIE1994 -=================================== - -.. currentmodule:: colour.difference - -.. autofunction:: delta_E_CIE1994 \ No newline at end of file diff --git a/docs/generated/colour.difference.delta_E_CIE2000.rst b/docs/generated/colour.difference.delta_E_CIE2000.rst deleted file mode 100644 index de14de4872..0000000000 --- a/docs/generated/colour.difference.delta_E_CIE2000.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.difference.delta\_E\_CIE2000 -=================================== - -.. currentmodule:: colour.difference - -.. autofunction:: delta_E_CIE2000 \ No newline at end of file diff --git a/docs/generated/colour.difference.delta_E_CMC.rst b/docs/generated/colour.difference.delta_E_CMC.rst deleted file mode 100644 index b8d72efe88..0000000000 --- a/docs/generated/colour.difference.delta_E_CMC.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.difference.delta\_E\_CMC -=============================== - -.. currentmodule:: colour.difference - -.. autofunction:: delta_E_CMC \ No newline at end of file diff --git a/docs/generated/colour.difference.delta_E_DIN99.rst b/docs/generated/colour.difference.delta_E_DIN99.rst deleted file mode 100644 index 8e913885ed..0000000000 --- a/docs/generated/colour.difference.delta_E_DIN99.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.difference.delta\_E\_DIN99 -================================= - -.. currentmodule:: colour.difference - -.. autofunction:: delta_E_DIN99 \ No newline at end of file diff --git a/docs/generated/colour.domain_range_scale.rst b/docs/generated/colour.domain_range_scale.rst deleted file mode 100644 index f775dcb399..0000000000 --- a/docs/generated/colour.domain_range_scale.rst +++ /dev/null @@ -1,22 +0,0 @@ -colour.domain\_range\_scale -=========================== - -.. currentmodule:: colour - -.. autoclass:: domain_range_scale - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~domain_range_scale.__init__ - - - - - - \ No newline at end of file diff --git a/docs/generated/colour.dominant_wavelength.rst b/docs/generated/colour.dominant_wavelength.rst deleted file mode 100644 index 93dabb7cbf..0000000000 --- a/docs/generated/colour.dominant_wavelength.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.dominant\_wavelength -=========================== - -.. currentmodule:: colour - -.. autofunction:: dominant_wavelength \ No newline at end of file diff --git a/docs/generated/colour.encoding_cctf.rst b/docs/generated/colour.encoding_cctf.rst deleted file mode 100644 index 319f5cdcd4..0000000000 --- a/docs/generated/colour.encoding_cctf.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.encoding\_cctf -===================== - -.. currentmodule:: colour - -.. autofunction:: encoding_cctf \ No newline at end of file diff --git a/docs/generated/colour.eotf.rst b/docs/generated/colour.eotf.rst deleted file mode 100644 index 0f8751dc7a..0000000000 --- a/docs/generated/colour.eotf.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.eotf -=========== - -.. currentmodule:: colour - -.. autofunction:: eotf \ No newline at end of file diff --git a/docs/generated/colour.eotf_reverse.rst b/docs/generated/colour.eotf_reverse.rst deleted file mode 100644 index 43c23ed709..0000000000 --- a/docs/generated/colour.eotf_reverse.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.eotf\_reverse -==================== - -.. currentmodule:: colour - -.. autofunction:: eotf_reverse \ No newline at end of file diff --git a/docs/generated/colour.excitation_purity.rst b/docs/generated/colour.excitation_purity.rst deleted file mode 100644 index cd5c5d6c7d..0000000000 --- a/docs/generated/colour.excitation_purity.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.excitation\_purity -========================= - -.. currentmodule:: colour - -.. autofunction:: excitation_purity \ No newline at end of file diff --git a/docs/generated/colour.full_to_legal.rst b/docs/generated/colour.full_to_legal.rst deleted file mode 100644 index 8fa5bae6f3..0000000000 --- a/docs/generated/colour.full_to_legal.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.full\_to\_legal -====================== - -.. currentmodule:: colour - -.. autofunction:: full_to_legal \ No newline at end of file diff --git a/docs/generated/colour.gamma_function.rst b/docs/generated/colour.gamma_function.rst deleted file mode 100644 index 3ecdeb82bf..0000000000 --- a/docs/generated/colour.gamma_function.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.gamma\_function -====================== - -.. currentmodule:: colour - -.. autofunction:: gamma_function \ No newline at end of file diff --git a/docs/generated/colour.get_domain_range_scale.rst b/docs/generated/colour.get_domain_range_scale.rst deleted file mode 100644 index 463cbb0f44..0000000000 --- a/docs/generated/colour.get_domain_range_scale.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.get\_domain\_range\_scale -================================ - -.. currentmodule:: colour - -.. autofunction:: get_domain_range_scale \ No newline at end of file diff --git a/docs/generated/colour.hdr_CIELab_to_XYZ.rst b/docs/generated/colour.hdr_CIELab_to_XYZ.rst deleted file mode 100644 index 7a2afc51d1..0000000000 --- a/docs/generated/colour.hdr_CIELab_to_XYZ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.hdr\_CIELab\_to\_XYZ -=========================== - -.. currentmodule:: colour - -.. autofunction:: hdr_CIELab_to_XYZ \ No newline at end of file diff --git a/docs/generated/colour.hdr_IPT_to_XYZ.rst b/docs/generated/colour.hdr_IPT_to_XYZ.rst deleted file mode 100644 index 379ae5fa78..0000000000 --- a/docs/generated/colour.hdr_IPT_to_XYZ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.hdr\_IPT\_to\_XYZ -======================== - -.. currentmodule:: colour - -.. autofunction:: hdr_IPT_to_XYZ \ No newline at end of file diff --git a/docs/generated/colour.io.AbstractLUTSequenceOperator.rst b/docs/generated/colour.io.AbstractLUTSequenceOperator.rst deleted file mode 100644 index a29dbdf9a9..0000000000 --- a/docs/generated/colour.io.AbstractLUTSequenceOperator.rst +++ /dev/null @@ -1,22 +0,0 @@ -colour.io.AbstractLUTSequenceOperator -===================================== - -.. currentmodule:: colour.io - -.. autoclass:: AbstractLUTSequenceOperator - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~AbstractLUTSequenceOperator.apply - - - - - - \ No newline at end of file diff --git a/docs/generated/colour.io.ImageAttribute_Specification.rst b/docs/generated/colour.io.ImageAttribute_Specification.rst deleted file mode 100644 index f15c2e51ac..0000000000 --- a/docs/generated/colour.io.ImageAttribute_Specification.rst +++ /dev/null @@ -1,31 +0,0 @@ -colour.io.ImageAttribute\_Specification -======================================= - -.. currentmodule:: colour.io - -.. autoclass:: ImageAttribute_Specification - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~ImageAttribute_Specification.count - ~ImageAttribute_Specification.index - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~ImageAttribute_Specification.name - ~ImageAttribute_Specification.type_ - ~ImageAttribute_Specification.value - - \ No newline at end of file diff --git a/docs/generated/colour.io.LUT_to_LUT.rst b/docs/generated/colour.io.LUT_to_LUT.rst deleted file mode 100644 index 6e350a96c6..0000000000 --- a/docs/generated/colour.io.LUT_to_LUT.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.io.LUT\_to\_LUT -====================== - -.. currentmodule:: colour.io - -.. autofunction:: LUT_to_LUT \ No newline at end of file diff --git a/docs/generated/colour.io.read_LUT_Cinespace.rst b/docs/generated/colour.io.read_LUT_Cinespace.rst deleted file mode 100644 index 4d19500886..0000000000 --- a/docs/generated/colour.io.read_LUT_Cinespace.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.io.read\_LUT\_Cinespace -============================== - -.. currentmodule:: colour.io - -.. autofunction:: read_LUT_Cinespace \ No newline at end of file diff --git a/docs/generated/colour.io.read_LUT_IridasCube.rst b/docs/generated/colour.io.read_LUT_IridasCube.rst deleted file mode 100644 index 3a947cfea1..0000000000 --- a/docs/generated/colour.io.read_LUT_IridasCube.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.io.read\_LUT\_IridasCube -=============================== - -.. currentmodule:: colour.io - -.. autofunction:: read_LUT_IridasCube \ No newline at end of file diff --git a/docs/generated/colour.io.read_LUT_SonySPI1D.rst b/docs/generated/colour.io.read_LUT_SonySPI1D.rst deleted file mode 100644 index 53fb8d2e7b..0000000000 --- a/docs/generated/colour.io.read_LUT_SonySPI1D.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.io.read\_LUT\_SonySPI1D -============================== - -.. currentmodule:: colour.io - -.. autofunction:: read_LUT_SonySPI1D \ No newline at end of file diff --git a/docs/generated/colour.io.read_LUT_SonySPI3D.rst b/docs/generated/colour.io.read_LUT_SonySPI3D.rst deleted file mode 100644 index 54ebefceb1..0000000000 --- a/docs/generated/colour.io.read_LUT_SonySPI3D.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.io.read\_LUT\_SonySPI3D -============================== - -.. currentmodule:: colour.io - -.. autofunction:: read_LUT_SonySPI3D \ No newline at end of file diff --git a/docs/generated/colour.io.write_LUT_Cinespace.rst b/docs/generated/colour.io.write_LUT_Cinespace.rst deleted file mode 100644 index 4f909b6220..0000000000 --- a/docs/generated/colour.io.write_LUT_Cinespace.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.io.write\_LUT\_Cinespace -=============================== - -.. currentmodule:: colour.io - -.. autofunction:: write_LUT_Cinespace \ No newline at end of file diff --git a/docs/generated/colour.io.write_LUT_IridasCube.rst b/docs/generated/colour.io.write_LUT_IridasCube.rst deleted file mode 100644 index dd96837efb..0000000000 --- a/docs/generated/colour.io.write_LUT_IridasCube.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.io.write\_LUT\_IridasCube -================================ - -.. currentmodule:: colour.io - -.. autofunction:: write_LUT_IridasCube \ No newline at end of file diff --git a/docs/generated/colour.io.write_LUT_SonySPI1D.rst b/docs/generated/colour.io.write_LUT_SonySPI1D.rst deleted file mode 100644 index 7172310c8f..0000000000 --- a/docs/generated/colour.io.write_LUT_SonySPI1D.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.io.write\_LUT\_SonySPI1D -=============================== - -.. currentmodule:: colour.io - -.. autofunction:: write_LUT_SonySPI1D \ No newline at end of file diff --git a/docs/generated/colour.io.write_LUT_SonySPI3D.rst b/docs/generated/colour.io.write_LUT_SonySPI3D.rst deleted file mode 100644 index 70804ec946..0000000000 --- a/docs/generated/colour.io.write_LUT_SonySPI3D.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.io.write\_LUT\_SonySPI3D -=============================== - -.. currentmodule:: colour.io - -.. autofunction:: write_LUT_SonySPI3D \ No newline at end of file diff --git a/docs/generated/colour.is_within_macadam_limits.rst b/docs/generated/colour.is_within_macadam_limits.rst deleted file mode 100644 index b90d4337ea..0000000000 --- a/docs/generated/colour.is_within_macadam_limits.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.is\_within\_macadam\_limits -================================== - -.. currentmodule:: colour - -.. autofunction:: is_within_macadam_limits \ No newline at end of file diff --git a/docs/generated/colour.is_within_mesh_volume.rst b/docs/generated/colour.is_within_mesh_volume.rst deleted file mode 100644 index c957d07c30..0000000000 --- a/docs/generated/colour.is_within_mesh_volume.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.is\_within\_mesh\_volume -=============================== - -.. currentmodule:: colour - -.. autofunction:: is_within_mesh_volume \ No newline at end of file diff --git a/docs/generated/colour.is_within_pointer_gamut.rst b/docs/generated/colour.is_within_pointer_gamut.rst deleted file mode 100644 index 5ecc31f0ff..0000000000 --- a/docs/generated/colour.is_within_pointer_gamut.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.is\_within\_pointer\_gamut -================================= - -.. currentmodule:: colour - -.. autofunction:: is_within_pointer_gamut \ No newline at end of file diff --git a/docs/generated/colour.is_within_visible_spectrum.rst b/docs/generated/colour.is_within_visible_spectrum.rst deleted file mode 100644 index e5144b346d..0000000000 --- a/docs/generated/colour.is_within_visible_spectrum.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.is\_within\_visible\_spectrum -==================================== - -.. currentmodule:: colour - -.. autofunction:: is_within_visible_spectrum \ No newline at end of file diff --git a/docs/generated/colour.kernel_cardinal_spline.rst b/docs/generated/colour.kernel_cardinal_spline.rst deleted file mode 100644 index a33a857e8e..0000000000 --- a/docs/generated/colour.kernel_cardinal_spline.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.kernel\_cardinal\_spline -=============================== - -.. currentmodule:: colour - -.. autofunction:: kernel_cardinal_spline \ No newline at end of file diff --git a/docs/generated/colour.kernel_lanczos.rst b/docs/generated/colour.kernel_lanczos.rst deleted file mode 100644 index 4d2c0033be..0000000000 --- a/docs/generated/colour.kernel_lanczos.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.kernel\_lanczos -====================== - -.. currentmodule:: colour - -.. autofunction:: kernel_lanczos \ No newline at end of file diff --git a/docs/generated/colour.kernel_linear.rst b/docs/generated/colour.kernel_linear.rst deleted file mode 100644 index aafe64282e..0000000000 --- a/docs/generated/colour.kernel_linear.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.kernel\_linear -===================== - -.. currentmodule:: colour - -.. autofunction:: kernel_linear \ No newline at end of file diff --git a/docs/generated/colour.kernel_nearest_neighbour.rst b/docs/generated/colour.kernel_nearest_neighbour.rst deleted file mode 100644 index 2d3d53b540..0000000000 --- a/docs/generated/colour.kernel_nearest_neighbour.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.kernel\_nearest\_neighbour -================================= - -.. currentmodule:: colour - -.. autofunction:: kernel_nearest_neighbour \ No newline at end of file diff --git a/docs/generated/colour.kernel_sinc.rst b/docs/generated/colour.kernel_sinc.rst deleted file mode 100644 index f9fdfcd342..0000000000 --- a/docs/generated/colour.kernel_sinc.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.kernel\_sinc -=================== - -.. currentmodule:: colour - -.. autofunction:: kernel_sinc \ No newline at end of file diff --git a/docs/generated/colour.lagrange_coefficients.rst b/docs/generated/colour.lagrange_coefficients.rst deleted file mode 100644 index e14ab4b43c..0000000000 --- a/docs/generated/colour.lagrange_coefficients.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.lagrange\_coefficients -============================= - -.. currentmodule:: colour - -.. autofunction:: lagrange_coefficients \ No newline at end of file diff --git a/docs/generated/colour.legal_to_full.rst b/docs/generated/colour.legal_to_full.rst deleted file mode 100644 index 70f60f7d32..0000000000 --- a/docs/generated/colour.legal_to_full.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.legal\_to\_full -====================== - -.. currentmodule:: colour - -.. autofunction:: legal_to_full \ No newline at end of file diff --git a/docs/generated/colour.lightness.rst b/docs/generated/colour.lightness.rst deleted file mode 100644 index 5d75e7ad93..0000000000 --- a/docs/generated/colour.lightness.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.lightness -================ - -.. currentmodule:: colour - -.. autofunction:: lightness \ No newline at end of file diff --git a/docs/generated/colour.linear_function.rst b/docs/generated/colour.linear_function.rst deleted file mode 100644 index af7a72a576..0000000000 --- a/docs/generated/colour.linear_function.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.linear\_function -======================= - -.. currentmodule:: colour - -.. autofunction:: linear_function \ No newline at end of file diff --git a/docs/generated/colour.log_decoding_curve.rst b/docs/generated/colour.log_decoding_curve.rst deleted file mode 100644 index 6bd6cb1c23..0000000000 --- a/docs/generated/colour.log_decoding_curve.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.log\_decoding\_curve -=========================== - -.. currentmodule:: colour - -.. autofunction:: log_decoding_curve \ No newline at end of file diff --git a/docs/generated/colour.log_encoding_curve.rst b/docs/generated/colour.log_encoding_curve.rst deleted file mode 100644 index 1e1de2df08..0000000000 --- a/docs/generated/colour.log_encoding_curve.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.log\_encoding\_curve -=========================== - -.. currentmodule:: colour - -.. autofunction:: log_encoding_curve \ No newline at end of file diff --git a/docs/generated/colour.luminance.rst b/docs/generated/colour.luminance.rst deleted file mode 100644 index 3b5479ae66..0000000000 --- a/docs/generated/colour.luminance.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.luminance -================ - -.. currentmodule:: colour - -.. autofunction:: luminance \ No newline at end of file diff --git a/docs/generated/colour.luminous_efficacy.rst b/docs/generated/colour.luminous_efficacy.rst deleted file mode 100644 index ce00753eea..0000000000 --- a/docs/generated/colour.luminous_efficacy.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.luminous\_efficacy -========================= - -.. currentmodule:: colour - -.. autofunction:: luminous_efficacy \ No newline at end of file diff --git a/docs/generated/colour.luminous_efficiency.rst b/docs/generated/colour.luminous_efficiency.rst deleted file mode 100644 index 0bc440fe8b..0000000000 --- a/docs/generated/colour.luminous_efficiency.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.luminous\_efficiency -=========================== - -.. currentmodule:: colour - -.. autofunction:: luminous_efficiency \ No newline at end of file diff --git a/docs/generated/colour.luminous_flux.rst b/docs/generated/colour.luminous_flux.rst deleted file mode 100644 index facf031b0a..0000000000 --- a/docs/generated/colour.luminous_flux.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.luminous\_flux -===================== - -.. currentmodule:: colour - -.. autofunction:: luminous_flux \ No newline at end of file diff --git a/docs/generated/colour.models.ACES_2065_1_COLOURSPACE.rst b/docs/generated/colour.models.ACES_2065_1_COLOURSPACE.rst deleted file mode 100644 index 492251e796..0000000000 --- a/docs/generated/colour.models.ACES_2065_1_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.ACES\_2065\_1\_COLOURSPACE -======================================== - -.. currentmodule:: colour.models - -.. autodata:: ACES_2065_1_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.ACES_CCT_COLOURSPACE.rst b/docs/generated/colour.models.ACES_CCT_COLOURSPACE.rst deleted file mode 100644 index 3a8df0db23..0000000000 --- a/docs/generated/colour.models.ACES_CCT_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.ACES\_CCT\_COLOURSPACE -==================================== - -.. currentmodule:: colour.models - -.. autodata:: ACES_CCT_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.ACES_CC_COLOURSPACE.rst b/docs/generated/colour.models.ACES_CC_COLOURSPACE.rst deleted file mode 100644 index a25be8baa4..0000000000 --- a/docs/generated/colour.models.ACES_CC_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.ACES\_CC\_COLOURSPACE -=================================== - -.. currentmodule:: colour.models - -.. autodata:: ACES_CC_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.ACES_CG_COLOURSPACE.rst b/docs/generated/colour.models.ACES_CG_COLOURSPACE.rst deleted file mode 100644 index a4698ce9a3..0000000000 --- a/docs/generated/colour.models.ACES_CG_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.ACES\_CG\_COLOURSPACE -=================================== - -.. currentmodule:: colour.models - -.. autodata:: ACES_CG_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.ACES_PROXY_COLOURSPACE.rst b/docs/generated/colour.models.ACES_PROXY_COLOURSPACE.rst deleted file mode 100644 index a303097eab..0000000000 --- a/docs/generated/colour.models.ACES_PROXY_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.ACES\_PROXY\_COLOURSPACE -====================================== - -.. currentmodule:: colour.models - -.. autodata:: ACES_PROXY_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.ACES_RICD.rst b/docs/generated/colour.models.ACES_RICD.rst deleted file mode 100644 index 11bb031096..0000000000 --- a/docs/generated/colour.models.ACES_RICD.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.ACES\_RICD -======================== - -.. currentmodule:: colour.models - -.. autodata:: ACES_RICD \ No newline at end of file diff --git a/docs/generated/colour.models.ADOBE_RGB_1998_COLOURSPACE.rst b/docs/generated/colour.models.ADOBE_RGB_1998_COLOURSPACE.rst deleted file mode 100644 index f626abdec5..0000000000 --- a/docs/generated/colour.models.ADOBE_RGB_1998_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.ADOBE\_RGB\_1998\_COLOURSPACE -=========================================== - -.. currentmodule:: colour.models - -.. autodata:: ADOBE_RGB_1998_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.ADOBE_WIDE_GAMUT_RGB_COLOURSPACE.rst b/docs/generated/colour.models.ADOBE_WIDE_GAMUT_RGB_COLOURSPACE.rst deleted file mode 100644 index 94fbcb852e..0000000000 --- a/docs/generated/colour.models.ADOBE_WIDE_GAMUT_RGB_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.ADOBE\_WIDE\_GAMUT\_RGB\_COLOURSPACE -================================================== - -.. currentmodule:: colour.models - -.. autodata:: ADOBE_WIDE_GAMUT_RGB_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.ALEXA_WIDE_GAMUT_COLOURSPACE.rst b/docs/generated/colour.models.ALEXA_WIDE_GAMUT_COLOURSPACE.rst deleted file mode 100644 index 4304405eb3..0000000000 --- a/docs/generated/colour.models.ALEXA_WIDE_GAMUT_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.ALEXA\_WIDE\_GAMUT\_COLOURSPACE -============================================= - -.. currentmodule:: colour.models - -.. autodata:: ALEXA_WIDE_GAMUT_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.APPLE_RGB_COLOURSPACE.rst b/docs/generated/colour.models.APPLE_RGB_COLOURSPACE.rst deleted file mode 100644 index 46ad43401a..0000000000 --- a/docs/generated/colour.models.APPLE_RGB_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.APPLE\_RGB\_COLOURSPACE -===================================== - -.. currentmodule:: colour.models - -.. autodata:: APPLE_RGB_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.BEST_RGB_COLOURSPACE.rst b/docs/generated/colour.models.BEST_RGB_COLOURSPACE.rst deleted file mode 100644 index 4da661626e..0000000000 --- a/docs/generated/colour.models.BEST_RGB_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.BEST\_RGB\_COLOURSPACE -==================================== - -.. currentmodule:: colour.models - -.. autodata:: BEST_RGB_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.BETA_RGB_COLOURSPACE.rst b/docs/generated/colour.models.BETA_RGB_COLOURSPACE.rst deleted file mode 100644 index 769ce8eda2..0000000000 --- a/docs/generated/colour.models.BETA_RGB_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.BETA\_RGB\_COLOURSPACE -==================================== - -.. currentmodule:: colour.models - -.. autodata:: BETA_RGB_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.BT2020_COLOURSPACE.rst b/docs/generated/colour.models.BT2020_COLOURSPACE.rst deleted file mode 100644 index 7ae62dc95e..0000000000 --- a/docs/generated/colour.models.BT2020_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.BT2020\_COLOURSPACE -================================= - -.. currentmodule:: colour.models - -.. autodata:: BT2020_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.BT470_525_COLOURSPACE.rst b/docs/generated/colour.models.BT470_525_COLOURSPACE.rst deleted file mode 100644 index 1150ad4c7c..0000000000 --- a/docs/generated/colour.models.BT470_525_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.BT470\_525\_COLOURSPACE -===================================== - -.. currentmodule:: colour.models - -.. autodata:: BT470_525_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.BT470_625_COLOURSPACE.rst b/docs/generated/colour.models.BT470_625_COLOURSPACE.rst deleted file mode 100644 index 6d89623243..0000000000 --- a/docs/generated/colour.models.BT470_625_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.BT470\_625\_COLOURSPACE -===================================== - -.. currentmodule:: colour.models - -.. autodata:: BT470_625_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.BT709_COLOURSPACE.rst b/docs/generated/colour.models.BT709_COLOURSPACE.rst deleted file mode 100644 index c34beb74f9..0000000000 --- a/docs/generated/colour.models.BT709_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.BT709\_COLOURSPACE -================================ - -.. currentmodule:: colour.models - -.. autodata:: BT709_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.CIE_RGB_COLOURSPACE.rst b/docs/generated/colour.models.CIE_RGB_COLOURSPACE.rst deleted file mode 100644 index ded217809a..0000000000 --- a/docs/generated/colour.models.CIE_RGB_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.CIE\_RGB\_COLOURSPACE -=================================== - -.. currentmodule:: colour.models - -.. autodata:: CIE_RGB_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.CINEMA_GAMUT_COLOURSPACE.rst b/docs/generated/colour.models.CINEMA_GAMUT_COLOURSPACE.rst deleted file mode 100644 index dc73d5283e..0000000000 --- a/docs/generated/colour.models.CINEMA_GAMUT_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.CINEMA\_GAMUT\_COLOURSPACE -======================================== - -.. currentmodule:: colour.models - -.. autodata:: CINEMA_GAMUT_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.COLOR_MATCH_RGB_COLOURSPACE.rst b/docs/generated/colour.models.COLOR_MATCH_RGB_COLOURSPACE.rst deleted file mode 100644 index 83149b9b41..0000000000 --- a/docs/generated/colour.models.COLOR_MATCH_RGB_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.COLOR\_MATCH\_RGB\_COLOURSPACE -============================================ - -.. currentmodule:: colour.models - -.. autodata:: COLOR_MATCH_RGB_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.DCDM_XYZ_COLOURSPACE.rst b/docs/generated/colour.models.DCDM_XYZ_COLOURSPACE.rst deleted file mode 100644 index 4167dac293..0000000000 --- a/docs/generated/colour.models.DCDM_XYZ_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.DCDM\_XYZ\_COLOURSPACE -==================================== - -.. currentmodule:: colour.models - -.. autodata:: DCDM_XYZ_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.DCI_P3_COLOURSPACE.rst b/docs/generated/colour.models.DCI_P3_COLOURSPACE.rst deleted file mode 100644 index 32ccab18dd..0000000000 --- a/docs/generated/colour.models.DCI_P3_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.DCI\_P3\_COLOURSPACE -================================== - -.. currentmodule:: colour.models - -.. autodata:: DCI_P3_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.DCI_P3_P_COLOURSPACE.rst b/docs/generated/colour.models.DCI_P3_P_COLOURSPACE.rst deleted file mode 100644 index e4a10fcb9c..0000000000 --- a/docs/generated/colour.models.DCI_P3_P_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.DCI\_P3\_P\_COLOURSPACE -===================================== - -.. currentmodule:: colour.models - -.. autodata:: DCI_P3_P_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.DON_RGB_4_COLOURSPACE.rst b/docs/generated/colour.models.DON_RGB_4_COLOURSPACE.rst deleted file mode 100644 index a666c5bfb3..0000000000 --- a/docs/generated/colour.models.DON_RGB_4_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.DON\_RGB\_4\_COLOURSPACE -====================================== - -.. currentmodule:: colour.models - -.. autodata:: DON_RGB_4_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.DRAGON_COLOR_2_COLOURSPACE.rst b/docs/generated/colour.models.DRAGON_COLOR_2_COLOURSPACE.rst deleted file mode 100644 index 2b22b551b3..0000000000 --- a/docs/generated/colour.models.DRAGON_COLOR_2_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.DRAGON\_COLOR\_2\_COLOURSPACE -=========================================== - -.. currentmodule:: colour.models - -.. autodata:: DRAGON_COLOR_2_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.DRAGON_COLOR_COLOURSPACE.rst b/docs/generated/colour.models.DRAGON_COLOR_COLOURSPACE.rst deleted file mode 100644 index 1de4687017..0000000000 --- a/docs/generated/colour.models.DRAGON_COLOR_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.DRAGON\_COLOR\_COLOURSPACE -======================================== - -.. currentmodule:: colour.models - -.. autodata:: DRAGON_COLOR_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.ECI_RGB_V2_COLOURSPACE.rst b/docs/generated/colour.models.ECI_RGB_V2_COLOURSPACE.rst deleted file mode 100644 index 8b0067f05f..0000000000 --- a/docs/generated/colour.models.ECI_RGB_V2_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.ECI\_RGB\_V2\_COLOURSPACE -======================================= - -.. currentmodule:: colour.models - -.. autodata:: ECI_RGB_V2_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.EKTA_SPACE_PS_5_COLOURSPACE.rst b/docs/generated/colour.models.EKTA_SPACE_PS_5_COLOURSPACE.rst deleted file mode 100644 index cbaa85e4a9..0000000000 --- a/docs/generated/colour.models.EKTA_SPACE_PS_5_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.EKTA\_SPACE\_PS\_5\_COLOURSPACE -============================================= - -.. currentmodule:: colour.models - -.. autodata:: EKTA_SPACE_PS_5_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.ERIMM_RGB_COLOURSPACE.rst b/docs/generated/colour.models.ERIMM_RGB_COLOURSPACE.rst deleted file mode 100644 index cfb58aeb3c..0000000000 --- a/docs/generated/colour.models.ERIMM_RGB_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.ERIMM\_RGB\_COLOURSPACE -===================================== - -.. currentmodule:: colour.models - -.. autodata:: ERIMM_RGB_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.MAX_RGB_COLOURSPACE.rst b/docs/generated/colour.models.MAX_RGB_COLOURSPACE.rst deleted file mode 100644 index eed375cc49..0000000000 --- a/docs/generated/colour.models.MAX_RGB_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.MAX\_RGB\_COLOURSPACE -=================================== - -.. currentmodule:: colour.models - -.. autodata:: MAX_RGB_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.NTSC_COLOURSPACE.rst b/docs/generated/colour.models.NTSC_COLOURSPACE.rst deleted file mode 100644 index 8b48d96c9d..0000000000 --- a/docs/generated/colour.models.NTSC_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.NTSC\_COLOURSPACE -=============================== - -.. currentmodule:: colour.models - -.. autodata:: NTSC_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.P3_D65_COLOURSPACE.rst b/docs/generated/colour.models.P3_D65_COLOURSPACE.rst deleted file mode 100644 index 36f0d0457b..0000000000 --- a/docs/generated/colour.models.P3_D65_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.P3\_D65\_COLOURSPACE -================================== - -.. currentmodule:: colour.models - -.. autodata:: P3_D65_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.PAL_SECAM_COLOURSPACE.rst b/docs/generated/colour.models.PAL_SECAM_COLOURSPACE.rst deleted file mode 100644 index e054f3d15d..0000000000 --- a/docs/generated/colour.models.PAL_SECAM_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.PAL\_SECAM\_COLOURSPACE -===================================== - -.. currentmodule:: colour.models - -.. autodata:: PAL_SECAM_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.PROPHOTO_RGB_COLOURSPACE.rst b/docs/generated/colour.models.PROPHOTO_RGB_COLOURSPACE.rst deleted file mode 100644 index c38c7c119c..0000000000 --- a/docs/generated/colour.models.PROPHOTO_RGB_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.PROPHOTO\_RGB\_COLOURSPACE -======================================== - -.. currentmodule:: colour.models - -.. autodata:: PROPHOTO_RGB_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.PROTUNE_NATIVE_COLOURSPACE.rst b/docs/generated/colour.models.PROTUNE_NATIVE_COLOURSPACE.rst deleted file mode 100644 index b5808fdec7..0000000000 --- a/docs/generated/colour.models.PROTUNE_NATIVE_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.PROTUNE\_NATIVE\_COLOURSPACE -========================================== - -.. currentmodule:: colour.models - -.. autodata:: PROTUNE_NATIVE_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.RED_COLOR_2_COLOURSPACE.rst b/docs/generated/colour.models.RED_COLOR_2_COLOURSPACE.rst deleted file mode 100644 index 1ec9bc9d8d..0000000000 --- a/docs/generated/colour.models.RED_COLOR_2_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.RED\_COLOR\_2\_COLOURSPACE -======================================== - -.. currentmodule:: colour.models - -.. autodata:: RED_COLOR_2_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.RED_COLOR_3_COLOURSPACE.rst b/docs/generated/colour.models.RED_COLOR_3_COLOURSPACE.rst deleted file mode 100644 index 4e96c0c514..0000000000 --- a/docs/generated/colour.models.RED_COLOR_3_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.RED\_COLOR\_3\_COLOURSPACE -======================================== - -.. currentmodule:: colour.models - -.. autodata:: RED_COLOR_3_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.RED_COLOR_4_COLOURSPACE.rst b/docs/generated/colour.models.RED_COLOR_4_COLOURSPACE.rst deleted file mode 100644 index b47bf9b76a..0000000000 --- a/docs/generated/colour.models.RED_COLOR_4_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.RED\_COLOR\_4\_COLOURSPACE -======================================== - -.. currentmodule:: colour.models - -.. autodata:: RED_COLOR_4_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.RED_COLOR_COLOURSPACE.rst b/docs/generated/colour.models.RED_COLOR_COLOURSPACE.rst deleted file mode 100644 index 081cb78b3d..0000000000 --- a/docs/generated/colour.models.RED_COLOR_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.RED\_COLOR\_COLOURSPACE -===================================== - -.. currentmodule:: colour.models - -.. autodata:: RED_COLOR_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.RED_WIDE_GAMUT_RGB_COLOURSPACE.rst b/docs/generated/colour.models.RED_WIDE_GAMUT_RGB_COLOURSPACE.rst deleted file mode 100644 index e4c5130fa3..0000000000 --- a/docs/generated/colour.models.RED_WIDE_GAMUT_RGB_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.RED\_WIDE\_GAMUT\_RGB\_COLOURSPACE -================================================ - -.. currentmodule:: colour.models - -.. autodata:: RED_WIDE_GAMUT_RGB_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.RIMM_RGB_COLOURSPACE.rst b/docs/generated/colour.models.RIMM_RGB_COLOURSPACE.rst deleted file mode 100644 index 73f222afbf..0000000000 --- a/docs/generated/colour.models.RIMM_RGB_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.RIMM\_RGB\_COLOURSPACE -==================================== - -.. currentmodule:: colour.models - -.. autodata:: RIMM_RGB_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.ROMM_RGB_COLOURSPACE.rst b/docs/generated/colour.models.ROMM_RGB_COLOURSPACE.rst deleted file mode 100644 index 27ca087826..0000000000 --- a/docs/generated/colour.models.ROMM_RGB_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.ROMM\_RGB\_COLOURSPACE -==================================== - -.. currentmodule:: colour.models - -.. autodata:: ROMM_RGB_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.RUSSELL_RGB_COLOURSPACE.rst b/docs/generated/colour.models.RUSSELL_RGB_COLOURSPACE.rst deleted file mode 100644 index 206334a3a4..0000000000 --- a/docs/generated/colour.models.RUSSELL_RGB_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.RUSSELL\_RGB\_COLOURSPACE -======================================= - -.. currentmodule:: colour.models - -.. autodata:: RUSSELL_RGB_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.SMPTE_240M_COLOURSPACE.rst b/docs/generated/colour.models.SMPTE_240M_COLOURSPACE.rst deleted file mode 100644 index bb464ce120..0000000000 --- a/docs/generated/colour.models.SMPTE_240M_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.SMPTE\_240M\_COLOURSPACE -====================================== - -.. currentmodule:: colour.models - -.. autodata:: SMPTE_240M_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.S_GAMUT3_CINE_COLOURSPACE.rst b/docs/generated/colour.models.S_GAMUT3_CINE_COLOURSPACE.rst deleted file mode 100644 index 55c12409db..0000000000 --- a/docs/generated/colour.models.S_GAMUT3_CINE_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.S\_GAMUT3\_CINE\_COLOURSPACE -========================================== - -.. currentmodule:: colour.models - -.. autodata:: S_GAMUT3_CINE_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.S_GAMUT3_COLOURSPACE.rst b/docs/generated/colour.models.S_GAMUT3_COLOURSPACE.rst deleted file mode 100644 index d8ad2dfe9c..0000000000 --- a/docs/generated/colour.models.S_GAMUT3_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.S\_GAMUT3\_COLOURSPACE -==================================== - -.. currentmodule:: colour.models - -.. autodata:: S_GAMUT3_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.S_GAMUT_COLOURSPACE.rst b/docs/generated/colour.models.S_GAMUT_COLOURSPACE.rst deleted file mode 100644 index f12e7f5ac4..0000000000 --- a/docs/generated/colour.models.S_GAMUT_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.S\_GAMUT\_COLOURSPACE -=================================== - -.. currentmodule:: colour.models - -.. autodata:: S_GAMUT_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.V_GAMUT_COLOURSPACE.rst b/docs/generated/colour.models.V_GAMUT_COLOURSPACE.rst deleted file mode 100644 index 5a74a53043..0000000000 --- a/docs/generated/colour.models.V_GAMUT_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.V\_GAMUT\_COLOURSPACE -=================================== - -.. currentmodule:: colour.models - -.. autodata:: V_GAMUT_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.XTREME_RGB_COLOURSPACE.rst b/docs/generated/colour.models.XTREME_RGB_COLOURSPACE.rst deleted file mode 100644 index 5dcfc20ea2..0000000000 --- a/docs/generated/colour.models.XTREME_RGB_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.XTREME\_RGB\_COLOURSPACE -====================================== - -.. currentmodule:: colour.models - -.. autodata:: XTREME_RGB_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.models.eotf_BT1886.rst b/docs/generated/colour.models.eotf_BT1886.rst deleted file mode 100644 index 1749c05bbb..0000000000 --- a/docs/generated/colour.models.eotf_BT1886.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.eotf\_BT1886 -========================== - -.. currentmodule:: colour.models - -.. autofunction:: eotf_BT1886 \ No newline at end of file diff --git a/docs/generated/colour.models.eotf_BT2020.rst b/docs/generated/colour.models.eotf_BT2020.rst deleted file mode 100644 index 18ef355445..0000000000 --- a/docs/generated/colour.models.eotf_BT2020.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.eotf\_BT2020 -========================== - -.. currentmodule:: colour.models - -.. autofunction:: eotf_BT2020 \ No newline at end of file diff --git a/docs/generated/colour.models.eotf_BT2100_HLG.rst b/docs/generated/colour.models.eotf_BT2100_HLG.rst deleted file mode 100644 index 8c34d879e7..0000000000 --- a/docs/generated/colour.models.eotf_BT2100_HLG.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.eotf\_BT2100\_HLG -=============================== - -.. currentmodule:: colour.models - -.. autofunction:: eotf_BT2100_HLG \ No newline at end of file diff --git a/docs/generated/colour.models.eotf_BT2100_PQ.rst b/docs/generated/colour.models.eotf_BT2100_PQ.rst deleted file mode 100644 index 758b2b58e2..0000000000 --- a/docs/generated/colour.models.eotf_BT2100_PQ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.eotf\_BT2100\_PQ -============================== - -.. currentmodule:: colour.models - -.. autofunction:: eotf_BT2100_PQ \ No newline at end of file diff --git a/docs/generated/colour.models.eotf_DCDM.rst b/docs/generated/colour.models.eotf_DCDM.rst deleted file mode 100644 index a85fc544b6..0000000000 --- a/docs/generated/colour.models.eotf_DCDM.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.eotf\_DCDM -======================== - -.. currentmodule:: colour.models - -.. autofunction:: eotf_DCDM \ No newline at end of file diff --git a/docs/generated/colour.models.eotf_DICOMGSDF.rst b/docs/generated/colour.models.eotf_DICOMGSDF.rst deleted file mode 100644 index 38a0e486dc..0000000000 --- a/docs/generated/colour.models.eotf_DICOMGSDF.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.eotf\_DICOMGSDF -============================= - -.. currentmodule:: colour.models - -.. autofunction:: eotf_DICOMGSDF \ No newline at end of file diff --git a/docs/generated/colour.models.eotf_ProPhotoRGB.rst b/docs/generated/colour.models.eotf_ProPhotoRGB.rst deleted file mode 100644 index 939882c41e..0000000000 --- a/docs/generated/colour.models.eotf_ProPhotoRGB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.eotf\_ProPhotoRGB -=============================== - -.. currentmodule:: colour.models - -.. autofunction:: eotf_ProPhotoRGB \ No newline at end of file diff --git a/docs/generated/colour.models.eotf_RIMMRGB.rst b/docs/generated/colour.models.eotf_RIMMRGB.rst deleted file mode 100644 index 6b7acb6c4a..0000000000 --- a/docs/generated/colour.models.eotf_RIMMRGB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.eotf\_RIMMRGB -=========================== - -.. currentmodule:: colour.models - -.. autofunction:: eotf_RIMMRGB \ No newline at end of file diff --git a/docs/generated/colour.models.eotf_ROMMRGB.rst b/docs/generated/colour.models.eotf_ROMMRGB.rst deleted file mode 100644 index b22b064e76..0000000000 --- a/docs/generated/colour.models.eotf_ROMMRGB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.eotf\_ROMMRGB -=========================== - -.. currentmodule:: colour.models - -.. autofunction:: eotf_ROMMRGB \ No newline at end of file diff --git a/docs/generated/colour.models.eotf_SMPTE240M.rst b/docs/generated/colour.models.eotf_SMPTE240M.rst deleted file mode 100644 index ddbf83c29a..0000000000 --- a/docs/generated/colour.models.eotf_SMPTE240M.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.eotf\_SMPTE240M -============================= - -.. currentmodule:: colour.models - -.. autofunction:: eotf_SMPTE240M \ No newline at end of file diff --git a/docs/generated/colour.models.eotf_ST2084.rst b/docs/generated/colour.models.eotf_ST2084.rst deleted file mode 100644 index 4dbe2ca5ef..0000000000 --- a/docs/generated/colour.models.eotf_ST2084.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.eotf\_ST2084 -========================== - -.. currentmodule:: colour.models - -.. autofunction:: eotf_ST2084 \ No newline at end of file diff --git a/docs/generated/colour.models.eotf_reverse_BT1886.rst b/docs/generated/colour.models.eotf_reverse_BT1886.rst deleted file mode 100644 index a35186b657..0000000000 --- a/docs/generated/colour.models.eotf_reverse_BT1886.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.eotf\_reverse\_BT1886 -=================================== - -.. currentmodule:: colour.models - -.. autofunction:: eotf_reverse_BT1886 \ No newline at end of file diff --git a/docs/generated/colour.models.eotf_reverse_BT2100_HLG.rst b/docs/generated/colour.models.eotf_reverse_BT2100_HLG.rst deleted file mode 100644 index 083509be76..0000000000 --- a/docs/generated/colour.models.eotf_reverse_BT2100_HLG.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.eotf\_reverse\_BT2100\_HLG -======================================== - -.. currentmodule:: colour.models - -.. autofunction:: eotf_reverse_BT2100_HLG \ No newline at end of file diff --git a/docs/generated/colour.models.eotf_reverse_BT2100_PQ.rst b/docs/generated/colour.models.eotf_reverse_BT2100_PQ.rst deleted file mode 100644 index 69d1ba9965..0000000000 --- a/docs/generated/colour.models.eotf_reverse_BT2100_PQ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.eotf\_reverse\_BT2100\_PQ -======================================= - -.. currentmodule:: colour.models - -.. autofunction:: eotf_reverse_BT2100_PQ \ No newline at end of file diff --git a/docs/generated/colour.models.eotf_reverse_DCDM.rst b/docs/generated/colour.models.eotf_reverse_DCDM.rst deleted file mode 100644 index 1c851a707a..0000000000 --- a/docs/generated/colour.models.eotf_reverse_DCDM.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.eotf\_reverse\_DCDM -================================= - -.. currentmodule:: colour.models - -.. autofunction:: eotf_reverse_DCDM \ No newline at end of file diff --git a/docs/generated/colour.models.log_decoding_ACEScc.rst b/docs/generated/colour.models.log_decoding_ACEScc.rst deleted file mode 100644 index bb1f33031c..0000000000 --- a/docs/generated/colour.models.log_decoding_ACEScc.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_decoding\_ACEScc -=================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_decoding_ACEScc \ No newline at end of file diff --git a/docs/generated/colour.models.log_decoding_ACEScct.rst b/docs/generated/colour.models.log_decoding_ACEScct.rst deleted file mode 100644 index fa37594904..0000000000 --- a/docs/generated/colour.models.log_decoding_ACEScct.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_decoding\_ACEScct -==================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_decoding_ACEScct \ No newline at end of file diff --git a/docs/generated/colour.models.log_decoding_ACESproxy.rst b/docs/generated/colour.models.log_decoding_ACESproxy.rst deleted file mode 100644 index af2039140f..0000000000 --- a/docs/generated/colour.models.log_decoding_ACESproxy.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_decoding\_ACESproxy -====================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_decoding_ACESproxy \ No newline at end of file diff --git a/docs/generated/colour.models.log_decoding_ALEXALogC.rst b/docs/generated/colour.models.log_decoding_ALEXALogC.rst deleted file mode 100644 index 530a3c8411..0000000000 --- a/docs/generated/colour.models.log_decoding_ALEXALogC.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_decoding\_ALEXALogC -====================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_decoding_ALEXALogC \ No newline at end of file diff --git a/docs/generated/colour.models.log_decoding_CanonLog.rst b/docs/generated/colour.models.log_decoding_CanonLog.rst deleted file mode 100644 index c7a1ceb67c..0000000000 --- a/docs/generated/colour.models.log_decoding_CanonLog.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_decoding\_CanonLog -===================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_decoding_CanonLog \ No newline at end of file diff --git a/docs/generated/colour.models.log_decoding_CanonLog2.rst b/docs/generated/colour.models.log_decoding_CanonLog2.rst deleted file mode 100644 index 3d13d6b03c..0000000000 --- a/docs/generated/colour.models.log_decoding_CanonLog2.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_decoding\_CanonLog2 -====================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_decoding_CanonLog2 \ No newline at end of file diff --git a/docs/generated/colour.models.log_decoding_CanonLog3.rst b/docs/generated/colour.models.log_decoding_CanonLog3.rst deleted file mode 100644 index 0c99bc26e9..0000000000 --- a/docs/generated/colour.models.log_decoding_CanonLog3.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_decoding\_CanonLog3 -====================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_decoding_CanonLog3 \ No newline at end of file diff --git a/docs/generated/colour.models.log_decoding_Cineon.rst b/docs/generated/colour.models.log_decoding_Cineon.rst deleted file mode 100644 index 0f00df5f42..0000000000 --- a/docs/generated/colour.models.log_decoding_Cineon.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_decoding\_Cineon -=================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_decoding_Cineon \ No newline at end of file diff --git a/docs/generated/colour.models.log_decoding_ERIMMRGB.rst b/docs/generated/colour.models.log_decoding_ERIMMRGB.rst deleted file mode 100644 index 7a4aae6cbf..0000000000 --- a/docs/generated/colour.models.log_decoding_ERIMMRGB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_decoding\_ERIMMRGB -===================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_decoding_ERIMMRGB \ No newline at end of file diff --git a/docs/generated/colour.models.log_decoding_Log3G10.rst b/docs/generated/colour.models.log_decoding_Log3G10.rst deleted file mode 100644 index a4f54b9aaa..0000000000 --- a/docs/generated/colour.models.log_decoding_Log3G10.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_decoding\_Log3G10 -==================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_decoding_Log3G10 \ No newline at end of file diff --git a/docs/generated/colour.models.log_decoding_Log3G12.rst b/docs/generated/colour.models.log_decoding_Log3G12.rst deleted file mode 100644 index b89b9257f6..0000000000 --- a/docs/generated/colour.models.log_decoding_Log3G12.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_decoding\_Log3G12 -==================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_decoding_Log3G12 \ No newline at end of file diff --git a/docs/generated/colour.models.log_decoding_Panalog.rst b/docs/generated/colour.models.log_decoding_Panalog.rst deleted file mode 100644 index 89dc7d6612..0000000000 --- a/docs/generated/colour.models.log_decoding_Panalog.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_decoding\_Panalog -==================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_decoding_Panalog \ No newline at end of file diff --git a/docs/generated/colour.models.log_decoding_PivotedLog.rst b/docs/generated/colour.models.log_decoding_PivotedLog.rst deleted file mode 100644 index 58538e4d8e..0000000000 --- a/docs/generated/colour.models.log_decoding_PivotedLog.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_decoding\_PivotedLog -======================================= - -.. currentmodule:: colour.models - -.. autofunction:: log_decoding_PivotedLog \ No newline at end of file diff --git a/docs/generated/colour.models.log_decoding_Protune.rst b/docs/generated/colour.models.log_decoding_Protune.rst deleted file mode 100644 index d4a46e31a4..0000000000 --- a/docs/generated/colour.models.log_decoding_Protune.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_decoding\_Protune -==================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_decoding_Protune \ No newline at end of file diff --git a/docs/generated/colour.models.log_decoding_REDLog.rst b/docs/generated/colour.models.log_decoding_REDLog.rst deleted file mode 100644 index 070357943e..0000000000 --- a/docs/generated/colour.models.log_decoding_REDLog.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_decoding\_REDLog -=================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_decoding_REDLog \ No newline at end of file diff --git a/docs/generated/colour.models.log_decoding_REDLogFilm.rst b/docs/generated/colour.models.log_decoding_REDLogFilm.rst deleted file mode 100644 index 3acdaaa144..0000000000 --- a/docs/generated/colour.models.log_decoding_REDLogFilm.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_decoding\_REDLogFilm -======================================= - -.. currentmodule:: colour.models - -.. autofunction:: log_decoding_REDLogFilm \ No newline at end of file diff --git a/docs/generated/colour.models.log_decoding_SLog.rst b/docs/generated/colour.models.log_decoding_SLog.rst deleted file mode 100644 index eed3fdabd2..0000000000 --- a/docs/generated/colour.models.log_decoding_SLog.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_decoding\_SLog -================================= - -.. currentmodule:: colour.models - -.. autofunction:: log_decoding_SLog \ No newline at end of file diff --git a/docs/generated/colour.models.log_decoding_SLog2.rst b/docs/generated/colour.models.log_decoding_SLog2.rst deleted file mode 100644 index ae808eb87f..0000000000 --- a/docs/generated/colour.models.log_decoding_SLog2.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_decoding\_SLog2 -================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_decoding_SLog2 \ No newline at end of file diff --git a/docs/generated/colour.models.log_decoding_SLog3.rst b/docs/generated/colour.models.log_decoding_SLog3.rst deleted file mode 100644 index 5487f1c85a..0000000000 --- a/docs/generated/colour.models.log_decoding_SLog3.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_decoding\_SLog3 -================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_decoding_SLog3 \ No newline at end of file diff --git a/docs/generated/colour.models.log_decoding_VLog.rst b/docs/generated/colour.models.log_decoding_VLog.rst deleted file mode 100644 index d465de4b7c..0000000000 --- a/docs/generated/colour.models.log_decoding_VLog.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_decoding\_VLog -================================= - -.. currentmodule:: colour.models - -.. autofunction:: log_decoding_VLog \ No newline at end of file diff --git a/docs/generated/colour.models.log_decoding_ViperLog.rst b/docs/generated/colour.models.log_decoding_ViperLog.rst deleted file mode 100644 index beea640bae..0000000000 --- a/docs/generated/colour.models.log_decoding_ViperLog.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_decoding\_ViperLog -===================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_decoding_ViperLog \ No newline at end of file diff --git a/docs/generated/colour.models.log_encoding_ACEScc.rst b/docs/generated/colour.models.log_encoding_ACEScc.rst deleted file mode 100644 index 960af11efd..0000000000 --- a/docs/generated/colour.models.log_encoding_ACEScc.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_encoding\_ACEScc -=================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_encoding_ACEScc \ No newline at end of file diff --git a/docs/generated/colour.models.log_encoding_ACEScct.rst b/docs/generated/colour.models.log_encoding_ACEScct.rst deleted file mode 100644 index 8c13d85674..0000000000 --- a/docs/generated/colour.models.log_encoding_ACEScct.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_encoding\_ACEScct -==================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_encoding_ACEScct \ No newline at end of file diff --git a/docs/generated/colour.models.log_encoding_ACESproxy.rst b/docs/generated/colour.models.log_encoding_ACESproxy.rst deleted file mode 100644 index b7301d421b..0000000000 --- a/docs/generated/colour.models.log_encoding_ACESproxy.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_encoding\_ACESproxy -====================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_encoding_ACESproxy \ No newline at end of file diff --git a/docs/generated/colour.models.log_encoding_ALEXALogC.rst b/docs/generated/colour.models.log_encoding_ALEXALogC.rst deleted file mode 100644 index b125211971..0000000000 --- a/docs/generated/colour.models.log_encoding_ALEXALogC.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_encoding\_ALEXALogC -====================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_encoding_ALEXALogC \ No newline at end of file diff --git a/docs/generated/colour.models.log_encoding_CanonLog.rst b/docs/generated/colour.models.log_encoding_CanonLog.rst deleted file mode 100644 index 203bb760ba..0000000000 --- a/docs/generated/colour.models.log_encoding_CanonLog.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_encoding\_CanonLog -===================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_encoding_CanonLog \ No newline at end of file diff --git a/docs/generated/colour.models.log_encoding_CanonLog2.rst b/docs/generated/colour.models.log_encoding_CanonLog2.rst deleted file mode 100644 index 573b3b7084..0000000000 --- a/docs/generated/colour.models.log_encoding_CanonLog2.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_encoding\_CanonLog2 -====================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_encoding_CanonLog2 \ No newline at end of file diff --git a/docs/generated/colour.models.log_encoding_CanonLog3.rst b/docs/generated/colour.models.log_encoding_CanonLog3.rst deleted file mode 100644 index d886a0a186..0000000000 --- a/docs/generated/colour.models.log_encoding_CanonLog3.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_encoding\_CanonLog3 -====================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_encoding_CanonLog3 \ No newline at end of file diff --git a/docs/generated/colour.models.log_encoding_Cineon.rst b/docs/generated/colour.models.log_encoding_Cineon.rst deleted file mode 100644 index 362abbf9c8..0000000000 --- a/docs/generated/colour.models.log_encoding_Cineon.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_encoding\_Cineon -=================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_encoding_Cineon \ No newline at end of file diff --git a/docs/generated/colour.models.log_encoding_ERIMMRGB.rst b/docs/generated/colour.models.log_encoding_ERIMMRGB.rst deleted file mode 100644 index d451a660a2..0000000000 --- a/docs/generated/colour.models.log_encoding_ERIMMRGB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_encoding\_ERIMMRGB -===================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_encoding_ERIMMRGB \ No newline at end of file diff --git a/docs/generated/colour.models.log_encoding_Log3G10.rst b/docs/generated/colour.models.log_encoding_Log3G10.rst deleted file mode 100644 index e522ef29ba..0000000000 --- a/docs/generated/colour.models.log_encoding_Log3G10.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_encoding\_Log3G10 -==================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_encoding_Log3G10 \ No newline at end of file diff --git a/docs/generated/colour.models.log_encoding_Log3G12.rst b/docs/generated/colour.models.log_encoding_Log3G12.rst deleted file mode 100644 index b036e36bbd..0000000000 --- a/docs/generated/colour.models.log_encoding_Log3G12.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_encoding\_Log3G12 -==================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_encoding_Log3G12 \ No newline at end of file diff --git a/docs/generated/colour.models.log_encoding_Panalog.rst b/docs/generated/colour.models.log_encoding_Panalog.rst deleted file mode 100644 index 4791d1d673..0000000000 --- a/docs/generated/colour.models.log_encoding_Panalog.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_encoding\_Panalog -==================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_encoding_Panalog \ No newline at end of file diff --git a/docs/generated/colour.models.log_encoding_PivotedLog.rst b/docs/generated/colour.models.log_encoding_PivotedLog.rst deleted file mode 100644 index 133ddd4ae0..0000000000 --- a/docs/generated/colour.models.log_encoding_PivotedLog.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_encoding\_PivotedLog -======================================= - -.. currentmodule:: colour.models - -.. autofunction:: log_encoding_PivotedLog \ No newline at end of file diff --git a/docs/generated/colour.models.log_encoding_Protune.rst b/docs/generated/colour.models.log_encoding_Protune.rst deleted file mode 100644 index ca3bc78f13..0000000000 --- a/docs/generated/colour.models.log_encoding_Protune.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_encoding\_Protune -==================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_encoding_Protune \ No newline at end of file diff --git a/docs/generated/colour.models.log_encoding_REDLog.rst b/docs/generated/colour.models.log_encoding_REDLog.rst deleted file mode 100644 index f844f0cdbc..0000000000 --- a/docs/generated/colour.models.log_encoding_REDLog.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_encoding\_REDLog -=================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_encoding_REDLog \ No newline at end of file diff --git a/docs/generated/colour.models.log_encoding_REDLogFilm.rst b/docs/generated/colour.models.log_encoding_REDLogFilm.rst deleted file mode 100644 index 6c88a37cce..0000000000 --- a/docs/generated/colour.models.log_encoding_REDLogFilm.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_encoding\_REDLogFilm -======================================= - -.. currentmodule:: colour.models - -.. autofunction:: log_encoding_REDLogFilm \ No newline at end of file diff --git a/docs/generated/colour.models.log_encoding_SLog.rst b/docs/generated/colour.models.log_encoding_SLog.rst deleted file mode 100644 index 4edf2028b8..0000000000 --- a/docs/generated/colour.models.log_encoding_SLog.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_encoding\_SLog -================================= - -.. currentmodule:: colour.models - -.. autofunction:: log_encoding_SLog \ No newline at end of file diff --git a/docs/generated/colour.models.log_encoding_SLog2.rst b/docs/generated/colour.models.log_encoding_SLog2.rst deleted file mode 100644 index 417acf7da5..0000000000 --- a/docs/generated/colour.models.log_encoding_SLog2.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_encoding\_SLog2 -================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_encoding_SLog2 \ No newline at end of file diff --git a/docs/generated/colour.models.log_encoding_SLog3.rst b/docs/generated/colour.models.log_encoding_SLog3.rst deleted file mode 100644 index 14b84570af..0000000000 --- a/docs/generated/colour.models.log_encoding_SLog3.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_encoding\_SLog3 -================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_encoding_SLog3 \ No newline at end of file diff --git a/docs/generated/colour.models.log_encoding_VLog.rst b/docs/generated/colour.models.log_encoding_VLog.rst deleted file mode 100644 index c2d5106d21..0000000000 --- a/docs/generated/colour.models.log_encoding_VLog.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_encoding\_VLog -================================= - -.. currentmodule:: colour.models - -.. autofunction:: log_encoding_VLog \ No newline at end of file diff --git a/docs/generated/colour.models.log_encoding_ViperLog.rst b/docs/generated/colour.models.log_encoding_ViperLog.rst deleted file mode 100644 index 5a3ca2845f..0000000000 --- a/docs/generated/colour.models.log_encoding_ViperLog.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.log\_encoding\_ViperLog -===================================== - -.. currentmodule:: colour.models - -.. autofunction:: log_encoding_ViperLog \ No newline at end of file diff --git a/docs/generated/colour.models.oetf_ARIBSTDB67.rst b/docs/generated/colour.models.oetf_ARIBSTDB67.rst deleted file mode 100644 index f703f52749..0000000000 --- a/docs/generated/colour.models.oetf_ARIBSTDB67.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.oetf\_ARIBSTDB67 -============================== - -.. currentmodule:: colour.models - -.. autofunction:: oetf_ARIBSTDB67 \ No newline at end of file diff --git a/docs/generated/colour.models.oetf_BT2020.rst b/docs/generated/colour.models.oetf_BT2020.rst deleted file mode 100644 index 85f83a80ac..0000000000 --- a/docs/generated/colour.models.oetf_BT2020.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.oetf\_BT2020 -========================== - -.. currentmodule:: colour.models - -.. autofunction:: oetf_BT2020 \ No newline at end of file diff --git a/docs/generated/colour.models.oetf_BT2100_HLG.rst b/docs/generated/colour.models.oetf_BT2100_HLG.rst deleted file mode 100644 index 00fc406967..0000000000 --- a/docs/generated/colour.models.oetf_BT2100_HLG.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.oetf\_BT2100\_HLG -=============================== - -.. currentmodule:: colour.models - -.. autofunction:: oetf_BT2100_HLG \ No newline at end of file diff --git a/docs/generated/colour.models.oetf_BT2100_PQ.rst b/docs/generated/colour.models.oetf_BT2100_PQ.rst deleted file mode 100644 index b5044c77c6..0000000000 --- a/docs/generated/colour.models.oetf_BT2100_PQ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.oetf\_BT2100\_PQ -============================== - -.. currentmodule:: colour.models - -.. autofunction:: oetf_BT2100_PQ \ No newline at end of file diff --git a/docs/generated/colour.models.oetf_BT601.rst b/docs/generated/colour.models.oetf_BT601.rst deleted file mode 100644 index 0c23a5ded5..0000000000 --- a/docs/generated/colour.models.oetf_BT601.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.oetf\_BT601 -========================= - -.. currentmodule:: colour.models - -.. autofunction:: oetf_BT601 \ No newline at end of file diff --git a/docs/generated/colour.models.oetf_BT709.rst b/docs/generated/colour.models.oetf_BT709.rst deleted file mode 100644 index 01667f8cb9..0000000000 --- a/docs/generated/colour.models.oetf_BT709.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.oetf\_BT709 -========================= - -.. currentmodule:: colour.models - -.. autofunction:: oetf_BT709 \ No newline at end of file diff --git a/docs/generated/colour.models.oetf_DICOMGSDF.rst b/docs/generated/colour.models.oetf_DICOMGSDF.rst deleted file mode 100644 index 25ca022121..0000000000 --- a/docs/generated/colour.models.oetf_DICOMGSDF.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.oetf\_DICOMGSDF -============================= - -.. currentmodule:: colour.models - -.. autofunction:: oetf_DICOMGSDF \ No newline at end of file diff --git a/docs/generated/colour.models.oetf_ProPhotoRGB.rst b/docs/generated/colour.models.oetf_ProPhotoRGB.rst deleted file mode 100644 index ccbffe4b35..0000000000 --- a/docs/generated/colour.models.oetf_ProPhotoRGB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.oetf\_ProPhotoRGB -=============================== - -.. currentmodule:: colour.models - -.. autofunction:: oetf_ProPhotoRGB \ No newline at end of file diff --git a/docs/generated/colour.models.oetf_RIMMRGB.rst b/docs/generated/colour.models.oetf_RIMMRGB.rst deleted file mode 100644 index 725bc17b56..0000000000 --- a/docs/generated/colour.models.oetf_RIMMRGB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.oetf\_RIMMRGB -=========================== - -.. currentmodule:: colour.models - -.. autofunction:: oetf_RIMMRGB \ No newline at end of file diff --git a/docs/generated/colour.models.oetf_ROMMRGB.rst b/docs/generated/colour.models.oetf_ROMMRGB.rst deleted file mode 100644 index de82577851..0000000000 --- a/docs/generated/colour.models.oetf_ROMMRGB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.oetf\_ROMMRGB -=========================== - -.. currentmodule:: colour.models - -.. autofunction:: oetf_ROMMRGB \ No newline at end of file diff --git a/docs/generated/colour.models.oetf_SMPTE240M.rst b/docs/generated/colour.models.oetf_SMPTE240M.rst deleted file mode 100644 index c6a89a1a51..0000000000 --- a/docs/generated/colour.models.oetf_SMPTE240M.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.oetf\_SMPTE240M -============================= - -.. currentmodule:: colour.models - -.. autofunction:: oetf_SMPTE240M \ No newline at end of file diff --git a/docs/generated/colour.models.oetf_ST2084.rst b/docs/generated/colour.models.oetf_ST2084.rst deleted file mode 100644 index 71dc5a7f23..0000000000 --- a/docs/generated/colour.models.oetf_ST2084.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.oetf\_ST2084 -========================== - -.. currentmodule:: colour.models - -.. autofunction:: oetf_ST2084 \ No newline at end of file diff --git a/docs/generated/colour.models.oetf_reverse_ARIBSTDB67.rst b/docs/generated/colour.models.oetf_reverse_ARIBSTDB67.rst deleted file mode 100644 index 613d903a05..0000000000 --- a/docs/generated/colour.models.oetf_reverse_ARIBSTDB67.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.oetf\_reverse\_ARIBSTDB67 -======================================= - -.. currentmodule:: colour.models - -.. autofunction:: oetf_reverse_ARIBSTDB67 \ No newline at end of file diff --git a/docs/generated/colour.models.oetf_reverse_BT2100_HLG.rst b/docs/generated/colour.models.oetf_reverse_BT2100_HLG.rst deleted file mode 100644 index 4a7edfb521..0000000000 --- a/docs/generated/colour.models.oetf_reverse_BT2100_HLG.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.oetf\_reverse\_BT2100\_HLG -======================================== - -.. currentmodule:: colour.models - -.. autofunction:: oetf_reverse_BT2100_HLG \ No newline at end of file diff --git a/docs/generated/colour.models.oetf_reverse_BT2100_PQ.rst b/docs/generated/colour.models.oetf_reverse_BT2100_PQ.rst deleted file mode 100644 index a86bd50406..0000000000 --- a/docs/generated/colour.models.oetf_reverse_BT2100_PQ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.oetf\_reverse\_BT2100\_PQ -======================================= - -.. currentmodule:: colour.models - -.. autofunction:: oetf_reverse_BT2100_PQ \ No newline at end of file diff --git a/docs/generated/colour.models.oetf_reverse_BT601.rst b/docs/generated/colour.models.oetf_reverse_BT601.rst deleted file mode 100644 index 912ead72e9..0000000000 --- a/docs/generated/colour.models.oetf_reverse_BT601.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.oetf\_reverse\_BT601 -================================== - -.. currentmodule:: colour.models - -.. autofunction:: oetf_reverse_BT601 \ No newline at end of file diff --git a/docs/generated/colour.models.oetf_reverse_BT709.rst b/docs/generated/colour.models.oetf_reverse_BT709.rst deleted file mode 100644 index 8e6b56345b..0000000000 --- a/docs/generated/colour.models.oetf_reverse_BT709.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.oetf\_reverse\_BT709 -================================== - -.. currentmodule:: colour.models - -.. autofunction:: oetf_reverse_BT709 \ No newline at end of file diff --git a/docs/generated/colour.models.oetf_reverse_sRGB.rst b/docs/generated/colour.models.oetf_reverse_sRGB.rst deleted file mode 100644 index 206e26057b..0000000000 --- a/docs/generated/colour.models.oetf_reverse_sRGB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.oetf\_reverse\_sRGB -================================= - -.. currentmodule:: colour.models - -.. autofunction:: oetf_reverse_sRGB \ No newline at end of file diff --git a/docs/generated/colour.models.oetf_sRGB.rst b/docs/generated/colour.models.oetf_sRGB.rst deleted file mode 100644 index f283eee1e7..0000000000 --- a/docs/generated/colour.models.oetf_sRGB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.oetf\_sRGB -======================== - -.. currentmodule:: colour.models - -.. autofunction:: oetf_sRGB \ No newline at end of file diff --git a/docs/generated/colour.models.ootf_BT2100_HLG.rst b/docs/generated/colour.models.ootf_BT2100_HLG.rst deleted file mode 100644 index cf35ca3641..0000000000 --- a/docs/generated/colour.models.ootf_BT2100_HLG.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.ootf\_BT2100\_HLG -=============================== - -.. currentmodule:: colour.models - -.. autofunction:: ootf_BT2100_HLG \ No newline at end of file diff --git a/docs/generated/colour.models.ootf_BT2100_PQ.rst b/docs/generated/colour.models.ootf_BT2100_PQ.rst deleted file mode 100644 index e8895e9432..0000000000 --- a/docs/generated/colour.models.ootf_BT2100_PQ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.ootf\_BT2100\_PQ -============================== - -.. currentmodule:: colour.models - -.. autofunction:: ootf_BT2100_PQ \ No newline at end of file diff --git a/docs/generated/colour.models.ootf_reverse_BT2100_HLG.rst b/docs/generated/colour.models.ootf_reverse_BT2100_HLG.rst deleted file mode 100644 index 532c652ac1..0000000000 --- a/docs/generated/colour.models.ootf_reverse_BT2100_HLG.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.ootf\_reverse\_BT2100\_HLG -======================================== - -.. currentmodule:: colour.models - -.. autofunction:: ootf_reverse_BT2100_HLG \ No newline at end of file diff --git a/docs/generated/colour.models.ootf_reverse_BT2100_PQ.rst b/docs/generated/colour.models.ootf_reverse_BT2100_PQ.rst deleted file mode 100644 index 64f2908611..0000000000 --- a/docs/generated/colour.models.ootf_reverse_BT2100_PQ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.ootf\_reverse\_BT2100\_PQ -======================================= - -.. currentmodule:: colour.models - -.. autofunction:: ootf_reverse_BT2100_PQ \ No newline at end of file diff --git a/docs/generated/colour.models.sRGB_COLOURSPACE.rst b/docs/generated/colour.models.sRGB_COLOURSPACE.rst deleted file mode 100644 index 79ec2d742a..0000000000 --- a/docs/generated/colour.models.sRGB_COLOURSPACE.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.models.sRGB\_COLOURSPACE -=============================== - -.. currentmodule:: colour.models - -.. autodata:: sRGB_COLOURSPACE \ No newline at end of file diff --git a/docs/generated/colour.multi_sds_to_XYZ.rst b/docs/generated/colour.multi_sds_to_XYZ.rst deleted file mode 100644 index b05bd0cc28..0000000000 --- a/docs/generated/colour.multi_sds_to_XYZ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.multi\_sds\_to\_XYZ -========================== - -.. currentmodule:: colour - -.. autofunction:: multi_sds_to_XYZ \ No newline at end of file diff --git a/docs/generated/colour.munsell_colour_to_xyY.rst b/docs/generated/colour.munsell_colour_to_xyY.rst deleted file mode 100644 index ee678a1cc7..0000000000 --- a/docs/generated/colour.munsell_colour_to_xyY.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.munsell\_colour\_to\_xyY -=============================== - -.. currentmodule:: colour - -.. autofunction:: munsell_colour_to_xyY \ No newline at end of file diff --git a/docs/generated/colour.munsell_value.rst b/docs/generated/colour.munsell_value.rst deleted file mode 100644 index a4216b9885..0000000000 --- a/docs/generated/colour.munsell_value.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.munsell\_value -===================== - -.. currentmodule:: colour - -.. autofunction:: munsell_value \ No newline at end of file diff --git a/docs/generated/colour.normalised_primary_matrix.rst b/docs/generated/colour.normalised_primary_matrix.rst deleted file mode 100644 index 28ed5ffcb8..0000000000 --- a/docs/generated/colour.normalised_primary_matrix.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.normalised\_primary\_matrix -================================== - -.. currentmodule:: colour - -.. autofunction:: normalised_primary_matrix \ No newline at end of file diff --git a/docs/generated/colour.notation.HEX_to_RGB.rst b/docs/generated/colour.notation.HEX_to_RGB.rst deleted file mode 100644 index 4ba8adb35d..0000000000 --- a/docs/generated/colour.notation.HEX_to_RGB.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.notation.HEX\_to\_RGB -============================ - -.. currentmodule:: colour.notation - -.. autofunction:: HEX_to_RGB \ No newline at end of file diff --git a/docs/generated/colour.notation.RGB_to_HEX.rst b/docs/generated/colour.notation.RGB_to_HEX.rst deleted file mode 100644 index 03a4967583..0000000000 --- a/docs/generated/colour.notation.RGB_to_HEX.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.notation.RGB\_to\_HEX -============================ - -.. currentmodule:: colour.notation - -.. autofunction:: RGB_to_HEX \ No newline at end of file diff --git a/docs/generated/colour.notation.munsell_value_ASTMD153508.rst b/docs/generated/colour.notation.munsell_value_ASTMD153508.rst deleted file mode 100644 index 160301f637..0000000000 --- a/docs/generated/colour.notation.munsell_value_ASTMD153508.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.notation.munsell\_value\_ASTMD153508 -=========================================== - -.. currentmodule:: colour.notation - -.. autofunction:: munsell_value_ASTMD153508 \ No newline at end of file diff --git a/docs/generated/colour.notation.munsell_value_Ladd1955.rst b/docs/generated/colour.notation.munsell_value_Ladd1955.rst deleted file mode 100644 index 68bec23319..0000000000 --- a/docs/generated/colour.notation.munsell_value_Ladd1955.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.notation.munsell\_value\_Ladd1955 -======================================== - -.. currentmodule:: colour.notation - -.. autofunction:: munsell_value_Ladd1955 \ No newline at end of file diff --git a/docs/generated/colour.notation.munsell_value_McCamy1987.rst b/docs/generated/colour.notation.munsell_value_McCamy1987.rst deleted file mode 100644 index 0ae1b1b64f..0000000000 --- a/docs/generated/colour.notation.munsell_value_McCamy1987.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.notation.munsell\_value\_McCamy1987 -========================================== - -.. currentmodule:: colour.notation - -.. autofunction:: munsell_value_McCamy1987 \ No newline at end of file diff --git a/docs/generated/colour.notation.munsell_value_Moon1943.rst b/docs/generated/colour.notation.munsell_value_Moon1943.rst deleted file mode 100644 index 0702da0325..0000000000 --- a/docs/generated/colour.notation.munsell_value_Moon1943.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.notation.munsell\_value\_Moon1943 -======================================== - -.. currentmodule:: colour.notation - -.. autofunction:: munsell_value_Moon1943 \ No newline at end of file diff --git a/docs/generated/colour.notation.munsell_value_Munsell1933.rst b/docs/generated/colour.notation.munsell_value_Munsell1933.rst deleted file mode 100644 index e7e170d6a7..0000000000 --- a/docs/generated/colour.notation.munsell_value_Munsell1933.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.notation.munsell\_value\_Munsell1933 -=========================================== - -.. currentmodule:: colour.notation - -.. autofunction:: munsell_value_Munsell1933 \ No newline at end of file diff --git a/docs/generated/colour.notation.munsell_value_Priest1920.rst b/docs/generated/colour.notation.munsell_value_Priest1920.rst deleted file mode 100644 index f2cf863859..0000000000 --- a/docs/generated/colour.notation.munsell_value_Priest1920.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.notation.munsell\_value\_Priest1920 -========================================== - -.. currentmodule:: colour.notation - -.. autofunction:: munsell_value_Priest1920 \ No newline at end of file diff --git a/docs/generated/colour.notation.munsell_value_Saunderson1944.rst b/docs/generated/colour.notation.munsell_value_Saunderson1944.rst deleted file mode 100644 index 2654a4d957..0000000000 --- a/docs/generated/colour.notation.munsell_value_Saunderson1944.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.notation.munsell\_value\_Saunderson1944 -============================================== - -.. currentmodule:: colour.notation - -.. autofunction:: munsell_value_Saunderson1944 \ No newline at end of file diff --git a/docs/generated/colour.oetf.rst b/docs/generated/colour.oetf.rst deleted file mode 100644 index bce75a2642..0000000000 --- a/docs/generated/colour.oetf.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.oetf -=========== - -.. currentmodule:: colour - -.. autofunction:: oetf \ No newline at end of file diff --git a/docs/generated/colour.oetf_reverse.rst b/docs/generated/colour.oetf_reverse.rst deleted file mode 100644 index eec9848807..0000000000 --- a/docs/generated/colour.oetf_reverse.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.oetf\_reverse -==================== - -.. currentmodule:: colour - -.. autofunction:: oetf_reverse \ No newline at end of file diff --git a/docs/generated/colour.ootf.rst b/docs/generated/colour.ootf.rst deleted file mode 100644 index a24c1950a1..0000000000 --- a/docs/generated/colour.ootf.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.ootf -=========== - -.. currentmodule:: colour - -.. autofunction:: ootf \ No newline at end of file diff --git a/docs/generated/colour.ootf_reverse.rst b/docs/generated/colour.ootf_reverse.rst deleted file mode 100644 index 4f2ac2341f..0000000000 --- a/docs/generated/colour.ootf_reverse.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.ootf\_reverse -==================== - -.. currentmodule:: colour - -.. autofunction:: ootf_reverse \ No newline at end of file diff --git a/docs/generated/colour.phenomena.rayleigh_optical_depth.rst b/docs/generated/colour.phenomena.rayleigh_optical_depth.rst deleted file mode 100644 index e388b4ac88..0000000000 --- a/docs/generated/colour.phenomena.rayleigh_optical_depth.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.phenomena.rayleigh\_optical\_depth -========================================= - -.. currentmodule:: colour.phenomena - -.. autofunction:: rayleigh_optical_depth \ No newline at end of file diff --git a/docs/generated/colour.plotting.artist.rst b/docs/generated/colour.plotting.artist.rst deleted file mode 100644 index ea27e75643..0000000000 --- a/docs/generated/colour.plotting.artist.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.artist -====================== - -.. currentmodule:: colour.plotting - -.. autofunction:: artist \ No newline at end of file diff --git a/docs/generated/colour.plotting.camera.rst b/docs/generated/colour.plotting.camera.rst deleted file mode 100644 index 5de47aaf5a..0000000000 --- a/docs/generated/colour.plotting.camera.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.camera -====================== - -.. currentmodule:: colour.plotting - -.. autofunction:: camera \ No newline at end of file diff --git a/docs/generated/colour.plotting.colour_cycle.rst b/docs/generated/colour.plotting.colour_cycle.rst deleted file mode 100644 index 88937c8323..0000000000 --- a/docs/generated/colour.plotting.colour_cycle.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.colour\_cycle -============================= - -.. currentmodule:: colour.plotting - -.. autofunction:: colour_cycle \ No newline at end of file diff --git a/docs/generated/colour.plotting.colour_style.rst b/docs/generated/colour.plotting.colour_style.rst deleted file mode 100644 index 479dc07ca7..0000000000 --- a/docs/generated/colour.plotting.colour_style.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.colour\_style -============================= - -.. currentmodule:: colour.plotting - -.. autofunction:: colour_style \ No newline at end of file diff --git a/docs/generated/colour.plotting.cube.rst b/docs/generated/colour.plotting.cube.rst deleted file mode 100644 index 451be2bb5a..0000000000 --- a/docs/generated/colour.plotting.cube.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.cube -==================== - -.. currentmodule:: colour.plotting - -.. autofunction:: cube \ No newline at end of file diff --git a/docs/generated/colour.plotting.diagrams.plot_chromaticity_diagram.rst b/docs/generated/colour.plotting.diagrams.plot_chromaticity_diagram.rst deleted file mode 100644 index e775fc69db..0000000000 --- a/docs/generated/colour.plotting.diagrams.plot_chromaticity_diagram.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.diagrams.plot\_chromaticity\_diagram -==================================================== - -.. currentmodule:: colour.plotting.diagrams - -.. autofunction:: plot_chromaticity_diagram \ No newline at end of file diff --git a/docs/generated/colour.plotting.diagrams.plot_chromaticity_diagram_colours.rst b/docs/generated/colour.plotting.diagrams.plot_chromaticity_diagram_colours.rst deleted file mode 100644 index f7ff6e3ba8..0000000000 --- a/docs/generated/colour.plotting.diagrams.plot_chromaticity_diagram_colours.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.diagrams.plot\_chromaticity\_diagram\_colours -============================================================= - -.. currentmodule:: colour.plotting.diagrams - -.. autofunction:: plot_chromaticity_diagram_colours \ No newline at end of file diff --git a/docs/generated/colour.plotting.diagrams.plot_sds_in_chromaticity_diagram.rst b/docs/generated/colour.plotting.diagrams.plot_sds_in_chromaticity_diagram.rst deleted file mode 100644 index ffe6af0fe4..0000000000 --- a/docs/generated/colour.plotting.diagrams.plot_sds_in_chromaticity_diagram.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.diagrams.plot\_sds\_in\_chromaticity\_diagram -============================================================= - -.. currentmodule:: colour.plotting.diagrams - -.. autofunction:: plot_sds_in_chromaticity_diagram \ No newline at end of file diff --git a/docs/generated/colour.plotting.diagrams.plot_spectral_locus.rst b/docs/generated/colour.plotting.diagrams.plot_spectral_locus.rst deleted file mode 100644 index 51e3c96348..0000000000 --- a/docs/generated/colour.plotting.diagrams.plot_spectral_locus.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.diagrams.plot\_spectral\_locus -============================================== - -.. currentmodule:: colour.plotting.diagrams - -.. autofunction:: plot_spectral_locus \ No newline at end of file diff --git a/docs/generated/colour.plotting.grid.rst b/docs/generated/colour.plotting.grid.rst deleted file mode 100644 index 7ad22bceac..0000000000 --- a/docs/generated/colour.plotting.grid.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.grid -==================== - -.. currentmodule:: colour.plotting - -.. autofunction:: grid \ No newline at end of file diff --git a/docs/generated/colour.plotting.label_rectangles.rst b/docs/generated/colour.plotting.label_rectangles.rst deleted file mode 100644 index 00cb0ce1ed..0000000000 --- a/docs/generated/colour.plotting.label_rectangles.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.label\_rectangles -================================= - -.. currentmodule:: colour.plotting - -.. autofunction:: label_rectangles \ No newline at end of file diff --git a/docs/generated/colour.plotting.models.plot_RGB_chromaticities_in_chromaticity_diagram.rst b/docs/generated/colour.plotting.models.plot_RGB_chromaticities_in_chromaticity_diagram.rst deleted file mode 100644 index 53675480b2..0000000000 --- a/docs/generated/colour.plotting.models.plot_RGB_chromaticities_in_chromaticity_diagram.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.models.plot\_RGB\_chromaticities\_in\_chromaticity\_diagram -=========================================================================== - -.. currentmodule:: colour.plotting.models - -.. autofunction:: plot_RGB_chromaticities_in_chromaticity_diagram \ No newline at end of file diff --git a/docs/generated/colour.plotting.models.plot_RGB_colourspaces_in_chromaticity_diagram.rst b/docs/generated/colour.plotting.models.plot_RGB_colourspaces_in_chromaticity_diagram.rst deleted file mode 100644 index 50cec22cdd..0000000000 --- a/docs/generated/colour.plotting.models.plot_RGB_colourspaces_in_chromaticity_diagram.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.models.plot\_RGB\_colourspaces\_in\_chromaticity\_diagram -========================================================================= - -.. currentmodule:: colour.plotting.models - -.. autofunction:: plot_RGB_colourspaces_in_chromaticity_diagram \ No newline at end of file diff --git a/docs/generated/colour.plotting.models.plot_pointer_gamut.rst b/docs/generated/colour.plotting.models.plot_pointer_gamut.rst deleted file mode 100644 index 1f1c1d4058..0000000000 --- a/docs/generated/colour.plotting.models.plot_pointer_gamut.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.models.plot\_pointer\_gamut -=========================================== - -.. currentmodule:: colour.plotting.models - -.. autofunction:: plot_pointer_gamut \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931.rst b/docs/generated/colour.plotting.plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931.rst deleted file mode 100644 index 39be6fa2a7..0000000000 --- a/docs/generated/colour.plotting.plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_RGB\_chromaticities\_in\_chromaticity\_diagram\_CIE1931 -============================================================================= - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931 \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_RGB_chromaticities_in_chromaticity_diagram_CIE1960UCS.rst b/docs/generated/colour.plotting.plot_RGB_chromaticities_in_chromaticity_diagram_CIE1960UCS.rst deleted file mode 100644 index c102ef8ea0..0000000000 --- a/docs/generated/colour.plotting.plot_RGB_chromaticities_in_chromaticity_diagram_CIE1960UCS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_RGB\_chromaticities\_in\_chromaticity\_diagram\_CIE1960UCS -================================================================================ - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_RGB_chromaticities_in_chromaticity_diagram_CIE1960UCS \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_RGB_chromaticities_in_chromaticity_diagram_CIE1976UCS.rst b/docs/generated/colour.plotting.plot_RGB_chromaticities_in_chromaticity_diagram_CIE1976UCS.rst deleted file mode 100644 index ee952e3e23..0000000000 --- a/docs/generated/colour.plotting.plot_RGB_chromaticities_in_chromaticity_diagram_CIE1976UCS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_RGB\_chromaticities\_in\_chromaticity\_diagram\_CIE1976UCS -================================================================================ - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_RGB_chromaticities_in_chromaticity_diagram_CIE1976UCS \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_RGB_colourspaces_gamuts.rst b/docs/generated/colour.plotting.plot_RGB_colourspaces_gamuts.rst deleted file mode 100644 index 9d57649f4d..0000000000 --- a/docs/generated/colour.plotting.plot_RGB_colourspaces_gamuts.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_RGB\_colourspaces\_gamuts -=============================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_RGB_colourspaces_gamuts \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_RGB_colourspaces_in_chromaticity_diagram_CIE1931.rst b/docs/generated/colour.plotting.plot_RGB_colourspaces_in_chromaticity_diagram_CIE1931.rst deleted file mode 100644 index 7d192900d7..0000000000 --- a/docs/generated/colour.plotting.plot_RGB_colourspaces_in_chromaticity_diagram_CIE1931.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_RGB\_colourspaces\_in\_chromaticity\_diagram\_CIE1931 -=========================================================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_RGB_colourspaces_in_chromaticity_diagram_CIE1931 \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_RGB_colourspaces_in_chromaticity_diagram_CIE1960UCS.rst b/docs/generated/colour.plotting.plot_RGB_colourspaces_in_chromaticity_diagram_CIE1960UCS.rst deleted file mode 100644 index b8f431da71..0000000000 --- a/docs/generated/colour.plotting.plot_RGB_colourspaces_in_chromaticity_diagram_CIE1960UCS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_RGB\_colourspaces\_in\_chromaticity\_diagram\_CIE1960UCS -============================================================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_RGB_colourspaces_in_chromaticity_diagram_CIE1960UCS \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS.rst b/docs/generated/colour.plotting.plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS.rst deleted file mode 100644 index 2974a2bdb1..0000000000 --- a/docs/generated/colour.plotting.plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_RGB\_colourspaces\_in\_chromaticity\_diagram\_CIE1976UCS -============================================================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_RGB_scatter.rst b/docs/generated/colour.plotting.plot_RGB_scatter.rst deleted file mode 100644 index cdc59c7fc4..0000000000 --- a/docs/generated/colour.plotting.plot_RGB_scatter.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_RGB\_scatter -================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_RGB_scatter \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_blackbody_colours.rst b/docs/generated/colour.plotting.plot_blackbody_colours.rst deleted file mode 100644 index cf7475ce62..0000000000 --- a/docs/generated/colour.plotting.plot_blackbody_colours.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_blackbody\_colours -======================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_blackbody_colours \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_blackbody_spectral_radiance.rst b/docs/generated/colour.plotting.plot_blackbody_spectral_radiance.rst deleted file mode 100644 index e23d6abf64..0000000000 --- a/docs/generated/colour.plotting.plot_blackbody_spectral_radiance.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_blackbody\_spectral\_radiance -=================================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_blackbody_spectral_radiance \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_chromaticity_diagram_CIE1931.rst b/docs/generated/colour.plotting.plot_chromaticity_diagram_CIE1931.rst deleted file mode 100644 index 7f33887a9c..0000000000 --- a/docs/generated/colour.plotting.plot_chromaticity_diagram_CIE1931.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_chromaticity\_diagram\_CIE1931 -==================================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_chromaticity_diagram_CIE1931 \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_chromaticity_diagram_CIE1960UCS.rst b/docs/generated/colour.plotting.plot_chromaticity_diagram_CIE1960UCS.rst deleted file mode 100644 index a8bbcf79fb..0000000000 --- a/docs/generated/colour.plotting.plot_chromaticity_diagram_CIE1960UCS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_chromaticity\_diagram\_CIE1960UCS -======================================================= - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_chromaticity_diagram_CIE1960UCS \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_chromaticity_diagram_CIE1976UCS.rst b/docs/generated/colour.plotting.plot_chromaticity_diagram_CIE1976UCS.rst deleted file mode 100644 index ac0390af98..0000000000 --- a/docs/generated/colour.plotting.plot_chromaticity_diagram_CIE1976UCS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_chromaticity\_diagram\_CIE1976UCS -======================================================= - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_chromaticity_diagram_CIE1976UCS \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_corresponding_chromaticities_prediction.rst b/docs/generated/colour.plotting.plot_corresponding_chromaticities_prediction.rst deleted file mode 100644 index 0a3a3209a2..0000000000 --- a/docs/generated/colour.plotting.plot_corresponding_chromaticities_prediction.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_corresponding\_chromaticities\_prediction -=============================================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_corresponding_chromaticities_prediction \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_cvd_simulation_Machado2009.rst b/docs/generated/colour.plotting.plot_cvd_simulation_Machado2009.rst deleted file mode 100644 index bbcd3b4477..0000000000 --- a/docs/generated/colour.plotting.plot_cvd_simulation_Machado2009.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_cvd\_simulation\_Machado2009 -================================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_cvd_simulation_Machado2009 \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1931.rst b/docs/generated/colour.plotting.plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1931.rst deleted file mode 100644 index b5ea50e8f1..0000000000 --- a/docs/generated/colour.plotting.plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1931.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_ellipses\_MacAdam1942\_in\_chromaticity\_diagram\_CIE1931 -=============================================================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1931 \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1960UCS.rst b/docs/generated/colour.plotting.plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1960UCS.rst deleted file mode 100644 index d2907f6225..0000000000 --- a/docs/generated/colour.plotting.plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1960UCS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_ellipses\_MacAdam1942\_in\_chromaticity\_diagram\_CIE1960UCS -================================================================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1960UCS \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS.rst b/docs/generated/colour.plotting.plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS.rst deleted file mode 100644 index ba2be463c3..0000000000 --- a/docs/generated/colour.plotting.plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_ellipses\_MacAdam1942\_in\_chromaticity\_diagram\_CIE1976UCS -================================================================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_image.rst b/docs/generated/colour.plotting.plot_image.rst deleted file mode 100644 index 11b49858b4..0000000000 --- a/docs/generated/colour.plotting.plot_image.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_image -=========================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_image \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_multi_cctfs.rst b/docs/generated/colour.plotting.plot_multi_cctfs.rst deleted file mode 100644 index 01d88a1ef2..0000000000 --- a/docs/generated/colour.plotting.plot_multi_cctfs.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_multi\_cctfs -================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_multi_cctfs \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_multi_cmfs.rst b/docs/generated/colour.plotting.plot_multi_cmfs.rst deleted file mode 100644 index 890fedf0ac..0000000000 --- a/docs/generated/colour.plotting.plot_multi_cmfs.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_multi\_cmfs -================================= - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_multi_cmfs \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_multi_colour_checkers.rst b/docs/generated/colour.plotting.plot_multi_colour_checkers.rst deleted file mode 100644 index 1a358029e5..0000000000 --- a/docs/generated/colour.plotting.plot_multi_colour_checkers.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_multi\_colour\_checkers -============================================= - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_multi_colour_checkers \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_multi_colour_swatches.rst b/docs/generated/colour.plotting.plot_multi_colour_swatches.rst deleted file mode 100644 index 9e01b0af3d..0000000000 --- a/docs/generated/colour.plotting.plot_multi_colour_swatches.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_multi\_colour\_swatches -============================================= - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_multi_colour_swatches \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_multi_functions.rst b/docs/generated/colour.plotting.plot_multi_functions.rst deleted file mode 100644 index af3c739b78..0000000000 --- a/docs/generated/colour.plotting.plot_multi_functions.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_multi\_functions -====================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_multi_functions \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_multi_illuminant_sds.rst b/docs/generated/colour.plotting.plot_multi_illuminant_sds.rst deleted file mode 100644 index d43ecbe62d..0000000000 --- a/docs/generated/colour.plotting.plot_multi_illuminant_sds.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_multi\_illuminant\_sds -============================================ - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_multi_illuminant_sds \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_multi_lightness_functions.rst b/docs/generated/colour.plotting.plot_multi_lightness_functions.rst deleted file mode 100644 index b505e7a887..0000000000 --- a/docs/generated/colour.plotting.plot_multi_lightness_functions.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_multi\_lightness\_functions -================================================= - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_multi_lightness_functions \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_multi_luminance_functions.rst b/docs/generated/colour.plotting.plot_multi_luminance_functions.rst deleted file mode 100644 index a5ab3aabed..0000000000 --- a/docs/generated/colour.plotting.plot_multi_luminance_functions.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_multi\_luminance\_functions -================================================= - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_multi_luminance_functions \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_multi_munsell_value_functions.rst b/docs/generated/colour.plotting.plot_multi_munsell_value_functions.rst deleted file mode 100644 index 73cce0d742..0000000000 --- a/docs/generated/colour.plotting.plot_multi_munsell_value_functions.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_multi\_munsell\_value\_functions -====================================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_multi_munsell_value_functions \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_multi_sds.rst b/docs/generated/colour.plotting.plot_multi_sds.rst deleted file mode 100644 index 87cc94f27c..0000000000 --- a/docs/generated/colour.plotting.plot_multi_sds.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_multi\_sds -================================ - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_multi_sds \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_multi_sds_colour_quality_scales_bars.rst b/docs/generated/colour.plotting.plot_multi_sds_colour_quality_scales_bars.rst deleted file mode 100644 index f41b060def..0000000000 --- a/docs/generated/colour.plotting.plot_multi_sds_colour_quality_scales_bars.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_multi\_sds\_colour\_quality\_scales\_bars -=============================================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_multi_sds_colour_quality_scales_bars \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_multi_sds_colour_rendering_indexes_bars.rst b/docs/generated/colour.plotting.plot_multi_sds_colour_rendering_indexes_bars.rst deleted file mode 100644 index eef1a7630d..0000000000 --- a/docs/generated/colour.plotting.plot_multi_sds_colour_rendering_indexes_bars.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_multi\_sds\_colour\_rendering\_indexes\_bars -================================================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_multi_sds_colour_rendering_indexes_bars \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_planckian_locus_in_chromaticity_diagram_CIE1931.rst b/docs/generated/colour.plotting.plot_planckian_locus_in_chromaticity_diagram_CIE1931.rst deleted file mode 100644 index 1cb23b7f9f..0000000000 --- a/docs/generated/colour.plotting.plot_planckian_locus_in_chromaticity_diagram_CIE1931.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_planckian\_locus\_in\_chromaticity\_diagram\_CIE1931 -========================================================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_planckian_locus_in_chromaticity_diagram_CIE1931 \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS.rst b/docs/generated/colour.plotting.plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS.rst deleted file mode 100644 index af48ace8f1..0000000000 --- a/docs/generated/colour.plotting.plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_planckian\_locus\_in\_chromaticity\_diagram\_CIE1960UCS -============================================================================= - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_sds_in_chromaticity_diagram_CIE1931.rst b/docs/generated/colour.plotting.plot_sds_in_chromaticity_diagram_CIE1931.rst deleted file mode 100644 index a9ced52928..0000000000 --- a/docs/generated/colour.plotting.plot_sds_in_chromaticity_diagram_CIE1931.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_sds\_in\_chromaticity\_diagram\_CIE1931 -============================================================= - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_sds_in_chromaticity_diagram_CIE1931 \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_sds_in_chromaticity_diagram_CIE1960UCS.rst b/docs/generated/colour.plotting.plot_sds_in_chromaticity_diagram_CIE1960UCS.rst deleted file mode 100644 index d72060aa11..0000000000 --- a/docs/generated/colour.plotting.plot_sds_in_chromaticity_diagram_CIE1960UCS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_sds\_in\_chromaticity\_diagram\_CIE1960UCS -================================================================ - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_sds_in_chromaticity_diagram_CIE1960UCS \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_sds_in_chromaticity_diagram_CIE1976UCS.rst b/docs/generated/colour.plotting.plot_sds_in_chromaticity_diagram_CIE1976UCS.rst deleted file mode 100644 index 016e02329c..0000000000 --- a/docs/generated/colour.plotting.plot_sds_in_chromaticity_diagram_CIE1976UCS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_sds\_in\_chromaticity\_diagram\_CIE1976UCS -================================================================ - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_sds_in_chromaticity_diagram_CIE1976UCS \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_single_cctf.rst b/docs/generated/colour.plotting.plot_single_cctf.rst deleted file mode 100644 index c924f24e0f..0000000000 --- a/docs/generated/colour.plotting.plot_single_cctf.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_single\_cctf -================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_single_cctf \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_single_cmfs.rst b/docs/generated/colour.plotting.plot_single_cmfs.rst deleted file mode 100644 index 3c72dd63e9..0000000000 --- a/docs/generated/colour.plotting.plot_single_cmfs.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_single\_cmfs -================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_single_cmfs \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_single_colour_checker.rst b/docs/generated/colour.plotting.plot_single_colour_checker.rst deleted file mode 100644 index 8522782c9e..0000000000 --- a/docs/generated/colour.plotting.plot_single_colour_checker.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_single\_colour\_checker -============================================= - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_single_colour_checker \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_single_colour_swatch.rst b/docs/generated/colour.plotting.plot_single_colour_swatch.rst deleted file mode 100644 index c2569214e9..0000000000 --- a/docs/generated/colour.plotting.plot_single_colour_swatch.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_single\_colour\_swatch -============================================ - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_single_colour_swatch \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_single_function.rst b/docs/generated/colour.plotting.plot_single_function.rst deleted file mode 100644 index 9e2af6fba0..0000000000 --- a/docs/generated/colour.plotting.plot_single_function.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_single\_function -====================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_single_function \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_single_illuminant_sd.rst b/docs/generated/colour.plotting.plot_single_illuminant_sd.rst deleted file mode 100644 index 3a8aa9f2df..0000000000 --- a/docs/generated/colour.plotting.plot_single_illuminant_sd.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_single\_illuminant\_sd -============================================ - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_single_illuminant_sd \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_single_lightness_function.rst b/docs/generated/colour.plotting.plot_single_lightness_function.rst deleted file mode 100644 index c46f1317b4..0000000000 --- a/docs/generated/colour.plotting.plot_single_lightness_function.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_single\_lightness\_function -================================================= - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_single_lightness_function \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_single_luminance_function.rst b/docs/generated/colour.plotting.plot_single_luminance_function.rst deleted file mode 100644 index 239b3363f5..0000000000 --- a/docs/generated/colour.plotting.plot_single_luminance_function.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_single\_luminance\_function -================================================= - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_single_luminance_function \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_single_munsell_value_function.rst b/docs/generated/colour.plotting.plot_single_munsell_value_function.rst deleted file mode 100644 index 9bf6219539..0000000000 --- a/docs/generated/colour.plotting.plot_single_munsell_value_function.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_single\_munsell\_value\_function -====================================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_single_munsell_value_function \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_single_sd.rst b/docs/generated/colour.plotting.plot_single_sd.rst deleted file mode 100644 index 6254889863..0000000000 --- a/docs/generated/colour.plotting.plot_single_sd.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_single\_sd -================================ - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_single_sd \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_single_sd_colour_quality_scale_bars.rst b/docs/generated/colour.plotting.plot_single_sd_colour_quality_scale_bars.rst deleted file mode 100644 index 11d01ce0c2..0000000000 --- a/docs/generated/colour.plotting.plot_single_sd_colour_quality_scale_bars.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_single\_sd\_colour\_quality\_scale\_bars -============================================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_single_sd_colour_quality_scale_bars \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_single_sd_colour_rendering_index_bars.rst b/docs/generated/colour.plotting.plot_single_sd_colour_rendering_index_bars.rst deleted file mode 100644 index 08db049ecb..0000000000 --- a/docs/generated/colour.plotting.plot_single_sd_colour_rendering_index_bars.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_single\_sd\_colour\_rendering\_index\_bars -================================================================ - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_single_sd_colour_rendering_index_bars \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_single_sd_rayleigh_scattering.rst b/docs/generated/colour.plotting.plot_single_sd_rayleigh_scattering.rst deleted file mode 100644 index 9738fa9056..0000000000 --- a/docs/generated/colour.plotting.plot_single_sd_rayleigh_scattering.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_single\_sd\_rayleigh\_scattering -====================================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_single_sd_rayleigh_scattering \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_the_blue_sky.rst b/docs/generated/colour.plotting.plot_the_blue_sky.rst deleted file mode 100644 index 54333626b5..0000000000 --- a/docs/generated/colour.plotting.plot_the_blue_sky.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_the\_blue\_sky -==================================== - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_the_blue_sky \ No newline at end of file diff --git a/docs/generated/colour.plotting.plot_visible_spectrum.rst b/docs/generated/colour.plotting.plot_visible_spectrum.rst deleted file mode 100644 index cb7f15d5e9..0000000000 --- a/docs/generated/colour.plotting.plot_visible_spectrum.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.plot\_visible\_spectrum -======================================= - -.. currentmodule:: colour.plotting - -.. autofunction:: plot_visible_spectrum \ No newline at end of file diff --git a/docs/generated/colour.plotting.quad.rst b/docs/generated/colour.plotting.quad.rst deleted file mode 100644 index 5f6f5d5db4..0000000000 --- a/docs/generated/colour.plotting.quad.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.quad -==================== - -.. currentmodule:: colour.plotting - -.. autofunction:: quad \ No newline at end of file diff --git a/docs/generated/colour.plotting.quality.plot_colour_quality_bars.rst b/docs/generated/colour.plotting.quality.plot_colour_quality_bars.rst deleted file mode 100644 index f46c2c80dc..0000000000 --- a/docs/generated/colour.plotting.quality.plot_colour_quality_bars.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.quality.plot\_colour\_quality\_bars -=================================================== - -.. currentmodule:: colour.plotting.quality - -.. autofunction:: plot_colour_quality_bars \ No newline at end of file diff --git a/docs/generated/colour.plotting.render.rst b/docs/generated/colour.plotting.render.rst deleted file mode 100644 index cb9f9cac0e..0000000000 --- a/docs/generated/colour.plotting.render.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.render -====================== - -.. currentmodule:: colour.plotting - -.. autofunction:: render \ No newline at end of file diff --git a/docs/generated/colour.plotting.temperature.plot_planckian_locus.rst b/docs/generated/colour.plotting.temperature.plot_planckian_locus.rst deleted file mode 100644 index 634436a36a..0000000000 --- a/docs/generated/colour.plotting.temperature.plot_planckian_locus.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.temperature.plot\_planckian\_locus -================================================== - -.. currentmodule:: colour.plotting.temperature - -.. autofunction:: plot_planckian_locus \ No newline at end of file diff --git a/docs/generated/colour.plotting.temperature.plot_planckian_locus_in_chromaticity_diagram.rst b/docs/generated/colour.plotting.temperature.plot_planckian_locus_in_chromaticity_diagram.rst deleted file mode 100644 index edd31d1437..0000000000 --- a/docs/generated/colour.plotting.temperature.plot_planckian_locus_in_chromaticity_diagram.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.temperature.plot\_planckian\_locus\_in\_chromaticity\_diagram -============================================================================= - -.. currentmodule:: colour.plotting.temperature - -.. autofunction:: plot_planckian_locus_in_chromaticity_diagram \ No newline at end of file diff --git a/docs/generated/colour.plotting.uniform_axes3d.rst b/docs/generated/colour.plotting.uniform_axes3d.rst deleted file mode 100644 index 712a3d82d1..0000000000 --- a/docs/generated/colour.plotting.uniform_axes3d.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.plotting.uniform\_axes3d -=============================== - -.. currentmodule:: colour.plotting - -.. autofunction:: uniform_axes3d \ No newline at end of file diff --git a/docs/generated/colour.polynomial_expansion.rst b/docs/generated/colour.polynomial_expansion.rst deleted file mode 100644 index a278165377..0000000000 --- a/docs/generated/colour.polynomial_expansion.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.polynomial\_expansion -============================ - -.. currentmodule:: colour - -.. autofunction:: polynomial_expansion \ No newline at end of file diff --git a/docs/generated/colour.primaries_whitepoint.rst b/docs/generated/colour.primaries_whitepoint.rst deleted file mode 100644 index 2a4ddd3e45..0000000000 --- a/docs/generated/colour.primaries_whitepoint.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.primaries\_whitepoint -============================ - -.. currentmodule:: colour - -.. autofunction:: primaries_whitepoint \ No newline at end of file diff --git a/docs/generated/colour.quality.CQS_Specification.rst b/docs/generated/colour.quality.CQS_Specification.rst deleted file mode 100644 index c8d42e8bb3..0000000000 --- a/docs/generated/colour.quality.CQS_Specification.rst +++ /dev/null @@ -1,36 +0,0 @@ -colour.quality.CQS\_Specification -================================= - -.. currentmodule:: colour.quality - -.. autoclass:: CQS_Specification - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~CQS_Specification.count - ~CQS_Specification.index - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~CQS_Specification.Q_a - ~CQS_Specification.Q_as - ~CQS_Specification.Q_d - ~CQS_Specification.Q_f - ~CQS_Specification.Q_g - ~CQS_Specification.Q_p - ~CQS_Specification.colorimetry_data - ~CQS_Specification.name - - \ No newline at end of file diff --git a/docs/generated/colour.quality.CRI_Specification.rst b/docs/generated/colour.quality.CRI_Specification.rst deleted file mode 100644 index bcd96e27be..0000000000 --- a/docs/generated/colour.quality.CRI_Specification.rst +++ /dev/null @@ -1,32 +0,0 @@ -colour.quality.CRI\_Specification -================================= - -.. currentmodule:: colour.quality - -.. autoclass:: CRI_Specification - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~CRI_Specification.count - ~CRI_Specification.index - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~CRI_Specification.Q_a - ~CRI_Specification.Q_as - ~CRI_Specification.colorimetry_data - ~CRI_Specification.name - - \ No newline at end of file diff --git a/docs/generated/colour.rayleigh_scattering.rst b/docs/generated/colour.rayleigh_scattering.rst deleted file mode 100644 index 6d48ac5dfe..0000000000 --- a/docs/generated/colour.rayleigh_scattering.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.rayleigh\_scattering -=========================== - -.. currentmodule:: colour - -.. autofunction:: rayleigh_scattering \ No newline at end of file diff --git a/docs/generated/colour.read_LUT.rst b/docs/generated/colour.read_LUT.rst deleted file mode 100644 index f632e6d192..0000000000 --- a/docs/generated/colour.read_LUT.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.read\_LUT -================ - -.. currentmodule:: colour - -.. autofunction:: read_LUT \ No newline at end of file diff --git a/docs/generated/colour.read_image.rst b/docs/generated/colour.read_image.rst deleted file mode 100644 index d2bd673792..0000000000 --- a/docs/generated/colour.read_image.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.read\_image -================== - -.. currentmodule:: colour - -.. autofunction:: read_image \ No newline at end of file diff --git a/docs/generated/colour.read_sds_from_csv_file.rst b/docs/generated/colour.read_sds_from_csv_file.rst deleted file mode 100644 index eb905ebf21..0000000000 --- a/docs/generated/colour.read_sds_from_csv_file.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.read\_sds\_from\_csv\_file -================================= - -.. currentmodule:: colour - -.. autofunction:: read_sds_from_csv_file \ No newline at end of file diff --git a/docs/generated/colour.read_sds_from_xrite_file.rst b/docs/generated/colour.read_sds_from_xrite_file.rst deleted file mode 100644 index 277c3b30c8..0000000000 --- a/docs/generated/colour.read_sds_from_xrite_file.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.read\_sds\_from\_xrite\_file -=================================== - -.. currentmodule:: colour - -.. autofunction:: read_sds_from_xrite_file \ No newline at end of file diff --git a/docs/generated/colour.read_spectral_data_from_csv_file.rst b/docs/generated/colour.read_spectral_data_from_csv_file.rst deleted file mode 100644 index f80f97bde3..0000000000 --- a/docs/generated/colour.read_spectral_data_from_csv_file.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.read\_spectral\_data\_from\_csv\_file -============================================ - -.. currentmodule:: colour - -.. autofunction:: read_spectral_data_from_csv_file \ No newline at end of file diff --git a/docs/generated/colour.recovery.RGB_to_sd_Smits1999.rst b/docs/generated/colour.recovery.RGB_to_sd_Smits1999.rst deleted file mode 100644 index 6399b082dc..0000000000 --- a/docs/generated/colour.recovery.RGB_to_sd_Smits1999.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.recovery.RGB\_to\_sd\_Smits1999 -====================================== - -.. currentmodule:: colour.recovery - -.. autofunction:: RGB_to_sd_Smits1999 \ No newline at end of file diff --git a/docs/generated/colour.recovery.SMITS_1999_SDS.rst b/docs/generated/colour.recovery.SMITS_1999_SDS.rst deleted file mode 100644 index 8a88cdc845..0000000000 --- a/docs/generated/colour.recovery.SMITS_1999_SDS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.recovery.SMITS\_1999\_SDS -================================ - -.. currentmodule:: colour.recovery - -.. autodata:: SMITS_1999_SDS \ No newline at end of file diff --git a/docs/generated/colour.recovery.XYZ_to_sd_Meng2015.rst b/docs/generated/colour.recovery.XYZ_to_sd_Meng2015.rst deleted file mode 100644 index 846ab6526d..0000000000 --- a/docs/generated/colour.recovery.XYZ_to_sd_Meng2015.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.recovery.XYZ\_to\_sd\_Meng2015 -===================================== - -.. currentmodule:: colour.recovery - -.. autofunction:: XYZ_to_sd_Meng2015 \ No newline at end of file diff --git a/docs/generated/colour.sRGB_to_XYZ.rst b/docs/generated/colour.sRGB_to_XYZ.rst deleted file mode 100644 index 722bf275e3..0000000000 --- a/docs/generated/colour.sRGB_to_XYZ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.sRGB\_to\_XYZ -==================== - -.. currentmodule:: colour - -.. autofunction:: sRGB_to_XYZ \ No newline at end of file diff --git a/docs/generated/colour.scattering_cross_section.rst b/docs/generated/colour.scattering_cross_section.rst deleted file mode 100644 index b6327dac53..0000000000 --- a/docs/generated/colour.scattering_cross_section.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.scattering\_cross\_section -================================= - -.. currentmodule:: colour - -.. autofunction:: scattering_cross_section \ No newline at end of file diff --git a/docs/generated/colour.sd_CIE_illuminant_D_series.rst b/docs/generated/colour.sd_CIE_illuminant_D_series.rst deleted file mode 100644 index d5380259c5..0000000000 --- a/docs/generated/colour.sd_CIE_illuminant_D_series.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.sd\_CIE\_illuminant\_D\_series -===================================== - -.. currentmodule:: colour - -.. autofunction:: sd_CIE_illuminant_D_series \ No newline at end of file diff --git a/docs/generated/colour.sd_CIE_standard_illuminant_A.rst b/docs/generated/colour.sd_CIE_standard_illuminant_A.rst deleted file mode 100644 index ddd89db64a..0000000000 --- a/docs/generated/colour.sd_CIE_standard_illuminant_A.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.sd\_CIE\_standard\_illuminant\_A -======================================= - -.. currentmodule:: colour - -.. autofunction:: sd_CIE_standard_illuminant_A \ No newline at end of file diff --git a/docs/generated/colour.sd_blackbody.rst b/docs/generated/colour.sd_blackbody.rst deleted file mode 100644 index d430894825..0000000000 --- a/docs/generated/colour.sd_blackbody.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.sd\_blackbody -==================== - -.. currentmodule:: colour - -.. autofunction:: sd_blackbody \ No newline at end of file diff --git a/docs/generated/colour.sd_constant.rst b/docs/generated/colour.sd_constant.rst deleted file mode 100644 index c877c33802..0000000000 --- a/docs/generated/colour.sd_constant.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.sd\_constant -=================== - -.. currentmodule:: colour - -.. autofunction:: sd_constant \ No newline at end of file diff --git a/docs/generated/colour.sd_gaussian.rst b/docs/generated/colour.sd_gaussian.rst deleted file mode 100644 index 9ee916f604..0000000000 --- a/docs/generated/colour.sd_gaussian.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.sd\_gaussian -=================== - -.. currentmodule:: colour - -.. autofunction:: sd_gaussian \ No newline at end of file diff --git a/docs/generated/colour.sd_mesopic_luminous_efficiency_function.rst b/docs/generated/colour.sd_mesopic_luminous_efficiency_function.rst deleted file mode 100644 index 6a2bbce1c4..0000000000 --- a/docs/generated/colour.sd_mesopic_luminous_efficiency_function.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.sd\_mesopic\_luminous\_efficiency\_function -================================================== - -.. currentmodule:: colour - -.. autofunction:: sd_mesopic_luminous_efficiency_function \ No newline at end of file diff --git a/docs/generated/colour.sd_multi_leds.rst b/docs/generated/colour.sd_multi_leds.rst deleted file mode 100644 index 465ca3a442..0000000000 --- a/docs/generated/colour.sd_multi_leds.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.sd\_multi\_leds -====================== - -.. currentmodule:: colour - -.. autofunction:: sd_multi_leds \ No newline at end of file diff --git a/docs/generated/colour.sd_ones.rst b/docs/generated/colour.sd_ones.rst deleted file mode 100644 index 8a9c0f57a8..0000000000 --- a/docs/generated/colour.sd_ones.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.sd\_ones -=============== - -.. currentmodule:: colour - -.. autofunction:: sd_ones \ No newline at end of file diff --git a/docs/generated/colour.sd_rayleigh_scattering.rst b/docs/generated/colour.sd_rayleigh_scattering.rst deleted file mode 100644 index c47895a510..0000000000 --- a/docs/generated/colour.sd_rayleigh_scattering.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.sd\_rayleigh\_scattering -=============================== - -.. currentmodule:: colour - -.. autofunction:: sd_rayleigh_scattering \ No newline at end of file diff --git a/docs/generated/colour.sd_single_led.rst b/docs/generated/colour.sd_single_led.rst deleted file mode 100644 index cac127240e..0000000000 --- a/docs/generated/colour.sd_single_led.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.sd\_single\_led -====================== - -.. currentmodule:: colour - -.. autofunction:: sd_single_led \ No newline at end of file diff --git a/docs/generated/colour.sd_to_XYZ.rst b/docs/generated/colour.sd_to_XYZ.rst deleted file mode 100644 index 5380dfd2b7..0000000000 --- a/docs/generated/colour.sd_to_XYZ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.sd\_to\_XYZ -================== - -.. currentmodule:: colour - -.. autofunction:: sd_to_XYZ \ No newline at end of file diff --git a/docs/generated/colour.sd_to_aces_relative_exposure_values.rst b/docs/generated/colour.sd_to_aces_relative_exposure_values.rst deleted file mode 100644 index 9a26f51448..0000000000 --- a/docs/generated/colour.sd_to_aces_relative_exposure_values.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.sd\_to\_aces\_relative\_exposure\_values -=============================================== - -.. currentmodule:: colour - -.. autofunction:: sd_to_aces_relative_exposure_values \ No newline at end of file diff --git a/docs/generated/colour.sd_zeros.rst b/docs/generated/colour.sd_zeros.rst deleted file mode 100644 index e19f8408b3..0000000000 --- a/docs/generated/colour.sd_zeros.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.sd\_zeros -================ - -.. currentmodule:: colour - -.. autofunction:: sd_zeros \ No newline at end of file diff --git a/docs/generated/colour.set_domain_range_scale.rst b/docs/generated/colour.set_domain_range_scale.rst deleted file mode 100644 index 7e1929361e..0000000000 --- a/docs/generated/colour.set_domain_range_scale.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.set\_domain\_range\_scale -================================ - -.. currentmodule:: colour - -.. autofunction:: set_domain_range_scale \ No newline at end of file diff --git a/docs/generated/colour.table_interpolation.rst b/docs/generated/colour.table_interpolation.rst deleted file mode 100644 index e31de35f7c..0000000000 --- a/docs/generated/colour.table_interpolation.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.table\_interpolation -=========================== - -.. currentmodule:: colour - -.. autofunction:: table_interpolation \ No newline at end of file diff --git a/docs/generated/colour.temperature.CCT_to_uv_Krystek1985.rst b/docs/generated/colour.temperature.CCT_to_uv_Krystek1985.rst deleted file mode 100644 index 8b1dfbfbaa..0000000000 --- a/docs/generated/colour.temperature.CCT_to_uv_Krystek1985.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.temperature.CCT\_to\_uv\_Krystek1985 -=========================================== - -.. currentmodule:: colour.temperature - -.. autofunction:: CCT_to_uv_Krystek1985 \ No newline at end of file diff --git a/docs/generated/colour.temperature.CCT_to_uv_Ohno2013.rst b/docs/generated/colour.temperature.CCT_to_uv_Ohno2013.rst deleted file mode 100644 index a8f85ca670..0000000000 --- a/docs/generated/colour.temperature.CCT_to_uv_Ohno2013.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.temperature.CCT\_to\_uv\_Ohno2013 -======================================== - -.. currentmodule:: colour.temperature - -.. autofunction:: CCT_to_uv_Ohno2013 \ No newline at end of file diff --git a/docs/generated/colour.temperature.CCT_to_uv_Robertson1968.rst b/docs/generated/colour.temperature.CCT_to_uv_Robertson1968.rst deleted file mode 100644 index 56ab9c91f6..0000000000 --- a/docs/generated/colour.temperature.CCT_to_uv_Robertson1968.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.temperature.CCT\_to\_uv\_Robertson1968 -============================================= - -.. currentmodule:: colour.temperature - -.. autofunction:: CCT_to_uv_Robertson1968 \ No newline at end of file diff --git a/docs/generated/colour.temperature.CCT_to_xy_CIE_D.rst b/docs/generated/colour.temperature.CCT_to_xy_CIE_D.rst deleted file mode 100644 index 4ff09375ff..0000000000 --- a/docs/generated/colour.temperature.CCT_to_xy_CIE_D.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.temperature.CCT\_to\_xy\_CIE\_D -====================================== - -.. currentmodule:: colour.temperature - -.. autofunction:: CCT_to_xy_CIE_D \ No newline at end of file diff --git a/docs/generated/colour.temperature.CCT_to_xy_Kang2002.rst b/docs/generated/colour.temperature.CCT_to_xy_Kang2002.rst deleted file mode 100644 index 3e0a567ae0..0000000000 --- a/docs/generated/colour.temperature.CCT_to_xy_Kang2002.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.temperature.CCT\_to\_xy\_Kang2002 -======================================== - -.. currentmodule:: colour.temperature - -.. autofunction:: CCT_to_xy_Kang2002 \ No newline at end of file diff --git a/docs/generated/colour.temperature.uv_to_CCT_Ohno2013.rst b/docs/generated/colour.temperature.uv_to_CCT_Ohno2013.rst deleted file mode 100644 index c2f57fd1b8..0000000000 --- a/docs/generated/colour.temperature.uv_to_CCT_Ohno2013.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.temperature.uv\_to\_CCT\_Ohno2013 -======================================== - -.. currentmodule:: colour.temperature - -.. autofunction:: uv_to_CCT_Ohno2013 \ No newline at end of file diff --git a/docs/generated/colour.temperature.uv_to_CCT_Robertson1968.rst b/docs/generated/colour.temperature.uv_to_CCT_Robertson1968.rst deleted file mode 100644 index 52f831de3c..0000000000 --- a/docs/generated/colour.temperature.uv_to_CCT_Robertson1968.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.temperature.uv\_to\_CCT\_Robertson1968 -============================================= - -.. currentmodule:: colour.temperature - -.. autofunction:: uv_to_CCT_Robertson1968 \ No newline at end of file diff --git a/docs/generated/colour.temperature.xy_to_CCT_Hernandez1999.rst b/docs/generated/colour.temperature.xy_to_CCT_Hernandez1999.rst deleted file mode 100644 index bb13d0603c..0000000000 --- a/docs/generated/colour.temperature.xy_to_CCT_Hernandez1999.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.temperature.xy\_to\_CCT\_Hernandez1999 -============================================= - -.. currentmodule:: colour.temperature - -.. autofunction:: xy_to_CCT_Hernandez1999 \ No newline at end of file diff --git a/docs/generated/colour.utilities.CaseInsensitiveMapping.rst b/docs/generated/colour.utilities.CaseInsensitiveMapping.rst deleted file mode 100644 index 8d646c34f4..0000000000 --- a/docs/generated/colour.utilities.CaseInsensitiveMapping.rst +++ /dev/null @@ -1,39 +0,0 @@ -colour.utilities.CaseInsensitiveMapping -======================================= - -.. currentmodule:: colour.utilities - -.. autoclass:: CaseInsensitiveMapping - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~CaseInsensitiveMapping.__init__ - ~CaseInsensitiveMapping.clear - ~CaseInsensitiveMapping.copy - ~CaseInsensitiveMapping.get - ~CaseInsensitiveMapping.items - ~CaseInsensitiveMapping.keys - ~CaseInsensitiveMapping.lower_items - ~CaseInsensitiveMapping.pop - ~CaseInsensitiveMapping.popitem - ~CaseInsensitiveMapping.setdefault - ~CaseInsensitiveMapping.update - ~CaseInsensitiveMapping.values - - - - - - .. rubric:: Attributes - - .. autosummary:: - - ~CaseInsensitiveMapping.data - - \ No newline at end of file diff --git a/docs/generated/colour.utilities.ColourRuntimeWarning.rst b/docs/generated/colour.utilities.ColourRuntimeWarning.rst deleted file mode 100644 index 0ccd7a7da2..0000000000 --- a/docs/generated/colour.utilities.ColourRuntimeWarning.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.ColourRuntimeWarning -===================================== - -.. currentmodule:: colour.utilities - -.. autoexception:: ColourRuntimeWarning \ No newline at end of file diff --git a/docs/generated/colour.utilities.ColourUsageWarning.rst b/docs/generated/colour.utilities.ColourUsageWarning.rst deleted file mode 100644 index 656f866acb..0000000000 --- a/docs/generated/colour.utilities.ColourUsageWarning.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.ColourUsageWarning -=================================== - -.. currentmodule:: colour.utilities - -.. autoexception:: ColourUsageWarning \ No newline at end of file diff --git a/docs/generated/colour.utilities.ColourWarning.rst b/docs/generated/colour.utilities.ColourWarning.rst deleted file mode 100644 index 4d9d7bb6ab..0000000000 --- a/docs/generated/colour.utilities.ColourWarning.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.ColourWarning -============================== - -.. currentmodule:: colour.utilities - -.. autoexception:: ColourWarning \ No newline at end of file diff --git a/docs/generated/colour.utilities.Lookup.rst b/docs/generated/colour.utilities.Lookup.rst deleted file mode 100644 index c1c6c71d6b..0000000000 --- a/docs/generated/colour.utilities.Lookup.rst +++ /dev/null @@ -1,34 +0,0 @@ -colour.utilities.Lookup -======================= - -.. currentmodule:: colour.utilities - -.. autoclass:: Lookup - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~Lookup.clear - ~Lookup.copy - ~Lookup.first_key_from_value - ~Lookup.fromkeys - ~Lookup.get - ~Lookup.items - ~Lookup.keys - ~Lookup.keys_from_value - ~Lookup.pop - ~Lookup.popitem - ~Lookup.setdefault - ~Lookup.update - ~Lookup.values - - - - - - \ No newline at end of file diff --git a/docs/generated/colour.utilities.Structure.rst b/docs/generated/colour.utilities.Structure.rst deleted file mode 100644 index f287038bd3..0000000000 --- a/docs/generated/colour.utilities.Structure.rst +++ /dev/null @@ -1,33 +0,0 @@ -colour.utilities.Structure -========================== - -.. currentmodule:: colour.utilities - -.. autoclass:: Structure - - - .. automethod:: __init__ - - - .. rubric:: Methods - - .. autosummary:: - - ~Structure.__init__ - ~Structure.clear - ~Structure.copy - ~Structure.fromkeys - ~Structure.get - ~Structure.items - ~Structure.keys - ~Structure.pop - ~Structure.popitem - ~Structure.setdefault - ~Structure.update - ~Structure.values - - - - - - \ No newline at end of file diff --git a/docs/generated/colour.utilities.as_array.rst b/docs/generated/colour.utilities.as_array.rst deleted file mode 100644 index 41b7a6e140..0000000000 --- a/docs/generated/colour.utilities.as_array.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.as\_array -========================== - -.. currentmodule:: colour.utilities - -.. autofunction:: as_array \ No newline at end of file diff --git a/docs/generated/colour.utilities.as_float.rst b/docs/generated/colour.utilities.as_float.rst deleted file mode 100644 index 31946e0e56..0000000000 --- a/docs/generated/colour.utilities.as_float.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.as\_float -========================== - -.. currentmodule:: colour.utilities - -.. autofunction:: as_float \ No newline at end of file diff --git a/docs/generated/colour.utilities.as_float_array.rst b/docs/generated/colour.utilities.as_float_array.rst deleted file mode 100644 index 4370481479..0000000000 --- a/docs/generated/colour.utilities.as_float_array.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.as\_float\_array -================================= - -.. currentmodule:: colour.utilities - -.. autofunction:: as_float_array \ No newline at end of file diff --git a/docs/generated/colour.utilities.as_int.rst b/docs/generated/colour.utilities.as_int.rst deleted file mode 100644 index e59e2049dc..0000000000 --- a/docs/generated/colour.utilities.as_int.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.as\_int -======================== - -.. currentmodule:: colour.utilities - -.. autofunction:: as_int \ No newline at end of file diff --git a/docs/generated/colour.utilities.as_int_array.rst b/docs/generated/colour.utilities.as_int_array.rst deleted file mode 100644 index 18d466b2df..0000000000 --- a/docs/generated/colour.utilities.as_int_array.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.as\_int\_array -=============================== - -.. currentmodule:: colour.utilities - -.. autofunction:: as_int_array \ No newline at end of file diff --git a/docs/generated/colour.utilities.as_namedtuple.rst b/docs/generated/colour.utilities.as_namedtuple.rst deleted file mode 100644 index 97a6a0733f..0000000000 --- a/docs/generated/colour.utilities.as_namedtuple.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.as\_namedtuple -=============================== - -.. currentmodule:: colour.utilities - -.. autofunction:: as_namedtuple \ No newline at end of file diff --git a/docs/generated/colour.utilities.as_numeric.rst b/docs/generated/colour.utilities.as_numeric.rst deleted file mode 100644 index 8f038e1ed9..0000000000 --- a/docs/generated/colour.utilities.as_numeric.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.as\_numeric -============================ - -.. currentmodule:: colour.utilities - -.. autofunction:: as_numeric \ No newline at end of file diff --git a/docs/generated/colour.utilities.batch.rst b/docs/generated/colour.utilities.batch.rst deleted file mode 100644 index aa869b44a2..0000000000 --- a/docs/generated/colour.utilities.batch.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.batch -====================== - -.. currentmodule:: colour.utilities - -.. autofunction:: batch \ No newline at end of file diff --git a/docs/generated/colour.utilities.centroid.rst b/docs/generated/colour.utilities.centroid.rst deleted file mode 100644 index f9f4c6bf7d..0000000000 --- a/docs/generated/colour.utilities.centroid.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.centroid -========================= - -.. currentmodule:: colour.utilities - -.. autofunction:: centroid \ No newline at end of file diff --git a/docs/generated/colour.utilities.closest.rst b/docs/generated/colour.utilities.closest.rst deleted file mode 100644 index e337afb447..0000000000 --- a/docs/generated/colour.utilities.closest.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.closest -======================== - -.. currentmodule:: colour.utilities - -.. autofunction:: closest \ No newline at end of file diff --git a/docs/generated/colour.utilities.closest_indexes.rst b/docs/generated/colour.utilities.closest_indexes.rst deleted file mode 100644 index 0dc4a5cde0..0000000000 --- a/docs/generated/colour.utilities.closest_indexes.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.closest\_indexes -================================= - -.. currentmodule:: colour.utilities - -.. autofunction:: closest_indexes \ No newline at end of file diff --git a/docs/generated/colour.utilities.describe_environment.rst b/docs/generated/colour.utilities.describe_environment.rst deleted file mode 100644 index c2bec0061d..0000000000 --- a/docs/generated/colour.utilities.describe_environment.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.describe\_environment -====================================== - -.. currentmodule:: colour.utilities - -.. autofunction:: describe_environment \ No newline at end of file diff --git a/docs/generated/colour.utilities.disable_multiprocessing.rst b/docs/generated/colour.utilities.disable_multiprocessing.rst deleted file mode 100644 index a351f7cf40..0000000000 --- a/docs/generated/colour.utilities.disable_multiprocessing.rst +++ /dev/null @@ -1,16 +0,0 @@ -colour.utilities.disable\_multiprocessing -========================================= - -.. currentmodule:: colour.utilities - -.. autoclass:: disable_multiprocessing - - - .. automethod:: __init__ - - - - - - - \ No newline at end of file diff --git a/docs/generated/colour.utilities.dot_matrix.rst b/docs/generated/colour.utilities.dot_matrix.rst deleted file mode 100644 index b65969d68c..0000000000 --- a/docs/generated/colour.utilities.dot_matrix.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.dot\_matrix -============================ - -.. currentmodule:: colour.utilities - -.. autofunction:: dot_matrix \ No newline at end of file diff --git a/docs/generated/colour.utilities.dot_vector.rst b/docs/generated/colour.utilities.dot_vector.rst deleted file mode 100644 index 37f9688b0a..0000000000 --- a/docs/generated/colour.utilities.dot_vector.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.dot\_vector -============================ - -.. currentmodule:: colour.utilities - -.. autofunction:: dot_vector \ No newline at end of file diff --git a/docs/generated/colour.utilities.fill_nan.rst b/docs/generated/colour.utilities.fill_nan.rst deleted file mode 100644 index d22ba34e75..0000000000 --- a/docs/generated/colour.utilities.fill_nan.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.fill\_nan -========================== - -.. currentmodule:: colour.utilities - -.. autofunction:: fill_nan \ No newline at end of file diff --git a/docs/generated/colour.utilities.filter_kwargs.rst b/docs/generated/colour.utilities.filter_kwargs.rst deleted file mode 100644 index accde0791e..0000000000 --- a/docs/generated/colour.utilities.filter_kwargs.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.filter\_kwargs -=============================== - -.. currentmodule:: colour.utilities - -.. autofunction:: filter_kwargs \ No newline at end of file diff --git a/docs/generated/colour.utilities.filter_mapping.rst b/docs/generated/colour.utilities.filter_mapping.rst deleted file mode 100644 index 4b41203813..0000000000 --- a/docs/generated/colour.utilities.filter_mapping.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.filter\_mapping -================================ - -.. currentmodule:: colour.utilities - -.. autofunction:: filter_mapping \ No newline at end of file diff --git a/docs/generated/colour.utilities.filter_warnings.rst b/docs/generated/colour.utilities.filter_warnings.rst deleted file mode 100644 index a347ec748c..0000000000 --- a/docs/generated/colour.utilities.filter_warnings.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.filter\_warnings -================================= - -.. currentmodule:: colour.utilities - -.. autofunction:: filter_warnings \ No newline at end of file diff --git a/docs/generated/colour.utilities.first_item.rst b/docs/generated/colour.utilities.first_item.rst deleted file mode 100644 index e14755c8b5..0000000000 --- a/docs/generated/colour.utilities.first_item.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.first\_item -============================ - -.. currentmodule:: colour.utilities - -.. autofunction:: first_item \ No newline at end of file diff --git a/docs/generated/colour.utilities.from_range_1.rst b/docs/generated/colour.utilities.from_range_1.rst deleted file mode 100644 index 332f3020ca..0000000000 --- a/docs/generated/colour.utilities.from_range_1.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.from\_range\_1 -=============================== - -.. currentmodule:: colour.utilities - -.. autofunction:: from_range_1 \ No newline at end of file diff --git a/docs/generated/colour.utilities.from_range_10.rst b/docs/generated/colour.utilities.from_range_10.rst deleted file mode 100644 index bab391bee5..0000000000 --- a/docs/generated/colour.utilities.from_range_10.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.from\_range\_10 -================================ - -.. currentmodule:: colour.utilities - -.. autofunction:: from_range_10 \ No newline at end of file diff --git a/docs/generated/colour.utilities.from_range_100.rst b/docs/generated/colour.utilities.from_range_100.rst deleted file mode 100644 index f84e76e538..0000000000 --- a/docs/generated/colour.utilities.from_range_100.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.from\_range\_100 -================================= - -.. currentmodule:: colour.utilities - -.. autofunction:: from_range_100 \ No newline at end of file diff --git a/docs/generated/colour.utilities.from_range_degrees.rst b/docs/generated/colour.utilities.from_range_degrees.rst deleted file mode 100644 index 22cc4353cb..0000000000 --- a/docs/generated/colour.utilities.from_range_degrees.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.from\_range\_degrees -===================================== - -.. currentmodule:: colour.utilities - -.. autofunction:: from_range_degrees \ No newline at end of file diff --git a/docs/generated/colour.utilities.from_range_int.rst b/docs/generated/colour.utilities.from_range_int.rst deleted file mode 100644 index 57624ced6e..0000000000 --- a/docs/generated/colour.utilities.from_range_int.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.from\_range\_int -================================= - -.. currentmodule:: colour.utilities - -.. autofunction:: from_range_int \ No newline at end of file diff --git a/docs/generated/colour.utilities.handle_numpy_errors.rst b/docs/generated/colour.utilities.handle_numpy_errors.rst deleted file mode 100644 index 3b0e1d5645..0000000000 --- a/docs/generated/colour.utilities.handle_numpy_errors.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.handle\_numpy\_errors -====================================== - -.. currentmodule:: colour.utilities - -.. autofunction:: handle_numpy_errors \ No newline at end of file diff --git a/docs/generated/colour.utilities.ignore_numpy_errors.rst b/docs/generated/colour.utilities.ignore_numpy_errors.rst deleted file mode 100644 index 8345501117..0000000000 --- a/docs/generated/colour.utilities.ignore_numpy_errors.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.ignore\_numpy\_errors -====================================== - -.. currentmodule:: colour.utilities - -.. autofunction:: ignore_numpy_errors \ No newline at end of file diff --git a/docs/generated/colour.utilities.ignore_python_warnings.rst b/docs/generated/colour.utilities.ignore_python_warnings.rst deleted file mode 100644 index f9729d7f98..0000000000 --- a/docs/generated/colour.utilities.ignore_python_warnings.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.ignore\_python\_warnings -========================================= - -.. currentmodule:: colour.utilities - -.. autofunction:: ignore_python_warnings \ No newline at end of file diff --git a/docs/generated/colour.utilities.in_array.rst b/docs/generated/colour.utilities.in_array.rst deleted file mode 100644 index d5db4983be..0000000000 --- a/docs/generated/colour.utilities.in_array.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.in\_array -========================== - -.. currentmodule:: colour.utilities - -.. autofunction:: in_array \ No newline at end of file diff --git a/docs/generated/colour.utilities.interval.rst b/docs/generated/colour.utilities.interval.rst deleted file mode 100644 index 89aff2cc62..0000000000 --- a/docs/generated/colour.utilities.interval.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.interval -========================= - -.. currentmodule:: colour.utilities - -.. autofunction:: interval \ No newline at end of file diff --git a/docs/generated/colour.utilities.is_integer.rst b/docs/generated/colour.utilities.is_integer.rst deleted file mode 100644 index 146f0977a4..0000000000 --- a/docs/generated/colour.utilities.is_integer.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.is\_integer -============================ - -.. currentmodule:: colour.utilities - -.. autofunction:: is_integer \ No newline at end of file diff --git a/docs/generated/colour.utilities.is_iterable.rst b/docs/generated/colour.utilities.is_iterable.rst deleted file mode 100644 index e6ac56bb80..0000000000 --- a/docs/generated/colour.utilities.is_iterable.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.is\_iterable -============================= - -.. currentmodule:: colour.utilities - -.. autofunction:: is_iterable \ No newline at end of file diff --git a/docs/generated/colour.utilities.is_numeric.rst b/docs/generated/colour.utilities.is_numeric.rst deleted file mode 100644 index ed3463d92a..0000000000 --- a/docs/generated/colour.utilities.is_numeric.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.is\_numeric -============================ - -.. currentmodule:: colour.utilities - -.. autofunction:: is_numeric \ No newline at end of file diff --git a/docs/generated/colour.utilities.is_openimageio_installed.rst b/docs/generated/colour.utilities.is_openimageio_installed.rst deleted file mode 100644 index 2fa390f8df..0000000000 --- a/docs/generated/colour.utilities.is_openimageio_installed.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.is\_openimageio\_installed -=========================================== - -.. currentmodule:: colour.utilities - -.. autofunction:: is_openimageio_installed \ No newline at end of file diff --git a/docs/generated/colour.utilities.is_pandas_installed.rst b/docs/generated/colour.utilities.is_pandas_installed.rst deleted file mode 100644 index 99435b31b6..0000000000 --- a/docs/generated/colour.utilities.is_pandas_installed.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.is\_pandas\_installed -====================================== - -.. currentmodule:: colour.utilities - -.. autofunction:: is_pandas_installed \ No newline at end of file diff --git a/docs/generated/colour.utilities.is_sibling.rst b/docs/generated/colour.utilities.is_sibling.rst deleted file mode 100644 index 9b75cd78de..0000000000 --- a/docs/generated/colour.utilities.is_sibling.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.is\_sibling -============================ - -.. currentmodule:: colour.utilities - -.. autofunction:: is_sibling \ No newline at end of file diff --git a/docs/generated/colour.utilities.is_string.rst b/docs/generated/colour.utilities.is_string.rst deleted file mode 100644 index 2820a66730..0000000000 --- a/docs/generated/colour.utilities.is_string.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.is\_string -=========================== - -.. currentmodule:: colour.utilities - -.. autofunction:: is_string \ No newline at end of file diff --git a/docs/generated/colour.utilities.is_uniform.rst b/docs/generated/colour.utilities.is_uniform.rst deleted file mode 100644 index 011b60aeb7..0000000000 --- a/docs/generated/colour.utilities.is_uniform.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.is\_uniform -============================ - -.. currentmodule:: colour.utilities - -.. autofunction:: is_uniform \ No newline at end of file diff --git a/docs/generated/colour.utilities.lerp.rst b/docs/generated/colour.utilities.lerp.rst deleted file mode 100644 index a3d1a8d4fb..0000000000 --- a/docs/generated/colour.utilities.lerp.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.lerp -===================== - -.. currentmodule:: colour.utilities - -.. autofunction:: lerp \ No newline at end of file diff --git a/docs/generated/colour.utilities.linear_conversion.rst b/docs/generated/colour.utilities.linear_conversion.rst deleted file mode 100644 index fbb3ba4d76..0000000000 --- a/docs/generated/colour.utilities.linear_conversion.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.linear\_conversion -=================================== - -.. currentmodule:: colour.utilities - -.. autofunction:: linear_conversion \ No newline at end of file diff --git a/docs/generated/colour.utilities.message_box.rst b/docs/generated/colour.utilities.message_box.rst deleted file mode 100644 index 72233eb474..0000000000 --- a/docs/generated/colour.utilities.message_box.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.message\_box -============================= - -.. currentmodule:: colour.utilities - -.. autofunction:: message_box \ No newline at end of file diff --git a/docs/generated/colour.utilities.metric_mse.rst b/docs/generated/colour.utilities.metric_mse.rst deleted file mode 100644 index 1db9a08272..0000000000 --- a/docs/generated/colour.utilities.metric_mse.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.metric\_mse -============================ - -.. currentmodule:: colour.utilities - -.. autofunction:: metric_mse \ No newline at end of file diff --git a/docs/generated/colour.utilities.metric_psnr.rst b/docs/generated/colour.utilities.metric_psnr.rst deleted file mode 100644 index f8bd7b6cf8..0000000000 --- a/docs/generated/colour.utilities.metric_psnr.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.metric\_psnr -============================= - -.. currentmodule:: colour.utilities - -.. autofunction:: metric_psnr \ No newline at end of file diff --git a/docs/generated/colour.utilities.multiprocessing_pool.rst b/docs/generated/colour.utilities.multiprocessing_pool.rst deleted file mode 100644 index 642ebb865e..0000000000 --- a/docs/generated/colour.utilities.multiprocessing_pool.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.multiprocessing\_pool -====================================== - -.. currentmodule:: colour.utilities - -.. autofunction:: multiprocessing_pool \ No newline at end of file diff --git a/docs/generated/colour.utilities.ndarray_write.rst b/docs/generated/colour.utilities.ndarray_write.rst deleted file mode 100644 index d40a0d7c11..0000000000 --- a/docs/generated/colour.utilities.ndarray_write.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.ndarray\_write -=============================== - -.. currentmodule:: colour.utilities - -.. autofunction:: ndarray_write \ No newline at end of file diff --git a/docs/generated/colour.utilities.normalise_maximum.rst b/docs/generated/colour.utilities.normalise_maximum.rst deleted file mode 100644 index 39c46152e3..0000000000 --- a/docs/generated/colour.utilities.normalise_maximum.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.normalise\_maximum -=================================== - -.. currentmodule:: colour.utilities - -.. autofunction:: normalise_maximum \ No newline at end of file diff --git a/docs/generated/colour.utilities.numpy_print_options.rst b/docs/generated/colour.utilities.numpy_print_options.rst deleted file mode 100644 index 2d916485a1..0000000000 --- a/docs/generated/colour.utilities.numpy_print_options.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.numpy\_print\_options -====================================== - -.. currentmodule:: colour.utilities - -.. autofunction:: numpy_print_options \ No newline at end of file diff --git a/docs/generated/colour.utilities.orient.rst b/docs/generated/colour.utilities.orient.rst deleted file mode 100644 index 84be9b1e9a..0000000000 --- a/docs/generated/colour.utilities.orient.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.orient -======================= - -.. currentmodule:: colour.utilities - -.. autofunction:: orient \ No newline at end of file diff --git a/docs/generated/colour.utilities.print_numpy_errors.rst b/docs/generated/colour.utilities.print_numpy_errors.rst deleted file mode 100644 index cbc886db79..0000000000 --- a/docs/generated/colour.utilities.print_numpy_errors.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.print\_numpy\_errors -===================================== - -.. currentmodule:: colour.utilities - -.. autofunction:: print_numpy_errors \ No newline at end of file diff --git a/docs/generated/colour.utilities.raise_numpy_errors.rst b/docs/generated/colour.utilities.raise_numpy_errors.rst deleted file mode 100644 index ecfbe8bbc2..0000000000 --- a/docs/generated/colour.utilities.raise_numpy_errors.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.raise\_numpy\_errors -===================================== - -.. currentmodule:: colour.utilities - -.. autofunction:: raise_numpy_errors \ No newline at end of file diff --git a/docs/generated/colour.utilities.row_as_diagonal.rst b/docs/generated/colour.utilities.row_as_diagonal.rst deleted file mode 100644 index a505857aed..0000000000 --- a/docs/generated/colour.utilities.row_as_diagonal.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.row\_as\_diagonal -================================== - -.. currentmodule:: colour.utilities - -.. autofunction:: row_as_diagonal \ No newline at end of file diff --git a/docs/generated/colour.utilities.suppress_warnings.rst b/docs/generated/colour.utilities.suppress_warnings.rst deleted file mode 100644 index 79ab4bf389..0000000000 --- a/docs/generated/colour.utilities.suppress_warnings.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.suppress\_warnings -=================================== - -.. currentmodule:: colour.utilities - -.. autofunction:: suppress_warnings \ No newline at end of file diff --git a/docs/generated/colour.utilities.to_domain_1.rst b/docs/generated/colour.utilities.to_domain_1.rst deleted file mode 100644 index 8f250df77c..0000000000 --- a/docs/generated/colour.utilities.to_domain_1.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.to\_domain\_1 -============================== - -.. currentmodule:: colour.utilities - -.. autofunction:: to_domain_1 \ No newline at end of file diff --git a/docs/generated/colour.utilities.to_domain_10.rst b/docs/generated/colour.utilities.to_domain_10.rst deleted file mode 100644 index 6918639e3f..0000000000 --- a/docs/generated/colour.utilities.to_domain_10.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.to\_domain\_10 -=============================== - -.. currentmodule:: colour.utilities - -.. autofunction:: to_domain_10 \ No newline at end of file diff --git a/docs/generated/colour.utilities.to_domain_100.rst b/docs/generated/colour.utilities.to_domain_100.rst deleted file mode 100644 index 8d898650dd..0000000000 --- a/docs/generated/colour.utilities.to_domain_100.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.to\_domain\_100 -================================ - -.. currentmodule:: colour.utilities - -.. autofunction:: to_domain_100 \ No newline at end of file diff --git a/docs/generated/colour.utilities.to_domain_degrees.rst b/docs/generated/colour.utilities.to_domain_degrees.rst deleted file mode 100644 index 7ffef3791c..0000000000 --- a/docs/generated/colour.utilities.to_domain_degrees.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.to\_domain\_degrees -==================================== - -.. currentmodule:: colour.utilities - -.. autofunction:: to_domain_degrees \ No newline at end of file diff --git a/docs/generated/colour.utilities.to_domain_int.rst b/docs/generated/colour.utilities.to_domain_int.rst deleted file mode 100644 index baaae24a6e..0000000000 --- a/docs/generated/colour.utilities.to_domain_int.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.to\_domain\_int -================================ - -.. currentmodule:: colour.utilities - -.. autofunction:: to_domain_int \ No newline at end of file diff --git a/docs/generated/colour.utilities.tsplit.rst b/docs/generated/colour.utilities.tsplit.rst deleted file mode 100644 index 90659d734f..0000000000 --- a/docs/generated/colour.utilities.tsplit.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.tsplit -======================= - -.. currentmodule:: colour.utilities - -.. autofunction:: tsplit \ No newline at end of file diff --git a/docs/generated/colour.utilities.tstack.rst b/docs/generated/colour.utilities.tstack.rst deleted file mode 100644 index 6bc7ed19ff..0000000000 --- a/docs/generated/colour.utilities.tstack.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.tstack -======================= - -.. currentmodule:: colour.utilities - -.. autofunction:: tstack \ No newline at end of file diff --git a/docs/generated/colour.utilities.warn_numpy_errors.rst b/docs/generated/colour.utilities.warn_numpy_errors.rst deleted file mode 100644 index bacb722443..0000000000 --- a/docs/generated/colour.utilities.warn_numpy_errors.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.warn\_numpy\_errors -==================================== - -.. currentmodule:: colour.utilities - -.. autofunction:: warn_numpy_errors \ No newline at end of file diff --git a/docs/generated/colour.utilities.warning.rst b/docs/generated/colour.utilities.warning.rst deleted file mode 100644 index e633cbac6f..0000000000 --- a/docs/generated/colour.utilities.warning.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.utilities.warning -======================== - -.. currentmodule:: colour.utilities - -.. autofunction:: warning \ No newline at end of file diff --git a/docs/generated/colour.uv_to_CCT.rst b/docs/generated/colour.uv_to_CCT.rst deleted file mode 100644 index 29382fb019..0000000000 --- a/docs/generated/colour.uv_to_CCT.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.uv\_to\_CCT -================== - -.. currentmodule:: colour - -.. autofunction:: uv_to_CCT \ No newline at end of file diff --git a/docs/generated/colour.uv_to_Luv.rst b/docs/generated/colour.uv_to_Luv.rst deleted file mode 100644 index 25febef311..0000000000 --- a/docs/generated/colour.uv_to_Luv.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.uv\_to\_Luv -================== - -.. currentmodule:: colour - -.. autofunction:: uv_to_Luv \ No newline at end of file diff --git a/docs/generated/colour.uv_to_UCS.rst b/docs/generated/colour.uv_to_UCS.rst deleted file mode 100644 index cf83a2762c..0000000000 --- a/docs/generated/colour.uv_to_UCS.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.uv\_to\_UCS -================== - -.. currentmodule:: colour - -.. autofunction:: uv_to_UCS \ No newline at end of file diff --git a/docs/generated/colour.volume.XYZ_outer_surface.rst b/docs/generated/colour.volume.XYZ_outer_surface.rst deleted file mode 100644 index eb6c757a53..0000000000 --- a/docs/generated/colour.volume.XYZ_outer_surface.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.volume.XYZ\_outer\_surface -================================= - -.. currentmodule:: colour.volume - -.. autofunction:: XYZ_outer_surface \ No newline at end of file diff --git a/docs/generated/colour.volume.generate_pulse_waves.rst b/docs/generated/colour.volume.generate_pulse_waves.rst deleted file mode 100644 index 5cb6cbc07b..0000000000 --- a/docs/generated/colour.volume.generate_pulse_waves.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.volume.generate\_pulse\_waves -==================================== - -.. currentmodule:: colour.volume - -.. autofunction:: generate_pulse_waves \ No newline at end of file diff --git a/docs/generated/colour.wavelength_to_XYZ.rst b/docs/generated/colour.wavelength_to_XYZ.rst deleted file mode 100644 index bb5ad947e5..0000000000 --- a/docs/generated/colour.wavelength_to_XYZ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.wavelength\_to\_XYZ -========================== - -.. currentmodule:: colour - -.. autofunction:: wavelength_to_XYZ \ No newline at end of file diff --git a/docs/generated/colour.whiteness.rst b/docs/generated/colour.whiteness.rst deleted file mode 100644 index 5112c62d47..0000000000 --- a/docs/generated/colour.whiteness.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.whiteness -================ - -.. currentmodule:: colour - -.. autofunction:: whiteness \ No newline at end of file diff --git a/docs/generated/colour.write_LUT.rst b/docs/generated/colour.write_LUT.rst deleted file mode 100644 index b84216b48f..0000000000 --- a/docs/generated/colour.write_LUT.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.write\_LUT -================= - -.. currentmodule:: colour - -.. autofunction:: write_LUT \ No newline at end of file diff --git a/docs/generated/colour.write_image.rst b/docs/generated/colour.write_image.rst deleted file mode 100644 index 159088104a..0000000000 --- a/docs/generated/colour.write_image.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.write\_image -=================== - -.. currentmodule:: colour - -.. autofunction:: write_image \ No newline at end of file diff --git a/docs/generated/colour.write_sds_to_csv_file.rst b/docs/generated/colour.write_sds_to_csv_file.rst deleted file mode 100644 index 1a20460a3b..0000000000 --- a/docs/generated/colour.write_sds_to_csv_file.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.write\_sds\_to\_csv\_file -================================ - -.. currentmodule:: colour - -.. autofunction:: write_sds_to_csv_file \ No newline at end of file diff --git a/docs/generated/colour.xyY_to_XYZ.rst b/docs/generated/colour.xyY_to_XYZ.rst deleted file mode 100644 index d4fd039fb7..0000000000 --- a/docs/generated/colour.xyY_to_XYZ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.xyY\_to\_XYZ -=================== - -.. currentmodule:: colour - -.. autofunction:: xyY_to_XYZ \ No newline at end of file diff --git a/docs/generated/colour.xyY_to_munsell_colour.rst b/docs/generated/colour.xyY_to_munsell_colour.rst deleted file mode 100644 index 169f425ccb..0000000000 --- a/docs/generated/colour.xyY_to_munsell_colour.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.xyY\_to\_munsell\_colour -=============================== - -.. currentmodule:: colour - -.. autofunction:: xyY_to_munsell_colour \ No newline at end of file diff --git a/docs/generated/colour.xyY_to_xy.rst b/docs/generated/colour.xyY_to_xy.rst deleted file mode 100644 index 05f65ea800..0000000000 --- a/docs/generated/colour.xyY_to_xy.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.xyY\_to\_xy -================== - -.. currentmodule:: colour - -.. autofunction:: xyY_to_xy \ No newline at end of file diff --git a/docs/generated/colour.xy_to_CCT.rst b/docs/generated/colour.xy_to_CCT.rst deleted file mode 100644 index 239688ebfa..0000000000 --- a/docs/generated/colour.xy_to_CCT.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.xy\_to\_CCT -================== - -.. currentmodule:: colour - -.. autofunction:: xy_to_CCT \ No newline at end of file diff --git a/docs/generated/colour.xy_to_Luv_uv.rst b/docs/generated/colour.xy_to_Luv_uv.rst deleted file mode 100644 index 51eaf0208e..0000000000 --- a/docs/generated/colour.xy_to_Luv_uv.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.xy\_to\_Luv\_uv -====================== - -.. currentmodule:: colour - -.. autofunction:: xy_to_Luv_uv \ No newline at end of file diff --git a/docs/generated/colour.xy_to_UCS_uv.rst b/docs/generated/colour.xy_to_UCS_uv.rst deleted file mode 100644 index c2e134e781..0000000000 --- a/docs/generated/colour.xy_to_UCS_uv.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.xy\_to\_UCS\_uv -====================== - -.. currentmodule:: colour - -.. autofunction:: xy_to_UCS_uv \ No newline at end of file diff --git a/docs/generated/colour.xy_to_XYZ.rst b/docs/generated/colour.xy_to_XYZ.rst deleted file mode 100644 index f09ba7533b..0000000000 --- a/docs/generated/colour.xy_to_XYZ.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.xy\_to\_XYZ -================== - -.. currentmodule:: colour - -.. autofunction:: xy_to_XYZ \ No newline at end of file diff --git a/docs/generated/colour.xy_to_xyY.rst b/docs/generated/colour.xy_to_xyY.rst deleted file mode 100644 index 019b4071da..0000000000 --- a/docs/generated/colour.xy_to_xyY.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.xy\_to\_xyY -================== - -.. currentmodule:: colour - -.. autofunction:: xy_to_xyY \ No newline at end of file diff --git a/docs/generated/colour.yellowness.rst b/docs/generated/colour.yellowness.rst deleted file mode 100644 index 4ac48b7555..0000000000 --- a/docs/generated/colour.yellowness.rst +++ /dev/null @@ -1,6 +0,0 @@ -colour.yellowness -================= - -.. currentmodule:: colour - -.. autofunction:: yellowness \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index 98f898a9ae..21f6969add 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,14 +1,14 @@ -Colour Science for Python -========================= +.. image:: https://raw.githubusercontent.com/colour-science/colour-branding/master/images/Colour_Logo_Medium_001.png -`Colour `_ is a -`Python `_ colour science package implementing a -comprehensive number of colour theory transformations and algorithms. +`Colour `__ is an open-source +`Python `__ package providing a comprehensive number of +algorithms and datasets for colour science. -It is open source and freely available under the -`New BSD License `_ terms. +It is freely available under the +`New BSD License `__ terms. -.. image:: https://raw.githubusercontent.com/colour-science/colour-branding/master/images/Colour_Logo_Medium_Tight_001.png +**Colour** is an affiliated project of `NumFOCUS `__, a +501(c)(3) nonprofit in the United States. .. contents:: **Table of Contents** :backlinks: none @@ -20,60 +20,73 @@ Draft Release Notes ------------------- The draft release notes from the -`develop `_ +`develop `__ branch are available at this -`url `_. +`url `__. Features -------- **Colour** features a rich dataset and collection of objects, please see the -`features `_ page for more +`features `__ page for more information. -Online ------- - -**Colour** can be used online with -`Google Colab `__. - Installation ------------ -`Anaconda `_ from *Continuum Analytics* -is the Python distribution we use to develop **Colour**: it ships all the -scientific dependencies we require and is easily deployed cross-platform: +**Colour** can be easily installed from the +`Python Package Index `__ +by issuing this command in a shell: .. code-block:: bash - $ conda create -y -n python-colour - $ source activate python-colour - $ conda install -y -c conda-forge colour-science + $ pip install colour-science -**Colour** can be easily installed from the -`Python Package Index `_ -by issuing this command in a shell: +**Colour** is also available for `Anaconda `__ +from *Continuum Analytics* via `conda-forge `__: .. code-block:: bash - $ pip install colour-science + $ conda install -c conda-forge colour-science The detailed installation procedure is described in the -`Installation Guide `_. +`Installation Guide `__. -Usage ------ +Documentation +------------- + +Tutorial +~~~~~~~~ + +The `static tutorial `__ +provides an introduction to **Colour**. An interactive version is available via +`Google Colab `__. + +How-To Guide +~~~~~~~~~~~~ + +The `How-To `__ +guide for **Colour** shows various techniques to solve specific problems and +highlights some interesting use cases. + +API Reference +~~~~~~~~~~~~~ -The two main references for **Colour** -usage are the `Colour Manual `_ -and the `Jupyter Notebooks `_ -with detailed historical and theoretical context and images. +The main technical reference for **Colour** and its API is the +`Colour Manual `__. .. toctree:: :maxdepth: 4 manual +Jupyter Notebooks +~~~~~~~~~~~~~~~~~ + +`Jupyter Notebooks `__ +are available and designed to provide an historical perspective of colour +science via **Colour** usage. + Examples ~~~~~~~~ @@ -83,6 +96,36 @@ Most of the objects are available from the ``colour`` namespace: >>> import colour +Automatic Colour Conversion Graph - ``colour.graph`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Starting with version *0.3.14*, **Colour** implements an automatic colour +conversion graph enabling easier colour conversions. + +.. image:: _static/Examples_Colour_Automatic_Conversion_Graph.png + +.. code-block:: python + + >>> sd = colour.COLOURCHECKERS_SDS['ColorChecker N Ohta']['dark skin'] + >>> convert(sd, 'Spectral Distribution', 'sRGB', verbose={'mode': 'Short'}) + +:: + + =============================================================================== + * * + * [ Conversion Path ] * + * * + * "sd_to_XYZ" --> "XYZ_to_sRGB" * + * * + =============================================================================== + array([ 0.45675795, 0.30986982, 0.24861924]) + +.. code-block:: python + + >>> illuminant = colour.ILLUMINANTS_SDS['FL2'] + >>> convert(sd, 'Spectral Distribution', 'sRGB', sd_to_XYZ={'illuminant': illuminant}) + array([ 0.47924575, 0.31676968, 0.17362725]) + Chromatic Adaptation - ``colour.adaptation`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -125,7 +168,7 @@ Colour Appearance Models - ``colour.appearance`` .. code-block:: python - >>> XYZ = [0.20654008 * 100, 0.12197225 * 100, 0.05136952* 100] + >>> XYZ = [0.20654008 * 100, 0.12197225 * 100, 0.05136952 * 100] >>> XYZ_w = [95.05, 100.00, 108.88] >>> L_A = 318.31 >>> Y_b = 20.0 @@ -173,7 +216,7 @@ Spectral Computations >>> colour.sd_to_XYZ(colour.LIGHT_SOURCES_SDS['Neodimium Incandescent']) array([ 36.94726204, 32.62076174, 13.0143849 ]) >>> sorted(colour.SPECTRAL_TO_XYZ_METHODS.keys()) - ['ASTM E308-15', 'Integration', 'astm2015'] + ['ASTM E308', 'Integration', 'astm2015'] Multi-Spectral Computations @@ -181,7 +224,7 @@ Multi-Spectral Computations .. code-block:: python - >>> msd = np.array([ + >>> msds = np.array([ ... [[0.01367208, 0.09127947, 0.01524376, 0.02810712, 0.19176012, 0.04299992], ... [0.00959792, 0.25822842, 0.41388571, 0.22275120, 0.00407416, 0.37439537], ... [0.01791409, 0.29707789, 0.56295109, 0.23752193, 0.00236515, 0.58190280]], @@ -195,8 +238,8 @@ Multi-Spectral Computations ... [0.06321812, 0.41898224, 0.15190357, 0.24591440, 0.55301750, 0.00657664], ... [0.00305180, 0.11288624, 0.11357290, 0.12924391, 0.00195315, 0.21771573]], ... ]) - >>> colour.multi_sds_to_XYZ(msd, colour.SpectralShape(400, 700, 60), - ... cmfs, illuminant)) + >>> colour.multi_sds_to_XYZ(msds, cmfs, illuminant, method='Integration', + ... shape=colour.SpectralShape(400, 700, 60))) [[[ 9.73192501 5.02105851 3.22790699] [ 16.08032168 24.47303359 10.28681006] [ 17.73513774 29.61865582 12.10713449]] @@ -210,7 +253,7 @@ Multi-Spectral Computations [ 38.64801062 26.70860262 15.08396538] [ 8.77151115 10.56330761 4.28940206]]] >>> sorted(colour.MULTI_SPECTRAL_TO_XYZ_METHODS.keys()) - ['Integration'] + ['ASTM E308', 'Integration', 'astm2015'] Blackbody Spectral Radiance Computation *************************************** @@ -265,7 +308,7 @@ Luminance Computation >>> colour.luminance(41.52787585) 12.197225353400775 >>> sorted(colour.LUMINANCE_METHODS.keys()) - ['ASTM D1535-08', + ['ASTM D1535', 'CIE 1976', 'Fairchild 2010', 'Fairchild 2011', @@ -372,6 +415,9 @@ Look Up Table (LUT) Data >>> LUT = colour.read_LUT('ACES_Proxy_10_to_ACES.cube') >>> print(LUT) + +:: + LUT3x1D - ACES Proxy 10 to ACES ------------------------------- Dimensions : 2 @@ -379,6 +425,8 @@ Look Up Table (LUT) Data [1 1 1]] Size : (32, 3) +.. code-block:: python + >>> RGB = [0.17224810, 0.09170660, 0.06416938] >>> LUT.apply(RGB) array([ 0.00575674, 0.00181493, 0.00121419]) @@ -630,13 +678,15 @@ RGB Colourspaces 'ECI RGB v2', 'ERIMM RGB', 'Ekta Space PS 5', + 'F-Gamut', 'FilmLight E-Gamut', 'ITU-R BT.2020', 'ITU-R BT.470 - 525', 'ITU-R BT.470 - 625', 'ITU-R BT.709', 'Max RGB', - 'NTSC', + 'NTSC (1953)', + 'NTSC (1987)', 'P3-D65', 'Pal/Secam', 'ProPhoto RGB', @@ -653,6 +703,7 @@ RGB Colourspaces 'S-Gamut3', 'S-Gamut3.Cine', 'SMPTE 240M', + 'SMPTE C', 'Sharp RGB', 'V-Gamut', 'Xtreme RGB', @@ -668,31 +719,24 @@ OETFs >>> sorted(colour.OETFS.keys()) ['ARIB STD-B67', - 'DICOM GSDF', 'ITU-R BT.2020', 'ITU-R BT.2100 HLG', 'ITU-R BT.2100 PQ', 'ITU-R BT.601', 'ITU-R BT.709', - 'ProPhoto RGB', - 'RIMM RGB', - 'ROMM RGB', - 'SMPTE 240M', - 'ST 2084', - 'sRGB'] + 'SMPTE 240M'] -OETFs Reverse +OETFs Inverse ************* .. code-block:: python - >>> sorted(colour.OETFS_REVERSE.keys()) + >>> sorted(colour.OETF_INVERSES.keys()) ['ARIB STD-B67', 'ITU-R BT.2100 HLD', 'ITU-R BT.2100 PQ', 'ITU-R BT.601', - 'ITU-R BT.709', - 'sRGB'] + 'ITU-R BT.709'] EOTFs ***** @@ -706,19 +750,23 @@ EOTFs 'ITU-R BT.2020', 'ITU-R BT.2100 HLG', 'ITU-R BT.2100 PQ', - 'ProPhoto RGB', - 'RIMM RGB', - 'ROMM RGB', 'SMPTE 240M', - 'ST 2084'] + 'ST 2084', + 'sRGB'] -EOTFs Reverse +EOTFs Inverse ************* .. code-block:: python - >>> sorted(colour.EOTFS_REVERSE.keys()) - ['DCDM', 'ITU-R BT.1886', 'ITU-R BT.2100 HLG', 'ITU-R BT.2100 PQ'] + >>> sorted(colour.EOTF_INVERSES.keys()) + ['DCDM', + 'DICOM GSDF', + 'ITU-R BT.1886', + 'ITU-R BT.2100 HLG', + 'ITU-R BT.2100 PQ', + 'ST 2084', + 'sRGB'] OOTFs ***** @@ -728,20 +776,20 @@ OOTFs >>> sorted(colour.OOTFS.keys()) ['ITU-R BT.2100 HLG', 'ITU-R BT.2100 PQ'] -OOTFs Reverse +OOTFs Inverse ************* .. code-block:: python - >>> sorted(colour.OOTFs_REVERSE.keys()) + >>> sorted(colour.OOTF_INVERSES.keys()) ['ITU-R BT.2100 HLG', 'ITU-R BT.2100 PQ'] -Log Encoding / Decoding Curves -****************************** +Log Encoding / Decoding +*********************** .. code-block:: python - >>> sorted(colour.LOG_ENCODING_CURVES.keys()) + >>> sorted(colour.LOG_ENCODINGS.keys()) ['ACEScc', 'ACEScct', 'ACESproxy', @@ -752,6 +800,7 @@ Log Encoding / Decoding Curves 'Cineon', 'D-Log', 'ERIMM RGB', + 'F-Log', 'Filmic Pro 6', 'Log3G10', 'Log3G12', @@ -767,6 +816,56 @@ Log Encoding / Decoding Curves 'V-Log', 'ViperLog'] +CCTFs Encoding / Decoding +************************* + +.. code-block:: python + + >>> sorted(colour.CCTF_ENCODINGS.keys()) + ['ACEScc', + 'ACEScct', + 'ACESproxy', + 'ALEXA Log C', + 'ARIB STD-B67', + 'Canon Log', + 'Canon Log 2', + 'Canon Log 3', + 'Cineon', + 'D-Log', + 'DCDM', + 'DICOM GSDF', + 'ERIMM RGB', + 'F-Log', + 'Filmic Pro 6', + 'Gamma 2.2', + 'Gamma 2.4', + 'Gamma 2.6', + 'ITU-R BT.1886', + 'ITU-R BT.2020', + 'ITU-R BT.2100 HLG', + 'ITU-R BT.2100 PQ', + 'ITU-R BT.601', + 'ITU-R BT.709', + 'Log3G10', + 'Log3G12', + 'PLog', + 'Panalog', + 'ProPhoto RGB', + 'Protune', + 'REDLog', + 'REDLogFilm', + 'RIMM RGB', + 'ROMM RGB', + 'S-Log', + 'S-Log2', + 'S-Log3', + 'SMPTE 240M', + 'ST 2084', + 'T-Log', + 'V-Log', + 'ViperLog', + 'sRGB'] + Colour Notation Systems - ``colour.notation`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -778,7 +877,7 @@ Munsell Value >>> colour.munsell_value(12.23634268) 4.0824437076525664 >>> sorted(colour.MUNSELL_VALUE_METHODS.keys()) - ['ASTM D1535-08', + ['ASTM D1535', 'Ladd 1955', 'McCamy 1987', 'Moon 1943', @@ -865,17 +964,9 @@ Correlated Colour Temperature Computation Methods - ``colour.temperature`` >>> colour.uv_to_CCT([0.1978, 0.3122]) array([ 6.50751282e+03, 3.22335875e-03]) >>> sorted(colour.UV_TO_CCT_METHODS.keys()) - ['Ohno 2013', 'Robertson 1968', 'ohno2013', 'robertson1968'] - >>> sorted(colour.UV_TO_CCT_METHODS.keys()) - ['Krystek 1985', - 'Ohno 2013', - 'Robertson 1968', - 'ohno2013', - 'robertson1968'] - >>> sorted(colour.XY_TO_CCT_METHODS.keys()) - ['Hernandez 1999', 'McCamy 1992', 'hernandez1999', 'mccamy1992'] - >>> sorted(colour.CCT_TO_XY_METHODS.keys()) - ['CIE Illuminant D Series', 'Kang 2002', 'cie_d', 'kang2002'] + ['Krystek 1985', 'Ohno 2013', 'Robertson 1968', 'ohno2013', 'robertson1968'] + >>> sorted(colour.XY_TO_CCT_METHODS.keys()) + ['CIE Illuminant D Series', 'Hernandez 1999', 'Kang 2002', 'McCamy 1992', 'daylight', 'hernandez1999', 'kang2002', 'mccamy1992'] Colour Volume - ``colour.volume`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1032,20 +1123,20 @@ Contributing ------------ If you would like to contribute to **Colour**, please refer to the following -`Contributing `_ guide. +`Contributing `__ guide. Changes ------- -The changes are viewable on the `Releases `_ page. +The changes are viewable on the `Releases `__ page. Bibliography ------------ -The bibliography is available on the `Bibliography `_ page. +The bibliography is available on the `Bibliography `__ page. It is also viewable directly from the repository in -`BibTeX `_ +`BibTeX `__ format. See Also @@ -1055,29 +1146,39 @@ Here is a list of notable colour science packages sorted by languages: **Python** -- `Colorio `_ by Schlömer, N. -- `ColorPy `_ by Kness, M. -- `Colorspacious `_ by Smith, N. J., et al. -- `python-colormath `_ by Taylor, G., et al. +- `Colorio `__ by Schlömer, N. +- `ColorPy `__ by Kness, M. +- `Colorspacious `__ by Smith, N. J., et al. +- `python-colormath `__ by Taylor, G., et al. + +**Go** + +- `go-colorful `__ by Beyer, L., et al. **.NET** -- `Colourful `_ by Pažourek, T., et al. +- `Colourful `__ by Pažourek, T., et al. **Julia** -- `Colors.jl `_ by Holy, T., et al. +- `Colors.jl `__ by Holy, T., et al. **Matlab & Octave** -- `COLORLAB `_ by Malo, J., et al. -- `Psychtoolbox `_ by Brainard, D., et al. -- `The Munsell and Kubelka-Munk Toolbox `_ by Centore, P. +- `COLORLAB `__ by Malo, J., et al. +- `Psychtoolbox `__ by Brainard, D., et al. +- `The Munsell and Kubelka-Munk Toolbox `__ by Centore, P. + +Code of Conduct +--------------- + +The *Code of Conduct*, adapted from the `Contributor Covenant 1.4 `__, +is available on the `Code of Conduct `__ page. About ----- | **Colour** by Colour Developers - 2013-2019 -| Copyright © 2013-2019 – Colour Developers – `colour-science@googlegroups.com `_ +| Copyright © 2013-2019 – Colour Developers – `colour-science@googlegroups.com `__ | This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause -| `https://github.com/colour-science/colour `_ +| `https://github.com/colour-science/colour `__ diff --git a/docs/manual.rst b/docs/manual.rst index a3e412aac4..b1ef00123c 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -6,5 +6,6 @@ Colour Manual tutorial basics + advanced reference bibliography \ No newline at end of file diff --git a/docs/tutorial.rst b/docs/tutorial.rst index 06c27c7f1f..ab71c05b0e 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -12,7 +12,6 @@ API but is a good introduction to the main concepts. installation: *colour/examples*. It can also be explored directly on `Github `__. - .. code:: python from colour.plotting import * @@ -21,40 +20,46 @@ API but is a good introduction to the main concepts. plot_visible_spectrum() - .. image:: _static/Tutorial_Visible_Spectrum.png - Overview -------- **Colour** is organised around various sub-packages: -- :doc:`adaptation `: Chromatic adaptation models and transformations. -- :doc:`algebra `: Algebra utilities. -- :doc:`appearance `: Colour appearance models. -- :doc:`biochemistry `: Biochemistry computations. -- :doc:`blindness `: Colour vision deficiency models. -- :doc:`continuous `: Base objects for continuous data representation. -- :doc:`contrast `: Objects for contrast sensitivity computation. -- :doc:`characterisation `: Colour fitting and camera characterisation. -- :doc:`colorimetry `: Core objects for colour computations. -- :doc:`constants `: *CIE* and *CODATA* constants. -- :doc:`corresponding `: Corresponding colour chromaticities computations. -- :doc:`difference `: Colour difference computations. +- :doc:`adaptation `: Chromatic adaptation models and + transformations. +- :doc:`algebra `: Algebra utilities. +- :doc:`appearance `: Colour appearance models. +- :doc:`biochemistry `: Biochemistry computations. +- :doc:`blindness `: Colour vision deficiency models. +- :doc:`continuous `: Base objects for continuous data + representation. +- :doc:`contrast `: Objects for contrast sensitivity + computation. +- :doc:`characterisation `: Colour fitting and + camera characterisation. +- :doc:`colorimetry `: Core objects for colour + computations. +- :doc:`constants `: *CIE* and *CODATA* constants. +- :doc:`corresponding `: Corresponding colour + chromaticities computations. +- :doc:`difference `: Colour difference computations. - *examples*: Examples for the sub-packages. -- :doc:`io `: Input / output objects for reading and writing data. -- :doc:`models `: Colour models. -- :doc:`notation `: Colour notation systems. -- :doc:`phenomena `: Computation of various optical phenomena. -- :doc:`plotting `: Diagrams, figures, etc… -- :doc:`quality `: Colour quality computation. -- :doc:`recovery `: Reflectance recovery. -- :doc:`temperature `: Colour temperature and correlated colour temperature - computation. -- :doc:`utilities `: Various utilities and data structures. -- :doc:`volume `: Colourspace volumes computation and optimal colour - stimuli. +- :doc:`graph `: Graph for automatic colour conversions. +- :doc:`io `: Input / output objects for reading and writing data. +- :doc:`models `: Colour models. +- :doc:`notation `: Colour notation systems. +- :doc:`phenomena `: Computation of various optical + phenomena. +- :doc:`plotting `: Diagrams, figures, etc… +- :doc:`quality `: Colour quality computation. +- :doc:`recovery `: Reflectance recovery. +- :doc:`temperature `: Colour temperature and correlated + colour temperature computation. +- :doc:`utilities `: Various utilities and data structures. +- :doc:`volume `: Colourspace volumes computation and optimal + colour stimuli. Most of the public API is available from the root ``colour`` namespace: @@ -64,12 +69,10 @@ Most of the public API is available from the root ``colour`` namespace: print(colour.__all__[:5] + ['...']) - .. code-block:: text ['domain_range_scale', 'get_domain_range_scale', 'set_domain_range_scale', 'CHROMATIC_ADAPTATION_METHODS', 'CHROMATIC_ADAPTATION_TRANSFORMS', '...'] - The various sub-packages also expose their public API: .. code:: python @@ -81,14 +84,13 @@ The various sub-packages also expose their public API: for sub_package in ('adaptation', 'algebra', 'appearance', 'biochemistry', 'blindness', 'characterisation', 'colorimetry', 'constants', 'continuous', 'contrast', 'corresponding', - 'difference', 'io', 'models', 'notation', 'phenomena', - 'plotting', 'quality', 'recovery', 'temperature', - 'utilities', 'volume'): + 'difference', 'graph', 'io', 'models', 'notation', + 'phenomena', 'plotting', 'quality', 'recovery', + 'temperature', 'utilities', 'volume'): print(sub_package.title()) pprint(getattr(colour, sub_package).__all__[:5] + ['...']) print('\n') - .. code-block:: text Adaptation @@ -145,17 +147,22 @@ The various sub-packages also expose their public API: ['SpectralShape', 'DEFAULT_SPECTRAL_SHAPE', 'SpectralDistribution', - 'MultiSpectralDistribution', - 'sd_blackbody', + 'MultiSpectralDistributions', + 'sds_and_multi_sds_to_sds', '...'] Constants - ['K_M', 'KP_M', 'AVOGADRO_CONSTANT', 'BOLTZMANN_CONSTANT', 'LIGHT_SPEED', '...'] + ['K_M', + 'KP_M', + 'AVOGADRO_CONSTANT', + 'BOLTZMANN_CONSTANT', + 'LIGHT_SPEED', + '...'] Continuous - ['AbstractContinuousFunction', 'Signal', 'MultiSignal', '...'] + ['AbstractContinuousFunction', 'Signal', 'MultiSignals', '...'] Contrast @@ -170,9 +177,9 @@ The various sub-packages also expose their public API: Corresponding ['BRENEMAN_EXPERIMENTS', 'BRENEMAN_EXPERIMENTS_PRIMARIES_CHROMATICITIES', + 'CorrespondingColourDataset', + 'CorrespondingChromaticitiesPrediction', 'corresponding_chromaticities_prediction_CIE1994', - 'corresponding_chromaticities_prediction_CMCCAT2000', - 'corresponding_chromaticities_prediction_Fairchild1990', '...'] @@ -185,6 +192,14 @@ The various sub-packages also expose their public API: '...'] + Graph + ['CONVERSION_GRAPH', + 'CONVERSION_GRAPH_NODE_LABELS', + 'describe_conversion_path', + 'convert', + '...'] + + Io ['SpectralDistribution_IESTM2714', 'AbstractLUTSequenceOperator', @@ -221,9 +236,9 @@ The various sub-packages also expose their public API: Plotting - ['ASTM_G_173_ETR', - 'ASTM_G_173_GLOBAL_TILT', - 'ASTM_G_173_DIRECT_CIRCUMSOLAR', + ['ASTMG173_ETR', + 'ASTMG173_GLOBAL_TILT', + 'ASTMG173_DIRECT_CIRCUMSOLAR', 'COLOUR_STYLE_CONSTANTS', 'COLOUR_ARROW_STYLE', '...'] @@ -248,11 +263,11 @@ The various sub-packages also expose their public API: Temperature - ['CCT_TO_UV_METHODS', - 'UV_TO_CCT_METHODS', - 'CCT_to_uv', - 'CCT_to_uv_Ohno2013', - 'CCT_to_uv_Robertson1968', + ['xy_to_CCT_CIE_D', + 'CCT_to_xy_CIE_D', + 'xy_to_CCT_Hernandez1999', + 'CCT_to_xy_Hernandez1999', + 'xy_to_CCT_Kang2002', '...'] @@ -273,14 +288,12 @@ The various sub-packages also expose their public API: 'generate_pulse_waves', '...'] - The codebase is documented and most docstrings have usage examples: .. code:: python print(colour.temperature.CCT_to_uv_Ohno2013.__doc__) - .. code-block:: text Returns the *CIE UCS* colourspace *uv* chromaticity coordinates from given @@ -289,10 +302,8 @@ The codebase is documented and most docstrings have usage examples: Parameters ---------- - CCT : numeric - Correlated colour temperature :math:`T_{cp}`. - D_uv : numeric, optional - :math:`\Delta_{uv}`. + CCT_D_uv : ndarray + Correlated colour temperature :math:`T_{cp}`, :math:`\Delta_{uv}`. cmfs : XYZ_ColourMatchingFunctions, optional Standard observer colour matching functions. @@ -307,14 +318,15 @@ The codebase is documented and most docstrings have usage examples: Examples -------- - >>> from colour import STANDARD_OBSERVERS_CMFS - >>> cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] - >>> CCT = 6507.4342201047066 - >>> D_uv = 0.003223690901513 - >>> CCT_to_uv_Ohno2013(CCT, D_uv, cmfs) # doctest: +ELLIPSIS + >>> from colour import DEFAULT_SPECTRAL_SHAPE, STANDARD_OBSERVERS_CMFS + >>> cmfs = ( + ... STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer']. + ... copy().align(DEFAULT_SPECTRAL_SHAPE) + ... ) + >>> CCT_D_uv = np.array([6507.4342201047066, 0.003223690901513]) + >>> CCT_to_uv_Ohno2013(CCT_D_uv, cmfs) # doctest: +ELLIPSIS array([ 0.1977999..., 0.3122004...]) - At the core of **Colour** is the ``colour.colorimetry`` sub-package, it defines the objects needed for spectral computations and many others: @@ -324,13 +336,13 @@ the objects needed for spectral computations and many others: pprint(colorimetry.__all__) - .. code-block:: text ['SpectralShape', 'DEFAULT_SPECTRAL_SHAPE', 'SpectralDistribution', - 'MultiSpectralDistribution', + 'MultiSpectralDistributions', + 'sds_and_multi_sds_to_sds', 'sd_blackbody', 'blackbody_spectral_radiance', 'planck_law', @@ -367,14 +379,15 @@ the objects needed for spectral computations and many others: 'MULTI_SD_TO_XYZ_METHODS', 'sd_to_XYZ', 'multi_sds_to_XYZ', - 'ASTME30815_PRACTISE_SHAPE', - 'lagrange_coefficients_ASTME202211', - 'tristimulus_weighting_factors_ASTME202211', - 'adjust_tristimulus_weighting_factors_ASTME30815', + 'ASTME308_PRACTISE_SHAPE', + 'lagrange_coefficients_ASTME2022', + 'tristimulus_weighting_factors_ASTME2022', + 'adjust_tristimulus_weighting_factors_ASTME308', 'sd_to_XYZ_integration', - 'sd_to_XYZ_tristimulus_weighting_factors_ASTME30815', - 'sd_to_XYZ_ASTME30815', + 'sd_to_XYZ_tristimulus_weighting_factors_ASTME308', + 'sd_to_XYZ_ASTME308', 'multi_sds_to_XYZ_integration', + 'multi_sds_to_XYZ_ASTME308', 'wavelength_to_XYZ', 'BANDPASS_CORRECTION_METHODS', 'bandpass_correction', @@ -395,7 +408,7 @@ the objects needed for spectral computations and many others: 'LUMINANCE_METHODS', 'luminance', 'luminance_Newhall1943', - 'luminance_ASTMD153508', + 'luminance_ASTMD1535', 'luminance_CIE1976', 'luminance_Fairchild2010', 'luminance_Fairchild2011', @@ -425,17 +438,15 @@ the objects needed for spectral computations and many others: 'yellowness_ASTMD1925', 'yellowness_ASTME313'] - -**Colour** computations leverage a comprehensive dataset available in most -sub-packages, for example the ``colour.colorimetry.dataset`` defines the -following components: +**Colour** computations leverage a comprehensive quantity of datasets available +in most sub-packages, for example the ``colour.colorimetry.datasets`` defines +the following components: .. code:: python - import colour.colorimetry.dataset as dataset - - pprint(dataset.__all__) + import colour.colorimetry.datasets as datasets + pprint(datasets.__all__) .. code-block:: text @@ -453,7 +464,6 @@ following components: 'PHOTOPIC_LEFS', 'SCOTOPIC_LEFS'] - From Spectral Distribution -------------------------- @@ -550,7 +560,6 @@ illuminants, spectral data is manipulated using an object built with the sd = colour.SpectralDistribution(sample_sd_data, name='Sample') print(repr(sd)) - .. code-block:: text SpectralDistribution([[ 3.80000000e+02, 4.80000000e-02], @@ -639,7 +648,6 @@ illuminants, spectral data is manipulated using an object built with the extrapolator=Extrapolator, extrapolator_args={u'right': None, u'method': u'Constant', u'left': None}) - The sample spectral distribution can be easily plotted against the visible spectrum: @@ -648,10 +656,8 @@ spectrum: # Plotting the sample spectral distribution. plot_single_sd(sd) - .. image:: _static/Tutorial_Sample_SD.png - With the sample spectral distribution defined, its shape is retrieved as follows: @@ -660,24 +666,20 @@ follows: # Displaying the sample spectral distribution shape. print(sd.shape) - .. code-block:: text (380.0, 780.0, 5.0) - The returned shape is an instance of the ``colour.SpectralShape`` class: .. code:: python repr(sd.shape) - .. code-block:: text 'SpectralShape(380.0, 780.0, 5.0)' - The ``colour.SpectralShape`` class is used throughout **Colour** to define spectral dimensions and is instantiated as follows: @@ -692,7 +694,6 @@ spectral dimensions and is instantiated as follows: shape = colour.SpectralShape(0, 10, 0.5) shape.range() - .. code-block:: text 0.0 @@ -707,14 +708,12 @@ spectral dimensions and is instantiated as follows: 9.0 10.0 - .. code-block:: text array([ 0. , 0.5, 1. , 1.5, 2. , 2.5, 3. , 3.5, 4. , 4.5, 5. , 5.5, 6. , 6.5, 7. , 7.5, 8. , 8.5, 9. , 9.5, 10. ]) - **Colour** defines three convenient objects to create constant spectral distributions: @@ -742,7 +741,6 @@ distributions: print(sd_ones.shape) print(sd_ones[400]) - .. code-block:: text "Constant Spectral Distribution" @@ -757,7 +755,6 @@ distributions: (360.0, 780.0, 1.0) 1.0 - By default the shape used by ``colour.sd_constant``, ``colour.sd_zeros`` and ``colour.sd_ones`` is the one defined by the ``colour.DEFAULT_SPECTRAL_SHAPE`` attribute and based on *ASTM E308-15* @@ -767,12 +764,10 @@ practise shape. print(repr(colour.DEFAULT_SPECTRAL_SHAPE)) - .. code-block:: text SpectralShape(360, 780, 1) - A custom shape can be passed to construct a constant spectral distribution with user defined dimensions: @@ -780,12 +775,10 @@ with user defined dimensions: colour.sd_ones(colour.SpectralShape(400, 700, 5))[450] - .. code-block:: text 1.0 - The ``colour.SpectralDistribution`` class supports the following arithmetical operations: @@ -807,7 +800,6 @@ arithmetical operations: print('\n"+ Spectral Distribution"') print((sd1 + colour.sd_ones())[400]) - .. code-block:: text "Ones Filled Spectral Distribution" @@ -819,7 +811,6 @@ arithmetical operations: "+ Spectral Distribution" 2.0 - Often interpolation of the spectral distribution is required, this is achieved with the ``colour.SpectralDistribution.interpolate`` method. Depending on the wavelengths uniformity, the default interpolation method will differ. @@ -835,12 +826,10 @@ The uniformity of the sample spectral distribution is assessed as follows: # Checking the sample spectral distribution uniformity. print(sd.is_uniform()) - .. code-block:: text True - In this case, since the sample spectral distribution is uniform the interpolation defaults to the ``colour.SpragueInterpolator`` interpolator. @@ -850,7 +839,6 @@ interpolation defaults to the ``colour.SpragueInterpolator`` interpolator. ``colour.SpectralDistribution.copy`` method to generate a copy of the spectral distribution before interpolation. - .. code:: python # Copying the sample spectral distribution. @@ -860,21 +848,17 @@ interpolation defaults to the ``colour.SpragueInterpolator`` interpolator. sd_copy.interpolate(colour.SpectralShape(400, 770, 1)) sd_copy[401] - .. code-block:: text 0.065809599999999996 - .. code:: python # Comparing the interpolated spectral distribution with the original one. plot_multi_sds([sd, sd_copy], bounding_box=[730,780, 0.25, 0.5]) - .. image:: _static/Tutorial_SD_Interpolation.png - Extrapolation although dangerous can be used to help aligning two spectral distributions together. *CIE publication CIE 15:2004 “Colorimetry”* recommends that unmeasured values may be set equal to the nearest measured value of the @@ -886,12 +870,10 @@ appropriate quantity in truncation :cite:`CIETC1-482004h`: sd_copy.extrapolate(colour.SpectralShape(340, 830)) sd_copy[340], sd_copy[830] - .. code-block:: text (0.065000000000000002, 0.44800000000000018) - The underlying interpolator can be swapped for any of the **Colour** interpolators: @@ -902,7 +884,6 @@ interpolators: if 'Interpolator' in export ]) - .. code-block:: text [u'KernelInterpolator', @@ -912,14 +893,12 @@ interpolators: u'PchipInterpolator', u'NullInterpolator'] - .. code:: python # Changing interpolator while trimming the copied spectral distribution. sd_copy.interpolate( colour.SpectralShape(400, 700, 10), interpolator=colour.LinearInterpolator) - .. code-block:: text SpectralDistribution([[ 4.00000000e+02, 6.50000000e-02], @@ -958,7 +937,6 @@ interpolators: extrapolator=Extrapolator, extrapolator_args={u'right': None, u'method': u'Constant', u'left': None}) - The extrapolation behaviour can be changed for ``Linear`` method instead of the ``Constant`` default method or even use arbitrary constant ``left`` and ``right`` values: @@ -972,12 +950,10 @@ and ``right`` values: 'right': 0}) sd_copy[340], sd_copy[830] - .. code-block:: text (0.046999999999999348, 0.0) - Aligning a spectral distribution is a convenient way to first interpolates the current data within its original bounds, then, if required, extrapolate any missing values to match the requested shape: @@ -990,12 +966,10 @@ missing values to match the requested shape: sd_copy.align(colour.SpectralShape(340, 830, 5)) sd_copy[340], sd_copy[830] - .. code-block:: text (0.065000000000000002, 0.28199999999999975) - The ``colour.SpectralDistribution`` class also supports various arithmetic operations like *addition*, *subtraction*, *multiplication*, *division* or *exponentiation* with *numeric* and *array_like* variables or other @@ -1018,7 +992,6 @@ operations like *addition*, *subtraction*, *multiplication*, *division* or print((sd * [0.35, 1.55, 0.75, 2.55, 0.95, 0.65, 0.15]).values) print((sd * colour.sd_constant(2, sd.shape) * colour.sd_constant(3, sd.shape)).values) - .. code-block:: text [ 1.25 1.5 1.75 2. 1.75 1.5 1.25] @@ -1026,7 +999,6 @@ operations like *addition*, *subtraction*, *multiplication*, *division* or [ 0.0875 0.775 0.5625 2.55 0.7125 0.325 0.0375] [ 1.5 3. 4.5 6. 4.5 3. nan 1.5] - The spectral distribution can be normalised with an arbitrary factor: .. code:: python @@ -1034,13 +1006,11 @@ The spectral distribution can be normalised with an arbitrary factor: print(sd.normalise().values) print(sd.normalise(100).values) - .. code-block:: text [ 0.25 0.5 0.75 1. 0.75 0.5 0.25] [ 25. 50. 75. 100. 75. 50. 25.] - A the heart of the ``colour.SpectralDistribution`` class is the ``colour.continuous.Signal`` class which implements the ``colour.continuous.Signal.function`` method. @@ -1066,7 +1036,6 @@ this tutorial but the core capability can be described. signal = colour.continuous.Signal(range_) print(repr(signal)) - .. code-block:: text Signal([[ 0., 10.], @@ -1084,20 +1053,17 @@ this tutorial but the core capability can be described. extrapolator=Extrapolator, extrapolator_args={u'right': nan, u'method': u'Constant', u'left': nan}) - .. code:: python # Returning the corresponding range *y* variable for any arbitrary independent domain *x* variable. signal[np.random.uniform(0, 9, 10)] - .. code-block:: text array([ 55.91309735, 65.4172615 , 65.54495059, 88.17819416, 61.88860248, 10.53878826, 55.25130534, 46.14659783, 86.41406136, 84.59897703]) - Convert to Tristimulus Values ----------------------------- @@ -1114,12 +1080,10 @@ calculated: XYZ = colour.sd_to_XYZ(sd, cmfs, illuminant) print(XYZ) - .. code-block:: text [ 10.97085572 9.70278591 6.05562778] - From *CIE XYZ* Colourspace -------------------------- @@ -1131,7 +1095,6 @@ computations are available, expanding to even more computations: # Displaying objects interacting directly with the *CIE XYZ* colourspace. pprint([name for name in colour.__all__ if name.startswith('XYZ_to')]) - .. code-block:: text ['XYZ_to_ATD95', @@ -1159,7 +1122,6 @@ computations are available, expanding to even more computations: 'XYZ_to_xyY', 'XYZ_to_sd'] - Convert to Display Colours -------------------------- @@ -1174,12 +1136,10 @@ values in order to display them on screen: RGB = colour.XYZ_to_sRGB(XYZ / 100) print(RGB) - .. code-block:: text [ 0.45675795 0.30986982 0.24861924] - .. code:: python # Plotting the *sRGB* colourspace colour of the *Sample* spectral distribution. @@ -1187,10 +1147,8 @@ values in order to display them on screen: ColourSwatch('Sample', RGB), text_parameters={'size': 'x-large'}) - .. image:: _static/Tutorial_Sample_Swatch.png - Generate Colour Rendition Charts -------------------------------- @@ -1202,7 +1160,6 @@ Likewise, colour values from a colour rendition chart sample can be computed. where a synthetic colour chart can be inserted into a render to ensure the colour management is acting as expected. - The ``colour.characterisation`` sub-package contains the dataset for various colour rendition charts: @@ -1214,12 +1171,10 @@ various colour rendition charts: # Colour rendition charts spectral distributions. print(sorted(colour.characterisation.COLOURCHECKERS_SDS.keys())) - .. code-block:: text - ['BabelColor Average', 'ColorChecker 1976', 'ColorChecker 2005', 'ColorChecker24 - After November 2014', 'ColorChecker24 - Before November 2014', 'babel_average', 'cc2005', 'cca2014', 'ccb2014'] - ['BabelColor Average', 'ColorChecker N Ohta', 'babel_average', 'cc_ohta'] - + [u'BabelColor Average', u'ColorChecker 1976', u'ColorChecker 2005', u'ColorChecker24 - After November 2014', u'ColorChecker24 - Before November 2014', u'babel_average', u'cc2005', u'cca2014', u'ccb2014'] + [u'BabelColor Average', u'ColorChecker N Ohta', u'babel_average', u'cc_ohta'] .. note:: @@ -1227,7 +1182,6 @@ various colour rendition charts: convenient aliases for respectively ``ColorChecker 2005``, ``BabelColor Average`` and ``ColorChecker N Ohta`` keys. - .. code:: python # Plotting the *sRGB* colourspace colour of *neutral 5 (.70 D)* patch. @@ -1240,10 +1194,8 @@ various colour rendition charts: ColourSwatch(patch_name.title(), RGB), text_parameters={'size': 'x-large'}) - .. image:: _static/Tutorial_Neutral5.png - **Colour** defines a convenient plotting object to draw synthetic colour rendition charts figures: @@ -1252,29 +1204,25 @@ rendition charts figures: plot_single_colour_checker( colour_checker='ColorChecker 2005', text_parameters={'visible': False}) - .. image:: _static/Tutorial_Colour_Checker.png - Convert to Chromaticity Coordinates ----------------------------------- -Given a spectral distribution, chromaticity coordinates *xy* can be computed +Given a spectral distribution, chromaticity coordinates *CIE xy* can be computed using the ``colour.XYZ_to_xy`` definition: .. code:: python - # Computing *xy* chromaticity coordinates for the *neutral 5 (.70 D)* patch. + # Computing *CIE xy* chromaticity coordinates for the *neutral 5 (.70 D)* patch. xy = colour.XYZ_to_xy(XYZ) print(xy) - .. code-block:: text [ 0.31259787 0.32870029] - -Chromaticity coordinates *xy* can be plotted into the *CIE 1931 Chromaticity Diagram*: +Chromaticity coordinates *CIE xy* can be plotted into the *CIE 1931 Chromaticity Diagram*: .. code:: python @@ -1285,7 +1233,7 @@ Chromaticity coordinates *xy* can be plotted into the *CIE 1931 Chromaticity Dia # displayed and can be used as a basis for other plots. plot_chromaticity_diagram_CIE1931(standalone=False) - # Plotting the *xy* chromaticity coordinates. + # Plotting the *CIE xy* chromaticity coordinates. x, y = xy plt.plot(x, y, 'o-', color='white') @@ -1303,10 +1251,8 @@ Chromaticity coordinates *xy* can be plotted into the *CIE 1931 Chromaticity Dia x_tighten=True, y_tighten=True) - .. image:: _static/Tutorial_CIE_1931_Chromaticity_Diagram.png - And More... ----------- diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000..d5f7638185 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,127 @@ +[tool.poetry] +name = "colour" +version = "0.3.14" +description = "Colour Science for Python" +license = "BSD-3-Clause" +authors = [ "Colour Developers" ] +readme = 'README.rst' +repository = "https://github.com/colour-science/colour" +homepage = "https://www.colour-science.org/" +keywords = [ + "color", + "color-science", + "color-space", + "color-spaces", + "colorspace", + "colorspaces", + "colour", + "colour-science", + "colour-space", + "colour-spaces", + "colourspace", + "colourspaces", + "data", + "dataset", + "datasets", + "python", + "spectral-data", + "spectral-dataset", + "spectral-datasets" +] +classifiers = [ + "Development Status :: 3 - Alpha", + "Environment :: Console", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "License :: OSI Approved", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Topic :: Scientific/Engineering", + "Topic :: Software Development" +] + +[tool.poetry.dependencies] +python = "~2.7 || ^3.5" +imageio = "*" +six = "*" +scipy = "*" + +"backports.functools_lru_cache" = { version = "*", optional = true } +biblib-simple = { version = "*", optional = true } # Development dependency. +coverage = { version = "*", optional = true } # Development dependency. +coveralls = { version = "*", optional = true } # Development dependency. +flake8 = { version = "*", optional = true } # Development dependency. +invoke = { version = "*", optional = true } # Development dependency. +jupyter = { version = "*", optional = true } # Development dependency. +matplotlib = { version = "*", optional = true } +mock = { version = "*", optional = true } # Development dependency. +networkx = { version = "*", optional = true } +nose = { version = "*", optional = true } # Development dependency. +numpy = { version = "*", optional = true } +pandas = { version = "*", optional = true } +pre-commit = { version = "*", optional = true } # Development dependency. +pygraphviz = { version = "*", optional = true } +pytest = { version = "*", optional = true } # Development dependency. +restructuredtext-lint = { version = "*", optional = true } # Development dependency. +sphinx = { version = "*", optional = true } # Development dependency. +sphinx_rtd_theme = { version = "*", optional = true } # Development dependency. +sphinxcontrib-bibtex = { version = "*", optional = true } # Development dependency. +toml = { version = "*", optional = true } # Development dependency. +twine = { version = "*", optional = true } # Development dependency. +yapf = { version = "0.23", optional = true } # Development dependency. + +[tool.poetry.dev-dependencies] +biblib-simple = "*" +coverage = "*" +coveralls = "*" +flake8 = "*" +invoke = "*" +jupyter = "*" +mock = "*" +nose = "*" +pre-commit = "*" +pytest = "*" +restructuredtext-lint = "*" +sphinx = "*" +sphinx_rtd_theme = "*" +sphinxcontrib-bibtex = "*" +toml = "*" +twine = "*" +yapf = "0.23" + +[tool.poetry.extras] +development = [ + "biblib-simple", + "coverage", + "coveralls", + "flake8", + "invoke", + "jupyter", + "mock", + "nose", + "pre-commit", + "pytest", + "restructuredtext-lint", + "sphinx", + "sphinx_rtd_theme", + "sphinxcontrib-bibtex", + "toml", + "twine", + "yapf" +] +graphviz = [ "pygraphviz" ] +optional = [ "networkx", "pandas" ] +plotting = [ "backports.functools_lru_cache", "matplotlib" ] +read-the-docs = [ + "mock", + "networkx", + "numpy", + "pygraphviz", + "sphinxcontrib-bibtex" +] + +[build-system] +requires = [ "poetry>=0.12" ] +build-backend = "poetry.masonry.api" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000..3bc2835111 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,114 @@ +alabaster==0.7.12 +appnope==0.1.0 +aspy.yaml==1.3.0 +atomicwrites==1.3.0 +attrs==19.3.0 +Babel==2.7.0 +backcall==0.1.0 +backports.functools-lru-cache==1.5 +biblib-simple==0.1.1 +bleach==3.1.0 +certifi==2019.9.11 +cfgv==2.0.1 +chardet==3.0.4 +coverage==4.5.4 +coveralls==1.8.2 +cycler==0.10.0 +decorator==4.4.0 +defusedxml==0.6.0 +docopt==0.6.2 +docutils==0.15.2 +entrypoints==0.3 +flake8==3.7.8 +identify==1.4.7 +idna==2.8 +imageio==2.6.1 +imagesize==1.1.0 +importlib-metadata==0.23 +invoke==1.3.0 +ipykernel==5.1.3 +ipython==7.8.0 +ipython-genutils==0.2.0 +ipywidgets==7.5.1 +jedi==0.15.1 +Jinja2==2.10.3 +jsonschema==3.1.1 +jupyter==1.0.0 +jupyter-client==5.3.4 +jupyter-console==6.0.0 +jupyter-core==4.6.1 +kiwisolver==1.1.0 +latexcodec==1.0.7 +MarkupSafe==1.1.1 +matplotlib==3.0.3 +mccabe==0.6.1 +mistune==0.8.4 +mock==3.0.5 +more-itertools==7.2.0 +nbconvert==5.6.0 +nbformat==4.4.0 +networkx==2.4 +nodeenv==1.3.3 +nose==1.3.7 +notebook==6.0.1 +numpy==1.17.3 +oset==0.1.3 +packaging==19.2 +pandas==0.24.2 +pandocfilters==1.4.2 +parso==0.5.1 +pexpect==4.7.0 +pickleshare==0.7.5 +Pillow==6.2.1 +pkginfo==1.5.0.1 +pluggy==0.13.0 +pre-commit==1.18.3 +prometheus-client==0.7.1 +prompt-toolkit==2.0.10 +ptyprocess==0.6.0 +py==1.8.0 +pybtex==0.22.2 +pybtex-docutils==0.2.2 +pycodestyle==2.5.0 +pyflakes==2.1.1 +Pygments==2.4.2 +pygraphviz==1.5 +pyparsing==2.4.2 +pyrsistent==0.15.4 +pytest==5.2.1 +python-dateutil==2.8.0 +pytz==2019.3 +PyYAML==5.1.2 +pyzmq==18.1.0 +qtconsole==4.5.5 +readme-renderer==24.0 +requests==2.22.0 +requests-toolbelt==0.9.1 +restructuredtext-lint==1.3.0 +scipy==1.3.1 +Send2Trash==1.5.0 +six==1.12.0 +snowballstemmer==2.0.0 +Sphinx==2.2.0 +sphinx-rtd-theme==0.4.3 +sphinxcontrib-applehelp==1.0.1 +sphinxcontrib-bibtex==1.0.0 +sphinxcontrib-devhelp==1.0.1 +sphinxcontrib-htmlhelp==1.0.2 +sphinxcontrib-jsmath==1.0.1 +sphinxcontrib-qthelp==1.0.2 +sphinxcontrib-serializinghtml==1.1.3 +terminado==0.8.2 +testpath==0.4.2 +toml==0.10.0 +tornado==6.0.3 +tqdm==4.36.1 +traitlets==4.3.3 +twine==1.15.0 +urllib3==1.25.6 +virtualenv==16.7.7 +wcwidth==0.1.7 +webencodings==0.5.1 +widgetsnbextension==3.5.1 +yapf==0.23.0 +zipp==0.6.0 diff --git a/setup.py b/setup.py deleted file mode 100644 index b9e3303a89..0000000000 --- a/setup.py +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" -Pypi Setup -========== -""" - -from __future__ import unicode_literals - -import os -import re -import sys -from setuptools import setup -from setuptools import find_packages - -__author__ = 'Colour Developers' -__copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' -__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' -__maintainer__ = 'Colour Developers' -__email__ = 'colour-science@googlegroups.com' -__status__ = 'Production' - -__all__ = [ - 'SHORT_DESCRIPTION', 'LONG_DESCRIPTION', 'INSTALLATION_REQUIREMENTS', - 'OPTIONAL_REQUIREMENTS', 'PLOTTING_REQUIREMENTS', 'DOCS_REQUIREMENTS', - 'TESTS_REQUIREMENTS', 'DEVELOPMENT_REQUIREMENTS' -] - -SHORT_DESCRIPTION = 'Colour Science for Python' - -LONG_DESCRIPTION = open('README.rst').read() - -INSTALLATION_REQUIREMENTS = ['six>=1.10.0', 'scipy>=0.16.0'] - -if os.environ.get('READTHEDOCS') == 'True': - INSTALLATION_REQUIREMENTS = [ - 'numpy>=1.8.1', 'mock', 'sphinxcontrib-bibtex' - ] - -OPTIONAL_REQUIREMENTS = ['pandas'] - -PLOTTING_REQUIREMENTS = ['matplotlib>=2.2.0'] - -DOCS_REQUIREMENTS = [ - 'sphinx>=1.6.6', 'sphinxcontrib-bibtex', 'sphinx_rtd_theme' -] - -TESTS_REQUIREMENTS = ['coverage>=3.7.1', 'flake8>=2.1.0', 'nose>=1.3.4'] - -if sys.version_info[:2] <= (3, 2): - TESTS_REQUIREMENTS += ['mock'] - -DEVELOPMENT_REQUIREMENTS = DOCS_REQUIREMENTS + TESTS_REQUIREMENTS + [ - 'invoke', 'restructuredtext_lint', 'twine', 'yapf==0.23.0' -] -if sys.version_info[:2] >= (3, 2): - DEVELOPMENT_REQUIREMENTS += ['biblib-simple'] - - -def get_version(): - """ - Returns the package full version. - - Returns - ------- - unicode - Package full version. - """ - - with open(os.path.join('colour', '__init__.py')) as file_handle: - file_content = file_handle.read() - major_version = re.search("__major_version__\s+=\s+'(.*)'", - file_content).group(1) - minor_version = re.search("__minor_version__\s+=\s+'(.*)'", - file_content).group(1) - change_version = re.search("__change_version__\s+=\s+'(.*)'", - file_content).group(1) - - return '.'.join((major_version, minor_version, change_version)) - - -setup( - name='colour-science', - version=get_version(), - author=__author__, - author_email=__email__, - include_package_data=True, - packages=find_packages(), - scripts=[], - url='https://github.com/colour-science/colour', - license=__license__, - description=SHORT_DESCRIPTION, - long_description=LONG_DESCRIPTION, - install_requires=INSTALLATION_REQUIREMENTS, - extras_require={ - 'docs': DOCS_REQUIREMENTS, - 'development': DEVELOPMENT_REQUIREMENTS, - 'optional': OPTIONAL_REQUIREMENTS, - 'plotting': PLOTTING_REQUIREMENTS, - 'tests': TESTS_REQUIREMENTS - }, - classifiers=[ - 'Development Status :: 3 - Alpha', 'Environment :: Console', - 'Intended Audience :: Developers', - 'Intended Audience :: Science/Research', 'License :: OSI Approved', - 'Natural Language :: English', 'Operating System :: OS Independent', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Topic :: Scientific/Engineering', 'Topic :: Software Development' - ]) diff --git a/tasks.py b/tasks.py index 03ed19d1f1..a140c05063 100644 --- a/tasks.py +++ b/tasks.py @@ -7,19 +7,19 @@ from __future__ import unicode_literals import sys -if sys.version_info[:2] >= (3, 2): +try: import biblib.bib +except ImportError: + pass import fnmatch -import glob import os import re -import shutil -import tempfile +import toml +import uuid from invoke import task import colour -from colour import read_image -from colour.utilities import message_box, metric_psnr +from colour.utilities import message_box __author__ = 'Colour Developers' __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' @@ -29,14 +29,16 @@ __status__ = 'Production' __all__ = [ - 'APPLICATION_NAME', 'PYTHON_PACKAGE_NAME', 'PYPI_PACKAGE_NAME', - 'BIBLIOGRAPHY_NAME', 'clean', 'formatting', 'tests', 'quality', 'examples', - 'docs', 'todo', 'preflight', 'build', 'virtualise', 'tag', 'release', - 'sha256' + 'APPLICATION_NAME', 'APPLICATION_VERSION', 'PYTHON_PACKAGE_NAME', + 'PYPI_PACKAGE_NAME', 'BIBLIOGRAPHY_NAME', 'clean', 'formatting', 'tests', + 'quality', 'examples', 'preflight', 'docs', 'todo', 'requirements', + 'build', 'virtualise', 'tag', 'release', 'sha256' ] APPLICATION_NAME = colour.__application_name__ +APPLICATION_VERSION = colour.__version__ + PYTHON_PACKAGE_NAME = colour.__name__ PYPI_PACKAGE_NAME = 'colour-science' @@ -152,10 +154,14 @@ def tests(ctx, nose=True): message_box('Running "Nosetests"...') ctx.run( 'nosetests --with-doctest --with-coverage --cover-package={0} {0}'. - format(PYTHON_PACKAGE_NAME)) + format(PYTHON_PACKAGE_NAME), + env={'MPLBACKEND': 'AGG'}) else: message_box('Running "Pytest"...') - ctx.run('pytest -W ignore') + ctx.run( + 'py.test --disable-warnings --doctest-modules ' + '--ignore={0}/examples {0}'.format(PYTHON_PACKAGE_NAME), + env={'MPLBACKEND': 'AGG'}) @task @@ -225,6 +231,26 @@ def examples(ctx, plots=False): ctx.run('python {0}'.format(os.path.join(root, filename))) +@task(formatting, tests, quality, examples) +def preflight(ctx): + """ + Performs the preflight tasks, i.e. *formatting*, *tests*, *quality*, and + *examples*. + + Parameters + ---------- + ctx : invoke.context.Context + Context. + + Returns + ------- + bool + Task success. + """ + + message_box('Finishing "Preflight"...') + + @task def docs(ctx, plots=True, html=True, pdf=True): """ @@ -248,31 +274,9 @@ def docs(ctx, plots=True, html=True, pdf=True): """ if plots: - temporary_directory = tempfile.mkdtemp() - test_directory = os.path.join('docs', '_static') - reference_directory = os.path.join(temporary_directory, '_static') - try: - shutil.copytree(test_directory, reference_directory) - similar_plots = [] - with ctx.cd('utilities'): - message_box('Generating plots...') - ctx.run('./generate_plots.py') - - png_files = glob.glob('{0}/*.png'.format(reference_directory)) - for reference_png_file in png_files: - test_png_file = os.path.join( - test_directory, os.path.basename(reference_png_file)) - psnr = metric_psnr( - read_image(str(reference_png_file))[::3, ::3], - read_image(str(test_png_file))[::3, ::3]) - if psnr > 70: - similar_plots.append(test_png_file) - with ctx.cd('docs/_static'): - for similar_plot in similar_plots: - ctx.run('git checkout -- {0}'.format( - os.path.basename(similar_plot))) - finally: - shutil.rmtree(temporary_directory) + with ctx.cd('utilities'): + message_box('Generating plots...') + ctx.run('./generate_plots.py') with ctx.prefix('export COLOUR_SCIENCE_DOCUMENTATION_BUILD=True'): with ctx.cd('docs'): @@ -307,11 +311,10 @@ def todo(ctx): ctx.run('./export_todo.py') -@task(formatting, tests, quality, examples) -def preflight(ctx): +@task +def requirements(ctx): """ - Performs the preflight tasks, i.e. *formatting*, *tests*, *quality*, and - *examples*. + Export the *requirements.txt* file. Parameters ---------- @@ -324,10 +327,12 @@ def preflight(ctx): Task success. """ - message_box('Finishing "Preflight"...') + message_box('Exporting "requirements.txt" file...') + ctx.run('poetry run pip freeze | grep -v "github.com/colour-science" ' + '> requirements.txt') -@task(docs, todo, preflight) +@task(preflight, docs, todo, requirements) def build(ctx): """ Builds the project and runs dependency tasks, i.e. *docs*, *todo*, and @@ -345,8 +350,17 @@ def build(ctx): """ message_box('Building...') - ctx.run('python setup.py sdist') - ctx.run('python setup.py bdist_wheel --universal') + pyproject_content = toml.load('pyproject.toml') + pyproject_content['tool']['poetry']['name'] = PYPI_PACKAGE_NAME + pyproject_content['tool']['poetry']['packages'] = [{ + 'include': PYTHON_PACKAGE_NAME, + 'from': '.' + }] + with open('pyproject.toml', 'w') as pyproject_file: + toml.dump(pyproject_content, pyproject_file) + + ctx.run('poetry build') + ctx.run('git checkout -- pyproject.toml') @task(clean, build) @@ -367,21 +381,20 @@ def virtualise(ctx, tests=True): Task success. """ - pip_binary = '../staging/bin/pip' - nosetests_binary = '../staging/bin/nosetests' - + unique_name = '{0}-{1}'.format(PYPI_PACKAGE_NAME, uuid.uuid1()) with ctx.cd('dist'): - ctx.run('tar -xvf {0}-*.tar.gz'.format(PYPI_PACKAGE_NAME)) - ctx.run('virtualenv staging') - with ctx.cd('{0}-*'.format(PYPI_PACKAGE_NAME)): - ctx.run('pwd') - ctx.run('{0} install numpy'.format(pip_binary)) - ctx.run('{0} install -e .'.format(pip_binary)) - ctx.run('{0} install matplotlib'.format(pip_binary)) - ctx.run('{0} install nose'.format(pip_binary)) - ctx.run('{0} install mock'.format(pip_binary)) + ctx.run('tar -xvf {0}-{1}.tar.gz'.format(PYPI_PACKAGE_NAME, + APPLICATION_VERSION)) + ctx.run('mv {0}-{1} {2}'.format(PYPI_PACKAGE_NAME, APPLICATION_VERSION, + unique_name)) + with ctx.cd(unique_name): + ctx.run('poetry env use 3') + ctx.run('poetry install --extras "optional plotting"') + ctx.run('source $(poetry env info -p)/bin/activate') + ctx.run('python -c "import imageio;' + 'imageio.plugins.freeimage.download()"') if tests: - ctx.run(nosetests_binary) + ctx.run('poetry run nosetests', env={'MPLBACKEND': 'AGG'}) @task @@ -402,16 +415,17 @@ def tag(ctx): message_box('Tagging...') result = ctx.run('git rev-parse --abbrev-ref HEAD', hide='both') + assert result.stdout.strip() == 'develop', ( 'Are you still on a feature or master branch?') with open(os.path.join(PYTHON_PACKAGE_NAME, '__init__.py')) as file_handle: file_content = file_handle.read() - major_version = re.search("__major_version__\s+=\s+'(.*)'", + major_version = re.search("__major_version__\\s+=\\s+'(.*)'", file_content).group(1) - minor_version = re.search("__minor_version__\s+=\s+'(.*)'", + minor_version = re.search("__minor_version__\\s+=\\s+'(.*)'", file_content).group(1) - change_version = re.search("__change_version__\s+=\s+'(.*)'", + change_version = re.search("__change_version__\\s+=\\s+'(.*)'", file_content).group(1) version = '.'.join((major_version, minor_version, change_version)) diff --git a/utilities/export_todo.py b/utilities/export_todo.py index 63bbab4d3d..a5b93c5158 100755 --- a/utilities/export_todo.py +++ b/utilities/export_todo.py @@ -32,9 +32,12 @@ ----- | **Colour** by Colour Developers -| Copyright © 2013-2019 – Colour Developers – `colour-science@googlegroups.com `_ -| This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause -| `https://github.com/colour-science/colour `_ +| Copyright © 2013-2019 – Colour Developers – \ +`colour-science@googlegroups.com `_ +| This software is released under terms of New BSD License: \ +https://opensource.org/licenses/BSD-3-Clause +| `https://github.com/colour-science/colour \ +`_ """ [1:] diff --git a/utilities/generate_plots.py b/utilities/generate_plots.py index 08b80bb218..3e5fef9403 100755 --- a/utilities/generate_plots.py +++ b/utilities/generate_plots.py @@ -7,23 +7,73 @@ from __future__ import division, unicode_literals -import matplotlib.pyplot as plt -import numpy as np -import os - -import colour -from colour.plotting import * -from colour.plotting.diagrams import ( +import matplotlib + +matplotlib.use('AGG') + +import matplotlib.pyplot as plt # noqa +import numpy as np # noqa +import os # noqa + +import colour # noqa +from colour.characterisation import COLOURCHECKERS_SDS # noqa +from colour.colorimetry import ( # noqa + ILLUMINANTS_SDS, LIGHT_SOURCES_SDS, PHOTOPIC_LEFS, SCOTOPIC_LEFS, + STANDARD_OBSERVERS_CMFS, SpectralDistribution, SpectralShape, sd_blackbody, + sd_mesopic_luminous_efficiency_function, sd_to_XYZ) +from colour.io import read_image # noqa +from colour.models import sRGB_to_XYZ, XYZ_to_sRGB, XYZ_to_xy # noqa +from colour.plotting import ( # noqa + colour_style, ColourSwatch, plot_automatic_colour_conversion_graph, + plot_blackbody_colours, plot_blackbody_spectral_radiance, + plot_chromaticity_diagram_CIE1931, plot_chromaticity_diagram_CIE1960UCS, + plot_chromaticity_diagram_CIE1976UCS, plot_constant_hue_loci, + plot_corresponding_chromaticities_prediction, + plot_cvd_simulation_Machado2009, + plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1931, + plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1960UCS, + plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS, plot_image, + plot_multi_cctfs, plot_multi_cmfs, plot_multi_colour_checkers, + plot_multi_colour_swatches, plot_multi_functions, + plot_multi_illuminant_sds, plot_multi_lightness_functions, + plot_multi_luminance_functions, plot_multi_munsell_value_functions, + plot_multi_sds_colour_quality_scales_bars, + plot_multi_sds_colour_rendering_indexes_bars, plot_multi_sds, + plot_planckian_locus_in_chromaticity_diagram_CIE1931, + plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS, + plot_pointer_gamut, + plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931, + plot_RGB_chromaticities_in_chromaticity_diagram_CIE1960UCS, + plot_RGB_chromaticities_in_chromaticity_diagram_CIE1976UCS, + plot_RGB_colourspaces_gamuts, + plot_RGB_colourspaces_in_chromaticity_diagram_CIE1931, + plot_RGB_colourspaces_in_chromaticity_diagram_CIE1960UCS, + plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS, plot_RGB_scatter, + plot_sds_in_chromaticity_diagram_CIE1931, + plot_sds_in_chromaticity_diagram_CIE1960UCS, + plot_sds_in_chromaticity_diagram_CIE1976UCS, plot_single_cctf, + plot_single_cmfs, plot_single_colour_checker, plot_single_colour_swatch, + plot_single_function, plot_single_illuminant_sd, + plot_single_lightness_function, plot_single_luminance_function, + plot_single_munsell_value_function, + plot_single_sd_colour_quality_scale_bars, + plot_single_sd_colour_rendering_index_bars, + plot_single_sd_rayleigh_scattering, plot_single_sd, plot_the_blue_sky, + plot_visible_spectrum, render) +from colour.plotting.diagrams import ( # noqa plot_spectral_locus, plot_chromaticity_diagram_colours, plot_chromaticity_diagram, plot_sds_in_chromaticity_diagram) -from colour.plotting.models import ( +from colour.plotting.models import ( # noqa plot_RGB_colourspaces_in_chromaticity_diagram, plot_RGB_chromaticities_in_chromaticity_diagram, plot_ellipses_MacAdam1942_in_chromaticity_diagram) -from colour.plotting.quality import plot_colour_quality_bars -from colour.plotting.temperature import ( - plot_planckian_locus, plot_planckian_locus_in_chromaticity_diagram) -from colour.utilities import domain_range_scale +from colour.plotting.quality import plot_colour_quality_bars # noqa +from colour.plotting.temperature import ( # noqa + plot_planckian_locus, plot_planckian_locus_CIE1931, + plot_planckian_locus_CIE1960UCS, + plot_planckian_locus_in_chromaticity_diagram) +from colour.quality import colour_quality_scale # noqa +from colour.utilities import domain_range_scale, filter_warnings # noqa __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' __license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' @@ -44,7 +94,7 @@ def generate_documentation_plots(output_directory): Output directory. """ - colour.utilities.filter_warnings() + filter_warnings() colour_style() @@ -53,6 +103,10 @@ def generate_documentation_plots(output_directory): # ************************************************************************* # "README.rst" # ************************************************************************* + filename = os.path.join(output_directory, + 'Examples_Colour_Automatic_Conversion_Graph.png') + plot_automatic_colour_conversion_graph(filename) + arguments = { 'tight_layout': True, @@ -62,105 +116,117 @@ def generate_documentation_plots(output_directory): os.path.join(output_directory, 'Examples_Plotting_Visible_Spectrum.png') } - plot_visible_spectrum('CIE 1931 2 Degree Standard Observer', **arguments) + plt.close( + plot_visible_spectrum('CIE 1931 2 Degree Standard Observer', + **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Examples_Plotting_Illuminant_F1_SD.png') - plot_single_illuminant_sd('FL1', **arguments) + plt.close(plot_single_illuminant_sd('FL1', **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Examples_Plotting_Blackbodies.png') blackbody_sds = [ - colour.sd_blackbody(i, colour.SpectralShape(0, 10000, 10)) + sd_blackbody(i, SpectralShape(0, 10000, 10)) for i in range(1000, 15000, 1000) ] - plot_multi_sds( - blackbody_sds, - y_label='W / (sr m$^2$) / m', - use_sds_colours=True, - normalise_sds_colours=True, - legend_location='upper right', - bounding_box=(0, 1250, 0, 2.5e15), - **arguments) + plt.close( + plot_multi_sds( + blackbody_sds, + y_label='W / (sr m$^2$) / m', + use_sds_colours=True, + normalise_sds_colours=True, + legend_location='upper right', + bounding_box=(0, 1250, 0, 2.5e15), + **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Examples_Plotting_Cone_Fundamentals.png') - plot_single_cmfs( - 'Stockman & Sharpe 2 Degree Cone Fundamentals', - y_label='Sensitivity', - bounding_box=(390, 870, 0, 1.1), - **arguments) + plt.close( + plot_single_cmfs( + 'Stockman & Sharpe 2 Degree Cone Fundamentals', + y_label='Sensitivity', + bounding_box=(390, 870, 0, 1.1), + **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Examples_Plotting_Luminous_Efficiency.png') - sd_mesopic_luminous_efficiency_function = ( - colour.sd_mesopic_luminous_efficiency_function(0.2)) - plot_multi_sds( - (sd_mesopic_luminous_efficiency_function, - colour.PHOTOPIC_LEFS['CIE 1924 Photopic Standard Observer'], - colour.SCOTOPIC_LEFS['CIE 1951 Scotopic Standard Observer']), - y_label='Luminous Efficiency', - legend_location='upper right', - y_tighten=True, - margins=(0, 0, 0, .1), - **arguments) + plt.close( + plot_multi_sds( + (sd_mesopic_luminous_efficiency_function(0.2), + PHOTOPIC_LEFS['CIE 1924 Photopic Standard Observer'], + SCOTOPIC_LEFS['CIE 1951 Scotopic Standard Observer']), + y_label='Luminous Efficiency', + legend_location='upper right', + y_tighten=True, + margins=(0, 0, 0, .1), + **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Examples_Plotting_BabelColor_Average.png') - plot_multi_sds( - colour.COLOURCHECKERS_SDS['BabelColor Average'].values(), - use_sds_colours=True, - title=('BabelColor Average - ' - 'Spectral Distributions'), - **arguments) + plt.close( + plot_multi_sds( + COLOURCHECKERS_SDS['BabelColor Average'].values(), + use_sds_colours=True, + title=('BabelColor Average - ' + 'Spectral Distributions'), + **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Examples_Plotting_ColorChecker_2005.png') - plot_single_colour_checker( - 'ColorChecker 2005', text_parameters={'visible': False}, **arguments) + plt.close( + plot_single_colour_checker( + 'ColorChecker 2005', + text_parameters={'visible': False}, + **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Examples_Plotting_Chromaticities_Prediction.png') - plot_corresponding_chromaticities_prediction(2, 'Von Kries', 'Bianco', - **arguments) + plt.close( + plot_corresponding_chromaticities_prediction(2, 'Von Kries', 'Bianco', + **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Examples_Plotting_CCT_CIE_1960_UCS_Chromaticity_Diagram.png') - plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS(['A', 'B', 'C'], - **arguments) + plt.close( + plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS( + ['A', 'B', 'C'], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Examples_Plotting_Chromaticities_CIE_1931_Chromaticity_Diagram.png') RGB = np.random.random((32, 32, 3)) - plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931( - RGB, - 'ITU-R BT.709', - colourspaces=['ACEScg', 'S-Gamut'], - show_pointer_gamut=True, - **arguments) + plt.close( + plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931( + RGB, + 'ITU-R BT.709', + colourspaces=['ACEScg', 'S-Gamut'], + show_pointer_gamut=True, + **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Examples_Plotting_CRI.png') - plot_single_sd_colour_rendering_index_bars(colour.ILLUMINANTS_SDS['FL2'], - **arguments) + plt.close( + plot_single_sd_colour_rendering_index_bars(ILLUMINANTS_SDS['FL2'], + **arguments)[0]) # ************************************************************************* # Documentation # ************************************************************************* arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_CVD_Simulation_Machado2009.png') - plot_cvd_simulation_Machado2009(RGB, **arguments) + plt.close(plot_cvd_simulation_Machado2009(RGB, **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Single_Colour_Checker.png') - plot_single_colour_checker('ColorChecker 2005', **arguments) + plt.close(plot_single_colour_checker('ColorChecker 2005', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Multi_Colour_Checkers.png') - plot_multi_colour_checkers(['ColorChecker 1976', 'ColorChecker 2005'], - **arguments) + plt.close( + plot_multi_colour_checkers(['ColorChecker 1976', 'ColorChecker 2005'], + **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Single_SD.png') @@ -172,11 +238,11 @@ def generate_documentation_plots(output_directory): 580: 0.1128, 600: 0.1360 } - sd = colour.SpectralDistribution(data, name='Custom') - plot_single_sd(sd, **arguments) + sd = SpectralDistribution(data, name='Custom') + plt.close(plot_single_sd(sd, **arguments)[0]) arguments['filename'] = os.path.join(output_directory, - 'Plotting_Plot_Multi_SDs.png') + 'Plotting_Plot_Multi_SDS.png') data_1 = { 500: 0.004900, 510: 0.009300, @@ -195,71 +261,79 @@ def generate_documentation_plots(output_directory): 550: 0.994950, 560: 0.995000 } - spd1 = colour.SpectralDistribution(data_1, name='Custom 1') - spd2 = colour.SpectralDistribution(data_2, name='Custom 2') - plot_multi_sds([spd1, spd2], **arguments) + spd1 = SpectralDistribution(data_1, name='Custom 1') + spd2 = SpectralDistribution(data_2, name='Custom 2') + plt.close(plot_multi_sds([spd1, spd2], **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Single_CMFS.png') - plot_single_cmfs('CIE 1931 2 Degree Standard Observer', **arguments) + plt.close( + plot_single_cmfs('CIE 1931 2 Degree Standard Observer', + **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Multi_CMFS.png') cmfs = ('CIE 1931 2 Degree Standard Observer', 'CIE 1964 10 Degree Standard Observer') - plot_multi_cmfs(cmfs, **arguments) + plt.close(plot_multi_cmfs(cmfs, **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Single_Illuminant_SD.png') - plot_single_illuminant_sd('A', **arguments) + plt.close(plot_single_illuminant_sd('A', **arguments)[0]) arguments['filename'] = os.path.join( - output_directory, 'Plotting_Plot_Multi_Illuminant_SDs.png') - plot_multi_illuminant_sds(['A', 'B', 'C'], **arguments) + output_directory, 'Plotting_Plot_Multi_Illuminant_SDS.png') + plt.close(plot_multi_illuminant_sds(['A', 'B', 'C'], **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Visible_Spectrum.png') - plot_visible_spectrum(**arguments) + plt.close(plot_visible_spectrum(**arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Single_Lightness_Function.png') - plot_single_lightness_function('CIE 1976', **arguments) + plt.close(plot_single_lightness_function('CIE 1976', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Multi_Lightness_Functions.png') - plot_multi_lightness_functions(['CIE 1976', 'Wyszecki 1963'], **arguments) + plt.close( + plot_multi_lightness_functions(['CIE 1976', 'Wyszecki 1963'], + **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Single_Luminance_Function.png') - plot_single_luminance_function('CIE 1976', **arguments) + plt.close(plot_single_luminance_function('CIE 1976', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Multi_Luminance_Functions.png') - plot_multi_luminance_functions(['CIE 1976', 'Newhall 1943'], **arguments) + plt.close( + plot_multi_luminance_functions(['CIE 1976', 'Newhall 1943'], + **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Blackbody_Spectral_Radiance.png') - plot_blackbody_spectral_radiance( - 3500, blackbody='VY Canis Major', **arguments) + plt.close( + plot_blackbody_spectral_radiance( + 3500, blackbody='VY Canis Major', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Blackbody_Colours.png') - plot_blackbody_colours(colour.SpectralShape(150, 12500, 50), **arguments) + plt.close( + plot_blackbody_colours(SpectralShape(150, 12500, 50), **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Single_Colour_Swatch.png') - RGB = ColourSwatch(RGB=(0.32315746, 0.32983556, 0.33640183)) - plot_single_colour_swatch(RGB, **arguments) + RGB = ColourSwatch(RGB=(0.45620519, 0.03081071, 0.04091952)) + plt.close(plot_single_colour_swatch(RGB, **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Multi_Colour_Swatches.png') RGB_1 = ColourSwatch(RGB=(0.45293517, 0.31732158, 0.26414773)) RGB_2 = ColourSwatch(RGB=(0.77875824, 0.57726450, 0.50453169)) - plot_multi_colour_swatches([RGB_1, RGB_2], **arguments) + plt.close(plot_multi_colour_swatches([RGB_1, RGB_2], **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Single_Function.png') - plot_single_function(lambda x: x ** (1 / 2.2), **arguments) + plt.close(plot_single_function(lambda x: x ** (1 / 2.2), **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Multi_Functions.png') @@ -268,238 +342,349 @@ def generate_documentation_plots(output_directory): 'Gamma 2.4': lambda x: x ** (1 / 2.4), 'Gamma 2.6': lambda x: x ** (1 / 2.6), } - plot_multi_functions(functions, **arguments) + plt.close(plot_multi_functions(functions, **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Image.png') - path = os.path.join(colour.__path__[0], '..', 'docs', '_static', - 'Logo_Medium_001.png') - plot_image(colour.read_image(str(path)), **arguments) + path = os.path.join(output_directory, 'Logo_Medium_001.png') + plt.close(plot_image(read_image(str(path)), **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Corresponding_Chromaticities_Prediction.png') - plot_corresponding_chromaticities_prediction(1, 'Von Kries', 'CAT02', - **arguments) + plt.close( + plot_corresponding_chromaticities_prediction(1, 'Von Kries', 'CAT02', + **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Spectral_Locus.png') - plot_spectral_locus(spectral_locus_colours='RGB', **arguments) + plt.close( + plot_spectral_locus(spectral_locus_colours='RGB', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Chromaticity_Diagram_Colours.png') - plot_chromaticity_diagram_colours(**arguments) + plt.close(plot_chromaticity_diagram_colours(**arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Chromaticity_Diagram.png') - plot_chromaticity_diagram(**arguments) + plt.close(plot_chromaticity_diagram(**arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Chromaticity_Diagram_CIE1931.png') - plot_chromaticity_diagram_CIE1931(**arguments) + plt.close(plot_chromaticity_diagram_CIE1931(**arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Chromaticity_Diagram_CIE1960UCS.png') - plot_chromaticity_diagram_CIE1960UCS(**arguments) + plt.close(plot_chromaticity_diagram_CIE1960UCS(**arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Chromaticity_Diagram_CIE1976UCS.png') - plot_chromaticity_diagram_CIE1976UCS(**arguments) + plt.close(plot_chromaticity_diagram_CIE1976UCS(**arguments)[0]) arguments['filename'] = os.path.join( - output_directory, 'Plotting_Plot_SDs_In_Chromaticity_Diagram.png') - A = colour.ILLUMINANTS_SDS['A'] - D65 = colour.ILLUMINANTS_SDS['D65'] - plot_sds_in_chromaticity_diagram([A, D65], **arguments) + output_directory, 'Plotting_Plot_SDS_In_Chromaticity_Diagram.png') + A = ILLUMINANTS_SDS['A'] + D65 = ILLUMINANTS_SDS['D65'] + plt.close(plot_sds_in_chromaticity_diagram([A, D65], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, - 'Plotting_Plot_SDs_In_Chromaticity_Diagram_CIE1931.png') - plot_sds_in_chromaticity_diagram_CIE1931([A, D65], **arguments) + 'Plotting_Plot_SDS_In_Chromaticity_Diagram_CIE1931.png') + plt.close( + plot_sds_in_chromaticity_diagram_CIE1931([A, D65], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, - 'Plotting_Plot_SDs_In_Chromaticity_Diagram_CIE1960UCS.png') - plot_sds_in_chromaticity_diagram_CIE1960UCS([A, D65], **arguments) + 'Plotting_Plot_SDS_In_Chromaticity_Diagram_CIE1960UCS.png') + plt.close( + plot_sds_in_chromaticity_diagram_CIE1960UCS([A, D65], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, - 'Plotting_Plot_SDs_In_Chromaticity_Diagram_CIE1976UCS.png') - plot_sds_in_chromaticity_diagram_CIE1976UCS([A, D65], **arguments) + 'Plotting_Plot_SDS_In_Chromaticity_Diagram_CIE1976UCS.png') + plt.close( + plot_sds_in_chromaticity_diagram_CIE1976UCS([A, D65], **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Pointer_Gamut.png') - plot_pointer_gamut(**arguments) + plt.close(plot_pointer_gamut(**arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_RGB_Colourspaces_In_Chromaticity_Diagram.png') - plot_RGB_colourspaces_in_chromaticity_diagram( - ['ITU-R BT.709', 'ACEScg', 'S-Gamut'], **arguments) + plt.close( + plot_RGB_colourspaces_in_chromaticity_diagram( + ['ITU-R BT.709', 'ACEScg', 'S-Gamut'], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_RGB_Colourspaces_In_Chromaticity_Diagram_CIE1931.png') - plot_RGB_colourspaces_in_chromaticity_diagram_CIE1931( - ['ITU-R BT.709', 'ACEScg', 'S-Gamut'], **arguments) + plt.close( + plot_RGB_colourspaces_in_chromaticity_diagram_CIE1931( + ['ITU-R BT.709', 'ACEScg', 'S-Gamut'], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_RGB_Colourspaces_In_' 'Chromaticity_Diagram_CIE1960UCS.png') - plot_RGB_colourspaces_in_chromaticity_diagram_CIE1960UCS( - ['ITU-R BT.709', 'ACEScg', 'S-Gamut'], **arguments) + plt.close( + plot_RGB_colourspaces_in_chromaticity_diagram_CIE1960UCS( + ['ITU-R BT.709', 'ACEScg', 'S-Gamut'], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_RGB_Colourspaces_In_' 'Chromaticity_Diagram_CIE1976UCS.png') - plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS( - ['ITU-R BT.709', 'ACEScg', 'S-Gamut'], **arguments) + plt.close( + plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS( + ['ITU-R BT.709', 'ACEScg', 'S-Gamut'], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_RGB_Chromaticities_In_' - 'Chromaticity_Diagram_Plot.png') + 'Chromaticity_Diagram.png') RGB = np.random.random((128, 128, 3)) - plot_RGB_chromaticities_in_chromaticity_diagram(RGB, 'ITU-R BT.709', - **arguments) + plt.close( + plot_RGB_chromaticities_in_chromaticity_diagram( + RGB, 'ITU-R BT.709', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_RGB_Chromaticities_In_' 'Chromaticity_Diagram_CIE1931.png') - plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931( - RGB, 'ITU-R BT.709', **arguments) + plt.close( + plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931( + RGB, 'ITU-R BT.709', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_RGB_Chromaticities_In_' 'Chromaticity_Diagram_CIE1960UCS.png') - plot_RGB_chromaticities_in_chromaticity_diagram_CIE1960UCS( - RGB, 'ITU-R BT.709', **arguments) + plt.close( + plot_RGB_chromaticities_in_chromaticity_diagram_CIE1960UCS( + RGB, 'ITU-R BT.709', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_RGB_Chromaticities_In_' 'Chromaticity_Diagram_CIE1976UCS.png') - plot_RGB_chromaticities_in_chromaticity_diagram_CIE1976UCS( - RGB, 'ITU-R BT.709', **arguments) + plt.close( + plot_RGB_chromaticities_in_chromaticity_diagram_CIE1976UCS( + RGB, 'ITU-R BT.709', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Ellipses_MacAdam1942_In_Chromaticity_Diagram.png') - plot_ellipses_MacAdam1942_in_chromaticity_diagram(**arguments) + plt.close( + plot_ellipses_MacAdam1942_in_chromaticity_diagram(**arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Ellipses_MacAdam1942_In_' 'Chromaticity_Diagram_CIE1931.png') - plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1931(**arguments) + plt.close( + plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1931( + **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Ellipses_MacAdam1942_In_' 'Chromaticity_Diagram_CIE1960UCS.png') - plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1960UCS(**arguments) + plt.close( + plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1960UCS( + **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Ellipses_MacAdam1942_In_' 'Chromaticity_Diagram_CIE1976UCS.png') - plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS(**arguments) + plt.close( + plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS( + **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Single_CCTF.png') - plot_single_cctf('ITU-R BT.709', **arguments) + plt.close(plot_single_cctf('ITU-R BT.709', **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Multi_CCTFs.png') - plot_multi_cctfs(['ITU-R BT.709', 'sRGB'], **arguments) + plt.close(plot_multi_cctfs(['ITU-R BT.709', 'sRGB'], **arguments)[0]) + + data = np.array([ + [ + None, + np.array([0.95010000, 1.00000000, 1.08810000]), + np.array([0.40920000, 0.28120000, 0.30600000]), + np.array([ + [0.02495100, 0.01908600, 0.02032900], + [0.10944300, 0.06235900, 0.06788100], + [0.27186500, 0.18418700, 0.19565300], + [0.48898900, 0.40749400, 0.44854600], + ]), + None, + ], + [ + None, + np.array([0.95010000, 1.00000000, 1.08810000]), + np.array([0.30760000, 0.48280000, 0.42770000]), + np.array([ + [0.02108000, 0.02989100, 0.02790400], + [0.06194700, 0.11251000, 0.09334400], + [0.15255800, 0.28123300, 0.23234900], + [0.34157700, 0.56681300, 0.47035300], + ]), + None, + ], + [ + None, + np.array([0.95010000, 1.00000000, 1.08810000]), + np.array([0.39530000, 0.28120000, 0.18450000]), + np.array([ + [0.02436400, 0.01908600, 0.01468800], + [0.10331200, 0.06235900, 0.02854600], + [0.26311900, 0.18418700, 0.12109700], + [0.43158700, 0.40749400, 0.39008600], + ]), + None, + ], + [ + None, + np.array([0.95010000, 1.00000000, 1.08810000]), + np.array([0.20510000, 0.18420000, 0.57130000]), + np.array([ + [0.03039800, 0.02989100, 0.06123300], + [0.08870000, 0.08498400, 0.21843500], + [0.18405800, 0.18418700, 0.40111400], + [0.32550100, 0.34047200, 0.50296900], + [0.53826100, 0.56681300, 0.80010400], + ]), + None, + ], + [ + None, + np.array([0.95010000, 1.00000000, 1.08810000]), + np.array([0.35770000, 0.28120000, 0.11250000]), + np.array([ + [0.03678100, 0.02989100, 0.01481100], + [0.17127700, 0.11251000, 0.01229900], + [0.30080900, 0.28123300, 0.21229800], + [0.52976000, 0.40749400, 0.11720000], + ]), + None, + ], + ]) + arguments['filename'] = os.path.join( + output_directory, 'Plotting_Plot_Constant_Hue_Loci.png') + plt.close(plot_constant_hue_loci(data, 'IPT', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Single_Munsell_Value_Function.png') - plot_single_munsell_value_function('ASTM D1535-08', **arguments) + plt.close(plot_single_munsell_value_function('ASTM D1535', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Multi_Munsell_Value_Functions.png') - plot_multi_munsell_value_functions(['ASTM D1535-08', 'McCamy 1987'], - **arguments) + plt.close( + plot_multi_munsell_value_functions(['ASTM D1535', 'McCamy 1987'], + **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Single_SD_Rayleigh_Scattering.png') - plot_single_sd_rayleigh_scattering(**arguments) + plt.close(plot_single_sd_rayleigh_scattering(**arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_The_Blue_Sky.png') - plot_the_blue_sky(**arguments) + plt.close(plot_the_blue_sky(**arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Colour_Quality_Bars.png') - illuminant = colour.ILLUMINANTS_SDS['FL2'] - light_source = colour.LIGHT_SOURCES_SDS['Kinoton 75P'] - light_source = light_source.copy().align(colour.SpectralShape(360, 830, 1)) - cqs_i = colour.colour_quality_scale(illuminant, additional_data=True) - cqs_l = colour.colour_quality_scale(light_source, additional_data=True) - plot_colour_quality_bars([cqs_i, cqs_l], **arguments) + illuminant = ILLUMINANTS_SDS['FL2'] + light_source = LIGHT_SOURCES_SDS['Kinoton 75P'] + light_source = light_source.copy().align(SpectralShape(360, 830, 1)) + cqs_i = colour_quality_scale(illuminant, additional_data=True) + cqs_l = colour_quality_scale(light_source, additional_data=True) + plt.close(plot_colour_quality_bars([cqs_i, cqs_l], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Single_SD_Colour_Rendering_Index_Bars.png') - illuminant = colour.ILLUMINANTS_SDS['FL2'] - plot_single_sd_colour_rendering_index_bars(illuminant, **arguments) + illuminant = ILLUMINANTS_SDS['FL2'] + plt.close( + plot_single_sd_colour_rendering_index_bars(illuminant, **arguments)[0]) arguments['filename'] = os.path.join( output_directory, - 'Plotting_Plot_Multi_SDs_Colour_Rendering_Indexes_Bars.png') - light_source = colour.LIGHT_SOURCES_SDS['Kinoton 75P'] - plot_multi_sds_colour_rendering_indexes_bars([illuminant, light_source], - **arguments) + 'Plotting_Plot_Multi_SDS_Colour_Rendering_Indexes_Bars.png') + light_source = LIGHT_SOURCES_SDS['Kinoton 75P'] + plt.close( + plot_multi_sds_colour_rendering_indexes_bars( + [illuminant, light_source], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Single_SD_Colour_Quality_Scale_Bars.png') - illuminant = colour.ILLUMINANTS_SDS['FL2'] - plot_single_sd_colour_quality_scale_bars(illuminant, **arguments) + illuminant = ILLUMINANTS_SDS['FL2'] + plt.close( + plot_single_sd_colour_quality_scale_bars(illuminant, **arguments)[0]) arguments['filename'] = os.path.join( output_directory, - 'Plotting_Plot_Multi_SDs_Colour_Quality_Scales_Bars.png') - light_source = colour.LIGHT_SOURCES_SDS['Kinoton 75P'] - plot_multi_sds_colour_quality_scales_bars([illuminant, light_source], - **arguments) + 'Plotting_Plot_Multi_SDS_Colour_Quality_Scales_Bars.png') + light_source = LIGHT_SOURCES_SDS['Kinoton 75P'] + plt.close( + plot_multi_sds_colour_quality_scales_bars([illuminant, light_source], + **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Planckian_Locus.png') - plot_planckian_locus(**arguments) + plt.close(plot_planckian_locus(**arguments)[0]) + + arguments['filename'] = os.path.join( + output_directory, 'Plotting_Plot_Planckian_Locus_CIE1931.png') + plt.close(plot_planckian_locus_CIE1931(**arguments)[0]) + + arguments['filename'] = os.path.join( + output_directory, 'Plotting_Plot_Planckian_Locus_CIE1960UCS.png') + plt.close(plot_planckian_locus_CIE1960UCS(**arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Planckian_Locus_In_Chromaticity_Diagram.png') - plot_planckian_locus_in_chromaticity_diagram(['A', 'B', 'C'], **arguments) + plt.close( + plot_planckian_locus_in_chromaticity_diagram(['A', 'B', 'C'], + **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Planckian_Locus_In_Chromaticity_Diagram_CIE1931.png') - plot_planckian_locus_in_chromaticity_diagram_CIE1931(['A', 'B', 'C'], - **arguments) + plt.close( + plot_planckian_locus_in_chromaticity_diagram_CIE1931(['A', 'B', 'C'], + **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Planckian_Locus_In_Chromaticity_Diagram_CIE1960UCS.png') - plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS(['A', 'B', 'C'], - **arguments) + plt.close( + plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS( + ['A', 'B', 'C'], **arguments)[0]) + arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_RGB_Colourspaces_Gamuts.png') - plot_RGB_colourspaces_gamuts(['ITU-R BT.709', 'ACEScg', 'S-Gamut'], - **arguments) + plt.close( + plot_RGB_colourspaces_gamuts(['ITU-R BT.709', 'ACEScg', 'S-Gamut'], + **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_RGB_Colourspaces_Gamuts.png') - plot_RGB_colourspaces_gamuts(['ITU-R BT.709', 'ACEScg', 'S-Gamut'], - **arguments) + plt.close( + plot_RGB_colourspaces_gamuts(['ITU-R BT.709', 'ACEScg', 'S-Gamut'], + **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_RGB_Scatter.png') - plot_RGB_scatter(RGB, 'ITU-R BT.709', **arguments) + plt.close(plot_RGB_scatter(RGB, 'ITU-R BT.709', **arguments)[0]) + + filename = os.path.join( + output_directory, + 'Plotting_Plot_Colour_Automatic_Conversion_Graph.png') + plot_automatic_colour_conversion_graph(filename) # ************************************************************************* # "tutorial.rst" # ************************************************************************* arguments['filename'] = os.path.join(output_directory, 'Tutorial_Visible_Spectrum.png') - plot_visible_spectrum(**arguments) + plt.close(plot_visible_spectrum(**arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Tutorial_Sample_SD.png') @@ -587,52 +772,55 @@ def generate_documentation_plots(output_directory): 780: 0.421 } - sd = colour.SpectralDistribution(sample_sd_data, name='Sample') - plot_single_sd(sd, **arguments) + sd = SpectralDistribution(sample_sd_data, name='Sample') + plt.close(plot_single_sd(sd, **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Tutorial_SD_Interpolation.png') sd_copy = sd.copy() - sd_copy.interpolate(colour.SpectralShape(400, 770, 1)) - plot_multi_sds( - [sd, sd_copy], bounding_box=[730, 780, 0.25, 0.5], **arguments) + sd_copy.interpolate(SpectralShape(400, 770, 1)) + plt.close( + plot_multi_sds( + [sd, sd_copy], bounding_box=[730, 780, 0.25, 0.5], **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Tutorial_Sample_Swatch.png') - sd = colour.SpectralDistribution(sample_sd_data) - cmfs = colour.STANDARD_OBSERVERS_CMFS[ - 'CIE 1931 2 Degree Standard Observer'] - illuminant = colour.ILLUMINANTS_SDS['D65'] + sd = SpectralDistribution(sample_sd_data) + cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] + illuminant = ILLUMINANTS_SDS['D65'] with domain_range_scale('1'): - XYZ = colour.sd_to_XYZ(sd, cmfs, illuminant) - RGB = colour.XYZ_to_sRGB(XYZ) - plot_single_colour_swatch( - ColourSwatch('Sample', RGB), - text_parameters={'size': 'x-large'}, - **arguments) + XYZ = sd_to_XYZ(sd, cmfs, illuminant) + RGB = XYZ_to_sRGB(XYZ) + plt.close( + plot_single_colour_swatch( + ColourSwatch('Sample', RGB), + text_parameters={'size': 'x-large'}, + **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Tutorial_Neutral5.png') patch_name = 'neutral 5 (.70 D)' - patch_sd = colour.COLOURCHECKERS_SDS['ColorChecker N Ohta'][patch_name] + patch_sd = COLOURCHECKERS_SDS['ColorChecker N Ohta'][patch_name] with domain_range_scale('1'): - XYZ = colour.sd_to_XYZ(patch_sd, cmfs, illuminant) - RGB = colour.XYZ_to_sRGB(XYZ) - plot_single_colour_swatch( - ColourSwatch(patch_name.title(), RGB), - text_parameters={'size': 'x-large'}, - **arguments) + XYZ = sd_to_XYZ(patch_sd, cmfs, illuminant) + RGB = XYZ_to_sRGB(XYZ) + plt.close( + plot_single_colour_swatch( + ColourSwatch(patch_name.title(), RGB), + text_parameters={'size': 'x-large'}, + **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Tutorial_Colour_Checker.png') - plot_single_colour_checker( - colour_checker='ColorChecker 2005', - text_parameters={'visible': False}, - **arguments) + plt.close( + plot_single_colour_checker( + colour_checker='ColorChecker 2005', + text_parameters={'visible': False}, + **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Tutorial_CIE_1931_Chromaticity_Diagram.png') - xy = colour.XYZ_to_xy(XYZ) + xy = XYZ_to_xy(XYZ) plot_chromaticity_diagram_CIE1931(standalone=False) x, y = xy plt.plot(x, y, 'o-', color='white') @@ -643,23 +831,25 @@ def generate_documentation_plots(output_directory): xytext=(-50, 30), textcoords='offset points', arrowprops=dict(arrowstyle='->', connectionstyle='arc3, rad=-0.2')) - render( - standalone=True, - limits=(-0.1, 0.9, -0.1, 0.9), - x_tighten=True, - y_tighten=True, - **arguments) + plt.close( + render( + standalone=True, + limits=(-0.1, 0.9, -0.1, 0.9), + x_tighten=True, + y_tighten=True, + **arguments)[0]) # ************************************************************************* # "basics.rst" # ************************************************************************* arguments['filename'] = os.path.join(output_directory, 'Basics_Logo_Small_001_CIE_XYZ.png') - RGB = colour.read_image( - os.path.join(output_directory, 'Logo_Small_001.png'))[..., 0:3] - XYZ = colour.sRGB_to_XYZ(RGB) - colour.plotting.plot_image( - XYZ, text_parameters={'text': 'sRGB to XYZ'}, **arguments) + RGB = read_image(os.path.join(output_directory, + 'Logo_Small_001.png'))[..., 0:3] + XYZ = sRGB_to_XYZ(RGB) + plt.close( + plot_image(XYZ, text_parameters={'text': 'sRGB to XYZ'}, + **arguments)[0]) if __name__ == '__main__': diff --git a/utilities/mock_for_colour.py b/utilities/mock_for_colour.py new file mode 100644 index 0000000000..d485cdbee2 --- /dev/null +++ b/utilities/mock_for_colour.py @@ -0,0 +1,254 @@ +# -*- coding: utf-8 -*- +""" +Mock for Colour +=============== + +Defines various mock objects to use with +`Colour `_. + +References +---------- +- :cite:`SphinxTeam` : Sphinx Team. (n.d.). sphinx.ext.autodoc.mock. + Retrieved May 2, 2019, from https://github.com/sphinx-doc/sphinx/blob/\ +master/sphinx/ext/autodoc/mock.py +""" + +from __future__ import division, unicode_literals + +import os + +from types import FunctionType, MethodType, ModuleType + +__author__ = 'Sphinx Team, Colour Developers' +__copyright__ = 'Copyright 2007-2019 - Sphinx Team' +__copyright__ += ', ' +__copyright__ += 'Copyright (C) 2013-2019 - Colour Developers' +__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause' +__maintainer__ = 'Colour Developers' +__email__ = 'colour-science@googlegroups.com' +__status__ = 'Production' + +__all__ = ['MockObject', 'MockModule', 'mock_scipy_for_colour'] + + +class MockObject(object): + """ + A generic mock object used for helping to mock tricky *Colour* requirements + such as *Scipy*. + + Other Parameters + ---------------- + \\*args : list, optional + Arguments. + \\**kwargs : dict, optional + Keywords arguments. + + References + ---------- + :cite:`SphinxTeam` + """ + + __display_name__ = 'MockObject' + + def __new__(cls, *args, **kwargs): + """ + Returns a new instance of the :class:`MockObject` class. + + Other Parameters + ---------------- + \\*args : list, optional + Arguments. + \\**kwargs : dict, optional + Keywords arguments. + """ + + if len(args) == 3 and isinstance(args[1], tuple): + superclass = args[1][-1].__class__ + if superclass is cls: + return _make_subclass( + args[0], + superclass.__display_name__, + superclass=superclass, + attributes=args[2]) + + return super(MockObject, cls).__new__(cls) + + def __init__(self, *args, **kwargs): + pass + + def __len__(self): + """ + Returns the length of the :class:`MockObject` class instance, i.e. 0. + """ + + return 0 + + def __contains__(self, key): + """ + Returns whether the :class:`MockObject` class instance contains given + key. + + Parameters + ---------- + key : unicode + Key to check whether is is contained in the :class:`MockObject` + class instance. + """ + + return False + + def __iter__(self): + """ + Iterates over the :class:`MockObject` class instance. + """ + + return iter([]) + + def __mro_entries__(self, bases): + """ + If an object that is not a class object appears in the tuple of bases + of a class definition, then method __mro_entries__ is searched on it. + """ + + return (self.__class__, ) + + def __getitem__(self, key): + """ + Returns the value at given key from the :class:`MockObject` class + instance. + + Parameters + ---------- + key : unicode + Key to return the value at. + """ + + return _make_subclass(key, self.__display_name__, self.__class__)() + + def __getattr__(self, key): + """ + Returns the attribute at given key from the :class:`MockObject` class + instance. + + Parameters + ---------- + key : unicode + Key to return the attribute at. + """ + + return _make_subclass(key, self.__display_name__, self.__class__)() + + def __call__(self, *args, **kwargs): + """ + Calls the :class:`MockObject` class instance. + + Other Parameters + ---------------- + \\*args : list, optional + Arguments. + \\**kwargs : dict, optional + Keywords arguments. + """ + + if args and type(args[0]) in [FunctionType, MethodType]: + return args[0] + + return self + + def __repr__(self): + """ + Returns an evaluable string representation of the :class:`MockObject` + class instance. + """ + + return self.__display_name__ + + +def _make_subclass(name, module, superclass=MockObject, attributes=None): + """ + A sub-class factory that makes sub-classes of given super-class type. + + Parameters + ---------- + name : unicode + Name of the sub-class. + module : unicode + Name of the sub-class module. + superclass : object + Super-class type. + attributes : dict + Attributes to set the sub-class with. + """ + + attrs = {'__module__': module, '__display_name__': module + '.' + name} + attrs.update(attributes or {}) + + return type(name, (superclass, ), attrs) + + +class MockModule(ModuleType): + """ + A mock object used to mock modules. + + Parameters + ---------- + name : unicode + Name of the mocked module. + + References + ---------- + :cite:`SphinxTeam` + """ + + __file__ = os.devnull + + def __init__(self, name): + super(MockModule, self).__init__(name) + self.__all__ = [] + self.__path__ = [] + + def __getattr__(self, name): + """ + Returns the attribute at given name from the :class:`MockModule` class + instance. + + Parameters + ---------- + name : unicode + Name to return the attribute at. + """ + + return _make_subclass(name, self.__name__)() + + def __repr__(self): + """ + Returns an evaluable string representation of the :class:`MockModule` + class instance. + """ + + return self.__name__ + + +def mock_scipy_for_colour(): + """ + Mocks *Scipy* for *Colour*. + """ + + import sys + + for module in ('scipy', 'scipy.interpolate', 'scipy.spatial', + 'scipy.spatial.distance', 'scipy.optimize'): + sys.modules[str(module)] = MockModule(str(module)) + + +if __name__ == '__main__': + import sys + + for module in ('scipy', 'scipy.interpolate', 'scipy.spatial', + 'scipy.spatial.distance', 'scipy.optimize'): + sys.modules[str(module)] = MockModule(str(module)) + + import colour + + xyY = (0.4316, 0.3777, 0.1008) + print(colour.xyY_to_XYZ(xyY)) diff --git a/utilities/unicode_to_ascii.py b/utilities/unicode_to_ascii.py index c66da797d8..40368873ac 100755 --- a/utilities/unicode_to_ascii.py +++ b/utilities/unicode_to_ascii.py @@ -11,9 +11,9 @@ reload(sys) # noqa sys.setdefaultencoding('utf-8') -import codecs -import os -import unicodedata +import codecs # noqa +import os # noqa +import unicodedata # noqa __copyright__ = 'Copyright (C) 2013-2019 - Colour Developers' __license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause'