Using the logger

EMD has a built in logger which can be tuned to print out the progress of an analysis to the console, to a file or both.

Logger Basics

The logger must be initialised by calling emd.logger.set_up. All subsequent calls to functions in the EMD library will then print output messages according to the logger specification.

# sphinx_gallery_thumbnail_path = '_static/emd_logger_thumb.png'

# Import numpy for later
import numpy as np

# Import EMD and initialise the logger
import emd
emd.logger.set_up()

Out:

EMD Logger Started

The detail of logger output can be tuned by changing the logger level. The available levels are CRITICAL (only print output when the program is about to crash), WARNING (only print output when something unusual is happening or an analysis is potentially wrong), INFO (print general statements about which processes are running) and DEBUG (print loads of info including details of computations).

The default level is INFO, so if we re-initialise the logger on DEBUG we get more detailed outputs

emd.logger.set_up(level='DEBUG')

Out:

EMD Logger Started
EMD logger: handler 'console' level set to 'DEBUG'
EMD v0.4.0 installed in /home/docs/checkouts/readthedocs.org/user_builds/emd/envs/v0.4.0/lib/python3.7/site-packages/emd-0.4.0-py3.7.egg/emd

Lets explore the logger by running some a few sifts. Here we create a simple simulated oscillation and run a standard sift with default options.

# Initialise the logger with default settings (level=INFO)
emd.logger.set_up()

# Generate a simulation
peak_freq = 12
sample_rate = 512
seconds = 10
noise_std = .5
x = emd.utils.ar_simulate(peak_freq, sample_rate, seconds, noise_std=noise_std, random_seed=42, r=.99)

# Run a standard sift
imf = emd.sift.sift(x)

Out:

EMD Logger Started
STARTED: sift
COMPLETED: sift

With the level on INFO the logger tells us that the sift is running but not much else. If we change the logger level to DEBUG we get more output about how the sift is performing.

The level of an initialised logger can be changed using emd.logger.set_level.

emd.logger.set_level('DEBUG')

# Run a standard sift
imf = emd.sift.sift(x)

Out:

EMD logger: handler 'console' level set to 'DEBUG'
STARTED: sift
Input data size: 5120
Input Sift Args: {}
Sift stopped by SD-thresh in 2 iters with sd 0.05909694676957796
Sift stopped by SD-thresh in 5 iters with sd 0.09414814053299374
Sift stopped by SD-thresh in 1 iters with sd 0.08042857700303212
Sift stopped by SD-thresh in 2 iters with sd 0.02407211284743216
Sift stopped by SD-thresh in 2 iters with sd 0.01516914536966586
Sift stopped by SD-thresh in 2 iters with sd 0.015651548522628466
Sift stopped by SD-thresh in 2 iters with sd 0.010076361853823552
Finishing sift: IMF has no extrema
Returning 8 imfs
COMPLETED: sift

If we don’t want to change the logger level for our whole script, some functions allow us to override the logger level for a single call to the function.

Any functions with the verbose option in ‘Other Parameters’ can override the logger level. Here we run a sift on WARNING and should see no outputs.

imf = emd.sift.sift(x, verbose='WARNING')

We can also disable the logger altogether for a section of code using emd.logger.disable and then restart it using emd.logger.enable.

Here we disable logging for a sift call and renable it afterwards.

emd.logger.disable()
imf = emd.sift.sift(x)
emd.logger.enable()

Out:

EMD logging disabled
EMD logging enabled

Advanced Logging

This section contains some logger optionality for more advanced use cases.

Firstly, we can supplement the EMD logger output from a script by loading the EMD logger into a script and adding our own logger calls. In this example, we load the logger and add some custom updates. To print some output at the INFO level through the logger, we call logger.info.

# Initialised EMD logger
emd.logger.set_up(level='DEBUG')

# Load logger into this script
import logging
logger = logging.getLogger('emd')

# Check the time
import time
tic = time.perf_counter()

# Run a sift
logger.info('Now starting my new analysis')
imf = emd.sift.sift(x)

# Check time again
toc = time.perf_counter()

# Print sift run-time
elapsed = toc - tic
logger.info('My new analysis finished in {0:4f} seconds'.format(elapsed))

Out:

EMD Logger Started
EMD logger: handler 'console' level set to 'DEBUG'
EMD v0.4.0 installed in /home/docs/checkouts/readthedocs.org/user_builds/emd/envs/v0.4.0/lib/python3.7/site-packages/emd-0.4.0-py3.7.egg/emd
Now starting my new analysis
STARTED: sift
Input data size: 5120
Input Sift Args: {}
Sift stopped by SD-thresh in 2 iters with sd 0.05909694676957796
Sift stopped by SD-thresh in 5 iters with sd 0.09414814053299374
Sift stopped by SD-thresh in 1 iters with sd 0.08042857700303212
Sift stopped by SD-thresh in 2 iters with sd 0.02407211284743216
Sift stopped by SD-thresh in 2 iters with sd 0.01516914536966586
Sift stopped by SD-thresh in 2 iters with sd 0.015651548522628466
Sift stopped by SD-thresh in 2 iters with sd 0.010076361853823552
Finishing sift: IMF has no extrema
Returning 8 imfs
COMPLETED: sift
My new analysis finished in 0.034038 seconds

This output respects the overall logger level, so info statements will be printed at levels INFO and DEBUG but suppressed if the overall logger level is at WARNING or CRITICAL.

Try changing the logger level in the example above to see the effect on the following output.

Next, we define an analysis function which runs a sift followed by a frequency transform and simple cycle analysis. We’ll run this example a few times in the next sections.

Note that we’ve included some custom logger calls and a temporary logger override on the mask_sift

def my_analysis(x):

    # Check time, and load the logger into the session
    tic = time.perf_counter()
    import logging
    logger = logging.getLogger('emd')

    # Print start-up message
    logger.info('Starting my example analysis')
    logger.info('----------------------------')

    # Run a mask-sift with detailed logging
    imf = emd.sift.mask_sift(x, verbose='DEBUG')

    # Compute frequency stats
    IP, IF, IA = emd.spectra.frequency_transform(imf, sample_rate, 'nht')
    logger.info('Avg frequency of IMF-2 is {0:2f}Hz'.format(np.average(IF[:, 2], weights=IA[:, 2])))

    # Find cycles in IMF-2
    mask = IA[:, 2] > .05
    cycles = emd.cycles.get_cycle_inds(IP, return_good=True, mask=mask)

    # Compute cycle stats
    cycle_freq = emd.cycles.get_cycle_stat(cycles[:, 2], IF[:, 2], func=np.mean)[1:]
    cycle_amp = emd.cycles.get_cycle_stat(cycles[:, 2], IA[:, 2], func=np.mean)[1:]

    # Print some cycle correlations
    logger.info('Freq-Amp correlation: r={0:2f}'.format(np.corrcoef(cycle_freq, cycle_amp)[0, 1]))

    # Print the elapsed time of the analysis
    toc = time.perf_counter()
    elapsed = toc - tic
    logger.info('My new analysis finished in {0:4f} seconds'.format(elapsed))

    return cycle_freq, cycle_amp

We can run this function as normal and inspect the logger outputs as they appear in the console.

# Run the analysis
freq, amp = my_analysis(x)

Out:

 Starting my example analysis
 ----------------------------
 EMD logger: handler 'console' level set to 'DEBUG'
 STARTED: mask_sift
 Input data size: 5120
 Input Sift Args: {'verbose': 'DEBUG'}
 Computing first mask frequency with method zc
 Getting first IMF with no mask
 Sift stopped by SD-thresh in 2 iters with sd 0.05909694676957796
 Found first mask frequency of 0.169775390625
 Sifting IMF-0
 Defining masks with freq 0.169775390625 and amp 8236.609552003994 at 4 phases
 Sifting IMF-1
 Defining masks with freq 0.0848876953125 and amp 3520.7794577158106 at 4 phases
 Sifting IMF-2
 Defining masks with freq 0.04244384765625 and amp 1357.5346330804737 at 4 phases
 Sifting IMF-3
 Defining masks with freq 0.021221923828125 and amp 7408.805910889346 at 4 phases
 Sifting IMF-4
 Defining masks with freq 0.0106109619140625 and amp 352.6411741982858 at 4 phases
 Sifting IMF-5
 Defining masks with freq 0.00530548095703125 and amp 448.4150517882588 at 4 phases
 Sifting IMF-6
 Defining masks with freq 0.002652740478515625 and amp 274.23109136128 at 4 phases
 Sifting IMF-7
 Defining masks with freq 0.0013263702392578125 and amp 320.50849470193697 at 4 phases
 Sifting IMF-8
 Defining masks with freq 0.0006631851196289062 and amp 79.30762150733322 at 4 phases
 Finishing sift: reached max number of imfs (9)
 Returning 9 imfs
 COMPLETED: mask_sift
 EMD logger: handler 'console' level set to 'DEBUG'
 STARTED: compute frequency stats
 computing on 5120 samples over 9 imfs at sample rate 512
 Using Amplitude-Normalised Hilbert transform
 STARTED: Amplitude-Normalise
 Normalising 5120 samples across 9 IMFs
 Using pchip interpolation with threshold of 1e-10 and max_iters 3
 Normalise of IMF-0-0 complete in 3 iters (val=0.0)
 Normalise of IMF-1-0 complete in 3 iters (val=0.0)
 Normalise of IMF-2-0 complete in 3 iters (val=0.0)
 Normalise of IMF-3-0 complete in 3 iters (val=0.0)
 Normalise of IMF-4-0 complete in 3 iters (val=0.0)
 Normalise of IMF-5-0 complete in 3 iters (val=0.0)
 Normalise of IMF-6-0 complete in 3 iters (val=0.0)
 Normalise of IMF-7-0 complete in 2 iters (val=0.0)
 Normalise of IMF-8-0 complete in 2 iters (val=0.0)
 COMPLETED: Amplitude-Normalise
 COMPLETED: compute frequency stats. Returning 9 imfs
 Avg frequency of IMF-2 is 12.081890Hz
/home/docs/checkouts/readthedocs.org/user_builds/emd/envs/v0.4.0/lib/python3.7/site-packages/emd-0.4.0-py3.7.egg/emd/cycles.py:64: UserWarning: WARNING: 'emd.cycles.get_cycle_inds' is deprecated and will be removed in a future version of EMD. Please change to use 'emd.cycles.get_cycle_vector' to remove this warning and future-proof your code
  warnings.warn(msg)
 WARNING: 'emd.cycles.get_cycle_inds' is deprecated and will be removed in a future version of EMD. Please change to use 'emd.cycles.get_cycle_vector' to remove this warning and future-proof your code
 STARTED: get cycle indices
 Checking get_cycle_vector inputs - Adding dummy dimension to input 'mask'
 computing on 5120 samples over 9 IMFs
 5106 (99.73%) samples masked out
 found 3 cycles in IMF-0
 found 61 cycles in IMF-1
 found 115 cycles in IMF-2
 found 56 cycles in IMF-3
 found 40 cycles in IMF-4
 found 15 cycles in IMF-5
 found 6 cycles in IMF-6
 found 2 cycles in IMF-7
 found -1 cycles in IMF-8
 COMPLETED: get cycle indices
 STARTED: get_cycle_stat
 STARTED: get_cycle_stat
 Freq-Amp correlation: r=-0.338789
 My new analysis finished in 1.124753 seconds

We can see a lot of information about which processes were running as the logger is set to INFO. If we configure the logger to run on WARNING level, we should only see output about potential errors. This can be useful when running familiar code where you only need output when something potentially strange is going on.

So in this case, after changing to WARNING we should only see output from the mask_sift call (as this has a logger override to DEBUG). All other output is suppressed.

# Change logger level
emd.logger.set_level('WARNING')

# Run the analysis
freq, amp = my_analysis(x)

Out:

 STARTED: mask_sift
 Input data size: 5120
 Input Sift Args: {'verbose': 'DEBUG'}
 Computing first mask frequency with method zc
 Getting first IMF with no mask
 Sift stopped by SD-thresh in 2 iters with sd 0.05909694676957796
 Found first mask frequency of 0.169775390625
 Sifting IMF-0
 Defining masks with freq 0.169775390625 and amp 8236.609552003994 at 4 phases
 Sifting IMF-1
 Defining masks with freq 0.0848876953125 and amp 3520.7794577158106 at 4 phases
 Sifting IMF-2
 Defining masks with freq 0.04244384765625 and amp 1357.5346330804737 at 4 phases
 Sifting IMF-3
 Defining masks with freq 0.021221923828125 and amp 7408.805910889346 at 4 phases
 Sifting IMF-4
 Defining masks with freq 0.0106109619140625 and amp 352.6411741982858 at 4 phases
 Sifting IMF-5
 Defining masks with freq 0.00530548095703125 and amp 448.4150517882588 at 4 phases
 Sifting IMF-6
 Defining masks with freq 0.002652740478515625 and amp 274.23109136128 at 4 phases
 Sifting IMF-7
 Defining masks with freq 0.0013263702392578125 and amp 320.50849470193697 at 4 phases
 Sifting IMF-8
 Defining masks with freq 0.0006631851196289062 and amp 79.30762150733322 at 4 phases
 Finishing sift: reached max number of imfs (9)
 Returning 9 imfs
 COMPLETED: mask_sift
/home/docs/checkouts/readthedocs.org/user_builds/emd/envs/v0.4.0/lib/python3.7/site-packages/emd-0.4.0-py3.7.egg/emd/cycles.py:64: UserWarning: WARNING: 'emd.cycles.get_cycle_inds' is deprecated and will be removed in a future version of EMD. Please change to use 'emd.cycles.get_cycle_vector' to remove this warning and future-proof your code
  warnings.warn(msg)
 WARNING: 'emd.cycles.get_cycle_inds' is deprecated and will be removed in a future version of EMD. Please change to use 'emd.cycles.get_cycle_vector' to remove this warning and future-proof your code

If we’re dealing with logger output from multiple sources or perhaps from multiple analyses running in parallel, then we can add a prefix to the logger to help distinguish the output coming from each. This can be specified when initialising the logger.

For example, here we reun the analysis function with a logger prefix indicating that we’re processing Subject 001.

# Initialise logger with a prefix
emd.logger.set_up(level='DEBUG', prefix='Subj001')

# Run the analysis
freq, amp = my_analysis(x)

Out:

Subj001 EMD Logger Started
Subj001 EMD logger: handler 'console' level set to 'DEBUG'
Subj001 EMD v0.4.0 installed in /home/docs/checkouts/readthedocs.org/user_builds/emd/envs/v0.4.0/lib/python3.7/site-packages/emd-0.4.0-py3.7.egg/emd
Subj001 Starting my example analysis
Subj001 ----------------------------
Subj001 EMD logger: handler 'console' level set to 'DEBUG'
Subj001 STARTED: mask_sift
Subj001 Input data size: 5120
Subj001 Input Sift Args: {'verbose': 'DEBUG'}
Subj001 Computing first mask frequency with method zc
Subj001 Getting first IMF with no mask
Subj001 Sift stopped by SD-thresh in 2 iters with sd 0.05909694676957796
Subj001 Found first mask frequency of 0.169775390625
Subj001 Sifting IMF-0
Subj001 Defining masks with freq 0.169775390625 and amp 8236.609552003994 at 4 phases
Subj001 Sifting IMF-1
Subj001 Defining masks with freq 0.0848876953125 and amp 3520.7794577158106 at 4 phases
Subj001 Sifting IMF-2
Subj001 Defining masks with freq 0.04244384765625 and amp 1357.5346330804737 at 4 phases
Subj001 Sifting IMF-3
Subj001 Defining masks with freq 0.021221923828125 and amp 7408.805910889346 at 4 phases
Subj001 Sifting IMF-4
Subj001 Defining masks with freq 0.0106109619140625 and amp 352.6411741982858 at 4 phases
Subj001 Sifting IMF-5
Subj001 Defining masks with freq 0.00530548095703125 and amp 448.4150517882588 at 4 phases
Subj001 Sifting IMF-6
Subj001 Defining masks with freq 0.002652740478515625 and amp 274.23109136128 at 4 phases
Subj001 Sifting IMF-7
Subj001 Defining masks with freq 0.0013263702392578125 and amp 320.50849470193697 at 4 phases
Subj001 Sifting IMF-8
Subj001 Defining masks with freq 0.0006631851196289062 and amp 79.30762150733322 at 4 phases
Subj001 Finishing sift: reached max number of imfs (9)
Subj001 Returning 9 imfs
Subj001 COMPLETED: mask_sift
Subj001 EMD logger: handler 'console' level set to 'DEBUG'
Subj001 STARTED: compute frequency stats
Subj001 computing on 5120 samples over 9 imfs at sample rate 512
Subj001 Using Amplitude-Normalised Hilbert transform
Subj001 STARTED: Amplitude-Normalise
Subj001 Normalising 5120 samples across 9 IMFs
Subj001 Using pchip interpolation with threshold of 1e-10 and max_iters 3
Subj001 Normalise of IMF-0-0 complete in 3 iters (val=0.0)
Subj001 Normalise of IMF-1-0 complete in 3 iters (val=0.0)
Subj001 Normalise of IMF-2-0 complete in 3 iters (val=0.0)
Subj001 Normalise of IMF-3-0 complete in 3 iters (val=0.0)
Subj001 Normalise of IMF-4-0 complete in 3 iters (val=0.0)
Subj001 Normalise of IMF-5-0 complete in 3 iters (val=0.0)
Subj001 Normalise of IMF-6-0 complete in 3 iters (val=0.0)
Subj001 Normalise of IMF-7-0 complete in 2 iters (val=0.0)
Subj001 Normalise of IMF-8-0 complete in 2 iters (val=0.0)
Subj001 COMPLETED: Amplitude-Normalise
Subj001 COMPLETED: compute frequency stats. Returning 9 imfs
Subj001 Avg frequency of IMF-2 is 12.081890Hz
/home/docs/checkouts/readthedocs.org/user_builds/emd/envs/v0.4.0/lib/python3.7/site-packages/emd-0.4.0-py3.7.egg/emd/cycles.py:64: UserWarning: WARNING: 'emd.cycles.get_cycle_inds' is deprecated and will be removed in a future version of EMD. Please change to use 'emd.cycles.get_cycle_vector' to remove this warning and future-proof your code
  warnings.warn(msg)
Subj001 WARNING: 'emd.cycles.get_cycle_inds' is deprecated and will be removed in a future version of EMD. Please change to use 'emd.cycles.get_cycle_vector' to remove this warning and future-proof your code
Subj001 STARTED: get cycle indices
Subj001 Checking get_cycle_vector inputs - Adding dummy dimension to input 'mask'
Subj001 computing on 5120 samples over 9 IMFs
Subj001 5106 (99.73%) samples masked out
Subj001 found 3 cycles in IMF-0
Subj001 found 61 cycles in IMF-1
Subj001 found 115 cycles in IMF-2
Subj001 found 56 cycles in IMF-3
Subj001 found 40 cycles in IMF-4
Subj001 found 15 cycles in IMF-5
Subj001 found 6 cycles in IMF-6
Subj001 found 2 cycles in IMF-7
Subj001 found -1 cycles in IMF-8
Subj001 COMPLETED: get cycle indices
Subj001 STARTED: get_cycle_stat
Subj001 STARTED: get_cycle_stat
Subj001 Freq-Amp correlation: r=-0.338789
Subj001 My new analysis finished in 1.123255 seconds

Finally, we can direct the logger output into a text file as well as the console.

# Define a temporary file
import tempfile
log_file = tempfile.NamedTemporaryFile(prefix="ExampleEMDLog", suffix='.log').name
# OR uncomment this line and define your own filepath
# log_file = /path/to/my/log_file.log

# Initialise the logger with a prefix and a text file
emd.logger.set_up(level='INFO', prefix='Subj001', log_file=log_file)

# Run the analysis
freq, amp = my_analysis(x)

Out:

Subj001 EMD Logger Started
Subj001 EMD logger: handler 'console' level set to 'INFO'
Subj001 logging to file: /tmp/ExampleEMDLog1oahpsv5.log
Subj001 Starting my example analysis
Subj001 ----------------------------
Subj001 EMD logger: handler 'console' level set to 'DEBUG'
Subj001 STARTED: mask_sift
Subj001 Input data size: 5120
Subj001 Input Sift Args: {'verbose': 'DEBUG'}
Subj001 Computing first mask frequency with method zc
Subj001 Getting first IMF with no mask
Subj001 Sift stopped by SD-thresh in 2 iters with sd 0.05909694676957796
Subj001 Found first mask frequency of 0.169775390625
Subj001 Sifting IMF-0
Subj001 Defining masks with freq 0.169775390625 and amp 8236.609552003994 at 4 phases
Subj001 Sifting IMF-1
Subj001 Defining masks with freq 0.0848876953125 and amp 3520.7794577158106 at 4 phases
Subj001 Sifting IMF-2
Subj001 Defining masks with freq 0.04244384765625 and amp 1357.5346330804737 at 4 phases
Subj001 Sifting IMF-3
Subj001 Defining masks with freq 0.021221923828125 and amp 7408.805910889346 at 4 phases
Subj001 Sifting IMF-4
Subj001 Defining masks with freq 0.0106109619140625 and amp 352.6411741982858 at 4 phases
Subj001 Sifting IMF-5
Subj001 Defining masks with freq 0.00530548095703125 and amp 448.4150517882588 at 4 phases
Subj001 Sifting IMF-6
Subj001 Defining masks with freq 0.002652740478515625 and amp 274.23109136128 at 4 phases
Subj001 Sifting IMF-7
Subj001 Defining masks with freq 0.0013263702392578125 and amp 320.50849470193697 at 4 phases
Subj001 Sifting IMF-8
Subj001 Defining masks with freq 0.0006631851196289062 and amp 79.30762150733322 at 4 phases
Subj001 Finishing sift: reached max number of imfs (9)
Subj001 Returning 9 imfs
Subj001 COMPLETED: mask_sift
Subj001 EMD logger: handler 'console' level set to 'INFO'
Subj001 STARTED: compute frequency stats
Subj001 Using Amplitude-Normalised Hilbert transform
Subj001 STARTED: Amplitude-Normalise
Subj001 Normalise of IMF-0-0 complete in 3 iters (val=0.0)
Subj001 Normalise of IMF-1-0 complete in 3 iters (val=0.0)
Subj001 Normalise of IMF-2-0 complete in 3 iters (val=0.0)
Subj001 Normalise of IMF-3-0 complete in 3 iters (val=0.0)
Subj001 Normalise of IMF-4-0 complete in 3 iters (val=0.0)
Subj001 Normalise of IMF-5-0 complete in 3 iters (val=0.0)
Subj001 Normalise of IMF-6-0 complete in 3 iters (val=0.0)
Subj001 Normalise of IMF-7-0 complete in 2 iters (val=0.0)
Subj001 Normalise of IMF-8-0 complete in 2 iters (val=0.0)
Subj001 COMPLETED: Amplitude-Normalise
Subj001 COMPLETED: compute frequency stats. Returning 9 imfs
Subj001 Avg frequency of IMF-2 is 12.081890Hz
/home/docs/checkouts/readthedocs.org/user_builds/emd/envs/v0.4.0/lib/python3.7/site-packages/emd-0.4.0-py3.7.egg/emd/cycles.py:64: UserWarning: WARNING: 'emd.cycles.get_cycle_inds' is deprecated and will be removed in a future version of EMD. Please change to use 'emd.cycles.get_cycle_vector' to remove this warning and future-proof your code
  warnings.warn(msg)
Subj001 WARNING: 'emd.cycles.get_cycle_inds' is deprecated and will be removed in a future version of EMD. Please change to use 'emd.cycles.get_cycle_vector' to remove this warning and future-proof your code
Subj001 STARTED: get cycle indices
Subj001 found 3 cycles in IMF-0
Subj001 found 61 cycles in IMF-1
Subj001 found 115 cycles in IMF-2
Subj001 found 56 cycles in IMF-3
Subj001 found 40 cycles in IMF-4
Subj001 found 15 cycles in IMF-5
Subj001 found 6 cycles in IMF-6
Subj001 found 2 cycles in IMF-7
Subj001 found -1 cycles in IMF-8
Subj001 COMPLETED: get cycle indices
Subj001 STARTED: get_cycle_stat
Subj001 STARTED: get_cycle_stat
Subj001 Freq-Amp correlation: r=-0.338789
Subj001 My new analysis finished in 1.126331 seconds

The log file is a simple text file containing very detailed outputs of which functions were executed and when. Here we read the log file and print its contents to the console.

Note that the log file contains a much more detailed output that the console!

# Open the text file and print its contents
with open(log_file, 'r') as f:
    txt = f.read()
print(txt)

Out:

[2021-03-30 17:43:45] Subj001 - INFO - emd.logger:105 -               set_up() : EMD Logger Started
[2021-03-30 17:43:45] Subj001 - INFO - emd.logger:126 -            set_level() : EMD logger: handler 'console' level set to 'INFO'
[2021-03-30 17:43:45] Subj001 - INFO - emd.logger:115 -               set_up() : logging to file: /tmp/ExampleEMDLog1oahpsv5.log
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.logger:117 -               set_up() : EMD v0.4.0 installed in /home/docs/checkouts/readthedocs.org/user_builds/emd/envs/v0.4.0/lib/python3.7/site-packages/emd-0.4.0-py3.7.egg/emd
[2021-03-30 17:43:45] Subj001 - INFO - emd.emd_tutorial_04_utils_02_logger:149 -          my_analysis() : Starting my example analysis
[2021-03-30 17:43:45] Subj001 - INFO - emd.emd_tutorial_04_utils_02_logger:150 -          my_analysis() : ----------------------------
[2021-03-30 17:43:45] Subj001 - INFO - emd.logger:126 -            set_level() : EMD logger: handler 'console' level set to 'DEBUG'
[2021-03-30 17:43:45] Subj001 - INFO - emd.logger:192 -          sift_logger() : STARTED: mask_sift
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.logger:202 -          sift_logger() : Input data size: 5120
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.logger:205 -          sift_logger() : Input Sift Args: {'verbose': 'DEBUG'}
[2021-03-30 17:43:45] Subj001 - INFO - emd.sift:864 -       get_mask_freqs() : Computing first mask frequency with method zc
[2021-03-30 17:43:45] Subj001 - INFO - emd.sift:865 -       get_mask_freqs() : Getting first IMF with no mask
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.05909694676957796
[2021-03-30 17:43:45] Subj001 - INFO - emd.sift:873 -       get_mask_freqs() : Found first mask frequency of 0.169775390625
[2021-03-30 17:43:45] Subj001 - INFO - emd.sift:1039 -            mask_sift() : Sifting IMF-0
[2021-03-30 17:43:45] Subj001 - INFO - emd.sift:812 -    get_next_imf_mask() : Defining masks with freq 0.169775390625 and amp 8236.609552003994 at 4 phases
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.049441878545209796
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.03986910318112337
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.05155977553802651
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.05785743319647514
[2021-03-30 17:43:45] Subj001 - INFO - emd.sift:1039 -            mask_sift() : Sifting IMF-1
[2021-03-30 17:43:45] Subj001 - INFO - emd.sift:812 -    get_next_imf_mask() : Defining masks with freq 0.0848876953125 and amp 3520.7794577158106 at 4 phases
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 3 iters with sd 0.013077578994296945
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 4 iters with sd 0.009375958019220525
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 4 iters with sd 0.012607446883506557
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 4 iters with sd 0.0025995120144501967
[2021-03-30 17:43:45] Subj001 - INFO - emd.sift:1039 -            mask_sift() : Sifting IMF-2
[2021-03-30 17:43:45] Subj001 - INFO - emd.sift:812 -    get_next_imf_mask() : Defining masks with freq 0.04244384765625 and amp 1357.5346330804737 at 4 phases
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 1 iters with sd 0.029763358988685013
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 1 iters with sd 0.02670186067534009
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 1 iters with sd 0.027422997431369958
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 1 iters with sd 0.03173994382511575
[2021-03-30 17:43:45] Subj001 - INFO - emd.sift:1039 -            mask_sift() : Sifting IMF-3
[2021-03-30 17:43:45] Subj001 - INFO - emd.sift:812 -    get_next_imf_mask() : Defining masks with freq 0.021221923828125 and amp 7408.805910889346 at 4 phases
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 1 iters with sd 0.017711377065850114
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 1 iters with sd 0.017361300841470445
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 1 iters with sd 0.017334882040975108
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 1 iters with sd 0.017525347890034737
[2021-03-30 17:43:45] Subj001 - INFO - emd.sift:1039 -            mask_sift() : Sifting IMF-4
[2021-03-30 17:43:45] Subj001 - INFO - emd.sift:812 -    get_next_imf_mask() : Defining masks with freq 0.0106109619140625 and amp 352.6411741982858 at 4 phases
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 3 iters with sd 0.024342036860667535
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.039322166763418494
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.01998926197186578
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.03523223810678736
[2021-03-30 17:43:45] Subj001 - INFO - emd.sift:1039 -            mask_sift() : Sifting IMF-5
[2021-03-30 17:43:45] Subj001 - INFO - emd.sift:812 -    get_next_imf_mask() : Defining masks with freq 0.00530548095703125 and amp 448.4150517882588 at 4 phases
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.02175054622896094
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.01798311114011376
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.08955561938699365
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.0254353544201344
[2021-03-30 17:43:45] Subj001 - INFO - emd.sift:1039 -            mask_sift() : Sifting IMF-6
[2021-03-30 17:43:45] Subj001 - INFO - emd.sift:812 -    get_next_imf_mask() : Defining masks with freq 0.002652740478515625 and amp 274.23109136128 at 4 phases
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.0020899504954643637
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.0053112467373927
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.01069102781040843
[2021-03-30 17:43:45] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.011489243728390514
[2021-03-30 17:43:45] Subj001 - INFO - emd.sift:1039 -            mask_sift() : Sifting IMF-7
[2021-03-30 17:43:45] Subj001 - INFO - emd.sift:812 -    get_next_imf_mask() : Defining masks with freq 0.0013263702392578125 and amp 320.50849470193697 at 4 phases
[2021-03-30 17:43:46] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.004303615128529323
[2021-03-30 17:43:46] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.005443267205683766
[2021-03-30 17:43:46] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.0038632831486115275
[2021-03-30 17:43:46] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.0048242775761801835
[2021-03-30 17:43:46] Subj001 - INFO - emd.sift:1039 -            mask_sift() : Sifting IMF-8
[2021-03-30 17:43:46] Subj001 - INFO - emd.sift:812 -    get_next_imf_mask() : Defining masks with freq 0.0006631851196289062 and amp 79.30762150733322 at 4 phases
[2021-03-30 17:43:46] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.0714287297982973
[2021-03-30 17:43:46] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.0022192867473848398
[2021-03-30 17:43:46] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.09565362637626233
[2021-03-30 17:43:46] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 3 iters with sd 0.033869548156066256
[2021-03-30 17:43:46] Subj001 - INFO - emd.sift:1056 -            mask_sift() : Finishing sift: reached max number of imfs (9)
[2021-03-30 17:43:46] Subj001 - DEBUG - emd.logger:213 -          sift_logger() : Returning 9 imfs
[2021-03-30 17:43:46] Subj001 - INFO - emd.logger:218 -          sift_logger() : COMPLETED: mask_sift
[2021-03-30 17:43:46] Subj001 - INFO - emd.logger:126 -            set_level() : EMD logger: handler 'console' level set to 'INFO'
[2021-03-30 17:43:46] Subj001 - INFO - emd.spectra:92 -  frequency_transform() : STARTED: compute frequency stats
[2021-03-30 17:43:46] Subj001 - DEBUG - emd.spectra:97 -  frequency_transform() : computing on 5120 samples over 9 imfs at sample rate 512
[2021-03-30 17:43:46] Subj001 - INFO - emd.spectra:110 -  frequency_transform() : Using Amplitude-Normalised Hilbert transform
[2021-03-30 17:43:46] Subj001 - INFO - emd.utils:63 -  amplitude_normalise() : STARTED: Amplitude-Normalise
[2021-03-30 17:43:46] Subj001 - DEBUG - emd.utils:66 -  amplitude_normalise() : Normalising 5120 samples across 9 IMFs
[2021-03-30 17:43:46] Subj001 - DEBUG - emd.utils:71 -  amplitude_normalise() : Using pchip interpolation with threshold of 1e-10 and max_iters 3
[2021-03-30 17:43:46] Subj001 - INFO - emd.utils:110 -  amplitude_normalise() : Normalise of IMF-0-0 complete in 3 iters (val=0.0)
[2021-03-30 17:43:46] Subj001 - INFO - emd.utils:110 -  amplitude_normalise() : Normalise of IMF-1-0 complete in 3 iters (val=0.0)
[2021-03-30 17:43:46] Subj001 - INFO - emd.utils:110 -  amplitude_normalise() : Normalise of IMF-2-0 complete in 3 iters (val=0.0)
[2021-03-30 17:43:46] Subj001 - INFO - emd.utils:110 -  amplitude_normalise() : Normalise of IMF-3-0 complete in 3 iters (val=0.0)
[2021-03-30 17:43:46] Subj001 - INFO - emd.utils:110 -  amplitude_normalise() : Normalise of IMF-4-0 complete in 3 iters (val=0.0)
[2021-03-30 17:43:46] Subj001 - INFO - emd.utils:110 -  amplitude_normalise() : Normalise of IMF-5-0 complete in 3 iters (val=0.0)
[2021-03-30 17:43:46] Subj001 - INFO - emd.utils:110 -  amplitude_normalise() : Normalise of IMF-6-0 complete in 3 iters (val=0.0)
[2021-03-30 17:43:46] Subj001 - INFO - emd.utils:110 -  amplitude_normalise() : Normalise of IMF-7-0 complete in 2 iters (val=0.0)
[2021-03-30 17:43:46] Subj001 - INFO - emd.utils:110 -  amplitude_normalise() : Normalise of IMF-8-0 complete in 2 iters (val=0.0)
[2021-03-30 17:43:46] Subj001 - INFO - emd.utils:120 -  amplitude_normalise() : COMPLETED: Amplitude-Normalise
[2021-03-30 17:43:46] Subj001 - INFO - emd.spectra:198 -  frequency_transform() : COMPLETED: compute frequency stats. Returning 9 imfs
[2021-03-30 17:43:46] Subj001 - INFO - emd.emd_tutorial_04_utils_02_logger:157 -          my_analysis() : Avg frequency of IMF-2 is 12.081890Hz
[2021-03-30 17:43:46] Subj001 - WARNING - emd.cycles:65 -       get_cycle_inds() : WARNING: 'emd.cycles.get_cycle_inds' is deprecated and will be removed in a future version of EMD. Please change to use 'emd.cycles.get_cycle_vector' to remove this warning and future-proof your code
[2021-03-30 17:43:46] Subj001 - INFO - emd.cycles:125 -     get_cycle_vector() : STARTED: get cycle indices
[2021-03-30 17:43:46] Subj001 - DEBUG - emd.support:243 -            ensure_2d() : Checking get_cycle_vector inputs - Adding dummy dimension to input 'mask'
[2021-03-30 17:43:46] Subj001 - DEBUG - emd.cycles:133 -     get_cycle_vector() : computing on 5120 samples over 9 IMFs
[2021-03-30 17:43:46] Subj001 - DEBUG - emd.cycles:135 -     get_cycle_vector() : 5106 (99.73%) samples masked out
[2021-03-30 17:43:46] Subj001 - INFO - emd.cycles:182 -     get_cycle_vector() : found 3 cycles in IMF-0
[2021-03-30 17:43:46] Subj001 - INFO - emd.cycles:182 -     get_cycle_vector() : found 61 cycles in IMF-1
[2021-03-30 17:43:46] Subj001 - INFO - emd.cycles:182 -     get_cycle_vector() : found 115 cycles in IMF-2
[2021-03-30 17:43:46] Subj001 - INFO - emd.cycles:182 -     get_cycle_vector() : found 56 cycles in IMF-3
[2021-03-30 17:43:46] Subj001 - INFO - emd.cycles:182 -     get_cycle_vector() : found 40 cycles in IMF-4
[2021-03-30 17:43:46] Subj001 - INFO - emd.cycles:182 -     get_cycle_vector() : found 15 cycles in IMF-5
[2021-03-30 17:43:46] Subj001 - INFO - emd.cycles:182 -     get_cycle_vector() : found 6 cycles in IMF-6
[2021-03-30 17:43:46] Subj001 - INFO - emd.cycles:182 -     get_cycle_vector() : found 2 cycles in IMF-7
[2021-03-30 17:43:46] Subj001 - INFO - emd.cycles:182 -     get_cycle_vector() : found -1 cycles in IMF-8
[2021-03-30 17:43:46] Subj001 - INFO - emd.cycles:184 -     get_cycle_vector() : COMPLETED: get cycle indices
[2021-03-30 17:43:46] Subj001 - INFO - emd.cycles:384 -       get_cycle_stat() : STARTED: get_cycle_stat
[2021-03-30 17:43:46] Subj001 - INFO - emd.cycles:384 -       get_cycle_stat() : STARTED: get_cycle_stat
[2021-03-30 17:43:46] Subj001 - INFO - emd.emd_tutorial_04_utils_02_logger:168 -          my_analysis() : Freq-Amp correlation: r=-0.338789
[2021-03-30 17:43:46] Subj001 - INFO - emd.emd_tutorial_04_utils_02_logger:173 -          my_analysis() : My new analysis finished in 1.126331 seconds

If we want this extra detailed output in the console as well, we can specify the console_format when setting up the logger.

# Initialise logger with a verbose console format
emd.logger.set_up(level='DEBUG', prefix='Subj001', console_format='verbose')

# Run the analysis
freq, amp = my_analysis(x)

Out:

Subj001 EMD Logger Started
Subj001 EMD logger: handler 'console' level set to 'DEBUG'
[2021-03-30 17:43:46,329] Subj001 - INFO - emd.logger:151 -           set_format() : EMD logger: handler console format changed to verbose
[2021-03-30 17:43:46,333] Subj001 - DEBUG - emd.logger:117 -               set_up() : EMD v0.4.0 installed in /home/docs/checkouts/readthedocs.org/user_builds/emd/envs/v0.4.0/lib/python3.7/site-packages/emd-0.4.0-py3.7.egg/emd
[2021-03-30 17:43:46,333] Subj001 - INFO - emd.emd_tutorial_04_utils_02_logger:149 -          my_analysis() : Starting my example analysis
[2021-03-30 17:43:46,333] Subj001 - INFO - emd.emd_tutorial_04_utils_02_logger:150 -          my_analysis() : ----------------------------
[2021-03-30 17:43:46,333] Subj001 - INFO - emd.logger:126 -            set_level() : EMD logger: handler 'console' level set to 'DEBUG'
[2021-03-30 17:43:46,333] Subj001 - INFO - emd.logger:192 -          sift_logger() : STARTED: mask_sift
[2021-03-30 17:43:46,333] Subj001 - DEBUG - emd.logger:202 -          sift_logger() : Input data size: 5120
[2021-03-30 17:43:46,333] Subj001 - DEBUG - emd.logger:205 -          sift_logger() : Input Sift Args: {'verbose': 'DEBUG'}
[2021-03-30 17:43:46,333] Subj001 - INFO - emd.sift:864 -       get_mask_freqs() : Computing first mask frequency with method zc
[2021-03-30 17:43:46,333] Subj001 - INFO - emd.sift:865 -       get_mask_freqs() : Getting first IMF with no mask
[2021-03-30 17:43:46,338] Subj001 - DEBUG - emd.sift:280 -              sd_stop() : Sift stopped by SD-thresh in 2 iters with sd 0.05909694676957796
[2021-03-30 17:43:46,338] Subj001 - INFO - emd.sift:873 -       get_mask_freqs() : Found first mask frequency of 0.169775390625
[2021-03-30 17:43:46,338] Subj001 - INFO - emd.sift:1039 -            mask_sift() : Sifting IMF-0
[2021-03-30 17:43:46,338] Subj001 - INFO - emd.sift:812 -    get_next_imf_mask() : Defining masks with freq 0.169775390625 and amp 8236.609552003994 at 4 phases
[2021-03-30 17:43:46,453] Subj001 - INFO - emd.sift:1039 -            mask_sift() : Sifting IMF-1
[2021-03-30 17:43:46,453] Subj001 - INFO - emd.sift:812 -    get_next_imf_mask() : Defining masks with freq 0.0848876953125 and amp 3520.7794577158106 at 4 phases
[2021-03-30 17:43:46,566] Subj001 - INFO - emd.sift:1039 -            mask_sift() : Sifting IMF-2
[2021-03-30 17:43:46,566] Subj001 - INFO - emd.sift:812 -    get_next_imf_mask() : Defining masks with freq 0.04244384765625 and amp 1357.5346330804737 at 4 phases
[2021-03-30 17:43:46,679] Subj001 - INFO - emd.sift:1039 -            mask_sift() : Sifting IMF-3
[2021-03-30 17:43:46,680] Subj001 - INFO - emd.sift:812 -    get_next_imf_mask() : Defining masks with freq 0.021221923828125 and amp 7408.805910889346 at 4 phases
[2021-03-30 17:43:46,793] Subj001 - INFO - emd.sift:1039 -            mask_sift() : Sifting IMF-4
[2021-03-30 17:43:46,793] Subj001 - INFO - emd.sift:812 -    get_next_imf_mask() : Defining masks with freq 0.0106109619140625 and amp 352.6411741982858 at 4 phases
[2021-03-30 17:43:46,906] Subj001 - INFO - emd.sift:1039 -            mask_sift() : Sifting IMF-5
[2021-03-30 17:43:46,907] Subj001 - INFO - emd.sift:812 -    get_next_imf_mask() : Defining masks with freq 0.00530548095703125 and amp 448.4150517882588 at 4 phases
[2021-03-30 17:43:47,020] Subj001 - INFO - emd.sift:1039 -            mask_sift() : Sifting IMF-6
[2021-03-30 17:43:47,020] Subj001 - INFO - emd.sift:812 -    get_next_imf_mask() : Defining masks with freq 0.002652740478515625 and amp 274.23109136128 at 4 phases
[2021-03-30 17:43:47,134] Subj001 - INFO - emd.sift:1039 -            mask_sift() : Sifting IMF-7
[2021-03-30 17:43:47,134] Subj001 - INFO - emd.sift:812 -    get_next_imf_mask() : Defining masks with freq 0.0013263702392578125 and amp 320.50849470193697 at 4 phases
[2021-03-30 17:43:47,248] Subj001 - INFO - emd.sift:1039 -            mask_sift() : Sifting IMF-8
[2021-03-30 17:43:47,248] Subj001 - INFO - emd.sift:812 -    get_next_imf_mask() : Defining masks with freq 0.0006631851196289062 and amp 79.30762150733322 at 4 phases
[2021-03-30 17:43:47,362] Subj001 - INFO - emd.sift:1056 -            mask_sift() : Finishing sift: reached max number of imfs (9)
[2021-03-30 17:43:47,362] Subj001 - DEBUG - emd.logger:213 -          sift_logger() : Returning 9 imfs
[2021-03-30 17:43:47,363] Subj001 - INFO - emd.logger:218 -          sift_logger() : COMPLETED: mask_sift
[2021-03-30 17:43:47,363] Subj001 - INFO - emd.logger:126 -            set_level() : EMD logger: handler 'console' level set to 'DEBUG'
[2021-03-30 17:43:47,363] Subj001 - INFO - emd.spectra:92 -  frequency_transform() : STARTED: compute frequency stats
[2021-03-30 17:43:47,363] Subj001 - DEBUG - emd.spectra:97 -  frequency_transform() : computing on 5120 samples over 9 imfs at sample rate 512
[2021-03-30 17:43:47,363] Subj001 - INFO - emd.spectra:110 -  frequency_transform() : Using Amplitude-Normalised Hilbert transform
[2021-03-30 17:43:47,363] Subj001 - INFO - emd.utils:63 -  amplitude_normalise() : STARTED: Amplitude-Normalise
[2021-03-30 17:43:47,363] Subj001 - DEBUG - emd.utils:66 -  amplitude_normalise() : Normalising 5120 samples across 9 IMFs
[2021-03-30 17:43:47,363] Subj001 - DEBUG - emd.utils:71 -  amplitude_normalise() : Using pchip interpolation with threshold of 1e-10 and max_iters 3
[2021-03-30 17:43:47,368] Subj001 - INFO - emd.utils:110 -  amplitude_normalise() : Normalise of IMF-0-0 complete in 3 iters (val=0.0)
[2021-03-30 17:43:47,373] Subj001 - INFO - emd.utils:110 -  amplitude_normalise() : Normalise of IMF-1-0 complete in 3 iters (val=0.0)
[2021-03-30 17:43:47,376] Subj001 - INFO - emd.utils:110 -  amplitude_normalise() : Normalise of IMF-2-0 complete in 3 iters (val=0.0)
[2021-03-30 17:43:47,380] Subj001 - INFO - emd.utils:110 -  amplitude_normalise() : Normalise of IMF-3-0 complete in 3 iters (val=0.0)
[2021-03-30 17:43:47,383] Subj001 - INFO - emd.utils:110 -  amplitude_normalise() : Normalise of IMF-4-0 complete in 3 iters (val=0.0)
[2021-03-30 17:43:47,387] Subj001 - INFO - emd.utils:110 -  amplitude_normalise() : Normalise of IMF-5-0 complete in 3 iters (val=0.0)
[2021-03-30 17:43:47,390] Subj001 - INFO - emd.utils:110 -  amplitude_normalise() : Normalise of IMF-6-0 complete in 3 iters (val=0.0)
[2021-03-30 17:43:47,393] Subj001 - INFO - emd.utils:110 -  amplitude_normalise() : Normalise of IMF-7-0 complete in 2 iters (val=0.0)
[2021-03-30 17:43:47,395] Subj001 - INFO - emd.utils:110 -  amplitude_normalise() : Normalise of IMF-8-0 complete in 2 iters (val=0.0)
[2021-03-30 17:43:47,395] Subj001 - INFO - emd.utils:120 -  amplitude_normalise() : COMPLETED: Amplitude-Normalise
[2021-03-30 17:43:47,420] Subj001 - INFO - emd.spectra:198 -  frequency_transform() : COMPLETED: compute frequency stats. Returning 9 imfs
[2021-03-30 17:43:47,420] Subj001 - INFO - emd.emd_tutorial_04_utils_02_logger:157 -          my_analysis() : Avg frequency of IMF-2 is 12.081890Hz
/home/docs/checkouts/readthedocs.org/user_builds/emd/envs/v0.4.0/lib/python3.7/site-packages/emd-0.4.0-py3.7.egg/emd/cycles.py:64: UserWarning: WARNING: 'emd.cycles.get_cycle_inds' is deprecated and will be removed in a future version of EMD. Please change to use 'emd.cycles.get_cycle_vector' to remove this warning and future-proof your code
  warnings.warn(msg)
[2021-03-30 17:43:47,420] Subj001 - WARNING - emd.cycles:65 -       get_cycle_inds() : WARNING: 'emd.cycles.get_cycle_inds' is deprecated and will be removed in a future version of EMD. Please change to use 'emd.cycles.get_cycle_vector' to remove this warning and future-proof your code
[2021-03-30 17:43:47,421] Subj001 - INFO - emd.cycles:125 -     get_cycle_vector() : STARTED: get cycle indices
[2021-03-30 17:43:47,421] Subj001 - DEBUG - emd.support:243 -            ensure_2d() : Checking get_cycle_vector inputs - Adding dummy dimension to input 'mask'
[2021-03-30 17:43:47,421] Subj001 - DEBUG - emd.cycles:133 -     get_cycle_vector() : computing on 5120 samples over 9 IMFs
[2021-03-30 17:43:47,421] Subj001 - DEBUG - emd.cycles:135 -     get_cycle_vector() : 5106 (99.73%) samples masked out
[2021-03-30 17:43:47,429] Subj001 - INFO - emd.cycles:182 -     get_cycle_vector() : found 3 cycles in IMF-0
[2021-03-30 17:43:47,439] Subj001 - INFO - emd.cycles:182 -     get_cycle_vector() : found 61 cycles in IMF-1
[2021-03-30 17:43:47,443] Subj001 - INFO - emd.cycles:182 -     get_cycle_vector() : found 115 cycles in IMF-2
[2021-03-30 17:43:47,445] Subj001 - INFO - emd.cycles:182 -     get_cycle_vector() : found 56 cycles in IMF-3
[2021-03-30 17:43:47,447] Subj001 - INFO - emd.cycles:182 -     get_cycle_vector() : found 40 cycles in IMF-4
[2021-03-30 17:43:47,448] Subj001 - INFO - emd.cycles:182 -     get_cycle_vector() : found 15 cycles in IMF-5
[2021-03-30 17:43:47,449] Subj001 - INFO - emd.cycles:182 -     get_cycle_vector() : found 6 cycles in IMF-6
[2021-03-30 17:43:47,450] Subj001 - INFO - emd.cycles:182 -     get_cycle_vector() : found 2 cycles in IMF-7
[2021-03-30 17:43:47,451] Subj001 - INFO - emd.cycles:182 -     get_cycle_vector() : found -1 cycles in IMF-8
[2021-03-30 17:43:47,451] Subj001 - INFO - emd.cycles:184 -     get_cycle_vector() : COMPLETED: get cycle indices
[2021-03-30 17:43:47,451] Subj001 - INFO - emd.cycles:384 -       get_cycle_stat() : STARTED: get_cycle_stat
[2021-03-30 17:43:47,455] Subj001 - INFO - emd.cycles:384 -       get_cycle_stat() : STARTED: get_cycle_stat
[2021-03-30 17:43:47,459] Subj001 - INFO - emd.emd_tutorial_04_utils_02_logger:168 -          my_analysis() : Freq-Amp correlation: r=-0.338789
[2021-03-30 17:43:47,459] Subj001 - INFO - emd.emd_tutorial_04_utils_02_logger:173 -          my_analysis() : My new analysis finished in 1.126127 seconds

Total running time of the script: ( 0 minutes 5.860 seconds)

Gallery generated by Sphinx-Gallery