-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
758 pspm_expand_epochs #786
Conversation
src/pspm_expand_epochs.m
Outdated
@@ -0,0 +1,147 @@ | |||
function [sts, ep_exp] = pspm_expand_epochs(epoches, expansion, options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest using the varargin
syntax.
src/pspm_expand_epochs.m
Outdated
% Initialize status | ||
sts = -1; | ||
|
||
% Check if epochs matrix and expansion vector are valid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is needed for all modes of the function, I would check it in the beginning of the main function, before anything is loaded from file (faster and easier to read).
src/pspm_expand_epochs.m
Outdated
|
||
% | ||
% Ensure that the start of any epoch is not negative | ||
expanded_epochs_temp(expanded_epochs_temp(:,1) < 0, 1) = 0; % or <1??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably we should put this code into pspm_get_epochs (if the functionality does not exist there already), because it is needed in several functions.
then just call [sts, epochs] = pspm_get_timing('epochs', epochs)
src/pspm_remove_epochs.m
Outdated
@@ -12,14 +12,17 @@ | |||
% be in seconds. This parameter is passed to pspm_get_timing(). | |||
% * timeunits: timeunits of the epochfile. | |||
% ┌───options | |||
% └─.channel_action: | |||
% └─.channel_action: [pre, post] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is the channel action changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some functions return sts == -1 if unsuccessful, others sts == 0. So to be most general, it is best practice to check for unsuccessful downstream functions with if sts < 1
Fixes #758 .
Changes proposed in this pull request: