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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
"""Bandwidth comparison between Singh & Czech."""
# --- import --------------------------------------------------------------------------------------
import os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import WrightTools as wt
from WrightTools import datasets
# --- define --------------------------------------------------------------------------------------
here = os.path.abspath(os.path.dirname(__file__))
# --- workspace -----------------------------------------------------------------------------------
fig, gs = wt.artists.create_figure(cols=[1, 'cbar'])
ax = plt.subplot(gs[0, 0])
# get data
ps = datasets.COLORS.v2p1_MoS2_TrEE_movie
data = wt.data.from_COLORS(ps)
data.convert('eV', convert_variables=True)
data.ai0.signed = False
data.ai0.clip(min=0, replace='value')
data = data.chop('w1=wm', 'w2', at={'d2': [-80, 'fs']})[0]
# czech
ax.pcolor(data)
# singh
edges = np.array([1660, 1610], dtype=np.float64) # meV
edges = wt.units.converter(edges, 'meV', 'eV')
corner = min(edges)
width = abs(edges[1] - edges[0])
rectangle = patches.Rectangle((corner, corner), width, width, fc='m')
ax.add_patch(rectangle)
# decoration
ax.set_xlim(corner, data.w1.max())
ax.set_ylim(corner, data.w2.max())
wt.artists.set_ax_labels(ax=ax, xlabel=data.w1__e__wm.label, ylabel=data.w2.label)
ax.grid()
wt.artists.diagonal_line()
# colorbar
cax = plt.subplot(gs[0, -1])
wt.artists.plot_colorbar(cax=cax, label='intensity')
# save
p = os.path.join(here, 'singh_czech.png')
plt.savefig(p, bbox_inches='tight')
|