polishing
This commit is contained in:
parent
1c03bd157f
commit
e81b67e964
|
@ -234,6 +234,7 @@ class Colormap(mpl.colors.ListedColormap):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _export_GOM(colormap,fhandle=None):
|
def _export_GOM(colormap,fhandle=None):
|
||||||
|
"""Write colormap to GOM Aramis compatible format."""
|
||||||
# ToDo: test in GOM
|
# ToDo: test in GOM
|
||||||
GOM_str = f'1 1 {colormap.name.replace(" ","_")} 9 {colormap.name.replace(" ","_")} ' \
|
GOM_str = f'1 1 {colormap.name.replace(" ","_")} 9 {colormap.name.replace(" ","_")} ' \
|
||||||
+ '0 1 0 3 0 0 -1 9 \\ 0 0 0 255 255 255 0 0 255 ' \
|
+ '0 1 0 3 0 0 -1 9 \\ 0 0 0 255 255 255 0 0 255 ' \
|
||||||
|
@ -249,6 +250,7 @@ class Colormap(mpl.colors.ListedColormap):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _export_gmsh(colormap,fhandle=None):
|
def _export_gmsh(colormap,fhandle=None):
|
||||||
|
"""Write colormap to Gmsh compatible format."""
|
||||||
# ToDo: test in gmsh
|
# ToDo: test in gmsh
|
||||||
gmsh_str = 'View.ColorTable = {\n' \
|
gmsh_str = 'View.ColorTable = {\n' \
|
||||||
+'\n'.join([f'{c[0]},{c[1]},{c[2]},' for c in colormap.colors[:,:3]*255]) \
|
+'\n'.join([f'{c[0]},{c[1]},{c[2]},' for c in colormap.colors[:,:3]*255]) \
|
||||||
|
|
|
@ -82,7 +82,7 @@ class TestColormap:
|
||||||
@pytest.mark.parametrize('format,name',[('ASCII','test.txt'),
|
@pytest.mark.parametrize('format,name',[('ASCII','test.txt'),
|
||||||
('paraview','test.json'),
|
('paraview','test.json'),
|
||||||
('GOM','test.legend'),
|
('GOM','test.legend'),
|
||||||
('gmsh','test.xxx')
|
('gmsh','test.msh')
|
||||||
])
|
])
|
||||||
def test_write_filehandle(self,format,name,tmpdir):
|
def test_write_filehandle(self,format,name,tmpdir):
|
||||||
c = Colormap.from_predefined('Dark2')
|
c = Colormap.from_predefined('Dark2')
|
||||||
|
@ -111,7 +111,6 @@ class TestColormap:
|
||||||
np.allclose(c_1.colors,c_2.reversed().colors)
|
np.allclose(c_1.colors,c_2.reversed().colors)
|
||||||
|
|
||||||
def test_list(self):
|
def test_list(self):
|
||||||
c = Colormap.from_predefined('afmhot').reversed()
|
Colormap.list_predefined()
|
||||||
c.list_predefined()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue