Math Tools¶
Implementations of basic maths equations.
- class DbConversionType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum
Supported db conversion types.
- AMPLITUDE = 1¶
- POWER = 0¶
- amplitude_path_loss(carrier_frequency, distance)[source]¶
Compute the free space propagation loss of a wave in vacuum.
- Parameters:
- Raises:
ValueError – If the absolute value of carrier_frequency is zero.
- Return type:
- db2lin(db_val, conversion_type=DbConversionType.POWER)[source]¶
Converts from dB to linear
- Parameters:
db_val (float) – value in dB
conversion_type (DbConversionType, optional) – if POWER then it converts from dB to a power ratio if AMPLITUDE, then it converts from dB to an amplitude ratio default = POWER
- Returns:
the equivalent value in linear scale
- Return type:
(float)
- lin2db(val, conversion_type=DbConversionType.POWER)[source]¶
Converts from linear to dB
- Parameters:
val (float) – value in linear scale
conversion_type (DbConversionType, optional) – if POWER then it converts from a power ratio to dB if AMPLITUDE, then it converts from an amplitude ratio to dB default = POWER
- Returns:
(float) the equivalent value in linear scale