What could cause a phase difference between a FPGA implemented FFT and numpy.fft.rfft We have a FPGA system which takes input from an ADC and calculates a FFT.  The system identifies the location of our frequencies of interest and sends the coefficients from those bins to my software.  In addition to the coefficients I am sent the time series data
While the hardware guys were working on the hardware I developed additional signal processing code.  To enable testing and development I wrote some code to synthesize the signals I expected to receive from the hardware and that works fine.  Not unexpectedly now that I have live data nothing works.
In the process of debuging the problem I am taking the real world time series data and using np.numpy.fft.rfft to look at the spectrum.  When I plot the spectrum I see our frequencies of interest in the correct FFT bins. I normalize the PSD and the Python's FFT and the hardware FFT match well.  The problem I see is the phases of the coefficients do not match.  The difference in phases don't look ordered.  (Just looking at the phase difference in a plot).
When I compute a FFT on the time series provided by the FPGA (this is the real world data) using numpy.fft.rfft I expect the coefficients at my frequencies of interest to have the same phases as the coefficients calculated by the FPGA FFT which is operating on the same time series.
Does anyone have an idea of what could cause FFT's on the same real world time series data to have different coefficient phases?
Thanks
Justin
Unless the sampling of the real signal is synchronized with the data, the sampled real data will often have different phases from synthesized data. The real signal will also not be noiseless.
Think of this as the difference between:
$$
x_{\tt real} [n] = A \sin (\omega n + \theta) + \epsilon[n]
$$
and
$$
x_{\tt synthetic} [n] = A \sin (\omega n ) 
$$
Here, $\theta$ is the phase offset due to the lack of synchronization and $\epsilon$ is the noise sequence.

Another thought: I'm wondering if it's a problem of offsets?  The manual entry for rfft says:

The truncated or zero-padded input, transformed along the axis
indicated by axis, or the last one if axis is not specified. If n is
even, the length of the transformed axis is (n/2)+1. If n is odd, the
length is (n+1)/2.

The numerical example at the bottom shows:

which indicates that while fft returns $N$ points, rfft returns $N-1$ points.  Could it be an indexing issue?