fully_coherent_search_using_MCMC_on_glitching_data.md 2.93 KB
Newer Older
1
2
3
# Fully coherent search on glitching data using MCMC

This example applies the basic [fully coherent
4
search using MCMC](fully_coherent_search_using_MCMC.md), to the glitching signal data set created in
5
6
7
[make fake data](make_fake_data.md]). The aim here is to illustrate the effect
such a signal can have on a fully-coherent search. The complete script for this
example canbe found
8
[here](../example/fully_coherent_search_using_MCMC_on_glitching_data.py).
9
10


11
12
After importing `pyfstat`, We setup a flat prior on `F0` and `F1`, based on the
values used to generate the signal:
13
14
15
16
17
18
19
20
21
22
23
24
25

```
from pyfstat import MCMCSearch

F0 = 30.0
F1 = -1e-10
F2 = 0
Alpha = 5e-3
Delta = 6e-2
tref = 362750407.0

tstart = 1000000000
duration = 100*86400
26
tend = tstart + duration
27

28
29
theta_prior = {'F0': {'type': 'unif', 'lower': F0-1e-4, 'upper': F0+1e-4},
               'F1': {'type': 'unif', 'lower': F1*(1+1e-3), 'upper': F1*(1-1e-3)},
30
31
32
33
34
35
               'F2': F2,
               'Alpha': Alpha,
               'Delta': Delta
               }
```

36
37
In this search, we will use paralllel tempering (to help the walkers move
between the different peaks in the posterior).
38
```
39
40
41
42
ntemps = 2
log10temperature_min = -0.01
nwalkers = 100
nsteps = [5000, 10000]
43

44
mcmc = MCMCSearch('fully_coherent_search_using_MCMC_on_glitching_data', 'data',
45
                  sftfilepath='data/*_glitch*.sft',
46
                  theta_prior=theta_prior, tref=tref, tstart=tstart, tend=tend,
47
                  nsteps=nsteps, nwalkers=nwalkers, ntemps=ntemps,
48
                  log10temperature_min=log10temperature_min)
49
50
51
52
mcmc.run()
mcmc.plot_corner(add_prior=True)
```

53
54
Running this example, we obtain traces of the walkers like this:
![](img/fully_coherent_search_using_MCMC_on_glitching_data_walkers.png)
55

56
57
58
59
60
Although it is not obvious at first, the large widths of these traces in fact
show that the walkers are jumping between two bimodal peaks (for both `F0` and
`F1): this is possible due to the tuning of the parallel tempering. To see this
clearly, we also plot the corner plot:
![](img/fully_coherent_search_using_MCMC_on_glitching_data_corner.png)
61

62
63
64
65
66
67
68
69
70
From this corner plot, we that unlike the in the [single glitch fully-coherent
search](full_coherent_search_using_MCMC.md), the posterior, even after a large
number of steps, is multimodal. However, these two peaks do **not** correspond
exactly to the two frequencies before and after the glitch, which would be
`30` and `30+4e5` (to see this, see how the data is
[generated](../examples/make_dake_data.py)). This is partly due to the noise
and partly due to the fact that the maximum detection statistic in the case
of glitches can occur at point *in between* the two frequencies. Moreover, we
see bimodality in `F1`, which did does not change during the glitch.
71
72
73

```
>>> mcmc.print_summary()
74
Max twoF: 1354.7
75
76
```
That is, compared to the basic search (on a smooth signal) which had a twoF of
77
`~1764` (in agreement with the predicted twoF), we have lost a large
78
79
fraction of the SNR due to the glitch.