polishing

This commit is contained in:
Martin Diehl 2020-06-28 10:32:59 +02:00
parent 1c03bd157f
commit e81b67e964
2 changed files with 4 additions and 3 deletions

View File

@ -234,6 +234,7 @@ class Colormap(mpl.colors.ListedColormap):
@staticmethod
def _export_GOM(colormap,fhandle=None):
"""Write colormap to GOM Aramis compatible format."""
# ToDo: test in GOM
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 ' \
@ -249,6 +250,7 @@ class Colormap(mpl.colors.ListedColormap):
@staticmethod
def _export_gmsh(colormap,fhandle=None):
"""Write colormap to Gmsh compatible format."""
# ToDo: test in gmsh
gmsh_str = 'View.ColorTable = {\n' \
+'\n'.join([f'{c[0]},{c[1]},{c[2]},' for c in colormap.colors[:,:3]*255]) \

View File

@ -82,7 +82,7 @@ class TestColormap:
@pytest.mark.parametrize('format,name',[('ASCII','test.txt'),
('paraview','test.json'),
('GOM','test.legend'),
('gmsh','test.xxx')
('gmsh','test.msh')
])
def test_write_filehandle(self,format,name,tmpdir):
c = Colormap.from_predefined('Dark2')
@ -111,7 +111,6 @@ class TestColormap:
np.allclose(c_1.colors,c_2.reversed().colors)
def test_list(self):
c = Colormap.from_predefined('afmhot').reversed()
c.list_predefined()
Colormap.list_predefined()