Note
Click here to download the full example code
Short transient grid search
An example grid-based search for a short transient signal.
8 import os
9
10 import numpy as np
11 import PyFstat_example_make_data_for_short_transient_search as data
12
13 import pyfstat
14
15 if __name__ == "__main__":
16
17 if not os.path.isdir(data.outdir) or not np.any(
18 [f.endswith(".sft") for f in os.listdir(data.outdir)]
19 ):
20 raise RuntimeError(
21 "Please first run PyFstat_example_make_data_for_short_transient_search.py !"
22 )
23
24 maxStartTime = data.tstart + data.duration
25
26 m = 0.001
27 dF0 = np.sqrt(12 * m) / (np.pi * data.duration)
28 DeltaF0 = 100 * dF0
29 F0s = [data.F0 - DeltaF0 / 2.0, data.F0 + DeltaF0 / 2.0, dF0]
30 F1s = [data.F1]
31 F2s = [data.F2]
32 Alphas = [data.Alpha]
33 Deltas = [data.Delta]
34
35 BSGL = False
36
37 print("Standard CW search:")
38 search1 = pyfstat.GridSearch(
39 label="CW" + ("_BSGL" if BSGL else ""),
40 outdir=data.outdir,
41 sftfilepattern=os.path.join(data.outdir, "*simulated_transient_signal*sft"),
42 F0s=F0s,
43 F1s=F1s,
44 F2s=F2s,
45 Alphas=Alphas,
46 Deltas=Deltas,
47 tref=data.tref,
48 BSGL=BSGL,
49 )
50 search1.run()
51 search1.print_max_twoF()
52 search1.plot_1D(xkey="F0", xlabel="freq [Hz]", ylabel="$2\\mathcal{F}$")
53
54 print("with t0,tau bands:")
55 search2 = pyfstat.TransientGridSearch(
56 label="tCW" + ("_BSGL" if BSGL else ""),
57 outdir=data.outdir,
58 sftfilepattern=os.path.join(data.outdir, "*simulated_transient_signal*sft"),
59 F0s=F0s,
60 F1s=F1s,
61 F2s=F2s,
62 Alphas=Alphas,
63 Deltas=Deltas,
64 tref=data.tref,
65 transientWindowType="rect",
66 t0Band=data.duration - 2 * data.Tsft,
67 tauBand=data.duration,
68 outputTransientFstatMap=True,
69 tCWFstatMapVersion="lal",
70 BSGL=BSGL,
71 )
72 search2.run()
73 search2.print_max_twoF()
74 search2.plot_1D(xkey="F0", xlabel="freq [Hz]", ylabel="$2\\mathcal{F}$")
Total running time of the script: ( 0 minutes 0.000 seconds)