Offset requests to:

The real and imaginary parts of baseband signals are obtained from a real narrow-band signal by quadrature mixing, i.e. by mixing with cosine and sine signals at the narrow band's selected center frequency. We address the consequences of a delay between the outputs of the quadrature mixer, which arise when digital samples of the quadrature baseband signals are not synchronised, i.e. when the real and imaginary components have been shifted by one or more samples with respect to each other. Through analytical considerations and simulations of such an error on different synthetic signals, we show how this error can be expected to afflict different measurements. In addition, we show the effect of the error on actual incoherent scatter radar data obtained by two different digital receiver systems used in parallel at the EISCAT Svalbard Radar (ESR). The analytical considerations indicate a procedure to correct the error, albeit with some limitations due to a small singular region. We demonstrate the correction procedure on actually afflicted data and compare the results to simultaneously acquired unafflicted data. We also discuss the possible data analysis strategies, including some that avoid dealing directly with the singular region mentioned above.


Introduction
An analog baseband (heterodyne) receiver processes the complete spectral information in the input signal by mixing to baseband and lowpass filtering before sampling to eliminate the redundant upper sidebands and for bandwidth treated as the real and imaginary part of a complex signal (e.g.Peebles, 1993).This type of receiver is known as a quadrature receiver.
When such receivers are realised in analog hardware, common problems are mismatches in phase or gain between the two signal paths.Such errors can be very difficult to identify and correct, and they can change over time, which makes constant monitoring necessary.Such problems of channel mismatching are partly the reason it is increasingly common to sample the signal (using a single digitizer) at some nonzero intermediate frequency (IF) and to perform the final quadrature mixing and filtering stage in the digital domain, where the behaviour of every (usually software) component is known exactly and does not change with time.In particular, phase and amplitude cannot become mismatched between the real and imaginary parts of the baseband signal.
However, digital receivers are not immune to problems, since complex software systems are notoriously difficult to make free from errors.One such error, which was in place at the EISCAT Svalbard Radar for several months, is a phase mismatch between the real and imaginary parts caused by a relative shift between the two signal streams by one or more samples (Grydeland, 2003, Sect. 5.5).
The consequence of this type of error is a modulation of the anti-symmetric part of the spectrum, which gives the appearance of a partial mirroring (symmetrization) of signals, an effect which varies with the frequency of the signal.For large Doppler shifts, the anti-symmetric part can even change sign, resulting in the mirrored spectral peak being stronger than the true peak.The effects on normal incoherent scatter signals depend on the value of the Doppler shift.For zero Doppler shift the effect is nil since the corresponding spectrum is symmetric.For non-zero Doppler shifts, the distortion of the spectrum increases as the Doppler shift increases.For some of the larger plasma velocities at high latitudes the inferred velocity will be greatly underestimated because the distortion tends to symmetrize the spectrum while the ion temperatures will be overstimated due to the accompanying spectral broadening.
T. Grydeland et al.: Correcting for the effect of a relative delay between quadrature components In the following sections we address the consequences of this error on the spectrum of incoherent scatter signals using first theoretical considerations; next, we show the effect of the error on simulated incoherent scatter signals; we deliberately replicate the error on unafflicted real-life data, and compare it to data taken in parallel with a different receiver that inadvertently had the error; we describe a way to correct for the error, and demonstrate it on the real-life afflicted data; finally we discuss different ways to deal with the error when analysing data for plasma physical parameters.

Analytic treatment
The complex baseband signal at the outputs of the quadrature receiver is represented as z(t)=x(t)+iy(t), where x(t) and y(t) are real signals.Its Fourier Transform is given by Z(ω)=X(ω)+iY (ω), where X and Y are the Fourier transforms of x and y respectively, the limit to an infinite time interval is implied, and the power spectrum S zz (ω) is given by In this expression, the terms |X| 2 and |Y | 2 are symmetric in ω, while the final term is anti-symmetric, as can be seen by expressing X and Y in polar coordinates, where the amplitudes |X| and |Y | are symmetric and the phases φ X,Y are anti-symmetric in ω since x and y are real.Let φ=φ X −φ Y .Then which is also anti-symmetric in ω.
For a stationary random process z, the ensemble average of the term XY * is purely imaginary, since the cross-correlation between x(t) and y(t) is anti-symmetric.
When the imaginary part of the signal z(t) is delayed by a time τ , the signal becomes z (t)=x(t)+iy(t−τ ), with Fourier Transform and the distorted power spectrum becomes When the ensemble average is taken, XY * is purely imaginary, and the distorted power spectrum becomes where the final term is again the anti-symmetric part of the spectrum.
In other words, the net effect of the error on an average spectral shape is that the anti-symmetric part of the spectrum is multiplied with cos ωτ .For exactly symmetric spectra the effect is nil.For spectra with an anti-symmetric component the effect is a reduction of the asymmetry which worsens with frequency.At the frequency |ωτ |=π/2, the asymmetry disappears altogether, while at larger frequencies the asymmetry changes sign, which means that asymmetries appear on the wrong side of the spectrum.Notice that the error is independent of the sign of τ .Examples of spectra with large anti-symmetric components are skewed and/or highly Doppler shifted spectra.
We should point out that the real part of XY * does not vanish for single realisations or short integrations.In these cases, there is also an additional anti-symmetric term 2|X||Y | cos φ sin ωτ .This term depends on the sign of τ , and it can cause the anti-symmetry to grow above the level of the original unshifted signal.
The following intuitive picture illustrates what the above means in practice for a complex single-tone signal e iω s t , which can also be written cos ω s t+i cos(ω s t−π/2).The shift of τ inflicts a frequency-dependent phase shift ψ=ω s τ on the imaginary part, which becomes cos(ω s t−π/2−ω s τ ).For τ =0, this shift is zero, and the real and imaginary parts are π/2 apart in phase.For τ =0 and zero frequency, the effect is likewise nil, but as the frequency of the tone increases, the phase shift of the imaginary part also increases, and when ω s τ =π/2, the phase difference between the real and imaginary parts has increased to π, which means that the real and imaginary parts have exactly opposite phase.This is equivalent to a purely real signal and it has a symmetric spectrum.If the tone frequency is increased to ω s τ =π, the phase difference between the real and imaginary parts is 3π/2, which corresponds to a signal e −iω s t , where all the signal power has moved over from ω s to −ω s .It should be clear from this simple picture that advancing or delaying either part of the signal has the same effect on the observed spectra.Analytically, the single-tone case can be written as follows:

Simulations
It is illustrative to show the effect of a relative delay on simple signals, to build up an understanding of its effect.Afterwards, more realistic synthetic signals can be studied subjected to the same relative delay.

Synthetic tone
A simple simulation is shown in is more pronounced for higher Doppler offsets.This is the S zz (−ω) term in Eq. ( 7) above.For a signal frequency of 25 kHz, ω s τ =π and the energy of the signal has been transferred to the opposite frequency, exactly as predicted.

Synthetic spectra
An analytical expression for the incoherent scattering spectrum was used to generate a theoretical spectrum.From this spectrum, a finite impulse response (FIR) digital filter was created, which was then used to filter pseudorandom white noise to create a simulated incoherent scatter signal.A small section of this signal and its power spectrum is shown in Fig. 2.
This signal is created initially with zero Doppler shift and is, of course, a purely real signal, and its power spectrum is symmetric, as expected.A non-zero Doppler shift is imposed by multiplying the purely real signal with a complex exponential, with a frequency equal to the desired Doppler shift, resulting in a complex baseband signal.The effects on the spectra of the relative delay between the real and imaginary parts of the synthetic signal correspond to those occurring in actual observations, as we will see below.
Figure 3 shows the results of the simulation.Each panel shows power spectra (blue lines) computed for a given Doppler shift and a given delay and the deviation from the correct spectrum (red lines).The first row shows that symmetric spectra are not afflicted, while the second and third rows show how spectra with noticable Doppler shifts have been afflicted, even though their spectral shapes are still credible.The last two rows show increasingly more significant effects, where any portion of the effect in a given spectral region is transferred to its mirror region.Figure 4 shows the results when a very asymmetric double-humped spectrum with narrow peaks has a relatively large Doppler shift, a situation which occasionally happens at high latitudes when there are large field-aligned ion outflows accompanied by plasma instabilities that distort the incoherent scatter spectrum, the so-called naturally enhanced ionacoustic echoes (Sedgemore-Schulthess and St.-Maurice, 2001, and references therein).This figure clearly shows that "image" peaks are created, resulting in what might be interpreted as a triple-humped spectrum, or a bifurcation of the upshifted shoulder.Using data afflicted in this way, one might unknowingly attempt to attribute a physical origin to such spectral features.

Observations
In January 2003, the University of Tromsø ran a combined optical and interferometric radar campaign intended for the study of enhanced ion-acoustic echoes and their connection to dynamical aurora.The interferometry setup was similar to that presented by Grydeland et al. (2003Grydeland et al. ( , 2004a)).The radar program used for the present observations is a new design, but it is similar to the one used for the previous studies in that it is a long-pulse multiple frequency program.The pulses are 550 µs long, and the basic sampling period of the experiment is 20 µs.
For interferometric observations, the two antennas of the EISCAT Svalbard Radar are pointed in the same direction, one of the two is used to transmit and both are used to receive the scattered signal.The signals from the two antennas are split and sampled separately in both the standard ESR receiver and the University of Tromsø MIDAS-W system (Holt et al., 2000;Grydeland et al., 2005).The MIDAS-W data was stored at the voltage level for off-line processing.The data presented here has been processed in a way that matches the processing of the standard ESR system as closely as possible.From the resulting lag profile matrices (LPMs), range-gated autocorrelation function (ACF) estimates have been extracted, using trapezoidal rule summation with a gating roughly corresponding to half the pulse length, 280 µs or 42 km.These ACFs have then been Fourier transformed to make spectral estimates, using a Hanning lag window to reduce spectral leakage.Figure 5 shows an example of enhanced ion-acoustic echoes observed in the two systems, presented to make direct comparison possible.The power in the spectra are shown using a logarithmic scale, so 10 dB is a factor of 10 enhancement.The data has not been subjected to background (noise) subtraction or correction for range squared attenuation.The top left panel shows data taken in the MIDAS-W system, unafflicted by the 1-sample shift, while the bottom right panel shows the corresponding data obtained in the standard ESR digital receiver, where the imaginary part of the signal was inadvertently advanced by 1 sample, corresponding to a delay of −20 µs.(The feature at zero frequency is a result  4. Simulation of the effect on a synthetic spectrum made to resemble naturally enhanced ion-acoustic echoes.The synthetic spectrum is shown in blue, the spectrum afflicted by the error in red.Although both spectral peaks have been partially mirrored, the Doppler shift of the entire spectrum means that the upshifted peak is much closer to zero frequency, and its mirror image is almost indiscernible.The downshifted peak is stronger, and subject to stronger mirroring, and its upshifted mirror image is slightly stronger than the true upshifted peak.The resulting spectrum has a "triple-humped" shape, or an apparent bifurcation of the upshifted peak. of incomplete DC subtraction and is not of interest to the present discussion.)

Introducing the error artificially
Since the data collected in the MIDAS-W system is at the voltage level, we have the opportunity to introduce the same error at the corresponding point in the processing of this data.The top right panel in Fig. 5 shows spectra obtained in this way, and by comparing to the ESR observations in the bottom right panel, it is clear that the difference between the spectral shapes observed in the two systems is fully explained by the processing error which was unknown at the time of the experiment.

Correcting the error
The result (6) indicates a procedure to correct the error in previously made observations.By separating the afflicted spectral estimates S into symmetric ( M ) and anti-symmetric ( A ) components, we can recreate a corrected spectral estimate by except where cos ωτ =0.In practice, a range of frequencies where the absolute value of cos ωτ is small cannot be corrected directly.To put it differently: due to the relative delay, the quantity being estimated has zero, or a near-zero, anti-symmetric component near where cos ωτ is zero; hence, the anti-symmetric component of the true spectrum at these frequencies cannot be estimated from the afflicted measurements.
The bottom left panel of Fig. 5 shows the result of applying the correction of Eq. ( 10).The frequencies of ±12.5 kHz correspond to cos ωτ =0, and at nearby frequencies the correction procedure does not work, but for other frequencies, the recovered spectral shapes compared to those obtained in the unafflicted MIDAS-W system is a convincing demonstration of the correction procedure.
Although the expected value of the anti-symmetric component of the spectral estimate S is zero where cos ωτ =0, this term vanishes only in a statistical sense.A finite averaging only decreases its value in inverse proportion to the square root of the number of points being averaged.For this reason, any particular estimate will in general have a non-zero contribution from this term.In addition, there is also the contribution from random noise.When applying the correction of Eq. ( 10), the remaining level of the anti-symmetric part of the spectral estimate will be amplified near the singularity.In Fig. 5, this can be identified as artificially large or small spectral values at the frequencies closest to the singularities.

Discussion
A close inspection of the distorted spectra compared to the correct spectra indicates that for small Doppler shifts, the results of the fitting, inasmuch as the values of the plasma parameters is concerned, will not be greatly afflicted.However, the error bars attributed to the fitted parameters will be clearly larger.As the Doppler shift increases, the fitted plasma parameters will start increasingly to deviate from their correct values.In particular, the outer edges of the spectrum can be shifted/broadened, resulting in artificially smaller velocity/larger temperature estimates.
We have presented a way to directly correct for the error in the afflicted data, but the correction is not perfect.For frequency intervals where cos ωτ is small, the anti-symmetric part of the spectra cannot be recovered, as described above.However, it is possible to interpolate the anti-symmetric component in these narrow frequency intervals from neighbouring regions.For applications where the detailed spectral shape is of interest, such as the study of enhanced ionacoustic echoes, or whenever spectra are produced for human consumption, as for real-time spectral displays, this correction should be applied, with or without interpolation over the singular region.
When analysing for plasma physical parameters, however, it is better not to correct the afflicted data at all.Instead, one should allow for the effect by modifying the theoretical spectra in the forward part of the inverse method used to analyse the afflicted data.A theoretical spectrum is computed as usual for a trial Doppler shift and other plasma parameters, but the anti-symmetric component of the theoretical spectrum is multiplied by cos ωτ before the theoretical spectrum is fitted to the uncorrected afflicted data.We believe this to be the best way to deal with the error when analysing afflicted data.
Since we know the symmetric component of the afflicted measurement is not influenced by the error, it is also possible to fit directly to this component alone and to disregard the anti-symmetric component.All the plasma parameters can be extracted from the symmetric part of the spectrum except for the sign of the Doppler shift.This sign can then be readily extracted from the anti-symmetric part, despite the error, and not be encumbered by the cos ωτ singularity.
Either of these two schemes will avoid dealing with the singular division by cos ωτ which is necessary if one chooses to correct the afflicted measured data.Nevertheless, the error has created a "blind spot" in the sense that for some combinations of spectral width and small Doppler shifts, the velocity influences the anti-symmetric component of the spectrum chiefly in the region where this component is not estimated.For these cases, Doppler velocity cannot be estimated from the observations.In our experiment with 20 µs sampling, the blind spot is for spectral widths near 25 kHz, while for the 16 µs sampling used in the standard tau0 experiment, the blind spot is for spectral widths near 31.25 kHz.In typical ESR cases, this should not be a problem.
Due to the error, parameters that previously influenced the theoretical spectra in quite separate ways (e.g.T i /m i and v i ), now have somewhat overlapping influences.This could create coupling between estimated parameters and their errors which did not exist previously.

Conclusions
In this paper we have evaluated the consequences on the incoherent scattering spectrum of a relative delay between the real and imaginary parts (or in-phase and quadrature components) of the outputs of quadrature receivers employed in incoherent scattering radars.In particular, we have discussed the type of error produced in a digital receiver when one of the two output streams is not synchronized with the other, owing to one or more samples in the afflicted stream having been (inadvertently) dropped.We derived an analytical expression for how this error influences the measured spectra, from which we introduced a procedure to correct for the error.We also simulated the error using pure tones and synthetic stochastic signals.The simulations using pure tones confirm the theoretical result that the result of the phase mismatch is a tendency to modulate the anti-symmetric component of the power spectrum, even enough to transfer all the power to a mirror frequency.This effect appears clearly for large Doppler shifts, as shown by simulations performed using synthetic incoherent scatter signals.For small Doppler shifts of a few hundred meters per second, the distortions in the spectrum amount to around 5-10% at each spectral point.A visual inspection indicates that these distortions will produce only small changes in the fitted plasma parameters while the error bars might increase by a corresponding amount.For larger Doppler shifts approaching 1 km s −1 , the fitted plasma parameters will be afflicted, as well as the errors.For very asymmetric spectra with large Doppler shifts, known as naturally enhanced ion-acoustic echoes, the result is the creation of image peaks, which can at times be stronger than the true spectral peaks.For such studies, this effect is clearly more than an academic curiosity.
Since for the most common values of ionospheric velocities the Doppler shift is not largely measured as a fraction of the signal bandwidth, the danger exists that the presence of such an error may pass undetected, as the distortion of the spectrum is not great and the resulting plasma parameters, although in error, will still be within typical values.More worrisome is the situation when there are large Doppler shifts, which occasionally occur, especially when there are large convection electric fields and/or large ion outflows not uncommon at high latitudes where several incoherent scattering radars are located.Plasma instabilities usually occur under these conditions and it will be all too easy to attempt to give physical significance to these artifacts, as, for example, to erroneous mirror peaks, as indicated above.The actual shape of the radar spectrum under plasma instabilities/turbulence is usually not known.When the distortions are slight under not very large Doppler, the error will pass undetected.When the distortions are large under large Doppler shifts, which is known to be accompanied by plasma instability/turbulence, the distortions will be interpreted as physical, a result of the plasma instability/turbulence and new theories may even be constructed.For these reasons routine checks should be carried out at incoherent scattering facilities to test for integrity of the phase, as well amplitude, of the outputs of the quadrature receivers, particularly when large changes are made in software systems.
Software is an increasingly critical part of modern scientific instruments, both as part of the data acquisition process and in the analysis, presentation and interpretation of these data.At the same time, software is perhaps not always recognized as having an importance on par with that of hardware, and engineering practices necessary to ensure quality control of software are often not in place.
In the presently discussed case, the effects of the error were mild, a method has been found to correct for the error in data already taken, and there is good reason to believe that none of this data is beyond recovery.At the same time, the following recent failures, all of which were attributed to software errors: the Ariane 5 maiden flight (see, e.g. the Ariane 5 flight 105 Inquiry Board report1 , or the ESA press release2 ); the navigation failure caused by mixing metric and imperial units leading to the loss of the MCO (see, e.g. the official inquiry board report 3 ); or the premature shutdown of the main thrusters which led to the loss of the Mars Polar Lander (see, e.g. the official inquiry board report 4 ), and the disastrous consequences of these failures serve as "a sobering reminder" that certain design principles and quality control for software is more than just "a pleasant academic ideal" (Jézéquel and Meyer, 1997).On the other hand, precisely the lack of spectacular effects in the EISCAT case is certainly part of the reason the bug could remain undetected for several months.

Fig. 1 .Fig. 2 .
Fig. 1.Simulating the error on synthetic (pure-tone) signal.The left panel shows power spectra (in dB) of a pure-tone signal, for frequencies comparable to the ion-acoustic frequency for incoherent scatter radars.The right panel shows the result when a delay of one 20 µs sample is introduced in the imaginary part.

FrequencyFig. 3 .
Fig. 3.Simulations on synthetic data.The data presented in Fig.2was multiplied with a complex exponential, resulting in a Doppler shift of the power spectrum.The imaginary part was then advanced by a number of samples, corresponding to a given number of microseconds.The figure shows the resulting power spectrum estimates for Doppler shifts from zero to −4 kHz, and with imaginary part shifts of zero to 30 µs.The deviation from the correct power spectrum is plotted in red.Shifting the imaginary part in the opposite direction produces spectra indistinguishable from those plotted.
Fig.4.Simulation of the effect on a synthetic spectrum made to resemble naturally enhanced ion-acoustic echoes.The synthetic spectrum is shown in blue, the spectrum afflicted by the error in red.Although both spectral peaks have been partially mirrored, the Doppler shift of the entire spectrum means that the upshifted peak is much closer to zero frequency, and its mirror image is almost indiscernible.The downshifted peak is stronger, and subject to stronger mirroring, and its upshifted mirror image is slightly stronger than the true upshifted peak.The resulting spectrum has a "triple-humped" shape, or an apparent bifurcation of the upshifted peak.

Fig. 5 .
Fig. 5.One of the observed enhancement events, as seen by the two systems.MIDAS-W spectra in the top left panel, ESR spectra in the bottom right.The top right panel shows the spectra obtained from the MIDAS-W data when the imaginary part of the baseband signal is advanced by 20 µs in the equivalent processing.The bottom left panel shows the result of the spectrum corrected by the procedure discussed in Sect.4.2.The frequencies of ±12.5 kHz correspond to cos ωτ =0, and for nearby frequencies, artifacts are introduced.The observations shown are from 26 January 2003, the 2-s integration starting at 06:53:14 UT.Spectra are not background subtracted, and not corrected for attenuation with range squared.