clear all; close all;

%

df = readtable('data1.csv');
df_mfet = df(:,1:13);
df_nano = df(:,14:end);

%

% dt = datetime(df.MM_DD_YYYYHH_MM_SS)
% dv = datevec(df.MM_DD_YYYYHH_MM_SS)

%

Vnames_mfet = df_mfet.Properties.VariableNames;
Vnames_nano = df_nano.Properties.VariableNames;

%

clf
figure(1);
tl = tiledlayout('flow');
title(tl,'mfet data')
for i = 3:length(Vnames_mfet)
    nexttile
    scatter(df_mfet.(Vnames_mfet{2}),df_mfet.(Vnames_mfet{i}))
    title(Vnames_mfet{i})
end

print('mfetdata','-dpdf','-fillpage')

%

clf
figure(2)
tl = tiledlayout('flow');
title(tl,'nano data')
for i = 3:length(Vnames_nano)
    nexttile
    scatter(df_nano.(Vnames_nano{2}),df_nano.(Vnames_nano{i}))
    title(Vnames_nano{i})
end

print('nanodata','-dpdf','-fillpage')

%

clf
figure(3);
tl = tiledlayout('flow');

nexttile
plot(df_mfet.MM_DD_YYYYHH_MM_SS,df_mfet.Vrse)
hold on
plot(df_mfet.MM_DD_YYYYHH_MM_SS,df_nano.Vrse_1)
title('mfet vs nano Vrse')
legend('mfet','nano','Location','best')

nexttile
plot(df_mfet.MM_DD_YYYYHH_MM_SS,df_mfet.Vrse-mean(df_mfet.Vrse))
hold on
plot(df_mfet.MM_DD_YYYYHH_MM_SS,df_nano.Vrse_1-mean(df_nano.Vrse_1))
title('mfet vs nano Vrse (mean removed)')
legend('mfet','nano','Location','best')

nexttile
scatter(df_mfet.Vrse-mean(df_mfet.Vrse),df_nano.Vrse_1-mean(df_nano.Vrse_1))
xlabel('mfet')
ylabel('nano')

nexttile
scatter(df_mfet.TC_cont, df_mfet.Vrse-mean(df_mfet.Vrse))
lsline

nexttile
scatter(df_mfet.TC_cont,df_nano.Vrse_1-mean(df_nano.Vrse_1))
lsline

%

%warm up time metric
clf
plot(diff(df_mfet.Vrse))

ii = find(abs(diff(df_mfet.Vrse)) < 2.5E-5); % somewhat arbitrary
ii = ii(1)

%

% nexttile
% errorbar(df_mfet.Vrse,df_mfet.Vrse_std)
% hold on
% errorbar(df_nano.Vrse_1,df_nano.Vrse_std_1)
% 
% nexttile
% errorbar(df_mfet.Vrse-mean(df_mfet.Vrse),df_mfet.Vrse_std)
% hold on
% errorbar(df_nano.Vrse_1-mean(df_nano.Vrse_1),df_nano.Vrse_std_1)
% title('mfet vs nano (mean removed, std error bars) Vrse')
% legend('mfet','nano','Location','best')