% Chirp Echo FT EPR-detected NMR
%
% 11/2017 Nino Wili: nino.wili@phys.chem.ethz.ch
% EPR @ ETH Zurich

% Plot of the Nitroxide echo-detected field swept EPR spectrum

clear, close all;

%load data with function tailored to our AWG spectrometer
options.plot = 0; % 0 for do not plot by uwb_eval
options.evlen = 512; % length of evaluation window in points
data=uwb_eval('20170829_1213_fieldswp',options);

%extract needed data from struct
fs=data.dta_ev; %integrated echo intensities
B=data.dta_x{1}; % B-field in Gauss


%open figure
h=figure(1);
clf
hold on

%plot spectrum
plot(B/10,abs(fs)/max(abs(fs)),'k')

%annotate
B_det = 12455/10;
plot(B_det*[1 1],[ 0.45 0.72],'--k')
text(B_det,0.73,'$B_\text{DET}$','horizontalalignment','center','verticalalignment','bottom')

B_det = 12442/10;
plot(B_det*[1 1],[ 0.45 0.72],'--k')
text(B_det,0.73,'$B_\text{DET}$','horizontalalignment','center','verticalalignment','bottom')

%make it look nice
axis([1241 1251 -0.04 1.04])
xlabel('$B$ / mT')
ylabel('Echo Intensity / a.u.')
set(gca,'ytick',[])
h=niwi_niceplot(h,[15 8]);
set(findall(h,'-property','Fontsize'),'Fontsize',12);
box off

%only needed to integrate it into latex, needs inkscape
% niwi_Plot2LaTex(h,'chirp_vs_classical_fs')