Skip to content

Commit

Permalink
allow removing nonnegativity constraint by removing the deconvolution…
Browse files Browse the repository at this point in the history
… step
  • Loading branch information
zhoupc committed Nov 25, 2018
1 parent 5450956 commit 48ad4a6
Show file tree
Hide file tree
Showing 100 changed files with 10 additions and 9 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 4 additions & 1 deletion ca_source_extraction/@Sources2D/update_temporal_parallel.m
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,10 @@ function update_temporal_parallel(obj, use_parallel, use_c_hat)
obj.C_raw = bsxfun(@times, C_new, 1./aa);
fprintf('Deconvolve and denoise all temporal traces again...\n');
if deconv_flag
C_new = obj.deconvTemporal();
obj.C = obj.deconvTemporal();
else
obj.C_raw = bsxfun(@minus, obj.C_raw, min(obj.C_raw,[],2));
obj.C = obj.C_raw;
end
fprintf('Done!\n');

Expand Down
10 changes: 3 additions & 7 deletions ca_source_extraction/utilities/HALS_temporal.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,9 @@

if ~deconv_flag
% no deconvolution, just thresholding
% C_raw(k, :) = ck_raw;
ck_raw = ck_raw -min(ck_raw);
C(k, :) = ck_raw;
C_raw(k, :) = ck_raw;
% C(k, :) = max(0, ck_raw);
% if miter==maxIter
% C_raw(k, :) = ck_raw;
% end
else
%remove baseline and estimate noise level. estiamte the noise
%using two methods: psd and histogram. choose the one with
Expand All @@ -79,7 +75,7 @@
% catch
% sn_hist = inf;
% end
% b = mean(ck_raw(ck_raw<median(ck_raw)));
b = mean(ck_raw(ck_raw<median(ck_raw)));
sn_psd = GetSn(ck_raw);
% if sn_psd<sn_hist
% tmp_sn = sn_psd;
Expand All @@ -89,7 +85,7 @@
% end

% subtract the baseline
% ck_raw = ck_raw -b;
ck_raw = ck_raw -b;
sn(k) = sn_psd;

% deconvolution
Expand Down
4 changes: 3 additions & 1 deletion demos/demo_large_data_1p.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
gSig = 3; % pixel, gaussian width of a gaussian kernel for filtering the data. 0 means no filtering
gSiz = 13; % pixel, neuron diameter
ssub = 1; % spatial downsampling factor
with_dendrites = true; % with dendrites or not
with_dendrites = false; % with dendrites or not
if with_dendrites
% determine the search locations by dilating the current neuron shapes
updateA_search_method = 'dilate'; %#ok<UNRCH>
Expand All @@ -34,6 +34,7 @@
% ------------------------- TEMPORAL ------------------------- %
Fs = 10; % frame rate
tsub = 1; % temporal downsampling factor
deconv_flag = true; % run deconvolution or not
deconv_options = struct('type', 'ar1', ... % model of the calcium traces. {'ar1', 'ar2'}
'method', 'foopsi', ... % method for running deconvolution {'foopsi', 'constrained', 'thresholded'}
'smin', -5, ... % minimum spike size. When the value is negative, the actual threshold is abs(smin)*noise level
Expand Down Expand Up @@ -99,6 +100,7 @@
'spatial_constraints', spatial_constraints, ...
'spatial_algorithm', spatial_algorithm, ...
'tsub', tsub, ... % -------- temporal --------
'deconv_flag', deconv_flag, ...
'deconv_options', deconv_options, ...
'nk', nk, ...
'detrend_method', detrend_method, ...
Expand Down

0 comments on commit 48ad4a6

Please sign in to comment.