diff --git a/tangostationcontrol/tangostationcontrol/common/calibration.py b/tangostationcontrol/tangostationcontrol/common/calibration.py index 3c9370b4f9b1a2871445c14b6436ef009c19fb29..b952b42f6ecc3ac66ce02b4da6d7724419dc9cf3 100644 --- a/tangostationcontrol/tangostationcontrol/common/calibration.py +++ b/tangostationcontrol/tangostationcontrol/common/calibration.py @@ -218,7 +218,7 @@ class CalibrationManager: ) -def delay_compensation(delays_seconds: numpy.ndarray, clock: int): +def delay_compensation(delays_seconds: numpy.ndarray, clock: int) -> numpy.ndarray: """Return the delay compensation required to line up signals that are delayed by "delays" seconds. The returned values are the delay to apply, in samples (coarse) and remaining seconds @@ -249,7 +249,7 @@ def delay_compensation(delays_seconds: numpy.ndarray, clock: int): # as we shift all of them to obtain a non-negative delay. input_delays_samples = numpy.round( max(signal_delays_samples) - signal_delays_samples - ) + ).astype(numpy.int32) return input_delays_samples @@ -317,7 +317,7 @@ def calibrate_RCU_attenuator_dB(antenna_field: DeviceProxy): antenna_field.RCU_attenuator_dB_RW = rcu_attenuator_db.astype(numpy.int64) -def loss_compensation(losses_dB: numpy.ndarray): +def loss_compensation(losses_dB: numpy.ndarray) -> numpy.ndarray: """Return the attenuation required to line up signals that are dampened by "lossed_dB" decibel. @@ -331,14 +331,9 @@ def loss_compensation(losses_dB: numpy.ndarray): in losses_dB. So we do _not_ fully dampen towards the weakest signal. """ - # NB: signal_* are the amount of loss the signal obtained in our processing - # chain, while input_* are the amount of (dampening) attenuation to apply - # to compensate. - - # compute the coarse correction, in samples - signal_attenuation_integer_dB = numpy.round(losses_dB).astype(numpy.uint32) - # correct for the coarse loss by dampening the signals to line up. - input_attenuation_integer_dB = numpy.round(numpy.max(losses_dB) - losses_dB) + input_attenuation_integer_dB = numpy.round(numpy.max(losses_dB) - losses_dB).astype( + numpy.int32 + ) return input_attenuation_integer_dB