Commit 40270371 authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Update grid plot to have offsets

parent a42f0b0a
...@@ -183,7 +183,7 @@ class GridSearch(BaseSearchClass): ...@@ -183,7 +183,7 @@ class GridSearch(BaseSearchClass):
def plot_2D(self, xkey, ykey, ax=None, save=True, vmin=None, vmax=None, def plot_2D(self, xkey, ykey, ax=None, save=True, vmin=None, vmax=None,
add_mismatch=None, xN=None, yN=None, flat_keys=[], add_mismatch=None, xN=None, yN=None, flat_keys=[],
rel_flat_idxs=[], flatten_method=np.max, title=None, rel_flat_idxs=[], flatten_method=np.max, title=None,
predicted_twoF=None, cm=None, cbarkwargs={}): predicted_twoF=None, cm=None, cbarkwargs={}, x0=None, y0=None):
""" Plots a 2D grid of 2F values """ Plots a 2D grid of 2F values
Parameters Parameters
...@@ -201,7 +201,11 @@ class GridSearch(BaseSearchClass): ...@@ -201,7 +201,11 @@ class GridSearch(BaseSearchClass):
flat_idxs = [self.keys.index(k) for k in flat_keys] flat_idxs = [self.keys.index(k) for k in flat_keys]
x = np.unique(self.data[:, xidx]) x = np.unique(self.data[:, xidx])
if x0:
x = x-x0
y = np.unique(self.data[:, yidx]) y = np.unique(self.data[:, yidx])
if y0:
y = y-y0
flat_vals = [np.unique(self.data[:, j]) for j in flat_idxs] flat_vals = [np.unique(self.data[:, j]) for j in flat_idxs]
z = self.data[:, -1] z = self.data[:, -1]
...@@ -230,8 +234,15 @@ class GridSearch(BaseSearchClass): ...@@ -230,8 +234,15 @@ class GridSearch(BaseSearchClass):
ax.set_xlim(x[0], x[-1]) ax.set_xlim(x[0], x[-1])
ax.set_ylim(y[0], y[-1]) ax.set_ylim(y[0], y[-1])
labels = {'F0': '$f$', 'F1': '$\dot{f}$'} labels = {'F0': '$f$', 'F1': '$\dot{f}$'}
ax.set_xlabel(labels[xkey]) labels0 = {'F0': '$-f_0$', 'F1': '$-\dot{f}_0$'}
ax.set_ylabel(labels[ykey]) if x0:
ax.set_xlabel(labels[xkey]+labels0[xkey])
else:
ax.set_xlabel(labels[xkey])
if y0:
ax.set_ylabel(labels[ykey]+labels0[ykey])
else:
ax.set_ylabel(labels[ykey])
if title: if title:
ax.set_title(title) ax.set_title(title)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment