Skip to content

Commit 229483b

Browse files
committed
Add Paraview colormaps
1 parent 95e1ca9 commit 229483b

File tree

4 files changed

+147
-2
lines changed

4 files changed

+147
-2
lines changed

ipygany/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# Copyright (c) Martin Renou.
55
# Distributed under the terms of the Modified BSD License.
66

7+
from .colormaps import colormaps
78
from .ipygany import ( # noqa
89
PolyMesh, TetraMesh, PointCloud,
910
Scene,

ipygany/colormaps.py

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
from traitlets.utils.bunch import Bunch
2+
3+
colormaps = Bunch(
4+
Cool_to_Warm='Cool to Warm',
5+
Cool_to_Warm_Extended='Cool to Warm (Extended)',
6+
Black_Body_Radiation='Black-Body Radiation',
7+
X_Ray='X Ray',
8+
Inferno='Inferno (matplotlib)',
9+
Black_Blue_White='Black, Blue and White',
10+
Blue_Orange='Blue Orange (divergent)',
11+
Viridis='Viridis (matplotlib)',
12+
Gray_Red='Gray and Red',
13+
Linear_Green='Linear Green (Gr4L)',
14+
Cold_Hot='Cold and Hot',
15+
Blue_Green_Orange='Blue - Green - Orange',
16+
Rainbow_Desaturated='Rainbow Desaturated',
17+
Yellow_Gray_Blue='Yellow - Gray - Blue',
18+
Rainbow_Uniform='Rainbow Uniform',
19+
Jet='jet',
20+
Warm_to_Cool='Warm to Cool',
21+
Warm_to_Cool_Extended='Warm to Cool (Extended)',
22+
Grayscale='Grayscale',
23+
Black_Orange_White='Black, Orange and White',
24+
Linear_YGB='Linear YGB 1211g',
25+
Linear_Blue='Linear Blue (8_31f)',
26+
Blue_to_Red_Rainbow='Blue to Red Rainbow',
27+
Red_to_Blue_Rainbow='Red to Blue Rainbow',
28+
Rainbow_Blended_White='Rainbow Blended White',
29+
Rainbow_Blended_Grey='Rainbow Blended Grey',
30+
Rainbow_Blended_Black='Rainbow Blended Black',
31+
Blue_to_Yellow='Blue to Yellow',
32+
Blot='blot',
33+
CIELab_Blue_to_Red='CIELab Blue to Red',
34+
Rainbow='rainbow',
35+
ERDC_rainbow_bright='erdc_rainbow_bright',
36+
ERDC_rainbow_dark='erdc_rainbow_dark',
37+
NIC_CubicL='nic_CubicL',
38+
NIC_CubicYF='nic_CubicYF',
39+
Gist_earth='gist_earth',
40+
TWOhot='2hot',
41+
ERDC_red2yellow_BW='erdc_red2yellow_BW',
42+
ERDC_marine2gold_BW='erdc_marine2gold_BW',
43+
ERDC_blue2gold_BW='erdc_blue2gold_BW',
44+
ERDC_sapphire2gold_BW='erdc_sapphire2gold_BW',
45+
ERDC_red2purple_BW='erdc_red2purple_BW',
46+
ERDC_purple2pink_BW='erdc_purple2pink_BW',
47+
ERDC_pbj_lin='erdc_pbj_lin',
48+
ERDC_blue2green_muted='erdc_blue2green_muted',
49+
ERDC_blue2green_BW='erdc_blue2green_BW',
50+
GREEN_WHITE_LINEAR='GREEN-WHITE_LINEAR',
51+
ERDC_green2yellow_BW='erdc_green2yellow_BW',
52+
Blue2cyan='blue2cyan',
53+
ERDC_blue2cyan_BW='erdc_blue2cyan_BW',
54+
ERDC_blue_BW='erdc_blue_BW',
55+
BLUE_WHITE='BLUE-WHITE',
56+
ERDC_purple_BW='erdc_purple_BW',
57+
ERDC_magenta_BW='erdc_magenta_BW',
58+
Magenta='magenta',
59+
RED_PURPLE='RED-PURPLE',
60+
ERDC_red_BW='erdc_red_BW',
61+
RED_TEMPERATURE='RED_TEMPERATURE',
62+
ERDC_orange_BW='erdc_orange_BW',
63+
Heated_object='heated_object',
64+
ERDC_gold_BW='erdc_gold_BW',
65+
ERDC_brown_BW='erdc_brown_BW',
66+
Copper_Matlab='copper_Matlab',
67+
Pink_Matlab='pink_Matlab',
68+
Bone_Matlab='bone_Matlab',
69+
Gray_Matlab='gray_Matlab',
70+
Purples='Purples',
71+
Blues='Blues',
72+
Greens='Greens',
73+
PuBu='PuBu',
74+
BuPu='BuPu',
75+
BuGn='BuGn',
76+
GnBu='GnBu',
77+
GnBuPu='GnBuPu',
78+
BuGnYl='BuGnYl',
79+
PuRd='PuRd',
80+
RdPu='RdPu',
81+
Oranges='Oranges',
82+
Reds='Reds',
83+
RdOr='RdOr',
84+
BrOrYl='BrOrYl',
85+
RdOrYl='RdOrYl',
86+
CIELab_blue2red='CIELab_blue2red',
87+
Blue2yellow='blue2yellow',
88+
ERDC_blue2gold='erdc_blue2gold',
89+
ERDC_blue2yellow='erdc_blue2yellow',
90+
ERDC_cyan2orange='erdc_cyan2orange',
91+
ERDC_purple2green='erdc_purple2green',
92+
ERDC_purple2green_dark='erdc_purple2green_dark',
93+
Coolwarm='coolwarm',
94+
BuRd='BuRd',
95+
Spectral_lowBlue='Spectral_lowBlue',
96+
GnRP='GnRP',
97+
GYPi='GYPi',
98+
GnYlRd='GnYlRd',
99+
GBBr='GBBr',
100+
PuOr='PuOr',
101+
PRGn='PRGn',
102+
PiYG='PiYG',
103+
OrPu='OrPu',
104+
BrBG='BrBG',
105+
ERDC_divHi_purpleGreen='erdc_divHi_purpleGreen',
106+
ERDC_divHi_purpleGreen_dim='erdc_divHi_purpleGreen_dim',
107+
ERDC_divLow_icePeach='erdc_divLow_icePeach',
108+
ERDC_divLow_purpleGreen='erdc_divLow_purpleGreen',
109+
Haze_green='Haze_green',
110+
Haze_lime='Haze_lime',
111+
Haze='Haze',
112+
Haze_cyan='Haze_cyan',
113+
NIC_Edge='nic_Edge',
114+
ERDC_iceFire_H='erdc_iceFire_H',
115+
ERDC_iceFire_L='erdc_iceFire_L',
116+
HSV='hsv',
117+
Hue_L60='hue_L60',
118+
GyRd='GyRd',
119+
Muted_Blue_Green='Muted Blue-Green',
120+
Green_Blue_Asymmetric_Divergent='Green-Blue Asymmetric Divergent (62Blbc)',
121+
Asymmtrical_Earth_Tones='Asymmtrical Earth Tones (6_21b)',
122+
Yellow_15='Yellow 15',
123+
Magma='Magma (matplotlib)',
124+
Plasma='Plasma (matplotlib)',
125+
KAAMS_Step='KAAMS Step',
126+
Spectrum_Step='Spectrum Step',
127+
Warm_Step='Warm Step',
128+
Cool_Step='Cool Step',
129+
Blues_Step='Blues Step',
130+
Wild_Flower_Step='Wild Flower Step',
131+
Citrus_Step='Citrus Step',
132+
Traffic_Lights_Step='Traffic Lights Step',
133+
Traffic_Lights_For_Deuteranopes_Step='Traffic Lights For Deuteranopes Step',
134+
Traffic_Lights_For_Deuteranopes_2_Step='Traffic Lights For Deuteranopes 2 Step'
135+
)

ipygany/ipygany.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import numpy as np
66

77
from traitlets import (
8-
Bool, Dict, Unicode, List, Instance, CFloat, Tuple, TraitError, Union, default, validate
8+
Bool, Dict, Enum, Unicode, List, Instance, CFloat, Tuple, TraitError, Union, default, validate
99
)
1010
from traittypes import Array
1111
from ipywidgets import (
@@ -18,6 +18,8 @@
1818

1919
from ._frontend import module_version, module_name
2020

21+
from .colormaps import colormaps
22+
2123
FLOAT32 = 'f'
2224
UINT32 = 'I'
2325

@@ -576,6 +578,8 @@ class IsoColor(Effect):
576578
min = CFloat(0.).tag(sync=True)
577579
max = CFloat(0.).tag(sync=True)
578580

581+
colormap = Enum(list(colormaps.keys()), allow_none=False, default_value=colormaps.Black_Body_Radiation).tag(sync=True)
582+
579583
@property
580584
def input_dim(self):
581585
"""Input dimension."""

src/widget.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,21 +508,26 @@ class IsoColorModel extends EffectModel {
508508
return this.get('max');
509509
}
510510

511+
get colormap () : string {
512+
return this.get('colormap');
513+
}
514+
511515
get input () {
512516
const input = this.get('input');
513517

514518
return typeof input == 'string' ? input : [input];
515519
}
516520

517521
createBlock () {
518-
return new IsoColor(this.parent.block, this.input, this.min, this.max);
522+
return new IsoColor(this.parent.block, this.input, this.min, this.max, this.colormap);
519523
}
520524

521525
initEventListeners () : void {
522526
super.initEventListeners();
523527

524528
this.on('change:min', () => { this.block.min = this.min; });
525529
this.on('change:max', () => { this.block.max = this.max; });
530+
this.on('change:colormap', () => { this.block.colorMap = this.colormap; });
526531
}
527532

528533
block: IsoColor;

0 commit comments

Comments
 (0)