Modem Algorithms
Common digital modulation algorithms.
DSSS
Bases: Modem
Direct-sequence spread spectrum modulation and demodulation.
Currently implemented using the third-party commpy library. Note that DSSS does not contain
any trainable parameters. DSSS provides compatible tx and rx methods. When defining
transmitters and receivers, ensure the corresponding method is passed.
Example
__init__(chip_sequence, mode='psk', n_symbols=2, demod_type='hard')
Create a new DSSS radio using either phase-shift keying (PSK) or quadrature amplitude modulation (QAM).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chip_sequence |
Tensor
|
A binary sequence to spread the input bits with. |
required |
mode |
str
|
Modulation mode. Must be either "psk" or "qam". |
'psk'
|
n_symbols |
int
|
Number of symbols to use for modulation. If |
2
|
demod_type |
str
|
"hard" or "soft" decision boundary for bit demodulation. |
'hard'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
ValueError
|
If |
ValueError
|
If |
NotImplementedError
|
If |
rx(signal)
Demodulates and despreads an input signal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signal |
Tensor
|
A 2D complex valued input tensor. |
required |
Returns:
| Type | Description |
|---|---|
Reception
|
A |
tx(n_timesteps, batch_size=1)
Encode randomly generated bits with a chip sequence before modulating using commpy.Modem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_timesteps |
int
|
How many timesteps to transmit for. |
required |
batch_size |
int
|
How many transmissions to create in parallel. |
1
|
Returns:
| Type | Description |
|---|---|
Transmission
|
A |
Modem
Torchradio compatible wrapper for commpy.PSKModem and commpy.QAMModem.
Currently implemented using the third-party commpy library. Note that Modem does not contain
any trainable parameters. A Modem provides compatible tx and rx methods. When defining
transmitters and receivers, ensure the corresponding method is passed.
Example
n_input_bits: int
property
Get number of bits per symbol.
Returns Number of bits per symbol.
__init__(mode, n_symbols, demod_type='hard')
Create a new Modem using either phase-shift keying (PSK) or quadrature amplitude modulation (QAM).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mode |
str
|
Modulation mode. Must be either "psk" or "qam". |
required |
n_symbols |
int
|
Number of symbols to use for modulation. If |
required |
demod_type |
str
|
"hard" or "soft" decision boundary for bit demodulation. |
'hard'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
ValueError
|
If |
ValueError
|
If |
NotImplementedError
|
If |
rx(signal)
Demodulates an input signal using a prespecified digital demodulation technique.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signal |
Tensor
|
A 2D complex valued input tensor. |
required |
Returns:
| Type | Description |
|---|---|
Reception
|
A |
tx(n_timesteps, batch_size=1)
Apply digital modulation to randomly generated bits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_timesteps |
int
|
How many timesteps to transmit for. |
required |
batch_size |
int
|
How many transmissions to create in parallel. |
1
|
Returns:
| Type | Description |
|---|---|
Transmission
|
A |