From d29370edbb0eeb56ec3aabff437c048b7d9ee178 Mon Sep 17 00:00:00 2001 From: Blaise Thompson Date: Mon, 26 Mar 2018 17:49:30 -0500 Subject: 2018-03-26 17:49 --- processing/cmap_comparison.py | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 processing/cmap_comparison.py (limited to 'processing/cmap_comparison.py') diff --git a/processing/cmap_comparison.py b/processing/cmap_comparison.py new file mode 100644 index 0000000..03b9a11 --- /dev/null +++ b/processing/cmap_comparison.py @@ -0,0 +1,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) -- cgit v1.2.3