Skip to content
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

GUI updates #800

Merged
merged 33 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
4cb12ce
correct PS-FC-GLM defaults in GUI, and make clearer in pspm_init
Nov 15, 2024
a382398
improve help text for SPS basis functions
Nov 15, 2024
2d79f8e
improve help text and GUI for find_valid_fixations and pupil_pp
Nov 15, 2024
a44f751
align hprf_fc defaults with GUI and publication
Nov 22, 2024
592bc4c
align rarf_fc help with GUI and publication
Nov 22, 2024
e426d4c
make import GUI and help textx consistent, and change start/quit message
Nov 23, 2024
f4f3490
fix dependencies in GUI
Nov 25, 2024
3584e30
Merge branch 'develop' into gui-updates
dominikbach Nov 25, 2024
54e395e
correct text in pspm_overwrite
Nov 29, 2024
2d61558
Merge branch 'develop' into gui-updates
dominikbach Nov 29, 2024
9c6365e
fix ylabel in pspm_display
Nov 30, 2024
19085c1
fix error handling in pspm_convert_gaze
Nov 30, 2024
70f2bd3
improve error handling in pspm_convert_gaze
Nov 30, 2024
fb3ba1d
fix cfg for find_valid_fixations (wrong option added)
Nov 30, 2024
3f208ef
improve display and fix cfg
Nov 30, 2024
6370c61
Merge branch 'develop' into gui-updates
dominikbach Dec 2, 2024
f91b04f
fix pupil size GUI and double overwrite question in pspm_glm
Dec 2, 2024
88b2964
improve pspm_extract_segments for DCM with trial names
Dec 3, 2024
08ff630
fix extract_segments
Dec 3, 2024
ac8d1ca
gui updates
Dec 3, 2024
62772c5
gui updates
Dec 3, 2024
93cbbb3
improve error handling in pspm_export
Dec 3, 2024
caaa63f
fix run_find_sounds
Dec 3, 2024
76597dc
updates and small fixes
Dec 5, 2024
446e14d
bugfixes, GUI changes, and improved helps
Dec 9, 2024
b1b5e8c
bufixes and improvements
Dec 9, 2024
93f44bf
update model review plots
Dec 10, 2024
a78397b
update HPRF_rew based on exps1-2 in Xia et al. 2024
Dec 10, 2024
8729a4c
remove outdated bf
Dec 11, 2024
5f01fe0
update heartpy reference in function help
Dec 14, 2024
aec7c03
unify missing epochs selector and fix overwrite settings in SF
Dec 23, 2024
d5aa2c3
Merge branch 'develop' into gui-updates
dominikbach Dec 23, 2024
9f01ebf
adapt variable names in test of find_valid_fixations
Jan 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions src/helper/PsPM_installer.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
% This is a convenience PsPM installer. As an alternative, download the
% lastest release from https://github.com/bachlab/PsPM, or clone the
% develop branch.
% Uzay Gökay & Dominik Bach, 2024

fprintf('Welcome to the PsPM installer.\n');
[indx,tf] = listdlg('ListString',{'Latest PsPM release', 'GLM tutorial dataset', 'DCM tutorial dataset'}, ...
'PromptString', 'Select items to install.');

if tf == 0
fprintf('PsPM installation aborted.\n');
return;
end

fprintf('Please select the parent directory for your PsPM installation.\n');
destinationFolder = uigetdir('','Select parent directory for your PsPM installation');

% -------------------------------------------------------------------------

if ismember(1, indx)

% GitHub release URL for PsPM and the desired version
githubReleaseURL = 'https://github.com/bachlab/PsPM/releases/download';
version = 'v6.1.2';
packageName = 'PsPM_v6.1.2';

% Create the destination folder if it does not exist
if ~exist(destinationFolder, 'dir')
mkdir(destinationFolder);
end

% Construct the full URL for the specified version and platform (assuming Windows)
matlabPackageURL = sprintf('%s/%s/%s.zip', githubReleaseURL, version, packageName);

% Download the PsPM package
disp(['Downloading PsPM version ' version '...']);
websave('temp_package.zip', matlabPackageURL);

% Unzip the contents to the destination folder
disp('Unzipping package...');
unzip('temp_package.zip', destinationFolder);

% Clean up: delete the temporary ZIP file
delete('temp_package.zip');

disp(['PsPM package ' version ' download and unzip completed.']);

%%%%%%%%%%%%%%%%%% add path %%%%%%%%%%%%%%%%%%%%%%%%%%
% Add the unzipped PsPM files to the MATLAB search path
addpath(fullfile(destinationFolder, packageName));

disp('PsPM added to MATLAB search path.');
end


%%%%%%%%%%% GLM dataset %%%%%%%%%%%%%%
if ismember(2, indx)
% URL for the PsPM GLM tutorial dataset
glmTutorialDatasetURL = 'https://github.com/bachlab/PsPM-tutorial-datasets/releases/download/tutorial-datasets/Tutorial_dataset_GLM.zip';
glmTutorialDatasetName = 'Tutorial_dataset_GLM';

% Destination folder for the tutorial dataset
tutorialDestinationFolder = fullfile(destinationFolder, glmTutorialDatasetName);

% Create the destination folder if it does not exist
if ~exist(tutorialDestinationFolder, 'dir')
mkdir(tutorialDestinationFolder);
end

% Download the PsPM tutorial dataset
disp('Downloading GLM tutorial dataset...');
websave('temp_tutorial_dataset.zip', glmTutorialDatasetURL);

% Unzip the tutorial dataset to the destination folder
disp('Unzipping GLM tutorial dataset...');
unzip('temp_tutorial_dataset.zip', tutorialDestinationFolder);

% Clean up: delete the temporary ZIP file
delete('temp_tutorial_dataset.zip');

disp('GLM tutorial dataset download and unzip completed.');
end

%%%%%%%%%%%%%%% DCM Dataset %%%%%%%%%%%%%%%
if ismember(3, indx)
% URL for the PsPM DCM tutorial dataset
dcmTutorialDatasetURL = 'https://github.com/bachlab/PsPM-tutorial-datasets/releases/download/tutorial-datasets/Tutorial_dataset_DCM.zip';
dcmTutorialDatasetName = 'Tutorial_dataset_DCM';

% Destination folder for the DCM tutorial dataset
dcmTutorialDestinationFolder = fullfile(destinationFolder, dcmTutorialDatasetName);

% Create the destination folder if it does not exist
if ~exist(dcmTutorialDestinationFolder, 'dir')
mkdir(dcmTutorialDestinationFolder);
end

% Download the PsPM DCM tutorial dataset
disp('Downloading DCM tutorial dataset...');
websave('temp_dcm_tutorial_dataset.zip', dcmTutorialDatasetURL);

% Unzip the DCM tutorial dataset to the destination folder
disp('Unzipping DCM tutorial dataset...');
unzip('temp_dcm_tutorial_dataset.zip', dcmTutorialDestinationFolder);

% Clean up: delete the temporary ZIP file
delete('temp_dcm_tutorial_dataset.zip');

disp('DCM tutorial dataset download and unzip completed.');

end

41 changes: 0 additions & 41 deletions src/pspm_bf_hprf_f.m

This file was deleted.

6 changes: 3 additions & 3 deletions src/pspm_bf_hprf_fc.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
% [bs, x] = pspm_bf_hprf_fc([TD, D, soa])
% ● Arguments
% * td : time resolution in second.
% * d : number of derivatives. Default as 0.
% * d : number of derivatives. Default is 1.
% ● History
% Introduced in PsPM 3.0
% Written in 2015 by Tobias Moser (University of Zurich)
Expand All @@ -21,7 +21,7 @@
end
td = varargin{1}(1);
if numel(varargin{1}) == 1 && nargin == 1
d = 0;
d = 1;
soa = 3.5;
else
if numel(varargin) > 1
Expand All @@ -32,7 +32,7 @@
if numel(va) > 1
d = va(2);
else
d = 0;
d = 1;
end
if numel(va) > 2
soa = va(3);
Expand Down
12 changes: 9 additions & 3 deletions src/pspm_bf_hprf_rew.m
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
function [bs, x] = pspm_bf_hprf_rew(td)
% ● Description
% This function implements a canonical gamma response function for
% reward-conditioned heart period responses.
% reward-conditioned heart period responses, based on exps 1-2 in Xia*,
% Liu*, et al. (2024).
% ● Format
% [bs, x] = pspm_bf_hprf_fc(TD)
% ● Arguments
% * td : time resolution in second.
% ● References:
% GLM for reward-conditioned bradycardia:
% Xia Y, Liu H, Kälin OK, Gerster S, Bach DR (under review). Measuring
% Xia Y, Liu H, Kälin OK, Gerster S, Bach DR (2024). Measuring
% human Pavlovian appetitive conditioning and memory retention.
% Pre-print.
% ● History
% Introduced in PsPM 7.0
% Written in 2021 by Oliver Keats Kälin and Yanfang Xia (University of Zurich)
Expand All @@ -28,7 +30,8 @@
% default values
duration = 30;
% k, theta, c, t0
p_cs = [1.716239999852250e+02,0.140004209328788,60.095121886556230,-17.607312178043863];
% p_cs = [1.716239999852250e+02,0.140004209328788,60.095121886556230,-17.607312178043863]; % generated from REW1 data
p_cs = [73.9977984802746, 0.210014413426350, 71.1984486930105, -9.19655727625912]; % generated from the combined data set of REW1 and REW2

x = (0:td:duration-td)';
bs = zeros(numel(x), 1);
Expand All @@ -51,3 +54,6 @@
elseif t0 < 0
bs(1:sto, 1) = g_cs(sta:end);
end

% normalise
bs = bs/max(bs);
4 changes: 2 additions & 2 deletions src/pspm_bf_rarf_fc.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
% ● Arguments
% * td: The time the response function should have.
% * bf_type: Which type of response function should be generated. Can be either 1 or 2.
% If 1, first type response function is generated, (default) = gamma_early + gamma_late.
% If 2, second type response function is generated, (default) = gamma_early + gamma_early'.
% If 1, first type response function is generated (default) : gamma_early + gamma_late.
% If 2, second type response function is generated (recommended for longer SOAs): gamma_early + gamma_early'.
% ● History
% Introduced in PsPM 3.1
% Written in 2016 by G Castegnetti, Tobias Moser (University of Zurich)
Expand Down
11 changes: 5 additions & 6 deletions src/pspm_bf_spsrf_box.m
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
function [bs, x] = pspm_bf_spsrf_box(varargin)
% ● Description
% pspm_bf_spsrf_box constructs a boxcar function to produce the averaged
% scanpath speed over a 2-s time window in the end of SOA, which equals
% to scanpath length over a 2-s time window divided by 2/s
% scanpath speed over a 2-s time window in the end of SOA. This equals
% to scanpath length over a 2-s time window divided by 2.
% ● Format
% [bs, x] = pspm_bf_spsrf_box(td, soa)
% [bs, x] = pspm_bf_spsrf_box([td, soa])
% ● Arguments
% * td : time resolution in second.
% ● References
% Xia Y, Melinscak F, Bach DR (2020)
% Saccadic Scanpath Length: An Index for Human Threat Conditioning
% Behavioral Research Methods 53, pages 1426–1439 (2021)
% doi: 10.3758/s13428-020-01490-5
% Xia Y, Melinščak F, Bach DR (2020). Saccadic scanpath length: an
% index for human threat conditioning. Behavior Research Methods, 53,
% 1426-1439.
% ● History
% Introduced in PsPM 4.0

Expand Down
4 changes: 1 addition & 3 deletions src/pspm_cfg/pspm_cfg_combine_markerchannels.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
channel_action = pspm_cfg_selector_channel_action;

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

%% Executable branch
combine_markerchannels = cfg_exbranch;
Expand Down
8 changes: 5 additions & 3 deletions src/pspm_cfg/pspm_cfg_data_preprocessing.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
cfg.name = 'Data Preprocessing';
cfg.tag = 'data_preprocessing';
cfg.values = {pspm_cfg_scr_pp,...
pspm_cfg_pp_cardiac, ...
pspm_cfg_resp_pp, ...
pspm_cfg_pp_pupil, ...
pspm_cfg_pp_emg};
pspm_cfg_pp_cardiac, ...
pspm_cfg_resp_pp, ...
pspm_cfg_pp_emg, ...
pspm_cfg_combine_markerchannels, ...
pspm_cfg_pp_general};
cfg.forcestruct = true;
cfg.help = {'Help: Data preprocessing'};
4 changes: 2 additions & 2 deletions src/pspm_cfg/pspm_cfg_dcm.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
timingfile.tag = 'timingfile';
timingfile.num = [1 1];
timingfile.filter = '.*\.(mat|MAT)$';
timingfile.help = {'See general help for this item for more information on how to specify timings'};
timingfile.help = {'See general DCM help for more information on how to specify timings'};


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


timing = cfg_choice;
Expand Down
34 changes: 17 additions & 17 deletions src/pspm_cfg/pspm_cfg_find_valid_fixations.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
ChanAct = pspm_cfg_selector_channel_action;

%% Visual angle
box_degree = cfg_entry;
box_degree.name = 'Visual angle';
box_degree.tag = 'box_degree';
box_degree.strtype = 'i';
box_degree.num = [1 1];
box_degree.help = pspm_cfg_help_format('pspm_find_valid_fixations', 'circle_degree');
circle_degree = cfg_entry;
circle_degree.name = 'Visual angle';
circle_degree.tag = 'circle_degree';
circle_degree.strtype = 'i';
circle_degree.num = [1 1];
circle_degree.help = pspm_cfg_help_format('pspm_find_valid_fixations', 'circle_degree');

%% Distance
distance = cfg_entry;
Expand All @@ -41,7 +41,7 @@
Resol.tag = 'resolution';
Resol.strtype = 'i';
Resol.num = [1 2];
Resol.val = {[1280 1024]};
Resol.val = {[1 1]};
Resol.help = pspm_cfg_help_format('pspm_find_valid_fixations', 'options.resolution');
%% Fixation point default
FixPtDefault = cfg_const;
Expand All @@ -55,18 +55,16 @@
FixPtFile.name = 'File';
FixPtFile.tag = 'fixpoint_file';
FixPtFile.num = [1 1];
FixPtFile.help = {['.mat file containing a variable F with an ', ...
'n x 2 matrix. N should have the length of ', ...
'the recorded data and each row should ', ...
'define the fixation point for the ', ...
'respective recorded data row.']};
temphelp = pspm_cfg_help_format('pspm_find_valid_fixations', 'options.fixation_point');
FixPtFile.help = {['Specify a .mat file containing a variable ''F'': ', ...
temphelp{1}]};
%% Fixation point value
FixPtVal = cfg_entry;
FixPtVal.name = 'Point';
FixPtVal.tag = 'fixpoint';
FixPtVal.strtype = 'r';
FixPtVal.num = [1 2];
FixPtVal.help = {['x/y coordinates of constant fixation point.']};
FixPtVal.help = {'x/y coordinates of constant fixation point.'};

%% Fixation point
FixPt = cfg_choice;
Expand All @@ -79,15 +77,17 @@
ValidSet = cfg_branch;
ValidSet.name = 'Fixation point';
ValidSet.tag = 'validation_settings';
ValidSet.val = {box_degree, distance, unit, Resol, FixPt};
ValidSet.val = {circle_degree, distance, unit, Resol, FixPt};
dominikbach marked this conversation as resolved.
Show resolved Hide resolved
ValidSet.help = {};

%% Validate on bitmap
bitmap = cfg_files;
bitmap.name = 'Bitmap file';
bitmap.tag = 'bitmap_file';
bitmap.num = [1 1];
bitmap.help = pspm_cfg_help_format('pspm_find_valid_fixations', 'bitmap');
temphelp = pspm_cfg_help_format('pspm_find_valid_fixations', 'bitmap');
bitmap.help = {['Specify a .mat file containing a variable ''bitmap'': ', ...
temphelp{1}]};
dominikbach marked this conversation as resolved.
Show resolved Hide resolved
%% Validation method
val_method = cfg_choice;
val_method.name = 'Validation method';
Expand All @@ -96,8 +96,8 @@
val_method.help = {};
%% Missing
missing = cfg_menu;
missing.name = 'Add channel with information invalid data points';
missing.tag = 'missing';
missing.name = 'Add channel with information on invalid data points';
missing.tag = 'add_invalid';
missing.labels = {'Yes', 'No'};
missing.values = {1, 0};
missing.val = {0};
Expand Down
5 changes: 3 additions & 2 deletions src/pspm_cfg/pspm_cfg_first_level.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
cfg = cfg_repeat;
cfg.name = 'First Level';
cfg.tag = 'first_level';
cfg.values = {pspm_cfg_first_level_scr, pspm_cfg_first_level_hp, ...
pspm_cfg_first_level_resp, ...
cfg.values = {pspm_cfg_first_level_scr, ...
pspm_cfg_first_level_ps, ...
pspm_cfg_first_level_sebr, ...
pspm_cfg_first_level_hp, ...
pspm_cfg_first_level_resp, ...
pspm_cfg_first_level_sps, ...
pspm_cfg_review1, ...
pspm_cfg_export}; % Values in a cfg_repeat can be any cfg_item objects
Expand Down
Loading