+class SymbolTime(object):
+ """
+ In theory the symbol distance (the distance to discriminate symbols) can
+ be arbitrary, and it's only bounded below by the stability of the pulse
+ time, but in practice it can be necessary to wait a predefined minimum
+ amount of time between pulses because of technological limits of the
+ transmitting devices, we call this time the "minimum inter-symbol
+ distance".
+ """
+
+ # pylint: disable=too-few-public-methods
+ def __init__(self, pulse_min, pulse_max, multiplier,
+ min_inter_symbol_distance=0.0):
+ assert multiplier >= 0
+ if (pulse_min == pulse_max) and (min_inter_symbol_distance == 0):
+ raise ValueError("If (pulse_min == pulse_max) a non-zero",
+ "inter-symbol distance MUST be specified")
+
+ symbol_distance = 2 * (pulse_max - pulse_min)
+ if symbol_distance == 0:
+ symbol_distance = min_inter_symbol_distance
+
+ # The time the transmitter has to wait to disambiguate between this
+ # symbol and a different one.
+ self.dist = min_inter_symbol_distance + symbol_distance * multiplier
+
+ # The minimum time which represents the symbol at the receiving end.
+ self.min = min_inter_symbol_distance + pulse_min + \
+ symbol_distance * multiplier
+
+ # The maximum time which represents the symbol at the receiving end
+ self.max = min_inter_symbol_distance + pulse_min + \
+ symbol_distance * (multiplier + 1)
+
+