Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new illuminants #5234

Closed
wants to merge 11 commits into from
Closed

Conversation

BierretA
Copy link
Contributor

Description

This small PR adds new white points for color conversions. See Issue #5223 .

I added illuminants B and C, as well as a new observer compatible with color conversions done with the R language.

Checklist

For reviewers

  • Check that the PR title is short, concise, and will make sense 1 year
    later.
  • Check that new functions are imported in corresponding __init__.py.
  • Check that new features, API changes, and deprecations are mentioned in
    doc/release/release_dev.rst.

@pep8speaks
Copy link

Hello @BierretA! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 421:80: E501 line too long (83 > 79 characters)

Line 313:13: E741 ambiguous variable name 'I'
Line 333:13: E741 ambiguous variable name 'I'
Line 405:13: E741 ambiguous variable name 'I'
Line 425:13: E741 ambiguous variable name 'I'

Line 44:80: E501 line too long (110 > 79 characters)
Line 46:80: E501 line too long (109 > 79 characters)
Line 47:80: E501 line too long (110 > 79 characters)
Line 48:80: E501 line too long (109 > 79 characters)
Line 49:80: E501 line too long (109 > 79 characters)
Line 50:80: E501 line too long (110 > 79 characters)
Line 51:80: E501 line too long (109 > 79 characters)
Line 52:80: E501 line too long (109 > 79 characters)
Line 55:80: E501 line too long (111 > 79 characters)
Line 58:80: E501 line too long (111 > 79 characters)
Line 61:80: E501 line too long (111 > 79 characters)
Line 64:80: E501 line too long (111 > 79 characters)
Line 66:80: E501 line too long (110 > 79 characters)
Line 67:80: E501 line too long (109 > 79 characters)
Line 68:80: E501 line too long (110 > 79 characters)
Line 70:80: E501 line too long (109 > 79 characters)
Line 71:80: E501 line too long (110 > 79 characters)
Line 72:80: E501 line too long (109 > 79 characters)
Line 73:80: E501 line too long (109 > 79 characters)
Line 74:80: E501 line too long (110 > 79 characters)
Line 75:80: E501 line too long (109 > 79 characters)
Line 76:80: E501 line too long (109 > 79 characters)
Line 79:80: E501 line too long (111 > 79 characters)
Line 82:80: E501 line too long (111 > 79 characters)
Line 85:80: E501 line too long (111 > 79 characters)
Line 88:80: E501 line too long (111 > 79 characters)
Line 89:80: E501 line too long (110 > 79 characters)
Line 91:80: E501 line too long (109 > 79 characters)

Copy link
Member

@mkcor mkcor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exciting addition, thanks!

The name of the illuminant (the function is NOT case sensitive).
observer : {"2", "10"}, optional
observer : {"2", "10", "R"}, optional
The aperture angle of the observer.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The aperture angle of the observer.
One of: 2-degree observer, 10-degree observer, or 'R' observer as in
R function grDevices::convertColor.

The name of the illuminant (the function is NOT case sensitive).
observer : {"2", "10"}, optional
observer : {"2", "10", "R"}, optional
The aperture angle of the observer.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update here as well, etc.

@BierretA
Copy link
Contributor Author

Unit tests work on my system but not with github actions.
It looks likes some tests fail because Pooch cannot fetch the new data files. I do not know why though.

Base automatically changed from master to main February 18, 2021 18:23
@mkcor
Copy link
Member

mkcor commented Feb 25, 2021

Hello @BierretA,

It definitely looks like an issue with Pooch via GitHub Actions (or vice versa). Tests run fine locally for me as well. Looking into the first failure (TestColorconv.test_lab2xyz), we can see that, over GitHub Actions, Pooch is attempting the following

Downloading file 'color/tests/data/lab_array_a_10.npy' from 'https://github.com/scikit-image/scikit-image/raw/main/skimage/color/tests/data/lab_array_a_10.npy' to '/home/runner/.cache/scikit-image/main'.

Unsurprisingly, the expected file doesn't live at https://github.com/scikit-image/scikit-image/raw/main/skimage/color/tests/data/ (yet) since skimage/color/tests/data/lab_array_a_10.npy ships with this PR!

I know I didn't run into any issue with Pooch when I added data files (#4939 merged on Sep 2, 2020). Actually, it is the first time (with this PR) we've added files in the data registry since we started running tests with GitHub Actions. Indeed, the time sequence goes like this:

I need to dig deeper to find out how Pooch builds paths, unless someone else at @scikit-image/core knows it right away. Thanks!

@stefanv
Copy link
Member

stefanv commented Feb 26, 2021

@mkcor This change was recently made—I hope that's not the culprit.

@mkcor
Copy link
Member

mkcor commented Feb 26, 2021

@mkcor This change was recently made—I hope that's not the culprit.

@stefanv I know, initially I thought about that, but apparently it's a different issue: CI tests initially ran 2 weeks ago, before this change was made, and failed in the same way. Thanks though.

@grlee77 grlee77 added the ⏩ type: Enhancement Improve existing features label Mar 11, 2021
"color/tests/data/luv_array_d75_10.npy": "e1cc70d56eb6789633d4c2a4059b9533f616a7c8592c9bd342403e41d72f45e4",
"color/tests/data/luv_array_d75_2.npy": "07db3bd59bd89de8e5ff62dad786fe5f4b299133495ba9bea30495b375133a98",
"color/tests/data/luv_array_d75_r.npy": "07db3bd59bd89de8e5ff62dad786fe5f4b299133495ba9bea30495b375133a98",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hash must be wrong since it's the same as line above

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh ok, files are the same

"color/tests/data/luv_array_d75_10.npy": "e1cc70d56eb6789633d4c2a4059b9533f616a7c8592c9bd342403e41d72f45e4",
"color/tests/data/luv_array_d75_2.npy": "07db3bd59bd89de8e5ff62dad786fe5f4b299133495ba9bea30495b375133a98",
"color/tests/data/luv_array_d75_r.npy": "07db3bd59bd89de8e5ff62dad786fe5f4b299133495ba9bea30495b375133a98",
"color/tests/data/luv_array_e_10.npy": "41b1037d81b267305ffe9e8e97e0affa9fa54b18e60413b01b8f11861cb32213",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hash must be wrong since it's the same as below

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh ok, files are the same

"color/tests/data/luv_array_e_2.npy": "41b1037d81b267305ffe9e8e97e0affa9fa54b18e60413b01b8f11861cb32213",
"color/tests/data/luv_array_e_r.npy": "41b1037d81b267305ffe9e8e97e0affa9fa54b18e60413b01b8f11861cb32213",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hash must be wrong since it's the same as above

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh ok, files are the same

Copy link
Member

@hmaarrfk hmaarrfk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR looks solid.

The only thing missing is a release note, but we don't have a good place to put them.

@hmaarrfk
Copy link
Member

i'm not too worried about the failing tests.

The data is in the right place, and the registry looks great. Thanks for the addition! and the thoroughness!

@mkcor
Copy link
Member

mkcor commented Mar 22, 2021

@hmaarrfk this PR needs a little clean-up before merging (wrt lab_B_2.npy , luv_array_d75_r, luv_array_e_r.npy luv_array_e_10.npy as I pointed out, see also my code review comments). But I agree that, conceptually, it would be fine to merge since tests would pass on main.

I think we can have a clean, linear (sequential) commit history by re-doing the addition of 'new illuminants' from a clean slate, which I have started with #5276. Then, we can document the process as @stefanv suggested, so that each PR (submitted in the proper order) can pass all CI tests.

@hmaarrfk
Copy link
Member

I think the commit history cleanup is superfluous. We can squash and merge on our end. No need to push that effort onto @BierretA .

The other cleanup is all worthwhile

@mkcor
Copy link
Member

mkcor commented Mar 22, 2021

No need to push that effort onto @BierretA

@hmaarrfk totally!! Couldn't agree more, that's why I offered to take over at #5276 -- I just forgot to declare @BierretA as a co-author when committing, sorry about that. Will do in subsequent, related commits.

@alexdesiqueira
Copy link
Member

Assuming that #5308 continues the work started here, and that one was merged, I am closing this one. Thank you @mkcor @BierretA @hmaarrfk for your work!

@stefanv
Copy link
Member

stefanv commented Apr 26, 2021

Thank you @BierretA!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⏩ type: Enhancement Improve existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants