"""
The ska_oso_pdm.sb_definition.csp.pst.df module defines a Python
representation of a PST Detected-Filterbank Configuration.
"""
from pydantic import Field, computed_field
from ska_oso_pdm._shared import PdmObject, TerseStrEnum
from .common import RequantisationBits, SpectralKurtosis
[docs]
class PolarisationState(TerseStrEnum):
"""
Polarisation output supported by PSRFITS. 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 - Square-law detected flux density of polarisation X (npol = 1)
Y - Square-law detected flux density of polarisation Y (npol = 1)
Intensity - Total intensity, X+Y (npol = 1)
Both - X and Y (npol = 2)
Coherence - X, Y, Re[XY], Im[XY] (npol= 4)
Stokes - Stokes I,Q,U,V (npol = 4)
"""
X = "X"
Y = "Y"
INTENSITY = "Intensity"
BOTH = "Both"
COHERENCE = "Coherence"
STOKES = "Stokes"
[docs]
class PSTDetectedFilterbankParams(PdmObject):
"""
Parameters relevant to the detected-filterbank processing mode.
:param dispersion_measure: The DM for coherent/incoherent de-dispersion in pc/cm^3
:param rotation_measure: The RM for phase-coherent Faraday rotation correction in rad/m^2
:param output_frequency_channels: Number of output frequency channels. The default of -1 means no re-channelisation
:param polarisation_state: Polarisation state to write to PSRFITS output
:param num_bits_out: Number of bits per output sample
:param time_decimation_factor: The number of input samples per output time sample
:param frequency_decimation_factor: The number of input frequency channels incoherently added to each output frequency channel
:param num_sk_config: Number of SK configs
:param sk_config: List of SK config parameters
:param requantisation_scale: Scale factor to govern the dynamic range for fixed precision output during re-quantisation
:param requantisation_length: Number of samples to average together when determining the scale factors
"""
dispersion_measure: float = Field(
default=0.0,
ge=0.0,
le=100000.0,
description="The DM for coherent/incoherent de-dispersion in pc/cm^3",
)
rotation_measure: float = Field(
default=0.0,
description="The RM for phase-coherent Faraday rotation correction in rad/m^2",
)
output_frequency_channels: int = Field(
default=-1,
description="Number of output frequency channels. The default of -1 means no re-channelisation",
)
polarisation_state: PolarisationState = Field(
default=PolarisationState.STOKES,
description="Polarisation state to write to PSRFITS output",
)
num_bits_out: RequantisationBits = Field(
default=RequantisationBits.EIGHT,
description="Number of bits per output sample",
)
time_decimation_factor: int = Field(
default=1,
description="The number of input samples per output time sample",
)
frequency_decimation_factor: int = Field(
default=1,
description="The number of input frequency channels incoherently added to each output frequency channel",
)
sk_config: list[SpectralKurtosis] = Field(
default_factory=list,
description="List of spectral kurtosis configurations",
)
requantisation_scale: float = Field(
default=1.0,
description="Scale factor to govern the dynamic range for fixed precision output during re-quantisation",
)
requantisation_length: float = Field(
default=1.0,
description="Number of samples to average together when determining the scale factors",
)
@computed_field
@property
def num_sk_config(self) -> int:
return len(self.sk_config)