Pulsar-signal generation
[Inject]

Collaboration diagram for Pulsar-signal generation:

Pulsar signal-generation routines for hardware- and software-injections. More...


Files

file  GeneratePulsarSignal.h
 
Author:
Reinhard Prix, Greg Mendell API for GeneratePulsarSignal.c

file  GeneratePulsarSignal.c
 
Author:
Reinhard Prix, Greg Mendell Module to generate simulated pulsar-signals.


Detailed Description

Pulsar signal-generation routines for hardware- and software-injections.

Description

This module also contains a few more general-purpose helper-functions:

Algorithm:
LALGeneratePulsarSignal() is basically a wrapper for the two LAL-functions GenerateSpinOrbitCW() to produce the source-signal, and LALSimulateCoherentGW() to turn it into a time-series at the detector.

LALSignalToSFTs() uses LALForwardRealFFT() appropriately on the input-timeseries to produce the required output-SFTs ( v2-normalization! ).

Note:
LALSignalToSFTs() currently enforces the constraint of Tsft * Band being an integer, so that the number of time-samples per SFT is even. This follows makefakedata_v2.

Furthermore, if the timestamps for SFT-creation passed to LALSignalToSFTs() do not fit exactly on a time-step of the input time-series, it will be "nudged" to the closest one. If lalDebugLevel>0 a warning will be printed about this. The user could also see this effect in the actual timestamps of the SFTs returned.

The FFTW-"plan" is currently created using the ESTIMATE flag, which is fast but only yields an approximate plan. Better results might be achieved by using MEASURE and an appropriate buffering of the resulting plan (which doesnt change provided the SFT-length is the same). Measuring the plan takes longer but might lead to substantial speedups for many FFTs, which seems the most likely situation.

Use of LALFastGeneratePulsarSFTs()
The functions LALComputeSkyAndZeroPsiAMResponse() and LALFastGeneratePulsarSFTs() use approximate analytic formulas to generate SFTs. This should be significantly faster than LALGeneratePulsarSignal() and LALSignalToSFTs(), which generate the time series data and then FFT it. Simple tests performed by the code in GeneratePulsarSignalTest.c indicate that the maximum modulus of the SFTs output by the approximate and exact codes differs by less that 10%. Since the tests are not exhaustive, the user should use caution and conduct their own test to compare LALComputeSkyAndZeroPsiAMResponse() and LALFastGeneratePulsarSFTs() with LALGeneratePulsarSignal() and LALSignalToSFTs().

The strain of a periodic signal at the detector is given by

\[ h(t) = F_+(t) A_+ {\rm cos}\Phi(t) + F_\times(t) A_\times {\rm sin}\Phi(t), \]

where $F_+$ and $F_\times$ are the usual beam pattern response functions, $A_+$ and $A_\times$ are the amplitudes of the gravitational wave for the plus and cross polarizations, and $\Phi$ is the phase. The phase contains modulations from doppler shifts due to the relative motion between the source and the detector and the spin evolution of the source. (The functions discussed here support both isolated sources and those in binary systems. The binary case has not been tested.)

If we Taylor expand the phase out to first order about the time at the midpoint of an SFT and approximate $F_+$ and $F_\times$ as constants, for one SFT we can write

\[ \Phi(t) \approx \Phi_{1/2} + 2\pi f_{1/2}(t - t_{1/2}). \]

The strain at discrete time $t_j$, measured from the start of the SFT, can thus be approximated as

\[ h_j \approx F_{+ 1/2} A_+ {\rm cos} [\Phi_{1/2} + 2\pi f_{1/2}(t_0 + t_j - t_{1/2})] + F_{\times 1/2} A_\times {\rm sin} [\Phi_{1/2} + 2\pi f_{1/2}(t_0 + t_j - t_{1/2})], \]

where $t_0$ is the time as the start of the SFT, and $t_{1/2} - t_0 = T_{\rm sft}/2$, where $T_{\rm sft}$ is the duration of one SFT. This simplifies to

\[ h_j \approx F_{+ 1/2} A_+ {\rm cos} (\Phi_0 + 2\pi f_{1/2}t_j) + F_{\times 1/2} A_\times {\rm sin} (\Phi_0 + 2\pi f_{1/2}t_j), \]

where $\Phi_0$ is the phase at the start of the SFT (not the initial phase at the start of the observation), i.e.,

\[ \Phi_0 = \Phi_{1/2} - 2 \pi f_{1/2} (T_{\rm sft} / 2). \]

Note that these are the same approximations used by LALDemod().

One can show that the Discrete Fourier Transform (DFT) of $h_j$ above is:

\[ \tilde{h}_k = e^{i\Phi_0} { ( F_{+ 1/2} A_+ - i F_{\times 1/2} A_\times) \over 2 } { 1 - e^{2\pi i (\kappa - k)} \over 1 - e^{2\pi i (\kappa - k)/N} } \\ + e^{-i\Phi_0} { ( F_{+ 1/2} A_+ + i F_{\times 1/2} A_\times) \over 2 } { 1 - e^{-2\pi i (\kappa + k)} \over 1 - e^{-2\pi i (\kappa + k)/N} } \]

where $N$ is the number of time samples used to find the DFT (i.e., the sample rate times $T_{\rm sft}$), and

\[ \kappa \equiv f_{1/2} T_{\rm sft}, \]

is usually not an integer.

Note that the factor $e^{\pm 2\pi i k}$ in the numerators of the equation for $\tilde{h}_k$ equals 1. Furthermore, for $0 < \kappa < N/2$ and $|\kappa - k| << N$ the first term dominates and can be Taylor expanded to give:

\[ \tilde{h}_k = N e^{i\Phi_0} { ( F_{+ 1/2} A_+ - i F_{\times 1/2} A_\times) \over 2 } \left [ \, { {\rm sin} (2\pi\kappa) \over 2 \pi (\kappa - k) } \, + \, i { 1 - {\rm cos} (2\pi\kappa) \over 2 \pi (\kappa - k) } \, \right ] \]

Note that the last factor in square brackets is $P_{\alpha k}^*$ and $e^{i\Phi_0} = Q_{\alpha}^*$ used by LALDemod.

Example pseudocode
The structs used by LALComputeSkyAndZeroPsiAMResponse and LALFastGeneratePulsarSFTs are given in previous sections, and make use of those used by LALGeneratePulsarSignal and LALSignalToSFTs plus a small number of additional parameters. Thus it is fairly easy to change between the above approximate routines the exact routines. See GeneratePulsarSignalTest.c for an example implementation of the code.

Note that one needs to call LALComputeSkyAndZeroPsiAMResponse once per sky position, and then call LALFastGeneratePulsarSFTs for each set of signal parameters at that sky position. Thus, one could perform a Monte Carlo simulation, as shown by the pseudo code:

loop over sky positions {
   ...
   LALComputeSkyAndZeroPsiAMResponse();
   ...
   loop over spindown {
      ...
      loop over frequencies {
         ...
         LALFastGeneratePulsarSFTs();
         ...
      }
      ...  
   }
   ...
}

Notes on LALFastGeneratePulsarSFTs
  1. If *outputSFTs sent to LALFastGeneratePulsarSFTs() is NULL then LALFastGeneratePulsarSFTs() allocates memory for the output SFTs; otherwise it assumes memory has already been allocated. Thus, the user does not have to deallocate memory for the SFTs until all calls to LALFastGeneratePulsarSFTs() are completed.

  1. fHeterodyne and 0.5 * samplingRate set in the PulsarSignalParams struct give the start frequency and frequency band of the SFTs output from LALFastGeneratePulsarSFTs().

  1. If resTrig is set to zero in the SFTandSignalParams struct, then the C math libary cos() sin() functions are called, else lookup tables (LUTs) are used for calls to trig functions. There may be a slight speedup in using LUTs.

  1. To maximize the speed of SFT generations, LALFastGeneratePulsarSFTs() only generates values for the bins in the band 2*Dterms centered on the signal frequency in each SFT. Dterms must be greater than zero and less than or equal to the number of frequency bins in the output SFTs. Note that Dterms is used the same way here as it is in LALDemod(). Nothing is done to the other bins, unless *outputSFTs is NULL; then, since memory is allocates for the output SFTs, the bins not in the 2*Dterms band are initialized to zero.

Generated on Tue Oct 7 02:41:40 2008 for LAL by  doxygen 1.5.2