def distance_indicators(x, epsilon=None, distance=1.5):
 x = np.asarray(x)
 nobs = len(x)
 if ((epsilon is not None) and (epsilon <= 0)):
  raise ValueError(('Threshold distance must be positive if specified. Got epsilon of %f' % epsilon))
 if (distance <= 0):
  raise ValueError(('Threshold distance must be positive. Got distance multiplier %f' % distance))
 if (epsilon is None):
  epsilon = (distance * x.std(ddof=1))
 return (np.abs((x[:, None] - x)) < epsilon)

def distance_indicators ( x , epsilon = None , distance = 1.5 ) : x = np . asarray ( x ) nobs = len ( x ) if ( ( epsilon is not None ) and ( epsilon <= 0 ) ) : raise ValueError ( ( 'Threshold distance must be positive if specified. Got epsilon of %f' % epsilon ) ) if ( distance <= 0 ) : raise ValueError ( ( 'Threshold distance must be positive. Got distance multiplier %f' % distance ) ) if ( epsilon is None ) : epsilon = ( distance * x . std ( ddof = 1 ) ) return ( np . abs ( ( x [ : , None ] - x ) ) < epsilon )
calculate all pairwise threshold distance indicators for a time series parameters x : 1d array observations of time series for which heaviside distance indicators are calculated epsilon : scalar .