Mathematical utilities

Created on Tue May 5 00:34:36 2020

@author: joaovitor

pytta.utils.maxabs(arr: array) int[source]

Maximum of the absolute of array values.

Parameters:

(np.array) (arr) –

Returns:

int or float

Return type:

Maximum of the absolute values.

pytta.utils.arr2rms(arr: array) float[source]

Root of the mean of a squared array.

Parameters:

(np.array) (arr) –

Returns:

float

Return type:

RMS of data.

pytta.utils.rms2dB(rms: float, power: bool = False, ref: float = 1.0) float[source]

RMS to decibel.

Parameters:
  • (float) (rms) –

  • (bool (power) –

  • optional) (Reference value for decibel scale. Defaults to 1.0.) –

  • (float (ref) –

  • optional)

Returns:

float

Return type:

Decibel scaled value.

pytta.utils.arr2dB(arr: array, power: bool = False, ref: float = 1.0) float[source]

Calculate the decibel level of an array of data.

Parameters:
  • (np.array) (arr) –

  • (bool (power) –

  • optional) (Decibel reference. Defaults to 1..) –

  • (float (ref) –

  • optional)

Returns:

float

Return type:

Decibel scaled value.