flap.spectral_analysis

Created on Thu Mar 7 10:34:49 2019

Spectral analysis tools for FLAP

@author: Sandor Zoletnik (zoletnik.sandor@ek-cer.hu) Centre for Energy Research

flap.spectral_analysis.trend_removal_func(d, ax, trend, x=None, return_trend=False, return_poly=False)

Remove a given trend from the data. Operates on one axis between two indices of the data array.

The input array is modified.

Parameters:
dnp.ndarray

Data array.

axint

The axis along which to operate.

trendlist | str | None

Possible values:

  • list:

    • ['poly', n]: Fit an n order polynomial to the data and subtract.

  • str:

    • ‘mean’: Subtract mean.

  • None: Don’t remove trend.

xnp.ndarray, optional, default=None

The ‘x’ axis values used in certain types of trend fitting. If not given, equidistant spacing will be assumed.

return_trendbool, optional, default=False

Whether to return the trend data.

return_polybool, optional, default=False

Return polynomial coefficients for poly trend removal. The coefficients will be in axis ax.

Returns:
array_like | None

Possible return values:

  • If return_trend is True, the trend data is returned.

  • If return_trend is True, and a polynomial fitting is performed, the trend data is returned.

  • Otherwise, return None.