Note
Go to the end to download the full example code.
MCMC search on data presenting a glitch
Executes a directed MCMC semicoherent F-statistic search on data presenting a glitch. This is intended to show the impact of glitches on vanilla CW searches.
10 import os
11
12 import numpy as np
13 from PyFstat_example_make_data_for_search_on_1_glitch import (
14 F0,
15 F1,
16 F2,
17 Alpha,
18 Delta,
19 duration,
20 outdir,
21 tref,
22 tstart,
23 )
24
25 import pyfstat
26
27 label = "PyFstatExampleStandardDirectedMCMCSearchOn1Glitch"
28 logger = pyfstat.set_up_logger(label=label, outdir=outdir)
29
30 Nstar = 10000
31 F0_width = np.sqrt(Nstar) * np.sqrt(12) / (np.pi * duration)
32 F1_width = np.sqrt(Nstar) * np.sqrt(180) / (np.pi * duration**2)
33
34 theta_prior = {
35 "F0": {"type": "unif", "lower": F0 - F0_width / 2.0, "upper": F0 + F0_width / 2.0},
36 "F1": {"type": "unif", "lower": F1 - F1_width / 2.0, "upper": F1 + F1_width / 2.0},
37 "F2": F2,
38 "Alpha": Alpha,
39 "Delta": Delta,
40 }
41
42 ntemps = 2
43 log10beta_min = -0.5
44 nwalkers = 100
45 nsteps = [500, 2000]
46
47 mcmc = pyfstat.MCMCSearch(
48 label=label,
49 outdir=outdir,
50 sftfilepattern=os.path.join(outdir, "*1glitch*sft"),
51 theta_prior=theta_prior,
52 tref=tref,
53 minStartTime=tstart,
54 maxStartTime=tstart + duration,
55 nsteps=nsteps,
56 nwalkers=nwalkers,
57 ntemps=ntemps,
58 log10beta_min=log10beta_min,
59 )
60
61 mcmc.transform_dictionary["F0"] = dict(subtractor=F0, symbol="$f-f^\\mathrm{s}$")
62 mcmc.transform_dictionary["F1"] = dict(
63 subtractor=F1, symbol="$\\dot{f}-\\dot{f}^\\mathrm{s}$"
64 )
65
66 mcmc.run()
67 mcmc.print_summary()
68 mcmc.plot_corner()
69 mcmc.plot_cumulative_max(savefig=True)