diff --git a/tangostationcontrol/tangostationcontrol/common/frequency_bands.py b/tangostationcontrol/tangostationcontrol/common/frequency_bands.py index 0e1e748a6ac459a7b839151fc18c54811a2ebd21..cab2d7f26dd7a1cc4c9997824cd00bc10777df7a 100644 --- a/tangostationcontrol/tangostationcontrol/common/frequency_bands.py +++ b/tangostationcontrol/tangostationcontrol/common/frequency_bands.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from .constants import CLK_160_MHZ, CLK_200_MHZ +from .sdp import subband_frequency, are_subbands_decreasing @dataclass(frozen=True) @@ -37,6 +38,17 @@ class Band: # return first match return matching_bands[0].name + @property + def spectral_inversion(self) -> bool: + """Whether the spectrum is inverted, and thus should be inverted back by SDP.""" + return are_subbands_decreasing(self.nyquist_zone, False) + + def subband_frequency(self, subband: int) -> float: + """The central frequency of the given subband index, if SDP is configured accordingly.""" + return subband_frequency( + subband, self.clock, self.nyquist_zone, self.spectral_inversion + ) + # Global list of all supported frequency bands bands = {}