Skip to content

Commit a92d93c

Browse files
committed
Merge branch 'develop' into Test-app_designer-display
2 parents 765db10 + 61e2da4 commit a92d93c

File tree

160 files changed

+8864
-18627
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+8864
-18627
lines changed

doc/PsPM.bib

+204-62
Large diffs are not rendered by default.

doc/PsPM_Developers_Guide.lyx

+2,606-968
Large diffs are not rendered by default.

doc/PsPM_Developers_Guide.pdf

755 KB
Binary file not shown.

doc/PsPM_Manual.lyx

+2,078-16,326
Large diffs are not rendered by default.

doc/PsPM_Manual.pdf

-2.05 MB
Binary file not shown.

doc/PsPM_References.lyx doc/PsPM_options_documentation.lyx

+198-89
Large diffs are not rendered by default.
Binary file not shown.

doc/PsPM_release_checklist.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
This file contains the steps required for finalising a PsPM release. Many items at the beginning don't have to be followed sequentially. However, it is important that there aren't any revisions (commits) that implement/fix something new in the release branch, because we don't merge these branches back to trunk. Therefore, it is sensible to create the release branch after making absolutely sure that no new stuff will be implemented.
33

44
- [ ] Update version number & date in
5-
- [ ] `pspm_msg`
5+
- [ ] `pspm_msg.txt`
66
- [ ] `pspm_quit`
77
- [ ] `pspm_ui`
8-
- [ ] `pspm.fig`: Load `pspm.fig` into MATLAB using `openfig`, update `fig.Children(9).String` and save back to `pspm.fig`
8+
- [ ] `pspm_ui_app`
99
- [ ] Manual and Developers Guide: front pages
1010
- [ ] Make sure both manuals are updated
1111
- [ ] Add release notes section of the new version to manual (at the end) and release\_notes.tex
@@ -23,3 +23,5 @@ This file contains the steps required for finalising a PsPM release. Many items
2323
- [ ] Add release message to GitHub
2424
- [ ] Change release number on lab webpage (gh-pages branch)
2525
- [ ] Add release message to lab webpage (gh-pages branch)
26+
- [ ] Update `PsPM_installer` in `/src/helper` with the new version number and download link, and merge this pull request on the official release date.
27+

doc/release_notes.pdf

8.27 KB
Binary file not shown.

doc/release_notes.tex

+435-25
Large diffs are not rendered by default.

src/Import/eyelink/import_eyelink.m

+8-2
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@
188188
while strncmp(curr_line, '**', numel('**'))
189189
if contains(curr_line, 'DATE')
190190
colon_idx = strfind(curr_line, ':');
191-
date_part = curr_line(colon_idx + 1 : end);
191+
date_part = curr_line(colon_idx(1) + 1 : end);
192192
date_fmt = 'eee MMM d HH:mm:ss yyyy';
193193
date = datetime(date_part, 'InputFormat', date_fmt);
194194
file_info.record_date = sprintf('%.2d.%.2d.%.2d', date.Day, date.Month, date.Year);
@@ -364,6 +364,7 @@
364364
function chan_info = parse_session_headers(messages)
365365
prev_n_messages = 0;
366366
pupil_str = sprintf('PUPIL\t');
367+
global settings;
367368
for sess_idx = 1:numel(messages)
368369
i = 1;
369370
while true
@@ -387,7 +388,12 @@
387388
parts = split(msg);
388389
chan_info{sess_idx}.track_mode = parts{4};
389390
chan_info{sess_idx}.sr = str2num(parts{5});
390-
chan_info{sess_idx}.eyesObserved = parts{8};
391+
chan_info{sess_idx}.eyesObserved = parts{end};
392+
if ~any(structfun( @(x) strcmpi(chan_info{sess_idx}.eyesObserved , x), settings.eye.cap ) )
393+
warning(['Parsing Error: The value for "eyesObserved"' ...
394+
' must be ''R'', ''L'', ''RL'', or ''LR''.']);
395+
end
396+
391397
elseif contains(msg, pupil_str)
392398
parts = split(msg);
393399
chan_info{sess_idx}.diam_vals = lower(parts{2});

src/g_SCR.m

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
function [gx,dgdx,dgdPhi] = g_SCR(Xt,Phi,ut,inG)
2-
% ● Description
3-
% TBA.
2+
% ● Description
3+
% This is the SCR observation function required by the VBA toolbox. It
4+
% adds the three generative processes (phasic SCR, SF, SCL) modelled in
5+
% f_SCR.
46
% ● Arguments
5-
% Xt:
6-
% Phi:
7-
% ut:
8-
% inG:
7+
% Xt: a 7-element vector
8+
% Phi: input required by VBA, ignored
9+
% ut: input required by VBA, ignored
10+
% inG: input required by VBA, ignored
911
% ● History
1012
% Introduced in PsPM 3.0
1113
% Written in 2008-2015 by Dominik R Bach (Wellcome Trust Centre for Neuroimaging)
1214

1315
global settings;
14-
if isempty(settings), pspm_init; end;
16+
if isempty(settings), pspm_init; end
1517
gx = Xt(1) + Xt(4) + Xt(7);
1618
dgdx = zeros(size(Xt,1),1);
1719
dgdx([1;4;7]) = 1;
1820
dgdPhi = [];
19-
if any(isnan(gx)|isinf(gx)), keyboard; end;
20-
if any(isnan(dgdx)|isinf(dgdx)), keyboard; end;
21+
if any(isnan(gx)|isinf(gx)), keyboard; end
22+
if any(isnan(dgdx)|isinf(dgdx)), keyboard; end

src/helper/PsPM_installer.m

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
% This is a convenience PsPM installer. As an alternative, download the
2+
% lastest release from https://github.com/bachlab/PsPM, or clone the
3+
% develop branch.
4+
% Uzay Gökay & Dominik Bach, 2025
5+
6+
fprintf('Welcome to the PsPM installer.\n');
7+
[indx,tf] = listdlg('ListString',{'Latest PsPM release', 'GLM tutorial dataset', 'DCM tutorial dataset'}, ...
8+
'PromptString', 'Select items to install.');
9+
10+
if tf == 0
11+
fprintf('PsPM installation aborted.\n');
12+
return;
13+
end
14+
15+
fprintf('Please select the parent directory for your PsPM installation.\n');
16+
destinationFolder = uigetdir('','Select parent directory for your PsPM installation');
17+
18+
% -------------------------------------------------------------------------
19+
20+
if ismember(1, indx)
21+
22+
% GitHub release URL for PsPM and the desired version
23+
githubReleaseURL = 'https://github.com/bachlab/PsPM/releases/download';
24+
version = 'v7.0.0';
25+
packageName = 'PsPM_v7.0.0';
26+
27+
% Create the destination folder if it does not exist
28+
if ~exist(destinationFolder, 'dir')
29+
mkdir(destinationFolder);
30+
end
31+
32+
% Construct the full URL for the specified version and platform (assuming Windows)
33+
matlabPackageURL = sprintf('%s/%s/%s.zip', githubReleaseURL, version, packageName);
34+
35+
% Download the PsPM package
36+
disp(['Downloading PsPM version ' version '...']);
37+
websave('temp_package.zip', matlabPackageURL);
38+
39+
% Unzip the contents to the destination folder
40+
disp('Unzipping package...');
41+
unzip('temp_package.zip', destinationFolder);
42+
43+
% Clean up: delete the temporary ZIP file
44+
delete('temp_package.zip');
45+
46+
disp(['PsPM package ' version ' download and unzip completed.']);
47+
48+
%%%%%%%%%%%%%%%%%% add path %%%%%%%%%%%%%%%%%%%%%%%%%%
49+
% Add the unzipped PsPM files to the MATLAB search path
50+
addpath(fullfile(destinationFolder, packageName));
51+
52+
disp('PsPM added to MATLAB search path.');
53+
end
54+
55+
56+
%%%%%%%%%%% GLM dataset %%%%%%%%%%%%%%
57+
if ismember(2, indx)
58+
% URL for the PsPM GLM tutorial dataset
59+
glmTutorialDatasetURL = 'https://github.com/bachlab/PsPM-tutorial-datasets/releases/download/tutorial-datasets/Tutorial_dataset_GLM.zip';
60+
glmTutorialDatasetName = 'Tutorial_dataset_GLM';
61+
62+
% Destination folder for the tutorial dataset
63+
tutorialDestinationFolder = fullfile(destinationFolder, glmTutorialDatasetName);
64+
65+
% Create the destination folder if it does not exist
66+
if ~exist(tutorialDestinationFolder, 'dir')
67+
mkdir(tutorialDestinationFolder);
68+
end
69+
70+
% Download the PsPM tutorial dataset
71+
disp('Downloading GLM tutorial dataset...');
72+
websave('temp_tutorial_dataset.zip', glmTutorialDatasetURL);
73+
74+
% Unzip the tutorial dataset to the destination folder
75+
disp('Unzipping GLM tutorial dataset...');
76+
unzip('temp_tutorial_dataset.zip', tutorialDestinationFolder);
77+
78+
% Clean up: delete the temporary ZIP file
79+
delete('temp_tutorial_dataset.zip');
80+
81+
disp('GLM tutorial dataset download and unzip completed.');
82+
end
83+
84+
%%%%%%%%%%%%%%% DCM Dataset %%%%%%%%%%%%%%%
85+
if ismember(3, indx)
86+
% URL for the PsPM DCM tutorial dataset
87+
dcmTutorialDatasetURL = 'https://github.com/bachlab/PsPM-tutorial-datasets/releases/download/tutorial-datasets/Tutorial_dataset_DCM.zip';
88+
dcmTutorialDatasetName = 'Tutorial_dataset_DCM';
89+
90+
% Destination folder for the DCM tutorial dataset
91+
dcmTutorialDestinationFolder = fullfile(destinationFolder, dcmTutorialDatasetName);
92+
93+
% Create the destination folder if it does not exist
94+
if ~exist(dcmTutorialDestinationFolder, 'dir')
95+
mkdir(dcmTutorialDestinationFolder);
96+
end
97+
98+
% Download the PsPM DCM tutorial dataset
99+
disp('Downloading DCM tutorial dataset...');
100+
websave('temp_dcm_tutorial_dataset.zip', dcmTutorialDatasetURL);
101+
102+
% Unzip the DCM tutorial dataset to the destination folder
103+
disp('Unzipping DCM tutorial dataset...');
104+
unzip('temp_dcm_tutorial_dataset.zip', dcmTutorialDestinationFolder);
105+
106+
% Clean up: delete the temporary ZIP file
107+
delete('temp_dcm_tutorial_dataset.zip');
108+
109+
disp('DCM tutorial dataset download and unzip completed.');
110+
111+
end
112+

src/pspm_appdesigner.mlapp

10.4 KB
Binary file not shown.

src/pspm_appdesigner2019.mlapp

13.3 KB
Binary file not shown.

src/pspm_bf_hprf_f.m

-41
This file was deleted.

src/pspm_bf_hprf_fc.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
% [bs, x] = pspm_bf_hprf_fc([TD, D, soa])
77
% ● Arguments
88
% * td : time resolution in second.
9-
% * d : number of derivatives. Default as 0.
9+
% * d : number of derivatives. Default is 1.
1010
% ● History
1111
% Introduced in PsPM 3.0
1212
% Written in 2015 by Tobias Moser (University of Zurich)
@@ -21,7 +21,7 @@
2121
end
2222
td = varargin{1}(1);
2323
if numel(varargin{1}) == 1 && nargin == 1
24-
d = 0;
24+
d = 1;
2525
soa = 3.5;
2626
else
2727
if numel(varargin) > 1
@@ -32,7 +32,7 @@
3232
if numel(va) > 1
3333
d = va(2);
3434
else
35-
d = 0;
35+
d = 1;
3636
end
3737
if numel(va) > 2
3838
soa = va(3);

src/pspm_bf_hprf_rew.m

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
function [bs, x] = pspm_bf_hprf_rew(td)
22
% ● Description
33
% This function implements a canonical gamma response function for
4-
% reward-conditioned heart period responses.
4+
% reward-conditioned heart period responses, based on exps 1-2 in Xia*,
5+
% Liu*, et al. (2024).
56
% ● Format
67
% [bs, x] = pspm_bf_hprf_fc(TD)
78
% ● Arguments
89
% * td : time resolution in second.
910
% ● References:
1011
% GLM for reward-conditioned bradycardia:
11-
% Xia Y, Liu H, Kälin OK, Gerster S, Bach DR (under review). Measuring
12+
% Xia Y, Liu H, Kälin OK, Gerster S, Bach DR (2024). Measuring
1213
% human Pavlovian appetitive conditioning and memory retention.
14+
% Pre-print.
1315
% ● History
1416
% Introduced in PsPM 7.0
1517
% Written in 2021 by Oliver Keats Kälin and Yanfang Xia (University of Zurich)
@@ -28,7 +30,8 @@
2830
% default values
2931
duration = 30;
3032
% k, theta, c, t0
31-
p_cs = [1.716239999852250e+02,0.140004209328788,60.095121886556230,-17.607312178043863];
33+
% p_cs = [1.716239999852250e+02,0.140004209328788,60.095121886556230,-17.607312178043863]; % generated from REW1 data
34+
p_cs = [73.9977984802746, 0.210014413426350, 71.1984486930105, -9.19655727625912]; % generated from the combined data set of REW1 and REW2
3235

3336
x = (0:td:duration-td)';
3437
bs = zeros(numel(x), 1);
@@ -51,3 +54,6 @@
5154
elseif t0 < 0
5255
bs(1:sto, 1) = g_cs(sta:end);
5356
end
57+
58+
% normalise
59+
bs = bs/max(bs);

src/pspm_bf_lcrf_gm.m

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
% ● Arguments
1111
% * td : time resolution in second.
1212
% * n : duration of the function in s. Default as 20 s.
13-
% * offset: offset in s. tells the function where to start with
14-
% the response function. Default as 0.2 s.
13+
% * offset: offset of the response function (in s).
1514
% * a : shape of the function.
1615
% * b : scale of the function.
1716
% * A : quantifier or amplitude of the function

src/pspm_bf_ldrf_gm.m

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
% ● Arguments
1111
% * td : Time resolution in second.
1212
% * n : Duration of the function in second. Default as 20 s.
13-
% * offset : Offset in s. tells the function where to start with
14-
% the response function. Default as 0.2 s.
13+
% * offset : Offset of the response (in s).
1514
% * a : Shape of the function.
1615
% * b : Scale of the function.
1716
% * A : Quantifier or amplitude of the function.

src/pspm_bf_rarf_fc.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
% ● Arguments
88
% * td: The time the response function should have.
99
% * bf_type: Which type of response function should be generated. Can be either 1 or 2.
10-
% If 1, first type response function is generated, (default) = gamma_early + gamma_late.
11-
% If 2, second type response function is generated, (default) = gamma_early + gamma_early'.
10+
% If 1, first type response function is generated (default) : gamma_early + gamma_late.
11+
% If 2, second type response function is generated (recommended for longer SOAs): gamma_early + gamma_early'.
1212
% ● History
1313
% Introduced in PsPM 3.1
1414
% Written in 2016 by G Castegnetti, Tobias Moser (University of Zurich)

src/pspm_bf_spsrf_box.m

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
function [bs, x] = pspm_bf_spsrf_box(varargin)
22
% ● Description
33
% pspm_bf_spsrf_box constructs a boxcar function to produce the averaged
4-
% scanpath speed over a 2-s time window in the end of SOA, which equals
5-
% to scanpath length over a 2-s time window divided by 2/s
4+
% scanpath speed over a 2-s time window in the end of SOA. This equals
5+
% to scanpath length over a 2-s time window divided by 2.
66
% ● Format
77
% [bs, x] = pspm_bf_spsrf_box(td, soa)
88
% [bs, x] = pspm_bf_spsrf_box([td, soa])
99
% ● Arguments
1010
% * td : time resolution in second.
1111
% ● References
12-
% Xia Y, Melinscak F, Bach DR (2020)
13-
% Saccadic Scanpath Length: An Index for Human Threat Conditioning
14-
% Behavioral Research Methods 53, pages 1426–1439 (2021)
15-
% doi: 10.3758/s13428-020-01490-5
12+
% Xia Y, Melinščak F, Bach DR (2020). Saccadic scanpath length: an
13+
% index for human threat conditioning. Behavior Research Methods, 53,
14+
% 1426-1439.
1615
% ● History
1716
% Introduced in PsPM 4.0
1817

src/pspm_cfg/pspm_cfg_combine_markerchannels.m

+1-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
channel_action = pspm_cfg_selector_channel_action;
1313

1414
%% Specific items
15-
marker_chan.help = {['Choose any number of marker channel numbers ',...
16-
'to combine. If 0, all marker ',...
17-
'channels in the file are combined.']};
15+
marker_chan.help = pspm_cfg_help_format('pspm_combine_markerchannels', 'options.marker_chan_num');
1816

1917
%% Executable branch
2018
combine_markerchannels = cfg_exbranch;

src/pspm_cfg/pspm_cfg_data_preprocessing.m

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
cfg.name = 'Data Preprocessing';
1212
cfg.tag = 'data_preprocessing';
1313
cfg.values = {pspm_cfg_scr_pp,...
14-
pspm_cfg_pp_cardiac, ...
15-
pspm_cfg_resp_pp, ...
1614
pspm_cfg_pp_pupil, ...
17-
pspm_cfg_pp_emg};
15+
pspm_cfg_pp_cardiac, ...
16+
pspm_cfg_resp_pp, ...
17+
pspm_cfg_pp_emg, ...
18+
pspm_cfg_combine_markerchannels, ...
19+
pspm_cfg_pp_general};
1820
cfg.forcestruct = true;
1921
cfg.help = {'Help: Data preprocessing'};

src/pspm_cfg/pspm_cfg_dcm.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
timingfile.tag = 'timingfile';
1717
timingfile.num = [1 1];
1818
timingfile.filter = '.*\.(mat|MAT)$';
19-
timingfile.help = {'See general help for this item for more information on how to specify timings'};
19+
timingfile.help = {'See general DCM help for more information on how to specify timings'};
2020

2121

2222
name = cfg_entry;
@@ -44,7 +44,7 @@
4444
timing_man_rep.tag = 'timing_man_rep';
4545
timing_man_rep.values = {timing_man};
4646
timing_man_rep.num = [1 Inf];
47-
timing_man_rep.help = {'See general help for this item for more information on how to specify timings'};
47+
timing_man_rep.help = {'See general DCM help for more information on how to specify timings'};
4848

4949

5050
timing = cfg_choice;

0 commit comments

Comments
 (0)