make_fake_data.py 1.57 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
print 'Predicted fstat value:', data.predict_fstat()
28
29
30

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

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,
37
    dtglitch=dtglitch, delta_F0=delta_F0, delta_F1=delta_F1, detector='L1')
38
39
glitch_data.make_data()

40

41
# The predicted twoF, given by lalapps_predictFstat can be accessed by
42

43
print 'Predicted fstat value:', data.predict_fstat()
44
45
46
47
48

# Making data with two glitches

dtglitch = [duration/4.0, 4*duration/5.0]
delta_phi = [0, 0]
49
delta_F0 = [4e-6, 3e-7]
50
51
52
53
delta_F1 = [0, 0]
delta_F2 = [0, 0]

two_glitch_data = Writer(
54
    label='twoglitch', outdir='data', tref=tref, tstart=tstart, F0=F0, F1=F1,
55
56
57
58
59
    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()