give default directly
only Colormap object caused problem (tab completion triggered '__repr__' which means showing colormap in maplotlib window
This commit is contained in:
parent
73f01c07d0
commit
c4a7c0096a
|
@ -688,7 +688,7 @@ class Grid:
|
|||
|
||||
|
||||
def show(self,
|
||||
colormap: Union[Colormap, str] = None) -> None:
|
||||
colormap: Union[Colormap, str] = 'cividis') -> None:
|
||||
"""
|
||||
Show on screen.
|
||||
|
||||
|
|
|
@ -503,7 +503,7 @@ class VTK:
|
|||
|
||||
def show(self,
|
||||
label: str = None,
|
||||
colormap: Union[Colormap, str] = None):
|
||||
colormap: Union[Colormap, str] = 'cividis'):
|
||||
"""
|
||||
Render.
|
||||
|
||||
|
@ -535,9 +535,8 @@ class VTK:
|
|||
height = 768
|
||||
|
||||
lut = vtk.vtkLookupTable()
|
||||
colormap_ = Colormap.from_predefined('cividis') if colormap is None \
|
||||
else Colormap.from_predefined(colormap) if isinstance(colormap,str) \
|
||||
else colormap
|
||||
colormap_ = Colormap.from_predefined(colormap) if isinstance(colormap,str) else \
|
||||
colormap
|
||||
lut.SetNumberOfTableValues(len(colormap_.colors))
|
||||
for i,c in enumerate(colormap_.colors):
|
||||
lut.SetTableValue(i,c if len(c)==4 else np.append(c,1.0))
|
||||
|
|
|
@ -43,7 +43,7 @@ class TestGrid:
|
|||
print('patched datetime.datetime.now')
|
||||
|
||||
|
||||
@pytest.mark.parametrize('cmap',[Colormap.from_predefined('cividis'),'cividis',None])
|
||||
@pytest.mark.parametrize('cmap',[Colormap.from_predefined('stress'),'viridis'])
|
||||
def test_show(sef,default,cmap,monkeypatch):
|
||||
monkeypatch.delenv('DISPLAY',raising=False)
|
||||
default.show(cmap)
|
||||
|
|
|
@ -30,7 +30,7 @@ class TestVTK:
|
|||
def _patch_execution_stamp(self, patch_execution_stamp):
|
||||
print('patched damask.util.execution_stamp')
|
||||
|
||||
@pytest.mark.parametrize('cmap',[Colormap.from_predefined('cividis'),'cividis',None])
|
||||
@pytest.mark.parametrize('cmap',[Colormap.from_predefined('cividis'),'strain'])
|
||||
def test_show(sef,default,cmap,monkeypatch):
|
||||
monkeypatch.delenv('DISPLAY',raising=False)
|
||||
default.show(colormap=cmap)
|
||||
|
|
Loading…
Reference in New Issue