Skip to content

Commit

Permalink
mapping: Add docstrings to make pydocstyle happy
Browse files Browse the repository at this point in the history
  • Loading branch information
noc0lour committed May 22, 2023
1 parent 8c47685 commit 7d9d646
Show file tree
Hide file tree
Showing 2 changed files with 184 additions and 34 deletions.
20 changes: 19 additions & 1 deletion src/mokka/mapping/numpy.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""NumPy implementation of Mappers and Demappers."""

import numpy as np
from ..utils.bitops import gray
from scipy import interpolate as interp
Expand All @@ -9,10 +11,13 @@

class QAM:
"""
Arbitrarily sized QAM constellation with gray mapping
Arbitrarily sized QAM constellation with gray mapping.
:param m: Information per symbol [bit/symbol]
"""

def __init__(self, m):
"""Construct QAM class."""
if m % 2:
raise ValueError(
"Only bits/per Symbol which are multiple of 2 are supported"
Expand All @@ -36,11 +41,24 @@ def __init__(self, m):
)

def get_constellation(self):
"""
Return all constellation symbols.
The index represents the integer representation of
the encoded bit-string (LSB first).
:returns: all constellation symbols
"""
bits = generate_all_bits(self.m)
symbols = self.map(bits)
return symbols

def map(self, bits):
"""
Perform mapping of bitstrings.
:returns: complex symbol per bitstring of length `self.m`
"""
output = []
for seq in bits.reshape(-1, self.m):
# Take first half for real and second half for imag
Expand Down
Loading

0 comments on commit 7d9d646

Please sign in to comment.