Skip to content
Snippets Groups Projects
Commit 076dd69f authored by Jan David Mol's avatar Jan David Mol
Browse files

typing

parent 48a9e41a
No related branches found
No related tags found
1 merge request!996L2SS-2017: Fix rounding of input samples delay
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment