[docs]classIsolation(ABC):"""Base class for antenna isolation modeling."""__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@abstractmethoddef_leak(self,signal:Signal)->Signal:"""Compute leakage between RF transmit and receive chains. Args: signal (Signal): The signal transmitted over the respective antenna RF chains. Returns: The signal components leaking into receive chains. """...# pragma no coverdef_assert_leaking_signal(self,signal:Signal|None)->Signal:"""Assert the validity of a leaking signal. Subroutine of :meth:`Isolation.leak`. Args: signal (Signal, None): The signal transmitted over the respective antenna RF chains. Raises: ValueError: If `signal` is invalid. Returns: The validated signal. """ifself.deviceisNone:raiseFloatingError("Error trying to simulate leakage of a floating model")ifsignalisNone:raiseValueError("Leaking signal not specified")ifself.device.antennas.num_transmit_antennas!=signal.num_streams:raiseValueError(f"Number of signal streams ({signal.num_streams}) does not match the number of transmitting antennas ({self.device.antennas.num_transmit_antennas})")returnsignal
[docs]defleak(self,signal:Signal|None)->Signal:"""Compute leakage between RF transmit and receive chains. Args: signal (Signal, None): The signal transmitted over the respective antenna RF chains. Returns: The signal components leaking into receive chains. Raises: FloatingError: If the device is not specified. ValueError: If the number of signal streams does not match the number of transmitting antennas. ValueError: If `signal` is not specified but required. """_signal=self._assert_leaking_signal(signal)leaking_signal=self._leak(_signal)returnleaking_signal