def sync_pulse_duration(self, value): if not is_scalar_numeric(value): raise LayerMisconfigured( "sync pulse duration must be a scalar numeric value") if value < 0.0: raise LayerMisconfigured( "sync pulse duration must be 0 or positive") self._sync_pulse_duration = value
def N_factor(self, value): if not is_scalar_numeric(value): raise LayerMisconfigured("N factor must be a scalar numeric value") self._N_factor = int(value)
def sampling_period(self, value): """Set the sampling period""" if not is_scalar_numeric(value): raise LayerMisconfigured( "sampling_period must be an integer of float") self._sampling_period = value
def validate(self) -> t.NoReturn: """Implementation of Configurable's `validate`""" if not is_scalar_numeric(self.config.subsymbol_rate): raise LayerMisconfigured("subsymbol_rate must be a numeric value") if not is_scalar_numeric(self.config.symbol_rate): raise LayerMisconfigured("symbol_rate must be a numeric value")
def num_bits_to_num_syms(self, num_bits: t.Union[float, int]): assert is_scalar_numeric(num_bits), "num_bits must be float or int" return math.ceil(num_bits / self.compression_factor)
def bitrate_to_symrate(self, bitrate: t.Union[float, int]): assert is_scalar_numeric(bitrate), "bitrate must be float or int" return bitrate / self.compression_factor
def symrate_to_bitrate(self, symrate: t.Union[float, int]): assert is_scalar_numeric(symrate), "symrate must be float or int" return symrate * self.compression_factor