<jupyter_start><jupyter_text>data<jupyter_code>layout = fifi.svg_to_axes.FigureLayout(figure_layout, autogenlayers=True, 
                                       make_mplfigures=True, hide_layers=[])
ax_data = layout.axes[('data', 'data')]

r = pynumdiff.utils.simulate.__dict__[problem](timeseries_length, noise_parameters=[0, noise], 
                                                               dt=dt)
x, x_truth, dxdt_truth, _ = r
t = np.linspace(0, timeseries_length, len(x))

ax_data.plot(t, x, '.', color='blue', zorder=-10, markersize=2)
ax_data.set_rasterization_zorder(0)
ax_data.set_xlim(0, timeseries_length)

xlimits = {'data': [0,4]}
ylimits = {'data': [-1.2,2]}

xticks = {'data': [0,2,4]}
yticks = {'data': [-1, 0, 1, 2]}

prep_spines(layout, 'data', xlimits, ylimits, xticks, yticks)

layout.append_figure_to_layer(layout.figures['data'], 'data', cleartarget=True)
layout.write_svg(figure_layout)
def go_overlay(example, dt, noise, timeseries_length, cutoff_freq, problem, method_parent, method, 
       xlimits, ylimits, xticks, yticks, read_existing=True):
    # simulate
    print('simulating')
    if problem == 'pi_control':
        r = pynumdiff.utils.simulate.__dict__[problem](timeseries_length, noise_parameters=[0, noise], 
                                                               dt=dt, simdt=0.01)
        simdt = 0.01
    elif problem != 'sine':
        r = pynumdiff.utils.simulate.__dict__[problem](timeseries_length, noise_parameters=[0, noise], 
                                                               dt=dt)
        simdt = 0.0001
    elif problem == 'sine':
        r = pynumdiff.utils.simulate.__dict__[problem](timeseries_length, noise_parameters=[0, noise], 
                                                               dt=dt, frequencies=[7, 10])
        simdt = 0.0001
        
    x, x_truth, dxdt_truth, _ = r
    print('done simulating')
    
    # get axes
    print('EXAMPLE: ', example)
    layout = fifi.svg_to_axes.FigureLayout(figure_layout, autogenlayers=True, 
                                           make_mplfigures=True, hide_layers=[])

    method_parent_pairs = [['linear_model', 'savgoldiff'],
                           ['smooth_finite_difference', 'butterdiff'],
                           ['kalman_smooth', 'constant_acceleration'],
                           ['total_variation_regularization', 'jerk']]
    
    colors = ['violet',
              'lightgreen',
              'cornflowerblue',
              'lightsalmon']
    
    for i, mpp in enumerate(method_parent_pairs):
        method_parent, method = mpp
        color = colors[i]
        
        # run_pareto_analysis
        if problem == 'sine':
            fname = run_pareto_plot.run_pareto_analysis_on_specific(noise, dt, timeseries_length, problem, method, method_parent, simdt=simdt, frequencies=[7,10], read_existing=read_existing)
        else:
            fname = run_pareto_plot.run_pareto_analysis_on_specific(noise, dt, timeseries_length, problem, method, method_parent, simdt=simdt, read_existing=read_existing)
        
        ax_vel = layout.axes[('vel', 'vel')]
        ax_pareto = layout.axes[('pareto', 'pareto')]

        # make pos, vel, spectra plots
        make_plot(method, method_parent, problem, dt, noise, timeseries_length, cutoff_freq, 
                      ax_data=None, ax_pos=None, ax_vel=ax_vel, ax_spectra=None, color=color)

        # make pareto plot
        data = load_data(fname)
        ax_pareto.set_xscale("log")
        plot_rmse_errcorr(data, ax=ax_pareto, plot=True, color=color, plot_gray=False)
        ax_pareto.set_rasterization_zorder(0)
        plot_goldilocks_gamma(dt, cutoff_freq, x, x_truth, dxdt_truth, ax_pareto, method, method_parent, color=color)

    
    # prep spines
    prep_spines(layout, 'vel', xlimits, ylimits, xticks, yticks)
    prep_spines(layout, 'pareto', xlimits, ylimits, xticks, yticks)
    
    
    # save
    layout.append_figure_to_layer(layout.figures['vel'], 'vel', cleartarget=True)
    layout.append_figure_to_layer(layout.figures['pareto'], 'pareto', cleartarget=True)
    layout.write_svg(figure_layout)<jupyter_output><empty_output><jupyter_text>overlay vel, pareto<jupyter_code>r = pynumdiff.utils.simulate.__dict__[problem](timeseries_length, noise_parameters=[0, noise], dt=dt)
x, x_truth, dxdt_truth, _ = r
t = np.linspace(0, timeseries_length, len(x))

# define problem
dt = 0.01
noise = 0.5
timeseries_length = 4
cutoff_freq = 2
problem = 'lorenz_x'

# define limits
xlimits = {#'data': [0,4],
           #'pos': [0,4],
           'vel': [0,4],
           #'spectra': [1e-2,1e2],
           'pareto': [5e-1, 1e2]}
ylimits = {#'data': [-1.2,2],
           #'pos': [-1.2,2],
           'vel': [-10, 10],
           #'spectra': [1e-3,1e1],
           'pareto': [0, 1]}

xticks = {#'data': [0,2,4],
           #'pos': [0,2,4],
           'vel': [0,2,4],
           #'spectra': [1e-2, 1e-1, 1e0, 1e1, 1e2],
           'pareto': [1e0, 1e1, 1e2]}
yticks = {#'data': [-1, 0, 1, 2],
           #'pos': [-1, 0, 1, 2],
           'vel': [-10, -5, 0, 5, 10],
           #'spectra': [1e-3,1e-2, 1e-1, 1e0, 1e1],
           'pareto': [0, 1]}

go_overlay('none', dt, noise, timeseries_length, cutoff_freq, problem, method_parent, method, 
   xlimits, ylimits, xticks, yticks, read_existing=read_existing)<jupyter_output>simulating
done simulating
EXAMPLE:  none
pareto_data/pareto_data_savgoldiff_linear_model_lorenz_x_0.5_0.01_4_auto.pickle
found file:  pareto_data/pareto_data_savgoldiff_linear_model_lorenz_x_0.5_0.01_4_auto.pickle
simulating
done simulating
tvgamma:  0.05844198239204049
{'fraction_non_alphanumeric': 0.1359828907503119, 'fraction_numerical': 0.029584744252361433, 'mean_word_length': 2.72890365448505, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '24768', 'license': 'MIT', 'n_tokens_mistral': 2065, 'n_tokens_neox': 1946, 'n_words': 353, 'path': 'notebooks/paper_figures/misc/make_fig_4_v2.ipynb', 'repo_name': 'fossabot/PyNumDiff', 'size': '5611'}