Created
January 1, 2021 14:11
-
-
Save suhaskv/898b0ab14e8a459b5abd4d2a9b08d188 to your computer and use it in GitHub Desktop.
VSB Power Line Blog - Katz FD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def katz_fd(x): | |
x = np.array(x) | |
# Get the difference between consecutive elements of x | |
dists = np.abs(np.ediff1d(x)) | |
# Get the sum of all the differences | |
l1 = dists.sum() | |
# Divide each value of dists (diff. b/w consec. elements) with its mean value and take the log10 | |
ln = np.log10(np.divide(l1, dists.mean())) | |
# Get the difference between the first value of the sequence with all the elements of the sequence | |
aux_d = x - x[0] | |
# Get the absolute maximum difference of the 1st value of seq. with all elements of seq. | |
d = np.max(np.abs(aux_d[1:])) | |
return np.divide(ln, np.add(ln, np.log10(np.divide(d, l1)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment