def implementation_validation(): M = 33 K = 32 alpha = .5 overlap = 2 H = get_frequency_domain_filter('rrc', alpha, M, K, overlap) taps = gfdm_filter_taps('rrc', alpha, M, K, 1) A = gfdm_modulation_matrix(taps, M, K) tests = 100 max_rel_error = 0.0 for t in range(tests): d = get_random_samples(M * K) xmat = A.dot(d) / np.sqrt(len(d)) D = get_data_matrix(d, K, group_by_subcarrier=True) xfft = gfdm_modulate_block(D, H, M, K, overlap, False) / np.sqrt( len(d)) rel_err = np.linalg.norm(xmat - xfft) / np.linalg.norm(xmat) if rel_err > max_rel_error: max_rel_error = rel_err if rel_err > 1e-3: raise RuntimeError( 'Relative error between FFT and Matrix implementation is above 1e-3!' ) print 'maximum relative error is:', max_rel_error
def main(): np.set_printoptions(precision=2, linewidth=150) alpha = .2 active_subcarriers = 52 timeslots = 9 fft_len = 64 cp_len = fft_len // 2 cs_len = cp_len // 2 subcarrier_map = mapping.get_subcarrier_map(fft_len, active_subcarriers, dc_free=True) ref_frame, modulated_frame, x_preamble, data, freq_filter_taps = generate_integrated_frame( timeslots, fft_len, active_subcarriers, cp_len, cs_len, alpha) test_frame = np.concatenate( (.001 * utils.get_random_samples(1000), ref_frame, .001 * utils.get_random_samples(1000)))
def main(): np.set_printoptions(precision=2, linewidth=150) alpha = .2 active_subcarriers = 52 timeslots = 9 fft_len = 64 cp_len = fft_len // 2 cs_len = cp_len // 2 subcarrier_map = mapping.get_subcarrier_map(fft_len, active_subcarriers, dc_free=True) ref_frame, modulated_frame, x_preamble, data, freq_filter_taps = generate_integrated_frame(timeslots, fft_len, active_subcarriers, cp_len, cs_len, alpha) test_frame = np.concatenate((.001 * utils.get_random_samples(1000), ref_frame, .001 * utils.get_random_samples(1000)))
def gr_conformity_validation(): M = 32 K = 8 alpha = .5 oversampling_factor = 1 overlap = 2 tests = 100 for t in range(tests): # d = np.random.standard_normal(2 * M * K) # d = np.reshape(d, (2, -1)) # d = d[0] + 1j * d[1] d = get_random_samples(M * K) xo = gfdm_tx_fft2(d, 'rrc', alpha, M, K, overlap, oversampling_factor) xn = gfdm_gr_modulator(d, 'rrc', alpha, M, K, overlap) assert np.all(np.abs(xo - xn) < 1e-4)
def gr_conformity_validation(): M = 32 K = 8 alpha = .5 oversampling_factor = 1 overlap = 2 tests = 100 for t in range(tests): # d = np.random.standard_normal(2 * M * K) # d = np.reshape(d, (2, -1)) # d = d[0] + 1j * d[1] d = get_random_samples(M * K) xo = gfdm_tx_fft2(d, 'rrc', alpha, M, K, overlap, oversampling_factor) xn = gfdm_gr_modulator(d, 'rrc', alpha, M, K, overlap) if not np.all(xo == xn): raise RuntimeError('Function results deviate')
def implementation_validation(): M = 33 K = 32 alpha = .5 overlap = 2 H = get_frequency_domain_filter('rrc', alpha, M, K, overlap) taps = gfdm_filter_taps('rrc', alpha, M, K, 1) A = gfdm_modulation_matrix(taps, M, K) tests = 100 max_rel_error = 0.0 for t in range(tests): d = get_random_samples(M * K) xmat = A.dot(d) / np.sqrt(len(d)) D = get_data_matrix(d, K, group_by_subcarrier=True) xfft = gfdm_modulate_block(D, H, M, K, overlap, False) / np.sqrt(len(d)) rel_err = np.linalg.norm(xmat - xfft) / np.linalg.norm(xmat) if rel_err > max_rel_error: max_rel_error = rel_err if rel_err > 1e-3: raise RuntimeError('Relative error between FFT and Matrix implementation is above 1e-3!') print 'maximum relative error is:', max_rel_error