def test_mode3_length2(self): # set up fg total_segments = 1 mode = 3 length = 2 total_carriers = total_segments * 96 * 2**(mode - 1) deinterleaver = isdbt.time_deinterleaver_1seg(mode, length) how_many = 1000 # the input data are how_many vector (each entry with the same number ranging from 1 to how_many) # that increases by one with each new vector src_data = [[i + 1] * total_carriers for i in range(how_many)] src_data = [item for sublist in src_data for item in sublist] src = blocks.vector_source_c(src_data, False, total_carriers) dst = blocks.vector_sink_c(total_carriers) self.tb.connect(src, deinterleaver) self.tb.connect(deinterleaver, dst) self.tb.run() actual_result = dst.data() for carrier in range(total_carriers): # in each carrier, I should have an increasing number as an output, preceded by # as many zeros as the delay correponding to the particular carrier mi = (5 * carrier) % 96 delay = length * (95 - mi) carrier_actual_result = [] for i in range(how_many): carrier_actual_result.append(actual_result[i * total_carriers + carrier]) carrier_expected_result = [0] * min(how_many, delay) carrier_expected_result += range(1, how_many - delay + 1) self.assertFloatTuplesAlmostEqual(carrier_expected_result, carrier_actual_result)
def test_mode3_length2 (self): # set up fg total_segments = 1; mode = 3; length=2 total_carriers = total_segments*96*2**(mode-1) deinterleaver = isdbt.time_deinterleaver_1seg(mode, length) how_many = 1000 # the input data are how_many vector (each entry with the same number ranging from 1 to how_many) # that increases by one with each new vector src_data = [[i+1]*total_carriers for i in range(how_many)] src_data = [item for sublist in src_data for item in sublist] src = blocks.vector_source_c(src_data, False, total_carriers) dst = blocks.vector_sink_c(total_carriers) self.tb.connect(src,deinterleaver) self.tb.connect(deinterleaver,dst) self.tb.run() actual_result = dst.data() for carrier in range(total_carriers): # in each carrier, I should have an increasing number as an output, preceded by # as many zeros as the delay correponding to the particular carrier mi = (5*carrier) % 96 delay = length*(95-mi) carrier_actual_result = [] for i in range(how_many): carrier_actual_result.append(actual_result[i*total_carriers+carrier]) carrier_expected_result = [0]*min(how_many,delay) carrier_expected_result += range(1,how_many-delay+1) self.assertFloatTuplesAlmostEqual(carrier_expected_result, carrier_actual_result)