Commit 78ecb25b authored by Gregory Ashton's avatar Gregory Ashton

Minor updates to examples

parent 90dad473
......@@ -43,15 +43,15 @@ glitch_data.make_data()
# Making data with two glitches
dtglitch = [duration/4.0, 4*duration/5.0]
delta_phi = [0, 0]
delta_F0 = [4e-6, 3e-7]
delta_F1 = [0, 0]
delta_F2 = [0, 0]
dtglitch_2 = [duration/4.0, 4*duration/5.0]
delta_phi_2 = [0, 0]
delta_F0_2 = [4e-6, 3e-7]
delta_F1_2 = [0, 0]
delta_F2_2 = [0, 0]
two_glitch_data = GlitchWriter(
label='2_glitch', outdir=outdir, tref=tref, tstart=tstart, F0=F0, F1=F1,
F2=F2, duration=duration, Alpha=Alpha, Delta=Delta, h0=h0, sqrtSX=sqrtSX,
dtglitch=dtglitch, delta_phi=delta_phi, delta_F0=delta_F0,
delta_F1=delta_F1, delta_F2=delta_F2)
dtglitch=dtglitch_2, delta_phi=delta_phi_2, delta_F0=delta_F0_2,
delta_F1=delta_F1_2, delta_F2=delta_F2_2)
two_glitch_data.make_data()
import numpy as np
import matplotlib.pyplot as plt
import pyfstat
from make_simulated_data import tstart, duration, tref, F0, F1, F2, Alpha, Delta, outdir
from make_simulated_data import tstart, duration, tref, F0, F1, F2, Alpha, Delta, delta_F0, dtglitch, outdir
plt.style.use('paper')
......@@ -33,19 +33,19 @@ theta_prior = {
ntemps = 3
log10beta_min = -0.5
nwalkers = 100
nsteps = [500, 500]
nsteps = [500, 1000]
mcmc = pyfstat.MCMCGlitchSearch(
label=label, sftfilepattern='data/*1_glitch*sft', theta_prior=theta_prior,
tref=tref, minStartTime=tstart, maxStartTime=tstart+duration,
nsteps=nsteps, nwalkers=nwalkers, ntemps=ntemps,
log10beta_min=log10beta_min, nglitch=1)
print delta_F0
mcmc.transform_dictionary['F0'] = dict(
subtractor=F0, symbol='$f-f^\mathrm{s}$')
mcmc.transform_dictionary['F1'] = dict(
subtractor=F1, symbol='$\dot{f}-\dot{f}^\mathrm{s}$')
mcmc.run()
mcmc.plot_corner(label_offset=0.15)
mcmc.plot_corner(label_offset=0.15, truths=[0, 0, delta_F0, 50])
mcmc.print_summary()
import pyfstat
import numpy as np
import matplotlib.pyplot as plt
from make_simulated_data import tstart, duration, tref, F0, F1, F2, Alpha, Delta, outdir
from make_simulated_data import tstart, duration, tref, F0, F1, F2, Alpha, Delta, delta_F0, outdir
try:
from gridcorner import gridcorner
......@@ -45,9 +45,10 @@ tglitch_vals_days = (tglitch_vals-tstart) / 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_0$\n[Hz]', '$\dot{f} - \dot{f}_0$\n[Hz/s]',
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}}$']
fig, axes = gridcorner(
twoF, xyz, projection='log_mean', whspace=0.1, factor=1.2, labels=labels)
twoF, xyz, projection='log_mean', whspace=0.1, factor=1.2, labels=labels,
showDvals=False, lines=[0, 0, delta_F0, 50])
fig.savefig('{}/{}_projection_matrix.png'.format(outdir, label),
bbox_inches='tight')
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