Skip to content
This repository has been archived by the owner on May 4, 2023. It is now read-only.

Commit

Permalink
disable raw data readiing in gui with resuts and do_clutering
Browse files Browse the repository at this point in the history
  • Loading branch information
ferchaure committed Aug 5, 2020
1 parent 700d3ff commit 9e19b2a
Showing 1 changed file with 31 additions and 25 deletions.
56 changes: 31 additions & 25 deletions Batch_files/readInData.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
obj.nick_name = fnam(1:end-7);
end

reset_results = (~isfield(par_ui,'reset_results')) || (~ par_ui.reset_results);
if reset_results || obj.with_results
keep_results = (~isfield(par_ui,'reset_results')) || (~ par_ui.reset_results);
if keep_results || obj.with_results
%Search for previous results
if exist(['times_' obj.nick_name '.mat'],'file')
finfo = whos('-file',['times_' obj.nick_name '.mat']);
Expand All @@ -74,7 +74,7 @@
end
end
end
if reset_results || obj.with_wc_spikes
if keep_results || obj.with_wc_spikes
%Search for previously detected spikes
if isempty(obj.spikes_file)
spikes_file = [obj.nick_name '_spikes.mat'];
Expand Down Expand Up @@ -104,30 +104,36 @@
ME = MException('MyComponent:FileError', 'Coultn''t find spikes variable in ''times_'' file');
throw(ME)
end
% Search raw data
if exist([ext(2:end) '_wc_reader'],'file')
obj.file_reader = eval([ext(2:end) '_wc_reader(obj.par,obj.par.filename)']);
[sr, obj.max_segments, obj.with_raw, with_spikes] = obj.file_reader.get_info();
obj.with_spikes = obj.with_spikes || with_spikes;
if ~with_par %if didn't load sr from previous results
if isempty(sr)
disp('Wave_clus didn''t find a sampling rate in file. It will use the input parameter or set_parameters.m') %use default sr (from set_parameters)
else
obj.par.sr = sr; %load sr from raw data

if ~keep_results || ~(obj.with_wc_spikes || obj.with_results)
% Search raw data
if exist([ext(2:end) '_wc_reader'],'file')
try
obj.file_reader = eval([ext(2:end) '_wc_reader(obj.par,obj.par.filename)']);
[sr, obj.max_segments, obj.with_raw, with_spikes] = obj.file_reader.get_info();
obj.with_spikes = obj.with_spikes || with_spikes;
if ~with_par %if didn't load sr from previous results
if isempty(sr)
disp('Wave_clus didn''t find a sampling rate in file. It will use the input parameter or set_parameters.m') %use default sr (from set_parameters)
else
obj.par.sr = sr; %load sr from raw data
end
end
catch

end
end
else
if ~(obj.with_results || obj.with_wc_spikes)
ME = MException('MyComponent:noSuchExt', 'File type ''%s'' isn''t supported',ext);
throw(ME)
elseif results_selected
disp ('Wave_clus data selected. Raw data wasn''t loaded.')
else
disp ('File type isn''t supported.')
disp ('Using Wave_clus data found.')
end
end

if ~(obj.with_results || obj.with_wc_spikes)
ME = MException('MyComponent:noSuchExt', 'File type ''%s'' isn''t supported',ext);
throw(ME)
elseif results_selected
disp ('Wave_clus data selected. Raw data wasn''t loaded.')
else
disp ('File type isn''t supported.')
disp ('Using Wave_clus data found.')
end
end
end
if ~isfield(obj.par,'channels')
obj.par.channels = 1;
end
Expand Down

0 comments on commit 9e19b2a

Please sign in to comment.