This is a static copy of a profile report

Home

smooth_gaussian (40 calls, 0.000 sec)
Generated 14-Nov-2016 07:47:10 using cpu time.
function in file /home/user/dev/ymap/scripts_seqModules/smooth_gaussian.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
FindChrSizes_4function28
calculate_allelic_ratio_cutoffsscript12
Lines where the most time was spent
No measurable time spent in this function

Line NumberCodeCallsTotal Time% TimeTime Plot
29
s = filtered;
400 s0%
28
data((end-size*4+1):end) = [];
400 s0%
27
data(1:size*4) = [];
400 s0%
26
filtered((end-size*4+1):end) =...
400 s0%
25
filtered(1:size*4) = [];
400 s0%
All other lines  0 s0%
Totals  0 s0% 
Children (called functions)
No children
Code Analyzer results
Line numberMessage
28The value assigned to variable 'data' might be unused.
Coverage results
Show coverage for parent directory
Total lines in function29
Non-code lines (comments, blank lines)13
Code lines (lines that can run)16
Code lines that did run16
Code lines that did not run0
Coverage (did run/can run)100.00 %
Function listing
time 
calls 
 line
   1 
function s = smooth_gaussian(data,sigma,size)
   2 

   3 
%    data  : input vector with raw data.
   4 
%    sigma : standard deviation of the gaussian distribution used in the smoothing.
   5 
%    size  : size of vector over which smoothing function is applied.   (2-3 sigmas is usually good.)
   6 

   7 
% Gaussian smoothing.
     40 
   8 
halfsize = round(size/2); 
     40 
   9 
a        = 1/(sqrt(2*pi)*sigma); 
     40 
  10 
b        = 1/(2*sigma^2); 
     40 
  11 
w        = a*exp(-b*(-halfsize:1:halfsize).^2); 
     40 
  12 
w        = w/sum(w);   % normalize the filter to a total of 1. 
  13 

  14 
% Extends endpoint data to larger than smoothing width.
     40 
  15 
data_L_val = data(1); 
     40 
  16 
data_R_val = data(end); 
     40 
  17 
data_L = ones(1,size*4)*data_L_val; 
     40 
  18 
data_R = ones(1,size*4)*data_R_val; 
     40 
  19 
data = [data_L data data_R]; 
  20 

  21 
% filters data and shifts smoothing left to align with data.
     40 
  22 
filtered = circshift(filter(w,1,data),[1 -halfsize]); 
  23 

  24 
% crops away the extended endpoint data from the raw and smoothed data.
     40 
  25 
filtered(1:size*4) = []; 
     40 
  26 
filtered((end-size*4+1):end) = []; 
     40 
  27 
data(1:size*4) = []; 
     40 
  28 
data((end-size*4+1):end) = []; 
     40 
  29 
s = filtered;