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