Here, we describe the steps required to generate fake data which will be used
throughout the other examples. We will generate data based on the properties of
the Crab pulsar, first as a smooth CW signal, then as a CW signal which
contains one glitch, and finally as a signal with two glitches. This document
is based on the file make_fake_data.py.
In the following code segment, we import the Writer class used to generate
fake data, define the Crab parameters and create an instant of the Writer
importnumpyasnpfrompyfstatimportWriter# Define parameters of the Crab pulsarF0=30.0F1=-1e-10F2=0Alpha=np.radians(83.6292)Delta=np.radians(22.0144)tref=362750407.0# Signal strengthh0=1e-23# Properties of the GW datasqrtSX=1e-22tstart=1000000000duration=100*86400tend=tstart+durationdata=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)
We can now use the data object to create .sft files which contain a smooth
signal in Gaussian noise. In detail, the process consists first in calling
which generates a file data/basic.cff (notice the directory and file name
are defined by the outdir and label arguments given to Writer). This
file contains instructions which will be passed to lalapps_MakeFakedata_v5,
In fact, the previous two commands are wrapped together by a single call to
data.make_data() which we will use from now on.
We now want to generate a set of data which contains a glitching signal. We
start with a simple case in which the glitch occurs half way through the
observation span. We define the properties of this signal, create
another Writer instance called glitch_data, and then run make_data()
The glitch config file uses transient windows to create two non-overlapping,
but continuous signals.
Finally, the Writer class also provides a wrapper of lalapps_PredictFstat.
Notice that the predicted value will be the same for both sets of data.
Making data with multiple glitches
Finally, one can also use the Writer to generate data with multiple glitches.
To do this, simply pass in dtglitch, delta_phi, delta_F0, delta_F1, and
delta_F2 as arrays (with a length equal to the number of glitches). Note
that all these must be of equal length. Moreover, the glitches are applied
sequentially and additively as implemented
pyfstat.BaseSearchClass.calculate_thetas. Here is an example with two
glitches, one a quarter of the way through and the other a fifth from the end.
So, having run $ python make_fake_data.py (from the examples directory), we
will see that in the sub-directory examples/data/ there are three .sft
files. These will be used throughout the other examples.