From 3704107125c793cf7f110a37cc56b2a803aece18 Mon Sep 17 00:00:00 2001
From: Gregory Ashton <gregory.ashton@ligo.org>
Date: Sun, 15 Apr 2018 19:48:21 +1000
Subject: [PATCH] Fix up glitch examples for the paper

---
 ...ch_robust_directed_MCMC_search_on_1_glitch.py | 14 +++++++++++---
 ...ch_robust_directed_grid_search_on_1_glitch.py | 16 ++++++++++------
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/examples/glitch_examples/semicoherent_glitch_robust_directed_MCMC_search_on_1_glitch.py b/examples/glitch_examples/semicoherent_glitch_robust_directed_MCMC_search_on_1_glitch.py
index 3178756..345caa9 100644
--- a/examples/glitch_examples/semicoherent_glitch_robust_directed_MCMC_search_on_1_glitch.py
+++ b/examples/glitch_examples/semicoherent_glitch_robust_directed_MCMC_search_on_1_glitch.py
@@ -43,15 +43,23 @@ mcmc = pyfstat.MCMCGlitchSearch(
     nsteps=nsteps, nwalkers=nwalkers, ntemps=ntemps,
     log10beta_min=log10beta_min, nglitch=1)
 mcmc.transform_dictionary['F0'] = dict(
-    subtractor=F0, symbol='$f-f^\mathrm{s}$')
+    subtractor=F0, multiplier=1e6, symbol='$f-f_\mathrm{s}$')
+mcmc.unit_dictionary['F0'] = '$\mu$Hz'
 mcmc.transform_dictionary['F1'] = dict(
-    subtractor=F1, symbol='$\dot{f}-\dot{f}^\mathrm{s}$')
+    subtractor=F1, multiplier=1e12, symbol='$\dot{f}-\dot{f}_\mathrm{s}$')
+mcmc.unit_dictionary['F1'] = '$p$Hz/s'
+mcmc.transform_dictionary['delta_F0'] = dict(
+    multiplier=1e6, subtractor=delta_F0,
+    symbol='$\delta f-\delta f_\mathrm{s}$')
+mcmc.unit_dictionary['delta_F0'] = '$\mu$Hz/s'
+mcmc.transform_dictionary['tglitch']['subtractor'] = tstart + dtglitch
+mcmc.transform_dictionary['tglitch']['label'] ='$t^\mathrm{g}-t^\mathrm{g}_\mathrm{s}$\n[d]'
 
 t1 = time.time()
 mcmc.run()
 dT = time.time() - t1
 fig_and_axes = gridcorner._get_fig_and_axes(4, 2, 0.05)
-mcmc.plot_corner(label_offset=0.35, truths=[0, 0, delta_F0, 50],
+mcmc.plot_corner(label_offset=0.25, truths=[0, 0, 0, 0],
                  fig_and_axes=fig_and_axes)
 mcmc.print_summary()
 
diff --git a/examples/glitch_examples/semicoherent_glitch_robust_directed_grid_search_on_1_glitch.py b/examples/glitch_examples/semicoherent_glitch_robust_directed_grid_search_on_1_glitch.py
index ef642d6..429f64c 100644
--- a/examples/glitch_examples/semicoherent_glitch_robust_directed_grid_search_on_1_glitch.py
+++ b/examples/glitch_examples/semicoherent_glitch_robust_directed_grid_search_on_1_glitch.py
@@ -42,18 +42,22 @@ dT = time.time() - t1
 
 F0_vals = np.unique(search.data[:, 0]) - F0
 F1_vals = np.unique(search.data[:, 1]) - F1
-delta_F0s_vals = np.unique(search.data[:, 5])
+delta_F0s_vals = np.unique(search.data[:, 5]) - delta_F0
 tglitch_vals = np.unique(search.data[:, 7])
-tglitch_vals_days = (tglitch_vals-tstart) / 86400.
+tglitch_vals_days = (tglitch_vals-tstart) / 86400. - dtglitch/86400.
 
 twoF = search.data[:, -1].reshape((len(F0_vals), len(F1_vals),
                                    len(delta_F0s_vals), len(tglitch_vals)))
-xyz = [F0_vals, F1_vals, delta_F0s_vals, tglitch_vals_days]
-labels = ['$f - f^\mathrm{s}$\n[Hz]', '$\dot{f} - \dot{f}^\mathrm{s}$\n[Hz/s]',
-          '$\delta f$\n[Hz]', '$t^g_0$\n[days]', '$\widehat{2\mathcal{F}}$']
+xyz = [F0_vals*1e6, F1_vals*1e12, delta_F0s_vals*1e6, tglitch_vals_days]
+labels = ['$f - f_\mathrm{s}$\n[$\mu$Hz]',
+          '$\dot{f} - \dot{f}_\mathrm{s}$\n[$p$Hz/s]',
+          '$\delta f-\delta f_\mathrm{s}$\n[$\mu$Hz]',
+          '$t^\mathrm{g} - t^\mathrm{g}_\mathrm{s}$\n[d]',
+          '$\widehat{2\mathcal{F}}$']
 fig, axes = gridcorner(
     twoF, xyz, projection='log_mean', labels=labels,
-    showDvals=False, lines=[0, 0, delta_F0, dtglitch/86400.], label_offset=0.35)
+    showDvals=False, lines=[0, 0, 0, 0], label_offset=0.25,
+    max_n_ticks=4)
 fig.savefig('{}/{}_projection_matrix.png'.format(outdir, label),
             bbox_inches='tight')
 
-- 
GitLab