function norm_total = NormalizeTraces (totalYFP)

% detrendYFP = cell(size(totalYFP,2),1);
% for i = 1:size(totalYFP,2)
%  lastidx= find(isnan(totalYFP(:,i))==1,1) -1;
%  if isempty(lastidx) == 1
%     detrendYFP{i} = detrend(totalYFP(:,i));
%  else
%      detrendYFP{i} = detrend(totalYFP(1:lastidx,i));
%  end
%  
% end


baseline = min(totalYFP,[],1);

normfactor = max(totalYFP-baseline);

norm_total = (totalYFP-baseline)./normfactor;

