import dataclasses
from dataclasses import dataclass
from enum import Enum
from typing import Optional, Union
import astropy.units as u
from astropy.coordinates import Latitude
from astropy.units import Quantity
from ska_ost_senscalc.low.model import CalculatorInput
from ska_ost_senscalc.subarray import LOWArrayConfiguration, MIDArrayConfiguration
from ska_ost_senscalc.utilities import Telescope
[docs]
class Weighting(Enum):
"""
Enumeration for different weighting
"""
NATURAL = "natural"
ROBUST = "robust"
UNIFORM = "uniform"
[docs]
class WeightingSpectralMode(Enum):
"""
Enumeration spectral modes supported by the calculator, which are used in the look up table.
"""
LINE = "line"
CONTINUUM = "continuum"
[docs]
@dataclass
class ContinuumWeightingRequestParams:
"""
Represents the parameters sent to the /continuum/weighting end points, after they have been deserialised into enums and astropy objects.
"""
spectral_mode: WeightingSpectralMode
telescope: Telescope
weighting_mode: Weighting
subarray_configuration: LOWArrayConfiguration | MIDArrayConfiguration
dec: Latitude
freq_centre: Quantity
taper: Quantity = 0.0 * u.arcsec
robustness: int = 0
subband_freq_centres: Optional[list[Quantity]] = None
[docs]
@dataclass
class ZoomWeightingRequestParams:
"""
Represents the parameters sent to the /zoom/weighting end points, after they have been deserialised into enums and astropy objects.
"""
telescope: Telescope
weighting_mode: Weighting
subarray_configuration: LOWArrayConfiguration | MIDArrayConfiguration
dec: Latitude
freq_centres: list[Quantity]
taper: Quantity = 0.0 * u.arcsec
robustness: int = 0
[docs]
class Limit(Enum):
"""
Enumeration for different types of limit
"""
UPPER = "upper limit"
LOWER = "lower limit"
VALUE = "value"
[docs]
@dataclasses.dataclass
class BeamSize:
beam_maj: u.Quantity
beam_min: u.Quantity
beam_pa: u.Quantity
[docs]
@dataclasses.dataclass
class ConfusionNoise:
value: u.Quantity
limit: Limit
@dataclasses.dataclass(kw_only=True)
class _WeightingInput:
dec: Latitude
weighting_mode: Weighting
subarray_configuration: Union[MIDArrayConfiguration, LOWArrayConfiguration]
telescope: Telescope
spectral_mode: WeightingSpectralMode
robustness: int = 0
taper: u.Quantity
[docs]
@dataclasses.dataclass
class WeightingResult:
weighting_factor: float
surface_brightness_conversion_factor: u.Quantity
beam_size: BeamSize
confusion_noise: ConfusionNoise
[docs]
@dataclasses.dataclass
class WeightingMultiResultElement(WeightingResult):
freq_centre: u.Quantity