"""
The ska_oso_pdm.sb_definition.csp.pst.ft module defines a Python
representation of a PST Flow-Through Configuration.
"""
from pydantic import Field
from ska_oso_pdm._shared import PdmObject, TerseStrEnum
from .common import RequantisationBits
[docs]
class FtPolarisations(TerseStrEnum):
"""
Options for the polarisation output of the flow-through mode.
Note that the PST code uses A and B for the two polarisations,
but the PDM uses linear as that is what the SKA will use.
"""
X = "X"
Y = "Y"
BOTH = "Both"
[docs]
class FtAlgorithm(TerseStrEnum):
"""
Options for rescale algorithm.
"""
MEDIANMAD = "MedianMAD"
MEANSTDDEV = "MeanStdDev"
[docs]
class PSTFlowThroughParams(PdmObject):
"""
Parameters relevant to the flow-through processing mode.
:param channels: Indices of the first and last (inclusive) frequency channels to process
:param polarisations: Polarisations to process
:param algorithm: Algorithm used to determine scales and offsets when rescaling complex voltage data
:param periodic_update: Indicates whether to recalculate the rescale statistics periodically
:param timescale: Timescale needed to calculate rescale stats, in seconds
:param num_bits_out: Number of bits per output sample
:param scale: Scale factor applied during re-quantisation
"""
channels: tuple[int, int] = Field(
default=(0, 0),
min_length=2,
max_length=2,
description="The indices of the first and last (inclusive) frequency channels",
)
polarisations: FtPolarisations = Field(
default=FtPolarisations.BOTH,
description="Polarisations to process",
)
algorithm: FtAlgorithm = Field(
default=FtAlgorithm.MEDIANMAD,
description="The algorithm used to determine the scales and offsets when rescaling complex voltage data",
)
periodic_update: bool = Field(
default=False,
description="An indicator for whether to recalculate the rescale statistics periodically",
)
timescale: float = Field(
default=0.0,
description="Time to sample before calculating statistics, in seconds",
)
num_bits_out: RequantisationBits = Field(
default=RequantisationBits.EIGHT,
description="Number of bits per output sample",
)
scale: float = Field(
gt=0.0,
default=1.0,
description="Scale factor that modifies the dynamic range of the fixed-precision output",
)