Trouble with time-syncing two radio signals using cross-correlation
It will work when you take the 2nd gradient of the signals:

import numpy as np
from scipy import signal

s0 = np.gradient(np.gradient(s0))
s1 = np.gradient(np.gradient(s1))
np.argmax(signal.correlate(s0, s1)) -&gt; 525358


That corresponds to a shift of 1071 which is close to your expected 1069
Interestingly the minimum (most negative correlation) is close by at 1069

Plotting the cross-correlation of 2nd gradient gives a reasonably sharp peak:


Zomming in to the accordingly shifted data shows that this worked:



Using the most negative correlation results in the almost same picture:


What might be surprising is that the min and max are just two samples apart and also that the signal seems to be significantly phase shifted. On the other hand the start is matched perfectly. My interpretation of this is that the sync is not so much done by what we see as signal but by some high frequency parts of noise received in both channels. Since this 2 sample shift between min and max is the typical result when matching two channels that received the same random noise.

I can not explain easily why the correlation of the original data works in some cases. But here is an simple example that gives an idea:

a = np.array([0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 0, 0, 0, 0], dtype=float)
b = np.array([0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 0, 0, 0, 0], dtype=float)
np.argmax(signal.correlate(a, b)) -&gt; 16


which is correct

but when adding an offset it fails

a += 5
b += 5
np.argmax(signal.correlate(a, b)) -&gt; 20


the correlation of the first gradient still gives the right result but it will fail also if a significant ramp is added. Though for the 2nd gradient the correct result is achieved

a += np.array(range(0,len(a)))*5
b += np.array(range(0,len(b)))*5
np.argmax(signal.correlate(a, b)) -&gt; 20
a = np.gradient(a)
b = np.gradient(b)
np.argmax(signal.correlate(a, b)) -&gt; 20
a = np.gradient(a)
b = np.gradient(b)
np.argmax(signal.correlate(a, b)) -&gt; 16