From 5aa9d5e00d28c91190a2c07866bb0139275133e3 Mon Sep 17 00:00:00 2001 From: Blaise Thompson Date: Mon, 26 Mar 2018 22:34:02 -0500 Subject: 2018-03-26 22:34 --- processing/join_example.py | 64 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 processing/join_example.py (limited to 'processing/join_example.py') diff --git a/processing/join_example.py b/processing/join_example.py new file mode 100644 index 0000000..ce1e18e --- /dev/null +++ b/processing/join_example.py @@ -0,0 +1,64 @@ +"""Join example.""" + + +# --- import -------------------------------------------------------------------------------------- + + +import os + +import WrightTools as wt + +import numpy as np + +import matplotlib.pyplot as plt + + +# --- define and import --------------------------------------------------------------------------- + + +here = os.path.abspath(os.path.dirname(__file__)) + +p = os.path.join(here, 'MX2_TSF.wt5') +root = wt.open(p) +divided = root.processed_tsf.divided_tsf + +def individual_plotter(gs, d, j): + ax = plt.subplot(gs[0,j]) + ax.pcolor(d) + ax.grid() + wt.artists.set_ax_labels(ax=ax, xlabel=d.w1.label, ylabel=d.w2.label) + + # join +ds = [divided[0], divided[1], divided[2]] +joined = wt.data.join(ds, parent=divided, ) +# pretty up indivudal +for d in ds: + d.transform('w1', 'w2') + d.sig.clip(0,4) +# pretty up joined +joined.sig.clip(0,4) +joined.transform('w1', 'w2') + + +# --- workspace ----------------------------------------------------------------------------------- + + +# instantiate figure +fig, gs = wt.artists.create_figure(width='double', nrows=3, cols=[1,'cbar',1,'cbar',1,'cbar'], hspace=.75, wspace=.35) +# plot indiviudal data +d = divided[0] +individual_plotter(gs, d, 0) +d = divided[1] +individual_plotter(gs, d, 2) +d = divided[2] +individual_plotter(gs, d, 4) +# plot joined data +ax = plt.subplot(gs[1:,:-1]) +ax.pcolor(joined) +ax.grid() +wt.artists.set_ax_labels(ax=ax, xlabel=d.w1.label, ylabel=d.w2.label) +# colorbar +cax = plt.subplot(gs[:,-1]) +ticks = np.linspace(joined.sig.min(), joined.sig.max(), 11) +label = 'TSF amplitude' +wt.artists.plot_colorbar(cax=cax, ticks=ticks, label=label) -- cgit v1.2.3