aboutsummaryrefslogtreecommitdiff
path: root/processing/cmap_comparison.py
blob: 03b9a11b759727e2cea6f5f897f957bdf8cf01fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import os

import matplotlib.pyplot as plt
from matplotlib import cm

import WrightTools as wt
from WrightTools import datasets

here = os.path.abspath(os.path.dirname(__file__))

fig, gs = wt.artists.create_figure(width='double', cols=[1, 1, 'cbar'], nrows=2)

p = datasets.COLORS.v2p1_MoS2_TrEE_movie
data = wt.data.from_COLORS(p, verbose=False)
data.level(0, 2, -3)
data.convert('eV')
data.ai0.symmetric_root(0.5)
data = data.chop('w1=wm', 'w2', at={'d2': [-600, 'fs']})[0]
data.ai0.normalize()


def fill_row(row, cmap):
    # greyscale
    ax = plt.subplot(gs[row, 0])
    ax.pcolor(data, cmap=wt.artists.grayify_cmap(cmap))
    # color
    ax = plt.subplot(gs[row, 1])
    ax.pcolor(data, cmap=cmap)
    # cbar
    cax = plt.subplot(gs[row, 2])
    wt.artists.plot_colorbar(cax=cax, label='amplitude', cmap=cmap)


cmap = wt.artists.colormaps['default']
fill_row(0, cmap)
cmap = wt.artists.colormaps['wright']
fill_row(1, cmap)

# label
wt.artists.set_fig_labels(xlabel=data.w1__e__wm.label, ylabel=data.w2.label)

# save
p = os.path.join(here, 'cmap_comparison.png')
wt.artists.savefig(p)