% check toolboxes
tools.toolboxes_needed()
addpath('mat_gemini')
addpath('mat_gemini-scripts')

% load simulation data
direc = fullfile('simulations','isinglass_78');
cfg = gemini3d.read.config(direc);
direc_rep = fullfile(direc,'/ext');
cfg_rep = gemini3d.read.config(direc_rep);
xg_rep = gemini3d.grid.cartesian(cfg_rep);
load(fullfile('supplementary','replicate_data_isinglass.mat'),'in_situ','image')

% replicate data (plots made inside)
[phi,~,E2_bg,E3_bg] = tools.replicate(in_situ,image,xg_rep ...
    ,flow_smoothing_window = 16 ...
    ,boundary_smoothing_window = 64 ...
    ,show_plots = false ...
    ,save_plots = [1 0 0] ...
    ,save_data = false ...
    ,direc = 'figures' ...
    ,suffix = '' ...
    ,starting_letter = 'A' ...
    ,add_phi_background = false ...
    ,fit_harmonic = true ...
    ,num_replications = 512 ...
    ,arc_definition = "conductance" ...
    ,edge_method = "contour" ...
    ,do_rotate = true ...
    ,do_scale = true ...
    ,harmonic_mask = [8,8,20]*1e3 ...
    ,contour_values = [10.5,19.1] ...
    );
