function slopes_this_induction=simple_stdp_slope_calculator(raw_induction_trace,induction_peaks,slopewindow_end,pulse_duration_presyn,plotting_color,current_expt,...
    general_fig_position,meanpreindwave,samples_per_ms)
%checked aug 6/2007

plot_slopes=1;
    ycutoff=.75;

raw_induction_trace=raw_induction_trace(:,2);
slope_increment=samples_per_ms;
slope_window=[((pulse_duration_presyn*samples_per_ms)+samples_per_ms):slopewindow_end];
slope_scan_range=length(slope_window)-slope_increment-1;
slopes_this_induction=[];
for present_peak=1:length(induction_peaks)
    rise_phase=induction_peaks(present_peak)+slope_window;
    best_slope=-100;
    for present_start_sample=1:slope_scan_range
        if (raw_induction_trace(rise_phase(present_start_sample)+slope_increment)-raw_induction_trace(rise_phase(present_start_sample)))>best_slope
            best_slope=raw_induction_trace(rise_phase(present_start_sample)+slope_increment)-raw_induction_trace(rise_phase(present_start_sample));   %because a one ms increment is used, the slope is in units of mV/ms
        end
    end
    slopes_this_induction=[slopes_this_induction best_slope];
end

if plot_slopes
    figure(current_expt+100)
    subplot('position',[.25 .15 .25 .1])
    plot(slopes_this_induction,'o','markersize',8,'linewidth',1.5,'markeredgecolor',plotting_color), hold on
    exceeders=find(slopes_this_induction>ycutoff);
    plot(exceeders,repmat(ycutoff,1,length(exceeders)),'o','markersize',8,'linewidth',2,'markeredgecolor',plotting_color)
    ylim([0 ycutoff])
    set(gca,'ytick',[],'xtick',[])
    
    sum_mean_preindwave=-1*sum(meanpreindwave);
    PSP_to_PSC_ratio=sum(slopes_this_induction./sum_mean_preindwave);
    title(strcat('PSP to PSC ratio:',num2str(PSP_to_PSC_ratio)))
    
     set(gcf,'position',general_fig_position)
end