Math Tools#

Implementations of basic maths equations.

class DbConversionType(value)#

Bases: Enum

Supported db conversion types.

POWER = 0#
AMPLITUDE = 1#
db2lin(db_val, conversion_type=DbConversionType.POWER)#

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)#

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

marcum_q(a, b, m=1)#

Calculates the Marcum-Q function Q_m(a, b)

This method uses the relationship between Marcum-Q function and the chi-squared distribution.

Parameters:
  • a (float) –

  • b (np.array) –

  • m (float) –

Returns:

the approximated Marcum-Q function for the desired parameters

Return type:

(np.ndarray)

rms_value(x)#

Returns the root-mean-square value of a given input vector

Return type:

float

amplitude_path_loss(carrier_frequency, distance)#

Compute the free space propagation loss of a wave in vacuum.

Parameters:
  • carrier_frequency (float) – The wave’s carrier frequency in Hz.

  • distance (float) – The traveled distance in m.

Raises:

ValueError – If the absolute value of carrier_frequency is zero.

Return type:

float