
#     ________
#            /
#      \    /
#       \  /
#        \/

import random
import textwrap
import emd_mean
import AdvEMDpy
import emd_basis
import emd_utils
import numpy as np
import pandas as pd
import cvxpy as cvx
import seaborn as sns
import matplotlib.pyplot as plt
from scipy.integrate import odeint
from scipy.ndimage import gaussian_filter
from emd_utils import time_extension, Utility
from scipy.interpolate import CubicSpline
from emd_hilbert import Hilbert, hilbert_spectrum
from emd_preprocess import Preprocess
from emd_mean import Fluctuation
from AdvEMDpy import EMD

# alternate packages
from PyEMD import EMD as pyemd0215
import emd as emd040

sns.set(style='darkgrid')

pseudo_alg_time = np.linspace(0, 2 * np.pi, 1001)
pseudo_alg_time_series = np.sin(pseudo_alg_time) + np.sin(5 * pseudo_alg_time)
pseudo_utils = Utility(time=pseudo_alg_time, time_series=pseudo_alg_time_series)

# plot 0 - addition
fig = plt.figure(figsize=(9, 4))
ax = plt.subplot(111)
plt.gcf().subplots_adjust(bottom=0.10)
plt.title('First Iteration of Sifting Algorithm')
plt.plot(pseudo_alg_time, pseudo_alg_time_series, label=r'$h_{(1,0)}(t)$', zorder=1)
plt.scatter(pseudo_alg_time[pseudo_utils.max_bool_func_1st_order_fd()],
            pseudo_alg_time_series[pseudo_utils.max_bool_func_1st_order_fd()],
            c='r', label=r'$M(t_i)$', zorder=2)
plt.plot(pseudo_alg_time, np.sin(pseudo_alg_time) + 1, '--', c='r', label=r'$\tilde{h}_{(1,0)}^M(t)$', zorder=4)
plt.scatter(pseudo_alg_time[pseudo_utils.min_bool_func_1st_order_fd()],
            pseudo_alg_time_series[pseudo_utils.min_bool_func_1st_order_fd()],
            c='c', label=r'$m(t_j)$', zorder=3)
plt.plot(pseudo_alg_time, np.sin(pseudo_alg_time) - 1, '--', c='c', label=r'$\tilde{h}_{(1,0)}^m(t)$', zorder=5)
plt.plot(pseudo_alg_time, np.sin(pseudo_alg_time), '--', c='purple', label=r'$\tilde{h}_{(1,0)}^{\mu}(t)$', zorder=5)
plt.yticks(ticks=[-2, -1, 0, 1, 2])
plt.xticks(ticks=[0, np.pi, 2 * np.pi],
           labels=[r'0', r'$\pi$', r'$2\pi$'])
box_0 = ax.get_position()
ax.set_position([box_0.x0 - 0.05, box_0.y0, box_0.width * 0.95, box_0.height])
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
plt.savefig('jss_figures/pseudo_algorithm.png')
plt.show()

knots = np.arange(12)
time = np.linspace(0, 11, 1101)

basis = emd_basis.Basis(time=time, time_series=time)
b_spline_basis = basis.cubic_b_spline(knots)
chsi_basis = basis.chsi_basis(knots)

# plot 1
plt.title('Non-Natural Cubic B-Spline Bases at Boundary')
plt.plot(time[500:], b_spline_basis[2, 500:].T, '--', label=r'$ B_{-3,4}(t) $')
plt.plot(time[500:], b_spline_basis[3, 500:].T, '--', label=r'$ B_{-2,4}(t) $')
plt.plot(time[500:], b_spline_basis[4, 500:].T, '--', label=r'$ B_{-1,4}(t) $')
plt.plot(time[500:], b_spline_basis[5, 500:].T, '--', label=r'$ B_{0,4}(t) $')
plt.plot(time[500:], b_spline_basis[6, 500:].T, '--', label=r'$ B_{1,4}(t) $')
plt.xticks([5, 6], [r'$ \tau_0 $', r'$ \tau_1 $'])
plt.xlim(4.4, 6.6)
plt.plot(5 * np.ones(100), np.linspace(-0.2, 1.2, 100), 'k-')
plt.plot(6 * np.ones(100), np.linspace(-0.2, 1.2, 100), 'k-')
plt.legend(loc='upper left')
plt.savefig('jss_figures/boundary_bases.png')
plt.show()

# plot 1a - addition
knot_demonstrate_time = np.linspace(0, 2 * np.pi, 1001)
knot_demonstrate_time_series = np.sin(knot_demonstrate_time) + np.sin(5 * knot_demonstrate_time)
knots_uniform = np.linspace(0, 2 * np.pi, 51)
emd = EMD(time=knot_demonstrate_time, time_series=knot_demonstrate_time_series)
imfs = emd.empirical_mode_decomposition(knots=knots_uniform, edge_effect='anti-symmetric', verbose=False)[0]

fig, axs = plt.subplots(3, 1)
fig.subplots_adjust(hspace=0.6)
plt.gcf().subplots_adjust(bottom=0.10)
axs[0].set_title('Time Series and Uniform Knots')
axs[0].plot(knot_demonstrate_time, knot_demonstrate_time_series, Linewidth=2, zorder=100)
axs[0].set_yticks(ticks=[-2, 0, 2])
axs[0].set_xticks(ticks=[0, np.pi, 2 * np.pi])
axs[0].set_xticklabels(labels=['0', r'$\pi$', r'$2\pi$'])
axs[1].set_title('IMF 1 and Uniform Knots')
axs[1].plot(knot_demonstrate_time, imfs[1, :], Linewidth=2, zorder=100)
axs[1].set_yticks(ticks=[-2, 0, 2])
axs[1].set_xticks(ticks=[0, np.pi, 2 * np.pi])
axs[1].set_xticklabels(labels=['0', r'$\pi$', r'$2\pi$'])
axs[2].set_title('IMF 2 and Uniform Knots')
axs[2].plot(knot_demonstrate_time, imfs[2, :], Linewidth=2, zorder=100)
axs[2].set_yticks(ticks=[-2, 0, 2])
axs[2].set_xticks(ticks=[0, np.pi, 2 * np.pi])
axs[2].set_xticklabels(labels=['0', r'$\pi$', r'$2\pi$'])
axs[0].plot(knots_uniform[0] * np.ones(101), np.linspace(-2, 2, 101), '--', c='grey', label='Knots')
axs[0].legend(loc='lower left')
axs[1].plot(knots_uniform[0] * np.ones(101), np.linspace(-2, 2, 101), '--', c='grey', label='Knots')
axs[2].plot(knots_uniform[0] * np.ones(101), np.linspace(-2, 2, 101), '--', c='grey', label='Knots')
for i in range(3):
    for j in range(1, len(knots_uniform)):
        axs[i].plot(knots_uniform[j] * np.ones(101), np.linspace(-2, 2, 101), '--', c='grey')
plt.savefig('jss_figures/knot_uniform.png')
plt.show()

# plot 1b - addition
knot_demonstrate_time = np.linspace(0, 2 * np.pi, 1001)
knot_demonstrate_time_series = np.sin(knot_demonstrate_time) + np.sin(5 * knot_demonstrate_time)
emd = EMD(time=knot_demonstrate_time, time_series=knot_demonstrate_time_series)
imfs, _, _, _, knots, _, _ = emd.empirical_mode_decomposition(edge_effect='anti-symmetric',
                                                              optimise_knots=1, verbose=False)

fig, axs = plt.subplots(3, 1)
fig.subplots_adjust(hspace=0.6)
plt.gcf().subplots_adjust(bottom=0.10)
axs[0].set_title('Time Series and Statically Optimised Knots')
axs[0].plot(knot_demonstrate_time, knot_demonstrate_time_series, Linewidth=2, zorder=100)
axs[0].set_yticks(ticks=[-2, 0, 2])
axs[0].set_xticks(ticks=[0, np.pi, 2 * np.pi])
axs[0].set_xticklabels(labels=['0', r'$\pi$', r'$2\pi$'])
axs[1].set_title('IMF 1 and Statically Optimised Knots')
axs[1].plot(knot_demonstrate_time, imfs[1, :], Linewidth=2, zorder=100)
axs[1].set_yticks(ticks=[-2, 0, 2])
axs[1].set_xticks(ticks=[0, np.pi, 2 * np.pi])
axs[1].set_xticklabels(labels=['0', r'$\pi$', r'$2\pi$'])
axs[2].set_title('IMF 2 and Statically Optimised Knots')
axs[2].plot(knot_demonstrate_time, imfs[2, :], Linewidth=2, zorder=100)
axs[2].set_yticks(ticks=[-2, 0, 2])
axs[2].set_xticks(ticks=[0, np.pi, 2 * np.pi])
axs[2].set_xticklabels(labels=['0', r'$\pi$', r'$2\pi$'])
axs[0].plot(knots[0] * np.ones(101), np.linspace(-2, 2, 101), '--', c='grey', label='Knots')
axs[0].legend(loc='lower left')
axs[1].plot(knots[0] * np.ones(101), np.linspace(-2, 2, 101), '--', c='grey', label='Knots')
axs[2].plot(knots[0] * np.ones(101), np.linspace(-2, 2, 101), '--', c='grey', label='Knots')
for i in range(3):
    for j in range(1, len(knots)):
        axs[i].plot(knots[j] * np.ones(101), np.linspace(-2, 2, 101), '--', c='grey')
plt.savefig('jss_figures/knot_1.png')
plt.show()

# plot 1c - addition
knot_demonstrate_time = np.linspace(0, 2 * np.pi, 1001)
knot_demonstrate_time_series = np.sin(knot_demonstrate_time) + np.sin(5 * knot_demonstrate_time)
emd = EMD(time=knot_demonstrate_time, time_series=knot_demonstrate_time_series)
imfs, _, _, _, knots, _, _ = emd.empirical_mode_decomposition(edge_effect='anti-symmetric',
                                                              optimise_knots=2, verbose=False)

fig, axs = plt.subplots(3, 1)
fig.subplots_adjust(hspace=0.6)
plt.gcf().subplots_adjust(bottom=0.10)
axs[0].set_title('Time Series and Dynamically Optimised Knots')
axs[0].plot(knot_demonstrate_time, knot_demonstrate_time_series, Linewidth=2, zorder=100)
axs[0].set_yticks(ticks=[-2, 0, 2])
axs[0].set_xticks(ticks=[0, np.pi, 2 * np.pi])
axs[0].set_xticklabels(labels=['0', r'$\pi$', r'$2\pi$'])
axs[1].set_title('IMF 1 and Dynamically Knots')
axs[1].plot(knot_demonstrate_time, imfs[1, :], Linewidth=2, zorder=100)
axs[1].set_yticks(ticks=[-2, 0, 2])
axs[1].set_xticks(ticks=[0, np.pi, 2 * np.pi])
axs[1].set_xticklabels(labels=['0', r'$\pi$', r'$2\pi$'])
axs[2].set_title('IMF 2 and Dynamically Knots')
axs[2].plot(knot_demonstrate_time, imfs[2, :], Linewidth=2, zorder=100)
axs[2].set_yticks(ticks=[-2, 0, 2])
axs[2].set_xticks(ticks=[0, np.pi, 2 * np.pi])
axs[2].set_xticklabels(labels=['0', r'$\pi$', r'$2\pi$'])
axs[0].plot(knots[0][0] * np.ones(101), np.linspace(-2, 2, 101), '--', c='grey', label='Knots')
axs[0].legend(loc='lower left')
axs[1].plot(knots[1][0] * np.ones(101), np.linspace(-2, 2, 101), '--', c='grey', label='Knots')
axs[2].plot(knots[2][0] * np.ones(101), np.linspace(-2, 2, 101), '--', c='grey', label='Knots')
for i in range(3):
    for j in range(1, len(knots[i])):
        axs[i].plot(knots[i][j] * np.ones(101), np.linspace(-2, 2, 101), '--', c='grey')
plt.savefig('jss_figures/knot_2.png')
plt.show()

# plot 1d - addition
window = 81
fig, axs = plt.subplots(2, 1)
fig.subplots_adjust(hspace=0.4)
figure_size = plt.gcf().get_size_inches()
factor = 0.8
plt.gcf().set_size_inches((figure_size[0], factor * figure_size[1]))
plt.gcf().subplots_adjust(bottom=0.10)
axs[0].set_title('Preprocess Filtering Demonstration')
axs[1].set_title('Zoomed Region')
preprocess_time = pseudo_alg_time.copy()
np.random.seed(1)
random.seed(1)
preprocess_time_series = pseudo_alg_time_series + np.random.normal(0, 0.1, len(preprocess_time))
for i in random.sample(range(1000), 500):
    preprocess_time_series[i] += np.random.normal(0, 1)
preprocess = Preprocess(time=preprocess_time, time_series=preprocess_time_series)
axs[0].plot(preprocess_time, preprocess_time_series, label='x(t)')
axs[0].plot(pseudo_alg_time, pseudo_alg_time_series, '--', c='purple',
            label=textwrap.fill('Noiseless time series', 12))
axs[0].plot(preprocess_time, preprocess.mean_filter(window_width=window)[1], label=textwrap.fill('Mean filter', 12))
axs[0].plot(preprocess_time, preprocess.median_filter(window_width=window)[1], label=textwrap.fill('Median filter', 13))
axs[0].plot(preprocess_time, preprocess.winsorize(window_width=window, a=0.8)[1], label=textwrap.fill('Windsorize filter', 12))
axs[0].plot(preprocess_time, preprocess.winsorize_interpolate(window_width=window, a=0.8)[1],
            label=textwrap.fill('Windsorize interpolation filter', 14))
axs[0].plot(preprocess_time, preprocess.quantile_filter(window_width=window, q=0.90)[1], c='grey',
            label=textwrap.fill('Quantile window', 12))
axs[0].plot(preprocess_time, preprocess.quantile_filter(window_width=window, q=0.10)[1], c='grey')

axs[0].plot(np.linspace(0.85 * np.pi, 1.15 * np.pi, 101), -3 * np.ones(101), '--', c='black',
            label=textwrap.fill('Zoomed region', 10))
axs[0].plot(np.linspace(0.85 * np.pi, 1.15 * np.pi, 101), 3 * np.ones(101), '--', c='black')
axs[0].plot(0.85 * np.pi * np.ones(101), np.linspace(-3, 3, 101), '--', c='black')
axs[0].plot(1.15 * np.pi * np.ones(101), np.linspace(-3, 3, 101), '--', c='black')

axs[0].set_yticks(ticks=[-2, 0, 2])
axs[0].set_xticks(ticks=[0, np.pi, 2 * np.pi])
axs[0].set_xticklabels(labels=['0', r'$\pi$', r'$2\pi$'])
axs[1].plot(preprocess_time, preprocess_time_series, label='x(t)')
axs[1].plot(pseudo_alg_time, pseudo_alg_time_series, '--', c='purple', label=textwrap.fill('Noiseless time series', 12))
axs[1].plot(preprocess_time, preprocess.mean_filter(window_width=window)[1], label=textwrap.fill('Mean filter', 12))
axs[1].plot(preprocess_time, preprocess.median_filter(window_width=window)[1], label=textwrap.fill('Median filter', 13))
axs[1].plot(preprocess_time, preprocess.winsorize(window_width=window, a=0.8)[1], label=textwrap.fill('Windsorize filter', 12))
axs[1].plot(preprocess_time, preprocess.winsorize_interpolate(window_width=window, a=0.8)[1],
            label=textwrap.fill('Windsorize interpolation filter', 14))
axs[1].plot(preprocess_time, preprocess.quantile_filter(window_width=window, q=0.90)[1], c='grey',
            label=textwrap.fill('Quantile window', 12))
axs[1].plot(preprocess_time, preprocess.quantile_filter(window_width=window, q=0.10)[1], c='grey')
axs[1].set_xlim(0.85 * np.pi, 1.15 * np.pi)
axs[1].set_ylim(-3, 3)
axs[1].set_yticks(ticks=[-2, 0, 2])
axs[1].set_xticks(ticks=[np.pi])
axs[1].set_xticklabels(labels=[r'$\pi$'])
box_0 = axs[0].get_position()
axs[0].set_position([box_0.x0 - 0.05, box_0.y0, box_0.width * 0.85, box_0.height])
axs[0].legend(loc='center left', bbox_to_anchor=(1, -0.15))
box_1 = axs[1].get_position()
axs[1].set_position([box_1.x0 - 0.05, box_1.y0, box_1.width * 0.85, box_1.height])
plt.savefig('jss_figures/preprocess_filter.png')
plt.show()

# plot 1e - addition
fig, axs = plt.subplots(2, 1)
fig.subplots_adjust(hspace=0.4)
figure_size = plt.gcf().get_size_inches()
factor = 0.8
plt.gcf().set_size_inches((figure_size[0], factor * figure_size[1]))
plt.gcf().subplots_adjust(bottom=0.10)
axs[0].set_title('Preprocess Smoothing Demonstration')
axs[1].set_title('Zoomed Region')
axs[0].plot(preprocess_time, preprocess_time_series, label='x(t)')
axs[0].plot(pseudo_alg_time, pseudo_alg_time_series, '--', c='purple',
            label=textwrap.fill('Noiseless time series', 12))
axs[0].plot(preprocess_time, preprocess.hp()[1],
            label=textwrap.fill('Hodrick-Prescott smoothing', 12))
axs[0].plot(preprocess_time, preprocess.hw(order=51)[1],
            label=textwrap.fill('Henderson-Whittaker smoothing', 13))
downsampled_and_decimated = preprocess.downsample()
axs[0].plot(downsampled_and_decimated[0], downsampled_and_decimated[1],
            label=textwrap.fill('Downsampled & decimated', 11))
downsampled = preprocess.downsample(decimate=False)
axs[0].plot(downsampled[0], downsampled[1],
            label=textwrap.fill('Downsampled', 13))
axs[0].plot(np.linspace(0.85 * np.pi, 1.15 * np.pi, 101), -3 * np.ones(101), '--', c='black',
            label=textwrap.fill('Zoomed region', 10))
axs[0].plot(np.linspace(0.85 * np.pi, 1.15 * np.pi, 101), 3 * np.ones(101), '--', c='black')
axs[0].plot(0.85 * np.pi * np.ones(101), np.linspace(-3, 3, 101), '--', c='black')
axs[0].plot(1.15 * np.pi * np.ones(101), np.linspace(-3, 3, 101), '--', c='black')
axs[0].set_yticks(ticks=[-2, 0, 2])
axs[0].set_xticks(ticks=[0, np.pi, 2 * np.pi])
axs[0].set_xticklabels(labels=['0', r'$\pi$', r'$2\pi$'])
axs[1].plot(preprocess_time, preprocess_time_series, label='x(t)')
axs[1].plot(pseudo_alg_time, pseudo_alg_time_series, '--', c='purple',
            label=textwrap.fill('Noiseless time series', 12))
axs[1].plot(preprocess_time, preprocess.hp()[1],
            label=textwrap.fill('Hodrick-Prescott smoothing', 12))
axs[1].plot(preprocess_time, preprocess.hw(order=51)[1],
            label=textwrap.fill('Henderson-Whittaker smoothing', 13))
axs[1].plot(downsampled_and_decimated[0], downsampled_and_decimated[1],
            label=textwrap.fill('Downsampled & decimated', 13))
axs[1].plot(downsampled[0], downsampled[1],
            label=textwrap.fill('Downsampled', 13))
axs[1].set_xlim(0.85 * np.pi, 1.15 * np.pi)
axs[1].set_ylim(-3, 3)
axs[1].set_yticks(ticks=[-2, 0, 2])
axs[1].set_xticks(ticks=[np.pi])
axs[1].set_xticklabels(labels=[r'$\pi$'])
box_0 = axs[0].get_position()
axs[0].set_position([box_0.x0 - 0.06, box_0.y0, box_0.width * 0.85, box_0.height])
axs[0].legend(loc='center left', bbox_to_anchor=(1, -0.15))
box_1 = axs[1].get_position()
axs[1].set_position([box_1.x0 - 0.06, box_1.y0, box_1.width * 0.85, box_1.height])
plt.savefig('jss_figures/preprocess_smooth.png')
plt.show()

# plot 2
fig, axs = plt.subplots(1, 2, sharey=True)
axs[0].set_title('Cubic B-Spline Bases')
axs[0].plot(time, b_spline_basis[2, :].T, '--', label='Basis 1')
axs[0].plot(time, b_spline_basis[3, :].T, '--', label='Basis 2')
axs[0].plot(time, b_spline_basis[4, :].T, '--', label='Basis 3')
axs[0].plot(time, b_spline_basis[5, :].T, '--', label='Basis 4')
axs[0].legend(loc='upper left')
axs[0].plot(5 * np.ones(100), np.linspace(-0.2, 0.8, 100), 'k-')
axs[0].plot(6 * np.ones(100), np.linspace(-0.2, 0.8, 100), 'k-')
axs[0].set_xticks([5, 6])
axs[0].set_xticklabels([r'$ \tau_k $', r'$ \tau_{k+1} $'])
axs[0].set_xlim(4.5, 6.5)
axs[1].set_title('Cubic Hermite Spline Bases')
axs[1].plot(time, chsi_basis[10, :].T, '--')
axs[1].plot(time, chsi_basis[11, :].T, '--')
axs[1].plot(time, chsi_basis[12, :].T, '--')
axs[1].plot(time, chsi_basis[13, :].T, '--')
axs[1].plot(5 * np.ones(100), np.linspace(-0.2, 1.2, 100), 'k-')
axs[1].plot(6 * np.ones(100), np.linspace(-0.2, 1.2, 100), 'k-')
axs[1].set_xticks([5, 6])
axs[1].set_xticklabels([r'$ \tau_k $', r'$ \tau_{k+1} $'])
axs[1].set_xlim(4.5, 6.5)
plt.savefig('jss_figures/comparing_bases.png')
plt.show()

# plot 3
a = 0.25
width = 0.2
time = np.linspace(0, (5 - a) * np.pi, 1001)
time_series = np.cos(time) + np.cos(5 * time)
utils = emd_utils.Utility(time=time, time_series=time_series)
max_bool = utils.max_bool_func_1st_order_fd()
maxima_x = time[max_bool]
maxima_y = time_series[max_bool]
min_bool = utils.min_bool_func_1st_order_fd()
minima_x = time[min_bool]
minima_y = time_series[min_bool]
max_dash_time = np.linspace(maxima_x[-1] - width, maxima_x[-1] + width, 101)
max_dash = maxima_y[-1] * np.ones_like(max_dash_time)
min_dash_time = np.linspace(minima_x[-1] - width, minima_x[-1] + width, 101)
min_dash = minima_y[-1] * np.ones_like(min_dash_time)
dash_1_time = np.linspace(maxima_x[-1], minima_x[-1], 101)
dash_1 = np.linspace(maxima_y[-1], minima_y[-1], 101)

max_discard = maxima_y[-1]
max_discard_time = minima_x[-1] - maxima_x[-1] + minima_x[-1]
max_discard_dash_time = np.linspace(max_discard_time - width, max_discard_time + width, 101)
max_discard_dash = max_discard * np.ones_like(max_discard_dash_time)
dash_2_time = np.linspace(minima_x[-1], max_discard_time, 101)
dash_2 = np.linspace(minima_y[-1], max_discard, 101)

end_point_time = time[-1]
end_point = time_series[-1]

time_reflect = np.linspace((5 - a) * np.pi, (5 + a) * np.pi, 101)
time_series_reflect = np.flip(np.cos(np.linspace((5 - 2.6 * a) * np.pi,
                                                 (5 - a) * np.pi, 101)) + np.cos(5 * np.linspace((5 - 2.6 * a) * np.pi,
                                                                                                 (5 - a) * np.pi, 101)))
time_series_anti_reflect = time_series_reflect[0] - time_series_reflect
utils = emd_utils.Utility(time=time, time_series=time_series_anti_reflect)
anti_max_bool = utils.max_bool_func_1st_order_fd()
anti_max_point_time = time_reflect[anti_max_bool]
anti_max_point = time_series_anti_reflect[anti_max_bool]

utils = emd_utils.Utility(time=time, time_series=time_series_reflect)
no_anchor_max_time = time_reflect[utils.max_bool_func_1st_order_fd()]
no_anchor_max = time_series_reflect[utils.max_bool_func_1st_order_fd()]

point_1 = 5.4
length_distance = np.linspace(maxima_y[-1], minima_y[-1], 101)
length_distance_time = point_1 * np.pi * np.ones_like(length_distance)
length_time = np.linspace(point_1 * np.pi - width, point_1 * np.pi + width, 101)
length_top = maxima_y[-1] * np.ones_like(length_time)
length_bottom = minima_y[-1] * np.ones_like(length_time)

point_2 = 5.2
length_distance_2 = np.linspace(time_series[-1], minima_y[-1], 101)
length_distance_time_2 = point_2 * np.pi * np.ones_like(length_distance_2)
length_time_2 = np.linspace(point_2 * np.pi - width, point_2 * np.pi + width, 101)
length_top_2 = time_series[-1] * np.ones_like(length_time_2)
length_bottom_2 = minima_y[-1] * np.ones_like(length_time_2)

symmetry_axis_1_time = minima_x[-1] * np.ones(101)
symmetry_axis_2_time = time[-1] * np.ones(101)
symmetry_axis = np.linspace(-2, 2, 101)

end_time = np.linspace(time[-1] - width, time[-1] + width, 101)
end_signal = time_series[-1] * np.ones_like(end_time)

anti_symmetric_time = np.linspace(time[-1] - 0.5, time[-1] + 0.5, 101)
anti_symmetric_signal = time_series[-1] * np.ones_like(anti_symmetric_time)

ax = plt.subplot(111)
plt.gcf().subplots_adjust(bottom=0.10)
plt.plot(time, time_series, LineWidth=2, label='Signal')
plt.title('Symmetry Edge Effects Example')
plt.plot(time_reflect, time_series_reflect, 'g--', LineWidth=2, label=textwrap.fill('Symmetric signal', 10))
plt.plot(time_reflect[:51], time_series_anti_reflect[:51], '--', c='purple', LineWidth=2,
         label=textwrap.fill('Anti-symmetric signal', 10))
plt.plot(max_dash_time, max_dash, 'k-')
plt.plot(min_dash_time, min_dash, 'k-')
plt.plot(dash_1_time, dash_1, 'k--')
plt.plot(dash_2_time, dash_2, 'k--')
plt.plot(length_distance_time, length_distance, 'k--')
plt.plot(length_distance_time_2, length_distance_2, 'k--')
plt.plot(length_time, length_top, 'k-')
plt.plot(length_time, length_bottom, 'k-')
plt.plot(length_time_2, length_top_2, 'k-')
plt.plot(length_time_2, length_bottom_2, 'k-')
plt.plot(end_time, end_signal, 'k-')
plt.plot(symmetry_axis_1_time, symmetry_axis, 'r--', zorder=1)
plt.plot(anti_symmetric_time, anti_symmetric_signal, 'r--', zorder=1)
plt.plot(symmetry_axis_2_time, symmetry_axis, 'r--', label=textwrap.fill('Axes of symmetry', 10), zorder=1)
plt.text(5.1 * np.pi, -0.7, r'$\beta$L')
plt.text(5.34 * np.pi, -0.05, 'L')
plt.scatter(maxima_x, maxima_y, c='r', zorder=4, label='Maxima')
plt.scatter(minima_x, minima_y, c='b', zorder=4, label='Minima')
plt.scatter(max_discard_time, max_discard, c='purple', zorder=4, label=textwrap.fill('Symmetric Discard maxima', 10))
plt.scatter(end_point_time, end_point, c='orange', zorder=4, label=textwrap.fill('Symmetric Anchor maxima', 10))
plt.scatter(anti_max_point_time, anti_max_point, c='green', zorder=4, label=textwrap.fill('Anti-Symmetric maxima', 10))
plt.scatter(no_anchor_max_time, no_anchor_max, c='gray', zorder=4, label=textwrap.fill('Symmetric maxima', 10))
plt.xlim(3.9 * np.pi, 5.5 * np.pi)
plt.xticks((4 * np.pi, 5 * np.pi), (r'4$\pi$', r'5$\pi$'))
plt.yticks((-2, -1, 0, 1, 2), ('-2', '-1', '0', '1', '2'))
box_0 = ax.get_position()
ax.set_position([box_0.x0 - 0.05, box_0.y0, box_0.width * 0.85, box_0.height])
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
plt.savefig('jss_figures/edge_effects_symmetry_anti.png')
plt.show()

# plot 4
a = 0.21
width = 0.2
time = np.linspace(0, (5 - a) * np.pi, 1001)
time_series = np.cos(time) + np.cos(5 * time)
utils = emd_utils.Utility(time=time, time_series=time_series)
max_bool = utils.max_bool_func_1st_order_fd()
maxima_x = time[max_bool]
maxima_y = time_series[max_bool]
min_bool = utils.min_bool_func_1st_order_fd()
minima_x = time[min_bool]
minima_y = time_series[min_bool]
max_dash_1 = np.linspace(maxima_y[-1] - width, maxima_y[-1] + width, 101)
max_dash_2 = np.linspace(maxima_y[-2] - width, maxima_y[-2] + width, 101)
max_dash_time_1 = maxima_x[-1] * np.ones_like(max_dash_1)
max_dash_time_2 = maxima_x[-2] * np.ones_like(max_dash_1)
min_dash_1 = np.linspace(minima_y[-1] - width, minima_y[-1] + width, 101)
min_dash_2 = np.linspace(minima_y[-2] - width, minima_y[-2] + width, 101)
min_dash_time_1 = minima_x[-1] * np.ones_like(min_dash_1)
min_dash_time_2 = minima_x[-2] * np.ones_like(min_dash_1)

dash_1_time = np.linspace(maxima_x[-1], minima_x[-1], 101)
dash_1 = np.linspace(maxima_y[-1], minima_y[-1], 101)
dash_2_time = np.linspace(maxima_x[-1], minima_x[-2], 101)
dash_2 = np.linspace(maxima_y[-1], minima_y[-2], 101)

s1 = (minima_y[-2] - maxima_y[-1]) / (minima_x[-2] - maxima_x[-1])

slope_based_maximum_time = maxima_x[-1] + (maxima_x[-1] - maxima_x[-2])
slope_based_maximum = minima_y[-1] + (slope_based_maximum_time - minima_x[-1]) * s1

max_dash_time_3 = slope_based_maximum_time * np.ones_like(max_dash_1)
max_dash_3 = np.linspace(slope_based_maximum - width, slope_based_maximum + width, 101)

dash_3_time = np.linspace(minima_x[-1], slope_based_maximum_time, 101)
dash_3 = np.linspace(minima_y[-1], slope_based_maximum, 101)

s2 = (minima_y[-1] - maxima_y[-1]) / (minima_x[-1] - maxima_x[-1])

slope_based_minimum_time = minima_x[-1] + (minima_x[-1] - minima_x[-2])
slope_based_minimum = slope_based_maximum - (slope_based_maximum_time - slope_based_minimum_time) * s2

min_dash_time_3 = slope_based_minimum_time * np.ones_like(min_dash_1)
min_dash_3 = np.linspace(slope_based_minimum - width, slope_based_minimum + width, 101)

dash_4_time = np.linspace(slope_based_maximum_time, slope_based_minimum_time)
dash_4 = np.linspace(slope_based_maximum, slope_based_minimum)

maxima_dash = np.linspace(2.5 - width, 2.5 + width, 101)
maxima_dash_time_1 = maxima_x[-2] * np.ones_like(maxima_dash)
maxima_dash_time_2 = maxima_x[-1] * np.ones_like(maxima_dash)
maxima_dash_time_3 = slope_based_maximum_time * np.ones_like(maxima_dash)
maxima_line_dash_time = np.linspace(maxima_x[-2], slope_based_maximum_time, 101)
maxima_line_dash = 2.5 * np.ones_like(maxima_line_dash_time)

minima_dash = np.linspace(-3.4 - width, -3.4 + width, 101)
minima_dash_time_1 = minima_x[-2] * np.ones_like(minima_dash)
minima_dash_time_2 = minima_x[-1] * np.ones_like(minima_dash)
minima_dash_time_3 = slope_based_minimum_time * np.ones_like(minima_dash)
minima_line_dash_time = np.linspace(minima_x[-2], slope_based_minimum_time, 101)
minima_line_dash = -3.4 * np.ones_like(minima_line_dash_time)

# slightly edit signal to make difference between slope-based method and improved slope-based method more clear

time_series[time >= minima_x[-1]] = 1.5 * (time_series[time >= minima_x[-1]] - time_series[time == minima_x[-1]]) + \
                                    time_series[time == minima_x[-1]]

improved_slope_based_maximum_time = time[-1]
improved_slope_based_maximum = time_series[-1]

improved_slope_based_minimum_time = slope_based_minimum_time
improved_slope_based_minimum = improved_slope_based_maximum + s2 * (improved_slope_based_minimum_time -
                                                                    improved_slope_based_maximum_time)

min_dash_4 = np.linspace(improved_slope_based_minimum - width, improved_slope_based_minimum + width, 101)
min_dash_time_4 = improved_slope_based_minimum_time * np.ones_like(min_dash_4)

dash_final_time = np.linspace(improved_slope_based_maximum_time, improved_slope_based_minimum_time, 101)
dash_final = np.linspace(improved_slope_based_maximum, improved_slope_based_minimum, 101)

ax = plt.subplot(111)
figure_size = plt.gcf().get_size_inches()
factor = 0.9
plt.gcf().set_size_inches((figure_size[0], factor * figure_size[1]))
plt.gcf().subplots_adjust(bottom=0.10)
plt.plot(time, time_series, LineWidth=2, label='Signal')
plt.title('Slope-Based Edge Effects Example')
plt.plot(max_dash_time_1, max_dash_1, 'k-')
plt.plot(max_dash_time_2, max_dash_2, 'k-')
plt.plot(max_dash_time_3, max_dash_3, 'k-')
plt.plot(min_dash_time_1, min_dash_1, 'k-')
plt.plot(min_dash_time_2, min_dash_2, 'k-')
plt.plot(min_dash_time_3, min_dash_3, 'k-')
plt.plot(min_dash_time_4, min_dash_4, 'k-')
plt.plot(maxima_dash_time_1, maxima_dash, 'k-')
plt.plot(maxima_dash_time_2, maxima_dash, 'k-')
plt.plot(maxima_dash_time_3, maxima_dash, 'k-')
plt.plot(minima_dash_time_1, minima_dash, 'k-')
plt.plot(minima_dash_time_2, minima_dash, 'k-')
plt.plot(minima_dash_time_3, minima_dash, 'k-')
plt.text(4.34 * np.pi, -3.2, r'$\Delta{t^{min}_{m}}$')
plt.text(4.74 * np.pi, -3.2, r'$\Delta{t^{min}_{m}}$')
plt.text(4.12 * np.pi, 2, r'$\Delta{t^{max}_{M}}$')
plt.text(4.50 * np.pi, 2, r'$\Delta{t^{max}_{M}}$')
plt.text(4.30 * np.pi, 0.35, r'$s_1$')
plt.text(4.43 * np.pi, -0.20, r'$s_2$')
plt.text(4.30 * np.pi + (minima_x[-1] - minima_x[-2]), 0.35 + (minima_y[-1] - minima_y[-2]), r'$s_1$')
plt.text(4.43 * np.pi + (slope_based_minimum_time - minima_x[-1]),
         -0.20 + (slope_based_minimum - minima_y[-1]), r'$s_2$')
plt.text(4.50 * np.pi + (slope_based_minimum_time - minima_x[-1]),
         1.20 + (slope_based_minimum - minima_y[-1]), r'$s_2$')
plt.plot(minima_line_dash_time, minima_line_dash, 'k--')
plt.plot(maxima_line_dash_time, maxima_line_dash, 'k--')
plt.plot(dash_1_time, dash_1, 'k--')
plt.plot(dash_2_time, dash_2, 'k--')
plt.plot(dash_3_time, dash_3, 'k--')
plt.plot(dash_4_time, dash_4, 'k--')
plt.plot(dash_final_time, dash_final, 'k--')
plt.scatter(maxima_x, maxima_y, c='r', zorder=4, label='Maxima')
plt.scatter(minima_x, minima_y, c='b', zorder=4, label='Minima')
plt.scatter(slope_based_maximum_time, slope_based_maximum, c='orange', zorder=4,
            label=textwrap.fill('Slope-based maximum', 11))
plt.scatter(slope_based_minimum_time, slope_based_minimum, c='purple', zorder=4,
            label=textwrap.fill('Slope-based minimum', 11))
plt.scatter(improved_slope_based_maximum_time, improved_slope_based_maximum, c='deeppink', zorder=4,
            label=textwrap.fill('Improved slope-based maximum', 11))
plt.scatter(improved_slope_based_minimum_time, improved_slope_based_minimum, c='dodgerblue', zorder=4,
            label=textwrap.fill('Improved slope-based minimum', 11))
plt.xlim(3.9 * np.pi, 5.5 * np.pi)
plt.xticks((4 * np.pi, 5 * np.pi), (r'4$\pi$', r'5$\pi$'))
plt.yticks((-3, -2, -1, 0, 1, 2), ('-3', '-2', '-1', '0', '1', '2'))
box_0 = ax.get_position()
ax.set_position([box_0.x0 - 0.05, box_0.y0, box_0.width * 0.85, box_0.height])
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
plt.savefig('jss_figures/edge_effects_slope_based.png')
plt.show()

# plot 5
a = 0.25
width = 0.2
time = np.linspace(0, (5 - a) * np.pi, 1001)
time_series = np.cos(time) + np.cos(5 * time)
utils = emd_utils.Utility(time=time, time_series=time_series)
max_bool = utils.max_bool_func_1st_order_fd()
maxima_x = time[max_bool]
maxima_y = time_series[max_bool]
min_bool = utils.min_bool_func_1st_order_fd()
minima_x = time[min_bool]
minima_y = time_series[min_bool]

A2 = np.abs(maxima_y[-2] - minima_y[-2]) / 2
A1 = np.abs(maxima_y[-1] - minima_y[-1]) / 2
P2 = 2 * np.abs(maxima_x[-2] - minima_x[-2])
P1 = 2 * np.abs(maxima_x[-1] - minima_x[-1])
Huang_time = (P1 / P2) * (time[time >= maxima_x[-2]] - time[time == maxima_x[-2]]) + maxima_x[-1]
Huang_wave = (A1 / A2) * (time_series[time >= maxima_x[-2]] - time_series[time == maxima_x[-2]]) + maxima_y[-1]

Coughlin_time = Huang_time
Coughlin_wave = A1 * np.cos(2 * np.pi * (1 / P1) * (Coughlin_time - Coughlin_time[0]))

Average_max_time = maxima_x[-1] + (maxima_x[-1] - maxima_x[-2])
Average_max = (maxima_y[-2] + maxima_y[-1]) / 2
Average_min_time = minima_x[-1] + (minima_x[-1] - minima_x[-2])
Average_min = (minima_y[-2] + minima_y[-1]) / 2

utils_Huang = emd_utils.Utility(time=time, time_series=Huang_wave)
Huang_max_bool = utils_Huang.max_bool_func_1st_order_fd()
Huang_min_bool = utils_Huang.min_bool_func_1st_order_fd()
utils_Coughlin = emd_utils.Utility(time=time, time_series=Coughlin_wave)
Coughlin_max_bool = utils_Coughlin.max_bool_func_1st_order_fd()
Coughlin_min_bool = utils_Coughlin.min_bool_func_1st_order_fd()

Huang_max_time = Huang_time[Huang_max_bool]
Huang_max = Huang_wave[Huang_max_bool]
Huang_min_time = Huang_time[Huang_min_bool]
Huang_min = Huang_wave[Huang_min_bool]

Coughlin_max_time = Coughlin_time[Coughlin_max_bool]
Coughlin_max = Coughlin_wave[Coughlin_max_bool]
Coughlin_min_time = Coughlin_time[Coughlin_min_bool]
Coughlin_min = Coughlin_wave[Coughlin_min_bool]

max_2_x_time = np.linspace(maxima_x[-2] - width, maxima_x[-2] + width, 101)
max_2_x_time_side = np.linspace(5.3 * np.pi - width, 5.3 * np.pi + width, 101)
max_2_x = maxima_y[-2] * np.ones_like(max_2_x_time)

min_2_x_time = np.linspace(minima_x[-2] - width, minima_x[-2] + width, 101)
min_2_x_time_side = np.linspace(5.3 * np.pi - width, 5.3 * np.pi + width, 101)
min_2_x = minima_y[-2] * np.ones_like(min_2_x_time)

dash_max_min_2_x = np.linspace(minima_y[-2], maxima_y[-2], 101)
dash_max_min_2_x_time = 5.3 * np.pi * np.ones_like(dash_max_min_2_x)

max_2_y = np.linspace(maxima_y[-2] - width, maxima_y[-2] + width, 101)
max_2_y_side = np.linspace(-1.8 - width, -1.8 + width, 101)
max_2_y_time = maxima_x[-2] * np.ones_like(max_2_y)

min_2_y = np.linspace(minima_y[-2] - width, minima_y[-2] + width, 101)
min_2_y_side = np.linspace(-1.8 - width, -1.8 + width, 101)
min_2_y_time = minima_x[-2] * np.ones_like(min_2_y)

dash_max_min_2_y_time = np.linspace(minima_x[-2], maxima_x[-2], 101)
dash_max_min_2_y = -1.8 * np.ones_like(dash_max_min_2_y_time)

max_1_x_time = np.linspace(maxima_x[-1] - width, maxima_x[-1] + width, 101)
max_1_x_time_side = np.linspace(5.4 * np.pi - width, 5.4 * np.pi + width, 101)
max_1_x = maxima_y[-1] * np.ones_like(max_1_x_time)

min_1_x_time = np.linspace(minima_x[-1] - width, minima_x[-1] + width, 101)
min_1_x_time_side = np.linspace(5.4 * np.pi - width, 5.4 * np.pi + width, 101)
min_1_x = minima_y[-1] * np.ones_like(min_1_x_time)

dash_max_min_1_x = np.linspace(minima_y[-1], maxima_y[-1], 101)
dash_max_min_1_x_time = 5.4 * np.pi * np.ones_like(dash_max_min_1_x)

max_1_y = np.linspace(maxima_y[-1] - width, maxima_y[-1] + width, 101)
max_1_y_side = np.linspace(-2.1 - width, -2.1 + width, 101)
max_1_y_time = maxima_x[-1] * np.ones_like(max_1_y)

min_1_y = np.linspace(minima_y[-1] - width, minima_y[-1] + width, 101)
min_1_y_side = np.linspace(-2.1 - width, -2.1 + width, 101)
min_1_y_time = minima_x[-1] * np.ones_like(min_1_y)

dash_max_min_1_y_time = np.linspace(minima_x[-1], maxima_x[-1], 101)
dash_max_min_1_y = -2.1 * np.ones_like(dash_max_min_1_y_time)

ax = plt.subplot(111)
plt.gcf().subplots_adjust(bottom=0.10)
plt.title('Characteristic Wave Effects Example')
plt.plot(time, time_series, LineWidth=2, label='Signal')
plt.scatter(Huang_max_time, Huang_max, c='magenta', zorder=4, label=textwrap.fill('Huang maximum', 10))
plt.scatter(Huang_min_time, Huang_min, c='lime', zorder=4, label=textwrap.fill('Huang minimum', 10))
plt.scatter(Coughlin_max_time, Coughlin_max, c='darkorange', zorder=4,
            label=textwrap.fill('Coughlin maximum', 14))
plt.scatter(Coughlin_min_time, Coughlin_min, c='dodgerblue', zorder=4,
            label=textwrap.fill('Coughlin minimum', 14))
plt.scatter(Average_max_time, Average_max, c='orangered', zorder=4,
            label=textwrap.fill('Average maximum', 14))
plt.scatter(Average_min_time, Average_min, c='cyan', zorder=4,
            label=textwrap.fill('Average minimum', 14))
plt.scatter(maxima_x, maxima_y, c='r', zorder=4, label='Maxima')
plt.scatter(minima_x, minima_y, c='b', zorder=4, label='Minima')
plt.plot(Huang_time, Huang_wave, '--', c='darkviolet', label=textwrap.fill('Huang Characteristic Wave', 14))
plt.plot(Coughlin_time, Coughlin_wave, '--', c='darkgreen', label=textwrap.fill('Coughlin Characteristic Wave', 14))

plt.plot(max_2_x_time, max_2_x, 'k-')
plt.plot(max_2_x_time_side, max_2_x, 'k-')
plt.plot(min_2_x_time, min_2_x, 'k-')
plt.plot(min_2_x_time_side, min_2_x, 'k-')
plt.plot(dash_max_min_2_x_time, dash_max_min_2_x, 'k--')
plt.text(5.16 * np.pi, 0.85, r'$2a_2$')

plt.plot(max_2_y_time, max_2_y, 'k-')
plt.plot(max_2_y_time, max_2_y_side, 'k-')
plt.plot(min_2_y_time, min_2_y, 'k-')
plt.plot(min_2_y_time, min_2_y_side, 'k-')
plt.plot(dash_max_min_2_y_time, dash_max_min_2_y, 'k--')
plt.text(4.08 * np.pi, -2.2, r'$\frac{p_2}{2}$')

plt.plot(max_1_x_time, max_1_x, 'k-')
plt.plot(max_1_x_time_side, max_1_x, 'k-')
plt.plot(min_1_x_time, min_1_x, 'k-')
plt.plot(min_1_x_time_side, min_1_x, 'k-')
plt.plot(dash_max_min_1_x_time, dash_max_min_1_x, 'k--')
plt.text(5.42 * np.pi, -0.1, r'$2a_1$')

plt.plot(max_1_y_time, max_1_y, 'k-')
plt.plot(max_1_y_time, max_1_y_side, 'k-')
plt.plot(min_1_y_time, min_1_y, 'k-')
plt.plot(min_1_y_time, min_1_y_side, 'k-')
plt.plot(dash_max_min_1_y_time, dash_max_min_1_y, 'k--')
plt.text(4.48 * np.pi, -2.5, r'$\frac{p_1}{2}$')

plt.xlim(3.9 * np.pi, 5.6 * np.pi)
plt.xticks((4 * np.pi, 5 * np.pi), (r'4$\pi$', r'5$\pi$'))
plt.yticks((-2, -1, 0, 1, 2), ('-2', '-1', '0', '1', '2'))

box_0 = ax.get_position()
ax.set_position([box_0.x0 - 0.05, box_0.y0, box_0.width * 0.84, box_0.height])
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
plt.savefig('jss_figures/edge_effects_characteristic_wave.png')
plt.show()

# plot 6
t = np.linspace(5, 95, 100)
signal_orig = np.cos(2 * np.pi * t / 50) + 0.6 * np.cos(2 * np.pi * t / 25) + 0.5 * np.sin(2 * np.pi * t / 200)

util_nn = emd_utils.Utility(time=t, time_series=signal_orig)
maxima = signal_orig[util_nn.max_bool_func_1st_order_fd()]
minima = signal_orig[util_nn.min_bool_func_1st_order_fd()]

cs_max = CubicSpline(t[util_nn.max_bool_func_1st_order_fd()], maxima)
cs_min = CubicSpline(t[util_nn.min_bool_func_1st_order_fd()], minima)

time = np.linspace(0, 5 * np.pi, 1001)
lsq_signal = np.cos(time) + np.cos(5 * time)
knots = np.linspace(0, 5 * np.pi, 101)

time_extended = time_extension(time)
time_series_extended = np.zeros_like(time_extended) / 0
time_series_extended[int(len(lsq_signal) - 1):int(2 * (len(lsq_signal) - 1) + 1)] = lsq_signal

neural_network_m = 200
neural_network_k = 100

# forward ->

P = np.zeros((int(neural_network_k + 1), neural_network_m))
for col in range(neural_network_m):
    P[:-1, col] = lsq_signal[(-(neural_network_m + neural_network_k - col)):(-(neural_network_m - col))]
    P[-1, col] = 1  # for additive constant
t = lsq_signal[-neural_network_m:]

# test - top

seed_weights = np.ones(neural_network_k) / neural_network_k
weights = 0 * seed_weights.copy()

train_input = P[:-1, :]
lr = 0.01

for iterations in range(1000):

    output = np.matmul(weights, train_input)

    error = (t - output)

    gradients = error * (- train_input)

    # guess average gradients
    average_gradients = np.mean(gradients, axis=1)

    # steepest descent
    max_gradient_vector = average_gradients * (np.abs(average_gradients) == max(np.abs(average_gradients)))

    adjustment = - lr * average_gradients
    # adjustment = - lr * max_gradient_vector

    weights += adjustment

# test - bottom

weights_right = np.hstack((weights, 0))

max_count_right = 0
min_count_right = 0
i_right = 0

while ((max_count_right < 1) or (min_count_right < 1)) and (i_right < len(lsq_signal) - 1):

    time_series_extended[int(2 * (len(lsq_signal) - 1) + 1 + i_right)] = \
        sum(weights_right * np.hstack((time_series_extended[
                                       int(2 * (len(lsq_signal) - 1) + 1 - neural_network_k + i_right):
                                       int(2 * (len(lsq_signal) - 1) + 1 + i_right)], 1)))

    i_right += 1

    if i_right > 1:

        emd_utils_max = \
            emd_utils.Utility(time=time_extended[int(2 * (len(lsq_signal) - 1) + 1):
                                                 int(2 * (len(lsq_signal) - 1) + 1 + i_right + 1)],
                              time_series=time_series_extended[int(2 * (len(lsq_signal) - 1) + 1):
                                                               int(2 * (len(lsq_signal) - 1) + 1 + i_right + 1)])

        if sum(emd_utils_max.max_bool_func_1st_order_fd()) > 0:

            max_count_right += 1

        emd_utils_min = \
            emd_utils.Utility(time=time_extended[int(2 * (len(lsq_signal) - 1) + 1):
                                                 int(2 * (len(lsq_signal) - 1) + 1 + i_right + 1)],
                              time_series=time_series_extended[int(2 * (len(lsq_signal) - 1) + 1):
                                                               int(2 * (len(lsq_signal) - 1) + 1 + i_right + 1)])

        if sum(emd_utils_min.min_bool_func_1st_order_fd()) > 0:

            min_count_right += 1

# backward <-

P = np.zeros((int(neural_network_k + 1), neural_network_m))
for col in range(neural_network_m):
    P[:-1, col] = lsq_signal[int(col + 1):int(col + neural_network_k + 1)]
    P[-1, col] = 1  # for additive constant
t = lsq_signal[:neural_network_m]

vx = cvx.Variable(int(neural_network_k + 1))
objective = cvx.Minimize(cvx.norm((2 * (vx * P) + 1 - t), 2))  # linear activation function is arbitrary
prob = cvx.Problem(objective)
result = prob.solve(verbose=True, solver=cvx.ECOS)
weights_left = np.array(vx.value)

max_count_left = 0
min_count_left = 0
i_left = 0

while ((max_count_left < 1) or (min_count_left < 1)) and (i_left < len(lsq_signal) - 1):

    time_series_extended[int(len(lsq_signal) - 2 - i_left)] = \
        2 * sum(weights_left * np.hstack((time_series_extended[int(len(lsq_signal) - 1 - i_left):
                                                               int(len(lsq_signal) - 1 - i_left + neural_network_k)],
                                          1))) + 1

    i_left += 1

    if i_left > 1:

        emd_utils_max = \
            emd_utils.Utility(time=time_extended[int(len(lsq_signal) - 1 - i_left):int(len(lsq_signal))],
                              time_series=time_series_extended[int(len(lsq_signal) - 1 - i_left):int(len(lsq_signal))])

        if sum(emd_utils_max.max_bool_func_1st_order_fd()) > 0:

            max_count_left += 1

        emd_utils_min = \
            emd_utils.Utility(time=time_extended[int(len(lsq_signal) - 1 - i_left):int(len(lsq_signal))],
                              time_series=time_series_extended[int(len(lsq_signal) - 1 - i_left):int(len(lsq_signal))])

        if sum(emd_utils_min.min_bool_func_1st_order_fd()) > 0:

            min_count_left += 1


lsq_utils = emd_utils.Utility(time=time, time_series=lsq_signal)
utils_extended = emd_utils.Utility(time=time_extended, time_series=time_series_extended)

maxima = lsq_signal[lsq_utils.max_bool_func_1st_order_fd()]
maxima_time = time[lsq_utils.max_bool_func_1st_order_fd()]

maxima_extrapolate = time_series_extended[utils_extended.max_bool_func_1st_order_fd()][-1]
maxima_extrapolate_time = time_extended[utils_extended.max_bool_func_1st_order_fd()][-1]

minima = lsq_signal[lsq_utils.min_bool_func_1st_order_fd()]
minima_time = time[lsq_utils.min_bool_func_1st_order_fd()]

minima_extrapolate = time_series_extended[utils_extended.min_bool_func_1st_order_fd()][-2:]
minima_extrapolate_time = time_extended[utils_extended.min_bool_func_1st_order_fd()][-2:]

ax = plt.subplot(111)
plt.gcf().subplots_adjust(bottom=0.10)
plt.title('Single Neuron Neural Network Example')
plt.plot(time, lsq_signal, zorder=2, label='Signal')
plt.plot(time_extended, time_series_extended, c='g', zorder=1, label=textwrap.fill('Extrapolated signal', 12))
plt.scatter(maxima_time, maxima, c='r', zorder=3, label='Maxima')
plt.scatter(minima_time, minima, c='b', zorder=3, label='Minima')
plt.scatter(maxima_extrapolate_time, maxima_extrapolate, c='magenta', zorder=3,
            label=textwrap.fill('Extrapolated maxima', 12))
plt.scatter(minima_extrapolate_time, minima_extrapolate, c='cyan', zorder=4,
            label=textwrap.fill('Extrapolated minima', 12))

plt.plot(((time[-302] + time[-301]) / 2) * np.ones(100), np.linspace(-2.75, 2.75, 100), c='k',
         label=textwrap.fill('Neural network inputs', 13))
plt.plot(np.linspace(((time[-302] + time[-301]) / 2), ((time[-302] + time[-301]) / 2) + 0.1, 100),
         -2.75 * np.ones(100), c='k')
plt.plot(np.linspace(((time[-302] + time[-301]) / 2), ((time[-302] + time[-301]) / 2) + 0.1, 100),
         2.75 * np.ones(100), c='k')
plt.plot(np.linspace(((time_extended[-1001] + time_extended[-1002]) / 2),
                     ((time_extended[-1001] + time_extended[-1002]) / 2) - 0.1, 100), -2.75 * np.ones(100), c='k')
plt.plot(np.linspace(((time_extended[-1001] + time_extended[-1002]) / 2),
                     ((time_extended[-1001] + time_extended[-1002]) / 2) - 0.1, 100), 2.75 * np.ones(100), c='k')
plt.plot(((time_extended[-1001] + time_extended[-1002]) / 2) * np.ones(100), np.linspace(-2.75, 2.75, 100), c='k')

plt.plot(((time[-202] + time[-201]) / 2) * np.ones(100), np.linspace(-2.75, 2.75, 100), c='gray', linestyle='dashed',
         label=textwrap.fill('Neural network targets', 13))
plt.plot(np.linspace(((time[-202] + time[-201]) / 2), ((time[-202] + time[-201]) / 2) + 0.1, 100),
         -2.75 * np.ones(100), c='gray')
plt.plot(np.linspace(((time[-202] + time[-201]) / 2), ((time[-202] + time[-201]) / 2) + 0.1, 100),
         2.75 * np.ones(100), c='gray')
plt.plot(np.linspace(((time_extended[-1001] + time_extended[-1000]) / 2),
                     ((time_extended[-1001] + time_extended[-1000]) / 2) - 0.1, 100), -2.75 * np.ones(100), c='gray')
plt.plot(np.linspace(((time_extended[-1001] + time_extended[-1000]) / 2),
                     ((time_extended[-1001] + time_extended[-1000]) / 2) - 0.1, 100), 2.75 * np.ones(100), c='gray')
plt.plot(((time_extended[-1001] + time_extended[-1000]) / 2) * np.ones(100), np.linspace(-2.75, 2.75, 100), c='gray',
         linestyle='dashed')

plt.xlim(3.4 * np.pi, 5.6 * np.pi)
plt.xticks((4 * np.pi, 5 * np.pi), (r'4$\pi$', r'5$\pi$'))
plt.yticks((-2, -1, 0, 1, 2), ('-2', '-1', '0', '1', '2'))

box_0 = ax.get_position()
ax.set_position([box_0.x0 - 0.05, box_0.y0, box_0.width * 0.84, box_0.height])
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
plt.savefig('jss_figures/neural_network.png')
plt.show()

# plot 6a
np.random.seed(0)

time = np.linspace(0, 5 * np.pi, 1001)
knots_51 = np.linspace(0, 5 * np.pi, 51)
time_series = np.cos(2 * time) + np.cos(4 * time) + np.cos(8 * time)
noise = np.random.normal(0, 1, len(time_series))
time_series += noise

advemdpy = EMD(time=time, time_series=time_series)
imfs_51, hts_51, ifs_51 = advemdpy.empirical_mode_decomposition(knots=knots_51, max_imfs=3,
                                                                edge_effect='symmetric_anchor', verbose=False)[:3]
knots_31 = np.linspace(0, 5 * np.pi, 31)
imfs_31, hts_31, ifs_31 = advemdpy.empirical_mode_decomposition(knots=knots_31, max_imfs=2,
                                                                edge_effect='symmetric_anchor', verbose=False)[:3]
knots_11 = np.linspace(0, 5 * np.pi, 11)
imfs_11, hts_11, ifs_11 = advemdpy.empirical_mode_decomposition(knots=knots_11, max_imfs=1,
                                                                edge_effect='symmetric_anchor', verbose=False)[:3]

fig, axs = plt.subplots(3, 1)
plt.suptitle(textwrap.fill('Comparison of Trends Extracted with Different Knot Sequences', 40))
plt.subplots_adjust(hspace=0.1)
axs[0].plot(time, time_series, label='Time series')
axs[0].plot(time, imfs_51[1, :] + imfs_51[2, :] + imfs_51[3, :], label=textwrap.fill('Sum of IMF 1, IMF 2, & IMF 3 with 51 knots', 21))
print(f'DFA fluctuation with 51 knots: {np.round(np.var(time_series - (imfs_51[1, :] + imfs_51[2, :] + imfs_51[3, :])), 3)}')
for knot in knots_51:
    axs[0].plot(knot * np.ones(101), np.linspace(-5, 5, 101), '--', c='grey', zorder=1)
axs[0].plot(knot * np.ones(101), np.linspace(-5, 5, 101), '--', c='grey', zorder=1, label='Knots')
axs[0].set_xticks([0, np.pi, 2 * np.pi, 3 * np.pi, 4 * np.pi, 5 * np.pi])
axs[0].set_xticklabels(['', '', '', '', '', ''])
axs[0].plot(np.linspace(0.95 * np.pi, 1.55 * np.pi, 101), 5.5 * np.ones(101), 'k--')
axs[0].plot(np.linspace(0.95 * np.pi, 1.55 * np.pi, 101), -5.5 * np.ones(101), 'k--')
axs[0].plot(0.95 * np.pi * np.ones(101), np.linspace(-5.5, 5.5, 101), 'k--')
axs[0].plot(1.55 * np.pi * np.ones(101), np.linspace(-5.5, 5.5, 101), 'k--', label='Zoomed region')
box_0 = axs[0].get_position()
axs[0].set_position([box_0.x0 - 0.05, box_0.y0, box_0.width * 0.85, box_0.height])
axs[0].legend(loc='center left', bbox_to_anchor=(1, 0.5), fontsize=8)

axs[1].plot(time, time_series, label='Time series')
axs[1].plot(time, imfs_31[1, :] + imfs_31[2, :], label=textwrap.fill('Sum of IMF 1 and IMF 2 with 31 knots', 19))
axs[1].plot(time, imfs_51[2, :] + imfs_51[3, :], label=textwrap.fill('Sum of IMF 2 and IMF 3 with 51 knots', 19))
print(f'DFA fluctuation with 31 knots: {np.round(np.var(time_series - (imfs_31[1, :] + imfs_31[2, :])), 3)}')
for knot in knots_31:
    axs[1].plot(knot * np.ones(101), np.linspace(-5, 5, 101), '--', c='grey', zorder=1)
axs[1].plot(knot * np.ones(101), np.linspace(-5, 5, 101), '--', c='grey', zorder=1, label='Knots')
axs[1].set_xticks([0, np.pi, 2 * np.pi, 3 * np.pi, 4 * np.pi, 5 * np.pi])
axs[1].set_xticklabels(['', '', '', '', '', ''])
box_1 = axs[1].get_position()
axs[1].set_position([box_1.x0 - 0.05, box_1.y0, box_1.width * 0.85, box_1.height])
axs[1].legend(loc='center left', bbox_to_anchor=(1, 0.5), fontsize=8)
axs[1].plot(np.linspace(0.95 * np.pi, 1.55 * np.pi, 101), 5.5 * np.ones(101), 'k--')
axs[1].plot(np.linspace(0.95 * np.pi, 1.55 * np.pi, 101), -5.5 * np.ones(101), 'k--')
axs[1].plot(0.95 * np.pi * np.ones(101), np.linspace(-5.5, 5.5, 101), 'k--')
axs[1].plot(1.55 * np.pi * np.ones(101), np.linspace(-5.5, 5.5, 101), 'k--', label='Zoomed region')

axs[2].plot(time, time_series, label='Time series')
axs[2].plot(time, imfs_11[1, :], label='IMF 1 with 11 knots')
axs[2].plot(time, imfs_31[2, :], label='IMF 2 with 31 knots')
axs[2].plot(time, imfs_51[3, :], label='IMF 3 with 51 knots')
print(f'DFA fluctuation with 11 knots: {np.round(np.var(time_series - imfs_51[3, :]), 3)}')
for knot in knots_11:
    axs[2].plot(knot * np.ones(101), np.linspace(-5, 5, 101), '--', c='grey', zorder=1)
axs[2].plot(knot * np.ones(101), np.linspace(-5, 5, 101), '--', c='grey', zorder=1, label='Knots')
axs[2].set_xticks([0, np.pi, 2 * np.pi, 3 * np.pi, 4 * np.pi, 5 * np.pi])
axs[2].set_xticklabels(['$0$', r'$\pi$', r'$2\pi$', r'$3\pi$', r'$4\pi$', r'$5\pi$'])
box_2 = axs[2].get_position()
axs[2].set_position([box_2.x0 - 0.05, box_2.y0, box_2.width * 0.85, box_2.height])
axs[2].legend(loc='center left', bbox_to_anchor=(1, 0.5), fontsize=8)
axs[2].plot(np.linspace(0.95 * np.pi, 1.55 * np.pi, 101), 5.5 * np.ones(101), 'k--')
axs[2].plot(np.linspace(0.95 * np.pi, 1.55 * np.pi, 101), -5.5 * np.ones(101), 'k--')
axs[2].plot(0.95 * np.pi * np.ones(101), np.linspace(-5.5, 5.5, 101), 'k--')
axs[2].plot(1.55 * np.pi * np.ones(101), np.linspace(-5.5, 5.5, 101), 'k--', label='Zoomed region')
plt.savefig('jss_figures/DFA_different_trends.png')
plt.show()

# plot 6b
fig, axs = plt.subplots(3, 1)
plt.suptitle(textwrap.fill('Comparison of Trends Extracted with Different Knot Sequences Zoomed Region', 40))
plt.subplots_adjust(hspace=0.1)
axs[0].plot(time, time_series, label='Time series')
axs[0].plot(time, imfs_51[1, :] + imfs_51[2, :] + imfs_51[3, :], label=textwrap.fill('Sum of IMF 1, IMF 2, & IMF 3 with 51 knots', 21))
for knot in knots_51:
    axs[0].plot(knot * np.ones(101), np.linspace(-5, 5, 101), '--', c='grey', zorder=1)
axs[0].plot(knot * np.ones(101), np.linspace(-5, 5, 101), '--', c='grey', zorder=1, label='Knots')
axs[0].set_xticks([0, np.pi, 2 * np.pi, 3 * np.pi, 4 * np.pi, 5 * np.pi])
axs[0].set_xticklabels(['', '', '', '', '', ''])
box_0 = axs[0].get_position()
axs[0].set_position([box_0.x0 - 0.05, box_0.y0, box_0.width * 0.85, box_0.height])
axs[0].legend(loc='center left', bbox_to_anchor=(1, 0.5), fontsize=8)
axs[0].set_ylim(-5.5, 5.5)
axs[0].set_xlim(0.95 * np.pi, 1.55 * np.pi)

axs[1].plot(time, time_series, label='Time series')
axs[1].plot(time, imfs_31[1, :] + imfs_31[2, :], label=textwrap.fill('Sum of IMF 1 and IMF 2 with 31 knots', 19))
axs[1].plot(time, imfs_51[2, :] + imfs_51[3, :], label=textwrap.fill('Sum of IMF 2 and IMF 3 with 51 knots', 19))
for knot in knots_31:
    axs[1].plot(knot * np.ones(101), np.linspace(-5, 5, 101), '--', c='grey', zorder=1)
axs[1].plot(knot * np.ones(101), np.linspace(-5, 5, 101), '--', c='grey', zorder=1, label='Knots')
axs[1].set_xticks([0, np.pi, 2 * np.pi, 3 * np.pi, 4 * np.pi, 5 * np.pi])
axs[1].set_xticklabels(['', '', '', '', '', ''])
box_1 = axs[1].get_position()
axs[1].set_position([box_1.x0 - 0.05, box_1.y0, box_1.width * 0.85, box_1.height])
axs[1].legend(loc='center left', bbox_to_anchor=(1, 0.5), fontsize=8)
axs[1].set_ylim(-5.5, 5.5)
axs[1].set_xlim(0.95 * np.pi, 1.55 * np.pi)

axs[2].plot(time, time_series, label='Time series')
axs[2].plot(time, imfs_11[1, :], label='IMF 1 with 11 knots')
axs[2].plot(time, imfs_31[2, :], label='IMF 2 with 31 knots')
axs[2].plot(time, imfs_51[3, :], label='IMF 3 with 51 knots')
for knot in knots_11:
    axs[2].plot(knot * np.ones(101), np.linspace(-5, 5, 101), '--', c='grey', zorder=1)
axs[2].plot(knot * np.ones(101), np.linspace(-5, 5, 101), '--', c='grey', zorder=1, label='Knots')
axs[2].set_xticks([np.pi, (3 / 2) * np.pi])
axs[2].set_xticklabels([r'$\pi$', r'$\frac{3}{2}\pi$'])
box_2 = axs[2].get_position()
axs[2].set_position([box_2.x0 - 0.05, box_2.y0, box_2.width * 0.85, box_2.height])
axs[2].legend(loc='center left', bbox_to_anchor=(1, 0.5), fontsize=8)
axs[2].set_ylim(-5.5, 5.5)
axs[2].set_xlim(0.95 * np.pi, 1.55 * np.pi)
plt.savefig('jss_figures/DFA_different_trends_zoomed.png')
plt.show()

hs_ouputs = hilbert_spectrum(time, imfs_51, hts_51, ifs_51, max_frequency=12, plot=False)

# plot 6c
ax = plt.subplot(111)
figure_size = plt.gcf().get_size_inches()
factor = 0.9
plt.gcf().set_size_inches((figure_size[0], factor * figure_size[1]))
plt.title(textwrap.fill('Gaussian Filtered Hilbert Spectrum of Simple Sinusoidal Time Seres with Added Noise', 50))
x_hs, y, z = hs_ouputs
z_min, z_max = 0, np.abs(z).max()
ax.pcolormesh(x_hs, y, np.abs(z), cmap='gist_rainbow', vmin=z_min, vmax=z_max)
ax.plot(x_hs[0, :], 8 * np.ones_like(x_hs[0, :]), '--', label=r'$\omega = 8$', Linewidth=3)
ax.plot(x_hs[0, :], 4 * np.ones_like(x_hs[0, :]), '--', label=r'$\omega = 4$', Linewidth=3)
ax.plot(x_hs[0, :], 2 * np.ones_like(x_hs[0, :]), '--', label=r'$\omega = 2$', Linewidth=3)
ax.set_xticks([0, np.pi, 2 * np.pi, 3 * np.pi, 4 * np.pi])
ax.set_xticklabels(['$0$', r'$\pi$', r'$2\pi$', r'$3\pi$', r'$4\pi$'])
plt.ylabel(r'Frequency (rad.s$^{-1}$)')
plt.xlabel('Time (s)')

box_0 = ax.get_position()
ax.set_position([box_0.x0, box_0.y0 + 0.05, box_0.width * 0.85, box_0.height * 0.9])
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
plt.savefig('jss_figures/DFA_hilbert_spectrum.png')
plt.show()

# plot 6c
time = np.linspace(0, 5 * np.pi, 1001)
time_series = np.cos(time) + np.cos(5 * time)
knots = np.linspace(0, 5 * np.pi, 51)

fluc = Fluctuation(time=time, time_series=time_series)
max_unsmoothed = fluc.envelope_basis_function_approximation(knots_for_envelope=knots, extrema_type='maxima', smooth=False)
max_smoothed = fluc.envelope_basis_function_approximation(knots_for_envelope=knots, extrema_type='maxima', smooth=True)
min_unsmoothed = fluc.envelope_basis_function_approximation(knots_for_envelope=knots, extrema_type='minima', smooth=False)
min_smoothed = fluc.envelope_basis_function_approximation(knots_for_envelope=knots, extrema_type='minima', smooth=True)
util = Utility(time=time, time_series=time_series)
maxima = util.max_bool_func_1st_order_fd()
minima = util.min_bool_func_1st_order_fd()

ax = plt.subplot(111)
plt.gcf().subplots_adjust(bottom=0.10)
plt.title(textwrap.fill('Plot Demonstrating Unsmoothed Extrema Envelopes if Schoenberg–Whitney Conditions are Not Satisfied', 50))
plt.plot(time, time_series, label='Time series', zorder=2, LineWidth=2)
plt.scatter(time[maxima], time_series[maxima], c='r', label='Maxima', zorder=10)
plt.scatter(time[minima], time_series[minima], c='b', label='Minima', zorder=10)
plt.plot(time, max_unsmoothed[0], label=textwrap.fill('Unsmoothed maxima envelope', 10), c='darkorange')
plt.plot(time, max_smoothed[0], label=textwrap.fill('Smoothed maxima envelope', 10), c='red')
plt.plot(time, min_unsmoothed[0], label=textwrap.fill('Unsmoothed minima envelope', 10), c='cyan')
plt.plot(time, min_smoothed[0], label=textwrap.fill('Smoothed minima envelope', 10), c='blue')
for knot in knots[:-1]:
    plt.plot(knot * np.ones(101), np.linspace(-3.0, -2.0, 101), '--', c='grey', zorder=1)
plt.plot(knots[-1] * np.ones(101), np.linspace(-3.0, -2.0, 101), '--', c='grey', label='Knots', zorder=1)
plt.xticks((0, 1 * np.pi, 2 * np.pi, 3 * np.pi, 4 * np.pi, 5 * np.pi),
           (r'$0$', r'$\pi$', r'2$\pi$', r'3$\pi$', r'4$\pi$', r'5$\pi$'))
plt.yticks((-2, -1, 0, 1, 2), ('-2', '-1', '0', '1', '2'))
plt.xlim(-0.25 * np.pi, 5.25 * np.pi)

box_0 = ax.get_position()
ax.set_position([box_0.x0 - 0.05, box_0.y0, box_0.width * 0.84, box_0.height])
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
plt.savefig('jss_figures/Schoenberg_Whitney_Conditions.png')
plt.show()

# plot 7
a = 0.25
width = 0.2
time = np.linspace((0 + a) * np.pi, (5 - a) * np.pi, 1001)
knots = np.linspace((0 + a) * np.pi, (5 - a) * np.pi, 11)
time_series = np.cos(time) + np.cos(5 * time)
utils = emd_utils.Utility(time=time, time_series=time_series)
max_bool = utils.max_bool_func_1st_order_fd()
maxima_x = time[max_bool]
maxima_y = time_series[max_bool]
min_bool = utils.min_bool_func_1st_order_fd()
minima_x = time[min_bool]
minima_y = time_series[min_bool]
inflection_bool = utils.inflection_point()
inflection_x = time[inflection_bool]
inflection_y = time_series[inflection_bool]

fluctuation = emd_mean.Fluctuation(time=time, time_series=time_series)

maxima_envelope = fluctuation.envelope_basis_function_approximation(knots, 'maxima', smooth=False,
                                                                    smoothing_penalty=0.2, edge_effect='none',
                                                                    spline_method='b_spline')[0]
maxima_envelope_smooth = fluctuation.envelope_basis_function_approximation(knots, 'maxima', smooth=True,
                                                                           smoothing_penalty=0.2, edge_effect='none',
                                                                           spline_method='b_spline')[0]

minima_envelope = fluctuation.envelope_basis_function_approximation(knots, 'minima', smooth=False,
                                                                    smoothing_penalty=0.2, edge_effect='none',
                                                                    spline_method='b_spline')[0]
minima_envelope_smooth = fluctuation.envelope_basis_function_approximation(knots, 'minima', smooth=True,
                                                                           smoothing_penalty=0.2, edge_effect='none',
                                                                           spline_method='b_spline')[0]

inflection_points_envelope = fluctuation.direct_detrended_fluctuation_estimation(knots,
                                                                                 smooth=True,
                                                                                 smoothing_penalty=0.2,
                                                                                 technique='inflection_points')[0]

binomial_points_envelope = fluctuation.direct_detrended_fluctuation_estimation(knots,
                                                                               smooth=True,
                                                                               smoothing_penalty=0.2,
                                                                               technique='binomial_average', order=21,
                                                                               increment=20)[0]

derivative_of_lsq = utils.derivative_forward_diff()
derivative_time = time[:-1]
derivative_knots = np.linspace(knots[0], knots[-1], 31)

# change (1) detrended_fluctuation_technique and (2) max_internal_iter and (3) debug (confusing with external debugging)
emd = AdvEMDpy.EMD(time=derivative_time, time_series=derivative_of_lsq)
imf_1_of_derivative = emd.empirical_mode_decomposition(knots=derivative_knots,
                                                       knot_time=derivative_time, text=False, verbose=False)[0][1, :]

utils = emd_utils.Utility(time=time[:-1], time_series=imf_1_of_derivative)
optimal_maxima = np.r_[False, utils.derivative_forward_diff() < 0, False] & \
                 np.r_[utils.zero_crossing() == 1, False]

optimal_minima = np.r_[False, utils.derivative_forward_diff() > 0, False] & \
                 np.r_[utils.zero_crossing() == 1, False]

EEMD_maxima_envelope = fluctuation.envelope_basis_function_approximation_fixed_points(knots, 'maxima',
                                                                                      optimal_maxima,
                                                                                      optimal_minima,
                                                                                      smooth=False,
                                                                                      smoothing_penalty=0.2,
                                                                                      edge_effect='none')[0]

EEMD_minima_envelope = fluctuation.envelope_basis_function_approximation_fixed_points(knots, 'minima',
                                                                                      optimal_maxima,
                                                                                      optimal_minima,
                                                                                      smooth=False,
                                                                                      smoothing_penalty=0.2,
                                                                                      edge_effect='none')[0]

ax = plt.subplot(111)
plt.gcf().subplots_adjust(bottom=0.10)
plt.title('Detrended Fluctuation Analysis Examples')
plt.plot(time, time_series, LineWidth=2, label='Time series')
plt.scatter(maxima_x, maxima_y, c='r', zorder=4, label='Maxima')
plt.scatter(minima_x, minima_y, c='b', zorder=4, label='Minima')
plt.scatter(time[optimal_maxima], time_series[optimal_maxima], c='darkred', zorder=4,
            label=textwrap.fill('Optimal maxima', 10))
plt.scatter(time[optimal_minima], time_series[optimal_minima], c='darkblue', zorder=4,
            label=textwrap.fill('Optimal minima', 10))
plt.scatter(inflection_x, inflection_y, c='magenta', zorder=4, label=textwrap.fill('Inflection points', 10))
plt.plot(time, maxima_envelope, c='darkblue', label=textwrap.fill('EMD envelope', 10))
plt.plot(time, minima_envelope, c='darkblue')
plt.plot(time, (maxima_envelope + minima_envelope) / 2, c='darkblue')
plt.plot(time, maxima_envelope_smooth, c='darkred', label=textwrap.fill('SEMD envelope', 10))
plt.plot(time, minima_envelope_smooth, c='darkred')
plt.plot(time, (maxima_envelope_smooth + minima_envelope_smooth) / 2, c='darkred')
plt.plot(time, EEMD_maxima_envelope, c='darkgreen', label=textwrap.fill('EEMD envelope', 10))
plt.plot(time, EEMD_minima_envelope, c='darkgreen')
plt.plot(time, (EEMD_maxima_envelope + EEMD_minima_envelope) / 2, c='darkgreen')
plt.plot(time, inflection_points_envelope, c='darkorange', label=textwrap.fill('Inflection point envelope', 10))
plt.plot(time, binomial_points_envelope, c='deeppink', label=textwrap.fill('Binomial average envelope', 10))
plt.plot(time, np.cos(time), c='black', label='True mean')

plt.xticks((0, 1 * np.pi, 2 * np.pi, 3 * np.pi, 4 * np.pi, 5 * np.pi), (r'$0$', r'$\pi$', r'2$\pi$', r'3$\pi$',
                                                                        r'4$\pi$', r'5$\pi$'))
plt.yticks((-2, -1, 0, 1, 2), ('-2', '-1', '0', '1', '2'))
plt.xlim(-0.25 * np.pi, 5.25 * np.pi)

box_0 = ax.get_position()
ax.set_position([box_0.x0 - 0.05, box_0.y0, box_0.width * 0.84, box_0.height])
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
plt.savefig('jss_figures/detrended_fluctuation_analysis.png')
plt.show()

# Duffing Equation Example


def duffing_equation(xy, ts):
    gamma = 0.1
    epsilon = 1
    omega = ((2 * np.pi) / 25)
    return [xy[1], xy[0] - epsilon * xy[0] ** 3 + gamma * np.cos(omega * ts)]


t = np.linspace(0, 150, 1501)
XY0 = [1, 1]
solution = odeint(duffing_equation, XY0, t)
x = solution[:, 0]
dxdt = solution[:, 1]

x_points = [0, 50, 100, 150]
x_names = {0, 50, 100, 150}
y_points_1 = [-2, 0, 2]
y_points_2 = [-1, 0, 1]

fig, axs = plt.subplots(2, 1)
plt.subplots_adjust(hspace=0.2)
axs[0].plot(t, x)
axs[0].set_title('Duffing Equation Displacement')
axs[0].set_ylim([-2, 2])
axs[0].set_xlim([0, 150])

axs[1].plot(t, dxdt)
axs[1].set_title('Duffing Equation Velocity')
axs[1].set_ylim([-1.5, 1.5])
axs[1].set_xlim([0, 150])

axis = 0
for ax in axs.flat:
    ax.label_outer()
    if axis == 0:
        ax.set_ylabel('x(t)')
        ax.set_yticks(y_points_1)
    if axis == 1:
        ax.set_ylabel(r'$ \dfrac{dx(t)}{dt} $')
        ax.set(xlabel='t')
        ax.set_yticks(y_points_2)
    ax.set_xticks(x_points)
    ax.set_xticklabels(x_names)
    axis += 1
plt.savefig('jss_figures/Duffing_equation.png')
plt.show()

# compare other packages Duffing - top

pyemd = pyemd0215()
py_emd = pyemd(x)
IP, IF, IA = emd040.spectra.frequency_transform(py_emd.T, 10, 'hilbert')
freq_edges, freq_bins = emd040.spectra.define_hist_bins(0, 0.2, 100)
hht = emd040.spectra.hilberthuang(IF, IA, freq_edges)
hht = gaussian_filter(hht, sigma=1)
ax = plt.subplot(111)
figure_size = plt.gcf().get_size_inches()
factor = 1.0
plt.gcf().set_size_inches((figure_size[0], factor * figure_size[1]))
plt.title(textwrap.fill('Gaussian Filtered Hilbert Spectrum of Duffing Equation using PyEMD 0.2.10', 40))
plt.pcolormesh(t, freq_bins, hht, cmap='gist_rainbow', vmin=0, vmax=np.max(np.max(np.abs(hht))))
plt.plot(t[:-1], 0.124 * np.ones_like(t[:-1]), '--', label=textwrap.fill('Hamiltonian frequency approximation', 15))
plt.plot(t[:-1], 0.04 * np.ones_like(t[:-1]), 'g--', label=textwrap.fill('Driving function frequency', 15))
plt.xticks([0, 50, 100, 150])
plt.yticks([0, 0.1, 0.2])
plt.ylabel('Frequency (Hz)')
plt.xlabel('Time (s)')

box_0 = ax.get_position()
ax.set_position([box_0.x0, box_0.y0 + 0.05, box_0.width * 0.75, box_0.height * 0.9])
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
plt.savefig('jss_figures/Duffing_equation_ht_pyemd.png')
plt.show()

plt.show()

emd_sift = emd040.sift.sift(x)
IP, IF, IA = emd040.spectra.frequency_transform(emd_sift, 10, 'hilbert')
freq_edges, freq_bins = emd040.spectra.define_hist_bins(0, 0.2, 100)
hht = emd040.spectra.hilberthuang(IF, IA, freq_edges)
hht = gaussian_filter(hht, sigma=1)
ax = plt.subplot(111)
figure_size = plt.gcf().get_size_inches()
factor = 1.0
plt.gcf().set_size_inches((figure_size[0], factor * figure_size[1]))
plt.title(textwrap.fill('Gaussian Filtered Hilbert Spectrum of Duffing Equation using emd 0.3.3', 40))
plt.pcolormesh(t, freq_bins, hht, cmap='gist_rainbow', vmin=0, vmax=np.max(np.max(np.abs(hht))))
plt.plot(t[:-1], 0.124 * np.ones_like(t[:-1]), '--', label=textwrap.fill('Hamiltonian frequency approximation', 15))
plt.plot(t[:-1], 0.04 * np.ones_like(t[:-1]), 'g--', label=textwrap.fill('Driving function frequency', 15))
plt.xticks([0, 50, 100, 150])
plt.yticks([0, 0.1, 0.2])
plt.ylabel('Frequency (Hz)')
plt.xlabel('Time (s)')

box_0 = ax.get_position()
ax.set_position([box_0.x0, box_0.y0 + 0.05, box_0.width * 0.75, box_0.height * 0.9])
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
plt.savefig('jss_figures/Duffing_equation_ht_emd.png')
plt.show()

# compare other packages Duffing - bottom

emd_duffing = AdvEMDpy.EMD(time=t, time_series=x)
emd_duff, emd_ht_duff, emd_if_duff, _, _, _, _ = emd_duffing.empirical_mode_decomposition(verbose=False)

fig, axs = plt.subplots(2, 1)
plt.subplots_adjust(hspace=0.3)
figure_size = plt.gcf().get_size_inches()
factor = 0.8
plt.gcf().set_size_inches((figure_size[0], factor * figure_size[1]))
axs[0].plot(t, emd_duff[1, :], label='AdvEMDpy')
axs[0].plot(t, py_emd[0, :], '--', label='PyEMD 0.2.10')
axs[0].plot(t, emd_sift[:, 0], '--', label='emd 0.3.3')
axs[0].set_title('IMF 1')
axs[0].set_ylim([-2, 2])
axs[0].set_xlim([0, 150])

axs[1].plot(t, emd_duff[2, :], label='AdvEMDpy')
print(f'AdvEMDpy driving function error: {np.round(sum(abs(0.1 * np.cos(0.04 * 2 * np.pi * t) - emd_duff[2, :])), 3)}')
axs[1].plot(t, py_emd[1, :], '--', label='PyEMD 0.2.10')
print(f'PyEMD driving function error: {np.round(sum(abs(0.1 * np.cos(0.04 * 2 * np.pi * t) - py_emd[1, :])), 3)}')
axs[1].plot(t, emd_sift[:, 1], '--', label='emd 0.3.3')
print(f'emd driving function error: {np.round(sum(abs(0.1 * np.cos(0.04 * 2 * np.pi * t) - emd_sift[:, 1])), 3)}')
axs[1].plot(t, 0.1 * np.cos(0.04 * 2 * np.pi * t), '--', label=r'$0.1$cos$(0.08{\pi}t)$')
axs[1].set_title('IMF 2')
axs[1].set_ylim([-0.2, 0.4])
axs[1].set_xlim([0, 150])

axis = 0
for ax in axs.flat:
    ax.label_outer()
    if axis == 0:
        ax.set_ylabel(r'$\gamma_1(t)$')
        ax.set_yticks([-2, 0, 2])
    if axis == 1:
        ax.set_ylabel(r'$\gamma_2(t)$')
        ax.set_yticks([-0.2, 0, 0.2])
    box_0 = ax.get_position()
    ax.set_position([box_0.x0, box_0.y0, box_0.width * 0.85, box_0.height])
    ax.legend(loc='center left', bbox_to_anchor=(1, 0.5), fontsize=8)
    ax.set_xticks(x_points)
    ax.set_xticklabels(x_names)
    axis += 1
plt.savefig('jss_figures/Duffing_equation_imfs.png')
plt.show()

hs_ouputs = hilbert_spectrum(t, emd_duff, emd_ht_duff, emd_if_duff, max_frequency=1.3, plot=False)

ax = plt.subplot(111)
plt.title(textwrap.fill('Gaussian Filtered Hilbert Spectrum of Duffing Equation using AdvEMDpy', 40))
x, y, z = hs_ouputs
y = y / (2 * np.pi)
z_min, z_max = 0, np.abs(z).max()
figure_size = plt.gcf().get_size_inches()
factor = 1.0
plt.gcf().set_size_inches((figure_size[0], factor * figure_size[1]))
ax.pcolormesh(x, y, np.abs(z), cmap='gist_rainbow', vmin=z_min, vmax=z_max)
plt.plot(t[:-1], 0.124 * np.ones_like(t[:-1]), '--', label=textwrap.fill('Hamiltonian frequency approximation', 15))
plt.plot(t[:-1], 0.04 * np.ones_like(t[:-1]), 'g--', label=textwrap.fill('Driving function frequency', 15))
plt.xticks([0, 50, 100, 150])
plt.yticks([0, 0.1, 0.2])
plt.ylabel('Frequency (Hz)')
plt.xlabel('Time (s)')

box_0 = ax.get_position()
ax.set_position([box_0.x0, box_0.y0 + 0.05, box_0.width * 0.75, box_0.height * 0.9])
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
plt.savefig('jss_figures/Duffing_equation_ht.png')
plt.show()

# Carbon Dioxide Concentration Example

CO2_data = pd.read_csv('Data/co2_mm_mlo.csv', header=51)

plt.plot(CO2_data['month'], CO2_data['decimal date'])
plt.title(textwrap.fill('Mean Monthly Concentration of Carbon Dioxide in the Atmosphere', 35))
plt.ylabel('Parts per million')
plt.xlabel('Time (years)')
plt.savefig('jss_figures/CO2_concentration.png')
plt.show()

signal = CO2_data['decimal date']
signal = np.asarray(signal)
time = CO2_data['month']
time = np.asarray(time)

# compare other packages Carbon Dioxide - top

pyemd = pyemd0215()
py_emd = pyemd(signal)
IP, IF, IA = emd040.spectra.frequency_transform(py_emd[:2, :].T, 12, 'hilbert')
print(f'PyEMD annual frequency error: {np.round(sum(np.abs(IF[:, 0] - np.ones_like(IF[:, 0]))), 3)}')
freq_edges, freq_bins = emd040.spectra.define_hist_bins(0, 2, 100)
hht = emd040.spectra.hilberthuang(IF, IA, freq_edges)
hht = gaussian_filter(hht, sigma=1)
fig, ax = plt.subplots()
figure_size = plt.gcf().get_size_inches()
factor = 0.8
plt.gcf().set_size_inches((figure_size[0], factor * figure_size[1]))
plt.title(textwrap.fill('Gaussian Filtered Hilbert Spectrum of CO$_{2}$ Concentration using PyEMD 0.2.10', 45))
plt.ylabel('Frequency (year$^{-1}$)')
plt.xlabel('Time (years)')
plt.pcolormesh(time, freq_bins, hht, cmap='gist_rainbow', vmin=0, vmax=np.max(np.max(np.abs(hht))))
plt.plot(time, np.ones_like(time), 'k--', label=textwrap.fill('Annual cycle', 10))
box_0 = ax.get_position()
ax.set_position([box_0.x0 + 0.0125, box_0.y0 + 0.075, box_0.width * 0.8, box_0.height * 0.9])
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
plt.savefig('jss_figures/CO2_Hilbert_pyemd.png')
plt.show()

emd_sift = emd040.sift.sift(signal)
IP, IF, IA = emd040.spectra.frequency_transform(emd_sift[:, :1], 12, 'hilbert')
print(f'emd annual frequency error: {np.round(sum(np.abs(IF - np.ones_like(IF)))[0], 3)}')
freq_edges, freq_bins = emd040.spectra.define_hist_bins(0, 2, 100)
hht = emd040.spectra.hilberthuang(IF, IA, freq_edges)
hht = gaussian_filter(hht, sigma=1)
fig, ax = plt.subplots()
figure_size = plt.gcf().get_size_inches()
factor = 0.8
plt.gcf().set_size_inches((figure_size[0], factor * figure_size[1]))
plt.title(textwrap.fill('Gaussian Filtered Hilbert Spectrum of CO$_{2}$ Concentration using emd 0.3.3', 45))
plt.ylabel('Frequency (year$^{-1}$)')
plt.xlabel('Time (years)')
plt.pcolormesh(time, freq_bins, hht, cmap='gist_rainbow', vmin=0, vmax=np.max(np.max(np.abs(hht))))
plt.plot(time, np.ones_like(time), 'k--', label=textwrap.fill('Annual cycle', 10))
box_0 = ax.get_position()
ax.set_position([box_0.x0 + 0.0125, box_0.y0 + 0.075, box_0.width * 0.8, box_0.height * 0.9])
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
plt.savefig('jss_figures/CO2_Hilbert_emd.png')
plt.show()

# compare other packages Carbon Dioxide - bottom

knots = np.linspace(time[0], time[-1], 200)

emd_example = AdvEMDpy.EMD(time=time, time_series=signal)

imfs, hts, ifs, _, _, _, _ = \
    emd_example.empirical_mode_decomposition(knots=knots, knot_time=time, verbose=False)
print(f'AdvEMDpy annual frequency error: {np.round(sum(np.abs(ifs[1, :] / (2 * np.pi) - np.ones_like(ifs[1, :]))), 3)}')

fig, axs = plt.subplots(2, 2)
plt.subplots_adjust(hspace=0.5)
axs[0, 0].plot(time, signal)
axs[0, 1].plot(time, signal)
axs[0, 1].plot(time, imfs[0, :], label='Smoothed')
axs[0, 1].legend(loc='lower right')
axs[1, 0].plot(time, imfs[1, :])
axs[1, 1].plot(time, imfs[2, :])

axis = 0
for ax in axs.flat:
    if axis == 0:
        ax.set(ylabel=R'C0$_2$ concentration')
    if axis == 1:
        pass
    if axis == 2:
        ax.set(ylabel=R'C0$_2$ concentration')
        ax.set(xlabel='Time (years)')
    if axis == 3:
        ax.set(xlabel='Time (years)')
    axis += 1

plt.gcf().subplots_adjust(bottom=0.15)

axs[0, 0].set_title(r'Original CO$_2$ Concentration')
axs[0, 1].set_title('Smoothed CO$_2$ Concentration')
axs[1, 0].set_title('IMF 1')
axs[1, 1].set_title('Residual')

plt.gcf().subplots_adjust(bottom=0.15)
plt.savefig('jss_figures/CO2_EMD.png')
plt.show()

hs_ouputs = hilbert_spectrum(time, imfs, hts, ifs, max_frequency=10, which_imfs=[1], plot=False)

x_hs, y, z = hs_ouputs
y = y / (2 * np.pi)

z_min, z_max = 0, np.abs(z).max()
fig, ax = plt.subplots()
figure_size = plt.gcf().get_size_inches()
factor = 0.7
plt.gcf().set_size_inches((figure_size[0], factor * figure_size[1]))
ax.pcolormesh(x_hs, y, np.abs(z), cmap='gist_rainbow', vmin=z_min, vmax=z_max)
ax.set_title(textwrap.fill(r'Gaussian Filtered Hilbert Spectrum of CO$_{2}$ Concentration using AdvEMDpy', 40))
plt.ylabel('Frequency (year$^{-1}$)')
plt.xlabel('Time (years)')
plt.plot(x_hs[0, :], np.ones_like(x_hs[0, :]), 'k--', label=textwrap.fill('Annual cycle', 10))
ax.axis([x_hs.min(), x_hs.max(), y.min(), y.max()])

box_0 = ax.get_position()
ax.set_position([box_0.x0 + 0.0125, box_0.y0 + 0.075, box_0.width * 0.8, box_0.height * 0.9])
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
plt.savefig('jss_figures/CO2_Hilbert.png')
plt.show()

[((670, 695), 'seaborn.set', 'sns.set', ([], {'style': '"""darkgrid"""'}), "(style='darkgrid')\n", (677, 695), True, 'import seaborn as sns\n'), ((715, 746), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', '(1001)'], {}), '(0, 2 * np.pi, 1001)\n', (726, 746), True, 'import numpy as np\n'), ((841, 906), 'emd_utils.Utility', 'Utility', ([], {'time': 'pseudo_alg_time', 'time_series': 'pseudo_alg_time_series'}), '(time=pseudo_alg_time, time_series=pseudo_alg_time_series)\n', (848, 906), False, 'from emd_utils import time_extension, Utility\n'), ((934, 960), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(9, 4)'}), '(figsize=(9, 4))\n', (944, 960), True, 'import matplotlib.pyplot as plt\n'), ((966, 982), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(111)'], {}), '(111)\n', (977, 982), True, 'import matplotlib.pyplot as plt\n'), ((1022, 1071), 'matplotlib.pyplot.title', 'plt.title', (['"""First Iteration of Sifting Algorithm"""'], {}), "('First Iteration of Sifting Algorithm')\n", (1031, 1071), True, 'import matplotlib.pyplot as plt\n'), ((1072, 1159), 'matplotlib.pyplot.plot', 'plt.plot', (['pseudo_alg_time', 'pseudo_alg_time_series'], {'label': '"""$h_{(1,0)}(t)$"""', 'zorder': '(1)'}), "(pseudo_alg_time, pseudo_alg_time_series, label='$h_{(1,0)}(t)$',\n    zorder=1)\n", (1080, 1159), True, 'import matplotlib.pyplot as plt\n'), ((1899, 1934), 'matplotlib.pyplot.yticks', 'plt.yticks', ([], {'ticks': '[-2, -1, 0, 1, 2]'}), '(ticks=[-2, -1, 0, 1, 2])\n', (1909, 1934), True, 'import matplotlib.pyplot as plt\n'), ((1935, 2009), 'matplotlib.pyplot.xticks', 'plt.xticks', ([], {'ticks': '[0, np.pi, 2 * np.pi]', 'labels': "['0', '$\\\\pi$', '$2\\\\pi$']"}), "(ticks=[0, np.pi, 2 * np.pi], labels=['0', '$\\\\pi$', '$2\\\\pi$'])\n", (1945, 2009), True, 'import matplotlib.pyplot as plt\n'), ((2181, 2228), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/pseudo_algorithm.png"""'], {}), "('jss_figures/pseudo_algorithm.png')\n", (2192, 2228), True, 'import matplotlib.pyplot as plt\n'), ((2229, 2239), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2237, 2239), True, 'import matplotlib.pyplot as plt\n'), ((2249, 2262), 'numpy.arange', 'np.arange', (['(12)'], {}), '(12)\n', (2258, 2262), True, 'import numpy as np\n'), ((2270, 2294), 'numpy.linspace', 'np.linspace', (['(0)', '(11)', '(1101)'], {}), '(0, 11, 1101)\n', (2281, 2294), True, 'import numpy as np\n'), ((2304, 2348), 'emd_basis.Basis', 'emd_basis.Basis', ([], {'time': 'time', 'time_series': 'time'}), '(time=time, time_series=time)\n', (2319, 2348), False, 'import emd_basis\n'), ((2441, 2498), 'matplotlib.pyplot.title', 'plt.title', (['"""Non-Natural Cubic B-Spline Bases at Boundary"""'], {}), "('Non-Natural Cubic B-Spline Bases at Boundary')\n", (2450, 2498), True, 'import matplotlib.pyplot as plt\n'), ((2499, 2584), 'matplotlib.pyplot.plot', 'plt.plot', (['time[500:]', 'b_spline_basis[(2), 500:].T', '"""--"""'], {'label': '"""$ B_{-3,4}(t) $"""'}), "(time[500:], b_spline_basis[(2), 500:].T, '--', label='$ B_{-3,4}(t) $'\n    )\n", (2507, 2584), True, 'import matplotlib.pyplot as plt\n'), ((2579, 2664), 'matplotlib.pyplot.plot', 'plt.plot', (['time[500:]', 'b_spline_basis[(3), 500:].T', '"""--"""'], {'label': '"""$ B_{-2,4}(t) $"""'}), "(time[500:], b_spline_basis[(3), 500:].T, '--', label='$ B_{-2,4}(t) $'\n    )\n", (2587, 2664), True, 'import matplotlib.pyplot as plt\n'), ((2659, 2744), 'matplotlib.pyplot.plot', 'plt.plot', (['time[500:]', 'b_spline_basis[(4), 500:].T', '"""--"""'], {'label': '"""$ B_{-1,4}(t) $"""'}), "(time[500:], b_spline_basis[(4), 500:].T, '--', label='$ B_{-1,4}(t) $'\n    )\n", (2667, 2744), True, 'import matplotlib.pyplot as plt\n'), ((2739, 2818), 'matplotlib.pyplot.plot', 'plt.plot', (['time[500:]', 'b_spline_basis[(5), 500:].T', '"""--"""'], {'label': '"""$ B_{0,4}(t) $"""'}), "(time[500:], b_spline_basis[(5), 500:].T, '--', label='$ B_{0,4}(t) $')\n", (2747, 2818), True, 'import matplotlib.pyplot as plt\n'), ((2818, 2897), 'matplotlib.pyplot.plot', 'plt.plot', (['time[500:]', 'b_spline_basis[(6), 500:].T', '"""--"""'], {'label': '"""$ B_{1,4}(t) $"""'}), "(time[500:], b_spline_basis[(6), 500:].T, '--', label='$ B_{1,4}(t) $')\n", (2826, 2897), True, 'import matplotlib.pyplot as plt\n'), ((2897, 2947), 'matplotlib.pyplot.xticks', 'plt.xticks', (['[5, 6]', "['$ \\\\tau_0 $', '$ \\\\tau_1 $']"], {}), "([5, 6], ['$ \\\\tau_0 $', '$ \\\\tau_1 $'])\n", (2907, 2947), True, 'import matplotlib.pyplot as plt\n'), ((2948, 2966), 'matplotlib.pyplot.xlim', 'plt.xlim', (['(4.4)', '(6.6)'], {}), '(4.4, 6.6)\n', (2956, 2966), True, 'import matplotlib.pyplot as plt\n'), ((3091, 3119), 'matplotlib.pyplot.legend', 'plt.legend', ([], {'loc': '"""upper left"""'}), "(loc='upper left')\n", (3101, 3119), True, 'import matplotlib.pyplot as plt\n'), ((3120, 3165), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/boundary_bases.png"""'], {}), "('jss_figures/boundary_bases.png')\n", (3131, 3165), True, 'import matplotlib.pyplot as plt\n'), ((3166, 3176), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (3174, 3176), True, 'import matplotlib.pyplot as plt\n'), ((3223, 3254), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', '(1001)'], {}), '(0, 2 * np.pi, 1001)\n', (3234, 3254), True, 'import numpy as np\n'), ((3368, 3397), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', '(51)'], {}), '(0, 2 * np.pi, 51)\n', (3379, 3397), True, 'import numpy as np\n'), ((3404, 3477), 'AdvEMDpy.EMD', 'EMD', ([], {'time': 'knot_demonstrate_time', 'time_series': 'knot_demonstrate_time_series'}), '(time=knot_demonstrate_time, time_series=knot_demonstrate_time_series)\n', (3407, 3477), False, 'from AdvEMDpy import EMD\n'), ((3599, 3617), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(3)', '(1)'], {}), '(3, 1)\n', (3611, 3617), True, 'import matplotlib.pyplot as plt\n'), ((4975, 5018), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/knot_uniform.png"""'], {}), "('jss_figures/knot_uniform.png')\n", (4986, 5018), True, 'import matplotlib.pyplot as plt\n'), ((5019, 5029), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (5027, 5029), True, 'import matplotlib.pyplot as plt\n'), ((5076, 5107), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', '(1001)'], {}), '(0, 2 * np.pi, 1001)\n', (5087, 5107), True, 'import numpy as np\n'), ((5211, 5284), 'AdvEMDpy.EMD', 'EMD', ([], {'time': 'knot_demonstrate_time', 'time_series': 'knot_demonstrate_time_series'}), '(time=knot_demonstrate_time, time_series=knot_demonstrate_time_series)\n', (5214, 5284), False, 'from AdvEMDpy import EMD\n'), ((5484, 5502), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(3)', '(1)'], {}), '(3, 1)\n', (5496, 5502), True, 'import matplotlib.pyplot as plt\n'), ((6859, 6896), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/knot_1.png"""'], {}), "('jss_figures/knot_1.png')\n", (6870, 6896), True, 'import matplotlib.pyplot as plt\n'), ((6897, 6907), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (6905, 6907), True, 'import matplotlib.pyplot as plt\n'), ((6954, 6985), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', '(1001)'], {}), '(0, 2 * np.pi, 1001)\n', (6965, 6985), True, 'import numpy as np\n'), ((7089, 7162), 'AdvEMDpy.EMD', 'EMD', ([], {'time': 'knot_demonstrate_time', 'time_series': 'knot_demonstrate_time_series'}), '(time=knot_demonstrate_time, time_series=knot_demonstrate_time_series)\n', (7092, 7162), False, 'from AdvEMDpy import EMD\n'), ((7362, 7380), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(3)', '(1)'], {}), '(3, 1)\n', (7374, 7380), True, 'import matplotlib.pyplot as plt\n'), ((8735, 8772), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/knot_2.png"""'], {}), "('jss_figures/knot_2.png')\n", (8746, 8772), True, 'import matplotlib.pyplot as plt\n'), ((8773, 8783), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (8781, 8783), True, 'import matplotlib.pyplot as plt\n'), ((8829, 8847), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(1)'], {}), '(2, 1)\n', (8841, 8847), True, 'import matplotlib.pyplot as plt\n'), ((9173, 9190), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (9187, 9190), True, 'import numpy as np\n'), ((9191, 9205), 'random.seed', 'random.seed', (['(1)'], {}), '(1)\n', (9202, 9205), False, 'import random\n'), ((9414, 9482), 'emd_preprocess.Preprocess', 'Preprocess', ([], {'time': 'preprocess_time', 'time_series': 'preprocess_time_series'}), '(time=preprocess_time, time_series=preprocess_time_series)\n', (9424, 9482), False, 'from emd_preprocess import Preprocess\n'), ((12457, 12505), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/preprocess_filter.png"""'], {}), "('jss_figures/preprocess_filter.png')\n", (12468, 12505), True, 'import matplotlib.pyplot as plt\n'), ((12506, 12516), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (12514, 12516), True, 'import matplotlib.pyplot as plt\n'), ((12550, 12568), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(1)'], {}), '(2, 1)\n', (12562, 12568), True, 'import matplotlib.pyplot as plt\n'), ((15319, 15367), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/preprocess_smooth.png"""'], {}), "('jss_figures/preprocess_smooth.png')\n", (15330, 15367), True, 'import matplotlib.pyplot as plt\n'), ((15368, 15378), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (15376, 15378), True, 'import matplotlib.pyplot as plt\n'), ((15400, 15431), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(2)'], {'sharey': '(True)'}), '(1, 2, sharey=True)\n', (15412, 15431), True, 'import matplotlib.pyplot as plt\n'), ((16474, 16520), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/comparing_bases.png"""'], {}), "('jss_figures/comparing_bases.png')\n", (16485, 16520), True, 'import matplotlib.pyplot as plt\n'), ((16521, 16531), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (16529, 16531), True, 'import matplotlib.pyplot as plt\n'), ((16570, 16607), 'numpy.linspace', 'np.linspace', (['(0)', '((5 - a) * np.pi)', '(1001)'], {}), '(0, (5 - a) * np.pi, 1001)\n', (16581, 16607), True, 'import numpy as np\n'), ((16662, 16715), 'emd_utils.Utility', 'emd_utils.Utility', ([], {'time': 'time', 'time_series': 'time_series'}), '(time=time, time_series=time_series)\n', (16679, 16715), False, 'import emd_utils\n'), ((16942, 17002), 'numpy.linspace', 'np.linspace', (['(maxima_x[-1] - width)', '(maxima_x[-1] + width)', '(101)'], {}), '(maxima_x[-1] - width, maxima_x[-1] + width, 101)\n', (16953, 17002), True, 'import numpy as np\n'), ((17073, 17133), 'numpy.linspace', 'np.linspace', (['(minima_x[-1] - width)', '(minima_x[-1] + width)', '(101)'], {}), '(minima_x[-1] - width, minima_x[-1] + width, 101)\n', (17084, 17133), True, 'import numpy as np\n'), ((17202, 17246), 'numpy.linspace', 'np.linspace', (['maxima_x[-1]', 'minima_x[-1]', '(101)'], {}), '(maxima_x[-1], minima_x[-1], 101)\n', (17213, 17246), True, 'import numpy as np\n'), ((17256, 17300), 'numpy.linspace', 'np.linspace', (['maxima_y[-1]', 'minima_y[-1]', '(101)'], {}), '(maxima_y[-1], minima_y[-1], 101)\n', (17267, 17300), True, 'import numpy as np\n'), ((17415, 17483), 'numpy.linspace', 'np.linspace', (['(max_discard_time - width)', '(max_discard_time + width)', '(101)'], {}), '(max_discard_time - width, max_discard_time + width, 101)\n', (17426, 17483), True, 'import numpy as np\n'), ((17567, 17615), 'numpy.linspace', 'np.linspace', (['minima_x[-1]', 'max_discard_time', '(101)'], {}), '(minima_x[-1], max_discard_time, 101)\n', (17578, 17615), True, 'import numpy as np\n'), ((17625, 17668), 'numpy.linspace', 'np.linspace', (['minima_y[-1]', 'max_discard', '(101)'], {}), '(minima_y[-1], max_discard, 101)\n', (17636, 17668), True, 'import numpy as np\n'), ((17740, 17790), 'numpy.linspace', 'np.linspace', (['((5 - a) * np.pi)', '((5 + a) * np.pi)', '(101)'], {}), '((5 - a) * np.pi, (5 + a) * np.pi, 101)\n', (17751, 17790), True, 'import numpy as np\n'), ((18184, 18250), 'emd_utils.Utility', 'emd_utils.Utility', ([], {'time': 'time', 'time_series': 'time_series_anti_reflect'}), '(time=time, time_series=time_series_anti_reflect)\n', (18201, 18250), False, 'import emd_utils\n'), ((18418, 18479), 'emd_utils.Utility', 'emd_utils.Utility', ([], {'time': 'time', 'time_series': 'time_series_reflect'}), '(time=time, time_series=time_series_reflect)\n', (18435, 18479), False, 'import emd_utils\n'), ((18655, 18699), 'numpy.linspace', 'np.linspace', (['maxima_y[-1]', 'minima_y[-1]', '(101)'], {}), '(maxima_y[-1], minima_y[-1], 101)\n', (18666, 18699), True, 'import numpy as np\n'), ((18785, 18851), 'numpy.linspace', 'np.linspace', (['(point_1 * np.pi - width)', '(point_1 * np.pi + width)', '(101)'], {}), '(point_1 * np.pi - width, point_1 * np.pi + width, 101)\n', (18796, 18851), True, 'import numpy as np\n'), ((18998, 19045), 'numpy.linspace', 'np.linspace', (['time_series[-1]', 'minima_y[-1]', '(101)'], {}), '(time_series[-1], minima_y[-1], 101)\n', (19009, 19045), True, 'import numpy as np\n'), ((19137, 19203), 'numpy.linspace', 'np.linspace', (['(point_2 * np.pi - width)', '(point_2 * np.pi + width)', '(101)'], {}), '(point_2 * np.pi - width, point_2 * np.pi + width, 101)\n', (19148, 19203), True, 'import numpy as np\n'), ((19441, 19464), 'numpy.linspace', 'np.linspace', (['(-2)', '(2)', '(101)'], {}), '(-2, 2, 101)\n', (19452, 19464), True, 'import numpy as np\n'), ((19477, 19529), 'numpy.linspace', 'np.linspace', (['(time[-1] - width)', '(time[-1] + width)', '(101)'], {}), '(time[-1] - width, time[-1] + width, 101)\n', (19488, 19529), True, 'import numpy as np\n'), ((19607, 19655), 'numpy.linspace', 'np.linspace', (['(time[-1] - 0.5)', '(time[-1] + 0.5)', '(101)'], {}), '(time[-1] - 0.5, time[-1] + 0.5, 101)\n', (19618, 19655), True, 'import numpy as np\n'), ((19738, 19754), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(111)'], {}), '(111)\n', (19749, 19754), True, 'import matplotlib.pyplot as plt\n'), ((19794, 19850), 'matplotlib.pyplot.plot', 'plt.plot', (['time', 'time_series'], {'LineWidth': '(2)', 'label': '"""Signal"""'}), "(time, time_series, LineWidth=2, label='Signal')\n", (19802, 19850), True, 'import matplotlib.pyplot as plt\n'), ((19851, 19893), 'matplotlib.pyplot.title', 'plt.title', (['"""Symmetry Edge Effects Example"""'], {}), "('Symmetry Edge Effects Example')\n", (19860, 19893), True, 'import matplotlib.pyplot as plt\n'), ((20152, 20191), 'matplotlib.pyplot.plot', 'plt.plot', (['max_dash_time', 'max_dash', '"""k-"""'], {}), "(max_dash_time, max_dash, 'k-')\n", (20160, 20191), True, 'import matplotlib.pyplot as plt\n'), ((20192, 20231), 'matplotlib.pyplot.plot', 'plt.plot', (['min_dash_time', 'min_dash', '"""k-"""'], {}), "(min_dash_time, min_dash, 'k-')\n", (20200, 20231), True, 'import matplotlib.pyplot as plt\n'), ((20232, 20268), 'matplotlib.pyplot.plot', 'plt.plot', (['dash_1_time', 'dash_1', '"""k--"""'], {}), "(dash_1_time, dash_1, 'k--')\n", (20240, 20268), True, 'import matplotlib.pyplot as plt\n'), ((20269, 20305), 'matplotlib.pyplot.plot', 'plt.plot', (['dash_2_time', 'dash_2', '"""k--"""'], {}), "(dash_2_time, dash_2, 'k--')\n", (20277, 20305), True, 'import matplotlib.pyplot as plt\n'), ((20306, 20360), 'matplotlib.pyplot.plot', 'plt.plot', (['length_distance_time', 'length_distance', '"""k--"""'], {}), "(length_distance_time, length_distance, 'k--')\n", (20314, 20360), True, 'import matplotlib.pyplot as plt\n'), ((20361, 20419), 'matplotlib.pyplot.plot', 'plt.plot', (['length_distance_time_2', 'length_distance_2', '"""k--"""'], {}), "(length_distance_time_2, length_distance_2, 'k--')\n", (20369, 20419), True, 'import matplotlib.pyplot as plt\n'), ((20420, 20459), 'matplotlib.pyplot.plot', 'plt.plot', (['length_time', 'length_top', '"""k-"""'], {}), "(length_time, length_top, 'k-')\n", (20428, 20459), True, 'import matplotlib.pyplot as plt\n'), ((20460, 20502), 'matplotlib.pyplot.plot', 'plt.plot', (['length_time', 'length_bottom', '"""k-"""'], {}), "(length_time, length_bottom, 'k-')\n", (20468, 20502), True, 'import matplotlib.pyplot as plt\n'), ((20503, 20546), 'matplotlib.pyplot.plot', 'plt.plot', (['length_time_2', 'length_top_2', '"""k-"""'], {}), "(length_time_2, length_top_2, 'k-')\n", (20511, 20546), True, 'import matplotlib.pyplot as plt\n'), ((20547, 20593), 'matplotlib.pyplot.plot', 'plt.plot', (['length_time_2', 'length_bottom_2', '"""k-"""'], {}), "(length_time_2, length_bottom_2, 'k-')\n", (20555, 20593), True, 'import matplotlib.pyplot as plt\n'), ((20594, 20630), 'matplotlib.pyplot.plot', 'plt.plot', (['end_time', 'end_signal', '"""k-"""'], {}), "(end_time, end_signal, 'k-')\n", (20602, 20630), True, 'import matplotlib.pyplot as plt\n'), ((20631, 20693), 'matplotlib.pyplot.plot', 'plt.plot', (['symmetry_axis_1_time', 'symmetry_axis', '"""r--"""'], {'zorder': '(1)'}), "(symmetry_axis_1_time, symmetry_axis, 'r--', zorder=1)\n", (20639, 20693), True, 'import matplotlib.pyplot as plt\n'), ((20694, 20763), 'matplotlib.pyplot.plot', 'plt.plot', (['anti_symmetric_time', 'anti_symmetric_signal', '"""r--"""'], {'zorder': '(1)'}), "(anti_symmetric_time, anti_symmetric_signal, 'r--', zorder=1)\n", (20702, 20763), True, 'import matplotlib.pyplot as plt\n'), ((20872, 20912), 'matplotlib.pyplot.text', 'plt.text', (['(5.1 * np.pi)', '(-0.7)', '"""$\\\\beta$L"""'], {}), "(5.1 * np.pi, -0.7, '$\\\\beta$L')\n", (20880, 20912), True, 'import matplotlib.pyplot as plt\n'), ((20913, 20947), 'matplotlib.pyplot.text', 'plt.text', (['(5.34 * np.pi)', '(-0.05)', '"""L"""'], {}), "(5.34 * np.pi, -0.05, 'L')\n", (20921, 20947), True, 'import matplotlib.pyplot as plt\n'), ((20948, 21012), 'matplotlib.pyplot.scatter', 'plt.scatter', (['maxima_x', 'maxima_y'], {'c': '"""r"""', 'zorder': '(4)', 'label': '"""Maxima"""'}), "(maxima_x, maxima_y, c='r', zorder=4, label='Maxima')\n", (20959, 21012), True, 'import matplotlib.pyplot as plt\n'), ((21013, 21077), 'matplotlib.pyplot.scatter', 'plt.scatter', (['minima_x', 'minima_y'], {'c': '"""b"""', 'zorder': '(4)', 'label': '"""Minima"""'}), "(minima_x, minima_y, c='b', zorder=4, label='Minima')\n", (21024, 21077), True, 'import matplotlib.pyplot as plt\n'), ((21541, 21575), 'matplotlib.pyplot.xlim', 'plt.xlim', (['(3.9 * np.pi)', '(5.5 * np.pi)'], {}), '(3.9 * np.pi, 5.5 * np.pi)\n', (21549, 21575), True, 'import matplotlib.pyplot as plt\n'), ((21576, 21634), 'matplotlib.pyplot.xticks', 'plt.xticks', (['(4 * np.pi, 5 * np.pi)', "('4$\\\\pi$', '5$\\\\pi$')"], {}), "((4 * np.pi, 5 * np.pi), ('4$\\\\pi$', '5$\\\\pi$'))\n", (21586, 21634), True, 'import matplotlib.pyplot as plt\n'), ((21635, 21693), 'matplotlib.pyplot.yticks', 'plt.yticks', (['(-2, -1, 0, 1, 2)', "('-2', '-1', '0', '1', '2')"], {}), "((-2, -1, 0, 1, 2), ('-2', '-1', '0', '1', '2'))\n", (21645, 21693), True, 'import matplotlib.pyplot as plt\n'), ((21853, 21910), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/edge_effects_symmetry_anti.png"""'], {}), "('jss_figures/edge_effects_symmetry_anti.png')\n", (21864, 21910), True, 'import matplotlib.pyplot as plt\n'), ((21911, 21921), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (21919, 21921), True, 'import matplotlib.pyplot as plt\n'), ((21960, 21997), 'numpy.linspace', 'np.linspace', (['(0)', '((5 - a) * np.pi)', '(1001)'], {}), '(0, (5 - a) * np.pi, 1001)\n', (21971, 21997), True, 'import numpy as np\n'), ((22052, 22105), 'emd_utils.Utility', 'emd_utils.Utility', ([], {'time': 'time', 'time_series': 'time_series'}), '(time=time, time_series=time_series)\n', (22069, 22105), False, 'import emd_utils\n'), ((22329, 22389), 'numpy.linspace', 'np.linspace', (['(maxima_y[-1] - width)', '(maxima_y[-1] + width)', '(101)'], {}), '(maxima_y[-1] - width, maxima_y[-1] + width, 101)\n', (22340, 22389), True, 'import numpy as np\n'), ((22403, 22463), 'numpy.linspace', 'np.linspace', (['(maxima_y[-2] - width)', '(maxima_y[-2] + width)', '(101)'], {}), '(maxima_y[-2] - width, maxima_y[-2] + width, 101)\n', (22414, 22463), True, 'import numpy as np\n'), ((22593, 22653), 'numpy.linspace', 'np.linspace', (['(minima_y[-1] - width)', '(minima_y[-1] + width)', '(101)'], {}), '(minima_y[-1] - width, minima_y[-1] + width, 101)\n', (22604, 22653), True, 'import numpy as np\n'), ((22667, 22727), 'numpy.linspace', 'np.linspace', (['(minima_y[-2] - width)', '(minima_y[-2] + width)', '(101)'], {}), '(minima_y[-2] - width, minima_y[-2] + width, 101)\n', (22678, 22727), True, 'import numpy as np\n'), ((22859, 22903), 'numpy.linspace', 'np.linspace', (['maxima_x[-1]', 'minima_x[-1]', '(101)'], {}), '(maxima_x[-1], minima_x[-1], 101)\n', (22870, 22903), True, 'import numpy as np\n'), ((22913, 22957), 'numpy.linspace', 'np.linspace', (['maxima_y[-1]', 'minima_y[-1]', '(101)'], {}), '(maxima_y[-1], minima_y[-1], 101)\n', (22924, 22957), True, 'import numpy as np\n'), ((22972, 23016), 'numpy.linspace', 'np.linspace', (['maxima_x[-1]', 'minima_x[-2]', '(101)'], {}), '(maxima_x[-1], minima_x[-2], 101)\n', (22983, 23016), True, 'import numpy as np\n'), ((23026, 23070), 'numpy.linspace', 'np.linspace', (['maxima_y[-1]', 'minima_y[-2]', '(101)'], {}), '(maxima_y[-1], minima_y[-2], 101)\n', (23037, 23070), True, 'import numpy as np\n'), ((23380, 23454), 'numpy.linspace', 'np.linspace', (['(slope_based_maximum - width)', '(slope_based_maximum + width)', '(101)'], {}), '(slope_based_maximum - width, slope_based_maximum + width, 101)\n', (23391, 23454), True, 'import numpy as np\n'), ((23470, 23526), 'numpy.linspace', 'np.linspace', (['minima_x[-1]', 'slope_based_maximum_time', '(101)'], {}), '(minima_x[-1], slope_based_maximum_time, 101)\n', (23481, 23526), True, 'import numpy as np\n'), ((23536, 23587), 'numpy.linspace', 'np.linspace', (['minima_y[-1]', 'slope_based_maximum', '(101)'], {}), '(minima_y[-1], slope_based_maximum, 101)\n', (23547, 23587), True, 'import numpy as np\n'), ((23916, 23990), 'numpy.linspace', 'np.linspace', (['(slope_based_minimum - width)', '(slope_based_minimum + width)', '(101)'], {}), '(slope_based_minimum - width, slope_based_minimum + width, 101)\n', (23927, 23990), True, 'import numpy as np\n'), ((24006, 24069), 'numpy.linspace', 'np.linspace', (['slope_based_maximum_time', 'slope_based_minimum_time'], {}), '(slope_based_maximum_time, slope_based_minimum_time)\n', (24017, 24069), True, 'import numpy as np\n'), ((24079, 24132), 'numpy.linspace', 'np.linspace', (['slope_based_maximum', 'slope_based_minimum'], {}), '(slope_based_maximum, slope_based_minimum)\n', (24090, 24132), True, 'import numpy as np\n'), ((24148, 24190), 'numpy.linspace', 'np.linspace', (['(2.5 - width)', '(2.5 + width)', '(101)'], {}), '(2.5 - width, 2.5 + width, 101)\n', (24159, 24190), True, 'import numpy as np\n'), ((24413, 24469), 'numpy.linspace', 'np.linspace', (['maxima_x[-2]', 'slope_based_maximum_time', '(101)'], {}), '(maxima_x[-2], slope_based_maximum_time, 101)\n', (24424, 24469), True, 'import numpy as np\n'), ((24546, 24590), 'numpy.linspace', 'np.linspace', (['(-3.4 - width)', '(-3.4 + width)', '(101)'], {}), '(-3.4 - width, -3.4 + width, 101)\n', (24557, 24590), True, 'import numpy as np\n'), ((24813, 24869), 'numpy.linspace', 'np.linspace', (['minima_x[-2]', 'slope_based_minimum_time', '(101)'], {}), '(minima_x[-2], slope_based_minimum_time, 101)\n', (24824, 24869), True, 'import numpy as np\n'), ((25610, 25707), 'numpy.linspace', 'np.linspace', (['(improved_slope_based_minimum - width)', '(improved_slope_based_minimum + width)', '(101)'], {}), '(improved_slope_based_minimum - width, \n    improved_slope_based_minimum + width, 101)\n', (25621, 25707), True, 'import numpy as np\n'), ((25801, 25891), 'numpy.linspace', 'np.linspace', (['improved_slope_based_maximum_time', 'improved_slope_based_minimum_time', '(101)'], {}), '(improved_slope_based_maximum_time,\n    improved_slope_based_minimum_time, 101)\n', (25812, 25891), True, 'import numpy as np\n'), ((25901, 25977), 'numpy.linspace', 'np.linspace', (['improved_slope_based_maximum', 'improved_slope_based_minimum', '(101)'], {}), '(improved_slope_based_maximum, improved_slope_based_minimum, 101)\n', (25912, 25977), True, 'import numpy as np\n'), ((25984, 26000), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(111)'], {}), '(111)\n', (25995, 26000), True, 'import matplotlib.pyplot as plt\n'), ((26164, 26220), 'matplotlib.pyplot.plot', 'plt.plot', (['time', 'time_series'], {'LineWidth': '(2)', 'label': '"""Signal"""'}), "(time, time_series, LineWidth=2, label='Signal')\n", (26172, 26220), True, 'import matplotlib.pyplot as plt\n'), ((26221, 26266), 'matplotlib.pyplot.title', 'plt.title', (['"""Slope-Based Edge Effects Example"""'], {}), "('Slope-Based Edge Effects Example')\n", (26230, 26266), True, 'import matplotlib.pyplot as plt\n'), ((26267, 26310), 'matplotlib.pyplot.plot', 'plt.plot', (['max_dash_time_1', 'max_dash_1', '"""k-"""'], {}), "(max_dash_time_1, max_dash_1, 'k-')\n", (26275, 26310), True, 'import matplotlib.pyplot as plt\n'), ((26311, 26354), 'matplotlib.pyplot.plot', 'plt.plot', (['max_dash_time_2', 'max_dash_2', '"""k-"""'], {}), "(max_dash_time_2, max_dash_2, 'k-')\n", (26319, 26354), True, 'import matplotlib.pyplot as plt\n'), ((26355, 26398), 'matplotlib.pyplot.plot', 'plt.plot', (['max_dash_time_3', 'max_dash_3', '"""k-"""'], {}), "(max_dash_time_3, max_dash_3, 'k-')\n", (26363, 26398), True, 'import matplotlib.pyplot as plt\n'), ((26399, 26442), 'matplotlib.pyplot.plot', 'plt.plot', (['min_dash_time_1', 'min_dash_1', '"""k-"""'], {}), "(min_dash_time_1, min_dash_1, 'k-')\n", (26407, 26442), True, 'import matplotlib.pyplot as plt\n'), ((26443, 26486), 'matplotlib.pyplot.plot', 'plt.plot', (['min_dash_time_2', 'min_dash_2', '"""k-"""'], {}), "(min_dash_time_2, min_dash_2, 'k-')\n", (26451, 26486), True, 'import matplotlib.pyplot as plt\n'), ((26487, 26530), 'matplotlib.pyplot.plot', 'plt.plot', (['min_dash_time_3', 'min_dash_3', '"""k-"""'], {}), "(min_dash_time_3, min_dash_3, 'k-')\n", (26495, 26530), True, 'import matplotlib.pyplot as plt\n'), ((26531, 26574), 'matplotlib.pyplot.plot', 'plt.plot', (['min_dash_time_4', 'min_dash_4', '"""k-"""'], {}), "(min_dash_time_4, min_dash_4, 'k-')\n", (26539, 26574), True, 'import matplotlib.pyplot as plt\n'), ((26575, 26622), 'matplotlib.pyplot.plot', 'plt.plot', (['maxima_dash_time_1', 'maxima_dash', '"""k-"""'], {}), "(maxima_dash_time_1, maxima_dash, 'k-')\n", (26583, 26622), True, 'import matplotlib.pyplot as plt\n'), ((26623, 26670), 'matplotlib.pyplot.plot', 'plt.plot', (['maxima_dash_time_2', 'maxima_dash', '"""k-"""'], {}), "(maxima_dash_time_2, maxima_dash, 'k-')\n", (26631, 26670), True, 'import matplotlib.pyplot as plt\n'), ((26671, 26718), 'matplotlib.pyplot.plot', 'plt.plot', (['maxima_dash_time_3', 'maxima_dash', '"""k-"""'], {}), "(maxima_dash_time_3, maxima_dash, 'k-')\n", (26679, 26718), True, 'import matplotlib.pyplot as plt\n'), ((26719, 26766), 'matplotlib.pyplot.plot', 'plt.plot', (['minima_dash_time_1', 'minima_dash', '"""k-"""'], {}), "(minima_dash_time_1, minima_dash, 'k-')\n", (26727, 26766), True, 'import matplotlib.pyplot as plt\n'), ((26767, 26814), 'matplotlib.pyplot.plot', 'plt.plot', (['minima_dash_time_2', 'minima_dash', '"""k-"""'], {}), "(minima_dash_time_2, minima_dash, 'k-')\n", (26775, 26814), True, 'import matplotlib.pyplot as plt\n'), ((26815, 26862), 'matplotlib.pyplot.plot', 'plt.plot', (['minima_dash_time_3', 'minima_dash', '"""k-"""'], {}), "(minima_dash_time_3, minima_dash, 'k-')\n", (26823, 26862), True, 'import matplotlib.pyplot as plt\n'), ((26863, 26917), 'matplotlib.pyplot.text', 'plt.text', (['(4.34 * np.pi)', '(-3.2)', '"""$\\\\Delta{t^{min}_{m}}$"""'], {}), "(4.34 * np.pi, -3.2, '$\\\\Delta{t^{min}_{m}}$')\n", (26871, 26917), True, 'import matplotlib.pyplot as plt\n'), ((26918, 26972), 'matplotlib.pyplot.text', 'plt.text', (['(4.74 * np.pi)', '(-3.2)', '"""$\\\\Delta{t^{min}_{m}}$"""'], {}), "(4.74 * np.pi, -3.2, '$\\\\Delta{t^{min}_{m}}$')\n", (26926, 26972), True, 'import matplotlib.pyplot as plt\n'), ((26973, 27024), 'matplotlib.pyplot.text', 'plt.text', (['(4.12 * np.pi)', '(2)', '"""$\\\\Delta{t^{max}_{M}}$"""'], {}), "(4.12 * np.pi, 2, '$\\\\Delta{t^{max}_{M}}$')\n", (26981, 27024), True, 'import matplotlib.pyplot as plt\n'), ((27025, 27075), 'matplotlib.pyplot.text', 'plt.text', (['(4.5 * np.pi)', '(2)', '"""$\\\\Delta{t^{max}_{M}}$"""'], {}), "(4.5 * np.pi, 2, '$\\\\Delta{t^{max}_{M}}$')\n", (27033, 27075), True, 'import matplotlib.pyplot as plt\n'), ((27077, 27113), 'matplotlib.pyplot.text', 'plt.text', (['(4.3 * np.pi)', '(0.35)', '"""$s_1$"""'], {}), "(4.3 * np.pi, 0.35, '$s_1$')\n", (27085, 27113), True, 'import matplotlib.pyplot as plt\n'), ((27116, 27153), 'matplotlib.pyplot.text', 'plt.text', (['(4.43 * np.pi)', '(-0.2)', '"""$s_2$"""'], {}), "(4.43 * np.pi, -0.2, '$s_2$')\n", (27124, 27153), True, 'import matplotlib.pyplot as plt\n'), ((27156, 27260), 'matplotlib.pyplot.text', 'plt.text', (['(4.3 * np.pi + (minima_x[-1] - minima_x[-2]))', '(0.35 + (minima_y[-1] - minima_y[-2]))', '"""$s_1$"""'], {}), "(4.3 * np.pi + (minima_x[-1] - minima_x[-2]), 0.35 + (minima_y[-1] -\n    minima_y[-2]), '$s_1$')\n", (27164, 27260), True, 'import matplotlib.pyplot as plt\n'), ((27259, 27384), 'matplotlib.pyplot.text', 'plt.text', (['(4.43 * np.pi + (slope_based_minimum_time - minima_x[-1]))', '(-0.2 + (slope_based_minimum - minima_y[-1]))', '"""$s_2$"""'], {}), "(4.43 * np.pi + (slope_based_minimum_time - minima_x[-1]), -0.2 + (\n    slope_based_minimum - minima_y[-1]), '$s_2$')\n", (27267, 27384), True, 'import matplotlib.pyplot as plt\n'), ((27391, 27514), 'matplotlib.pyplot.text', 'plt.text', (['(4.5 * np.pi + (slope_based_minimum_time - minima_x[-1]))', '(1.2 + (slope_based_minimum - minima_y[-1]))', '"""$s_2$"""'], {}), "(4.5 * np.pi + (slope_based_minimum_time - minima_x[-1]), 1.2 + (\n    slope_based_minimum - minima_y[-1]), '$s_2$')\n", (27399, 27514), True, 'import matplotlib.pyplot as plt\n'), ((27522, 27578), 'matplotlib.pyplot.plot', 'plt.plot', (['minima_line_dash_time', 'minima_line_dash', '"""k--"""'], {}), "(minima_line_dash_time, minima_line_dash, 'k--')\n", (27530, 27578), True, 'import matplotlib.pyplot as plt\n'), ((27579, 27635), 'matplotlib.pyplot.plot', 'plt.plot', (['maxima_line_dash_time', 'maxima_line_dash', '"""k--"""'], {}), "(maxima_line_dash_time, maxima_line_dash, 'k--')\n", (27587, 27635), True, 'import matplotlib.pyplot as plt\n'), ((27636, 27672), 'matplotlib.pyplot.plot', 'plt.plot', (['dash_1_time', 'dash_1', '"""k--"""'], {}), "(dash_1_time, dash_1, 'k--')\n", (27644, 27672), True, 'import matplotlib.pyplot as plt\n'), ((27673, 27709), 'matplotlib.pyplot.plot', 'plt.plot', (['dash_2_time', 'dash_2', '"""k--"""'], {}), "(dash_2_time, dash_2, 'k--')\n", (27681, 27709), True, 'import matplotlib.pyplot as plt\n'), ((27710, 27746), 'matplotlib.pyplot.plot', 'plt.plot', (['dash_3_time', 'dash_3', '"""k--"""'], {}), "(dash_3_time, dash_3, 'k--')\n", (27718, 27746), True, 'import matplotlib.pyplot as plt\n'), ((27747, 27783), 'matplotlib.pyplot.plot', 'plt.plot', (['dash_4_time', 'dash_4', '"""k--"""'], {}), "(dash_4_time, dash_4, 'k--')\n", (27755, 27783), True, 'import matplotlib.pyplot as plt\n'), ((27784, 27828), 'matplotlib.pyplot.plot', 'plt.plot', (['dash_final_time', 'dash_final', '"""k--"""'], {}), "(dash_final_time, dash_final, 'k--')\n", (27792, 27828), True, 'import matplotlib.pyplot as plt\n'), ((27829, 27893), 'matplotlib.pyplot.scatter', 'plt.scatter', (['maxima_x', 'maxima_y'], {'c': '"""r"""', 'zorder': '(4)', 'label': '"""Maxima"""'}), "(maxima_x, maxima_y, c='r', zorder=4, label='Maxima')\n", (27840, 27893), True, 'import matplotlib.pyplot as plt\n'), ((27894, 27958), 'matplotlib.pyplot.scatter', 'plt.scatter', (['minima_x', 'minima_y'], {'c': '"""b"""', 'zorder': '(4)', 'label': '"""Minima"""'}), "(minima_x, minima_y, c='b', zorder=4, label='Minima')\n", (27905, 27958), True, 'import matplotlib.pyplot as plt\n'), ((28583, 28617), 'matplotlib.pyplot.xlim', 'plt.xlim', (['(3.9 * np.pi)', '(5.5 * np.pi)'], {}), '(3.9 * np.pi, 5.5 * np.pi)\n', (28591, 28617), True, 'import matplotlib.pyplot as plt\n'), ((28618, 28676), 'matplotlib.pyplot.xticks', 'plt.xticks', (['(4 * np.pi, 5 * np.pi)', "('4$\\\\pi$', '5$\\\\pi$')"], {}), "((4 * np.pi, 5 * np.pi), ('4$\\\\pi$', '5$\\\\pi$'))\n", (28628, 28676), True, 'import matplotlib.pyplot as plt\n'), ((28677, 28745), 'matplotlib.pyplot.yticks', 'plt.yticks', (['(-3, -2, -1, 0, 1, 2)', "('-3', '-2', '-1', '0', '1', '2')"], {}), "((-3, -2, -1, 0, 1, 2), ('-3', '-2', '-1', '0', '1', '2'))\n", (28687, 28745), True, 'import matplotlib.pyplot as plt\n'), ((28905, 28960), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/edge_effects_slope_based.png"""'], {}), "('jss_figures/edge_effects_slope_based.png')\n", (28916, 28960), True, 'import matplotlib.pyplot as plt\n'), ((28961, 28971), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (28969, 28971), True, 'import matplotlib.pyplot as plt\n'), ((29010, 29047), 'numpy.linspace', 'np.linspace', (['(0)', '((5 - a) * np.pi)', '(1001)'], {}), '(0, (5 - a) * np.pi, 1001)\n', (29021, 29047), True, 'import numpy as np\n'), ((29102, 29155), 'emd_utils.Utility', 'emd_utils.Utility', ([], {'time': 'time', 'time_series': 'time_series'}), '(time=time, time_series=time_series)\n', (29119, 29155), False, 'import emd_utils\n'), ((30112, 30164), 'emd_utils.Utility', 'emd_utils.Utility', ([], {'time': 'time', 'time_series': 'Huang_wave'}), '(time=time, time_series=Huang_wave)\n', (30129, 30164), False, 'import emd_utils\n'), ((30298, 30353), 'emd_utils.Utility', 'emd_utils.Utility', ([], {'time': 'time', 'time_series': 'Coughlin_wave'}), '(time=time, time_series=Coughlin_wave)\n', (30315, 30353), False, 'import emd_utils\n'), ((30868, 30928), 'numpy.linspace', 'np.linspace', (['(maxima_x[-2] - width)', '(maxima_x[-2] + width)', '(101)'], {}), '(maxima_x[-2] - width, maxima_x[-2] + width, 101)\n', (30879, 30928), True, 'import numpy as np\n'), ((30949, 31007), 'numpy.linspace', 'np.linspace', (['(5.3 * np.pi - width)', '(5.3 * np.pi + width)', '(101)'], {}), '(5.3 * np.pi - width, 5.3 * np.pi + width, 101)\n', (30960, 31007), True, 'import numpy as np\n'), ((31076, 31136), 'numpy.linspace', 'np.linspace', (['(minima_x[-2] - width)', '(minima_x[-2] + width)', '(101)'], {}), '(minima_x[-2] - width, minima_x[-2] + width, 101)\n', (31087, 31136), True, 'import numpy as np\n'), ((31157, 31215), 'numpy.linspace', 'np.linspace', (['(5.3 * np.pi - width)', '(5.3 * np.pi + width)', '(101)'], {}), '(5.3 * np.pi - width, 5.3 * np.pi + width, 101)\n', (31168, 31215), True, 'import numpy as np\n'), ((31288, 31332), 'numpy.linspace', 'np.linspace', (['minima_y[-2]', 'maxima_y[-2]', '(101)'], {}), '(minima_y[-2], maxima_y[-2], 101)\n', (31299, 31332), True, 'import numpy as np\n'), ((31413, 31473), 'numpy.linspace', 'np.linspace', (['(maxima_y[-2] - width)', '(maxima_y[-2] + width)', '(101)'], {}), '(maxima_y[-2] - width, maxima_y[-2] + width, 101)\n', (31424, 31473), True, 'import numpy as np\n'), ((31489, 31533), 'numpy.linspace', 'np.linspace', (['(-1.8 - width)', '(-1.8 + width)', '(101)'], {}), '(-1.8 - width, -1.8 + width, 101)\n', (31500, 31533), True, 'import numpy as np\n'), ((31597, 31657), 'numpy.linspace', 'np.linspace', (['(minima_y[-2] - width)', '(minima_y[-2] + width)', '(101)'], {}), '(minima_y[-2] - width, minima_y[-2] + width, 101)\n', (31608, 31657), True, 'import numpy as np\n'), ((31673, 31717), 'numpy.linspace', 'np.linspace', (['(-1.8 - width)', '(-1.8 + width)', '(101)'], {}), '(-1.8 - width, -1.8 + width, 101)\n', (31684, 31717), True, 'import numpy as np\n'), ((31795, 31839), 'numpy.linspace', 'np.linspace', (['minima_x[-2]', 'maxima_x[-2]', '(101)'], {}), '(minima_x[-2], maxima_x[-2], 101)\n', (31806, 31839), True, 'import numpy as np\n'), ((31918, 31978), 'numpy.linspace', 'np.linspace', (['(maxima_x[-1] - width)', '(maxima_x[-1] + width)', '(101)'], {}), '(maxima_x[-1] - width, maxima_x[-1] + width, 101)\n', (31929, 31978), True, 'import numpy as np\n'), ((31999, 32057), 'numpy.linspace', 'np.linspace', (['(5.4 * np.pi - width)', '(5.4 * np.pi + width)', '(101)'], {}), '(5.4 * np.pi - width, 5.4 * np.pi + width, 101)\n', (32010, 32057), True, 'import numpy as np\n'), ((32126, 32186), 'numpy.linspace', 'np.linspace', (['(minima_x[-1] - width)', '(minima_x[-1] + width)', '(101)'], {}), '(minima_x[-1] - width, minima_x[-1] + width, 101)\n', (32137, 32186), True, 'import numpy as np\n'), ((32207, 32265), 'numpy.linspace', 'np.linspace', (['(5.4 * np.pi - width)', '(5.4 * np.pi + width)', '(101)'], {}), '(5.4 * np.pi - width, 5.4 * np.pi + width, 101)\n', (32218, 32265), True, 'import numpy as np\n'), ((32338, 32382), 'numpy.linspace', 'np.linspace', (['minima_y[-1]', 'maxima_y[-1]', '(101)'], {}), '(minima_y[-1], maxima_y[-1], 101)\n', (32349, 32382), True, 'import numpy as np\n'), ((32463, 32523), 'numpy.linspace', 'np.linspace', (['(maxima_y[-1] - width)', '(maxima_y[-1] + width)', '(101)'], {}), '(maxima_y[-1] - width, maxima_y[-1] + width, 101)\n', (32474, 32523), True, 'import numpy as np\n'), ((32539, 32583), 'numpy.linspace', 'np.linspace', (['(-2.1 - width)', '(-2.1 + width)', '(101)'], {}), '(-2.1 - width, -2.1 + width, 101)\n', (32550, 32583), True, 'import numpy as np\n'), ((32647, 32707), 'numpy.linspace', 'np.linspace', (['(minima_y[-1] - width)', '(minima_y[-1] + width)', '(101)'], {}), '(minima_y[-1] - width, minima_y[-1] + width, 101)\n', (32658, 32707), True, 'import numpy as np\n'), ((32723, 32767), 'numpy.linspace', 'np.linspace', (['(-2.1 - width)', '(-2.1 + width)', '(101)'], {}), '(-2.1 - width, -2.1 + width, 101)\n', (32734, 32767), True, 'import numpy as np\n'), ((32845, 32889), 'numpy.linspace', 'np.linspace', (['minima_x[-1]', 'maxima_x[-1]', '(101)'], {}), '(minima_x[-1], maxima_x[-1], 101)\n', (32856, 32889), True, 'import numpy as np\n'), ((32958, 32974), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(111)'], {}), '(111)\n', (32969, 32974), True, 'import matplotlib.pyplot as plt\n'), ((33014, 33062), 'matplotlib.pyplot.title', 'plt.title', (['"""Characteristic Wave Effects Example"""'], {}), "('Characteristic Wave Effects Example')\n", (33023, 33062), True, 'import matplotlib.pyplot as plt\n'), ((33063, 33119), 'matplotlib.pyplot.plot', 'plt.plot', (['time', 'time_series'], {'LineWidth': '(2)', 'label': '"""Signal"""'}), "(time, time_series, LineWidth=2, label='Signal')\n", (33071, 33119), True, 'import matplotlib.pyplot as plt\n'), ((33824, 33888), 'matplotlib.pyplot.scatter', 'plt.scatter', (['maxima_x', 'maxima_y'], {'c': '"""r"""', 'zorder': '(4)', 'label': '"""Maxima"""'}), "(maxima_x, maxima_y, c='r', zorder=4, label='Maxima')\n", (33835, 33888), True, 'import matplotlib.pyplot as plt\n'), ((33889, 33953), 'matplotlib.pyplot.scatter', 'plt.scatter', (['minima_x', 'minima_y'], {'c': '"""b"""', 'zorder': '(4)', 'label': '"""Minima"""'}), "(minima_x, minima_y, c='b', zorder=4, label='Minima')\n", (33900, 33953), True, 'import matplotlib.pyplot as plt\n'), ((34181, 34218), 'matplotlib.pyplot.plot', 'plt.plot', (['max_2_x_time', 'max_2_x', '"""k-"""'], {}), "(max_2_x_time, max_2_x, 'k-')\n", (34189, 34218), True, 'import matplotlib.pyplot as plt\n'), ((34219, 34261), 'matplotlib.pyplot.plot', 'plt.plot', (['max_2_x_time_side', 'max_2_x', '"""k-"""'], {}), "(max_2_x_time_side, max_2_x, 'k-')\n", (34227, 34261), True, 'import matplotlib.pyplot as plt\n'), ((34262, 34299), 'matplotlib.pyplot.plot', 'plt.plot', (['min_2_x_time', 'min_2_x', '"""k-"""'], {}), "(min_2_x_time, min_2_x, 'k-')\n", (34270, 34299), True, 'import matplotlib.pyplot as plt\n'), ((34300, 34342), 'matplotlib.pyplot.plot', 'plt.plot', (['min_2_x_time_side', 'min_2_x', '"""k-"""'], {}), "(min_2_x_time_side, min_2_x, 'k-')\n", (34308, 34342), True, 'import matplotlib.pyplot as plt\n'), ((34343, 34399), 'matplotlib.pyplot.plot', 'plt.plot', (['dash_max_min_2_x_time', 'dash_max_min_2_x', '"""k--"""'], {}), "(dash_max_min_2_x_time, dash_max_min_2_x, 'k--')\n", (34351, 34399), True, 'import matplotlib.pyplot as plt\n'), ((34400, 34438), 'matplotlib.pyplot.text', 'plt.text', (['(5.16 * np.pi)', '(0.85)', '"""$2a_2$"""'], {}), "(5.16 * np.pi, 0.85, '$2a_2$')\n", (34408, 34438), True, 'import matplotlib.pyplot as plt\n'), ((34441, 34478), 'matplotlib.pyplot.plot', 'plt.plot', (['max_2_y_time', 'max_2_y', '"""k-"""'], {}), "(max_2_y_time, max_2_y, 'k-')\n", (34449, 34478), True, 'import matplotlib.pyplot as plt\n'), ((34479, 34521), 'matplotlib.pyplot.plot', 'plt.plot', (['max_2_y_time', 'max_2_y_side', '"""k-"""'], {}), "(max_2_y_time, max_2_y_side, 'k-')\n", (34487, 34521), True, 'import matplotlib.pyplot as plt\n'), ((34522, 34559), 'matplotlib.pyplot.plot', 'plt.plot', (['min_2_y_time', 'min_2_y', '"""k-"""'], {}), "(min_2_y_time, min_2_y, 'k-')\n", (34530, 34559), True, 'import matplotlib.pyplot as plt\n'), ((34560, 34602), 'matplotlib.pyplot.plot', 'plt.plot', (['min_2_y_time', 'min_2_y_side', '"""k-"""'], {}), "(min_2_y_time, min_2_y_side, 'k-')\n", (34568, 34602), True, 'import matplotlib.pyplot as plt\n'), ((34603, 34659), 'matplotlib.pyplot.plot', 'plt.plot', (['dash_max_min_2_y_time', 'dash_max_min_2_y', '"""k--"""'], {}), "(dash_max_min_2_y_time, dash_max_min_2_y, 'k--')\n", (34611, 34659), True, 'import matplotlib.pyplot as plt\n'), ((34660, 34708), 'matplotlib.pyplot.text', 'plt.text', (['(4.08 * np.pi)', '(-2.2)', '"""$\\\\frac{p_2}{2}$"""'], {}), "(4.08 * np.pi, -2.2, '$\\\\frac{p_2}{2}$')\n", (34668, 34708), True, 'import matplotlib.pyplot as plt\n'), ((34710, 34747), 'matplotlib.pyplot.plot', 'plt.plot', (['max_1_x_time', 'max_1_x', '"""k-"""'], {}), "(max_1_x_time, max_1_x, 'k-')\n", (34718, 34747), True, 'import matplotlib.pyplot as plt\n'), ((34748, 34790), 'matplotlib.pyplot.plot', 'plt.plot', (['max_1_x_time_side', 'max_1_x', '"""k-"""'], {}), "(max_1_x_time_side, max_1_x, 'k-')\n", (34756, 34790), True, 'import matplotlib.pyplot as plt\n'), ((34791, 34828), 'matplotlib.pyplot.plot', 'plt.plot', (['min_1_x_time', 'min_1_x', '"""k-"""'], {}), "(min_1_x_time, min_1_x, 'k-')\n", (34799, 34828), True, 'import matplotlib.pyplot as plt\n'), ((34829, 34871), 'matplotlib.pyplot.plot', 'plt.plot', (['min_1_x_time_side', 'min_1_x', '"""k-"""'], {}), "(min_1_x_time_side, min_1_x, 'k-')\n", (34837, 34871), True, 'import matplotlib.pyplot as plt\n'), ((34872, 34928), 'matplotlib.pyplot.plot', 'plt.plot', (['dash_max_min_1_x_time', 'dash_max_min_1_x', '"""k--"""'], {}), "(dash_max_min_1_x_time, dash_max_min_1_x, 'k--')\n", (34880, 34928), True, 'import matplotlib.pyplot as plt\n'), ((34929, 34967), 'matplotlib.pyplot.text', 'plt.text', (['(5.42 * np.pi)', '(-0.1)', '"""$2a_1$"""'], {}), "(5.42 * np.pi, -0.1, '$2a_1$')\n", (34937, 34967), True, 'import matplotlib.pyplot as plt\n'), ((34970, 35007), 'matplotlib.pyplot.plot', 'plt.plot', (['max_1_y_time', 'max_1_y', '"""k-"""'], {}), "(max_1_y_time, max_1_y, 'k-')\n", (34978, 35007), True, 'import matplotlib.pyplot as plt\n'), ((35008, 35050), 'matplotlib.pyplot.plot', 'plt.plot', (['max_1_y_time', 'max_1_y_side', '"""k-"""'], {}), "(max_1_y_time, max_1_y_side, 'k-')\n", (35016, 35050), True, 'import matplotlib.pyplot as plt\n'), ((35051, 35088), 'matplotlib.pyplot.plot', 'plt.plot', (['min_1_y_time', 'min_1_y', '"""k-"""'], {}), "(min_1_y_time, min_1_y, 'k-')\n", (35059, 35088), True, 'import matplotlib.pyplot as plt\n'), ((35089, 35131), 'matplotlib.pyplot.plot', 'plt.plot', (['min_1_y_time', 'min_1_y_side', '"""k-"""'], {}), "(min_1_y_time, min_1_y_side, 'k-')\n", (35097, 35131), True, 'import matplotlib.pyplot as plt\n'), ((35132, 35188), 'matplotlib.pyplot.plot', 'plt.plot', (['dash_max_min_1_y_time', 'dash_max_min_1_y', '"""k--"""'], {}), "(dash_max_min_1_y_time, dash_max_min_1_y, 'k--')\n", (35140, 35188), True, 'import matplotlib.pyplot as plt\n'), ((35189, 35237), 'matplotlib.pyplot.text', 'plt.text', (['(4.48 * np.pi)', '(-2.5)', '"""$\\\\frac{p_1}{2}$"""'], {}), "(4.48 * np.pi, -2.5, '$\\\\frac{p_1}{2}$')\n", (35197, 35237), True, 'import matplotlib.pyplot as plt\n'), ((35239, 35273), 'matplotlib.pyplot.xlim', 'plt.xlim', (['(3.9 * np.pi)', '(5.6 * np.pi)'], {}), '(3.9 * np.pi, 5.6 * np.pi)\n', (35247, 35273), True, 'import matplotlib.pyplot as plt\n'), ((35274, 35332), 'matplotlib.pyplot.xticks', 'plt.xticks', (['(4 * np.pi, 5 * np.pi)', "('4$\\\\pi$', '5$\\\\pi$')"], {}), "((4 * np.pi, 5 * np.pi), ('4$\\\\pi$', '5$\\\\pi$'))\n", (35284, 35332), True, 'import matplotlib.pyplot as plt\n'), ((35333, 35391), 'matplotlib.pyplot.yticks', 'plt.yticks', (['(-2, -1, 0, 1, 2)', "('-2', '-1', '0', '1', '2')"], {}), "((-2, -1, 0, 1, 2), ('-2', '-1', '0', '1', '2'))\n", (35343, 35391), True, 'import matplotlib.pyplot as plt\n'), ((35552, 35615), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/edge_effects_characteristic_wave.png"""'], {}), "('jss_figures/edge_effects_characteristic_wave.png')\n", (35563, 35615), True, 'import matplotlib.pyplot as plt\n'), ((35616, 35626), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (35624, 35626), True, 'import matplotlib.pyplot as plt\n'), ((35641, 35664), 'numpy.linspace', 'np.linspace', (['(5)', '(95)', '(100)'], {}), '(5, 95, 100)\n', (35652, 35664), True, 'import numpy as np\n'), ((35788, 35838), 'emd_utils.Utility', 'emd_utils.Utility', ([], {'time': 't', 'time_series': 'signal_orig'}), '(time=t, time_series=signal_orig)\n', (35805, 35838), False, 'import emd_utils\n'), ((36106, 36137), 'numpy.linspace', 'np.linspace', (['(0)', '(5 * np.pi)', '(1001)'], {}), '(0, 5 * np.pi, 1001)\n', (36117, 36137), True, 'import numpy as np\n'), ((36191, 36221), 'numpy.linspace', 'np.linspace', (['(0)', '(5 * np.pi)', '(101)'], {}), '(0, 5 * np.pi, 101)\n', (36202, 36221), True, 'import numpy as np\n'), ((36239, 36259), 'emd_utils.time_extension', 'time_extension', (['time'], {}), '(time)\n', (36253, 36259), False, 'from emd_utils import time_extension, Utility\n'), ((37406, 37429), 'numpy.hstack', 'np.hstack', (['(weights, 0)'], {}), '((weights, 0))\n', (37415, 37429), True, 'import numpy as np\n'), ((39418, 39440), 'cvxpy.Problem', 'cvx.Problem', (['objective'], {}), '(objective)\n', (39429, 39440), True, 'import cvxpy as cvx\n'), ((39507, 39525), 'numpy.array', 'np.array', (['vx.value'], {}), '(vx.value)\n', (39515, 39525), True, 'import numpy as np\n'), ((40751, 40803), 'emd_utils.Utility', 'emd_utils.Utility', ([], {'time': 'time', 'time_series': 'lsq_signal'}), '(time=time, time_series=lsq_signal)\n', (40768, 40803), False, 'import emd_utils\n'), ((40821, 40892), 'emd_utils.Utility', 'emd_utils.Utility', ([], {'time': 'time_extended', 'time_series': 'time_series_extended'}), '(time=time_extended, time_series=time_series_extended)\n', (40838, 40892), False, 'import emd_utils\n'), ((41503, 41519), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(111)'], {}), '(111)\n', (41514, 41519), True, 'import matplotlib.pyplot as plt\n'), ((41559, 41608), 'matplotlib.pyplot.title', 'plt.title', (['"""Single Neuron Neural Network Example"""'], {}), "('Single Neuron Neural Network Example')\n", (41568, 41608), True, 'import matplotlib.pyplot as plt\n'), ((41609, 41661), 'matplotlib.pyplot.plot', 'plt.plot', (['time', 'lsq_signal'], {'zorder': '(2)', 'label': '"""Signal"""'}), "(time, lsq_signal, zorder=2, label='Signal')\n", (41617, 41661), True, 'import matplotlib.pyplot as plt\n'), ((41773, 41838), 'matplotlib.pyplot.scatter', 'plt.scatter', (['maxima_time', 'maxima'], {'c': '"""r"""', 'zorder': '(3)', 'label': '"""Maxima"""'}), "(maxima_time, maxima, c='r', zorder=3, label='Maxima')\n", (41784, 41838), True, 'import matplotlib.pyplot as plt\n'), ((41839, 41904), 'matplotlib.pyplot.scatter', 'plt.scatter', (['minima_time', 'minima'], {'c': '"""b"""', 'zorder': '(3)', 'label': '"""Minima"""'}), "(minima_time, minima, c='b', zorder=3, label='Minima')\n", (41850, 41904), True, 'import matplotlib.pyplot as plt\n'), ((44091, 44125), 'matplotlib.pyplot.xlim', 'plt.xlim', (['(3.4 * np.pi)', '(5.6 * np.pi)'], {}), '(3.4 * np.pi, 5.6 * np.pi)\n', (44099, 44125), True, 'import matplotlib.pyplot as plt\n'), ((44126, 44184), 'matplotlib.pyplot.xticks', 'plt.xticks', (['(4 * np.pi, 5 * np.pi)', "('4$\\\\pi$', '5$\\\\pi$')"], {}), "((4 * np.pi, 5 * np.pi), ('4$\\\\pi$', '5$\\\\pi$'))\n", (44136, 44184), True, 'import matplotlib.pyplot as plt\n'), ((44185, 44243), 'matplotlib.pyplot.yticks', 'plt.yticks', (['(-2, -1, 0, 1, 2)', "('-2', '-1', '0', '1', '2')"], {}), "((-2, -1, 0, 1, 2), ('-2', '-1', '0', '1', '2'))\n", (44195, 44243), True, 'import matplotlib.pyplot as plt\n'), ((44404, 44449), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/neural_network.png"""'], {}), "('jss_figures/neural_network.png')\n", (44415, 44449), True, 'import matplotlib.pyplot as plt\n'), ((44450, 44460), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (44458, 44460), True, 'import matplotlib.pyplot as plt\n'), ((44472, 44489), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (44486, 44489), True, 'import numpy as np\n'), ((44498, 44529), 'numpy.linspace', 'np.linspace', (['(0)', '(5 * np.pi)', '(1001)'], {}), '(0, 5 * np.pi, 1001)\n', (44509, 44529), True, 'import numpy as np\n'), ((44541, 44570), 'numpy.linspace', 'np.linspace', (['(0)', '(5 * np.pi)', '(51)'], {}), '(0, 5 * np.pi, 51)\n', (44552, 44570), True, 'import numpy as np\n'), ((44722, 44761), 'AdvEMDpy.EMD', 'EMD', ([], {'time': 'time', 'time_series': 'time_series'}), '(time=time, time_series=time_series)\n', (44725, 44761), False, 'from AdvEMDpy import EMD\n'), ((44980, 45009), 'numpy.linspace', 'np.linspace', (['(0)', '(5 * np.pi)', '(31)'], {}), '(0, 5 * np.pi, 31)\n', (44991, 45009), True, 'import numpy as np\n'), ((45228, 45257), 'numpy.linspace', 'np.linspace', (['(0)', '(5 * np.pi)', '(11)'], {}), '(0, 5 * np.pi, 11)\n', (45239, 45257), True, 'import numpy as np\n'), ((45477, 45495), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(3)', '(1)'], {}), '(3, 1)\n', (45489, 45495), True, 'import matplotlib.pyplot as plt\n'), ((45592, 45623), 'matplotlib.pyplot.subplots_adjust', 'plt.subplots_adjust', ([], {'hspace': '(0.1)'}), '(hspace=0.1)\n', (45611, 45623), True, 'import matplotlib.pyplot as plt\n'), ((49286, 49337), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/DFA_different_trends.png"""'], {}), "('jss_figures/DFA_different_trends.png')\n", (49297, 49337), True, 'import matplotlib.pyplot as plt\n'), ((49338, 49348), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (49346, 49348), True, 'import matplotlib.pyplot as plt\n'), ((49371, 49389), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(3)', '(1)'], {}), '(3, 1)\n', (49383, 49389), True, 'import matplotlib.pyplot as plt\n'), ((49500, 49531), 'matplotlib.pyplot.subplots_adjust', 'plt.subplots_adjust', ([], {'hspace': '(0.1)'}), '(hspace=0.1)\n', (49519, 49531), True, 'import matplotlib.pyplot as plt\n'), ((51975, 52033), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/DFA_different_trends_zoomed.png"""'], {}), "('jss_figures/DFA_different_trends_zoomed.png')\n", (51986, 52033), True, 'import matplotlib.pyplot as plt\n'), ((52034, 52044), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (52042, 52044), True, 'import matplotlib.pyplot as plt\n'), ((52058, 52135), 'emd_hilbert.hilbert_spectrum', 'hilbert_spectrum', (['time', 'imfs_51', 'hts_51', 'ifs_51'], {'max_frequency': '(12)', 'plot': '(False)'}), '(time, imfs_51, hts_51, ifs_51, max_frequency=12, plot=False)\n', (52074, 52135), False, 'from emd_hilbert import Hilbert, hilbert_spectrum\n'), ((52152, 52168), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(111)'], {}), '(111)\n', (52163, 52168), True, 'import matplotlib.pyplot as plt\n'), ((52951, 52989), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""Frequency (rad.s$^{-1}$)"""'], {}), "('Frequency (rad.s$^{-1}$)')\n", (52961, 52989), True, 'import matplotlib.pyplot as plt\n'), ((52991, 53013), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Time (s)"""'], {}), "('Time (s)')\n", (53001, 53013), True, 'import matplotlib.pyplot as plt\n'), ((53180, 53231), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/DFA_hilbert_spectrum.png"""'], {}), "('jss_figures/DFA_hilbert_spectrum.png')\n", (53191, 53231), True, 'import matplotlib.pyplot as plt\n'), ((53232, 53242), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (53240, 53242), True, 'import matplotlib.pyplot as plt\n'), ((53261, 53292), 'numpy.linspace', 'np.linspace', (['(0)', '(5 * np.pi)', '(1001)'], {}), '(0, 5 * np.pi, 1001)\n', (53272, 53292), True, 'import numpy as np\n'), ((53347, 53376), 'numpy.linspace', 'np.linspace', (['(0)', '(5 * np.pi)', '(51)'], {}), '(0, 5 * np.pi, 51)\n', (53358, 53376), True, 'import numpy as np\n'), ((53385, 53432), 'emd_mean.Fluctuation', 'Fluctuation', ([], {'time': 'time', 'time_series': 'time_series'}), '(time=time, time_series=time_series)\n', (53396, 53432), False, 'from emd_mean import Fluctuation\n'), ((53926, 53969), 'emd_utils.Utility', 'Utility', ([], {'time': 'time', 'time_series': 'time_series'}), '(time=time, time_series=time_series)\n', (53933, 53969), False, 'from emd_utils import time_extension, Utility\n'), ((54062, 54078), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(111)'], {}), '(111)\n', (54073, 54078), True, 'import matplotlib.pyplot as plt\n'), ((54249, 54320), 'matplotlib.pyplot.plot', 'plt.plot', (['time', 'time_series'], {'label': '"""Time series"""', 'zorder': '(2)', 'LineWidth': '(2)'}), "(time, time_series, label='Time series', zorder=2, LineWidth=2)\n", (54257, 54320), True, 'import matplotlib.pyplot as plt\n'), ((54321, 54406), 'matplotlib.pyplot.scatter', 'plt.scatter', (['time[maxima]', 'time_series[maxima]'], {'c': '"""r"""', 'label': '"""Maxima"""', 'zorder': '(10)'}), "(time[maxima], time_series[maxima], c='r', label='Maxima', zorder=10\n    )\n", (54332, 54406), True, 'import matplotlib.pyplot as plt\n'), ((54402, 54487), 'matplotlib.pyplot.scatter', 'plt.scatter', (['time[minima]', 'time_series[minima]'], {'c': '"""b"""', 'label': '"""Minima"""', 'zorder': '(10)'}), "(time[minima], time_series[minima], c='b', label='Minima', zorder=10\n    )\n", (54413, 54487), True, 'import matplotlib.pyplot as plt\n'), ((55096, 55234), 'matplotlib.pyplot.xticks', 'plt.xticks', (['(0, 1 * np.pi, 2 * np.pi, 3 * np.pi, 4 * np.pi, 5 * np.pi)', "('$0$', '$\\\\pi$', '2$\\\\pi$', '3$\\\\pi$', '4$\\\\pi$', '5$\\\\pi$')"], {}), "((0, 1 * np.pi, 2 * np.pi, 3 * np.pi, 4 * np.pi, 5 * np.pi), (\n    '$0$', '$\\\\pi$', '2$\\\\pi$', '3$\\\\pi$', '4$\\\\pi$', '5$\\\\pi$'))\n", (55106, 55234), True, 'import matplotlib.pyplot as plt\n'), ((55242, 55300), 'matplotlib.pyplot.yticks', 'plt.yticks', (['(-2, -1, 0, 1, 2)', "('-2', '-1', '0', '1', '2')"], {}), "((-2, -1, 0, 1, 2), ('-2', '-1', '0', '1', '2'))\n", (55252, 55300), True, 'import matplotlib.pyplot as plt\n'), ((55301, 55338), 'matplotlib.pyplot.xlim', 'plt.xlim', (['(-0.25 * np.pi)', '(5.25 * np.pi)'], {}), '(-0.25 * np.pi, 5.25 * np.pi)\n', (55309, 55338), True, 'import matplotlib.pyplot as plt\n'), ((55499, 55559), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/Schoenberg_Whitney_Conditions.png"""'], {}), "('jss_figures/Schoenberg_Whitney_Conditions.png')\n", (55510, 55559), True, 'import matplotlib.pyplot as plt\n'), ((55560, 55570), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (55568, 55570), True, 'import matplotlib.pyplot as plt\n'), ((55609, 55660), 'numpy.linspace', 'np.linspace', (['((0 + a) * np.pi)', '((5 - a) * np.pi)', '(1001)'], {}), '((0 + a) * np.pi, (5 - a) * np.pi, 1001)\n', (55620, 55660), True, 'import numpy as np\n'), ((55669, 55718), 'numpy.linspace', 'np.linspace', (['((0 + a) * np.pi)', '((5 - a) * np.pi)', '(11)'], {}), '((0 + a) * np.pi, (5 - a) * np.pi, 11)\n', (55680, 55718), True, 'import numpy as np\n'), ((55773, 55826), 'emd_utils.Utility', 'emd_utils.Utility', ([], {'time': 'time', 'time_series': 'time_series'}), '(time=time, time_series=time_series)\n', (55790, 55826), False, 'import emd_utils\n'), ((56176, 56232), 'emd_mean.Fluctuation', 'emd_mean.Fluctuation', ([], {'time': 'time', 'time_series': 'time_series'}), '(time=time, time_series=time_series)\n', (56196, 56232), False, 'import emd_mean\n'), ((58501, 58537), 'numpy.linspace', 'np.linspace', (['knots[0]', 'knots[-1]', '(31)'], {}), '(knots[0], knots[-1], 31)\n', (58512, 58537), True, 'import numpy as np\n'), ((58666, 58731), 'AdvEMDpy.EMD', 'AdvEMDpy.EMD', ([], {'time': 'derivative_time', 'time_series': 'derivative_of_lsq'}), '(time=derivative_time, time_series=derivative_of_lsq)\n', (58678, 58731), False, 'import AdvEMDpy\n'), ((58938, 59004), 'emd_utils.Utility', 'emd_utils.Utility', ([], {'time': 'time[:-1]', 'time_series': 'imf_1_of_derivative'}), '(time=time[:-1], time_series=imf_1_of_derivative)\n', (58955, 59004), False, 'import emd_utils\n'), ((60536, 60552), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(111)'], {}), '(111)\n', (60547, 60552), True, 'import matplotlib.pyplot as plt\n'), ((60592, 60644), 'matplotlib.pyplot.title', 'plt.title', (['"""Detrended Fluctuation Analysis Examples"""'], {}), "('Detrended Fluctuation Analysis Examples')\n", (60601, 60644), True, 'import matplotlib.pyplot as plt\n'), ((60645, 60706), 'matplotlib.pyplot.plot', 'plt.plot', (['time', 'time_series'], {'LineWidth': '(2)', 'label': '"""Time series"""'}), "(time, time_series, LineWidth=2, label='Time series')\n", (60653, 60706), True, 'import matplotlib.pyplot as plt\n'), ((60707, 60771), 'matplotlib.pyplot.scatter', 'plt.scatter', (['maxima_x', 'maxima_y'], {'c': '"""r"""', 'zorder': '(4)', 'label': '"""Maxima"""'}), "(maxima_x, maxima_y, c='r', zorder=4, label='Maxima')\n", (60718, 60771), True, 'import matplotlib.pyplot as plt\n'), ((60772, 60836), 'matplotlib.pyplot.scatter', 'plt.scatter', (['minima_x', 'minima_y'], {'c': '"""b"""', 'zorder': '(4)', 'label': '"""Minima"""'}), "(minima_x, minima_y, c='b', zorder=4, label='Minima')\n", (60783, 60836), True, 'import matplotlib.pyplot as plt\n'), ((61316, 61361), 'matplotlib.pyplot.plot', 'plt.plot', (['time', 'minima_envelope'], {'c': '"""darkblue"""'}), "(time, minima_envelope, c='darkblue')\n", (61324, 61361), True, 'import matplotlib.pyplot as plt\n'), ((61362, 61431), 'matplotlib.pyplot.plot', 'plt.plot', (['time', '((maxima_envelope + minima_envelope) / 2)'], {'c': '"""darkblue"""'}), "(time, (maxima_envelope + minima_envelope) / 2, c='darkblue')\n", (61370, 61431), True, 'import matplotlib.pyplot as plt\n'), ((61526, 61577), 'matplotlib.pyplot.plot', 'plt.plot', (['time', 'minima_envelope_smooth'], {'c': '"""darkred"""'}), "(time, minima_envelope_smooth, c='darkred')\n", (61534, 61577), True, 'import matplotlib.pyplot as plt\n'), ((61578, 61665), 'matplotlib.pyplot.plot', 'plt.plot', (['time', '((maxima_envelope_smooth + minima_envelope_smooth) / 2)'], {'c': '"""darkred"""'}), "(time, (maxima_envelope_smooth + minima_envelope_smooth) / 2, c=\n    'darkred')\n", (61586, 61665), True, 'import matplotlib.pyplot as plt\n'), ((61755, 61806), 'matplotlib.pyplot.plot', 'plt.plot', (['time', 'EEMD_minima_envelope'], {'c': '"""darkgreen"""'}), "(time, EEMD_minima_envelope, c='darkgreen')\n", (61763, 61806), True, 'import matplotlib.pyplot as plt\n'), ((61807, 61892), 'matplotlib.pyplot.plot', 'plt.plot', (['time', '((EEMD_maxima_envelope + EEMD_minima_envelope) / 2)'], {'c': '"""darkgreen"""'}), "(time, (EEMD_maxima_envelope + EEMD_minima_envelope) / 2, c='darkgreen'\n    )\n", (61815, 61892), True, 'import matplotlib.pyplot as plt\n'), ((62170, 62308), 'matplotlib.pyplot.xticks', 'plt.xticks', (['(0, 1 * np.pi, 2 * np.pi, 3 * np.pi, 4 * np.pi, 5 * np.pi)', "('$0$', '$\\\\pi$', '2$\\\\pi$', '3$\\\\pi$', '4$\\\\pi$', '5$\\\\pi$')"], {}), "((0, 1 * np.pi, 2 * np.pi, 3 * np.pi, 4 * np.pi, 5 * np.pi), (\n    '$0$', '$\\\\pi$', '2$\\\\pi$', '3$\\\\pi$', '4$\\\\pi$', '5$\\\\pi$'))\n", (62180, 62308), True, 'import matplotlib.pyplot as plt\n'), ((62377, 62435), 'matplotlib.pyplot.yticks', 'plt.yticks', (['(-2, -1, 0, 1, 2)', "('-2', '-1', '0', '1', '2')"], {}), "((-2, -1, 0, 1, 2), ('-2', '-1', '0', '1', '2'))\n", (62387, 62435), True, 'import matplotlib.pyplot as plt\n'), ((62436, 62473), 'matplotlib.pyplot.xlim', 'plt.xlim', (['(-0.25 * np.pi)', '(5.25 * np.pi)'], {}), '(-0.25 * np.pi, 5.25 * np.pi)\n', (62444, 62473), True, 'import matplotlib.pyplot as plt\n'), ((62634, 62695), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/detrended_fluctuation_analysis.png"""'], {}), "('jss_figures/detrended_fluctuation_analysis.png')\n", (62645, 62695), True, 'import matplotlib.pyplot as plt\n'), ((62696, 62706), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (62704, 62706), True, 'import matplotlib.pyplot as plt\n'), ((62914, 62939), 'numpy.linspace', 'np.linspace', (['(0)', '(150)', '(1501)'], {}), '(0, 150, 1501)\n', (62925, 62939), True, 'import numpy as np\n'), ((62964, 62996), 'scipy.integrate.odeint', 'odeint', (['duffing_equation', 'XY0', 't'], {}), '(duffing_equation, XY0, t)\n', (62970, 62996), False, 'from scipy.integrate import odeint\n'), ((63156, 63174), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(1)'], {}), '(2, 1)\n', (63168, 63174), True, 'import matplotlib.pyplot as plt\n'), ((63175, 63206), 'matplotlib.pyplot.subplots_adjust', 'plt.subplots_adjust', ([], {'hspace': '(0.2)'}), '(hspace=0.2)\n', (63194, 63206), True, 'import matplotlib.pyplot as plt\n'), ((63783, 63830), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/Duffing_equation.png"""'], {}), "('jss_figures/Duffing_equation.png')\n", (63794, 63830), True, 'import matplotlib.pyplot as plt\n'), ((63831, 63841), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (63839, 63841), True, 'import matplotlib.pyplot as plt\n'), ((63891, 63902), 'PyEMD.EMD', 'pyemd0215', ([], {}), '()\n', (63900, 63902), True, 'from PyEMD import EMD as pyemd0215\n'), ((63934, 63993), 'emd.spectra.frequency_transform', 'emd040.spectra.frequency_transform', (['py_emd.T', '(10)', '"""hilbert"""'], {}), "(py_emd.T, 10, 'hilbert')\n", (63968, 63993), True, 'import emd as emd040\n'), ((64018, 64062), 'emd.spectra.define_hist_bins', 'emd040.spectra.define_hist_bins', (['(0)', '(0.2)', '(100)'], {}), '(0, 0.2, 100)\n', (64049, 64062), True, 'import emd as emd040\n'), ((64069, 64116), 'emd.spectra.hilberthuang', 'emd040.spectra.hilberthuang', (['IF', 'IA', 'freq_edges'], {}), '(IF, IA, freq_edges)\n', (64096, 64116), True, 'import emd as emd040\n'), ((64123, 64152), 'scipy.ndimage.gaussian_filter', 'gaussian_filter', (['hht'], {'sigma': '(1)'}), '(hht, sigma=1)\n', (64138, 64152), False, 'from scipy.ndimage import gaussian_filter\n'), ((64158, 64174), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(111)'], {}), '(111)\n', (64169, 64174), True, 'import matplotlib.pyplot as plt\n'), ((64727, 64756), 'matplotlib.pyplot.xticks', 'plt.xticks', (['[0, 50, 100, 150]'], {}), '([0, 50, 100, 150])\n', (64737, 64756), True, 'import matplotlib.pyplot as plt\n'), ((64757, 64782), 'matplotlib.pyplot.yticks', 'plt.yticks', (['[0, 0.1, 0.2]'], {}), '([0, 0.1, 0.2])\n', (64767, 64782), True, 'import matplotlib.pyplot as plt\n'), ((64783, 64811), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""Frequency (Hz)"""'], {}), "('Frequency (Hz)')\n", (64793, 64811), True, 'import matplotlib.pyplot as plt\n'), ((64812, 64834), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Time (s)"""'], {}), "('Time (s)')\n", (64822, 64834), True, 'import matplotlib.pyplot as plt\n'), ((65001, 65057), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/Duffing_equation_ht_pyemd.png"""'], {}), "('jss_figures/Duffing_equation_ht_pyemd.png')\n", (65012, 65057), True, 'import matplotlib.pyplot as plt\n'), ((65058, 65068), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (65066, 65068), True, 'import matplotlib.pyplot as plt\n'), ((65070, 65080), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (65078, 65080), True, 'import matplotlib.pyplot as plt\n'), ((65093, 65112), 'emd.sift.sift', 'emd040.sift.sift', (['x'], {}), '(x)\n', (65109, 65112), True, 'import emd as emd040\n'), ((65126, 65185), 'emd.spectra.frequency_transform', 'emd040.spectra.frequency_transform', (['emd_sift', '(10)', '"""hilbert"""'], {}), "(emd_sift, 10, 'hilbert')\n", (65160, 65185), True, 'import emd as emd040\n'), ((65210, 65254), 'emd.spectra.define_hist_bins', 'emd040.spectra.define_hist_bins', (['(0)', '(0.2)', '(100)'], {}), '(0, 0.2, 100)\n', (65241, 65254), True, 'import emd as emd040\n'), ((65261, 65308), 'emd.spectra.hilberthuang', 'emd040.spectra.hilberthuang', (['IF', 'IA', 'freq_edges'], {}), '(IF, IA, freq_edges)\n', (65288, 65308), True, 'import emd as emd040\n'), ((65315, 65344), 'scipy.ndimage.gaussian_filter', 'gaussian_filter', (['hht'], {'sigma': '(1)'}), '(hht, sigma=1)\n', (65330, 65344), False, 'from scipy.ndimage import gaussian_filter\n'), ((65350, 65366), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(111)'], {}), '(111)\n', (65361, 65366), True, 'import matplotlib.pyplot as plt\n'), ((65916, 65945), 'matplotlib.pyplot.xticks', 'plt.xticks', (['[0, 50, 100, 150]'], {}), '([0, 50, 100, 150])\n', (65926, 65945), True, 'import matplotlib.pyplot as plt\n'), ((65946, 65971), 'matplotlib.pyplot.yticks', 'plt.yticks', (['[0, 0.1, 0.2]'], {}), '([0, 0.1, 0.2])\n', (65956, 65971), True, 'import matplotlib.pyplot as plt\n'), ((65972, 66000), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""Frequency (Hz)"""'], {}), "('Frequency (Hz)')\n", (65982, 66000), True, 'import matplotlib.pyplot as plt\n'), ((66001, 66023), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Time (s)"""'], {}), "('Time (s)')\n", (66011, 66023), True, 'import matplotlib.pyplot as plt\n'), ((66190, 66244), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/Duffing_equation_ht_emd.png"""'], {}), "('jss_figures/Duffing_equation_ht_emd.png')\n", (66201, 66244), True, 'import matplotlib.pyplot as plt\n'), ((66245, 66255), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (66253, 66255), True, 'import matplotlib.pyplot as plt\n'), ((66314, 66349), 'AdvEMDpy.EMD', 'AdvEMDpy.EMD', ([], {'time': 't', 'time_series': 'x'}), '(time=t, time_series=x)\n', (66326, 66349), False, 'import AdvEMDpy\n'), ((66467, 66485), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(1)'], {}), '(2, 1)\n', (66479, 66485), True, 'import matplotlib.pyplot as plt\n'), ((66486, 66517), 'matplotlib.pyplot.subplots_adjust', 'plt.subplots_adjust', ([], {'hspace': '(0.3)'}), '(hspace=0.3)\n', (66505, 66517), True, 'import matplotlib.pyplot as plt\n'), ((68054, 68106), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/Duffing_equation_imfs.png"""'], {}), "('jss_figures/Duffing_equation_imfs.png')\n", (68065, 68106), True, 'import matplotlib.pyplot as plt\n'), ((68107, 68117), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (68115, 68117), True, 'import matplotlib.pyplot as plt\n'), ((68131, 68221), 'emd_hilbert.hilbert_spectrum', 'hilbert_spectrum', (['t', 'emd_duff', 'emd_ht_duff', 'emd_if_duff'], {'max_frequency': '(1.3)', 'plot': '(False)'}), '(t, emd_duff, emd_ht_duff, emd_if_duff, max_frequency=1.3,\n    plot=False)\n', (68147, 68221), False, 'from emd_hilbert import Hilbert, hilbert_spectrum\n'), ((68224, 68240), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(111)'], {}), '(111)\n', (68235, 68240), True, 'import matplotlib.pyplot as plt\n'), ((68842, 68871), 'matplotlib.pyplot.xticks', 'plt.xticks', (['[0, 50, 100, 150]'], {}), '([0, 50, 100, 150])\n', (68852, 68871), True, 'import matplotlib.pyplot as plt\n'), ((68872, 68897), 'matplotlib.pyplot.yticks', 'plt.yticks', (['[0, 0.1, 0.2]'], {}), '([0, 0.1, 0.2])\n', (68882, 68897), True, 'import matplotlib.pyplot as plt\n'), ((68898, 68926), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""Frequency (Hz)"""'], {}), "('Frequency (Hz)')\n", (68908, 68926), True, 'import matplotlib.pyplot as plt\n'), ((68927, 68949), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Time (s)"""'], {}), "('Time (s)')\n", (68937, 68949), True, 'import matplotlib.pyplot as plt\n'), ((69116, 69166), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/Duffing_equation_ht.png"""'], {}), "('jss_figures/Duffing_equation_ht.png')\n", (69127, 69166), True, 'import matplotlib.pyplot as plt\n'), ((69167, 69177), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (69175, 69177), True, 'import matplotlib.pyplot as plt\n'), ((69230, 69275), 'pandas.read_csv', 'pd.read_csv', (['"""Data/co2_mm_mlo.csv"""'], {'header': '(51)'}), "('Data/co2_mm_mlo.csv', header=51)\n", (69241, 69275), True, 'import pandas as pd\n'), ((69277, 69330), 'matplotlib.pyplot.plot', 'plt.plot', (["CO2_data['month']", "CO2_data['decimal date']"], {}), "(CO2_data['month'], CO2_data['decimal date'])\n", (69285, 69330), True, 'import matplotlib.pyplot as plt\n'), ((69426, 69457), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""Parts per million"""'], {}), "('Parts per million')\n", (69436, 69457), True, 'import matplotlib.pyplot as plt\n'), ((69458, 69484), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Time (years)"""'], {}), "('Time (years)')\n", (69468, 69484), True, 'import matplotlib.pyplot as plt\n'), ((69485, 69533), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/CO2_concentration.png"""'], {}), "('jss_figures/CO2_concentration.png')\n", (69496, 69533), True, 'import matplotlib.pyplot as plt\n'), ((69534, 69544), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (69542, 69544), True, 'import matplotlib.pyplot as plt\n'), ((69589, 69607), 'numpy.asarray', 'np.asarray', (['signal'], {}), '(signal)\n', (69599, 69607), True, 'import numpy as np\n'), ((69640, 69656), 'numpy.asarray', 'np.asarray', (['time'], {}), '(time)\n', (69650, 69656), True, 'import numpy as np\n'), ((69713, 69724), 'PyEMD.EMD', 'pyemd0215', ([], {}), '()\n', (69722, 69724), True, 'from PyEMD import EMD as pyemd0215\n'), ((69761, 69827), 'emd.spectra.frequency_transform', 'emd040.spectra.frequency_transform', (['py_emd[:2, :].T', '(12)', '"""hilbert"""'], {}), "(py_emd[:2, :].T, 12, 'hilbert')\n", (69795, 69827), True, 'import emd as emd040\n'), ((69954, 69996), 'emd.spectra.define_hist_bins', 'emd040.spectra.define_hist_bins', (['(0)', '(2)', '(100)'], {}), '(0, 2, 100)\n', (69985, 69996), True, 'import emd as emd040\n'), ((70003, 70050), 'emd.spectra.hilberthuang', 'emd040.spectra.hilberthuang', (['IF', 'IA', 'freq_edges'], {}), '(IF, IA, freq_edges)\n', (70030, 70050), True, 'import emd as emd040\n'), ((70057, 70086), 'scipy.ndimage.gaussian_filter', 'gaussian_filter', (['hht'], {'sigma': '(1)'}), '(hht, sigma=1)\n', (70072, 70086), False, 'from scipy.ndimage import gaussian_filter\n'), ((70097, 70111), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (70109, 70111), True, 'import matplotlib.pyplot as plt\n'), ((70348, 70385), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""Frequency (year$^{-1}$)"""'], {}), "('Frequency (year$^{-1}$)')\n", (70358, 70385), True, 'import matplotlib.pyplot as plt\n'), ((70386, 70412), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Time (years)"""'], {}), "('Time (years)')\n", (70396, 70412), True, 'import matplotlib.pyplot as plt\n'), ((70770, 70818), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/CO2_Hilbert_pyemd.png"""'], {}), "('jss_figures/CO2_Hilbert_pyemd.png')\n", (70781, 70818), True, 'import matplotlib.pyplot as plt\n'), ((70819, 70829), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (70827, 70829), True, 'import matplotlib.pyplot as plt\n'), ((70842, 70866), 'emd.sift.sift', 'emd040.sift.sift', (['signal'], {}), '(signal)\n', (70858, 70866), True, 'import emd as emd040\n'), ((70880, 70946), 'emd.spectra.frequency_transform', 'emd040.spectra.frequency_transform', (['emd_sift[:, :1]', '(12)', '"""hilbert"""'], {}), "(emd_sift[:, :1], 12, 'hilbert')\n", (70914, 70946), True, 'import emd as emd040\n'), ((71062, 71104), 'emd.spectra.define_hist_bins', 'emd040.spectra.define_hist_bins', (['(0)', '(2)', '(100)'], {}), '(0, 2, 100)\n', (71093, 71104), True, 'import emd as emd040\n'), ((71111, 71158), 'emd.spectra.hilberthuang', 'emd040.spectra.hilberthuang', (['IF', 'IA', 'freq_edges'], {}), '(IF, IA, freq_edges)\n', (71138, 71158), True, 'import emd as emd040\n'), ((71165, 71194), 'scipy.ndimage.gaussian_filter', 'gaussian_filter', (['hht'], {'sigma': '(1)'}), '(hht, sigma=1)\n', (71180, 71194), False, 'from scipy.ndimage import gaussian_filter\n'), ((71205, 71219), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (71217, 71219), True, 'import matplotlib.pyplot as plt\n'), ((71453, 71490), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""Frequency (year$^{-1}$)"""'], {}), "('Frequency (year$^{-1}$)')\n", (71463, 71490), True, 'import matplotlib.pyplot as plt\n'), ((71491, 71517), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Time (years)"""'], {}), "('Time (years)')\n", (71501, 71517), True, 'import matplotlib.pyplot as plt\n'), ((71875, 71921), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/CO2_Hilbert_emd.png"""'], {}), "('jss_figures/CO2_Hilbert_emd.png')\n", (71886, 71921), True, 'import matplotlib.pyplot as plt\n'), ((71922, 71932), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (71930, 71932), True, 'import matplotlib.pyplot as plt\n'), ((71992, 72027), 'numpy.linspace', 'np.linspace', (['time[0]', 'time[-1]', '(200)'], {}), '(time[0], time[-1], 200)\n', (72003, 72027), True, 'import numpy as np\n'), ((72043, 72086), 'AdvEMDpy.EMD', 'AdvEMDpy.EMD', ([], {'time': 'time', 'time_series': 'signal'}), '(time=time, time_series=signal)\n', (72055, 72086), False, 'import AdvEMDpy\n'), ((72341, 72359), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(2)'], {}), '(2, 2)\n', (72353, 72359), True, 'import matplotlib.pyplot as plt\n'), ((72360, 72391), 'matplotlib.pyplot.subplots_adjust', 'plt.subplots_adjust', ([], {'hspace': '(0.5)'}), '(hspace=0.5)\n', (72379, 72391), True, 'import matplotlib.pyplot as plt\n'), ((73151, 73189), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/CO2_EMD.png"""'], {}), "('jss_figures/CO2_EMD.png')\n", (73162, 73189), True, 'import matplotlib.pyplot as plt\n'), ((73190, 73200), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (73198, 73200), True, 'import matplotlib.pyplot as plt\n'), ((73214, 73302), 'emd_hilbert.hilbert_spectrum', 'hilbert_spectrum', (['time', 'imfs', 'hts', 'ifs'], {'max_frequency': '(10)', 'which_imfs': '[1]', 'plot': '(False)'}), '(time, imfs, hts, ifs, max_frequency=10, which_imfs=[1],\n    plot=False)\n', (73230, 73302), False, 'from emd_hilbert import Hilbert, hilbert_spectrum\n'), ((73388, 73402), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (73400, 73402), True, 'import matplotlib.pyplot as plt\n'), ((73718, 73755), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""Frequency (year$^{-1}$)"""'], {}), "('Frequency (year$^{-1}$)')\n", (73728, 73755), True, 'import matplotlib.pyplot as plt\n'), ((73756, 73782), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Time (years)"""'], {}), "('Time (years)')\n", (73766, 73782), True, 'import matplotlib.pyplot as plt\n'), ((74105, 74147), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""jss_figures/CO2_Hilbert.png"""'], {}), "('jss_figures/CO2_Hilbert.png')\n", (74116, 74147), True, 'import matplotlib.pyplot as plt\n'), ((74148, 74158), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (74156, 74158), True, 'import matplotlib.pyplot as plt\n'), ((772, 795), 'numpy.sin', 'np.sin', (['pseudo_alg_time'], {}), '(pseudo_alg_time)\n', (778, 795), True, 'import numpy as np\n'), ((798, 825), 'numpy.sin', 'np.sin', (['(5 * pseudo_alg_time)'], {}), '(5 * pseudo_alg_time)\n', (804, 825), True, 'import numpy as np\n'), ((1807, 1830), 'numpy.sin', 'np.sin', (['pseudo_alg_time'], {}), '(pseudo_alg_time)\n', (1813, 1830), True, 'import numpy as np\n'), ((2994, 3021), 'numpy.linspace', 'np.linspace', (['(-0.2)', '(1.2)', '(100)'], {}), '(-0.2, 1.2, 100)\n', (3005, 3021), True, 'import numpy as np\n'), ((3056, 3083), 'numpy.linspace', 'np.linspace', (['(-0.2)', '(1.2)', '(100)'], {}), '(-0.2, 1.2, 100)\n', (3067, 3083), True, 'import numpy as np\n'), ((3286, 3315), 'numpy.sin', 'np.sin', (['knot_demonstrate_time'], {}), '(knot_demonstrate_time)\n', (3292, 3315), True, 'import numpy as np\n'), ((3318, 3351), 'numpy.sin', 'np.sin', (['(5 * knot_demonstrate_time)'], {}), '(5 * knot_demonstrate_time)\n', (3324, 3351), True, 'import numpy as np\n'), ((4529, 4552), 'numpy.linspace', 'np.linspace', (['(-2)', '(2)', '(101)'], {}), '(-2, 2, 101)\n', (4540, 4552), True, 'import numpy as np\n'), ((4662, 4685), 'numpy.linspace', 'np.linspace', (['(-2)', '(2)', '(101)'], {}), '(-2, 2, 101)\n', (4673, 4685), True, 'import numpy as np\n'), ((4763, 4786), 'numpy.linspace', 'np.linspace', (['(-2)', '(2)', '(101)'], {}), '(-2, 2, 101)\n', (4774, 4786), True, 'import numpy as np\n'), ((5139, 5168), 'numpy.sin', 'np.sin', (['knot_demonstrate_time'], {}), '(knot_demonstrate_time)\n', (5145, 5168), True, 'import numpy as np\n'), ((5171, 5204), 'numpy.sin', 'np.sin', (['(5 * knot_demonstrate_time)'], {}), '(5 * knot_demonstrate_time)\n', (5177, 5204), True, 'import numpy as np\n'), ((6445, 6468), 'numpy.linspace', 'np.linspace', (['(-2)', '(2)', '(101)'], {}), '(-2, 2, 101)\n', (6456, 6468), True, 'import numpy as np\n'), ((6570, 6593), 'numpy.linspace', 'np.linspace', (['(-2)', '(2)', '(101)'], {}), '(-2, 2, 101)\n', (6581, 6593), True, 'import numpy as np\n'), ((6663, 6686), 'numpy.linspace', 'np.linspace', (['(-2)', '(2)', '(101)'], {}), '(-2, 2, 101)\n', (6674, 6686), True, 'import numpy as np\n'), ((7017, 7046), 'numpy.sin', 'np.sin', (['knot_demonstrate_time'], {}), '(knot_demonstrate_time)\n', (7023, 7046), True, 'import numpy as np\n'), ((7049, 7082), 'numpy.sin', 'np.sin', (['(5 * knot_demonstrate_time)'], {}), '(5 * knot_demonstrate_time)\n', (7055, 7082), True, 'import numpy as np\n'), ((8309, 8332), 'numpy.linspace', 'np.linspace', (['(-2)', '(2)', '(101)'], {}), '(-2, 2, 101)\n', (8320, 8332), True, 'import numpy as np\n'), ((8437, 8460), 'numpy.linspace', 'np.linspace', (['(-2)', '(2)', '(101)'], {}), '(-2, 2, 101)\n', (8448, 8460), True, 'import numpy as np\n'), ((8533, 8556), 'numpy.linspace', 'np.linspace', (['(-2)', '(2)', '(101)'], {}), '(-2, 2, 101)\n', (8544, 8556), True, 'import numpy as np\n'), ((9378, 9400), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)'], {}), '(0, 1)\n', (9394, 9400), True, 'import numpy as np\n'), ((10482, 10526), 'numpy.linspace', 'np.linspace', (['(0.85 * np.pi)', '(1.15 * np.pi)', '(101)'], {}), '(0.85 * np.pi, 1.15 * np.pi, 101)\n', (10493, 10526), True, 'import numpy as np\n'), ((10630, 10674), 'numpy.linspace', 'np.linspace', (['(0.85 * np.pi)', '(1.15 * np.pi)', '(101)'], {}), '(0.85 * np.pi, 1.15 * np.pi, 101)\n', (10641, 10674), True, 'import numpy as np\n'), ((10752, 10775), 'numpy.linspace', 'np.linspace', (['(-3)', '(3)', '(101)'], {}), '(-3, 3, 101)\n', (10763, 10775), True, 'import numpy as np\n'), ((10835, 10858), 'numpy.linspace', 'np.linspace', (['(-3)', '(3)', '(101)'], {}), '(-3, 3, 101)\n', (10846, 10858), True, 'import numpy as np\n'), ((13644, 13688), 'numpy.linspace', 'np.linspace', (['(0.85 * np.pi)', '(1.15 * np.pi)', '(101)'], {}), '(0.85 * np.pi, 1.15 * np.pi, 101)\n', (13655, 13688), True, 'import numpy as np\n'), ((13792, 13836), 'numpy.linspace', 'np.linspace', (['(0.85 * np.pi)', '(1.15 * np.pi)', '(101)'], {}), '(0.85 * np.pi, 1.15 * np.pi, 101)\n', (13803, 13836), True, 'import numpy as np\n'), ((13914, 13937), 'numpy.linspace', 'np.linspace', (['(-3)', '(3)', '(101)'], {}), '(-3, 3, 101)\n', (13925, 13937), True, 'import numpy as np\n'), ((13997, 14020), 'numpy.linspace', 'np.linspace', (['(-3)', '(3)', '(101)'], {}), '(-3, 3, 101)\n', (14008, 14020), True, 'import numpy as np\n'), ((15795, 15822), 'numpy.linspace', 'np.linspace', (['(-0.2)', '(0.8)', '(100)'], {}), '(-0.2, 0.8, 100)\n', (15806, 15822), True, 'import numpy as np\n'), ((15860, 15887), 'numpy.linspace', 'np.linspace', (['(-0.2)', '(0.8)', '(100)'], {}), '(-0.2, 0.8, 100)\n', (15871, 15887), True, 'import numpy as np\n'), ((16263, 16290), 'numpy.linspace', 'np.linspace', (['(-0.2)', '(1.2)', '(100)'], {}), '(-0.2, 1.2, 100)\n', (16274, 16290), True, 'import numpy as np\n'), ((16328, 16355), 'numpy.linspace', 'np.linspace', (['(-0.2)', '(1.2)', '(100)'], {}), '(-0.2, 1.2, 100)\n', (16339, 16355), True, 'import numpy as np\n'), ((16622, 16634), 'numpy.cos', 'np.cos', (['time'], {}), '(time)\n', (16628, 16634), True, 'import numpy as np\n'), ((16637, 16653), 'numpy.cos', 'np.cos', (['(5 * time)'], {}), '(5 * time)\n', (16643, 16653), True, 'import numpy as np\n'), ((17029, 17056), 'numpy.ones_like', 'np.ones_like', (['max_dash_time'], {}), '(max_dash_time)\n', (17041, 17056), True, 'import numpy as np\n'), ((17160, 17187), 'numpy.ones_like', 'np.ones_like', (['min_dash_time'], {}), '(min_dash_time)\n', (17172, 17187), True, 'import numpy as np\n'), ((17517, 17552), 'numpy.ones_like', 'np.ones_like', (['max_discard_dash_time'], {}), '(max_discard_dash_time)\n', (17529, 17552), True, 'import numpy as np\n'), ((18741, 18770), 'numpy.ones_like', 'np.ones_like', (['length_distance'], {}), '(length_distance)\n', (18753, 18770), True, 'import numpy as np\n'), ((18880, 18905), 'numpy.ones_like', 'np.ones_like', (['length_time'], {}), '(length_time)\n', (18892, 18905), True, 'import numpy as np\n'), ((18937, 18962), 'numpy.ones_like', 'np.ones_like', (['length_time'], {}), '(length_time)\n', (18949, 18962), True, 'import numpy as np\n'), ((19089, 19120), 'numpy.ones_like', 'np.ones_like', (['length_distance_2'], {}), '(length_distance_2)\n', (19101, 19120), True, 'import numpy as np\n'), ((19237, 19264), 'numpy.ones_like', 'np.ones_like', (['length_time_2'], {}), '(length_time_2)\n', (19249, 19264), True, 'import numpy as np\n'), ((19298, 19325), 'numpy.ones_like', 'np.ones_like', (['length_time_2'], {}), '(length_time_2)\n', (19310, 19325), True, 'import numpy as np\n'), ((19365, 19377), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (19372, 19377), True, 'import numpy as np\n'), ((19412, 19424), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (19419, 19424), True, 'import numpy as np\n'), ((19561, 19583), 'numpy.ones_like', 'np.ones_like', (['end_time'], {}), '(end_time)\n', (19573, 19583), True, 'import numpy as np\n'), ((19698, 19731), 'numpy.ones_like', 'np.ones_like', (['anti_symmetric_time'], {}), '(anti_symmetric_time)\n', (19710, 19731), True, 'import numpy as np\n'), ((22012, 22024), 'numpy.cos', 'np.cos', (['time'], {}), '(time)\n', (22018, 22024), True, 'import numpy as np\n'), ((22027, 22043), 'numpy.cos', 'np.cos', (['(5 * time)'], {}), '(5 * time)\n', (22033, 22043), True, 'import numpy as np\n'), ((22497, 22521), 'numpy.ones_like', 'np.ones_like', (['max_dash_1'], {}), '(max_dash_1)\n', (22509, 22521), True, 'import numpy as np\n'), ((22555, 22579), 'numpy.ones_like', 'np.ones_like', (['max_dash_1'], {}), '(max_dash_1)\n', (22567, 22579), True, 'import numpy as np\n'), ((22761, 22785), 'numpy.ones_like', 'np.ones_like', (['min_dash_1'], {}), '(min_dash_1)\n', (22773, 22785), True, 'import numpy as np\n'), ((22819, 22843), 'numpy.ones_like', 'np.ones_like', (['min_dash_1'], {}), '(min_dash_1)\n', (22831, 22843), True, 'import numpy as np\n'), ((23342, 23366), 'numpy.ones_like', 'np.ones_like', (['max_dash_1'], {}), '(max_dash_1)\n', (23354, 23366), True, 'import numpy as np\n'), ((23878, 23902), 'numpy.ones_like', 'np.ones_like', (['min_dash_1'], {}), '(min_dash_1)\n', (23890, 23902), True, 'import numpy as np\n'), ((24227, 24252), 'numpy.ones_like', 'np.ones_like', (['maxima_dash'], {}), '(maxima_dash)\n', (24239, 24252), True, 'import numpy as np\n'), ((24289, 24314), 'numpy.ones_like', 'np.ones_like', (['maxima_dash'], {}), '(maxima_dash)\n', (24301, 24314), True, 'import numpy as np\n'), ((24363, 24388), 'numpy.ones_like', 'np.ones_like', (['maxima_dash'], {}), '(maxima_dash)\n', (24375, 24388), True, 'import numpy as np\n'), ((24495, 24530), 'numpy.ones_like', 'np.ones_like', (['maxima_line_dash_time'], {}), '(maxima_line_dash_time)\n', (24507, 24530), True, 'import numpy as np\n'), ((24627, 24652), 'numpy.ones_like', 'np.ones_like', (['minima_dash'], {}), '(minima_dash)\n', (24639, 24652), True, 'import numpy as np\n'), ((24689, 24714), 'numpy.ones_like', 'np.ones_like', (['minima_dash'], {}), '(minima_dash)\n', (24701, 24714), True, 'import numpy as np\n'), ((24763, 24788), 'numpy.ones_like', 'np.ones_like', (['minima_dash'], {}), '(minima_dash)\n', (24775, 24788), True, 'import numpy as np\n'), ((24896, 24931), 'numpy.ones_like', 'np.ones_like', (['minima_line_dash_time'], {}), '(minima_line_dash_time)\n', (24908, 24931), True, 'import numpy as np\n'), ((25757, 25781), 'numpy.ones_like', 'np.ones_like', (['min_dash_4'], {}), '(min_dash_4)\n', (25769, 25781), True, 'import numpy as np\n'), ((29062, 29074), 'numpy.cos', 'np.cos', (['time'], {}), '(time)\n', (29068, 29074), True, 'import numpy as np\n'), ((29077, 29093), 'numpy.cos', 'np.cos', (['(5 * time)'], {}), '(5 * time)\n', (29083, 29093), True, 'import numpy as np\n'), ((29372, 29407), 'numpy.abs', 'np.abs', (['(maxima_y[-2] - minima_y[-2])'], {}), '(maxima_y[-2] - minima_y[-2])\n', (29378, 29407), True, 'import numpy as np\n'), ((29417, 29452), 'numpy.abs', 'np.abs', (['(maxima_y[-1] - minima_y[-1])'], {}), '(maxima_y[-1] - minima_y[-1])\n', (29423, 29452), True, 'import numpy as np\n'), ((29466, 29501), 'numpy.abs', 'np.abs', (['(maxima_x[-2] - minima_x[-2])'], {}), '(maxima_x[-2] - minima_x[-2])\n', (29472, 29501), True, 'import numpy as np\n'), ((29511, 29546), 'numpy.abs', 'np.abs', (['(maxima_x[-1] - minima_x[-1])'], {}), '(maxima_x[-1] - minima_x[-1])\n', (29517, 29546), True, 'import numpy as np\n'), ((29806, 29871), 'numpy.cos', 'np.cos', (['(2 * np.pi * (1 / P1) * (Coughlin_time - Coughlin_time[0]))'], {}), '(2 * np.pi * (1 / P1) * (Coughlin_time - Coughlin_time[0]))\n', (29812, 29871), True, 'import numpy as np\n'), ((31033, 31059), 'numpy.ones_like', 'np.ones_like', (['max_2_x_time'], {}), '(max_2_x_time)\n', (31045, 31059), True, 'import numpy as np\n'), ((31241, 31267), 'numpy.ones_like', 'np.ones_like', (['min_2_x_time'], {}), '(min_2_x_time)\n', (31253, 31267), True, 'import numpy as np\n'), ((31371, 31401), 'numpy.ones_like', 'np.ones_like', (['dash_max_min_2_x'], {}), '(dash_max_min_2_x)\n', (31383, 31401), True, 'import numpy as np\n'), ((31564, 31585), 'numpy.ones_like', 'np.ones_like', (['max_2_y'], {}), '(max_2_y)\n', (31576, 31585), True, 'import numpy as np\n'), ((31748, 31769), 'numpy.ones_like', 'np.ones_like', (['min_2_y'], {}), '(min_2_y)\n', (31760, 31769), True, 'import numpy as np\n'), ((31866, 31901), 'numpy.ones_like', 'np.ones_like', (['dash_max_min_2_y_time'], {}), '(dash_max_min_2_y_time)\n', (31878, 31901), True, 'import numpy as np\n'), ((32083, 32109), 'numpy.ones_like', 'np.ones_like', (['max_1_x_time'], {}), '(max_1_x_time)\n', (32095, 32109), True, 'import numpy as np\n'), ((32291, 32317), 'numpy.ones_like', 'np.ones_like', (['min_1_x_time'], {}), '(min_1_x_time)\n', (32303, 32317), True, 'import numpy as np\n'), ((32421, 32451), 'numpy.ones_like', 'np.ones_like', (['dash_max_min_1_x'], {}), '(dash_max_min_1_x)\n', (32433, 32451), True, 'import numpy as np\n'), ((32614, 32635), 'numpy.ones_like', 'np.ones_like', (['max_1_y'], {}), '(max_1_y)\n', (32626, 32635), True, 'import numpy as np\n'), ((32798, 32819), 'numpy.ones_like', 'np.ones_like', (['min_1_y'], {}), '(min_1_y)\n', (32810, 32819), True, 'import numpy as np\n'), ((32916, 32951), 'numpy.ones_like', 'np.ones_like', (['dash_max_min_1_y_time'], {}), '(dash_max_min_1_y_time)\n', (32928, 32951), True, 'import numpy as np\n'), ((36151, 36163), 'numpy.cos', 'np.cos', (['time'], {}), '(time)\n', (36157, 36163), True, 'import numpy as np\n'), ((36166, 36182), 'numpy.cos', 'np.cos', (['(5 * time)'], {}), '(5 * time)\n', (36172, 36182), True, 'import numpy as np\n'), ((36283, 36311), 'numpy.zeros_like', 'np.zeros_like', (['time_extended'], {}), '(time_extended)\n', (36296, 36311), True, 'import numpy as np\n'), ((36783, 36808), 'numpy.ones', 'np.ones', (['neural_network_k'], {}), '(neural_network_k)\n', (36790, 36808), True, 'import numpy as np\n'), ((36943, 36974), 'numpy.matmul', 'np.matmul', (['weights', 'train_input'], {}), '(weights, train_input)\n', (36952, 36974), True, 'import numpy as np\n'), ((37097, 37123), 'numpy.mean', 'np.mean', (['gradients'], {'axis': '(1)'}), '(gradients, axis=1)\n', (37104, 37123), True, 'import numpy as np\n'), ((39331, 39364), 'cvxpy.norm', 'cvx.norm', (['(2 * (vx * P) + 1 - t)', '(2)'], {}), '(2 * (vx * P) + 1 - t, 2)\n', (39339, 39364), True, 'import cvxpy as cvx\n'), ((42240, 42269), 'numpy.linspace', 'np.linspace', (['(-2.75)', '(2.75)', '(100)'], {}), '(-2.75, 2.75, 100)\n', (42251, 42269), True, 'import numpy as np\n'), ((42346, 42435), 'numpy.linspace', 'np.linspace', (['((time[-302] + time[-301]) / 2)', '((time[-302] + time[-301]) / 2 + 0.1)', '(100)'], {}), '((time[-302] + time[-301]) / 2, (time[-302] + time[-301]) / 2 + \n    0.1, 100)\n', (42357, 42435), True, 'import numpy as np\n'), ((42483, 42572), 'numpy.linspace', 'np.linspace', (['((time[-302] + time[-301]) / 2)', '((time[-302] + time[-301]) / 2 + 0.1)', '(100)'], {}), '((time[-302] + time[-301]) / 2, (time[-302] + time[-301]) / 2 + \n    0.1, 100)\n', (42494, 42572), True, 'import numpy as np\n'), ((42619, 42748), 'numpy.linspace', 'np.linspace', (['((time_extended[-1001] + time_extended[-1002]) / 2)', '((time_extended[-1001] + time_extended[-1002]) / 2 - 0.1)', '(100)'], {}), '((time_extended[-1001] + time_extended[-1002]) / 2, (\n    time_extended[-1001] + time_extended[-1002]) / 2 - 0.1, 100)\n', (42630, 42748), True, 'import numpy as np\n'), ((42808, 42937), 'numpy.linspace', 'np.linspace', (['((time_extended[-1001] + time_extended[-1002]) / 2)', '((time_extended[-1001] + time_extended[-1002]) / 2 - 0.1)', '(100)'], {}), '((time_extended[-1001] + time_extended[-1002]) / 2, (\n    time_extended[-1001] + time_extended[-1002]) / 2 - 0.1, 100)\n', (42819, 42937), True, 'import numpy as np\n'), ((43064, 43093), 'numpy.linspace', 'np.linspace', (['(-2.75)', '(2.75)', '(100)'], {}), '(-2.75, 2.75, 100)\n', (43075, 43093), True, 'import numpy as np\n'), ((43160, 43189), 'numpy.linspace', 'np.linspace', (['(-2.75)', '(2.75)', '(100)'], {}), '(-2.75, 2.75, 100)\n', (43171, 43189), True, 'import numpy as np\n'), ((43290, 43379), 'numpy.linspace', 'np.linspace', (['((time[-202] + time[-201]) / 2)', '((time[-202] + time[-201]) / 2 + 0.1)', '(100)'], {}), '((time[-202] + time[-201]) / 2, (time[-202] + time[-201]) / 2 + \n    0.1, 100)\n', (43301, 43379), True, 'import numpy as np\n'), ((43430, 43519), 'numpy.linspace', 'np.linspace', (['((time[-202] + time[-201]) / 2)', '((time[-202] + time[-201]) / 2 + 0.1)', '(100)'], {}), '((time[-202] + time[-201]) / 2, (time[-202] + time[-201]) / 2 + \n    0.1, 100)\n', (43441, 43519), True, 'import numpy as np\n'), ((43569, 43698), 'numpy.linspace', 'np.linspace', (['((time_extended[-1001] + time_extended[-1000]) / 2)', '((time_extended[-1001] + time_extended[-1000]) / 2 - 0.1)', '(100)'], {}), '((time_extended[-1001] + time_extended[-1000]) / 2, (\n    time_extended[-1001] + time_extended[-1000]) / 2 - 0.1, 100)\n', (43580, 43698), True, 'import numpy as np\n'), ((43761, 43890), 'numpy.linspace', 'np.linspace', (['((time_extended[-1001] + time_extended[-1000]) / 2)', '((time_extended[-1001] + time_extended[-1000]) / 2 - 0.1)', '(100)'], {}), '((time_extended[-1001] + time_extended[-1000]) / 2, (\n    time_extended[-1001] + time_extended[-1000]) / 2 - 0.1, 100)\n', (43772, 43890), True, 'import numpy as np\n'), ((44020, 44049), 'numpy.linspace', 'np.linspace', (['(-2.75)', '(2.75)', '(100)'], {}), '(-2.75, 2.75, 100)\n', (44031, 44049), True, 'import numpy as np\n'), ((44623, 44639), 'numpy.cos', 'np.cos', (['(8 * time)'], {}), '(8 * time)\n', (44629, 44639), True, 'import numpy as np\n'), ((45509, 45594), 'textwrap.fill', 'textwrap.fill', (['"""Comparison of Trends Extracted with Different Knot Sequences"""', '(40)'], {}), "('Comparison of Trends Extracted with Different Knot Sequences',\n    40)\n", (45522, 45594), False, 'import textwrap\n'), ((46081, 46104), 'numpy.linspace', 'np.linspace', (['(-5)', '(5)', '(101)'], {}), '(-5, 5, 101)\n', (46092, 46104), True, 'import numpy as np\n'), ((46282, 46326), 'numpy.linspace', 'np.linspace', (['(0.95 * np.pi)', '(1.55 * np.pi)', '(101)'], {}), '(0.95 * np.pi, 1.55 * np.pi, 101)\n', (46293, 46326), True, 'import numpy as np\n'), ((46367, 46411), 'numpy.linspace', 'np.linspace', (['(0.95 * np.pi)', '(1.55 * np.pi)', '(101)'], {}), '(0.95 * np.pi, 1.55 * np.pi, 101)\n', (46378, 46411), True, 'import numpy as np\n'), ((46482, 46509), 'numpy.linspace', 'np.linspace', (['(-5.5)', '(5.5)', '(101)'], {}), '(-5.5, 5.5, 101)\n', (46493, 46509), True, 'import numpy as np\n'), ((46559, 46586), 'numpy.linspace', 'np.linspace', (['(-5.5)', '(5.5)', '(101)'], {}), '(-5.5, 5.5, 101)\n', (46570, 46586), True, 'import numpy as np\n'), ((47335, 47358), 'numpy.linspace', 'np.linspace', (['(-5)', '(5)', '(101)'], {}), '(-5, 5, 101)\n', (47346, 47358), True, 'import numpy as np\n'), ((47719, 47763), 'numpy.linspace', 'np.linspace', (['(0.95 * np.pi)', '(1.55 * np.pi)', '(101)'], {}), '(0.95 * np.pi, 1.55 * np.pi, 101)\n', (47730, 47763), True, 'import numpy as np\n'), ((47804, 47848), 'numpy.linspace', 'np.linspace', (['(0.95 * np.pi)', '(1.55 * np.pi)', '(101)'], {}), '(0.95 * np.pi, 1.55 * np.pi, 101)\n', (47815, 47848), True, 'import numpy as np\n'), ((47919, 47946), 'numpy.linspace', 'np.linspace', (['(-5.5)', '(5.5)', '(101)'], {}), '(-5.5, 5.5, 101)\n', (47930, 47946), True, 'import numpy as np\n'), ((47996, 48023), 'numpy.linspace', 'np.linspace', (['(-5.5)', '(5.5)', '(101)'], {}), '(-5.5, 5.5, 101)\n', (48007, 48023), True, 'import numpy as np\n'), ((48529, 48552), 'numpy.linspace', 'np.linspace', (['(-5)', '(5)', '(101)'], {}), '(-5, 5, 101)\n', (48540, 48552), True, 'import numpy as np\n'), ((48950, 48994), 'numpy.linspace', 'np.linspace', (['(0.95 * np.pi)', '(1.55 * np.pi)', '(101)'], {}), '(0.95 * np.pi, 1.55 * np.pi, 101)\n', (48961, 48994), True, 'import numpy as np\n'), ((49035, 49079), 'numpy.linspace', 'np.linspace', (['(0.95 * np.pi)', '(1.55 * np.pi)', '(101)'], {}), '(0.95 * np.pi, 1.55 * np.pi, 101)\n', (49046, 49079), True, 'import numpy as np\n'), ((49150, 49177), 'numpy.linspace', 'np.linspace', (['(-5.5)', '(5.5)', '(101)'], {}), '(-5.5, 5.5, 101)\n', (49161, 49177), True, 'import numpy as np\n'), ((49227, 49254), 'numpy.linspace', 'np.linspace', (['(-5.5)', '(5.5)', '(101)'], {}), '(-5.5, 5.5, 101)\n', (49238, 49254), True, 'import numpy as np\n'), ((49403, 49508), 'textwrap.fill', 'textwrap.fill', (['"""Comparison of Trends Extracted with Different Knot Sequences Zoomed Region"""', '(40)'], {}), "(\n    'Comparison of Trends Extracted with Different Knot Sequences Zoomed Region'\n    , 40)\n", (49416, 49508), False, 'import textwrap\n'), ((49863, 49886), 'numpy.linspace', 'np.linspace', (['(-5)', '(5)', '(101)'], {}), '(-5, 5, 101)\n', (49874, 49886), True, 'import numpy as np\n'), ((50730, 50753), 'numpy.linspace', 'np.linspace', (['(-5)', '(5)', '(101)'], {}), '(-5, 5, 101)\n', (50741, 50753), True, 'import numpy as np\n'), ((51555, 51578), 'numpy.linspace', 'np.linspace', (['(-5)', '(5)', '(101)'], {}), '(-5, 5, 101)\n', (51566, 51578), True, 'import numpy as np\n'), ((52303, 52417), 'textwrap.fill', 'textwrap.fill', (['"""Gaussian Filtered Hilbert Spectrum of Simple Sinusoidal Time Seres with Added Noise"""', '(50)'], {}), "(\n    'Gaussian Filtered Hilbert Spectrum of Simple Sinusoidal Time Seres with Added Noise'\n    , 50)\n", (52316, 52417), False, 'import textwrap\n'), ((52489, 52498), 'numpy.abs', 'np.abs', (['z'], {}), '(z)\n', (52495, 52498), True, 'import numpy as np\n'), ((53307, 53319), 'numpy.cos', 'np.cos', (['time'], {}), '(time)\n', (53313, 53319), True, 'import numpy as np\n'), ((53322, 53338), 'numpy.cos', 'np.cos', (['(5 * time)'], {}), '(5 * time)\n', (53328, 53338), True, 'import numpy as np\n'), ((54128, 54257), 'textwrap.fill', 'textwrap.fill', (['"""Plot Demonstrating Unsmoothed Extrema Envelopes if Schoenberg–Whitney Conditions are Not Satisfied"""', '(50)'], {}), "(\n    'Plot Demonstrating Unsmoothed Extrema Envelopes if Schoenberg–Whitney Conditions are Not Satisfied'\n    , 50)\n", (54141, 54257), False, 'import textwrap\n'), ((55025, 55053), 'numpy.linspace', 'np.linspace', (['(-3.0)', '(-2.0)', '(101)'], {}), '(-3.0, -2.0, 101)\n', (55036, 55053), True, 'import numpy as np\n'), ((55733, 55745), 'numpy.cos', 'np.cos', (['time'], {}), '(time)\n', (55739, 55745), True, 'import numpy as np\n'), ((55748, 55764), 'numpy.cos', 'np.cos', (['(5 * time)'], {}), '(5 * time)\n', (55754, 55764), True, 'import numpy as np\n'), ((62125, 62137), 'numpy.cos', 'np.cos', (['time'], {}), '(time)\n', (62131, 62137), True, 'import numpy as np\n'), ((64309, 64413), 'textwrap.fill', 'textwrap.fill', (['"""Gaussian Filtered Hilbert Spectrum of Duffing Equation using PyEMD 0.2.10"""', '(40)'], {}), "(\n    'Gaussian Filtered Hilbert Spectrum of Duffing Equation using PyEMD 0.2.10'\n    , 40)\n", (64322, 64413), False, 'import textwrap\n'), ((65501, 65601), 'textwrap.fill', 'textwrap.fill', (['"""Gaussian Filtered Hilbert Spectrum of Duffing Equation using emd 0.3.3"""', '(40)'], {}), "(\n    'Gaussian Filtered Hilbert Spectrum of Duffing Equation using emd 0.3.3',\n    40)\n", (65514, 65601), False, 'import textwrap\n'), ((68251, 68351), 'textwrap.fill', 'textwrap.fill', (['"""Gaussian Filtered Hilbert Spectrum of Duffing Equation using AdvEMDpy"""', '(40)'], {}), "(\n    'Gaussian Filtered Hilbert Spectrum of Duffing Equation using AdvEMDpy', 40\n    )\n", (68264, 68351), False, 'import textwrap\n'), ((68561, 68570), 'numpy.abs', 'np.abs', (['z'], {}), '(z)\n', (68567, 68570), True, 'import numpy as np\n'), ((69341, 69428), 'textwrap.fill', 'textwrap.fill', (['"""Mean Monthly Concentration of Carbon Dioxide in the Atmosphere"""', '(35)'], {}), "('Mean Monthly Concentration of Carbon Dioxide in the Atmosphere',\n    35)\n", (69354, 69428), False, 'import textwrap\n'), ((70246, 70356), 'textwrap.fill', 'textwrap.fill', (['"""Gaussian Filtered Hilbert Spectrum of CO$_{2}$ Concentration using PyEMD 0.2.10"""', '(45)'], {}), "(\n    'Gaussian Filtered Hilbert Spectrum of CO$_{2}$ Concentration using PyEMD 0.2.10'\n    , 45)\n", (70259, 70356), False, 'import textwrap\n'), ((70528, 70546), 'numpy.ones_like', 'np.ones_like', (['time'], {}), '(time)\n', (70540, 70546), True, 'import numpy as np\n'), ((71354, 71461), 'textwrap.fill', 'textwrap.fill', (['"""Gaussian Filtered Hilbert Spectrum of CO$_{2}$ Concentration using emd 0.3.3"""', '(45)'], {}), "(\n    'Gaussian Filtered Hilbert Spectrum of CO$_{2}$ Concentration using emd 0.3.3'\n    , 45)\n", (71367, 71461), False, 'import textwrap\n'), ((71633, 71651), 'numpy.ones_like', 'np.ones_like', (['time'], {}), '(time)\n', (71645, 71651), True, 'import numpy as np\n'), ((73550, 73559), 'numpy.abs', 'np.abs', (['z'], {}), '(z)\n', (73556, 73559), True, 'import numpy as np\n'), ((73619, 73725), 'textwrap.fill', 'textwrap.fill', (['"""Gaussian Filtered Hilbert Spectrum of CO$_{2}$ Concentration using AdvEMDpy"""', '(40)'], {}), "(\n    'Gaussian Filtered Hilbert Spectrum of CO$_{2}$ Concentration using AdvEMDpy'\n    , 40)\n", (73632, 73725), False, 'import textwrap\n'), ((73804, 73830), 'numpy.ones_like', 'np.ones_like', (['x_hs[(0), :]'], {}), '(x_hs[(0), :])\n', (73816, 73830), True, 'import numpy as np\n'), ((983, 992), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (990, 992), True, 'import matplotlib.pyplot as plt\n'), ((1382, 1405), 'numpy.sin', 'np.sin', (['pseudo_alg_time'], {}), '(pseudo_alg_time)\n', (1388, 1405), True, 'import numpy as np\n'), ((1694, 1717), 'numpy.sin', 'np.sin', (['pseudo_alg_time'], {}), '(pseudo_alg_time)\n', (1700, 1717), True, 'import numpy as np\n'), ((2980, 2992), 'numpy.ones', 'np.ones', (['(100)'], {}), '(100)\n', (2987, 2992), True, 'import numpy as np\n'), ((3042, 3054), 'numpy.ones', 'np.ones', (['(100)'], {}), '(100)\n', (3049, 3054), True, 'import numpy as np\n'), ((3650, 3659), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (3657, 3659), True, 'import matplotlib.pyplot as plt\n'), ((4515, 4527), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (4522, 4527), True, 'import numpy as np\n'), ((4648, 4660), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (4655, 4660), True, 'import numpy as np\n'), ((4749, 4761), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (4756, 4761), True, 'import numpy as np\n'), ((5535, 5544), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (5542, 5544), True, 'import matplotlib.pyplot as plt\n'), ((6431, 6443), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (6438, 6443), True, 'import numpy as np\n'), ((6556, 6568), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (6563, 6568), True, 'import numpy as np\n'), ((6649, 6661), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (6656, 6661), True, 'import numpy as np\n'), ((7413, 7422), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (7420, 7422), True, 'import matplotlib.pyplot as plt\n'), ((8295, 8307), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (8302, 8307), True, 'import numpy as np\n'), ((8423, 8435), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (8430, 8435), True, 'import numpy as np\n'), ((8519, 8531), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (8526, 8531), True, 'import numpy as np\n'), ((8894, 8903), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (8901, 8903), True, 'import matplotlib.pyplot as plt\n'), ((8935, 8944), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (8942, 8944), True, 'import matplotlib.pyplot as plt\n'), ((9004, 9013), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (9011, 9013), True, 'import matplotlib.pyplot as plt\n'), ((9639, 9681), 'textwrap.fill', 'textwrap.fill', (['"""Noiseless time series"""', '(12)'], {}), "('Noiseless time series', 12)\n", (9652, 9681), False, 'import textwrap\n'), ((9766, 9798), 'textwrap.fill', 'textwrap.fill', (['"""Mean filter"""', '(12)'], {}), "('Mean filter', 12)\n", (9779, 9798), False, 'import textwrap\n'), ((9885, 9919), 'textwrap.fill', 'textwrap.fill', (['"""Median filter"""', '(13)'], {}), "('Median filter', 13)\n", (9898, 9919), False, 'import textwrap\n'), ((10009, 10047), 'textwrap.fill', 'textwrap.fill', (['"""Windsorize filter"""', '(12)'], {}), "('Windsorize filter', 12)\n", (10022, 10047), False, 'import textwrap\n'), ((10161, 10213), 'textwrap.fill', 'textwrap.fill', (['"""Windsorize interpolation filter"""', '(14)'], {}), "('Windsorize interpolation filter', 14)\n", (10174, 10213), False, 'import textwrap\n'), ((10332, 10368), 'textwrap.fill', 'textwrap.fill', (['"""Quantile window"""', '(12)'], {}), "('Quantile window', 12)\n", (10345, 10368), False, 'import textwrap\n'), ((10533, 10545), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (10540, 10545), True, 'import numpy as np\n'), ((10582, 10616), 'textwrap.fill', 'textwrap.fill', (['"""Zoomed region"""', '(10)'], {}), "('Zoomed region', 10)\n", (10595, 10616), False, 'import textwrap\n'), ((10680, 10692), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (10687, 10692), True, 'import numpy as np\n'), ((10738, 10750), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (10745, 10750), True, 'import numpy as np\n'), ((10821, 10833), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (10828, 10833), True, 'import numpy as np\n'), ((11163, 11205), 'textwrap.fill', 'textwrap.fill', (['"""Noiseless time series"""', '(12)'], {}), "('Noiseless time series', 12)\n", (11176, 11205), False, 'import textwrap\n'), ((11290, 11322), 'textwrap.fill', 'textwrap.fill', (['"""Mean filter"""', '(12)'], {}), "('Mean filter', 12)\n", (11303, 11322), False, 'import textwrap\n'), ((11409, 11443), 'textwrap.fill', 'textwrap.fill', (['"""Median filter"""', '(13)'], {}), "('Median filter', 13)\n", (11422, 11443), False, 'import textwrap\n'), ((11533, 11571), 'textwrap.fill', 'textwrap.fill', (['"""Windsorize filter"""', '(12)'], {}), "('Windsorize filter', 12)\n", (11546, 11571), False, 'import textwrap\n'), ((11685, 11737), 'textwrap.fill', 'textwrap.fill', (['"""Windsorize interpolation filter"""', '(14)'], {}), "('Windsorize interpolation filter', 14)\n", (11698, 11737), False, 'import textwrap\n'), ((11856, 11892), 'textwrap.fill', 'textwrap.fill', (['"""Quantile window"""', '(12)'], {}), "('Quantile window', 12)\n", (11869, 11892), False, 'import textwrap\n'), ((12615, 12624), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (12622, 12624), True, 'import matplotlib.pyplot as plt\n'), ((12656, 12665), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (12663, 12665), True, 'import matplotlib.pyplot as plt\n'), ((12725, 12734), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (12732, 12734), True, 'import matplotlib.pyplot as plt\n'), ((13009, 13051), 'textwrap.fill', 'textwrap.fill', (['"""Noiseless time series"""', '(12)'], {}), "('Noiseless time series', 12)\n", (13022, 13051), False, 'import textwrap\n'), ((13120, 13167), 'textwrap.fill', 'textwrap.fill', (['"""Hodrick-Prescott smoothing"""', '(12)'], {}), "('Hodrick-Prescott smoothing', 12)\n", (13133, 13167), False, 'import textwrap\n'), ((13244, 13294), 'textwrap.fill', 'textwrap.fill', (['"""Henderson-Whittaker smoothing"""', '(13)'], {}), "('Henderson-Whittaker smoothing', 13)\n", (13257, 13294), False, 'import textwrap\n'), ((13438, 13482), 'textwrap.fill', 'textwrap.fill', (['"""Downsampled & decimated"""', '(11)'], {}), "('Downsampled & decimated', 11)\n", (13451, 13482), False, 'import textwrap\n'), ((13598, 13630), 'textwrap.fill', 'textwrap.fill', (['"""Downsampled"""', '(13)'], {}), "('Downsampled', 13)\n", (13611, 13630), False, 'import textwrap\n'), ((13695, 13707), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (13702, 13707), True, 'import numpy as np\n'), ((13744, 13778), 'textwrap.fill', 'textwrap.fill', (['"""Zoomed region"""', '(10)'], {}), "('Zoomed region', 10)\n", (13757, 13778), False, 'import textwrap\n'), ((13842, 13854), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (13849, 13854), True, 'import numpy as np\n'), ((13900, 13912), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (13907, 13912), True, 'import numpy as np\n'), ((13983, 13995), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (13990, 13995), True, 'import numpy as np\n'), ((14336, 14378), 'textwrap.fill', 'textwrap.fill', (['"""Noiseless time series"""', '(12)'], {}), "('Noiseless time series', 12)\n", (14349, 14378), False, 'import textwrap\n'), ((14447, 14494), 'textwrap.fill', 'textwrap.fill', (['"""Hodrick-Prescott smoothing"""', '(12)'], {}), "('Hodrick-Prescott smoothing', 12)\n", (14460, 14494), False, 'import textwrap\n'), ((14571, 14621), 'textwrap.fill', 'textwrap.fill', (['"""Henderson-Whittaker smoothing"""', '(13)'], {}), "('Henderson-Whittaker smoothing', 13)\n", (14584, 14621), False, 'import textwrap\n'), ((14713, 14757), 'textwrap.fill', 'textwrap.fill', (['"""Downsampled & decimated"""', '(13)'], {}), "('Downsampled & decimated', 13)\n", (14726, 14757), False, 'import textwrap\n'), ((14821, 14853), 'textwrap.fill', 'textwrap.fill', (['"""Downsampled"""', '(13)'], {}), "('Downsampled', 13)\n", (14834, 14853), False, 'import textwrap\n'), ((15781, 15793), 'numpy.ones', 'np.ones', (['(100)'], {}), '(100)\n', (15788, 15793), True, 'import numpy as np\n'), ((15846, 15858), 'numpy.ones', 'np.ones', (['(100)'], {}), '(100)\n', (15853, 15858), True, 'import numpy as np\n'), ((16249, 16261), 'numpy.ones', 'np.ones', (['(100)'], {}), '(100)\n', (16256, 16261), True, 'import numpy as np\n'), ((16314, 16326), 'numpy.ones', 'np.ones', (['(100)'], {}), '(100)\n', (16321, 16326), True, 'import numpy as np\n'), ((19755, 19764), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (19762, 19764), True, 'import matplotlib.pyplot as plt\n'), ((19964, 20001), 'textwrap.fill', 'textwrap.fill', (['"""Symmetric signal"""', '(10)'], {}), "('Symmetric signal', 10)\n", (19977, 20001), False, 'import textwrap\n'), ((20108, 20150), 'textwrap.fill', 'textwrap.fill', (['"""Anti-symmetric signal"""', '(10)'], {}), "('Anti-symmetric signal', 10)\n", (20121, 20150), False, 'import textwrap\n'), ((20823, 20860), 'textwrap.fill', 'textwrap.fill', (['"""Axes of symmetry"""', '(10)'], {}), "('Axes of symmetry', 10)\n", (20836, 20860), False, 'import textwrap\n'), ((21149, 21194), 'textwrap.fill', 'textwrap.fill', (['"""Symmetric Discard maxima"""', '(10)'], {}), "('Symmetric Discard maxima', 10)\n", (21162, 21194), False, 'import textwrap\n'), ((21263, 21307), 'textwrap.fill', 'textwrap.fill', (['"""Symmetric Anchor maxima"""', '(10)'], {}), "('Symmetric Anchor maxima', 10)\n", (21276, 21307), False, 'import textwrap\n'), ((21385, 21427), 'textwrap.fill', 'textwrap.fill', (['"""Anti-Symmetric maxima"""', '(10)'], {}), "('Anti-Symmetric maxima', 10)\n", (21398, 21427), False, 'import textwrap\n'), ((21502, 21539), 'textwrap.fill', 'textwrap.fill', (['"""Symmetric maxima"""', '(10)'], {}), "('Symmetric maxima', 10)\n", (21515, 21539), False, 'import textwrap\n'), ((26015, 26024), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (26022, 26024), True, 'import matplotlib.pyplot as plt\n'), ((26056, 26065), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (26063, 26065), True, 'import matplotlib.pyplot as plt\n'), ((26125, 26134), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (26132, 26134), True, 'import matplotlib.pyplot as plt\n'), ((28058, 28098), 'textwrap.fill', 'textwrap.fill', (['"""Slope-based maximum"""', '(11)'], {}), "('Slope-based maximum', 11)\n", (28071, 28098), False, 'import textwrap\n'), ((28199, 28239), 'textwrap.fill', 'textwrap.fill', (['"""Slope-based minimum"""', '(11)'], {}), "('Slope-based minimum', 11)\n", (28212, 28239), False, 'import textwrap\n'), ((28360, 28409), 'textwrap.fill', 'textwrap.fill', (['"""Improved slope-based maximum"""', '(11)'], {}), "('Improved slope-based maximum', 11)\n", (28373, 28409), False, 'import textwrap\n'), ((28532, 28581), 'textwrap.fill', 'textwrap.fill', (['"""Improved slope-based minimum"""', '(11)'], {}), "('Improved slope-based minimum', 11)\n", (28545, 28581), False, 'import textwrap\n'), ((32975, 32984), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (32982, 32984), True, 'import matplotlib.pyplot as plt\n'), ((33188, 33222), 'textwrap.fill', 'textwrap.fill', (['"""Huang maximum"""', '(10)'], {}), "('Huang maximum', 10)\n", (33201, 33222), False, 'import textwrap\n'), ((33289, 33323), 'textwrap.fill', 'textwrap.fill', (['"""Huang minimum"""', '(10)'], {}), "('Huang minimum', 10)\n", (33302, 33323), False, 'import textwrap\n'), ((33414, 33451), 'textwrap.fill', 'textwrap.fill', (['"""Coughlin maximum"""', '(14)'], {}), "('Coughlin maximum', 14)\n", (33427, 33451), False, 'import textwrap\n'), ((33542, 33579), 'textwrap.fill', 'textwrap.fill', (['"""Coughlin minimum"""', '(14)'], {}), "('Coughlin minimum', 14)\n", (33555, 33579), False, 'import textwrap\n'), ((33667, 33703), 'textwrap.fill', 'textwrap.fill', (['"""Average maximum"""', '(14)'], {}), "('Average maximum', 14)\n", (33680, 33703), False, 'import textwrap\n'), ((33786, 33822), 'textwrap.fill', 'textwrap.fill', (['"""Average minimum"""', '(14)'], {}), "('Average minimum', 14)\n", (33799, 33822), False, 'import textwrap\n'), ((34015, 34061), 'textwrap.fill', 'textwrap.fill', (['"""Huang Characteristic Wave"""', '(14)'], {}), "('Huang Characteristic Wave', 14)\n", (34028, 34061), False, 'import textwrap\n'), ((34129, 34178), 'textwrap.fill', 'textwrap.fill', (['"""Coughlin Characteristic Wave"""', '(14)'], {}), "('Coughlin Characteristic Wave', 14)\n", (34142, 34178), False, 'import textwrap\n'), ((35679, 35705), 'numpy.cos', 'np.cos', (['(2 * np.pi * t / 50)'], {}), '(2 * np.pi * t / 50)\n', (35685, 35705), True, 'import numpy as np\n'), ((35749, 35776), 'numpy.sin', 'np.sin', (['(2 * np.pi * t / 200)'], {}), '(2 * np.pi * t / 200)\n', (35755, 35776), True, 'import numpy as np\n'), ((41520, 41529), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (41527, 41529), True, 'import matplotlib.pyplot as plt\n'), ((41731, 41771), 'textwrap.fill', 'textwrap.fill', (['"""Extrapolated signal"""', '(12)'], {}), "('Extrapolated signal', 12)\n", (41744, 41771), False, 'import textwrap\n'), ((42003, 42043), 'textwrap.fill', 'textwrap.fill', (['"""Extrapolated maxima"""', '(12)'], {}), "('Extrapolated maxima', 12)\n", (42016, 42043), False, 'import textwrap\n'), ((42140, 42180), 'textwrap.fill', 'textwrap.fill', (['"""Extrapolated minima"""', '(12)'], {}), "('Extrapolated minima', 12)\n", (42153, 42180), False, 'import textwrap\n'), ((42226, 42238), 'numpy.ones', 'np.ones', (['(100)'], {}), '(100)\n', (42233, 42238), True, 'import numpy as np\n'), ((42293, 42335), 'textwrap.fill', 'textwrap.fill', (['"""Neural network inputs"""', '(13)'], {}), "('Neural network inputs', 13)\n", (42306, 42335), False, 'import textwrap\n'), ((42453, 42465), 'numpy.ones', 'np.ones', (['(100)'], {}), '(100)\n', (42460, 42465), True, 'import numpy as np\n'), ((42589, 42601), 'numpy.ones', 'np.ones', (['(100)'], {}), '(100)\n', (42596, 42601), True, 'import numpy as np\n'), ((42778, 42790), 'numpy.ones', 'np.ones', (['(100)'], {}), '(100)\n', (42785, 42790), True, 'import numpy as np\n'), ((42966, 42978), 'numpy.ones', 'np.ones', (['(100)'], {}), '(100)\n', (42973, 42978), True, 'import numpy as np\n'), ((43050, 43062), 'numpy.ones', 'np.ones', (['(100)'], {}), '(100)\n', (43057, 43062), True, 'import numpy as np\n'), ((43146, 43158), 'numpy.ones', 'np.ones', (['(100)'], {}), '(100)\n', (43153, 43158), True, 'import numpy as np\n'), ((43236, 43279), 'textwrap.fill', 'textwrap.fill', (['"""Neural network targets"""', '(13)'], {}), "('Neural network targets', 13)\n", (43249, 43279), False, 'import textwrap\n'), ((43397, 43409), 'numpy.ones', 'np.ones', (['(100)'], {}), '(100)\n', (43404, 43409), True, 'import numpy as np\n'), ((43536, 43548), 'numpy.ones', 'np.ones', (['(100)'], {}), '(100)\n', (43543, 43548), True, 'import numpy as np\n'), ((43728, 43740), 'numpy.ones', 'np.ones', (['(100)'], {}), '(100)\n', (43735, 43740), True, 'import numpy as np\n'), ((43919, 43931), 'numpy.ones', 'np.ones', (['(100)'], {}), '(100)\n', (43926, 43931), True, 'import numpy as np\n'), ((44006, 44018), 'numpy.ones', 'np.ones', (['(100)'], {}), '(100)\n', (44013, 44018), True, 'import numpy as np\n'), ((44585, 44601), 'numpy.cos', 'np.cos', (['(2 * time)'], {}), '(2 * time)\n', (44591, 44601), True, 'import numpy as np\n'), ((44604, 44620), 'numpy.cos', 'np.cos', (['(4 * time)'], {}), '(4 * time)\n', (44610, 44620), True, 'import numpy as np\n'), ((45747, 45810), 'textwrap.fill', 'textwrap.fill', (['"""Sum of IMF 1, IMF 2, & IMF 3 with 51 knots"""', '(21)'], {}), "('Sum of IMF 1, IMF 2, & IMF 3 with 51 knots', 21)\n", (45760, 45810), False, 'import textwrap\n'), ((45997, 46020), 'numpy.linspace', 'np.linspace', (['(-5)', '(5)', '(101)'], {}), '(-5, 5, 101)\n', (46008, 46020), True, 'import numpy as np\n'), ((46067, 46079), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (46074, 46079), True, 'import numpy as np\n'), ((46334, 46346), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (46341, 46346), True, 'import numpy as np\n'), ((46420, 46432), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (46427, 46432), True, 'import numpy as np\n'), ((46468, 46480), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (46475, 46480), True, 'import numpy as np\n'), ((46545, 46557), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (46552, 46557), True, 'import numpy as np\n'), ((46909, 46966), 'textwrap.fill', 'textwrap.fill', (['"""Sum of IMF 1 and IMF 2 with 31 knots"""', '(19)'], {}), "('Sum of IMF 1 and IMF 2 with 31 knots', 19)\n", (46922, 46966), False, 'import textwrap\n'), ((47023, 47080), 'textwrap.fill', 'textwrap.fill', (['"""Sum of IMF 2 and IMF 3 with 51 knots"""', '(19)'], {}), "('Sum of IMF 2 and IMF 3 with 51 knots', 19)\n", (47036, 47080), False, 'import textwrap\n'), ((47251, 47274), 'numpy.linspace', 'np.linspace', (['(-5)', '(5)', '(101)'], {}), '(-5, 5, 101)\n', (47262, 47274), True, 'import numpy as np\n'), ((47321, 47333), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (47328, 47333), True, 'import numpy as np\n'), ((47771, 47783), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (47778, 47783), True, 'import numpy as np\n'), ((47857, 47869), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (47864, 47869), True, 'import numpy as np\n'), ((47905, 47917), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (47912, 47917), True, 'import numpy as np\n'), ((47982, 47994), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (47989, 47994), True, 'import numpy as np\n'), ((48445, 48468), 'numpy.linspace', 'np.linspace', (['(-5)', '(5)', '(101)'], {}), '(-5, 5, 101)\n', (48456, 48468), True, 'import numpy as np\n'), ((48515, 48527), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (48522, 48527), True, 'import numpy as np\n'), ((49002, 49014), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (49009, 49014), True, 'import numpy as np\n'), ((49088, 49100), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (49095, 49100), True, 'import numpy as np\n'), ((49136, 49148), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (49143, 49148), True, 'import numpy as np\n'), ((49213, 49225), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (49220, 49225), True, 'import numpy as np\n'), ((49655, 49718), 'textwrap.fill', 'textwrap.fill', (['"""Sum of IMF 1, IMF 2, & IMF 3 with 51 knots"""', '(21)'], {}), "('Sum of IMF 1, IMF 2, & IMF 3 with 51 knots', 21)\n", (49668, 49718), False, 'import textwrap\n'), ((49779, 49802), 'numpy.linspace', 'np.linspace', (['(-5)', '(5)', '(101)'], {}), '(-5, 5, 101)\n', (49790, 49802), True, 'import numpy as np\n'), ((49849, 49861), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (49856, 49861), True, 'import numpy as np\n'), ((50414, 50471), 'textwrap.fill', 'textwrap.fill', (['"""Sum of IMF 1 and IMF 2 with 31 knots"""', '(19)'], {}), "('Sum of IMF 1 and IMF 2 with 31 knots', 19)\n", (50427, 50471), False, 'import textwrap\n'), ((50528, 50585), 'textwrap.fill', 'textwrap.fill', (['"""Sum of IMF 2 and IMF 3 with 51 knots"""', '(19)'], {}), "('Sum of IMF 2 and IMF 3 with 51 knots', 19)\n", (50541, 50585), False, 'import textwrap\n'), ((50646, 50669), 'numpy.linspace', 'np.linspace', (['(-5)', '(5)', '(101)'], {}), '(-5, 5, 101)\n', (50657, 50669), True, 'import numpy as np\n'), ((50716, 50728), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (50723, 50728), True, 'import numpy as np\n'), ((51471, 51494), 'numpy.linspace', 'np.linspace', (['(-5)', '(5)', '(101)'], {}), '(-5, 5, 101)\n', (51482, 51494), True, 'import numpy as np\n'), ((51541, 51553), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (51548, 51553), True, 'import numpy as np\n'), ((52183, 52192), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (52190, 52192), True, 'import matplotlib.pyplot as plt\n'), ((52224, 52233), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (52231, 52233), True, 'import matplotlib.pyplot as plt\n'), ((52569, 52595), 'numpy.ones_like', 'np.ones_like', (['x_hs[(0), :]'], {}), '(x_hs[(0), :])\n', (52581, 52595), True, 'import numpy as np\n'), ((52661, 52687), 'numpy.ones_like', 'np.ones_like', (['x_hs[(0), :]'], {}), '(x_hs[(0), :])\n', (52673, 52687), True, 'import numpy as np\n'), ((52753, 52779), 'numpy.ones_like', 'np.ones_like', (['x_hs[(0), :]'], {}), '(x_hs[(0), :])\n', (52765, 52779), True, 'import numpy as np\n'), ((54079, 54088), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (54086, 54088), True, 'import matplotlib.pyplot as plt\n'), ((54523, 54570), 'textwrap.fill', 'textwrap.fill', (['"""Unsmoothed maxima envelope"""', '(10)'], {}), "('Unsmoothed maxima envelope', 10)\n", (54536, 54570), False, 'import textwrap\n'), ((54626, 54671), 'textwrap.fill', 'textwrap.fill', (['"""Smoothed maxima envelope"""', '(10)'], {}), "('Smoothed maxima envelope', 10)\n", (54639, 54671), False, 'import textwrap\n'), ((54722, 54769), 'textwrap.fill', 'textwrap.fill', (['"""Unsmoothed minima envelope"""', '(10)'], {}), "('Unsmoothed minima envelope', 10)\n", (54735, 54769), False, 'import textwrap\n'), ((54819, 54864), 'textwrap.fill', 'textwrap.fill', (['"""Smoothed minima envelope"""', '(10)'], {}), "('Smoothed minima envelope', 10)\n", (54832, 54864), False, 'import textwrap\n'), ((54934, 54962), 'numpy.linspace', 'np.linspace', (['(-3.0)', '(-2.0)', '(101)'], {}), '(-3.0, -2.0, 101)\n', (54945, 54962), True, 'import numpy as np\n'), ((55011, 55023), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (55018, 55023), True, 'import numpy as np\n'), ((60553, 60562), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (60560, 60562), True, 'import matplotlib.pyplot as plt\n'), ((60941, 60976), 'textwrap.fill', 'textwrap.fill', (['"""Optimal maxima"""', '(10)'], {}), "('Optimal maxima', 10)\n", (60954, 60976), False, 'import textwrap\n'), ((61083, 61118), 'textwrap.fill', 'textwrap.fill', (['"""Optimal minima"""', '(10)'], {}), "('Optimal minima', 10)\n", (61096, 61118), False, 'import textwrap\n'), ((61189, 61227), 'textwrap.fill', 'textwrap.fill', (['"""Inflection points"""', '(10)'], {}), "('Inflection points', 10)\n", (61202, 61227), False, 'import textwrap\n'), ((61281, 61314), 'textwrap.fill', 'textwrap.fill', (['"""EMD envelope"""', '(10)'], {}), "('EMD envelope', 10)\n", (61294, 61314), False, 'import textwrap\n'), ((61490, 61524), 'textwrap.fill', 'textwrap.fill', (['"""SEMD envelope"""', '(10)'], {}), "('SEMD envelope', 10)\n", (61503, 61524), False, 'import textwrap\n'), ((61719, 61753), 'textwrap.fill', 'textwrap.fill', (['"""EEMD envelope"""', '(10)'], {}), "('EEMD envelope', 10)\n", (61732, 61753), False, 'import textwrap\n'), ((61953, 61999), 'textwrap.fill', 'textwrap.fill', (['"""Inflection point envelope"""', '(10)'], {}), "('Inflection point envelope', 10)\n", (61966, 61999), False, 'import textwrap\n'), ((62062, 62108), 'textwrap.fill', 'textwrap.fill', (['"""Binomial average envelope"""', '(10)'], {}), "('Binomial average envelope', 10)\n", (62075, 62108), False, 'import textwrap\n'), ((64189, 64198), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (64196, 64198), True, 'import matplotlib.pyplot as plt\n'), ((64230, 64239), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (64237, 64239), True, 'import matplotlib.pyplot as plt\n'), ((64527, 64547), 'numpy.ones_like', 'np.ones_like', (['t[:-1]'], {}), '(t[:-1])\n', (64539, 64547), True, 'import numpy as np\n'), ((64561, 64617), 'textwrap.fill', 'textwrap.fill', (['"""Hamiltonian frequency approximation"""', '(15)'], {}), "('Hamiltonian frequency approximation', 15)\n", (64574, 64617), False, 'import textwrap\n'), ((64643, 64663), 'numpy.ones_like', 'np.ones_like', (['t[:-1]'], {}), '(t[:-1])\n', (64655, 64663), True, 'import numpy as np\n'), ((64678, 64725), 'textwrap.fill', 'textwrap.fill', (['"""Driving function frequency"""', '(15)'], {}), "('Driving function frequency', 15)\n", (64691, 64725), False, 'import textwrap\n'), ((65381, 65390), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (65388, 65390), True, 'import matplotlib.pyplot as plt\n'), ((65422, 65431), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (65429, 65431), True, 'import matplotlib.pyplot as plt\n'), ((65716, 65736), 'numpy.ones_like', 'np.ones_like', (['t[:-1]'], {}), '(t[:-1])\n', (65728, 65736), True, 'import numpy as np\n'), ((65750, 65806), 'textwrap.fill', 'textwrap.fill', (['"""Hamiltonian frequency approximation"""', '(15)'], {}), "('Hamiltonian frequency approximation', 15)\n", (65763, 65806), False, 'import textwrap\n'), ((65832, 65852), 'numpy.ones_like', 'np.ones_like', (['t[:-1]'], {}), '(t[:-1])\n', (65844, 65852), True, 'import numpy as np\n'), ((65867, 65914), 'textwrap.fill', 'textwrap.fill', (['"""Driving function frequency"""', '(15)'], {}), "('Driving function frequency', 15)\n", (65880, 65914), False, 'import textwrap\n'), ((66532, 66541), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (66539, 66541), True, 'import matplotlib.pyplot as plt\n'), ((66573, 66582), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (66580, 66582), True, 'import matplotlib.pyplot as plt\n'), ((67415, 67443), 'numpy.cos', 'np.cos', (['(0.04 * 2 * np.pi * t)'], {}), '(0.04 * 2 * np.pi * t)\n', (67421, 67443), True, 'import numpy as np\n'), ((68431, 68440), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (68438, 68440), True, 'import matplotlib.pyplot as plt\n'), ((68472, 68481), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (68479, 68481), True, 'import matplotlib.pyplot as plt\n'), ((68642, 68662), 'numpy.ones_like', 'np.ones_like', (['t[:-1]'], {}), '(t[:-1])\n', (68654, 68662), True, 'import numpy as np\n'), ((68676, 68732), 'textwrap.fill', 'textwrap.fill', (['"""Hamiltonian frequency approximation"""', '(15)'], {}), "('Hamiltonian frequency approximation', 15)\n", (68689, 68732), False, 'import textwrap\n'), ((68758, 68778), 'numpy.ones_like', 'np.ones_like', (['t[:-1]'], {}), '(t[:-1])\n', (68770, 68778), True, 'import numpy as np\n'), ((68793, 68840), 'textwrap.fill', 'textwrap.fill', (['"""Driving function frequency"""', '(15)'], {}), "('Driving function frequency', 15)\n", (68806, 68840), False, 'import textwrap\n'), ((70126, 70135), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (70133, 70135), True, 'import matplotlib.pyplot as plt\n'), ((70167, 70176), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (70174, 70176), True, 'import matplotlib.pyplot as plt\n'), ((70561, 70594), 'textwrap.fill', 'textwrap.fill', (['"""Annual cycle"""', '(10)'], {}), "('Annual cycle', 10)\n", (70574, 70594), False, 'import textwrap\n'), ((71234, 71243), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (71241, 71243), True, 'import matplotlib.pyplot as plt\n'), ((71275, 71284), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (71282, 71284), True, 'import matplotlib.pyplot as plt\n'), ((71666, 71699), 'textwrap.fill', 'textwrap.fill', (['"""Annual cycle"""', '(10)'], {}), "('Annual cycle', 10)\n", (71679, 71699), False, 'import textwrap\n'), ((72903, 72912), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (72910, 72912), True, 'import matplotlib.pyplot as plt\n'), ((73112, 73121), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (73119, 73121), True, 'import matplotlib.pyplot as plt\n'), ((73417, 73426), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (73424, 73426), True, 'import matplotlib.pyplot as plt\n'), ((73458, 73467), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (73465, 73467), True, 'import matplotlib.pyplot as plt\n'), ((73843, 73876), 'textwrap.fill', 'textwrap.fill', (['"""Annual cycle"""', '(10)'], {}), "('Annual cycle', 10)\n", (73856, 73876), False, 'import textwrap\n'), ((4934, 4957), 'numpy.linspace', 'np.linspace', (['(-2)', '(2)', '(101)'], {}), '(-2, 2, 101)\n', (4945, 4957), True, 'import numpy as np\n'), ((6818, 6841), 'numpy.linspace', 'np.linspace', (['(-2)', '(2)', '(101)'], {}), '(-2, 2, 101)\n', (6829, 6841), True, 'import numpy as np\n'), ((8694, 8717), 'numpy.linspace', 'np.linspace', (['(-2)', '(2)', '(101)'], {}), '(-2, 2, 101)\n', (8705, 8717), True, 'import numpy as np\n'), ((17828, 17884), 'numpy.linspace', 'np.linspace', (['((5 - 2.6 * a) * np.pi)', '((5 - a) * np.pi)', '(101)'], {}), '((5 - 2.6 * a) * np.pi, (5 - a) * np.pi, 101)\n', (17839, 17884), True, 'import numpy as np\n'), ((35714, 35740), 'numpy.cos', 'np.cos', (['(2 * np.pi * t / 25)'], {}), '(2 * np.pi * t / 25)\n', (35720, 35740), True, 'import numpy as np\n'), ((37195, 37220), 'numpy.abs', 'np.abs', (['average_gradients'], {}), '(average_gradients)\n', (37201, 37220), True, 'import numpy as np\n'), ((45983, 45995), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (45990, 45995), True, 'import numpy as np\n'), ((47237, 47249), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (47244, 47249), True, 'import numpy as np\n'), ((48431, 48443), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (48438, 48443), True, 'import numpy as np\n'), ((49765, 49777), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (49772, 49777), True, 'import numpy as np\n'), ((50632, 50644), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (50639, 50644), True, 'import numpy as np\n'), ((51457, 51469), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (51464, 51469), True, 'import numpy as np\n'), ((52450, 52459), 'numpy.abs', 'np.abs', (['z'], {}), '(z)\n', (52456, 52459), True, 'import numpy as np\n'), ((54920, 54932), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (54927, 54932), True, 'import numpy as np\n'), ((68401, 68410), 'numpy.abs', 'np.abs', (['z'], {}), '(z)\n', (68407, 68410), True, 'import numpy as np\n'), ((73362, 73371), 'numpy.abs', 'np.abs', (['z'], {}), '(z)\n', (73368, 73371), True, 'import numpy as np\n'), ((4920, 4932), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (4927, 4932), True, 'import numpy as np\n'), ((6804, 6816), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (6811, 6816), True, 'import numpy as np\n'), ((8680, 8692), 'numpy.ones', 'np.ones', (['(101)'], {}), '(101)\n', (8687, 8692), True, 'import numpy as np\n'), ((17948, 18004), 'numpy.linspace', 'np.linspace', (['((5 - 2.6 * a) * np.pi)', '((5 - a) * np.pi)', '(101)'], {}), '((5 - 2.6 * a) * np.pi, (5 - a) * np.pi, 101)\n', (17959, 18004), True, 'import numpy as np\n'), ((37228, 37253), 'numpy.abs', 'np.abs', (['average_gradients'], {}), '(average_gradients)\n', (37234, 37253), True, 'import numpy as np\n'), ((45861, 45936), 'numpy.var', 'np.var', (['(time_series - (imfs_51[(1), :] + imfs_51[(2), :] + imfs_51[(3), :]))'], {}), '(time_series - (imfs_51[(1), :] + imfs_51[(2), :] + imfs_51[(3), :]))\n', (45867, 45936), True, 'import numpy as np\n'), ((47131, 47188), 'numpy.var', 'np.var', (['(time_series - (imfs_31[(1), :] + imfs_31[(2), :]))'], {}), '(time_series - (imfs_31[(1), :] + imfs_31[(2), :]))\n', (47137, 47188), True, 'import numpy as np\n'), ((48343, 48380), 'numpy.var', 'np.var', (['(time_series - imfs_51[(3), :])'], {}), '(time_series - imfs_51[(3), :])\n', (48349, 48380), True, 'import numpy as np\n'), ((62888, 62906), 'numpy.cos', 'np.cos', (['(omega * ts)'], {}), '(omega * ts)\n', (62894, 62906), True, 'import numpy as np\n'), ((64487, 64498), 'numpy.abs', 'np.abs', (['hht'], {}), '(hht)\n', (64493, 64498), True, 'import numpy as np\n'), ((65676, 65687), 'numpy.abs', 'np.abs', (['hht'], {}), '(hht)\n', (65682, 65687), True, 'import numpy as np\n'), ((70498, 70509), 'numpy.abs', 'np.abs', (['hht'], {}), '(hht)\n', (70504, 70509), True, 'import numpy as np\n'), ((71603, 71614), 'numpy.abs', 'np.abs', (['hht'], {}), '(hht)\n', (71609, 71614), True, 'import numpy as np\n'), ((69898, 69922), 'numpy.ones_like', 'np.ones_like', (['IF[:, (0)]'], {}), '(IF[:, (0)])\n', (69910, 69922), True, 'import numpy as np\n'), ((72296, 72321), 'numpy.ones_like', 'np.ones_like', (['ifs[(1), :]'], {}), '(ifs[(1), :])\n', (72308, 72321), True, 'import numpy as np\n'), ((66996, 67024), 'numpy.cos', 'np.cos', (['(0.04 * 2 * np.pi * t)'], {}), '(0.04 * 2 * np.pi * t)\n', (67002, 67024), True, 'import numpy as np\n'), ((67170, 67198), 'numpy.cos', 'np.cos', (['(0.04 * 2 * np.pi * t)'], {}), '(0.04 * 2 * np.pi * t)\n', (67176, 67198), True, 'import numpy as np\n'), ((67339, 67367), 'numpy.cos', 'np.cos', (['(0.04 * 2 * np.pi * t)'], {}), '(0.04 * 2 * np.pi * t)\n', (67345, 67367), True, 'import numpy as np\n'), ((71009, 71025), 'numpy.ones_like', 'np.ones_like', (['IF'], {}), '(IF)\n', (71021, 71025), True, 'import numpy as np\n')]