Skip to content

Commit

Permalink
ci: Fix failing CI
Browse files Browse the repository at this point in the history
remove temporary tests with missing input.

Fix formatting and consistency.

Signed-off-by: Johannes Demel <[email protected]>
  • Loading branch information
jdemel committed Oct 6, 2023
1 parent 1f4ad5b commit a8e9831
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 147 deletions.
30 changes: 6 additions & 24 deletions lib/advanced_receiver_kernel_cc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,6 @@ advanced_receiver_kernel_cc::advanced_receiver_kernel_cc(
d_freq_block.resize(d_kernel->block_size());
d_ic_time_buffer.resize(d_kernel->block_size());
d_ic_freq_buffer.resize(d_kernel->block_size());

// d_pilot_reference.push_back({ 0, 0, gr_complex(0.70710678, -0.70710678) });
// d_pilot_reference.push_back({ 4, 0, gr_complex(-0.70710678, 0.70710678) });
// d_pilot_reference.push_back({ 8, 0, gr_complex(0.70710678, -0.70710678) });
// d_pilot_reference.push_back({ 12, 0, gr_complex(0.70710678, 0.70710678) });
// d_pilot_reference.push_back({ 16, 0, gr_complex(0.70710678, -0.70710678) });
// d_pilot_reference.push_back({ 20, 0, gr_complex(-0.70710678, -0.70710678) });
// d_pilot_reference.push_back({ 24, 0, gr_complex(0.70710678, 0.70710678) });
// d_pilot_reference.push_back({ 28, 0, gr_complex(-0.70710678, 0.70710678) });

// d_pilot_reference.push_back({ 34, 0, gr_complex(-0.70710678, -0.70710678) });
// d_pilot_reference.push_back({ 38, 0, gr_complex(0.70710678, -0.70710678) });
// d_pilot_reference.push_back({ 42, 0, gr_complex(0.70710678, -0.70710678) });
// d_pilot_reference.push_back({ 46, 0, gr_complex(-0.70710678, -0.70710678) });
// d_pilot_reference.push_back({ 50, 0, gr_complex(0.70710678, -0.70710678) });
// d_pilot_reference.push_back({ 54, 0, gr_complex(-0.70710678, 0.70710678) });
// d_pilot_reference.push_back({ 58, 0, gr_complex(0.70710678, -0.70710678) });
// d_pilot_reference.push_back({ 62, 0, gr_complex(0.70710678, 0.70710678) });
}

void advanced_receiver_kernel_cc::perform_ic_iterations(gr_complex* p_out,
Expand Down Expand Up @@ -162,12 +144,12 @@ gr_complex advanced_receiver_kernel_cc::estimate_pilot_distortion(const gr_compl
auto val = p_in[sidx * d_kernel->timeslots() + tidx];
// fmt::print("val={}\n", val);
auto phase = std::arg(val) - std::arg(ref);
fmt::print("sidx={:2}, tidx={}, {:+.3} vs. {:+.3}\t{:+.3}\n",
sidx,
tidx,
std::arg(ref),
std::arg(val),
phase);
// fmt::print("sidx={:2}, tidx={}, {:+.3} vs. {:+.3}\t{:+.3}\n",
// sidx,
// tidx,
// std::arg(ref),
// std::arg(val),
// phase);

result += phase;
}
Expand Down
2 changes: 1 addition & 1 deletion python/bindings/docstrings/transmitter_cc_pydoc_template.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 Free Software Foundation, Inc.
* Copyright 2023 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
Expand Down
6 changes: 3 additions & 3 deletions python/bindings/transmitter_cc_python.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 Free Software Foundation, Inc.
* Copyright 2023 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
Expand All @@ -14,7 +14,7 @@
/* BINDTOOL_GEN_AUTOMATIC(0) */
/* BINDTOOL_USE_PYGCCXML(0) */
/* BINDTOOL_HEADER_FILE(transmitter_cc.h) */
/* BINDTOOL_HEADER_FILE_HASH(8f7b28bfbde25e48c4af97a0c4aed39b) */
/* BINDTOOL_HEADER_FILE_HASH(764d84082aa27068d3df9c4e3abd4ca5) */
/***********************************************************************************/

#include <pybind11/complex.h>
Expand All @@ -30,7 +30,7 @@ namespace py = pybind11;
void bind_transmitter_cc(py::module& m)
{

using transmitter_cc = ::gr::gfdm::transmitter_cc;
using transmitter_cc = gr::gfdm::transmitter_cc;


py::class_<transmitter_cc,
Expand Down
27 changes: 0 additions & 27 deletions python/multi_port_receiver_cc.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,33 +74,6 @@ def __init__(
for port in range(num_antenna_ports)
]

# pilotsc = np.concatenate((np.arange(0, 29, 4) + 1, np.arange(63, 34, -4)))
# pilotsc = np.sort(pilotsc)
# pilots = []
# # pilots.append((1, 0, 1-1j ));
# pilots.append((5, 0, -1+1j ));
# pilots.append((9, 0, 1-1j ));
# pilots.append((13, 0, 1+1j ));
# pilots.append((17, 0, 1-1j ));
# pilots.append((21, 0, -1-1j ));
# pilots.append((25, 0, 1+1j ));
# pilots.append((29, 0, -1+1j ));

# pilots.append((35, 0, -1-1j ));
# pilots.append((39, 0, 1-1j ));
# pilots.append((43, 0, 1-1j ));
# pilots.append((47, 0, -1-1j ));
# pilots.append((51, 0, 1-1j ));
# pilots.append((55, 0, -1+1j ));
# pilots.append((59, 0, 1-1j ));
# pilots.append((63, 0, 1+1j ));

# pilots = [(p[0] - 1, p[1], p[2] / np.sqrt(2.)) for p in pilots]

# for r in self.receivers:
# r.activate_pilot_estimation(True)
# r.set_pilots(pilots)

# Define blocks and connect them
for port in range(num_antenna_ports):
# The demodulated complex symbols output
Expand Down
91 changes: 0 additions & 91 deletions python/qa_advanced_receiver_sb_cc.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,97 +197,6 @@ def test_004_active_subcarriers(self):
self.assertComplexTuplesAlmostEqual(data, res, 1)
# self.assertComplexTuplesAlmostEqual(data, res, 2)


def test_005_pilots(self):
np.set_printoptions(linewidth=250, precision=3)
print(f"Test receiver demodulator with pilots")
n_frames = 1
timeslots = 15
subcarriers = 64
active_subcarriers = 60
overlap = 2
ic_iterations = 2
f_taps = filters.get_frequency_domain_filter(
"rrc", 0.2, timeslots, subcarriers, overlap
)
gfdm_constellation = digital.constellation_calcdist(
[-0.707 - 0.707j, -0.707 + 0.707j, 0.707 + 0.707j, 0.707 - 0.707j],
[0, 1, 3, 2],
4,
1,
digital.constellation.AMPLITUDE_NORMALIZATION,
).base()
# print(gfdm_constellation.points())
subcarrier_map = get_subcarrier_map(subcarriers, active_subcarriers, True)
num_pilots = 16
pilot_spacing = 1 + subcarrier_map.size // num_pilots

upper_subcarrier_map = subcarrier_map[0:subcarrier_map.size // 2]
lower_subcarrier_map = subcarrier_map[subcarrier_map.size // 2:]
pilot_subcarriers = np.concatenate((upper_subcarrier_map[::-1][::pilot_spacing][::-1], lower_subcarrier_map[::pilot_spacing]))
pilot_subcarriers = np.sort(pilot_subcarriers)

import pathlib
data = np.load(pathlib.Path(__file__).parent / "symbols.npy")
# frame = np.load(pathlib.Path(__file__).parent / "frame.npy")

matdata = map_to_waveform_resource_grid(np.copy(data), active_subcarriers, subcarriers, subcarrier_map, True)

print(matdata)
print(matdata.shape)

scs = np.concatenate((np.arange(0, 29, 4) + 1, np.arange(63, 34, -4)))
scs = np.sort(scs)
refpilots = []
for s in scs:
p = matdata[s, 0]
print(f"{s=} t=0\t{p.real:+.3f} {p.imag:+.3f}")
refpilots.append((s, 0, p))

# data = get_random_qpsk(n_frames * timeslots * active_subcarriers)
# data *= 2.0
src = blocks.vector_source_c(data)
rot = 2. * np.pi * 0.02
eqdata = np.array([1.+0.j,] * timeslots * subcarriers) * np.exp(1.j * rot)
estimate = blocks.vector_source_c(eqdata)
mapper = gfdm.resource_mapper_cc(
timeslots, subcarriers, active_subcarriers, subcarrier_map, True
)
mod = gfdm.simple_modulator_cc(timeslots, subcarriers, overlap, f_taps)
demod = gfdm.advanced_receiver_sb_cc(
timeslots,
subcarriers,
overlap,
ic_iterations,
f_taps,
gfdm_constellation,
subcarrier_map,
0,
)
demod.set_ic(64)
demod.set_pilots(refpilots)
print(f"{demod.activate_pilot_estimation(True)=}")
demapper = gfdm.resource_demapper_cc(
timeslots, subcarriers, active_subcarriers, subcarrier_map, True
)
snk = blocks.vector_sink_c()
self.tb.connect(src, mapper, mod, demod, demapper, snk)
self.tb.connect(estimate, (demod, 1))
self.tb.run()

res = np.array(snk.data())
print(f"{rot=}")
print(data[0:10])
print(res[0:10])
used_pilots = demod.pilots()
print(used_pilots)
for ref, used in zip(refpilots, used_pilots):
self.assertEqual(ref[0], used[0])
self.assertEqual(ref[1], used[1])
self.assertComplexAlmostEqual(ref[2], used[2])
self.assertComplexTuplesAlmostEqual(data, res, 1)
# self.assertComplexTuplesAlmostEqual(data, res, 2)

def test_006_pilot_processing_chain(self):
np.set_printoptions(linewidth=250, precision=3)
print(f"Test pilot chain")
Expand Down
1 change: 0 additions & 1 deletion python/qa_resource_mapper_cc.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ def test_004_pilots_per_timeslot(self):
data = get_random_qpsk(frame_len)
ref = map_to_waveform_resources(data, active_subcarriers, subcarriers, smap, True)


for i in range(n_frames - 1):
d = get_random_qpsk(frame_len)
data = np.concatenate((data, d))
Expand Down

0 comments on commit a8e9831

Please sign in to comment.