Note
Click here to download the full example code
Short transient grid searchΒΆ
An example grid-based search for a short transient signal.
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 | import pyfstat
import os
import numpy as np
import PyFstat_example_make_data_for_short_transient_search as data
if __name__ == "__main__":
if not os.path.isdir(data.outdir) or not np.any(
[f.endswith(".sft") for f in os.listdir(data.outdir)]
):
raise RuntimeError(
"Please first run PyFstat_example_make_data_for_short_transient_search.py !"
)
maxStartTime = data.tstart + data.duration
m = 0.001
dF0 = np.sqrt(12 * m) / (np.pi * data.duration)
DeltaF0 = 100 * dF0
F0s = [data.F0 - DeltaF0 / 2.0, data.F0 + DeltaF0 / 2.0, dF0]
F1s = [data.F1]
F2s = [data.F2]
Alphas = [data.Alpha]
Deltas = [data.Delta]
print("Standard CW search:")
search1 = pyfstat.GridSearch(
label="CW",
outdir=data.outdir,
sftfilepattern=os.path.join(data.outdir, "*simulated_transient_signal*sft"),
F0s=F0s,
F1s=F1s,
F2s=F2s,
Alphas=Alphas,
Deltas=Deltas,
tref=data.tref,
BSGL=False,
)
search1.run()
search1.print_max_twoF()
search1.plot_1D(xkey="F0", xlabel="freq [Hz]", ylabel="$2\\mathcal{F}$")
print("with t0,tau bands:")
search2 = pyfstat.TransientGridSearch(
label="tCW",
outdir=data.outdir,
sftfilepattern=os.path.join(data.outdir, "*simulated_transient_signal*sft"),
F0s=F0s,
F1s=F1s,
F2s=F2s,
Alphas=Alphas,
Deltas=Deltas,
tref=data.tref,
transientWindowType="rect",
t0Band=data.duration - 2 * data.Tsft,
tauBand=data.duration,
BSGL=False,
outputTransientFstatMap=True,
tCWFstatMapVersion="lal",
)
search2.run()
search2.print_max_twoF()
search2.plot_1D(xkey="F0", xlabel="freq [Hz]", ylabel="$2\\mathcal{F}$")
|
Total running time of the script: ( 0 minutes 0.000 seconds)