-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #562 from bachlab/559-pspm_convert_ppg2hb-supports…
…-both-optionsreplace-and-optionschannel_action
- Loading branch information
Showing
56 changed files
with
916 additions
and
1,267 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,39 @@ | ||
function out = pspm_cfg_run_artefact_rm(job) | ||
% Executes pspm_pp | ||
|
||
% $Id$ | ||
% $Rev$ | ||
|
||
options = struct; | ||
options.overwrite = job.overwrite; | ||
|
||
% Reviewed and updated on 18-Dec-2023 by Teddy | ||
options = struct(); | ||
options = pspm_update_struct(options, job, {'overwrite'}); | ||
filtertype = fieldnames(job.filtertype); | ||
filtertype = filtertype{1}; | ||
datafile = job.datafile; | ||
datafile = datafile{1}; | ||
channelnumber = job.chan_nr; | ||
|
||
switch filtertype | ||
case 'median' | ||
n = job.filtertype.(filtertype).nr_time_pt; | ||
out = pspm_pp(filtertype, datafile, n, channelnumber, options); | ||
case 'butter' | ||
freq = job.filtertype.(filtertype).freq; | ||
out = pspm_pp(filtertype, datafile, freq, channelnumber, options); | ||
case 'scr_pp' | ||
scr_job = job.filtertype.(filtertype); | ||
% Option structure sent to pspm_simple_qa | ||
scr = struct(); | ||
if isfield(scr_job, 'min'), scr.min = scr_job.min; end % Check if min is defined | ||
if isfield(scr_job, 'max'), scr.max = scr_job.max; end % Check if max is defined | ||
if isfield(scr_job, 'slope'), scr.slope = scr_job.slope; end % Check if slope is defined | ||
if isfield(scr_job.missing_epochs, 'write_to_file') % Check if missing_epochs is defined | ||
if isfield(scr_job.missing_epochs.write_to_file,'filename') && isfield(scr_job.missing_epochs.write_to_file,'outdir') | ||
scr.missing_epochs_filename = fullfile(scr_job.missing_epochs.write_to_file.outdir{1}, scr_job.missing_epochs.write_to_file.filename); | ||
end | ||
end | ||
if isfield(scr_job, 'deflection_threshold'), scr.deflection_threshold = scr_job.deflection_threshold; end % Check if deflection_threshold is defined | ||
if isfield(scr_job, 'data_island_threshold'), scr.data_island_threshold = scr_job.data_island_threshold; end % Check if data_island_threshold is defined | ||
if isfield(scr_job, 'expand_epochs'), scr.expand_epochs = scr_job.expand_epochs; end % Check if expand_epochs is defined | ||
if isfield(scr_job, 'change_data'), scr_job.change_data = scr_job.change_data; else, scr_job.change_data = "replace"; end % Check if data will be changed | ||
|
||
[~, out] = pspm_scr_pp(datafile, scr); | ||
case 'median' | ||
n = job.filtertype.(filtertype).nr_time_pt; | ||
out = pspm_pp(filtertype, datafile, n, channelnumber, options); | ||
case 'butter' | ||
freq = job.filtertype.(filtertype).freq; | ||
out = pspm_pp(filtertype, datafile, freq, channelnumber, options); | ||
case 'scr_pp' | ||
scr_job = job.filtertype.(filtertype); | ||
options = pspm_update_struct(options, scr_job, {'min',... | ||
'max',... | ||
'slope',... | ||
'deflection_threshold',... | ||
'data_island_threshold',... | ||
'expand_epochs'}) | ||
if isfield(scr_job.missing_epochs, 'write_to_file') | ||
if isfield(scr_job.missing_epochs.write_to_file,'filename') && ... | ||
isfield(scr_job.missing_epochs.write_to_file,'outdir') | ||
options.missing_epochs_filename = fullfile(... | ||
scr_job.missing_epochs.write_to_file.outdir{1}, ... | ||
scr_job.missing_epochs.write_to_file.filename); | ||
end | ||
end | ||
if isfield(scr_job, 'change_data') | ||
options.channel_action = 'add'; | ||
else | ||
options.channel_action = 'replace'; | ||
end | ||
[~, out] = pspm_scr_pp(datafile, options); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
function pspm_cfg_run_combine_markerchannels(job) | ||
% Updated on 19-12-2023 by Teddy | ||
%% Variables | ||
% fn | ||
fn = job.datafile{1}; | ||
channel_action = job.channel_action; | ||
marker_channel_number = job.marker_chan_num; | ||
options = struct('channel_action', channel_action, ... | ||
'marker_chan_num', marker_channel_number); | ||
% options | ||
options = struct(); | ||
options = pspm_update_struct(options, job, {'channel_action',... | ||
'marker_chan_num'}) | ||
%% Run | ||
pspm_combine_markerchannels(fn, options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,21 @@ | ||
function out = pspm_cfg_run_contrast1(job) | ||
% Executes pspm_con1 | ||
|
||
% $Id$ | ||
% $Rev$ | ||
|
||
% Updated on 18-12-2023 by Teddy | ||
%% Variables | ||
% modelfile | ||
modelfile = job.modelfile; | ||
|
||
% contrast names & vectors | ||
% connames, convec | ||
nrCon = size(job.con,2); | ||
for iCon=1:nrCon | ||
for iCon = 1:nrCon | ||
connames{1,iCon} = job.con(iCon).conname; | ||
convec{1,iCon} = job.con(iCon).convec; | ||
end | ||
|
||
% delete existing contrast | ||
deletecon = job.deletecon; | ||
|
||
% zscore data | ||
options.zscored = job.zscored; | ||
|
||
% datatype | ||
datatype = job.datatype; | ||
|
||
% deletecon | ||
deletecon = job.deletecon; | ||
% options | ||
options = struct(); | ||
options = pspm_update_struct(options, job, 'zscored') | ||
%% Run | ||
pspm_con1(modelfile, connames, convec, datatype, deletecon, options); | ||
|
||
out = modelfile; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,23 @@ | ||
function [out] = pspm_cfg_run_data_convert(job) | ||
|
||
% $Id$ | ||
% $Rev$ | ||
|
||
channel_action = job.channel_action; | ||
% Updated on 19-12-2023 by Teddy | ||
fn = job.datafile{1}; | ||
|
||
for i=1:numel(job.conversion) | ||
options = struct(); | ||
options.channel_action = channel_action; | ||
channel = job.conversion(i).channel; | ||
if isfield(job.conversion(i).mode, 'area2diameter') | ||
pspm_convert_area2diameter(fn, chan, options); | ||
end | ||
if isfield(job.conversion(i).mode, 'pixel2unit') | ||
width = job.conversion(i).mode.pixel2unit.width; | ||
height = job.conversion(i).mode.pixel2unit.height; | ||
distance = job.conversion(i).mode.pixel2unit.distance; | ||
unit = job.conversion(i).mode.pixel2unit.unit; | ||
pspm_convert_pixel2unit(fn, chan, unit, width, height,distance, options); | ||
end | ||
if isfield(job.conversion(i).mode, 'visangle2sps') | ||
options.channels = channel; | ||
options.eyes = job.conversion(i).mode.visangle2sps.eyes; | ||
pspm_convert_visangle2sps(fn,options); | ||
end | ||
for i = 1:numel(job.conversion) | ||
options = struct(); | ||
options = pspm_update_struct(options, job, 'channel_action'); | ||
if isfield(job.conversion(i).mode, 'area2diameter') | ||
pspm_convert_area2diameter(fn, chan, options); | ||
end | ||
if isfield(job.conversion(i).mode, 'pixel2unit') | ||
width = job.conversion(i).mode.pixel2unit.width; | ||
height = job.conversion(i).mode.pixel2unit.height; | ||
distance = job.conversion(i).mode.pixel2unit.distance; | ||
unit = job.conversion(i).mode.pixel2unit.unit; | ||
pspm_convert_pixel2unit(fn, chan, unit, width, height,distance, options); | ||
end | ||
if isfield(job.conversion(i).mode, 'visangle2sps') | ||
options = pspm_update_struct(options, job.conversion(i), 'channel'); | ||
options = pspm_update_struct(options, job.conversion(i).mode.visangle2sps, 'eyes'); | ||
pspm_convert_visangle2sps(fn, options); | ||
end | ||
end | ||
|
||
out = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.