Skip to content

Commit

Permalink
fix small chanmap bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
nsteinme committed Feb 22, 2019
1 parent 10aaaf6 commit c3f415d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
Binary file added configFiles/Linear16x1_kilosortChanMap.mat
Binary file not shown.
7 changes: 7 additions & 0 deletions gui/ksGUI.m
Original file line number Diff line number Diff line change
Expand Up @@ -1115,12 +1115,18 @@ function updateProbeView(obj, varargin)
end
cm = createValidChanMap(cm);
if ~isempty(cm)
obj.P.allChanMaps(end+1) = cm;
currProbeList = obj.H.settings.setProbeEdt.String;
newProbeList = [{cm.name} currProbeList];
obj.H.settings.setProbeEdt.String = newProbeList;

answer = questdlg('Save this channel map for later?');
if strcmp(answer, 'Yes')
saveNewChanMap(cm, obj);
end
else
obj.log('Channel map invalid. Must have chanMap, xcoords, and ycoords of same length');
return;
end
end
case 'other...'
Expand All @@ -1135,6 +1141,7 @@ function updateProbeView(obj, varargin)
currProbeList = obj.H.settings.setProbeEdt.String;
newProbeList = [{cm.name} currProbeList];
obj.H.settings.setProbeEdt.String = newProbeList;

answer = questdlg('Save this channel map for later?');
if strcmp(answer, 'Yes')
saveNewChanMap(cm, obj);
Expand Down
7 changes: 6 additions & 1 deletion gui/loadChanMaps.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@

idx = 1;
chanMaps = [];
orig_state = warning;
warning('off','all')

for c = 1:numel(chanMapFiles)

q = load(fullfile(ksroot, 'configFiles', chanMapFiles(c).name));

cm = createValidChanMap(q, chanMapFiles(c).name);
if ~isempty(cm)
if idx==1; chanMaps = cm; else; chanMaps(idx) = cm; end;
if idx==1; chanMaps = cm; else; chanMaps(idx) = cm; end
idx = idx+1;
end

end

warning(orig_state);
3 changes: 2 additions & 1 deletion gui/saveNewChanMap.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ function saveNewChanMap(cm, obj)
end
end
if ~isempty(newName)
newName = genvarname(newName);
ksRoot = fileparts(fileparts(mfilename('fullpath')));
newFn = [answer{1} '_kilosortChanMap.mat'];
newFn = [newName '_kilosortChanMap.mat'];
save(fullfile(ksRoot, 'configFiles', newFn), '-struct', 'cm');
obj.log(['Saved new channel map: ' fullfile(ksRoot, 'configFiles', newFn)]);
else
Expand Down

0 comments on commit c3f415d

Please sign in to comment.