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