WIP: Known pulsar search heterodyne filter changes
In the current known pulsar search pipeline the "heterodyne" stage, performed using
lalapps_heterodyne_pulsar, removes the fast variations of the source signal, then low-pass filters the data, and finally downsamples it by averaging the data. Initially this is performed without accounting for the Doppler modulation of the signal in a so-called "coarse" heterodyne. This is then followed by applying a "fine" heterodyne on the downsampled data that accounts for the Doppler modulations.
In the "coarse" heterodyne the high-pass filtering involves successively applying 3 third order IIR Butterworth filters to the data (with a default knee frequency of 0.25 Hz), making a 9th order Butterworth filter. However, the filter is only applied in the forward direction. This means that the phase of any signal in the data is shifted by the phase response of the filter. The filter's phase response is also frequency dependent, so as the still Doppler modulated signal moves in frequency the filter's phase shift will vary. Currently, this phase shifting of the signal is dealt with during the "fine" heterodyne stage by calculating the filter's response and removing it from the data. This works well and hasn't caused problems, but it is a bit of a hack and might cause some problems if a true signal's phase doesn't behave exactly as predicted from EM pulsar observations.
The standard way to remove the phase response of a filter is to apply it in the forward direction and then apply it again in the reverse direction. In the heterodyne code this wasn't done as the same filter is used over the whole run preserving its history, but this can't be reversed over the whole run as smaller chunks of data will already have had to be downsampled and output. However, in this MR I have changed the filtering, so that the filter is run in reverse over the current stretch of data, but the history of the forward run is kept and then used in the following stretch of data (this is done to avoid any problems of discontinuities between the start of one data stretch and the start of the next causing a new filter impulse response - although I'm not entirely sure if this is necessary!)
I will detail tests of these changes in the comments below.