make_fake_data.py 1.54 KB
Newer Older
1
2
3
4
from pyfstat import Writer

# First, we generate data with a reasonably strong smooth signal

5
# Define parameters of the Crab pulsar as an example
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
F0 = 30.0
F1 = -1e-10
F2 = 0
Alpha = 5e-3
Delta = 6e-2
tref = 362750407.0

# Signal strength
h0 = 1e-23

# Properties of the GW data
sqrtSX = 1e-22
tstart = 1000000000
duration = 100*86400
tend = tstart+duration

data = Writer(
    label='basic', outdir='data', tref=tref, tstart=tstart, F0=F0, F1=F1,
    F2=F2, duration=duration, Alpha=Alpha, Delta=Delta, h0=h0, sqrtSX=sqrtSX)
data.make_data()

27
28
29
# The predicted twoF, given by lalapps_predictFstat can be accessed by
twoF = data.predict_fstat()
print 'Predicted twoF value: {}\n'.format(twoF)
30
31
32

# Next, taking the same signal parameters, we include a glitch half way through
dtglitch = duration/2.0
33
delta_F0 = 4e-5
34
delta_F1 = 0
35
36
37
38

glitch_data = Writer(
    label='glitch', outdir='data', tref=tref, tstart=tstart, F0=F0, F1=F1,
    F2=F2, duration=duration, Alpha=Alpha, Delta=Delta, h0=h0, sqrtSX=sqrtSX,
39
    dtglitch=dtglitch, delta_F0=delta_F0, delta_F1=delta_F1, detector='L1')
40
41
glitch_data.make_data()

42
43
44
45
# Making data with two glitches

dtglitch = [duration/4.0, 4*duration/5.0]
delta_phi = [0, 0]
46
delta_F0 = [4e-6, 3e-7]
47
48
49
50
delta_F1 = [0, 0]
delta_F2 = [0, 0]

two_glitch_data = Writer(
51
    label='twoglitch', outdir='data', tref=tref, tstart=tstart, F0=F0, F1=F1,
52
53
54
55
56
    F2=F2, duration=duration, Alpha=Alpha, Delta=Delta, h0=h0, sqrtSX=sqrtSX,
    dtglitch=dtglitch, delta_phi=delta_phi, delta_F0=delta_F0,
    delta_F1=delta_F1, delta_F2=delta_F2)
two_glitch_data.make_data()