Skip to content

Commit

Permalink
Merge branch 'release-2024-spring' into 'master'
Browse files Browse the repository at this point in the history
2024 Spring Release

Closes #216

See merge request barkhauseninstitut/wicon/hermespy!193
  • Loading branch information
adlerjan committed Jun 6, 2024
2 parents de87b4f + 6c83b37 commit 5dd4170
Show file tree
Hide file tree
Showing 15 changed files with 258 additions and 317 deletions.
19 changes: 7 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,21 @@ cmake_minimum_required(VERSION 3.15...3.19)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

project(hermespy)

if(SKBUILD)
execute_process(
COMMAND
"${PYTHON_EXECUTABLE}" -c
"import pybind11; print(pybind11.get_cmake_dir())"
OUTPUT_VARIABLE _tmp_dir
OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ECHO STDOUT)
list(APPEND CMAKE_PREFIX_PATH "${_tmp_dir}")
endif()

# Add and configure aff3ct
set(AFF3CT_COMPILE_EXE OFF CACHE INTERNAL "Disable executable target" FORCE)
set(AFF3CT_COMPILE_STATIC_LIB ON CACHE INTERNAL "Enable static library target" FORCE)
set(AFF3CT_COMPILE_SHARED_LIB OFF CACHE INTERNAL "Disable shared library target" FORCE)
set(AFF3CT_OVERRIDE_VERSION ON CACHE INTERNAL "Enable build without .git" FORCE)
add_subdirectory(submodules/affect)
set(AFF3CT_COMPILE_OBJ OFF CACHE INTERNAL "Disable object building" FORCE)
set(AFF3ECT_INCLUDE_SPU_LIB OFF CACHE INTERNAL "Disable SPU" FORCE)
set(CLI_COMPILE_STATIC_LIB OFF CACHE INTERNAL "Disable CLI" FORCE)
set(CLI_COMPILE_SHARED_LIB OFF CACHE INTERNAL "Disable CLI" FORCE)

# Add aff3ct bindings to hermes api
add_subdirectory(submodules/affect)
add_subdirectory(hermespy/fec/aff3ct)

install(TARGETS ldpc polar rs rsc turbo bch DESTINATION hermespy/fec/aff3ct)
77 changes: 0 additions & 77 deletions bumpver.toml

This file was deleted.

20 changes: 20 additions & 0 deletions docssource/api/channel/channel.Channel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@ Channel
.. inheritance-diagram:: hermespy.channel.channel.Channel
:parts: 1


The channel model represents the basic configuration of two linked :class:`SimulatedDevices<hermespy.simulation.simulated_device.SimulatedDevice>`
:meth:`alpha_device<.alpha_device>` and :meth:`beta_device<.beta_device>` exchanging electromagnetic :class:`Signals<hermespy.core.signal_model.Signal>`.

Each invokation of :meth:`realize<hermespy.channel.channel.Channel.realize>` will generate a new :class:`ChannelRealization<hermespy.channel.channel.ChannelRealization>` instance by internally calling :meth:`._realize<hermespy.channel.channel.Channel._realize>`.
The channel model represents the matrix function of time :math:`t` and delay :math:`\tau`

.. math::
\mathbf{H}(t, \tau; \mathbf{\zeta}) \in \mathbb{C}^{N_{\mathrm{Rx}} \times N_{\mathrm{Tx}}} \ \text{,}
the dimensionality of which depends on the number of transmitting antennas :math:`N_{\mathrm{Tx}}` and number of receiving antennas :math:`N_{\mathrm{Rx}}`.
The vector :math:`\mathbf{\zeta}` represents the channel model's paramteres as random variables.
Realizing the channel model is synonymous with realizing and "fixing" these random parameters by drawing a sample from their respective
distributions, so that a :class:`ChannelRealization<hermespy.channel.channel.ChannelRealization>` represents the deterministic function

.. math::
\mathbf{H}(t, \tau) \in \mathbb{C}^{N_{\mathrm{Rx}} \times N_{\mathrm{Tx}}} \ \text{.}
.. autoclass:: hermespy.channel.channel.Channel

.. autoclass:: hermespy.channel.channel.ChannelSampleHook
Expand Down
5 changes: 1 addition & 4 deletions docssource/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -150,21 +150,18 @@ As a result, all combined binaries and source files will remain within the repos
conda activate <envname>
conda install pip
pip install -e ".[develop]"
python -m setup develop

.. code-tab:: batch Windows vEnv

python -m venv <envname>
<envname>\\Scripts\\activate
<envname>\Scripts\activate
pip install -e ".[develop]"
python -m setup develop

.. code-tab:: bash Linux vEnv

python -m venv env
source env/bin/activate
pip install -e ".[develop]"
python -m setup develop


Install Quadriga
Expand Down
25 changes: 3 additions & 22 deletions hermespy/channel/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations
from abc import ABC, abstractmethod
from typing import Callable, Generic, Optional, overload, Set, TypeVar, TYPE_CHECKING
from typing import Callable, Generic, overload, Set, TypeVar, TYPE_CHECKING

import numpy as np
from h5py import Group
Expand Down Expand Up @@ -747,33 +747,14 @@ def to_HDF(self, group: Group) -> None:
class Channel(ABC, RandomNode, Serializable, Generic[CRT, CST]):
"""Abstract base class of all channel models.
The channel model represents the basic configuration of two linked :doc:`SimulatedDevices<hermespy.simulation.simulated_device.SimulatedDevice>`
:meth:`alpha_device<.alpha_device>` and :meth:`beta_device<.beta_device>` exchanging electromagnetic :doc:`Signals<hermespy.core.signal_model.Signal>`.
Each invokation of :meth:`.propagate` and :meth:`.realize` will generate a new :doc:`channel.channel.ChannelRealization` instance by internally calling :meth:`._realize`.
In the case of a :meth:`propagate` call the generated :doc:`hermespy.channel.channel.ChannelRealization` will additionally be wrapped in a :doc:`hermespy.channel.channel.ChannelPropagation`.
The channel model represents the matrix function of time :math:`t` and delay :math:`\\tau`
.. math::
\\mathbf{H}(t, \\tau; \\mathbf{\\zeta}) \\in \\mathbb{C}^{N_{\\mathrm{Rx}} \\times N_{\\mathrm{Tx}}} \\ \\text{,}
the dimensionality of which depends on the number of transmitting antennas :math:`N_{\\mathrm{Tx}}` and number of receiving antennas :math:`N_{\\mathrm{Rx}}`.
The vector :math:`\\mathbf{\\zeta}` represents the channel model's paramteres as random variables.
Realizing the channel model is synonymous with realizing and "fixing" these random parameters by drawing a sample from their respective
distributions, so that a :doc:`hermespy.channel.channel.ChannelRealization` represents the deterministic function
.. math::
\\mathbf{H}(t, \\tau) \\in \\mathbb{C}^{N_{\\mathrm{Rx}} \\times N_{\\mathrm{Tx}}} \\ \\text{.}
Channel models represent the basic physical properties of a elemtromagnetic waves propagating through space in between devices.
"""

__scenario: SimulationScenario
__gain: float
__sample_hooks: Set[ChannelSampleHook[CST]]

def __init__(self, gain: float = 1.0, seed: Optional[int] = None) -> None:
def __init__(self, gain: float = 1.0, seed: int | None = None) -> None:
"""
Args:
Expand Down
28 changes: 15 additions & 13 deletions hermespy/fec/aff3ct/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

project(aff3ct_binding VERSION "0.3.0")
project(aff3ct_binding VERSION "1.3.0")

find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
find_package(pybind11 CONFIG REQUIRED)

pybind11_add_module(ldpc MODULE ldpc.cpp)
python_add_library(ldpc MODULE ldpc.cpp WITH_SOABI)
target_compile_definitions(ldpc PRIVATE VERSION_INFO=${PROJECT_VERSION})
target_link_libraries(ldpc PUBLIC aff3ct-static-lib)
target_link_libraries(ldpc PRIVATE aff3ct-static-lib pybind11::headers)

pybind11_add_module(polar MODULE polar.cpp)
python_add_library(polar MODULE polar.cpp WITH_SOABI)
target_compile_definitions(polar PRIVATE VERSION_INFO=${PROJECT_VERSION})
target_link_libraries(polar PUBLIC aff3ct-static-lib)
target_link_libraries(polar PRIVATE aff3ct-static-lib pybind11::headers)

pybind11_add_module(rsc MODULE rsc.cpp)
python_add_library(rsc MODULE rsc.cpp WITH_SOABI)
target_compile_definitions(rsc PRIVATE VERSION_INFO=${PROJECT_VERSION})
target_link_libraries(rsc PUBLIC aff3ct-static-lib)
target_link_libraries(rsc PRIVATE aff3ct-static-lib pybind11::headers)

pybind11_add_module(turbo MODULE turbo.cpp)
python_add_library(turbo MODULE turbo.cpp WITH_SOABI)
target_compile_definitions(turbo PRIVATE VERSION_INFO=${PROJECT_VERSION})
target_link_libraries(turbo PUBLIC aff3ct-static-lib)
target_link_libraries(turbo PRIVATE aff3ct-static-lib pybind11::headers)

pybind11_add_module(rs MODULE rs.cpp)
python_add_library(rs MODULE rs.cpp WITH_SOABI)
target_compile_definitions(rs PRIVATE VERSION_INFO=${PROJECT_VERSION})
target_link_libraries(rs PUBLIC aff3ct-static-lib)
target_link_libraries(rs PRIVATE aff3ct-static-lib pybind11::headers)

pybind11_add_module(bch MODULE bch.cpp)
python_add_library(bch MODULE bch.cpp WITH_SOABI)
target_compile_definitions(bch PRIVATE VERSION_INFO=${PROJECT_VERSION})
target_link_libraries(bch PUBLIC aff3ct-static-lib)
target_link_libraries(bch PRIVATE aff3ct-static-lib pybind11::headers)
20 changes: 8 additions & 12 deletions hermespy/hardware_loop/uhd/usrp.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class UsrpDevice(PhysicalDevice, Serializable):
__selected_receive_ports: Sequence[int]
__max_selected_receive_port: int
__max_selected_transmit_port: int
__current_configuration: RfConfig

def __init__(
self,
Expand Down Expand Up @@ -253,10 +254,8 @@ def _configure_device(self, force: bool = False) -> None:
rx_carrier_frequency != self.__current_configuration.rxCarrierFrequency,
tx_gain != self.__current_configuration.txGain,
rx_gain != self.__current_configuration.rxGain,
1 + self.__max_selected_transmit_port
!= self.__current_configuration.noTxAntennas,
1 + self.__max_selected_receive_port
!= self.__current_configuration.noRxAntennas,
self.selected_transmit_ports != self.__current_configuration.txAntennaMapping,
self.selected_receive_ports != self.__current_configuration.rxAntennaMapping,
]
)
or force
Expand All @@ -270,8 +269,10 @@ def _configure_device(self, force: bool = False) -> None:
rxCarrierFrequency=rx_carrier_frequency,
txGain=tx_gain,
rxGain=rx_gain,
noTxAntennas=1 + self.__max_selected_transmit_port,
noRxAntennas=1 + self.__max_selected_receive_port,
noTxStreams=self.num_transmit_ports,
noRxStreams=self.num_receive_ports,
txAntennaMapping=self.selected_transmit_ports,
rxAntennaMapping=self.selected_receive_ports,
)

self.__rpc_call_wrapper(self.__usrp_client.configureRfConfig, config)
Expand Down Expand Up @@ -325,13 +326,8 @@ def _upload(self, baseband_signal: Signal) -> Signal:

# Append a zero vector for unselected transmit ports
# Workaround for the USRP wrapper missing dedicated port selections
signal_list: List[np.ndarray] = [s for s in baseband_signal[:, :]]
for i in range(self.__max_selected_transmit_port + 1):
if i not in self.__selected_transmit_ports:
signal_list.insert(i, np.zeros(baseband_signal.num_samples, dtype=np.complex_))

tx_config = TxStreamingConfig(
max(0.0, -self.delay_calibration.delay), MimoSignal(signal_list)
max(0.0, -self.delay_calibration.delay), MimoSignal(baseband_signal[:, :])
)
self.__rpc_call_wrapper(self.__usrp_client.configureTx, tx_config)

Expand Down
47 changes: 0 additions & 47 deletions mypy.ini

This file was deleted.

Loading

0 comments on commit 5dd4170

Please sign in to comment.