%% BartelsRausch_Cryosphere_NaCl_2020 Data Repository
%
%%
% This file lists and explains the data in the repository.

% Initialise Matlab
clc
close all
clearvars

%% Measurement settings table: Table1.txt
% This table lists all data files in chronological order. "SampleTemp"
% refers to the reading of the PT-1000 at the side of the sample holder.
% "cellPressure" is the water vapour pressure during the measurements. From
% this, in presence of ice, the temperature of the ice sample can be
% calculated which is given in the column "iceTemp". "dT" is the
% difference, or temperature offset, between sensor's reading and the ice
% samples temperature. The offset is due to the sensor being mounted away
% from the cooled spot of the sample were it experiences heating from
% warmer parts of the sample holder. The off-set is used to calibrate the
% temperature sensor and the resulting temperature during the experiments
% is given in the column "temperature". "relHum" is the relative humidity
% above (supercooled) liquid and "concBrine" is the concentration of a NaCl
% solution in mol/l in equilibrium with ice at the experimental
% temperature. "Area" is the integrated PE signal.
%
% Here, we only print the first few rows, the complete data can be found in
% the text file.
%%
Tone = readtable('Table1.txt');
head(Tone)
%% NEXAFS samples: Table2.txt
% This table lists all NEXAFS data files in chronological order with PE
% carbon to oxygen signal intensity ratios -from which the atomic ratio
% were calculated in the paper - before ("preCtoO") and after ("postCtoO")
% each NEXAFS measurement. Also listed is the change in Na ("lossSodi"), O
% ("lossOxy"), Cl ("lossChlor"), and C ("lossCarb") signal intensity after
% the NEXAFS measurement compared to prior to the NEXAFS measurement.
%
% Here, we only print the first few rows, the complete data can be found in
% the text file.
%%
Ttwo = readtable('Table2.txt');
head(Ttwo)
%% Figure 1 data: Fig1Data[A-F].txt
%
% Each file holds the x-data in the first and the y-data in the second
% column. The data is identical to that shown in Figure 1. Here, we only
% print the first few rows, the complete data can be found in the text
% files.

Fig1DataA = readtable('Fig1DataA.txt');
Fig1DataB = readtable('Fig1DataB.txt');
Fig1DataC = readtable('Fig1DataC.txt');
Fig1DataD = readtable('Fig1DataD.txt');
Fig1DataE = readtable('Fig1DataE.txt');
Fig1DataF = readtable('Fig1DataF.txt');

%%
% *Fig1DataA*
head(Fig1DataA)
%%
% *Fig1DataB*
head(Fig1DataB)
%%
% *Fig1DataC*
head(Fig1DataC)
%%
% *Fig1DataD*
head(Fig1DataD)
%%
% *Fig1DataE*
head(Fig1DataE)
%%
% *Fig1DataF*
head(Fig1DataF)
%% Figure 1 individual data: Fig1Data[C,F]file-name.txt
%
% Here, we give the NEXAFS data to each individual sample the averages of
% which are shown in Figure 1. Each file holds the x-data in the
% first and the y-data in second column. The file name refers to the first
% column in the NEXAFS data list. 

Fig1DataC_PHOENIX04042016_006= readtable('Fig1DataB_PHOENIX04042016_006.txt');
Fig1DataC_PHOENIX04042016_007= readtable('Fig1DataB_PHOENIX04042016_007.txt');
Fig1DataC_PHOENIX04042016_020= readtable('Fig1DataB_PHOENIX04042016_020.txt');
Fig1DataF_PHOENIX04042016_015= readtable('Fig1DataF_PHOENIX04042016_015.txt');
Fig1DataF_PHOENIX04042016_016= readtable('Fig1DataF_PHOENIX04042016_016.txt');
%% 
% *Plot individual data from Figure 1C:*

figure
plot(Fig1DataC_PHOENIX04042016_006.Xray_Ekin_eV,Fig1DataC_PHOENIX04042016_006.Intensity,'displayName','PHOENIX04042016_6')
hold on
plot(Fig1DataC_PHOENIX04042016_007.Xray_Ekin_eV,Fig1DataC_PHOENIX04042016_007.Intensity,'displayName','PHOENIX04042016_7')
plot(Fig1DataC_PHOENIX04042016_020.Xray_Ekin_eV,Fig1DataC_PHOENIX04042016_020.Intensity,'displayName','PHOENIX04042016_20')
xlabel('photon energy [hv]');
ylabel('Cl K-edge partial Auger-Meitner electron yield  [arb. units]');
legend('interpreter','none')

%% 
% *Plot individual data from Figure 1F:*

figure
plot(Fig1DataF_PHOENIX04042016_015.Xray_Ekin_eV,Fig1DataF_PHOENIX04042016_015.Intensity,'displayName','PHOENIX04042016_15')
hold on
plot(Fig1DataF_PHOENIX04042016_016.Xray_Ekin_eV,Fig1DataF_PHOENIX04042016_016.Intensity,'displayName','PHOENIX04042016_16')
xlabel('photon energy [hv]');
ylabel('Cl K-edge partial Auger-Meitner electron yield  [arb. units]');
legend('interpreter','none')

clearvars -except DataList LabView NEXAFS* XPS timeDisplay fileLocation I_0 fitresult*
