Directed grid search: Quadratic spindownΒΆ

Search for CW signal including two spindown parameters 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_F0F1F2"
 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 DeltaF2 = N * dF2
 60 F0s = [F0 - DeltaF0 / 2.0, F0 + DeltaF0 / 2.0, dF0]
 61 F1s = [F1 - DeltaF1 / 2.0, F1 + DeltaF1 / 2.0, dF1]
 62 F2s = [F2 - DeltaF2 / 2.0, F2 + DeltaF2 / 2.0, dF2]
 63 Alphas = [Alpha]
 64 Deltas = [Delta]
 65 search = pyfstat.GridSearch(
 66     label,
 67     outdir,
 68     data.sftfilepath,
 69     F0s,
 70     F1s,
 71     F2s,
 72     Alphas,
 73     Deltas,
 74     tref,
 75     tstart,
 76     tend,
 77 )
 78 search.run()
 79
 80 # FIXME: workaround for matplotlib "Exceeded cell block limit" errors
 81 agg_chunksize = 10000
 82
 83 print("Plotting 2F(F0)...")
 84 search.plot_1D(
 85     xkey="F0", xlabel="freq [Hz]", ylabel="$2\\mathcal{F}$", agg_chunksize=agg_chunksize
 86 )
 87 print("Plotting 2F(F1)...")
 88 search.plot_1D(xkey="F1", agg_chunksize=agg_chunksize)
 89 print("Plotting 2F(F2)...")
 90 search.plot_1D(xkey="F2", agg_chunksize=agg_chunksize)
 91 print("Plotting 2F(Alpha)...")
 92 search.plot_1D(xkey="Alpha", agg_chunksize=agg_chunksize)
 93 print("Plotting 2F(Delta)...")
 94 search.plot_1D(xkey="Delta", agg_chunksize=agg_chunksize)
 95 # 2D plots will currently not work for >2 non-trivial (gridded) search dimensions
 96 # search.plot_2D(xkey="F0",ykey="F1",colorbar=True)
 97 # search.plot_2D(xkey="F0",ykey="F2",colorbar=True)
 98 # search.plot_2D(xkey="F1",ykey="F2",colorbar=True)
 99
100 print("Making gridcorner plot...")
101 F0_vals = np.unique(search.data["F0"]) - F0
102 F1_vals = np.unique(search.data["F1"]) - F1
103 F2_vals = np.unique(search.data["F2"]) - F2
104 twoF = search.data["twoF"].reshape((len(F0_vals), len(F1_vals), len(F2_vals)))
105 xyz = [F0_vals, F1_vals, F2_vals]
106 labels = [
107     "$f - f_0$",
108     "$\\dot{f} - \\dot{f}_0$",
109     "$\\ddot{f} - \\ddot{f}_0$",
110     "$\\widetilde{2\\mathcal{F}}$",
111 ]
112 fig, axes = pyfstat.gridcorner(
113     twoF, xyz, projection="log_mean", labels=labels, whspace=0.1, factor=1.8
114 )
115 fig.savefig(os.path.join(outdir, label + "_projection_matrix.png"))

Total running time of the script: ( 0 minutes 0.000 seconds)

Gallery generated by Sphinx-Gallery