Skip to content

Commit

Permalink
more files to update
Browse files Browse the repository at this point in the history
  • Loading branch information
4gwe committed Jan 28, 2025
1 parent 4a79664 commit b781483
Show file tree
Hide file tree
Showing 24 changed files with 77 additions and 58 deletions.
4 changes: 2 additions & 2 deletions src/pspm_convert_pixel2unit_core.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
% ● Description
% pspm_convert_pixel2unit_core converts gaze data from pixel to units.
% ● Format
% [sts, out_data, out_range] = pspm_convert_pixel2unit_core(data, screen_length)
% [out_data, out_range] = pspm_convert_pixel2unit_core(data, data_range, screen_length)
% ● Arguments
% * data: Original data in pixels. No checks are performed.
% * range: Original range in pixels.
% * data_range: Original range in pixels.
% * screen_length: Screen width for gaze_x data, or screen height for gaze_y data, in mm
% ● History
% Introduced in PsPM 4.0
Expand Down
2 changes: 1 addition & 1 deletion src/pspm_eye.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
% ● Description
% pspm_eye converts legacy use of eye markers into the current version
% ● Format
% Y = pspm_eye(X)
% Y = pspm_eye(X,feature)
% ● Arguments
% * X: The input eye marker.
% * feature: The feature used for converting eye marker. Accepted values
Expand Down
10 changes: 6 additions & 4 deletions src/pspm_get_acq_bioread.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
% ● Arguments
% * datafile : the path of the BIOPAC/AcqKnowledge file to be imported
% ┌───import
% ├─.channel : channel.
% ├──────.sr : sampling rate.
% ├────.type : channel type.
% ├────.data : The data read from the acq file.
% ├───.units : the unit of data.
% └──.marker : The type of marker, such as 'continuous'.
Expand All @@ -38,8 +40,8 @@
channel = import{k}.channel;
else
channel = pspm_find_channel(channel_labels, import{k}.type);
if channel < 1, return; end;
end;
if channel < 1, return; end
end
if channel > size(channel_labels, 1)
warning('ID:channel_not_contained_in_file', ...
'Channel %02.0f not contained in file %s.\n', channel, datafile);
Expand All @@ -54,8 +56,8 @@
import{k}.units = inputdata.channels{channel}.units;
if strcmpi(settings.channeltypes(import{k}.typeno).data, 'events')
import{k}.marker = 'continuous';
end;
end;
end
end
%% Return values
sts = 1;
return
8 changes: 4 additions & 4 deletions src/pspm_get_biograph.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
fprintf('\n');
warning('Please use ''Interval Data Export'' for channels of type ''%s''', ...
import{1}.type); return
end;
end
import{1}.marker = 'timestamps';
import{1}.sr = 1; % time stamps are in seconds
import{1}.data = bio.data{1};
Expand All @@ -50,7 +50,7 @@
fprintf('\n');
warning('Please use ''Export Channel Data'' for channels of type ''%s''', ...
import{1}.type); return
end;
end
import{1}.sr = str2num(cell2mat(regexp(bio.header{1}{1}, '\d', 'match')));
import{1}.data = bio.data{2};
% check sample rate --
Expand All @@ -70,8 +70,8 @@
% --> abs(1-diff(timestamps)) < threshold, with threshold = sr * abs(error)
if any(abs(1-import{1}.sr*diff(bio.data{1})) > threshold)
warning('Sample rate in header line and timestamps in first column do not match.'); return;
end;
end;
end
end
%% Return values
sts = 1;
return
1 change: 1 addition & 0 deletions src/pspm_get_blink_l.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
% ● Arguments
% ┌──import
% ├───.data: column vector of waveform data
% ├──.units: units of waveform data
% └─────.sr: sample rate
% ● History
% Introduced in PsPM 4.0.2
Expand Down
1 change: 1 addition & 0 deletions src/pspm_get_blink_r.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
% ● Arguments
% ┌────import
% ├─────.data : column vector of waveform data
% ├────.units : units of waveform data
% └───────.sr : sample rate
% ● History
% Introduced in PsPM 4.0.2
Expand Down
12 changes: 6 additions & 6 deletions src/pspm_get_cnt.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
headerformat = 'ns_cnt32';
else
headerformat = 'ns_cnt16';
end;
end

hdr = ft_read_header(datafile, 'headerformat', headerformat);
indata = ft_read_data(datafile, 'headerformat', headerformat, 'dataformat', headerformat);
Expand All @@ -51,8 +51,8 @@
channel = import{k}.channel;
else
channel = pspm_find_channel(hdr.label, import{k}.type);
if channel < 1, return; end;
end;
if channel < 1, return; end
end

sourceinfo.channel{k, 1} = sprintf('Channel %02.0f: %s', channel, hdr.label{channel});

Expand All @@ -74,10 +74,10 @@
import{k}.data = [];
import{k}.markerinfo.value = [];
import{k}.markerinfo.name = [];
end;
end;
end
end

end;
end

% clear path and return
% -------------------------------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion src/pspm_get_gaze_x_l.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
% ● Arguments
% ┌import
% ├─.data : column vector of left gaze x data
% └───.sr : sample rate
% ├─.units: measurement units
% ├───.sr : sample rate
% └─.range: range of the gaze data
% ● History
% Introduced in PsPM 3.1
% Written in 2015 by Tobias Moser (University of Zurich)
Expand Down
4 changes: 3 additions & 1 deletion src/pspm_get_gaze_x_r.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
% ● Arguments
% ┌import
% ├─.data : column vector of right gaze x data
% └───.sr : sample rate
% ├─.units: measurement units
% ├───.sr : sample rate
% └─.range: range of the gaze data
% ● History
% Introduced in PsPM 3.1
% Written in 2015 by Tobias Moser (University of Zurich)
Expand Down
4 changes: 3 additions & 1 deletion src/pspm_get_gaze_y_l.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
% ● Arguments
% ┌import
% ├─.data : column vector of left gaze y data
% └───.sr : sample rate
% ├─.units: measurement units
% ├───.sr : sample rate
% └─.range: range of the gaze data
% ● History
% Introduced in PsPM 3.1
% Written in 2015 by Tobias Moser (University of Zurich)
Expand Down
4 changes: 3 additions & 1 deletion src/pspm_get_gaze_y_r.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
% ● Arguments
% ┌import
% ├─.data : column vector of right gaze y data
% └───.sr : sample rate
% ├─.units: measurement units
% ├───.sr : sample rate
% └─.range: range of the gaze data
% ● History
% Introduced in PsPM 3.1
% Written in 2015 by Tobias Moser (University of Zurich)
Expand Down
2 changes: 1 addition & 1 deletion src/pspm_get_labchart.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
% ● Description
% pspm_get_labchart imports ADInstruments LabChart *.adicht files. This
% function uses an external library that requires Windows as OS. See
% pspm_labchartmat_in and pspm_labchart_mat_ex for import of matlab
% pspm_get_labchartmat_in and pspm_get_labchartmat_ext for import of matlab
% files that were exported either using the built-in function or the
% online conversion tool.
% ● Format
Expand Down
2 changes: 1 addition & 1 deletion src/pspm_get_pupil_l.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function [sts, data] = pspm_get_pupil_l(import)
edit function [sts, data] = pspm_get_pupil_l(import)
% ● Description
% pspm_get_pupil_l is a common function for importing eyelink data
% (pupil_l data)
Expand Down
10 changes: 5 additions & 5 deletions src/pspm_get_rf.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
warning('No events specified'); return;
elseif nargin < 3
outfile = '';
end;
end
if isempty(outfile) || ~ischar(outfile)
[pth infn ext] = fileparts(fn);
outfile = fullfile(pth, ['RF_', infn, ext]);
end;
end
if nargin < 4
channel = 'scr';
end;
end

%% call DCM
options = pspm_options(options, 'get_rf');
Expand All @@ -56,7 +56,7 @@
else
% based on aSCR (i. e. updated RF)
theta = dcm{1}.prior.posterior(3).muTheta(1:7)';
end;
end

%% write response function to file
if ~isempty(outfile)
Expand Down Expand Up @@ -85,6 +85,6 @@
job = strvcat(job');
outfile = fullfile(pth, [fn, '.m']);
dlmwrite(outfile, job, 'delimiter', '');
end;
end
sts = 1;
return
4 changes: 2 additions & 2 deletions src/pspm_get_saccade_l.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
% ● Arguments
% ┌import
% ├─.data : column vector of left saccade data
%───.sr : sample rate
%.units : unit of left saccade data
%.units : unit of left saccade data
%───.sr : sample rate
% ● History
% Introduced in PsPM 4.0.2
% Written in 2018 by Laure Ciernik
Expand Down
13 changes: 6 additions & 7 deletions src/pspm_get_smr.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
% ● Format
% [sts, import, sourceinfo] = pspm_get_smr(datafile, import);
% ● Arguments
% datafile
% * datafile : the data file to be imported.
% ┌───import
% └───denoise: for marker channels in CED spike format (recorded as 'level'),
% only retains markers with duration longer than the value given here (in ms).
% ├───channel : X
% └───denoise : for marker channels in CED spike format (recorded as 'level'),
% only retains markers with duration longer than the value given here (in ms).
% ● Outputs
% import
% ┌──sourceinfo
% └───channel:
% sts
% * import : the import struct with added information.
% * sourceinfo: the struct that includes source information.
% ● History
% Introduced in PsPM 3.0
% Written in 2008-2015 by Dominik R Bach (Wellcome Trust Centre for Neuroimaging)
Expand Down
4 changes: 2 additions & 2 deletions src/pspm_get_smrx.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
function [sts, import, sourceinfo] = pspm_get_smrx(datafile, import)
% ● Description
% pspm_get_smr imports *.smrx files generated by Cambridge Electronics
% pspm_get_smrx imports *.smrx files generated by Cambridge Electronics
% Design (CED) Spike software.
% ● Format
% [sts, import, sourceinfo] = pspm_get_smr(datafile, import);
% [sts, import, sourceinfo] = pspm_get_smrx(datafile, import);
% ● Arguments
% * datafile : path to the smrx file
% ┌───import
Expand Down
1 change: 1 addition & 0 deletions src/pspm_get_sound.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
% ● Arguments
% ┌─import
% ├──.data : column vector of waveform data.
% ├─.units : units of data.
% └────.sr : sample rate.
% ● History
% Introduced in PsPM 3.0
Expand Down
6 changes: 3 additions & 3 deletions src/pspm_glm_recon.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
% Reconstructed responses are written into the field glm.resp, and
% reconstructed response peaks into the field glm.recon in original GLM file.
% ● Format
% glm = pspm_glm_recon(glmfile) or [sts, glm] = pspm_glm_recon(glmfile)
% glm = pspm_glm_recon(modelfile) or [sts, glm] = pspm_glm_recon(modelfile)
% ● Arguments
% * glmfile : the GLM file
% * modelfile : the GLM file
% ● Outputs
% * glm : calculated GLM struct
% * glm : calculated GLM struct
% ● History
% Introduced in PsPM 3.0
% Written in 2008-2018 Dominik R Bach (Wellcome Trust Centre for Neuroimaging)
Expand Down
1 change: 1 addition & 0 deletions src/pspm_load1.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
% 'stats', 'recon', 'cond')
% - con structure (for 'con')
% - full first level structure (for 'all')
% * mdltype : model type e.g. 'glm', 'sf', 'dcm', 'tam'
% ● Developer's Notes
% General structure of PsPM 1st level model files
% Each file contains one struct variable with the model
Expand Down
5 changes: 3 additions & 2 deletions src/pspm_load_data.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
function [sts, infos, data, filestruct] = pspm_load_data(fn, channel)
% ● Description
% pspm_load_data checks and returns the structure of PsPM 3-5.x and
% pspm_load_data checks and returns the structure of PsPM 3-7.x and
% SCRalyze 2.x data files - SCRalyze 1.x is not supported
% ● Format
% [sts, infos, data, filestruct] = pspm_load_data(fn, channel)
% [sts, infos, data, filestruct] = pspm_load_data(fn)
% ● Arguments
% * fn: [char] filename / [struct] with fields
% ┌──────fn
Expand All @@ -25,7 +26,7 @@
% returns the respective channels (see settings for
% permissible channel types)
% 'none' just checks the file
% ▶ struct check and save file
% ▶ struct check and save file
% ┌────channel
% ├───.infos: (mandatory)
% ├────.data: (mandatory)
Expand Down
2 changes: 1 addition & 1 deletion src/pspm_multi_channel.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
% function multiple times and so does accelerate processing time. It
% creates the required loop and handles any processing errors.
% ● Format
% [sts, channel_index] = pspm_multi_channel(function, channels, argument1, argument2, ..., options)
% [sts, channel_index] = pspm_multi_channel(fhandle, channels, argument1, argument2, ..., options)
% ● Arguments
% * fhandle : [char or function handle] Preprocessing function
% * channels : [char, vector, cell array] Channel specifications:
Expand Down
29 changes: 17 additions & 12 deletions src/pspm_sf_mp.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
% matching pursuit algorithm, and f_SF for the forward model the input data is assumed
% to be in mcS, and sampling rate in Hz.
% ● Format
% [sts, mp] = pspm_sf_mp(model, options)
% [sts, out] = pspm_sf_mp(model, options)
% ● Arguments
% * scr : skin conductance epoch (maximum size depends on computing power, a
% sensible size is 60 s at 10 Hz)
% * sr : sampling rate in Hz
% ┌─model
% ├─────scr : skin conductance epoch (maximum size depends on computing power, a
% │ sensible size is 60 s at 10 Hz)
% └──────sr : sampling rate in Hz
% ┌─options
% ├─.threshold: threshold for SN detection (default 0.1 mcS)
% ├──.theta : a (1 x 5) vector of theta values for f_SF (default: read from pspm_sf_theta)
Expand All @@ -23,15 +24,19 @@
% ├──────.n : number of responses above threshold
% ├──────.f : frequency of responses above threshold in Hz
% ├─────.ma : mean amplitude of responses above threshold
% ├──────.t : timing of responses
% ├──────.a : amplitude of responses (re-estimated)
% ├───.rawa : amplitude of responses (initial estimate)
% ├──────.t : timing of responses (adjusted for conduction delay)
% ├──────.a : amplitude of responses (re-estimated via ML)
% ├───.rawa : amplitude of responses (initial greedy estimate)
% ├──.theta : parameters used for f_SF
% ├─.threshold : threshold
% ├───.yhat : fitted time series (reestimated amplitudes)
% ├.yhatraw : fitted time series (original amplitudes)
% ├──────.S : inversion settings
% └──────.D : inversion dictionary
% ├─.threshold : threshold applied for response detection
% ├───.yhat : fitted time series (using reestimated amplitudes)
% ├.yhatraw : fitted time series (using initial amplitudes)
% ├──────.ind : indices of selected dictionary atoms in D.D
% ├──.sortind : sorted indices of selected atoms (after pruning)
% ├───────.y : preprocessed input data (baseline-centered scr)
% ├───.time : total execution time in seconds
% ├──────.S : inversion settings (struct with algorithm parameters)
% └──────.D : inversion dictionary (struct with atoms and metadata)
% ● References
% [1] Bach DR, Staib M (2015). A matching pursuit algorithm for inferring tonic
% sympathetic arousal from spontaneous skin conductance fluctuations.
Expand Down
2 changes: 1 addition & 1 deletion src/pspm_sf_scl.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
% ● Description
% pspm_sf_scl returns the mean skin conductance level for an epoch
% ● Format
% [sts, scl] = pspm_sf_scl(scr, sr)
% [sts, scl] = pspm_sf_scl(model, options)
% ● Arguments
% ┌────────model
% ├─────────.scr : skin conductance epoch (maximum size depends on computing power,
Expand Down

0 comments on commit b781483

Please sign in to comment.