-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import numpy as np | ||
|
||
def nrTransformDeprecode(modSym, mrb): | ||
mrb = int(mrb) | ||
assert modSym.shape[0] % (mrb * 12) == 0, "input number of rows must be an integer multiple of mrb * 12" | ||
return (np.fft.ifft(modSym.reshape(int(modSym.shape[0] / (mrb * 12)), mrb * 12)) * np.sqrt(mrb * 12)).ravel() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import sys | ||
import numpy as np | ||
import pytest | ||
|
||
from py3gpp.nrTransformPrecode import nrTransformPrecode | ||
from py3gpp.nrTransformDeprecode import nrTransformDeprecode | ||
from py3gpp.nrSymbolModulate import nrSymbolModulate | ||
|
||
sys.path.append("test_data") | ||
|
||
from test_data.transformPrecode import cw, desired_result_2, desired_result_40 | ||
|
||
def test_run_nrTransformPrecode_nrTransformDeprecode_2(): | ||
modSym = nrSymbolModulate(cw, 'QPSK') | ||
result = nrTransformPrecode(modSym, 2) | ||
assert np.array_equal(np.round(result, 8), np.round(desired_result_2, 8)) | ||
x = nrTransformDeprecode(result, 2) | ||
assert np.array_equal(np.round(x, 8), np.round(modSym, 8)) | ||
|
||
def test_run_nrTransformPrecode_nrTransformDeprecode_40(): | ||
modSym = nrSymbolModulate(cw, 'QPSK') | ||
result = nrTransformPrecode(modSym, 40) | ||
assert np.array_equal(np.round(result, 8), np.round(desired_result_40, 8)) | ||
x = nrTransformDeprecode(result, 40) | ||
assert np.array_equal(np.round(x, 8), np.round(modSym, 8)) | ||
|
||
if __name__ == '__main__': | ||
test_run_nrTransformPrecode_nrTransformDeprecode_2() | ||
test_run_nrTransformPrecode_nrTransformDeprecode_40() |