% Barnett 2012b
% Male and female rats administered malathion in diet for 28 days
% 100, 500, 5000, or 10000 ppm


rat_parameters 	       % rat parameters
TSTOP=768;      			  % Simulation duration
%BW = 0.425;   	 			 % kg


MAXT=0.01;       %maximum time step
MINT=1.0e-3;      %minimum time step


%28 day exposure
%BW during study (weekly)
%males--Column B; females--Column C
DT = xlsread("Barnett_2012b_bw.xls", "500ppm", "A1:A33"); 
BWT=xlsread("Barnett_2012b_bw.xls","500ppm","B1:B33");
%to dose with various concentrations, change name of subsheet accordingly
%to dose females--Column B; to dose males--column C
DT = xlsRead("Barnett_2012b_dosing.xls", "500ppm", "A1:A33");  % Dosing Times (hr)
DORAL=xlsRead("Barnett_2012b_dosing.xls", "500ppm", "C1:C33"); % Dose in ug/kg

prepare @clear @all

load @format=ascii @separator=comma @ignoreheader @file=Barnett2012b_28days_1.csv Barnett_1
tdata1=Barnett_1
load @format=ascii @separator=comma @ignoreheader @file=Barnett2012b_28days_2.csv Barnett_2
tdata2=Barnett_2
load @format=ascii @separator=comma @ignoreheader @file=Barnett2012b_28days_3.csv Barnett_3
tdata3=Barnett_3
load @format=ascii @separator=comma @ignoreheader @file=Barnett2012b_28days_4.csv Barnett_4
tdata4=Barnett_4

start@nocallback

%100 ppm
%plot(_time, _bce, "-", tdata1(:,1), tdata1(:,2),tdata1(:,1), tdata1(:,4), "*", 'Barnett_2012b_brain_1.aps')
%plot(_time, _rbcce, "-", tdata1(:,1), tdata1(:,3),tdata1(:,1), tdata1(:,5), "*", 'Barnett_2012b_RBC_1.aps')

%500 ppm
plot(_time, _bce, "-", tdata2(:,1), tdata2(:,2),tdata2(:,1), tdata2(:,4), "*", 'Barnett_2012b_brain_2.aps')
plot(_time, _rbcce, "-", tdata2(:,1), tdata2(:,3),tdata2(:,1), tdata2(:,5), "*", 'Barnett_2012b_RBC_2.aps')

%5000 ppm
%plot(_time, _bce, "-", tdata3(:,1), tdata3(:,2),tdata3(:,1), tdata3(:,4), "*", 'Barnett_2012b_brain_3.aps')
%plot(_time, _rbcce, "-", tdata3(:,1), tdata3(:,3),tdata3(:,1), tdata3(:,5), "*", 'Barnett_2012b_RBC_3.aps')

%10000 ppm
%plot(_time, _bce, "-", tdata4(:,1), tdata4(:,2),tdata4(:,1), tdata4(:,4), "*", 'Barnett_2012b_brain_4.aps')
%plot(_time, _rbcce, "-", tdata4(:,1), tdata4(:,3),tdata4(:,1), tdata4(:,5), "*", 'Barnett_2012b_RBC_4.aps')




