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:
  • 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

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

marcum_q(a, b, m=1)[source]

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

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

Parameters:
Returns:

the approximated Marcum-Q function for the desired parameters

Return type:

(np.ndarray)

rms_value(x)[source]

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

Return type:

float