function [sa, sigma] = C_1997_horiz(M, R, T, Fault_Type, Soil, D, arb)
% by Jack Baker, 2/1/05
% Stanford University
% bakerjw@stanford.edu
%
% Compute the Campbell attenuation prediction (1997 Seismological Research
% Letters, Vol 68, No 1, p180).
%
% This script has been modified to include standard deviations for either
% arbitrary or average components of ground motion See Baker, JW, and
% Cornell, CA (2006). "Which spectral acceleration are you using?"
% Earthquake Spectra, 22(2), 293-312.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% INPUT
%
% M = earthquake magnitude
% R = closest distance to fault rupture
% T = period of vibration
% Fault_Type = 0 for strike-slip fault
% = 1 for reverse, thrust, reverse-oblique, and thrust-oblique fault
% Soil = 0 for soil
% = 1 for soft rock
% = 2 for hard rock
% D = depth to basement bedrock (km)
% arb = 1 for arbitrary component sigma
% = 0 for average component sigma
%
% OUTPUT
%
% sa = median spectral acceleration prediction
% sigma = logarithmic standard deviation of spectral acceleration
% prediction FOR AN ARBITRARY OR AVERAGE COMPONENT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% interpolate between periods if neccesary
period = [0.05, 0.075, 0.10, 0.15, 0.20, 0.30, 0.50, 0.75, 1.00, 1.50, 2.00, 3.00, 4.00];
if (length(find(period == T)) == 0)
index_low = sum(period= 1)
depth_term = 0;
else
depth_term = c6*(1-S_SR)*(1-D) + 0.5*c6*(1-D)*S_SR;
end