-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add nrPDSCHMCSTables() and bump version to 0.5.1
- Loading branch information
Showing
4 changed files
with
69 additions
and
1 deletion.
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,44 @@ | ||
import numpy as np | ||
|
||
def qm_to_mod(qm): | ||
if qm == 1: | ||
return 'BPSK' | ||
if qm == 2: | ||
return 'QPSK' | ||
if qm == 4: | ||
return '16QAM' | ||
if qm == 6: | ||
return '64QAM' | ||
assert False, f'modulation order = {qm} is not supported' | ||
return 0 | ||
|
||
class qam16_table(): | ||
def __init__(self): | ||
self._table = np.zeros((4, 29), int) | ||
self._table[0,:] = np.arange(self._table.shape[1]) | ||
self._table[1,:] = np.array( [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]) | ||
self._table[2,:] = np.array([120,157,193,251,308,379,449,526,602,679,340,378,434,490,553,616,658,438,466,517,567,616,666,719,772,822,873,910,948]) | ||
|
||
def Qm(self, mcs): | ||
return self._table[1,mcs] | ||
|
||
def Modulation(self, mcs): | ||
return qm_to_mod(self._table[1,mcs]) | ||
|
||
def Rate(self, mcs): | ||
return self._table[2,mcs] / 1024 | ||
|
||
|
||
class pdsch_mcs_table_class(): | ||
def __init__(self): | ||
self.QAM64Table = qam16_table() | ||
|
||
def nrPDSCHMCSTables(): | ||
return pdsch_mcs_table_class() | ||
|
||
if __name__ == '__main__': | ||
table = nrPDSCHMCSTables().QAM64Table | ||
mcs = 0 | ||
print(f'mcs = {mcs}, modulation = {table.Modulation(mcs)}, rate = {table.Rate(mcs)}') | ||
mcs = 16 | ||
print(f'mcs = {mcs}, modulation = {table.Modulation(mcs)}, rate = {table.Rate(mcs)}') |
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,23 @@ | ||
import numpy as np | ||
|
||
from py3gpp.nrPDSCHMCSTables import nrPDSCHMCSTables | ||
|
||
def test_nrPDSCHMCSTables(): | ||
table = nrPDSCHMCSTables().QAM64Table | ||
mcs = 0 | ||
assert table.Modulation(mcs) == 'QPSK' | ||
assert table.Qm(mcs) == 2 | ||
assert table.Rate(mcs) == 120 / 1024 | ||
|
||
mcs = 15 | ||
assert table.Modulation(mcs) == '16QAM' | ||
assert table.Qm(mcs) == 4 | ||
assert table.Rate(mcs) == 616 / 1024 | ||
|
||
mcs = 16 | ||
assert table.Modulation(mcs) == '16QAM' | ||
assert table.Qm(mcs) == 4 | ||
assert table.Rate(mcs) == 658 / 1024 | ||
|
||
if __name__ == '__main__': | ||
test_nrPDSCHMCSTables() |