%% This file is licensed under the Allen Institute Terms of Use, which can be found at:
%http://www.alleninstitute.org/Media/policies/terms_of_use_content.html

%------------------------------------------------------------------------------------

%Script to generate Supp. Fig. S4 for DiPDE bounds for non-instantaneous
%synapses

clear variables;

% Settings for plot
fnt = 36;
fntleg = 18;

xtc = [0;50;100;150;200]*10^-3;  %x-axis ticks for time in (ms)
ytc = [0;5;10;15;20]*10^-3; %y-axis ticks for membrane potential in (mV)
xtl = [0;50;100;150;200]; %x-axis labels for time in (ms)
ytl = [0;5;10;15;20]; %y-axis labels for membrane potential in (mV)

set(0,'DefaultFigureWindowStyle','docked');
set(0,'defaultAxesFontName', 'Arial');

load SuppFigS4.mat;

figure;

%FIRING RATE PLOTs
%-----------------
plot(tplot_b3(1:end-1),simfrate_dttref0p1_1(1:end-1),t_orig_taud0,frate_orig_taud0,'--',t_orig_taudtmax,frate_orig_taudtmax,'--',t_orig_taudts,frate_orig_taudts,'--','LineWidth',4)
hold on;
plot(t_orig_taudtmin,frate_orig_taudtmin,'--','Color',[0.2,0,0.5],'LineWidth',4);
axis([0 0.2 0 7]);
set(gca,'FontSize',fnt);
ylabel('Firing rate (Hz)');xlabel('time (ms)');
set(gca,'XTick',xtc); %set(gca,'YTick',ytc);
set(gca,'XTickLabel',xtl); %set(gca,'YTickLabel',ytl);
axis square; box on;
leg5 = legend('Sim \tau_s=1.0ms','DiPDE \tau_s=1.0ms, \tau_d=0','DiPDE \tau_s=1.0ms, \tau_d=t_{max}','DiPDE \tau_s=\tau_d=1.0ms','DiPDE \tau_s=1.0ms, \tau_d=t_{min}');
set(leg5,'FontSize',fntleg,'Interpreter','tex','Location','SouthEast');

print2eps Fig_S4.eps
