Skip to content

Commit

Permalink
First attempts
Browse files Browse the repository at this point in the history
  • Loading branch information
gvanhoy committed Sep 5, 2023
1 parent 157626d commit 594b1a5
Show file tree
Hide file tree
Showing 6 changed files with 261 additions and 140 deletions.
106 changes: 53 additions & 53 deletions tests/test_transforms_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,60 +25,60 @@ def generate_data():


transforms_list = [
(
"random_resample_up",
RandomResample(1.5, num_iq_samples=128, keep_samples=False),
RandomResample(1.5, num_iq_samples=4096, keep_samples=False),
),
(
"random_resample_down",
RandomResample(0.75, num_iq_samples=128, keep_samples=False),
RandomResample(0.75, num_iq_samples=4096, keep_samples=False),
),
# (
# "random_resample_up",
# RandomResample(1.5, num_iq_samples=128, keep_samples=False),
# RandomResample(1.5, num_iq_samples=4096, keep_samples=False),
# ),
# (
# "random_resample_down",
# RandomResample(0.75, num_iq_samples=128, keep_samples=False),
# RandomResample(0.75, num_iq_samples=4096, keep_samples=False),
# ),
("add_noise", AddNoise(-10), AddNoise(-10)),
("time_varying_noise", TimeVaryingNoise(-30, -10), TimeVaryingNoise(-30, -10)),
(
"rayleigh_fading",
RayleighFadingChannel(0.05, (1.0, 0.5, 0.1)),
RayleighFadingChannel(0.05, (1.0, 0.5, 0.1)),
),
("phase_shift", RandomPhaseShift(0.5), RandomPhaseShift(0.5)),
("time_shift", RandomTimeShift(-100.5), RandomTimeShift(-2.5)),
(
"time_crop",
TimeCrop("random", length=128),
TimeCrop("random", length=4096),
),
("time_reversal", TimeReversal(False), TimeReversal(False)),
("frequency_shift", RandomFrequencyShift(-0.25), RandomFrequencyShift(-0.25)),
(
"delayed_frequency_shift",
RandomDelayedFrequencyShift(0.2, 0.25),
RandomDelayedFrequencyShift(0.2, 0.25),
),
(
"oscillator_drift",
LocalOscillatorDrift(0.01, 0.001),
LocalOscillatorDrift(0.01, 0.001),
),
("gain_drift", GainDrift(0.01, 0.001, 0.1), GainDrift(0.01, 0.001, 0.1)),
(
"iq_imbalance",
IQImbalance(3, np.pi / 180, 0.05),
IQImbalance(3, np.pi / 180, 0.05),
),
("roll_off", RollOff(0.05, 0.98), RollOff(0.05, 0.98)),
("add_slope", AddSlope(), AddSlope()),
("spectral_inversion", SpectralInversion(), SpectralInversion()),
("channel_swap", ChannelSwap(), ChannelSwap()),
("magnitude_rescale", RandomMagRescale(0.5, 3), RandomMagRescale(0.5, 3)),
(
"drop_samples",
RandomDropSamples(0.3, 50, ["zero"]),
RandomDropSamples(0.3, 50, ["zero"]),
),
("quantize", Quantize(32, ["floor"]), Quantize(32, ["floor"])),
("clip", Clip(0.85), Clip(0.85)),
# ("time_varying_noise", TimeVaryingNoise(-30, -10), TimeVaryingNoise(-30, -10)),
# (
# "rayleigh_fading",
# RayleighFadingChannel(0.05, (1.0, 0.5, 0.1)),
# RayleighFadingChannel(0.05, (1.0, 0.5, 0.1)),
# ),
# ("phase_shift", RandomPhaseShift(0.5), RandomPhaseShift(0.5)),
# ("time_shift", RandomTimeShift(-100.5), RandomTimeShift(-2.5)),
# (
# "time_crop",
# TimeCrop("random", length=128),
# TimeCrop("random", length=4096),
# ),
# ("time_reversal", TimeReversal(False), TimeReversal(False)),
# ("frequency_shift", RandomFrequencyShift(-0.25), RandomFrequencyShift(-0.25)),
# (
# "delayed_frequency_shift",
# RandomDelayedFrequencyShift(0.2, 0.25),
# RandomDelayedFrequencyShift(0.2, 0.25),
# ),
# (
# "oscillator_drift",
# LocalOscillatorDrift(0.01, 0.001),
# LocalOscillatorDrift(0.01, 0.001),
# ),
# ("gain_drift", GainDrift(0.01, 0.001, 0.1), GainDrift(0.01, 0.001, 0.1)),
# (
# "iq_imbalance",
# IQImbalance(3, np.pi / 180, 0.05),
# IQImbalance(3, np.pi / 180, 0.05),
# ),
# ("roll_off", RollOff(0.05, 0.98), RollOff(0.05, 0.98)),
# ("add_slope", AddSlope(), AddSlope()),
# ("spectral_inversion", SpectralInversion(), SpectralInversion()),
# ("channel_swap", ChannelSwap(), ChannelSwap()),
# ("magnitude_rescale", RandomMagRescale(0.5, 3), RandomMagRescale(0.5, 3)),
# (
# "drop_samples",
# RandomDropSamples(0.01, 50, ["zero"]),
# RandomDropSamples(0.01, 50, ["zero"]),
# ),
# ("quantize", Quantize(32, ["floor"]), Quantize(32, ["floor"])),
# ("clip", Clip(0.85), Clip(0.85)),
]


Expand Down
7 changes: 6 additions & 1 deletion tests/test_transforms_figures.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ def generate_data(modulation_name):


@pytest.mark.parametrize(
"transform, modulation_name", itertools.product(transforms_list, modulations)
"transform, modulation_name",
itertools.product(transforms_list, modulations),
ids=[
"{}-{}".format(x[0], y)
for x, y in itertools.product(transforms_list, modulations)
],
)
def test_transform_figures(transform, modulation_name):
short_data, long_data = generate_data(modulation_name)
Expand Down
Loading

0 comments on commit 594b1a5

Please sign in to comment.