Exemplo n.º 1
0
# Complete path to file
current_dir = os.path.dirname(os.path.abspath(__file__))
data_file = os.path.join(current_dir, data_file)

data = get_data_from_mat_file(data_file)

signal_1 = data[:2**12]
signal_2 = data[2**12:]


#-------------------------------------------------------------------------------
# Setup analysis
#-------------------------------------------------------------------------------

# Multifractal analysis object
mfa = mf.MFA()

### Set parameters. They can also be set in the constructor of mf.MFA()

# wavelet to be used (see PyWavelets documentation for more options)
mfa.wt_name = 'db3'

# value of p for p-leaders, can be numpy.inf
# NOTE: instead of defining the value of p, we can set the variable mfa.formalism,
#       e.g., mfa.formalism = 'wlmf' (corresponding to p = np.inf) or
#             mfa.formalism = 'wcmf' (which uses wavelet coefficients only, not leaders)
mfa.p = 2

# scaling range
mfa.j1 = 3
mfa.j2 = 9
Exemplo n.º 2
0
# ------------------------------------------------------------------------------
# Run mf_analysis
# ------------------------------------------------------------------------------
for test_filename in test_data_files_full:

    print(" ")
    print("* Analyzing file ", test_filename)

    # Load data
    data = get_data_from_mat_file(test_filename)

    # Get output filename
    output_filename = out_filenames[test_filename]

    # Run mf_analysis and save results
    mfa = mfanalysis.MFA(verbose=0)
    with open(output_filename, 'a') as csvfile:
        writer = csv.writer(csvfile, lineterminator='\n')
        for test_index in params:  # test_index is a string, e.g. '123', and starts from '1'

            if int(test_index) % 10 == 0:
                print(" -- Test " + test_index, " of ", n_tests)

            # Set parameters in MFA object
            mfa.q = np.array(params[test_index]['q'])
            mfa.j1 = params[test_index]['j1']
            mfa.j2 = params[test_index]['j2']
            mfa.wtype = params[test_index]['wtype']
            mfa.gamint = params[test_index]['gamint']
            mfa.wt_name = 'db' + str(
                params[test_index]['nb_vanishing_moments'])