Dynamic power spectra

pyspedas.tdpwrspc(varname, newname=None, trange=['0.0', '0.0'], nboxpoints=None, nshiftpoints=None, polar=False, bin=3, nohanning=False, noline=False, notperhz=False, notmvariance=False)

Compute power spectra for a tplot variable.

Parameters:
  • varname (str) – Name of pytplot variable.

  • newname (str, optional) – Name of new pytplot variable to save data to. Default: None. If newname is not set ‘_dpwrspc’ will be appended to the varname

  • trange (list of float, optional) – Start and end times for the calculation.

  • nboxpoints (int, optional) – The number of points to use for the hanning window. Default: 256

  • nshiftpoints (int, optional) – The number of points to shift for each spectrum. Default: 128

  • polar (bool, optional) – If True, the input data is in polar coordinates. Default: False

  • bin (int, optional) – Size for binning of the data along the frequency domain. Default: 3

  • nohanning (bool, optional) – If True, no hanning window is applied to the input. Default: False

  • noline (bool, optional) – If True, no straight line is subtracted. Default: False

  • notperhz (bool, optional) – If True, the output units are the square of the input units. Default: False

  • notmvariance (bool, optional) – If True, replace output spectrum for any windows that have variable. cadence with NaNs. Default: False

Returns:

Name of new pytplot variable.

Return type:

str

Example

>>> import pytplot
>>> import numpy as np
>>> pytplot.store_data('a', data={'x': range(100), 'y': np.random.random(100)})
>>> pytplot.get_data('a_pwrspc')
>>> pytplot.tpwrspc('a_pwrspc')
pyspedas.dpwrspc(time, quantity, nboxpoints=256, nshiftpoints=128, bin=3, tbegin=-1.0, tend=-1.0, noline=False, nohanning=False, notperhz=False, notmvariance=False, tm_sensitivity=None)

Compute power spectra.

Parameters:
  • time (list of float) – Time array.

  • quantity (list of float) – Data array.

  • nboxpoints (int, optional) – The number of points to use for the hanning window. The default is 256.

  • nshiftpoints (int, optional) – The number of points to shift for each spectrum. The default is 128.

  • bin (int, optional) – Size for binning of the data along the frequency domain. The default is 3.

  • tbegin (float, optional) – Start time for the calculation. If -1.0, the start time is the first time in the time array.

  • tend (float, optional) – End time for the calculation. If -1.0, the end time is the last time in the time array.

  • noline (bool, optional) – If True, no straight line is subtracted. The default is False.

  • nohanning (bool, optional) – If True, no hanning window is applied to the input. The default is False.

  • notperhz (bool, optional) – If True, the output units are the square of the input units. The default is False.

  • notmvariance (bool, optional) – If True, replace output spectrum for any windows that have variable cadence with NaNs. The default is False.

  • tm_sensitivity (float, optional) – If noTmVariance is set, this number controls how much of a dt anomaly is accepted. The default is None.

Returns:

  • tdps (array of float) – The time array for the dynamic power spectrum, the center time of the interval used for the spectrum.

  • fdps (array of float) – The frequency array (units =1/time units).

  • dps (array of float) – The power spectrum, (units of quantity)^2/frequency_units.