From 8f27fc99820482bc6d6a650cb4aadd8d4da6b8fa Mon Sep 17 00:00:00 2001 From: Gregory Ashton <gregory.ashton@ligo.org> Date: Wed, 19 Oct 2016 18:53:22 +0200 Subject: [PATCH] Add functionality to plot the mismatch in the grid search --- pyfstat.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pyfstat.py b/pyfstat.py index dea022d..c3a9adf 100755 --- a/pyfstat.py +++ b/pyfstat.py @@ -1607,7 +1607,8 @@ class GridSearch(BaseSearchClass): def plot_2D(self, xkey, ykey, ax=None, save=True, vmin=None, vmax=None, add_mismatch=None, xN=None, yN=None, flat_keys=[], - rel_flat_idxs=[], flatten_method=np.max): + rel_flat_idxs=[], flatten_method=np.max, + predicted_twoF=None, cm=None): """ Plots a 2D grid of 2F values Parameters @@ -1636,7 +1637,15 @@ class GridSearch(BaseSearchClass): if len(rel_flat_idxs) > 0: Z = flatten_method(Z, axis=tuple(rel_flat_idxs)) - pax = ax.pcolormesh(X, Y, Z, cmap=plt.cm.viridis, vmin=vmin, vmax=vmax) + if predicted_twoF: + Z = (predicted_twoF - Z) / (predicted_twoF + 4) + if cm is None: + cm = plt.cm.viridis_r + else: + if cm is None: + cm = plt.cm.viridis + + pax = ax.pcolormesh(X, Y, Z, cmap=cm, vmin=vmin, vmax=vmax) plt.colorbar(pax, ax=ax) if add_mismatch: -- GitLab