function current_peaks=really_simple_patchlog_reader_dwn(raw_values)

%october 18, 2005
stim_artifact_threshold=1000;
stim_artifact_jitter=30;
% peaks_record=[];
presynaptic_cell=1
current_peaks=[]

for trial=presynaptic_cell:2:size(raw_values,2)
	above_threshold=raw_values(:,trial)>stim_artifact_threshold;
	beginnings_iftrue=~above_threshold(1:end-1)&above_threshold(2:end);
	endings_iftrue=above_threshold(1:end-1)&~above_threshold(2:end);
	stim_start_indices=1+find(beginnings_iftrue);
	stim_end_indices=find(endings_iftrue);
	%find the max value within each group of suprathreshold values
	stim_peaks=[];
	for ttt=1:length(stim_start_indices)
        superthresh_max=find(raw_values(stim_start_indices(ttt):stim_end_indices(ttt),trial)==max(raw_values(stim_start_indices(ttt):stim_end_indices(ttt),trial)));
        stim_peaks(ttt)=superthresh_max(1)+stim_start_indices(ttt)-1;
	end
	%remove any stim artifacts within stim_artifact_jitter of a previous stim artifact
	z=length(stim_peaks);
	if length(stim_peaks)>1
		for bleb=2:length(stim_peaks)
            if stim_peaks(z)-stim_peaks(z-1)<stim_artifact_jitter
                stim_peaks(z)=[];
            end
            z=z-1;
        end
	end
%     plot(raw_values(:,i))
%     stim_peaks
%     peaks_record=[peaks_record,stim_peaks']
    numstims=length(stim_peaks);
    current_peaks(1:numstims,(trial+1)/2)=stim_peaks';
    for i=1:numstims
        [val,ind]=min(raw_values(stim_peaks(i)+10:stim_peaks(i)+150,trial+1));
        current_peaks(numstims+i,(trial+1)/2)=mean(raw_values((stim_peaks(i)+5+ind):(stim_peaks(i)+15+ind),trial+1));
        %min(raw_values(stim_peaks(i)+10:stim_peaks(i)+150,trial+1));
    end   
end