# -*- coding: utf-8 -*-from__future__importannotationsfromhermespy.modemimportBaseModem,CommunicationWaveformfrom..noiseimportNoiseLevel__author__="Jan Adler"__copyright__="Copyright 2024, Barkhausen Institut gGmbH"__credits__=["Jan Adler"]__license__="AGPLv3"__version__="1.3.0"__maintainer__="Jan Adler"__email__="jan.adler@barkhauseninstitut.org"__status__="Prototype"classCommunicationNoiseLevel(NoiseLevel):"""Base class for all communication noise level configuration classes."""__reference:BaseModem|CommunicationWaveformdef__init__(self,reference:BaseModem|CommunicationWaveform,level:float=float("inf"))->None:""" Args: reference (BaseModem | CommunicationWaveform): Reference with respect to which the noise level is defined. level (float, optional): Noise level relative to the reference' """# Init base classNoiseLevel.__init__(self)# Init class attributesself.level=levelself.__reference=reference@propertydeflevel(self)->float:"""Communication relative noise level. Raises: ValueError: For non-positive noise levels. """returnself.__level@level.setterdeflevel(self,value:float)->None:ifvalue<=0:raiseValueError("Communication noise level must be positive")self.__level=value@propertydefreference(self)->BaseModem|CommunicationWaveform:"""Reference of the noise level. Returns: Reference of the noise level. """returnself.__reference@reference.setterdefreference(self,value:BaseModem|CommunicationWaveform)->None:self.__reference=valuedef_get_reference_waveform(self)->CommunicationWaveform:"""Waveform of the reference signal. Returns: Waveform of the reference signal. Raises: RuntimeError: If a modem withiout a waveform is used as a reference. """ifisinstance(self.reference,CommunicationWaveform):returnself.referenceelse:ifself.reference.waveformisNone:raiseRuntimeError("The reference modem has no waveform configured. Noise level cannot be determined.")returnself.reference.waveform
[docs]classEBN0(CommunicationNoiseLevel):"""Fixed noise power configuration."""yaml_tag="EBN0"