make_fake_data.py 1.59 KB
Newer Older
1
from pyfstat import Writer, GlitchWriter
Gregory Ashton's avatar
Gregory Ashton committed
2
import numpy as np
3
4
5

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

6
# Define parameters of the Crab pulsar as an example
7
8
9
F0 = 30.0
F1 = -1e-10
F2 = 0
Gregory Ashton's avatar
Gregory Ashton committed
10
11
Alpha = np.radians(83.6292)
Delta = np.radians(22.0144)
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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()

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

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

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

43
44
45
46
# Making data with two glitches

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

51
two_glitch_data = GlitchWriter(
52
    label='twoglitch', outdir='data', tref=tref, tstart=tstart, F0=F0, F1=F1,
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()