-
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.
add matlab test for nrRateRecoverPolar()
- Loading branch information
Showing
1 changed file
with
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import matlab.engine | ||
import itertools | ||
import numpy as np | ||
import pytest | ||
|
||
from py3gpp.nrRateRecoverPolar import nrRateRecoverPolar | ||
|
||
def run_nrRateRecoverPolar(N, eng): | ||
K = 56 | ||
cw = np.arange(N) | ||
ref_data = eng.nrRateRecoverPolar(eng.transpose(eng.double(cw)), eng.double(K), eng.double(N)) | ||
ref_data = np.array(list(itertools.chain(*ref_data))) | ||
|
||
data = nrRateRecoverPolar(cw, K, N, False) | ||
|
||
assert (ref_data == data).all() | ||
|
||
@pytest.fixture(scope='session') | ||
def eng(): | ||
eng = matlab.engine.connect_matlab() | ||
yield eng | ||
eng.quit() | ||
|
||
@pytest.mark.parametrize("N", [512, 256, 128]) | ||
def test_nrRateRecoverPolar(N, eng): | ||
run_nrRateRecoverPolar(N, eng) | ||
|
||
if __name__ == '__main__': | ||
_eng = matlab.engine.connect_matlab() | ||
test_nrRateRecoverPolar(512, _eng) | ||
_eng.quit() |