Commit 1191ecc2 authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Minor improvements to general running

1) Adds check if the truths are not of the correct length (to prevent
corner.corner error)
2) Improve sliding window labels
3) Adds option to plot gps seconds on the sliding window
parent 6d8c913e
...@@ -399,7 +399,7 @@ class FrequencySlidingWindow(GridSearch): ...@@ -399,7 +399,7 @@ class FrequencySlidingWindow(GridSearch):
self.input_data = np.array(input_data) self.input_data = np.array(input_data)
def plot_sliding_window(self, F0=None, ax=None, savefig=True, def plot_sliding_window(self, F0=None, ax=None, savefig=True,
colorbar=True): colorbar=True, timestamps=False):
data = self.data data = self.data
if ax is None: if ax is None:
ax = plt.subplot() ax = plt.subplot()
...@@ -411,7 +411,7 @@ class FrequencySlidingWindow(GridSearch): ...@@ -411,7 +411,7 @@ class FrequencySlidingWindow(GridSearch):
dts = (tmids - self.minStartTime) / 86400. dts = (tmids - self.minStartTime) / 86400.
if F0: if F0:
frequencies = frequencies - F0 frequencies = frequencies - F0
ax.set_ylabel('Frequency - $f_0$ [Hz]') ax.set_ylabel('Frequency - $f_0$ [Hz] \n $f_0={:0.2f}$'.format(F0))
else: else:
ax.set_ylabel('Frequency [Hz]') ax.set_ylabel('Frequency [Hz]')
twoF = twoF.reshape((len(tmids), len(frequencies))) twoF = twoF.reshape((len(tmids), len(frequencies)))
...@@ -421,10 +421,17 @@ class FrequencySlidingWindow(GridSearch): ...@@ -421,10 +421,17 @@ class FrequencySlidingWindow(GridSearch):
cb = plt.colorbar(pax, ax=ax) cb = plt.colorbar(pax, ax=ax)
cb.set_label('$2\mathcal{F}$') cb.set_label('$2\mathcal{F}$')
ax.set_xlabel( ax.set_xlabel(
r'Days from $t_\mathrm{{start}}$={}'.format(self.minStartTime)) r'Mid-point (days after $t_\mathrm{{start}}$={})'.format(
self.minStartTime))
ax.set_title( ax.set_title(
'Sliding window length = {} days in increments of {} days' 'Sliding window length = {} days in increments of {} days'
.format(self.window_size/86400, self.window_delta/86400)) .format(self.window_size/86400, self.window_delta/86400),
)
if timestamps:
axT = ax.twiny()
axT.set_xlim(tmids[0]*1e-9, tmids[-1]*1e-9)
axT.set_xlabel('Mid-point timestamp [GPS $10^{9}$ s]')
ax.set_title(ax.get_title(), y=1.18)
if savefig: if savefig:
plt.tight_layout() plt.tight_layout()
plt.savefig( plt.savefig(
......
...@@ -544,6 +544,10 @@ class MCMCSearch(core.BaseSearchClass): ...@@ -544,6 +544,10 @@ class MCMCSearch(core.BaseSearchClass):
""" """
if 'truths' in kwargs and len(kwargs['truths']) != self.ndim:
logging.warning('len(Truths) != ndim, Truths will be ignored')
kwargs['truths'] = None
if self.ndim < 2: if self.ndim < 2:
with plt.rc_context(rc_context): with plt.rc_context(rc_context):
if fig_and_axes is None: if fig_and_axes is None:
......
Supports Markdown
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