Source code for ska_pst.testutils.scan_config.model

# -*- coding: utf-8 -*-
#
# This file is part of the SKA PST project
#
# Distributed under the terms of the BSD 3-clause new license.
# See LICENSE for more info.

"""Module with data classes representing the model of the scan configuration."""

from __future__ import annotations

import dataclasses
from typing import Tuple


[docs]@dataclasses.dataclass class FlowThroughConfig: """Data class representing the Flow Through configuration used in testing.""" rescale_timescale: float = 0.0 """ The timescale needed to calculate rescale stats, in seconds. This value is how long in time to sample data before calculating the rescale statistics. If periodic_update is true, then this is also the period of how often the rescale stats are recalculated. If this value is set to 0.0, then PST will use the smallest chunk of data available to it to perform the statistics calculation. Default: 0.0 """ periodic_update: bool = False "An indicator for whether to recalculate the rescale statistics periodically." algorithm: str = "MedianMAD" """The algorithm used to determine the scales and offsets when rescaling complex voltage data.""" channels_out: Tuple[int, int] | None = None """ The selected channel as an exclusive range. To select all the channels use (-1, -1) which the scan config generator will use as a sentinel value for all channels """ polarisations: str | None = None """ The polarisations to select in ChanPolSelect. Default is we test a random selection of "A", "B" or "Both" """ num_bits_out: int | None = None """ The number of bits to use when performing digitisation. """ requantisation_scale: float = 1.0 """ The scale to apply to values before performing digitisation. """ @property def use_robust_statistics(self: FlowThroughConfig) -> bool: """ Get the use robust statistics property. If ``algorithm`` property is ``MedianMAD`` then this will return ``True``. :return: the use robust statistics property. :rtype: bool """ return self.algorithm == "MedianMAD" @use_robust_statistics.setter def use_robust_statistics(self: FlowThroughConfig, use_robust: bool) -> None: """ Set the use robust statistics property. This will set the ``algorithm`` property to ``MedianMAD`` if the parameter is ``True`` else it will set the ``algorithm`` property to ``MeanStdDev``. :param use_robust: the use robust statistics property value. :type use_robust: bool """ self.algorithm = "MedianMAD" if use_robust else "MeanStdDev"