Bases: object
Class that is representation of the channel.
Attributes:
Name |
Type |
Description |
noise_type |
str
|
Type of noise in channel.
|
_noise_method |
Callable[[float, int, int], NDArray[float64]]
|
Method responible for generating noise.
|
Methods:
Name |
Description |
gwn |
Function returns samples of gaussian white noise.
|
send_through |
Function retunrs samples of signal after channel noise.
|
Source code in src\transmission_simulation.py
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 | class Channel(object):
"""
Class that is representation of the channel.
Attributes
----------
noise_type : str
Type of noise in channel.
_noise_method: Callable[[float, int, int], NDArray[np.float64]]
Method responible for generating noise.
Methods
-------
gwn()
Function returns samples of gaussian white noise.
send_through()
Function retunrs samples of signal after channel noise.
"""
def __init__(self, noise_type: str):
""""""
self.noise_type = noise_type
noise_method = getattr(self, noise_type)
if not isinstance(noise_method, (FunctionType, MethodType)):
raise ValueError(f"There is no such method '{noise_type}' in Channel class.")
self._noise_method = noise_method
def gwn(self, EbN0dB: float, K: int, N: int) -> NDArray[np.float64]:
""""""
N0Eb = 10 ** (-EbN0dB/10)
std_dev = sqrt(0.5 * N/K * N0Eb)
return np.random.randn(N) * std_dev
def send_through(self, mod_seq: NDArray[np.int8], EbN0dB: float, K: int) -> NDArray[np.float64]:
""""""
N = mod_seq.size
return mod_seq + self._noise_method(EbN0dB, K, N)
|
__init__(noise_type)
Source code in src\transmission_simulation.py
| def __init__(self, noise_type: str):
""""""
self.noise_type = noise_type
noise_method = getattr(self, noise_type)
if not isinstance(noise_method, (FunctionType, MethodType)):
raise ValueError(f"There is no such method '{noise_type}' in Channel class.")
self._noise_method = noise_method
|
gwn(EbN0dB, K, N)
Source code in src\transmission_simulation.py
| def gwn(self, EbN0dB: float, K: int, N: int) -> NDArray[np.float64]:
""""""
N0Eb = 10 ** (-EbN0dB/10)
std_dev = sqrt(0.5 * N/K * N0Eb)
return np.random.randn(N) * std_dev
|
send_through(mod_seq, EbN0dB, K)
Source code in src\transmission_simulation.py
| def send_through(self, mod_seq: NDArray[np.int8], EbN0dB: float, K: int) -> NDArray[np.float64]:
""""""
N = mod_seq.size
return mod_seq + self._noise_method(EbN0dB, K, N)
|