### MFDFA Usage Example Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fathon.MFDFA.rst.txt This example demonstrates the typical workflow for using the MFDFA class. It includes data preparation, initialization, computation of fluctuation functions and exponents, and derivation of the multifractal spectrum. Ensure data is zero-mean cumulative sum before initialization. ```python import numpy as np import fathon from fathon import fathonUtils as fu #time series a = np.random.randn(10000) #zero-mean cumulative sum a = fu.toAggregated(a) #initialize mfdfa object pymfdfa = fathon.MFDFA(a) #compute fluctuation function and generalized Hurst exponents wins = fu.linRangeByStep(10, 2000) n, F = pymfdfa.computeFlucVec(wins, np.arange(-3, 4, 0.1), revSeg=True, polOrd=1) list_H, list_H_intercept = pymfdfa.fitFlucVec() #compute mass exponents tau = pymfdfa.computeMassExponents() #compute multifractal spectrum alpha, mfSpect = pymfdfa.computeMultifractalSpectrum() ``` -------------------------------- ### Usage Example Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.MFDCCA.html Example demonstrating how to use the MFDCCA class for time series analysis. ```APIDOC ```python import numpy as np import fathon from fathon import fathonUtils as fu #time series a = np.random.randn(10000) b = np.random.randn(10000) #zero-mean cumulative sum a = fu.toAggregated(a) b = fu.toAggregated(b) #initialize mfdfa object pymfdcca = fathon.MFDCCA(a, b) #compute fluctuation function and generalized Hurst exponents wins = fu.linRangeByStep(10, 2000) n, F = pymfdcca.computeFlucVec(wins, np.arange(-3, 4, 0.1), revSeg=True, polOrd=1) list_H, list_H_intercept = pymfdcca.fitFlucVec() #compute mass exponents tau = pymfdcca.computeMassExponents() #compute multifractal spectrum alpha, mfSpect = pymfdcca.computeMultifractalSpectrum() ``` ``` -------------------------------- ### MFDCCA Usage Example Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.MFDCCA.html This example demonstrates the complete workflow for MFDCCA analysis, including data preparation, object initialization, computation of fluctuation vectors, fitting, mass exponents, and the multifractal spectrum. Ensure time series are preprocessed to be zero-mean and aggregated. ```python import numpy as np import fathon from fathon import fathonUtils as fu #time series a = np.random.randn(10000) b = np.random.randn(10000) #zero-mean cumulative sum a = fu.toAggregated(a) b = fu.toAggregated(b) #initialize mfdfa object pymfdcca = fathon.MFDCCA(a, b) #compute fluctuation function and generalized Hurst exponents wins = fu.linRangeByStep(10, 2000) n, F = pymfdcca.computeFlucVec(wins, np.arange(-3, 4, 0.1), revSeg=True, polOrd=1) list_H, list_H_intercept = pymfdcca.fitFlucVec() #compute mass exponents tau = pymfdcca.computeMassExponents() #compute multifractal spectrum alpha, mfSpect = pymfdcca.computeMultifractalSpectrum() ``` -------------------------------- ### MFDCCA Usage Example Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fathon.MFDCCA.rst.txt Demonstrates initializing the MFDCCA object with two time series and computing various multifractal spectrum components. ```python import numpy as np import fathon from fathon import fathonUtils as fu #time series a = np.random.randn(10000) b = np.random.randn(10000) #zero-mean cumulative sum a = fu.toAggregated(a) b = fu.toAggregated(b) #initialize mfdfa object pymfdcca = fathon.MFDCCA(a, b) #compute fluctuation function and generalized Hurst exponents wins = fu.linRangeByStep(10, 2000) n, F = pymfdcca.computeFlucVec(wins, np.arange(-3, 4, 0.1), revSeg=True, polOrd=1) list_H, list_H_intercept = pymfdcca.fitFlucVec() #compute mass exponents tau = pymfdcca.computeMassExponents() #compute multifractal spectrum alpha, mfSpect = pymfdcca.computeMultifractalSpectrum() ``` -------------------------------- ### Zero-Mean Cumulative Sum with toAggregated Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fu/fathonUtils.toAggregated.rst.txt This example demonstrates how to compute the zero-mean cumulative sum of a NumPy array using the toAggregated function. Ensure numpy and fathonUtils are imported. ```python import numpy as np from fathon import fathonUtils as fu #time series a = np.random.randn(10000) #zero-mean cumulative sum a = fu.toAggregated(a) ``` -------------------------------- ### DCCA Usage Example Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fathon.DCCA.rst.txt Demonstrates initializing a DCCA object with time series data, computing fluctuation functions and Hurst exponents, and calculating rho indices. Requires numpy and fathon libraries. ```python import numpy as np import fathon from fathon import fathonUtils as fu #time series a = np.random.randn(10000) b = np.random.randn(10000) #zero-mean cumulative sum a = fu.toAggregated(a) b = fu.toAggregated(b) #initialize non-empty dcca object pydcca = fathon.DCCA(a, b) #compute fluctuation function and Hurst exponent wins = fu.linRangeByStep(20, 1000, step=50) n, F = pydcca.computeFlucVec(wins, polOrd=1) H, H_intercept = pydcca.fitFlucVec() #compute Hurst exponent in different ranges limits_list = np.array([[20,120], [220,870]], dtype=int) list_H, list_H_intercept = pydcca.multiFitFlucVec(limits_list) #compute rho index wins = fu.linRangeByStep(20, 100, step=50) n, rho = pydcca.computeRho(wins, polOrd=1) #initialize empty dcca object pythresh = fathon.DCCA() #compute confidence levels wins = fu.linRangeByStep(4, 100) n, cInt1, cInt2 = pythresh.rhoThresholds(300, wins, 100, 0.95, polOrd=1) ``` -------------------------------- ### Generate Linearly Separated Elements Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fu/fathonUtils.linRangeByStep.rst.txt Use linRangeByStep to create a list of numbers starting from 10, up to (but not including) 100, with a step of 2. Ensure fathonUtils is imported as fu. ```python from fathon import fathonUtils as fu #linearly separated elements a = fu.linRangeByStep(10, 100, step=2) ``` -------------------------------- ### powRangeByStep Source: https://fathon.readthedocs.io/en/latest/fun_class/fu/fathonUtils.powRangeByStep.html Generates an array of elements by raising a specified base to linearly separated exponents. The exponents range from `start` to `end` with a given `step`, and the `base` determines the exponential value. ```APIDOC ## powRangeByStep() ### Description Generates an array of elements by raising a specified base to linearly separated exponents. The exponents range from `start` to `end` with a given `step`, and the `base` determines the exponential value. ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - None ### Function Signature `fathon.fathonUtils.powRangeByStep(_start_ , _end_ , _step =1_, _base =2_)` ### Parameters - **start** (_int_) – Smallest exponent. - **end** (_int_) – Biggest exponent. - **step** (_int_) – Step between two consecutive exponents (default : 1). - **base** (_int_) – Base of the exponential (default : 2). ### Returns Array of elements given by base raised to linearly separated exponents. ### Return Type numpy ndarray ### Request Example ```python from fathon import fathonUtils as fu # elements given by `base` raised to linearly separated exponents a = fu.powRangeByStep(10, 1000, step=2, base=3) ``` ``` -------------------------------- ### linRangeByCount Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fu/fathonUtils.linRangeByCount.rst.txt Generates a list of numbers linearly spaced between a start and end value, with a specified count of elements. ```APIDOC ## linRangeByCount ### Description Generates a list of numbers linearly spaced between a start and end value, with a specified count of elements. ### Method `linRangeByCount(start, end, count)` ### Parameters #### Path Parameters - **start** (int) - The starting value of the range. - **end** (int) - The ending value of the range. - **count** (int) - The desired number of elements in the generated list. ### Request Example ```python from fathon import fathonUtils as fu a = fu.linRangeByCount(10, 100, count=42) ``` ### Response #### Success Response (200) - **list** (list[int]) - A list of integers representing the linearly spaced elements. ``` -------------------------------- ### powRangeByCount Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fu/fathonUtils.powRangeByCount.rst.txt Calculates `count` numbers by raising `base` to linearly separated exponents between `start` and `end`. ```APIDOC ## powRangeByCount ### Description Generates a sequence of numbers by raising a specified `base` to `count` linearly separated exponents. The range of these exponents is determined by `start` and `end` values. ### Parameters #### Path Parameters - **start** (int) - Required - The starting value for the range. - **end** (int) - Required - The ending value for the range. - **base** (int) - Optional - The base number to be raised to the power. Defaults to 10. - **count** (int) - Optional - The number of elements to generate in the range. Defaults to 10. ### Request Example ```python from fathon import fathonUtils as fu # elements given by `base` raised to linearly separated exponents a = fu.powRangeByCount(10, 1000, base=3, count=42) ``` ### Response #### Success Response (200) - **list** (list[int]) - A list of integers representing the generated sequence. ``` -------------------------------- ### Generate Linearly Spaced Elements Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fu/fathonUtils.linRangeByCount.rst.txt Use linRangeByCount to create a list of numbers evenly distributed between a start and end value. Specify the desired number of elements using the 'count' parameter. ```python from fathon import fathonUtils as fu #linearly separated elements a = fu.linRangeByCount(10, 100, count=42) ``` -------------------------------- ### Generate powers with a step Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fu/fathonUtils.powRangeByStep.rst.txt Use `powRangeByStep` to create a list of numbers by raising a base to exponents that increase linearly. This is useful for generating sequences with exponential growth. ```python from fathon import fathonUtils as fu #elements given by `base` raised to linearly separated exponents a = fu.powRangeByStep(10, 1000, step=2, base=3) ``` -------------------------------- ### Compute and Fit Fluctuation Function with DFA Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fathon.DFA.rst.txt Demonstrates initializing a DFA object with aggregated time series data, computing the fluctuation function over specified window sizes, and fitting the function to obtain the Hurst exponent. Uses `revSeg=True` for reversed segment analysis and `polOrd=3` for cubic polynomial detrending. ```python import numpy as np import fathon from fathon import fathonUtils as fu #time series a = np.random.randn(10000) #zero-mean cumulative sum a = fu.toAggregated(a) #initialize dfa object pydfa = fathon.DFA(a) #compute fluctuation function and Hurst exponent wins = fu.linRangeByStep(10, 2000) n, F = pydfa.computeFlucVec(wins, revSeg=True, polOrd=3) H, H_intercept = pydfa.fitFlucVec() #compute Hurst exponent in different ranges limits_list = np.array([[15,2000], [200,1000]], dtype=int) list_H, list_H_intercept = pydfa.multiFitFlucVec(limits_list) ``` -------------------------------- ### DFA Class Initialization Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.DFA.html Initializes the DFA class with a time series. ```APIDOC ## DFA Class ### Description Detrended Fluctuation Analysis class. ### Parameters #### Parameters - **tsVec** (iterable) - Time series used for the analysis. ``` -------------------------------- ### linRangeByStep Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fu/fathonUtils.linRangeByStep.rst.txt Generates a list of linearly separated elements within a given range and step. ```APIDOC ## linRangeByStep ### Description Generates a list of numbers starting from a given value, up to (but not including) an end value, with a specified step. ### Parameters #### Path Parameters None #### Query Parameters - **start** (int) - The starting value of the range. - **end** (int) - The end value of the range (exclusive). - **step** (int) - The step to increment by. ### Request Example ```python from fathon import fathonUtils as fu a = fu.linRangeByStep(10, 100, step=2) ``` ### Response #### Success Response (200) - **list** (list[int]) - A list of integers representing the generated range. ``` -------------------------------- ### Compute Hurst Exponent with HT Class Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fathon.HT.rst.txt Initializes the HT object with aggregated time series data and computes the time-dependent Hurst exponent using specified window sizes and polynomial orders. ```python import numpy as np import fathon from fathon import fathonUtils as fu #time series a = np.random.randn(10000) #zero-mean cumulative sum a = fu.toAggregated(a) #initialize ht object pyht = fathon.HT(a) #compute time-dependent Hurst exponent ht = pyht.computeHt([100, 200, 1000], mfdfaPolOrd=1, polOrd=1) ``` -------------------------------- ### powRangeByStep Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fu/fathonUtils.powRangeByStep.rst.txt Generates elements by `base` raised to linearly separated exponents. ```APIDOC ## powRangeByStep ### Description Generates a sequence of numbers where each number is the result of raising a `base` to a power. The powers are determined by a range starting from an initial value, ending at a specified limit, and incrementing by a given `step`. ### Parameters #### Path Parameters None #### Query Parameters - **start** (int) - Required - The starting value of the range (inclusive). - **stop** (int) - Required - The stopping value of the range (inclusive). - **step** (int) - Optional - The increment between exponents. Defaults to 1. - **base** (int) - Optional - The base number to be raised to the power. Defaults to 10. ### Request Example ```python from fathon import fathonUtils as fu # elements given by `base` raised to linearly separated exponents a = fu.powRangeByStep(10, 1000, step=2, base=3) ``` ### Response #### Success Response (200) - **list** (list[int]) - A list of integers representing the calculated powers. ``` -------------------------------- ### MFDFA Class Initialization Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.MFDFA.html Initializes the MFDFA class with a given time series. ```APIDOC ## MFDFA(tsVec) ### Description Initializes the MultiFractal Detrended Fluctuation Analysis class. ### Parameters * **tsVec** (iterable) - Time series used for the analysis. ``` -------------------------------- ### DCCA Class Initialization Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.DCCA.html Initializes the DCCA class with two time series. ```APIDOC ## DCCA Class ### Description Detrended Cross-Correlation Analysis class. ### Parameters * **tsVec1** (_iterable_) – First time series used for the analysis. * **tsVec2** (_iterable_) – Second time series used for the analysis. ``` -------------------------------- ### MFDFA Class Methods Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fathon.MFDFA.rst.txt This section details the core methods available within the MFDFA class for performing multifractal analysis. ```APIDOC ## MFDFA Class ### Description Provides methods for multifractal detrended fluctuation analysis. ### Methods - **`computeFlucVec(wins, q, revSeg=False, polOrd=2, fitType='poly')`** Computes the fluctuation function and generalized Hurst exponents for a given time series and a range of window sizes and q-orders. - **`computeMassExponents(q=None, wins=None, revSeg=False, polOrd=2, fitType='poly')`** Computes the mass exponents (tau(q)) of the time series. - **`computeMultifractalSpectrum(q=None, wins=None, revSeg=False, polOrd=2, fitType='poly')`** Computes the multifractal spectrum (alpha, f(alpha)) of the time series. - **`fitFlucVec()`** Fits the fluctuation vector data obtained from `computeFlucVec` to determine the generalized Hurst exponents and their intercepts. - **`saveObject(path)`** Saves the current state of the MFDFA object to a specified file path. ``` -------------------------------- ### HT.saveObject() Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.HT.html Saves the current state of the HT object to a binary file. The '.fathon' extension is automatically appended to the provided file name. ```APIDOC ## HT.saveObject() ### Description Save current object state to binary file. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **outFileName** (str) - Output binary file. .fathon extension will be appended to the file name. ### Returns None ``` -------------------------------- ### HT.computeHt() Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.HT.html Computes the time-dependent local Hurst exponent at each scale using Ihlen’s approach. It allows for customization of polynomial orders for fitting and provides an option to use pre-computed values for MFDFA's Hurst exponent at q=0. ```APIDOC ## HT.computeHt() ### Description Computation of the time-dependent local Hurst exponent at each scale, using Ihlen’s approach. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **scales** (int or iterable or numpy ndarray) - Window’s sizes used for the computation of the time-dependent local Hurst exponent. * **polOrd** (int, optional) - Order of the polynomial to be fitted in each window (default : 1). * **mfdfaPolOrd** (int, optional) - Order of the polynomial to be fitted to MFDFA’s fluctuations at q = 0 (default : 1). * **q0Fit** (iterable or numpy ndarray of floats, optional) - MFDFA’s Hurst exponent at order q = 0 and the corresponding intercept of the fit, [hq0, hq0_intercept]. These values must come from a log-log fit, with the log base equal to e. If not empty, it will be directly used to compute the time-dependent local Hurst exponent, ignoring mfdfaPolOrd value (default : []). * **verbose** (bool, optional) - Verbosity (default : False). ### Returns Time-dependent local Hurst exponent. ### Return Type numpy ndarray ``` -------------------------------- ### Generate Powers with Count Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fu/fathonUtils.powRangeByCount.rst.txt Generates elements by raising a base to linearly separated exponents. Use this when you need a sequence of exponentially spaced values. ```python from fathon import fathonUtils as fu #elements given by `base` raised to linearly separated exponents a = fu.powRangeByCount(10, 1000, base=3, count=42) ``` -------------------------------- ### computeMassExponents Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.MFDCCA.html Computes the mass exponents from the fluctuations. ```APIDOC ## MFDCCA.computeMassExponents() ### Description Computation of the mass exponents. ### Returns Mass exponents. ### Return type numpy ndarray ``` -------------------------------- ### saveObject Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.DFA.html Saves the current state of the DFA object to a binary file. ```APIDOC ## saveObject() ### Description Save current object state to binary file. ### Parameters #### Parameters - **outFileName** (str) - Output binary file. .fathon extension will be appended to the file name. ``` -------------------------------- ### HT Class Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fathon.HT.rst.txt The HT class is the main interface for Hurst exponent calculations. It is initialized with aggregated time series data. ```APIDOC class HT: """The main class for Hurst exponent calculations.""" def __init__(self, aggregated_time_series): """Initializes the HT object. Args: aggregated_time_series (np.ndarray): The zero-mean cumulative sum of the time series. """ pass ``` -------------------------------- ### saveObject Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.DCCA.html Saves the current DCCA object state to a binary file. ```APIDOC ## saveObject() ### Description Save current object state to binary file. ### Parameters * **outFileName** (_str_) – Output binary file. .fathon extension will be appended to the file name. ``` -------------------------------- ### computeFlucVec Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.MFDCCA.html Computes the fluctuations in each window for each q-order. ```APIDOC ## MFDCCA.computeFlucVec(winSizes, qList, polOrd=1, revSeg=False) ### Description Computation of the fluctuations in each window for each q-order. ### Parameters * **winSizes** (numpy ndarray) – Array of window’s sizes. * **qList** (float or iterable or numpy ndarray) – List of q-orders used to compute F. * **polOrd** (int, optional) – Order of the polynomial to be fitted in each window (default : 1). * **revSeg** (bool, optional) – If True, the computation of F is repeated starting from the end of the time series (default : False). ### Returns * numpy ndarray – Array n of window’s sizes. * numpy ndarray – qxn array F containing the values of the fluctuations in each window for each q-order. ``` -------------------------------- ### computeFlucVec Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.MFDFA.html Computes the fluctuations in each window for each q-order. ```APIDOC ## computeFlucVec(winSizes, qList, polOrd=1, revSeg=False) ### Description Computation of the fluctuations in each window for each q-order. ### Parameters * **winSizes** (numpy ndarray) - Array of window’s sizes. * **qList** (float or iterable or numpy ndarray) - List of q-orders used to compute F. * **polOrd** (int, optional) - Order of the polynomial to be fitted in each window (default : 1). * **revSeg** (bool, optional) - If True, the computation of F is repeated starting from the end of the time series (default : False). ### Returns * numpy ndarray - Array n of window’s sizes. * numpy ndarray - qxn array F containing the values of the fluctuations in each window for each q-order. ``` -------------------------------- ### saveObject Method Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fathon.HT.rst.txt Saves the current HT object to a file. ```APIDOC def saveObject(self, filename): """Saves the HT object to a file. Args: filename (str): The name of the file to save the object to. """ pass ``` -------------------------------- ### fitFlucVec Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.DFA.html Fits the fluctuations values to determine the Hurst exponent. ```APIDOC ## fitFlucVec() ### Description Fit of the fluctuations values. ### Parameters #### Parameters - **nStart** (int, optional) - Size of the smaller window used to fit F (default : first value of n). - **nEnd** (int, optional) - Size of the bigger window used to fit F (default : last value of n). - **logBase** (float, optional) - Base of the logarithm for the log-log fit of n vs F (default : e). - **verbose** (bool, optional) - Verbosity (default : False). ### Returns - **float** - Slope of the fit. - **float** - Intercept of the fit. ``` -------------------------------- ### fitFlucVec Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.MFDFA.html Fits the fluctuations values to determine scaling exponents. ```APIDOC ## fitFlucVec(nStart=-999, nEnd=-999, logBase=2.718281828459045, verbose=False) ### Description Fit of the fluctuations values. ### Parameters * **nStart** (int, optional) - Size of the smaller window used to fit F at each q-order (default : first value of n). * **nEnd** (int, optional) - Size of the bigger window used to fit F at each q-order (default : last value of n). * **logBase** (float, optional) - Base of the logarithm for the log-log fit of n vs F (default : e). * **verbose** (bool, optional) - Verbosity (default : False). ### Returns * numpy ndarray - Slope of the fit for each q-order. * numpy ndarray - Intercept of the fit for each q-order. ``` -------------------------------- ### fitFlucVec Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.MFDCCA.html Fits the fluctuations values to determine scaling exponents. ```APIDOC ## MFDCCA.fitFlucVec(nStart=-999, nEnd=-999, logBase=2.718281828459045, verbose=False) ### Description Fit of the fluctuations values. ### Parameters * **nStart** (int, optional) – Size of the smaller window used to fit F at each q-order (default : first value of n). * **nEnd** (int, optional) – Size of the bigger window used to fit F at each q-order (default : last value of n). * **logBase** (float, optional) – Base of the logarithm for the log-log fit of n vs F (default : e). * **verbose** (bool, optional) – Verbosity (default : False). ### Returns * numpy ndarray – Slope of the fit for each q-order. * numpy ndarray – Intercept of the fit for each q-order. ``` -------------------------------- ### computeMassExponents Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.MFDFA.html Computes the mass exponents from the MFDFA results. ```APIDOC ## computeMassExponents() ### Description Computation of the mass exponents. ### Returns * numpy ndarray - Mass exponents. ``` -------------------------------- ### DFA Class Methods Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fathon.DFA.rst.txt This section details the methods available within the DFA class for performing Detrended Fluctuation Analysis. ```APIDOC ## DFA Class ### Description Provides methods for performing Detrended Fluctuation Analysis (DFA) on time series data. ### Methods #### computeFlucVec ##### Description Computes the fluctuation function and related parameters for DFA. ##### Parameters - **wins** (list or array): A list or array of window sizes to use for the analysis. - **revSeg** (bool, optional): Whether to use the fully generalized DFA method. Defaults to False. - **polOrd** (int, optional): The order of the polynomial used for detrending. Defaults to 1. #### fitFlucVec ##### Description Fits a line to the fluctuation function data to estimate the Hurst exponent. ##### Parameters None ##### Returns - **H** (float): The estimated Hurst exponent. - **H_intercept** (float): The intercept of the fitted line. #### multiFitFlucVec ##### Description Computes the Hurst exponent for multiple specified ranges within the fluctuation function data. ##### Parameters - **limits_list** (array): A 2D array where each row specifies a range [min_window, max_window] for fitting. ##### Returns - **list_H** (list): A list of Hurst exponents, one for each specified range. - **list_H_intercept** (list): A list of intercepts, one for each specified range. #### saveObject ##### Description Saves the current DFA object to a file. ##### Parameters - **filename** (str): The name of the file to save the object to. ``` -------------------------------- ### multiFitFlucVec Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.DFA.html Fits the fluctuations values in different intervals simultaneously. ```APIDOC ## multiFitFlucVec() ### Description Fit of the fluctuations values in different intervals at the same time. ### Parameters #### Parameters - **limitsList** (numpy ndarray) - kx2 array with the sizes of k starting and ending windows used to fit F. - **logBase** (float, optional) - Base of the logarithm for the log-log fit of n vs F (default : e). - **verbose** (bool, optional) - Verbosity (default : False). ### Returns - **numpy ndarray** - Slopes of the fits. - **numpy ndarray** - Intercepts of the fits. ``` -------------------------------- ### computeHt Method Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fathon.HT.rst.txt Computes the time-dependent Hurst exponent for the given time series data using specified parameters. ```APIDOC def computeHt(self, window_sizes, mfdfaPolOrd=1, polOrd=1): """Computes the time-dependent Hurst exponent. Args: window_sizes (list[int]): A list of window sizes to use for the computation. mfdfaPolOrd (int): The order of the polynomial for Multifractal Detrended Fluctuation Analysis. polOrd (int): The order of the polynomial for Detrended Fluctuation Analysis. Returns: np.ndarray: An array containing the computed Hurst exponent values for each window size. """ pass ``` -------------------------------- ### computeMultifractalSpectrum Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.MFDCCA.html Computes the multifractal spectrum. ```APIDOC ## MFDCCA.computeMultifractalSpectrum() ### Description Computation of the multifractal spectrum. ### Returns * numpy ndarray – Singularity strengths. * numpy ndarray – Multifractal spectrum. ``` -------------------------------- ### computeMultifractalSpectrum Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.MFDFA.html Computes the multifractal spectrum. ```APIDOC ## computeMultifractalSpectrum() ### Description Computation of the multifractal spectrum. ### Returns * numpy ndarray - Singularity strengths. * numpy ndarray - Multifractal spectrum. ``` -------------------------------- ### computeRho Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.DCCA.html Computes the cross-correlation index in each window for DCCA. ```APIDOC ## computeRho() ### Description Computation of the cross-correlation index in each window. ### Parameters * **winSizes** (_numpy ndarray_) – Array of window’s sizes. * **polOrd** (_int_, optional) – Order of the polynomial to be fitted in each window (default : 1). * **verbose** (_bool_, optional) – Verbosity (default : False). * **overlap** (_bool_, optional) – If True, computes F using overlapping segments (default : False). * **revSeg** (_bool_, optional) – If True, the computation of F is repeated starting from the end of the time series, ignored if overlap is True (default : False). ### Returns * _numpy ndarray_ – Array of window’s sizes. * _numpy ndarray_ – Array containing the cross-correlation index. ``` -------------------------------- ### powRangeByCount Source: https://fathon.readthedocs.io/en/latest/fun_class/fu/fathonUtils.powRangeByCount.html Generates an array of elements given by base raised to linearly separated exponents. ```APIDOC ## powRangeByCount ### Description Array of elements given by base raised to linearly separated exponents. ### Method `powRangeByCount(_start_ , _end_ , _count =-1_, _base =2_)` ### Parameters #### Path Parameters - **start** (int) - Required - Smallest element. - **end** (int) - Required - Biggest element. - **count** (int) - Optional - Number of elements (default : end - start + 1). - **base** (int) - Optional - Base of the exponential (default : 2). ### Response #### Success Response - **return** (numpy ndarray) - Array of elements given by base raised to linearly separated exponents. ### Request Example ```python from fathon import fathonUtils as fu #elements given by `base` raised to linearly separated exponents a = fu.powRangeByCount(10, 1000, base=3, count=42) ``` ``` -------------------------------- ### MFDCCA Class Methods Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fathon.MFDCCA.rst.txt The MFDCCA class provides several methods for performing multifractal detrended cross-correlation analysis. These include computing fluctuation vectors, mass exponents, multifractal spectra, fitting fluctuation vectors, and saving the object. ```APIDOC ## computeFlucVec ### Description Computes the fluctuation vector for the given time series and parameters. ### Method Signature `computeFlucVec(self, wins, q, revSeg=False, polOrd=1, fitType='poly')` ### Parameters - **wins** (list or np.array) - List of window sizes. - **q** (list or np.array) - List of q-orders. - **revSeg** (bool, optional) - Whether to consider reversed segments. Defaults to False. - **polOrd** (int, optional) - Order of the polynomial for detrending. Defaults to 1. - **fitType** (str, optional) - Type of fit to use. Defaults to 'poly'. ### Returns - **n** (np.array) - Array of window sizes. - **F** (np.array) - Fluctuation function values. ## computeMassExponents ### Description Computes the mass exponents (tau) from the fluctuation function. ### Method Signature `computeMassExponents(self)` ### Returns - **tau** (np.array) - Array of mass exponents. ## computeMultifractalSpectrum ### Description Computes the multifractal spectrum (alpha and mfSpect) from the mass exponents. ### Method Signature `computeMultifractalSpectrum(self)` ### Returns - **alpha** (np.array) - Array of singularity spectrum values. - **mfSpect** (np.array) - Array of multifractal spectrum values. ## fitFlucVec ### Description Fits the fluctuation vector to determine generalized Hurst exponents and their intercepts. ### Method Signature `fitFlucVec(self)` ### Returns - **list_H** (list) - List of generalized Hurst exponents. - **list_H_intercept** (list) - List of intercepts from the fit. ## saveObject ### Description Saves the current MFDCCA object to a file. ### Method Signature `saveObject(self, filename)` ### Parameters - **filename** (str) - The name of the file to save the object to. ``` -------------------------------- ### getObjectMember Source: https://fathon.readthedocs.io/en/latest/fun_class/fu/fathonUtils.getObjectMember.html Retrieves a specified member from a .fathon file. The member's name corresponds to its original object member name. The 'isComputed' status is not practically usable or retrievable. ```APIDOC ## getObjectMember ### Description Return member of a previously saved object. Member’s name is the same of the object’s member it refers to. Member isComputed has no practical use and cannot be retrieved. ### Method `getObjectMember(_fileName_, _memberName_) ### Parameters #### Path Parameters - **fileName** (str) - Required - Path to a previously saved .fathon file. - **memberName** (str) - Required - Desired member’s name. ### Response #### Success Response - **Object’s member** (numpy ndarray) - The retrieved member from the .fathon file. ``` -------------------------------- ### fitFlucVec Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.DCCA.html Fits the fluctuations values obtained from DCCA. ```APIDOC ## fitFlucVec() ### Description Fit of the fluctuations values. ### Parameters * **nStart** (_int_, optional) – Size of the smaller window used to fit F (default : first value of n). * **nEnd** (_int_, optional) – Size of the bigger window used to fit F (default : last value of n). * **logBase** (_float_, optional) – Base of the logarithm for the log-log fit of n vs F (default : e). * **verbose** (_bool_, optional) – Verbosity (default : False). ### Returns * _float_ – Slope of the fit. * _float_ – Intercept of the fit. ``` -------------------------------- ### DCCA Class Methods Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fathon.DCCA.rst.txt This section details the methods available within the DCCA class for performing Detrended Cross-Correlation Analysis. ```APIDOC ## computeFlucVec ### Description Computes the fluctuation function and related values for DCCA. ### Method `computeFlucVec(self, wins, polOrd=1)` ### Parameters - **wins** (list or numpy.ndarray) - A list or array of window sizes to use for the analysis. - **polOrd** (int, optional) - The order of the polynomial used for detrending. Defaults to 1. ### Returns - **n** (numpy.ndarray) - The window sizes used. - **F** (numpy.ndarray) - The computed fluctuation function values. ## computeRho ### Description Computes the rho index for DCCA. ### Method `computeRho(self, wins, polOrd=1)` ### Parameters - **wins** (list or numpy.ndarray) - A list or array of window sizes to use for the analysis. - **polOrd** (int, optional) - The order of the polynomial used for detrending. Defaults to 1. ### Returns - **n** (numpy.ndarray) - The window sizes used. - **rho** (numpy.ndarray) - The computed rho index values. ## fitFlucVec ### Description Fits a line to the fluctuation function to estimate the Hurst exponent. ### Method `fitFlucVec(self)` ### Returns - **H** (float) - The estimated Hurst exponent. - **H_intercept** (float) - The intercept of the fitted line. ## multiFitFlucVec ### Description Fits lines to the fluctuation function in multiple specified ranges to estimate Hurst exponents. ### Method `multiFitFlucVec(self, limits_list)` ### Parameters - **limits_list** (numpy.ndarray) - A 2D array where each row specifies the start and end of a range for fitting. ### Returns - **list_H** (list) - A list of estimated Hurst exponents for each range. - **list_H_intercept** (list) - A list of intercepts for the fitted lines in each range. ## rhoThresholds ### Description Computes confidence intervals for the rho index. ### Method `rhoThresholds(self, n_steps, wins, n_realizations, alpha, polOrd=1)` ### Parameters - **n_steps** (int) - The number of steps for generating surrogate data. - **wins** (list or numpy.ndarray) - A list or array of window sizes to use for the analysis. - **n_realizations** (int) - The number of surrogate data realizations to generate. - **alpha** (float) - The significance level for the confidence intervals. - **polOrd** (int, optional) - The order of the polynomial used for detrending. Defaults to 1. ### Returns - **n** (numpy.ndarray) - The window sizes used. - **cInt1** (numpy.ndarray) - The lower confidence interval for the rho index. - **cInt2** (numpy.ndarray) - The upper confidence interval for the rho index. ## saveObject ### Description Saves the DCCA object to a file. ### Method `saveObject(self, filename)` ### Parameters - **filename** (str) - The name of the file to save the object to. ``` -------------------------------- ### computeFlucVec Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.DFA.html Computes the fluctuations in each window of the time series. ```APIDOC ## computeFlucVec() ### Description Computation of the fluctuations in each window. ### Parameters #### Parameters - **winSizes** (numpy ndarray) - Array of window’s sizes. - **polOrd** (int, optional) - Order of the polynomial to be fitted in each window (default : 1). - **revSeg** (bool, optional) - If True, the computation of F is repeated starting from the end of the time series (default : False). - **unbiased** (bool, optional) - If True, the unbiased version of DFA is computed, and revSeg is ignored. To be used on short time series (default : False). ### Returns - **numpy ndarray** - Array n of window’s sizes. - **numpy ndarray** - Array F containing the values of the fluctuations in each window. ``` -------------------------------- ### Subtract Mean from Time Series Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fu/fathonUtils.subtractMean.rst.txt Use this function to transform a time series into a zero-mean series. Ensure numpy and fathonUtils are imported. ```python import numpy as np from fathon import fathonUtils as fu #time series a = np.random.randn(10000) #zero-mean time series a = fu.subtractMean(a) ``` -------------------------------- ### subtractMean Source: https://fathon.readthedocs.io/en/latest/fun_class/fu/fathonUtils.subtractMean.html Subtracts the mean of a vector (iterable). ```APIDOC ## subtractMean() ### Description Subtracts mean of a vector. ### Parameters #### Path Parameters - **vec** (iterable) - Required - Python iterable whose mean will be subtracted. ### Returns - **vec with its mean subtracted** (numpy ndarray) - Description of the return value. ### Request Example ```python import numpy as np from fathon import fathonUtils as fu #time series a = np.random.randn(10000) #zero-mean time series a = fu.subtractMean(a) ``` ``` -------------------------------- ### rhoThresholds Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.DCCA.html Computes the confidence levels for the cross-correlation index in each window for DCCA. ```APIDOC ## rhoThresholds() ### Description Computation of the cross-correlation index’s confidence levels in each window. ### Parameters * **L** (_int_) – Size of the random time series used to evaluate confidence levels. * **winSizes** (_numpy ndarray_) – Array of window’s sizes. * **nSim** (_int_) – Number of times the cross-correlation index between two random time series is computed in order to evaluate the confidence levels. * **confLvl** (_float_) – Confidence level. * **polOrd** (_int_, optional) – Order of the polynomial to be fitted in each window (default : 1). * **verbose** (_bool_, optional) – Verbosity (default : False). ### Returns * _numpy ndarray_ – Array of window’s sizes. * _numpy ndarray_ – Array containing the first confidence interval. * _numpy ndarray_ – Array containing the second confidence interval. ``` -------------------------------- ### getObjectMember Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fu/fathonUtils.getObjectMember.rst.txt Retrieves a member from an object. ```APIDOC ## getObjectMember ### Description Retrieves a member from an object. ### Signature `getObjectMember(obj, name)` ### Parameters * **obj** (object) - The object from which to retrieve the member. * **name** (string) - The name of the member to retrieve. ### Returns * The member of the object if found, otherwise None. ``` -------------------------------- ### subtractMean Function Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fu/fathonUtils.subtractMean.rst.txt The subtractMean function takes a NumPy array representing a time series and returns a new array with the mean subtracted, effectively making the series zero-mean. ```APIDOC ## subtractMean ### Description Subtracts the mean from a time series. ### Usage ```python import numpy as np from fathon import fathonUtils as fu # time series a = np.random.randn(10000) # zero-mean time series a = fu.subtractMean(a) ``` ### Parameters This function does not explicitly list parameters in the provided documentation, but it is used with a NumPy array as input. ``` -------------------------------- ### toAggregated Function Source: https://fathon.readthedocs.io/en/latest/_sources/fun_class/fu/fathonUtils.toAggregated.rst.txt The toAggregated function transforms a numerical array into its zero-mean cumulative sum. This is often used in time series analysis to create a stationary representation of the data. ```APIDOC ## toAggregated ### Description Computes the zero-mean cumulative sum of a time series. ### Parameters This function does not explicitly list parameters in the provided documentation, but it is expected to take a numerical array as input. ### Usage Example ```python import numpy as np from fathon import fathonUtils as fu # time series a = np.random.randn(10000) # zero-mean cumulative sum a = fu.toAggregated(a) ``` ### Returns The function returns the zero-mean cumulative sum of the input array. ``` -------------------------------- ### toAggregated Source: https://fathon.readthedocs.io/en/latest/fun_class/fu/fathonUtils.toAggregated.html Subtracts the mean of a vector and computes the cumulative sum. This function is useful for time series analysis where a zero-mean cumulative sum is required. ```APIDOC ## toAggregated() ### Description Subtracts mean of a vector and computes the cumulative sum. ### Parameters #### Path Parameters - **vec** (iterable) - The vector to be integrated. ### Returns Cumulative sum of vec after subtraction of its mean. ### Return Type numpy ndarray ### Usage Example ```python import numpy as np from fathon import fathonUtils as fu # time series a = np.random.randn(10000) # zero-mean cumulative sum a = fu.toAggregated(a) ``` ``` -------------------------------- ### MFDCCA Class Source: https://fathon.readthedocs.io/en/latest/fun_class/fathon.MFDCCA.html The MFDCCA class is used for MultiFractal Detrended Cross-Correlation Analysis. It takes two time series as input. ```APIDOC ## class fathon.MFDCCA(tsVec1, tsVec2=[]) ### Description MultiFractal Detrended Cross-Correlation Analysis class. ### Parameters * **tsVec1** (iterable) – First time series used for the analysis. * **tsVec2** (iterable) – Second time series used for the analysis. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.