pyhctsa.operations.physics.walker

pyhctsa.operations.physics.walker(y, walker_rule='prop', walker_params=None)

Simulates a hypothetical walker moving through the time domain.

The hypothetical particle (or ‘walker’) moves in response to values of the time series at each point. Outputs from this operation are summaries of the walker’s motion, and comparisons of it to the original time series.

Parameters:
y : array-like

The input time series.

walker_rule : str, optional

The kinematic rule by which the walker moves in response to the time series over time:

  • ’prop’: the walker narrows the gap between its value and that of the previous value of the time series by a given proportion p: w[i] = w[i-1] + p * (y[i-1] - w[i-1]), with w[0] = 0. walker_params = p

  • ’biasprop’: biased motion; when the time series has just gone up (y[i-1] > y[i-2]) the walker narrows the gap to y[i-1] by a proportion p_up, and otherwise (including at the first step) by p_down. walker_params = [pup, pdown]

  • ’momentum’: the walker moves with mass m and inertia from the previous step: it extrapolates its previous step, w_inert = 2 w[i-1] - w[i-2], then closes a fraction 1/m of the gap between w_inert and y[i-1]. walker_params = m

  • ’runningvar’: inertial motion as above, with values rescaled by the ratio of the standard deviation of the last wl+1 values of y (up to y[i-1]) to that of the walker over the same window, including its provisional new value. walker_params = [m, wl] (inertial mass, window length)

Default is 'prop'.

walker_params : float, int, or list, optional

The parameters for the specified walker_rule. Default is None (use pre-defined defaults).

Returns:

Summaries of the walker’s trajectory (w_mean, w_median, w_std, w_min, w_max, w_ac1, w_ac2, w_tau, w_propzcross), of the walker compared with the series (sw_meanabsdiff, sw_taudiff, sw_stdrat, sw_minrat, sw_maxrat, sw_ac1diff (lag-1 autocorrelation of w minus that of y), sw_propcross, sw_ansarib_pval, sw_distdiff (L1 distance between the kernel-smoothed densities of y and w, at most 2)), and of the residual w - y (res_runsz (signed z-statistic of a runs test for randomness, pyhctsa.robust.bf_runs_z(): negative when it has fewer runs about its median than expected), res_swss5_1, res_ac1).

Return type:

dict