yt-project / cmyt Goto Github PK
View Code? Open in Web Editor NEWyt-native colormaps
License: Other
yt-native colormaps
License: Other
The current implementation allows to import individual cmap objects as
from cmyt import arbre
# or
import cmyt
cmyt.arbre
but it only works with Python>=3.9. This is because I didn't realise that my first implementation was Python-version specific.
On the other hand this could be regarded as an implementation detail since this feature isn't necessary for backwards compatibility in yt, but it's definitely possible to do it in older versions of Python. See e.g. cmasher.
I am currently packaging cmyt for Debian, which is a new dependency of yt 4.0.2. When running the tests, I observed the following failure:
Error: Image dimensions did not match.
Expected shape: (374, 917)
/tmp/tmpz7mck7eo/tests.test_integration.test_from_str_dusk/baseline.png
Actual shape: (372, 917)
/tmp/tmpz7mck7eo/tests.test_integration.test_from_str_dusk/result.png
This happens with all test_from_str
and test_from_obj
tests.
Python: 3.0.10
More-itertools: 8.10.0
Numpy: 1.22.1
Pytest: 6.2.5
Matplotlib: 3.5.1
Pytest-mpl: 0.13
Colorspacious: 1.1.2
Sibling projects (yt, unyt...) are deployed to conda-forge, I think it would make sense to do this as well for cmyt after 1.0.0
I would like to add explicit support for Python 3.12 ahead of the release, but it'll require having both numpy and matplotlib publishing stable wheels for it first.
Due to some mistake in packaging
import cmyt
fails with
ModuleNotFoundError: No module named 'cmyt.colormaps'
cmyt would fit here
https://matplotlib.org/mpl-third-party/#colormaps-and-styles
I'd like to reach cmyt 1.0.0 first
using matplotlib 3.2.0 (current minimal supported version)
import cmyt
crashes with
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/robcleme/dev/yt-project/cmyt/cmyt/__init__.py", line 1, in <module>
from .cm import *
File "/Users/robcleme/dev/yt-project/cmyt/cmyt/cm.py", line 31, in <module>
cmap, cmap_r = register_colormap(name, data)
File "/Users/robcleme/dev/yt-project/cmyt/cmyt/utils.py", line 110, in register_colormap
_register_mpl_cmap(mpl_cmap)
File "/Users/robcleme/dev/yt-project/cmyt/cmyt/utils.py", line 98, in _register_mpl_cmap
matplotlib.cm.register_cmap(cmap=cmap)
AttributeError: module 'matplotlib' has no attribute 'cm'
I get why it breaks, but I'm not sure how this wasn't caught in CI already
I don't think there's any real reason not to support it actually. I think I set the minimal supported version to 3.7 because of some shenenigans related to old versions of matplotlib that currently exist in the original yt code.
To avoid clumping the size of the repo, this should be done in the late stages before the release.
TODO (downstream):
Setting this up could help debugging in the future.
see https://github.com/matplotlib/pytest-mpl
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.