GithubHelp home page GithubHelp logo

zx9506 / higuchifractaldimension Goto Github PK

View Code? Open in Web Editor NEW

This project forked from inuritdino/higuchifractaldimension

0.0 1.0 0.0 297 KB

Higuchi Fractal Dimension (HFD) for 1D(time) series

License: MIT License

Python 88.09% C 11.91%

higuchifractaldimension's Introduction

Higuchi Fractal Dimension (HFD)

Following: T. Higuchi, Approach to an Irregular Time Series on the Basis of the Fractal Theory, Physica D, 1988; 31: 277-283.

Requirements

  • Python3
  • NumPy
  • C compiler (for the optimized version)

Compilation (optional)

To compile the C library (assume the compiler name is gcc):

gcc -shared hfd.c -o libhfd.so -lm -fPIC

Keep the name for the output library libhfd.so: Python wrapper looks for this name.

Python module

In python, assuming the package is in the Python's path and called HiguchiFractalDimension:

import HiguchiFractalDimension

The module contains several functions:

  • hfd calculates HFD of a 1D series
  • curve_length caculates a paired array (k,Lk), i.e. interval "times" and the curve length.
  • lin_fit_hfd calculates linear fitting from (k,Lk) data and returns HFD.

Examples

import numpy as np
import HiguchiFractalDimension as hfd

x = np.random.randn(10000)
y = np.empty(9900)
for i in range(x.size-100):
	y[i] = np.sum(x[:(i+100)])
	
## Note x is a Guassian noise, y is the original Brownian data used in Higuchi, Physica D, 1988.

hfd.hfd(x) # ~ 2.00
hfd.hfd(y) # ~ 1.50

higuchifractaldimension's People

Contributors

inuritdino avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.