pyrfu.pyrf.movmean module#

pyrfu.pyrf.movmean.movmean(inp, n_pts: int = 100)[source]#

Computes running average of the inp over npts points.

Parameters:
  • inp (xarray.DataArray) – Time series of the input variable.

  • n_pts (int, Optional) – Number of points to average over.

Returns:

out – Time series of the input variable averaged over npts points.

Return type:

xarray.DataArray

Notes

Works also with 3D skymap distribution.

Examples

>>> from pyrfu import mms, pyrf

Time interval

>>> tint = ["2019-09-14T07:54:00.000","2019-09-14T08:11:00.000"]

Spacecraft index

>>> mms_id = 1

Load ion pressure tensor

>>> p_xyz_i = mms.get_data("Pi_gse_fpi_brst_l2", tint, mms_id)

Running average the pressure tensor over 10s

>>> fs = pyrf.calc_fs(p_xyz_i)
>>> p_xyz_i = pyrf.movmean(p_xyz_i, int(10 * fs))