def test_data(self, shiftN, N1): sig = self.s[0] syms = self.s.symbols[0] sig2 = np.roll(sig, shift=shiftN) offset = ber_functions.find_sequence_offset(syms[:N1], sig2) sig2 = np.roll(sig2, offset) npt.assert_allclose(syms[:N1], sig2[:N1], atol=self.d/4)
def test_shift(self, shiftN, snr, N1): sig = impairments.change_snr(self.s, self.s.fb, self.s.fs, snr) sig = sig[0] syms = sig.symbols[0] sig2 = np.roll(sig, shift=shiftN) offset = ber_functions.find_sequence_offset(syms[:N1], sig2) assert (offset == -shiftN) or ((3*10**4 - offset )== shiftN)
def test_ints_shift2(self, shiftN, N1): b = np.random.randint(0,2, 2**16) b2 = np.roll(b, shift=shiftN) offset = ber_functions.find_sequence_offset(b, b2[:N1]) assert (shiftN == -offset) or (shiftN+offset == 2**16)