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

Update colorcet to upstream, especially new Gouldian Parula replacement #56

Closed
randallpittman opened this issue Jan 15, 2021 · 1 comment · Fixed by #65
Closed

Update colorcet to upstream, especially new Gouldian Parula replacement #56

randallpittman opened this issue Jan 15, 2021 · 1 comment · Fixed by #65
Assignees
Milestone

Comments

@randallpittman
Copy link
Contributor

Changes in upstream CSVs:

New

  • C3 - Cyclic: white - red - black - blue
  • C6 - "Six colour cyclic with primaries and secondaries matched in lightness"
  • C7 - Cyclic Yellow - Magenta - Cyan - Green - Yellow
  • L20 - Parula replacement "Gouldian"
  • R4 - Rainbow colour map from blue to red

Changed

  • D1-D9, L1-L9 renamed to D01-D09, L01-L09
  • Floats have higher precision

There actually look to be even more in colorcet.m, I guess that's the ultimate canonical source?

I'm a bit unsure how to integrate these changes into CET_to_py.py, especially the D01-D09 and L01-09 stuff. Or maybe this project keeps the original CSV names?

@jbednar
Copy link
Member

jbednar commented Jan 17, 2021

Yes, it would be great to get those new maps. Looks like the names have again changed upstream, and the values have also been truncated to fewer (not more) significant digits, which probably doesn't matter but could conceivably change a color. I'd rather not change any of the existing maps at all, so I'd want to get only the new ones. I've also kept the original naming style for continuity.

I think the steps involved in such a PR would be:

  1. Unpack the new CETperceptual_csv_0_1.zip into assets/CETperceptual_csv_0_1_v3.
  2. If any of the ones in colorcet.m are useful (and not just e.g. stray obsolete versions), make CSVs for them and put them in e.g. assets/colorcet_m_to_csv
  3. Edit assets/CET_to_py.py:
    • Add the new directory(s) to paths
    • Add support for v3 (and colorcet_m) following what's done already for v2 (though it's fairly complicated at first glance!)
    • Add mapping info to mapping, with long names for the short filenames from v3 (not sure where that mapping came from; maybe it's on Peter's website?)
    • Add aliases where appropriate (e.g. wrkb, ymcgy, gouldian, rainbowbr)
  4. Run CET_to_py.py to generate an updated colorcet/__init__.py.
  5. Check the generated colorcet/__init__.py to make sure it didn't mess up any of the existing colormaps and defines the new ones properly, and doesn't somehow get extra copies of all the v1 and v2 maps that are duplicated in v3.
  6. Make a PR with the new CSVs and updated colorcet/__init__.py.

Seems like somehow it didn't need to be this complicated, but I don't see how to simplify it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment