Note
Click here to download the full example code
Directed grid search: Linear spindownΒΆ
Search for CW signal including one spindown parameter using a parameter space grid (i.e. no MCMC).
8 import pyfstat
9 import numpy as np
10 import os
11
12 label = "PyFstat_example_grid_search_F0F1"
13 outdir = os.path.join("PyFstat_example_data", label)
14
15 F0 = 30.0
16 F1 = 1e-10
17 F2 = 0
18 Alpha = 1.0
19 Delta = 1.5
20
21 # Properties of the GW data
22 sqrtSX = 1e-23
23 tstart = 1000000000
24 duration = 10 * 86400
25 tend = tstart + duration
26 tref = 0.5 * (tstart + tend)
27 IFOs = "H1"
28
29 depth = 20
30
31 h0 = sqrtSX / depth
32 cosi = 0
33
34 data = pyfstat.Writer(
35 label=label,
36 outdir=outdir,
37 tref=tref,
38 tstart=tstart,
39 F0=F0,
40 F1=F1,
41 F2=F2,
42 duration=duration,
43 Alpha=Alpha,
44 Delta=Delta,
45 h0=h0,
46 cosi=cosi,
47 sqrtSX=sqrtSX,
48 detectors=IFOs,
49 )
50 data.make_data()
51
52 m = 0.01
53 dF0 = np.sqrt(12 * m) / (np.pi * duration)
54 dF1 = np.sqrt(180 * m) / (np.pi * duration ** 2)
55 dF2 = 1e-17
56 N = 100
57 DeltaF0 = N * dF0
58 DeltaF1 = N * dF1
59 F0s = [F0 - DeltaF0 / 2.0, F0 + DeltaF0 / 2.0, dF0]
60 F1s = [F1 - DeltaF1 / 2.0, F1 + DeltaF1 / 2.0, dF1]
61 F2s = [F2]
62 Alphas = [Alpha]
63 Deltas = [Delta]
64 search = pyfstat.GridSearch(
65 label,
66 outdir,
67 data.sftfilepath,
68 F0s,
69 F1s,
70 F2s,
71 Alphas,
72 Deltas,
73 tref,
74 tstart,
75 tend,
76 )
77 search.run()
78
79 print("Plotting 2F(F0)...")
80 search.plot_1D(xkey="F0", xlabel="freq [Hz]", ylabel="$2\\mathcal{F}$")
81 print("Plotting 2F(F1)...")
82 search.plot_1D(xkey="F1")
83 print("Plotting 2F(F0,F1)...")
84 search.plot_2D(xkey="F0", ykey="F1", colorbar=True)
85
86 print("Making gridcorner plot...")
87 F0_vals = np.unique(search.data["F0"]) - F0
88 F1_vals = np.unique(search.data["F1"]) - F1
89 twoF = search.data["twoF"].reshape((len(F0_vals), len(F1_vals)))
90 xyz = [F0_vals, F1_vals]
91 labels = [
92 "$f - f_0$",
93 "$\\dot{f} - \\dot{f}_0$",
94 "$\\widetilde{2\\mathcal{F}}$",
95 ]
96 fig, axes = pyfstat.gridcorner(
97 twoF, xyz, projection="log_mean", labels=labels, whspace=0.1, factor=1.8
98 )
99 fig.savefig(os.path.join(outdir, label + "_projection_matrix.png"))
Total running time of the script: ( 0 minutes 0.000 seconds)