Exemple #1
0
    def to_yaml(cls: Type[RadarChannel], representer: SafeRepresenter,
                node: RadarChannel) -> MappingNode:
        """Serialize a radar channel object to YAML.

        Args:
            representer (SafeRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (RadarChannel):
                The channel instance to be serialized.

        Returns:
            Node:
                The serialized YAML node.
        """

        state = {
            'target_range': node.target_range,
            'radar_cross_section': node.radar_cross_section,
            'gain': node.gain,
            'losses_db': node.losses_db,
            'velocity': node.target_velocity,
        }

        return representer.represent_mapping(cls.yaml_tag, state)
    def to_yaml(cls: Type[WaveformGeneratorPskQam],
                representer: SafeRepresenter,
                node: WaveformGeneratorPskQam) -> MappingNode:
        """Serialize an `WaveformGeneratorPskQam` object to YAML.

        Args:
            representer (SafeRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (WaveformGeneratorPskQam):
                The `WaveformGeneratorPskQam` instance to be serialized.

        Returns:
            Node:
                The serialized YAML node
        """

        state = {
            "oversampling_factor": node.oversampling_factor,
            "modulation_order": node.modulation_order,
            "tx_filter": node.tx_filter,
            "rx_filter": node.rx_filter,
            "chirp_duration": node.chirp_duration,
            "chirp_bandwidth": node.chirp_bandwidth,
            "num_preamble_symbols": node.num_preamble_symbols,
            "num_data_symbols": node.num_data_symbols,
            "num_postamble_symbols": node.num_postamble_symbols,
            "pilot_rate": node.pilot_rate,
            "guard_interval": node.guard_interval,
            "equalization": node.equalization
        }
        return representer.represent_mapping(cls.yaml_tag, state)
Exemple #3
0
    def to_yaml(cls: Type[QuadrigaChannel], representer: SafeRepresenter,
                node: QuadrigaChannel) -> MappingNode:
        """Serialize a QuadrigaChannel object to YAML.

        Args:
            representer (SafeRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (QuadrigaChannel):
                The QuadrigaChannel instance to be serialized.

        Returns:
            Node:
                The serialized YAML node.
        """

        state = {
            'active': node.active,
            'gain': node.gain,
            'sync_offset_low': node.sync_offset_low,
            'sync_offset_high': node.sync_offset_high
        }

        return representer.represent_mapping(cls.yaml_tag, state)
Exemple #4
0
    def to_yaml(cls: Type[AnalogDigitalConverter],
                representer: SafeRepresenter,
                node: AnalogDigitalConverter) -> MappingNode:
        """Serialize a `AnalogDigitalConverter` object to YAML.

        Args:
            representer (BaseRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (AnalogDigitalConverter):
                The ADC instance to be serialized.

        Returns:
            Node:
                The serialized YAML node.
        """
        state = {
            'num_quantization_bits': node.num_quantization_bits,
        }

        if not node.num_quantization_bits == np.inf:
            state['quantizer_type'] = node.quantizer_type.name
            state['gain_control'] = node.gain

        return representer.represent_mapping(cls.yaml_tag, state)
Exemple #5
0
    def to_yaml(cls: Type[BlockInterleaver], representer: SafeRepresenter,
                node: BlockInterleaver) -> MappingNode:
        """Serialize a `Interleaver` encoder to YAML.

        Args:
            representer (SafeRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (BlockInterleaver):
                The `Interleaver` instance to be serialized.

        Returns:
            Node:
                The serialized YAML node.

        :meta private:
        """

        state = {
            "block_size": node.block_size,
            "interleave_blocks": node.interleave_blocks
        }

        return representer.represent_mapping(cls.yaml_tag, state)
    def to_yaml(cls: Type[WaveformGeneratorChirpFsk],
                representer: SafeRepresenter,
                node: WaveformGeneratorChirpFsk) -> Node:
        """Serialize an `WaveformGenerator` object to YAML.

        Args:
            representer (SafeRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (WaveformGenerator):
                The `WaveformGeneratorChirpFsk` instance to be serialized.

        Returns:
            Node:
                The serialized YAML node
        """

        state = {
            "chirp_duration": node.chirp_duration,
            "chirp_bandwidth": node.chirp_bandwidth,
            "num_pilot_chirps": node.num_pilot_chirps,
            "num_data_chirps": node.num_data_chirps,
            "guard_interval": node.guard_interval,
        }

        mapping = representer.represent_mapping(cls.yaml_tag, state)
        mapping.value.extend(
            WaveformGenerator.to_yaml(representer, node).value)

        return mapping
    def test_to_yaml(self) -> None:
        """Serialization to YAML."""

        safe_representer = SafeRepresenter()
        node = EncoderManager.to_yaml(safe_representer, self.encoder_manager)
        self.assertEqual(node.value, 'null',
                         "YAML serialization produced unexpected result")
    def to_yaml(cls: Type[SalehPowerAmplifier], representer: SafeRepresenter,
                node: SalehPowerAmplifier) -> MappingNode:
        """Serialize a `SalehPowerAmplifier` object to YAML.

        Args:
            representer (BaseRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (SalehPowerAmplifier):
                The amplifier instance to be serialized.

        Returns:
            Node:
                The serialized YAML node.
        """

        state = {
            'amplitude_alpha': node.__amplitude_alpha,
            'amplitude_beta': node.__amplitude_beta,
            'phase_alpha': node.phase_alpha,
            'phase_beta': node.phase_beta,
        }

        representation = representer.represent_mapping(cls.yaml_tag, state)
        representation.value.extend(
            PowerAmplifier.to_yaml(representer, node).value)

        return representation
Exemple #9
0
    def to_yaml(
            cls: Type[CorrelationSynchronization],
            representer: SafeRepresenter,
            node: CorrelationSynchronization) -> CorrelationSynchronization:
        """Serialize an `CorrelationSynchronization` object to YAML.

        Args:
            representer (CorrelationSynchronization):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (CorrelationSynchronization):
                The `CorrelationSynchronization` instance to be serialized.

        Returns:
            Node:
                The serialized YAML node
        """

        state = {
            'threshold': cls.threshold,
            'guard_ratio': cls.guard_ratio,
        }

        return representer.represent_mapping(cls.yaml_tag, state)
Exemple #10
0
    def to_yaml(cls: Type[CyclicRedundancyCheck], representer: SafeRepresenter,
                node: CyclicRedundancyCheck) -> MappingNode:
        """Serialize a `CyclicRedundancyCheck` to YAML.

        Args:
            representer (SafeRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (CyclicRedundancyCheck):
                The `CyclicRedundancyCheck` instance to be serialized.

        Returns:
            MappingNode:
                The serialized YAML node.

        :meta private:
        """

        state = {
            'bit_block_size': node.__bit_block_size,
            'check_block_size': node.__check_block_size,
        }

        return representer.represent_mapping(cls.yaml_tag, state)
    def to_yaml(cls: Type[RappPowerAmplifier], representer: SafeRepresenter,
                node: RappPowerAmplifier) -> MappingNode:
        """Serialize a `RappPowerAmplifier` object to YAML.

        Args:
            representer (BaseRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (RappPowerAmplifier):
                The amplifier instance to be serialized.

        Returns:
            Node:
                The serialized YAML node.
        """

        state = {
            'smoothness_factor': node.__smoothness_factor,
        }

        representation = representer.represent_mapping(cls.yaml_tag, state)
        representation.value.extend(
            PowerAmplifier.to_yaml(representer, node).value)

        return representation
    def to_yaml(cls: Type[RepetitionEncoder], representer: SafeRepresenter,
                node: RepetitionEncoder) -> MappingNode:
        """Serialize a `RepetitionEncoder` to YAML.

        Args:

            representer (SafeRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (RepetitionEncoder):
                The `RepetitionEncoder` instance to be serialized.

        Returns:

            Node:
                The serialized YAML node.

        :meta private:
        """

        state = {
            "bit_block_size": node.bit_block_size,
            "repetitions": node.repetitions
        }

        return representer.represent_mapping(cls.yaml_tag, state)
Exemple #13
0
    def to_yaml(cls: Type[Modem], representer: SafeRepresenter, node: Modem) -> MappingNode:
        """Serialize a `Modem` object to YAML.

        Args:

            representer (Modem):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (Modem):
                The `Device` instance to be serialized.

        Returns:

            MappingNode:
                The serialized YAML node.
        """

        state = {}

        if len(node.__encoder_manager.encoders) > 0:
            state['Encoding'] = node.__encoder_manager

        if len(node.__precoding) > 0:
            state['Precoding'] = node.__precoding

        if node.__waveform_generator is not None:
            state['Waveform'] = node.__waveform_generator

        return representer.represent_mapping(cls.yaml_tag, state)
Exemple #14
0
    def to_yaml(cls: Type[Simulation],
                representer: SafeRepresenter,
                node: Simulation) -> MappingNode:
        """Serialize an `Simulation` object to YAML.

        Args:
            representer (SafeRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (Simulation):
                The `Simulation` instance to be serialized.

        Returns:
            Node:
                The serialized YAML node
        """

        state = {
            "snr_type": node.snr_type.value,
            "verbosity": node.verbosity.name
        }

        # If a global Quadriga interface exists,
        # add its configuration to the simulation section
        if QuadrigaInterface.GlobalInstanceExists():
            state[QuadrigaInterface.yaml_tag] = QuadrigaInterface.GlobalInstance()

        return representer.represent_mapping(cls.yaml_tag, state)
    def to_yaml(cls: Type[ShapingFilter], representer: SafeRepresenter,
                node: ShapingFilter) -> MappingNode:
        """Serialize an `ShapingFilter` object to YAML.

        Args:
            representer (SafeRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (ShapingFilter):
                The `ShapingFilter` instance to be serialized.

        Returns:
            Node:
                The serialized YAML node
        """

        state = {
            "filter_type": node.filter_type.name,
            "samples_per_symbol": node.samples_per_symbol,
            "length_in_symbols": node.length_in_symbols,
            "bandwidth_factor": node.bandwidth_factor,
            "roll_off": node.roll_off,
            "is_matched": node.is_matched,
        }
        return representer.represent_mapping(cls.yaml_tag, state)
Exemple #16
0
    def to_yaml(cls: Type[MultipathFadingExponential],
                representer: SafeRepresenter,
                node: MultipathFadingExponential) -> MappingNode:
        """Serialize a channel object to YAML.

        Args:
            representer (SafeRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (MultipathFadingExponential):
                The channel instance to be serialized.

        Returns:
            Node:
                The serialized YAML node.
        """

        state = {
            'tap_interval': node.__tap_interval,
            'rms_delay': node.__rms_delay,
            'active': node.active,
            'gain': node.gain,
            'num_sinusoids': node.num_sinusoids,
            'los_angle': node.los_angle,
            'doppler_frequency': node.doppler_frequency,
            'los_doppler_frequency': node.los_doppler_frequency,
            'sync_offset_low': node.sync_offset_low,
            'sync_offset_high': node.sync_offset_high
        }

        return representer.represent_mapping(cls.yaml_tag, state)
Exemple #17
0
    def to_yaml(cls: Type[MultipathFadingCost256],
                representer: SafeRepresenter,
                node: MultipathFadingCost256) -> MappingNode:
        """Serialize a channel object to YAML.

        Args:
            representer (SafeRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (MultipathFadingCost256):
                The channel instance to be serialized.

        Returns:
            Node:
                The serialized YAML node.
        """

        state = {
            'type': node.model_type.name,
            'active': node.active,
            'gain': node.gain,
            'num_sinusoids': node.num_sinusoids,
            'los_angle': node.los_angle,
            'doppler_frequency': node.doppler_frequency,
            'los_doppler_frequency': node.los_doppler_frequency,
            'sync_offset_low': node.sync_offset_low,
            'sync_offset_high': node.sync_offset_high
        }

        if node.model_type is MultipathFadingCost256.TYPE.HILLY:
            state.pop('los_angle')

        return representer.represent_mapping(cls.yaml_tag, state)
Exemple #18
0
    def to_yaml(cls: Type[SimulatedDevice], representer: SafeRepresenter, node: SimulatedDevice) -> MappingNode:
        """Serialize a `SimulatedDevice` object to YAML.

        Args:

            representer (SimulatedDevice):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (SimulatedDevice):
                The `Device` instance to be serialized.

        Returns:

            MappingNode:
                The serialized YAML node.
        """

        state = {
            'num_antennas': node.num_antennas,
            'sampling_rate': node.__sampling_rate,
            'carrier_frequency': node.__carrier_frequency,
        }

        return representer.represent_mapping(cls.yaml_tag, state)
    def to_yaml(cls: Type[SymbolPrecoding], representer: SafeRepresenter,
                node: SymbolPrecoding) -> Node:
        """Serialize a `SymbolPrecoding` configuration to YAML.

        Args:
            representer (SafeRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (SymbolPrecoding):
                The `SymbolPrecoding` instance to be serialized.

        Returns:
            Node:
                The serialized YAML node.
                None if the object state is default.
        """

        if len(node.__symbol_precoders) < 1:
            return representer.represent_none(None)

        return representer.represent_sequence(cls.yaml_tag,
                                              node.__symbol_precoders)
    def to_yaml(cls: Type[RandomNode], representer: SafeRepresenter,
                node: RandomNode) -> ScalarNode:
        """Serialize a `RandomNode` object to YAML.

        Args:
            representer (SafeRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (RandomNode):
                The `RandomNode` instance to be serialized.

        Returns:
            Node:
                The serialized YAML node.
                None if the object state is default.
        """

        if node.__seed is not None:

            state = {'seed': node.__seed}
            return representer.represent_mapping(cls.yaml_tag, state)

        return representer.represent_none(None)
    def to_yaml(cls: Type[SpaceTimeBlockCoding], representer: SafeRepresenter, node: SpaceTimeBlockCoding) -> Node:
        """Serialize a `SpaceTimeBlockCoding` precoder to YAML.

        Args:
            representer (SafeRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (SpaceTimeBlockCoding):
                The `SpaceTimeBlockCoding` instance to be serialized.

        Returns:
            Node:
                The serialized YAML node.
        """

        return representer.represent_scalar(cls.yaml_tag, "")
Exemple #22
0
    def to_yaml(cls: Type[MMSETimeEqualizer], representer: SafeRepresenter,
                node: MMSETimeEqualizer) -> ScalarNode:
        """Serialize an `MMSETimeEqualizer` object to YAML.

        Args:
            representer (SafeRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (MMSETimeEqualizer):
                The `MMSETimeEqualizer` instance to be serialized.

        Returns:
            Node:
                The serialized YAML node
        """

        return representer.represent_scalar(cls.yaml_tag, None)
    def to_yaml(cls: Type[SpatialMultiplexing], representer: SafeRepresenter,
                node: SpatialMultiplexing) -> ScalarNode:
        """Serialize an `SpatialMultiplexing` object to YAML.

        Args:
            representer (SafeRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (SpatialMultiplexing):
                The `SpatialMultiplexing` instance to be serialized.

        Returns:
            Node:
                The serialized YAML node
        """

        return representer.represent_scalar(cls.yaml_tag, None)
    def to_yaml(cls: Type[Synchronization], representer: SafeRepresenter,
                node: Synchronization) -> Node:
        """Serialize an `Synchronization` object to YAML.

        Args:
            representer (Synchronization):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (Synchronization):
                The `Synchronization` instance to be serialized.

        Returns:
            Node:
                The serialized YAML node
        """

        return representer.represent_scalar(cls.yaml_tag, None)
Exemple #25
0
    def to_yaml(cls: Type[Gain], representer: SafeRepresenter,
                node: AutomaticGainControl) -> MappingNode:
        """Serialize a `Gain` object to YAML.

        Args:
            representer (BaseRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (AutomaticGainControl):
                The ADC instance to be serialized.

        Returns:
            Node:
                The serialized YAML node.
        """
        state = {'gain': node.gain}

        return representer.represent_mapping(cls.yaml_tag, state)
    def to_yaml(cls: Type[Scrambler80211a], representer: SafeRepresenter,
                node: Scrambler80211a) -> ScalarNode:
        """Serialize a `Scrambler80211a` to YAML.

        Args:
            representer (SafeRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (Scrambler80211a):
                The `Scrambler80211a` instance to be serialized.

        Returns:
            Node:
                The serialized YAML node.

        :meta private:
        """

        return representer.represent_scalar(cls.yaml_tag, None)
    def to_yaml(cls: Type[PowerAmplifier], representer: SafeRepresenter,
                node: PowerAmplifier) -> MappingNode:
        """Serialize a `PowerAmplifier` object to YAML.

        Args:
            representer (BaseRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (PowerAmplifier):
                The amplifier instance to be serialized.

        Returns:
            Node:
                The serialized YAML node.
        """

        state = {
            'saturation_amplitude': node.__saturation_amplitude,
            'adjust_power': node.adjust_power,
        }

        return representer.represent_mapping(cls.yaml_tag, state)
    def to_yaml(cls: Type[WaveformGenerator], representer: SafeRepresenter,
                node: WaveformGenerator) -> Node:
        """Serialize an `WaveformGenerator` object to YAML.

        Args:
            representer (SafeRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (WaveformGenerator):
                The `WaveformGenerator` instance to be serialized.

        Returns:
            Node:
                The serialized YAML node
        """

        state = {
            "oversampling_factor": node.__oversampling_factor,
            "modulation_order": node.modulation_order,
            'synchronization': node.synchronization,
        }

        return representer.represent_mapping(cls.yaml_tag, state)
Exemple #29
0
    def to_yaml(cls: Type[QuadrigaInterface], representer: SafeRepresenter,
                node: QuadrigaInterface) -> MappingNode:
        """Serialize a QuadrigaInterface object to YAML.

        Args:
            representer (SafeRepresenter):
                A handle to a representer used to generate valid YAML code.
                The representer gets passed down the serialization tree to each node.

            node (QuadrigaInterface):
                The QuadrigaInterface instance to be serialized.

        Returns:
            Node:
                The serialized YAML node.
        """

        state = {
            'path_quadriga_src': node.path_quadriga_src,
            'antenna_kind': node.antenna_kind,
            'scenario_label': node.scenario_label,
        }

        return representer.represent_mapping(cls.yaml_tag, state)