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