clear variables
close all

%Script for calling the functions of TR-EPR toolbox

%path to dataset
datapath = 'C:\Users\lukas\Nextcloud\Uni\Bachelorarbeit\tr-epr-simulation\example_data.mat';
[raw_data,params] = load_matlab(datapath);

% datapath = 'C:\Users\lukas\Nextcloud\Uni\Bachelorarbeit\tr-epr-simulation\pentacene_355nm_481pt.DSC';
% [raw_data,params] = load_bruker(datapath);

[time_corr_data,params] = correct_time_baseline(raw_data,params);

[full_corr_data,params] = correct_magnetic_baseline(time_corr_data,params);

[norm_data,params] = average_maximum(full_corr_data,params);

[params] = pre_simulation_TREPR(params);

[params] = simulation_TREPR(params);

writestruct(params,strcat(params.Path,"/",params.Name,".xml"));

print_figure_pdf(full_corr_data,params,1) %print simuation figure
% print_figure_pdf(full_corr_data,params,1) %print 3D figure