From 6592573cc33f7634dac3143798d004e130b614b9 Mon Sep 17 00:00:00 2001 From: Adeolu Ajayi Date: Wed, 12 Jul 2023 11:21:11 -0500 Subject: [PATCH 1/3] initial commit --- diffpy/snmf/io.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/diffpy/snmf/io.py b/diffpy/snmf/io.py index f666949..5247c0d 100644 --- a/diffpy/snmf/io.py +++ b/diffpy/snmf/io.py @@ -114,3 +114,7 @@ def load_input_signals(file_path=None): grid_vector = np.unique(grid_array, axis=1) values_array = np.column_stack(values_list) return grid_vector, values_array + + +def drawfig(): + pass From bd0739313b67af84f02394bb45479221acf42333 Mon Sep 17 00:00:00 2001 From: Adeolu Ajayi Date: Wed, 12 Jul 2023 13:02:21 -0500 Subject: [PATCH 2/3] draft update --- diffpy/snmf/io.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/diffpy/snmf/io.py b/diffpy/snmf/io.py index 5247c0d..97eaae9 100644 --- a/diffpy/snmf/io.py +++ b/diffpy/snmf/io.py @@ -2,6 +2,10 @@ import scipy.sparse from pathlib import Path from diffpy.utils.parsers.loaddata import loadData +import matplotlib.pyplot as plt +from bg_mpl_stylesheet.bg_mpl_stylesheet import bg_mpl_style + +plt.style.use(bg_mpl_style) def initialize_variables(data_input, component_amount, data_type, sparsity=1, smoothness=1e18): @@ -116,5 +120,13 @@ def load_input_signals(file_path=None): return grid_vector, values_array -def drawfig(): - pass +def drawfig(component_amount): + plt.ion() + fig = plt.figure() + grid = plt.GridSpec(component_amount, 3) + stretching_plot = fig.add_subplot(grid[0, 0]) + weight_plot = fig.add_subplot(grid[1, 0]) + + stretching_plot.plot() + fig.canvas.draw() + plt.show() From d055a8e4825b24fec97dc5aacacfce7ae3b97907 Mon Sep 17 00:00:00 2001 From: Adeolu Ajayi Date: Wed, 12 Jul 2023 14:08:54 -0500 Subject: [PATCH 3/3] update --- diffpy/snmf/io.py | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/diffpy/snmf/io.py b/diffpy/snmf/io.py index 97eaae9..150065d 100644 --- a/diffpy/snmf/io.py +++ b/diffpy/snmf/io.py @@ -120,13 +120,30 @@ def load_input_signals(file_path=None): return grid_vector, values_array -def drawfig(component_amount): +def drawfig(moment_amount, stretching_matrix, weight_matrix, grid_vector): plt.ion() fig = plt.figure() - grid = plt.GridSpec(component_amount, 3) - stretching_plot = fig.add_subplot(grid[0, 0]) - weight_plot = fig.add_subplot(grid[1, 0]) + grid = plt.GridSpec(4, 4) + stretching_plot = fig.add_subplot(grid[0:2, 0:2]) + weight_plot = fig.add_subplot(grid[2:, 0:2]) + component_plot = fig.add_subplot(grid[:, 2:]) + + stretching_plot.plot(stretching_matrix.T) + stretching_plot.set_title("Component Stretching Factors") + stretching_plot.set_xlabel("Moment") + stretching_plot.set_ylabel("Stretching Factor") + + weight_plot.plot(weight_matrix.T) + weight_plot.set_title("Component Weights") + weight_plot.set_ylabel("Weight") + weight_plot.set_xlabel("Moment") + + component_plot.plot(grid_vector, component_plot) + component_plot.set_title("Component Signals") + component_plot.sex_ylabel("g(r)") + component_plot.set_xlabel("r") - stretching_plot.plot() fig.canvas.draw() + fig.canvas.flush_events() + plt.tight_layout() plt.show()