Channel
__init__(fs=128000, duration=1, noise_mode='snr', noise_db=20, seed=10)
Implementation of a channel for aggregation of multiple signals, as displayed on block diagram below.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fs
|
int
|
sampling rate of the signal. |
128000
|
duration
|
int
|
duration of the channel in seconds. |
1
|
noise_mode
|
str
|
noise mode ('snr' or 'ebn0'). |
'snr'
|
noise_db
|
int
|
noise level in dB. |
20
|
seed
|
int
|
seed for random number generation. |
10
|
Returns:
Name | Type | Description |
---|---|---|
Channel |
channel object. |
Raises:
Type | Description |
---|---|
ValueError
|
if the noise mode is invalid. |
Examples:
>>> import argos3
>>> import numpy as np
>>>
>>> transmitter = argos3.Transmitter(fc=2400, output_print=False, output_plot=False)
>>> t, s = transmitter.transmit(argos3.Datagram(pcdnum=1234, numblocks=1))
>>>
>>> channel = argos3.Channel(duration=1, noise_mode="ebn0", noise_db=20)
>>> channel.add_signal(s, position_factor=0.5)
>>> channel.add_noise()
>>> st = channel.channel
>>>
>>> receiver = argos3.Receiver(fc=2400, output_print=False, output_plot=False)
>>> datagramRX, success = receiver.receive(st)
>>>
>>> print(success)
True
>>> print(datagramRX.parse_datagram())
{
"msglength": 1,
"pcdid": 1234,
"data": {
"bloco_1": {
"sensor_1": 37,
"sensor_2": 198,
"sensor_3": 9
}
},
"tail": 7
}
- Time Domain Plot Example:
add_signal(signal, position_factor=0.5)
Adds a signal to the channel at a relative position.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
signal
|
ndarray
|
signal samples to insert. |
required |
position_factor
|
float
|
position factor between [0, 1] (0 = start of the channel, 1 = end). |
0.5
|
Raises:
Type | Description |
---|---|
ValueError
|
if position_factor is not between [0, 1]. |
Examples:
- Time Domain Plot Example:
add_noise()
Adds noise to the channel.
Examples:
- Time Domain Plot Example: