Skip to content

Commit

Permalink
Automatic update + read raw data again
Browse files Browse the repository at this point in the history
  • Loading branch information
hmogensen committed Jan 16, 2015
1 parent c446249 commit 89c9057
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 12 deletions.
14 changes: 14 additions & 0 deletions panelcomponents/ReImportRawData.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
classdef ReImportRawData < PanelComponent
methods
function obj = ReImportRawData(panel)
obj@PanelComponent(panel);
end
function populate(obj,mgr)
mgr.newline(20);
mgr.add(sc_ctrl('pushbutton','Read raw data again',@(~,~) obj.read_raw_data_callback()),200);
end
function read_raw_data_callback(obj)
obj.gui.experiment.init(true);
end
end
end
1 change: 1 addition & 0 deletions panels/@InfoPanel/InfoPanel.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function layout(obj)

function setup_components(obj)
obj.gui_components.add(AutomaticUpdate(obj));
obj.gui_components.add(ReImportRawData(obj));
obj.gui_components.add(SaveLoadButton(obj));
obj.gui_components.add(ExperimentOptions(obj));
obj.gui_components.add(SequenceOptions(obj));
Expand Down
4 changes: 2 additions & 2 deletions sensorimotor/classes/ScExperiment.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ function sc_clear(obj)
end

%Populate all children
function init(obj)
function init(obj,varargin)
for i=1:obj.n
fprintf('reading file: %i out of %i\n',i,obj.n);
obj.get(i).init();
obj.get(i).init(varargin{:});
end
end

Expand Down
26 changes: 16 additions & 10 deletions sensorimotor/classes/ScFile.m
Original file line number Diff line number Diff line change
Expand Up @@ -381,20 +381,26 @@ function sc_clear(obj)
d = load(obj.filepath,channelname);
channelstruct = d.(channelname);
if isfield(channelstruct,'values')
signal = ScSignal(obj,channelname,'tag',channelname);
signal.dt = channelstruct.interval;
signal.N = channelstruct.length; %<- sometimes incorrect value from Spike2
obj.signals.add(signal);
if isempty(strfind(channelname,'patch'))
signal.filter.smoothing_width = 1;
signal.filter.artifact_width = 0;
if ~obj.signals.has('tag',channelname)
signal = ScSignal(obj,channelname,'tag',channelname);
signal.dt = channelstruct.interval;
signal.N = channelstruct.length; %<- sometimes incorrect value from Spike2
obj.signals.add(signal);
if isempty(strfind(channelname,'patch'))
signal.filter.smoothing_width = 1;
signal.filter.artifact_width = 0;
end
end
elseif strcmpi(channelname,'TextMark') || ...
strcmpi(channelname,'Keyboard')
textchannel = ScTextMark(obj,channelname,'tag',channelname);
obj.textchannels.add(textchannel);
if ~obj.textchannels.has('tag',channelname)
textchannel = ScTextMark(obj,channelname,'tag',channelname);
obj.textchannels.add(textchannel);
end
elseif isfield(channelstruct,'times')
obj.stims.add(ScStim(obj,channelname,'tag',channelname));
if ~obj.stims.has('tag',channelname)
obj.stims.add(ScStim(obj,channelname,'tag',channelname));
end
else
msg = sprintf('Warning: Channel %s in file %s did not meet any criteria in %s.\n Go find Hannes if you think this channel should be viewable.', channelname, obj.tag, mfilename);
msgbox(msg);
Expand Down

0 comments on commit 89c9057

Please sign in to comment.