Note
Click here to download the full example code
Glitch examples: Make dataΒΆ
Generate the data to run examples on glitch-robust searches.
8 from pyfstat import Writer, GlitchWriter
9 import numpy as np
10 import os
11
12 outdir = os.path.join("PyFstat_example_data", "PyFstat_example_glitch_robust_search")
13
14 # First, we generate data with a reasonably strong smooth signal
15
16 # Define parameters of the Crab pulsar as an example
17 F0 = 30.0
18 F1 = -1e-10
19 F2 = 0
20 Alpha = np.radians(83.6292)
21 Delta = np.radians(22.0144)
22
23 # Signal strength
24 h0 = 5e-24
25 cosi = 0
26
27 # Properties of the GW data
28 sqrtSX = 1e-22
29 tstart = 1000000000
30 duration = 50 * 86400
31 tend = tstart + duration
32 tref = tstart + 0.5 * duration
33 IFO = "H1"
34
35 data = Writer(
36 label="0_glitch",
37 outdir=outdir,
38 tref=tref,
39 tstart=tstart,
40 F0=F0,
41 F1=F1,
42 F2=F2,
43 duration=duration,
44 Alpha=Alpha,
45 Delta=Delta,
46 h0=h0,
47 cosi=cosi,
48 sqrtSX=sqrtSX,
49 detectors=IFO,
50 )
51 data.make_data()
52
53 # Next, taking the same signal parameters, we include a glitch half way through
54 dtglitch = duration / 2.0
55 delta_F0 = 5e-6
56 delta_F1 = 0
57
58 glitch_data = GlitchWriter(
59 label="1_glitch",
60 outdir=outdir,
61 tref=tref,
62 tstart=tstart,
63 F0=F0,
64 F1=F1,
65 F2=F2,
66 duration=duration,
67 Alpha=Alpha,
68 Delta=Delta,
69 h0=h0,
70 cosi=cosi,
71 sqrtSX=sqrtSX,
72 detectors=IFO,
73 dtglitch=dtglitch,
74 delta_F0=delta_F0,
75 delta_F1=delta_F1,
76 )
77 glitch_data.make_data()
78
79 # Making data with two glitches
80
81 dtglitch_2 = [duration / 4.0, 4 * duration / 5.0]
82 delta_phi_2 = [0, 0]
83 delta_F0_2 = [4e-6, 3e-7]
84 delta_F1_2 = [0, 0]
85 delta_F2_2 = [0, 0]
86
87 two_glitch_data = GlitchWriter(
88 label="2_glitch",
89 outdir=outdir,
90 tref=tref,
91 tstart=tstart,
92 F0=F0,
93 F1=F1,
94 F2=F2,
95 duration=duration,
96 Alpha=Alpha,
97 Delta=Delta,
98 h0=h0,
99 cosi=cosi,
100 sqrtSX=sqrtSX,
101 detectors=IFO,
102 dtglitch=dtglitch_2,
103 delta_phi=delta_phi_2,
104 delta_F0=delta_F0_2,
105 delta_F1=delta_F1_2,
106 delta_F2=delta_F2_2,
107 )
108 two_glitch_data.make_data()
Total running time of the script: ( 0 minutes 0.000 seconds)