[docs]classCoupling(ABC):"""Base class for mutual coupling model implementations."""__device:SimulatedDevice|Nonedef__init__(self,device:SimulatedDevice|None=None)->None:""" Args: device (SimulatedDevice, optional): Device the model is configured to. """self.device=device@propertydefdevice(self)->SimulatedDevice|None:"""Device the model is configured to. Returns: Handle to the device. `None`, if the model is considered floating. """returnself.__device@device.setterdefdevice(self,value:SimulatedDevice|None)->None:self.__device=value
[docs]deftransmit(self,signal:Signal)->Signal:"""Apply the mutual coupling model during signal transmission. Args: signal (Signal): The signal to be transmitted. Returns: The signal resulting from coupling modeling. Raises: FloatingError: If the device is not specified. ValueError: If the number of signal streams does not match the number of transmitting antennas. """ifself.deviceisNone:raiseFloatingError("Error trying to simulate coupling of a floating model")ifself.device.num_transmit_antennas!=signal.num_streams:raiseValueError("Number of signal streams ({signal.num_streams}) does not match the number of transmitting antennas ({self.device.num_transmit_antennas})")returnself._transmit(signal)
@abstractmethoddef_transmit(self,signal:Signal)->Signal:"""Apply the mutual coupling model during signal transmission. Args: signal (Signal): The signal to be transmitted. Returns: The signal resulting from coupling modeling. """...# pragma: no cover
[docs]defreceive(self,signal:Signal)->Signal:"""Apply the mutual coupling model during signal reception. Args: signal (Signal): The signal to be received. Returns: The signal resulting from coupling modeling. Raises: FloatingError: If the device is not specified. ValueError: If the number of signal streams does not match the number of transmitting antennas. """ifself.deviceisNone:raiseFloatingError("Error trying to simulate coupling of a floating model")ifself.device.num_receive_antennas!=signal.num_streams:raiseValueError(f"Number of signal streams ({signal.num_streams}) does not match the number of transmitting antennas ({self.device.num_transmit_antennas})")returnself._receive(signal)
@abstractmethoddef_receive(self,signal:Signal)->Signal:"""Apply the mutual coupling model during signal reception. Args: signal (Signal): The signal to be received. Returns: The signal resulting from coupling modeling. """...# pragma: no cover