[docs]classImpedanceCoupling(Serializable,Coupling):"""Imedance based mutual coupling model"""yaml_tag="Impedance-Coupling"__transmit_correlation:np.ndarray|None__receive_correlation:np.ndarray|None__transmit_impedance:np.ndarray|None__receive_impedance:np.ndarray|None__matching_impedance:np.ndarray|Nonedef__init__(self,device:SimulatedDevice|None=None,transmit_correlation:np.ndarray|None=None,receive_correlation:np.ndarray|None=None,transmit_impedance:np.ndarray|None=None,receive_impedance:np.ndarray|None=None,matching_impedance:np.ndarray|None=None,)->None:""" Args: device (SimulatedDevice, optional) Device the model is configured to. transmit_correlation (np.ndarray, optional): Correlation matrix of the transmit antenna array. Defaults to the identity matrix. receive_correlation (np.ndarray, optional): Correlation matrix of the receive antenna array. Defaults to the identity matrix. transmit_impedance (np.ndarray, optional): Impedance matrix of the transmit antenna array. Defaults to the identity matrix. receive_impedance (np.ndarray, optional): Impedance matrix of the receive antenna array. Defaults to the identity matrix. matching_impedance (np.ndarray, optional): Impedance matrix of the matching network. Defaults to the identity matrix. """Coupling.__init__(self,device=device)self.transmit_correlation=transmit_correlationself.receive_correlation=receive_correlationself.transmit_impedance=transmit_impedanceself.receive_impedance=receive_impedanceself.matching_impedance=matching_impedance@propertydeftransmit_correlation(self)->np.ndarray|None:returnself.__transmit_correlation@transmit_correlation.setterdeftransmit_correlation(self,value:np.ndarray|None)->None:ifvalueisNone:self.__transmit_correlation=Nonereturnifvalue.ndim!=2:raiseValueError("Transmit correlation must be a two dimensional array")ifvalue.shape[0]!=value.shape[1]:raiseValueError("Transmit correlation must be square")self.__transmit_correlation=value@propertydefreceive_correlation(self)->np.ndarray:returnself.__receive_correlation@receive_correlation.setterdefreceive_correlation(self,value:np.ndarray|None)->None:ifvalueisNone:self.__receive_correlation=Nonereturnifvalue.ndim!=2:raiseValueError("Receive correlation must be a two dimensional array")ifvalue.shape[0]!=value.shape[1]:raiseValueError("Receive correlation must be square")self.__receive_correlation=value@propertydeftransmit_impedance(self)->np.ndarray|None:returnself.__transmit_impedance@transmit_impedance.setterdeftransmit_impedance(self,value:np.ndarray|None)->None:ifvalueisNone:self.__transmit_impedance=Nonereturnifvalue.ndim!=2:raiseValueError("Transmit impedance must be a two dimensional array")ifvalue.shape[0]!=value.shape[1]:raiseValueError("Transmit impedance must be square")self.__transmit_impedance=value@propertydefreceive_impedance(self)->np.ndarray|None:returnself.__receive_impedance@receive_impedance.setterdefreceive_impedance(self,value:np.ndarray|None)->None:ifvalueisNone:self.__receive_impedance=Nonereturnifvalue.ndim!=2:raiseValueError("Receive impedance must be a two dimensional array")ifvalue.shape[0]!=value.shape[1]:raiseValueError("Receive impedance must be square")self.__receive_impedance=value@propertydefmatching_impedance(self)->np.ndarray|None:returnself.__matching_impedance@matching_impedance.setterdefmatching_impedance(self,value:np.ndarray|None)->None:ifvalueisNone:self.__matching_impedance=Nonereturnifvalue.ndim!=2:raiseValueError("Matching impedances must be a two dimensional array")ifvalue.shape[0]!=value.shape[1]:raiseValueError("Matching impedances must be square")self.__matching_impedance=valuedef_transmit(self,signal:Signal)->Signal:transmit_impedance=(np.eye(self.device.antennas.num_transmit_antennas)ifself.transmit_impedanceisNoneelseself.transmit_impedance)transmit_correlation=(np.eye(self.device.antennas.num_transmit_antennas)ifself.transmit_correlationisNoneelseself.transmit_correlation)transmit_coupling=transmit_impedance.real**-0.5@transmit_correlation**0.5transmitted_samples=transmit_coupling@signal[:,:]returnsignal.from_ndarray(transmitted_samples)def_receive(self,signal:Signal)->Signal:receive_impedance=(np.eye(self.device.antennas.num_receive_antennas)ifself.receive_impedanceisNoneelseself.receive_impedance)receive_correlation=(np.eye(self.device.antennas.num_receive_antennas)ifself.receive_correlationisNoneelseself.receive_correlation)matching_impedance=(np.eye(self.device.antennas.num_receive_antennas)ifself.matching_impedanceisNoneelseself.matching_impedance)receive_coupling=(2*receive_impedance[0,0].real*matching_impedance.real**0.5@np.linalg.inv(matching_impedance+receive_correlation)@receive_correlation**0.5)received_samples=receive_coupling@signal[:,:]returnsignal.from_ndarray(received_samples)