parameters

Parametes of electrogastroenterography signals and some help functions.

egegsignals.parameters.dfic(fs, x, dt, nseg, nstep, window='hanning', nfft=None, padded=False)[source]

Return dominant frequency instability coefficient.

Parameters:
  • fs (array_like) – Two frequencies bounds
  • x (numpy.ndarray) – Signal.
  • dt (float) – Sampling period.
  • window (str) – Type of window.
  • nseg (int) – Length of segment (in samples).
  • nstep (int) – Length of step (in samples).
  • nfft (int) – Length of the FFT. Use it for doing magick with resolution in spectrum. If None or less than nseg, the FFT length is nseg.
Returns:

Value of parameter.

Return type:

float

egegsignals.parameters.dominant_frequency(spectrum, dt, fs)[source]

Return dominant frequency of signal in band of frequencies.

Parameters:
  • spectrum (array_like) – Pre-calculated spectrum.
  • dt (float) – Sampling period.
  • fs (array_like) – Two frequencies bounds.
Returns:

Value of parameter.

Return type:

float

egegsignals.parameters.energy(spectrum, dt, fs)[source]

Return the energy of the part of the specturm.

Parameters:
  • spectrum (array_like) – Pre-calculated spectrum.
  • dt (float) – Sampling period
  • fs (array_like) – Two frequencies bounds
Returns:

Value of parameter.

Return type:

float

egegsignals.parameters.expand_to(x, new_len)[source]

Add zeros to signal. For doing magick with resolution in spectrum.

Returns:Signal expanded by zeros.
Return type:numpy.array
egegsignals.parameters.power(spectrum, dt, fs)[source]

Return the power of the part of the specturm.

Parameters:
  • spectrum (array_like) – Pre-calculated spectrum.
  • dt (float) – Sampling period
  • fs (array_like) – Two frequencies bounds
Returns:

Value of parameter.

Return type:

float

egegsignals.parameters.rhythmicity(spectrum, dt, fs)[source]

Return Gastroscan-GEM version of the rhythmicity coefficient. Do not use it.

Parameters:
  • spectrum (array_like) – Pre-calculated spectrum.
  • dt (float) – Sampling period
  • fs (array_like) – Two frequencies bounds
Returns:

Value of parameter.

Return type:

float

egegsignals.parameters.rhythmicity_norm(spectrum, dt, fs)[source]

Return normalized Gastroscan-GEM version of the rhythmicity coefficient.

Parameters:
  • spectrum (array_like) – Pre-calculated spectrum.
  • dt (float) – Sampling period
  • fs (array_like) – Two frequencies bounds
Returns:

Value of parameter.

Return type:

float

egegsignals.parameters.spectrum(x)[source]

Return amplitude spectrum of signal.

Parameters:x (array_like) – Signal.
Returns:Two-side amplitude spectrum.
Return type:numpy.array
egegsignals.parameters.stft(x, dt, nseg, nstep, window='hanning', nfft=None, padded=False)[source]

Return result of short-time fourier transform.

Parameters:
  • x (numpy.ndarray) – Signal.
  • dt (float) – Sampling period.
  • window (str) – Type of window.
  • nseg (int) – Length of segment (in samples).
  • nstep (int) – Length of step (in samples).
  • nfft (int) – Length of the FFT. If None or less than nseg, the FFT length is nseg.
Returns:

Result of STFT.

Return type:

list of numpy.ndarray