TEAP (Toolbox for Emotion Analysis using Physiological Signals) doc
extracting_features_MAHNOB.m
Go to the documentation of this file.
1 %we assume the pre-processed physilogical signals in mat file from DEAP data is being used
2 %this script loads the MAHNOB data and converts it to the EEGLAB format that
3 %is readable by TEAP
4 %I assume the data is in MAHNOB_path
5 %I added minimally required fields to the structure
6 %Mohammad Soleymani June 2015 mohammad.soleymani@unige.ch
7 %Takes the path physio_files_path and writes the mat files in eeglab format
8 %acceptable by TEAP
9 %for ECG we take the ECG2-ECG3 as the lead
10 clc
11 clear
12 close all
13 %replace thee following line by the location where you saved the mat files
14 MAHNOB_path = 'MAHNOB-HCI/teapformat/';
15 cntr = 0;
16 files_physio = dir([MAHNOB_path '*_eeglab.mat']);
17 %there is only one epoch
18 epoch = 1;
19 for i = 1:length(files_physio)
20  fprintf('loading file %s\n',files_physio(i).name);
21  s = strsplit(files_physio(i).name ,'_');
22  subj_id = str2double(s{1}(2:3));
23  trial_id = str2double(s{2}(2:3));
24  eeglab_file = sprintf('%s%s',MAHNOB_path,files_physio(i).name);
25  %loading the file
26  bulk = Bulk_load(eeglab_file);
27  %loading feedbacks
28  feedback_file = strrep(eeglab_file, 'eeglab', 'feedback');
29  load(feedback_file);
30  features(subj_id,trial_id).feedback = feedback;
31  %extracting ECG features
32  [features(subj_id,trial_id).ECG_feats, features(subj_id,trial_id).ECG_feats_names] = ...
33  ECG_feat_extr(bulk(epoch));
34  %extracting EEG features
35  %average re-referencing
36  EEGSignal = EEG_reference_mean(bulk(epoch));
37  [features(subj_id,trial_id).EEG_feats, features(subj_id,trial_id).EEG_feats_names] = ...
38  EEG_feat_extr(EEGSignal);
39  %extracting GSR features
40  [features(subj_id,trial_id).GSR_feats, features(subj_id,trial_id).GSR_feats_names] = ...
41  GSR_feat_extr(bulk(epoch));
42  %extracting skin temperature features
43  [features(subj_id,trial_id).HST_feats, features(subj_id,trial_id).HST_feats_names] = ...
44  HST_feat_extr(bulk(epoch));
45  %extracting respiration features
46  [features(subj_id,trial_id).RES_feats, features(subj_id,trial_id).RES_feats_names] = ...
47  RES_feat_extr(bulk(epoch));
48  fprintf('extracted all the features for subject %d trial %d\n',subj_id, trial_id);
49 
50 end
51 %correct the following path to where you want your features to be saved
52 save('mahnob_features.mat','features');
53 
54 
55 fprintf('Done! Successfully extracted the feaures\n');
RES_feat_extr
function RES_feat_extr(in RESsignal, in varargin)
HST_feat_extr
function HST_feat_extr(in HSTsignal, in varargin)
Bulk_load
function Bulk_load(in file_name)
EEG_reference_mean
function EEG_reference_mean(in EEGSignal)
GSR_feat_extr
function GSR_feat_extr(in GSRsignal, in varargin)
str2double
function str2double(in s, in cdelim, in rdelim, in ddelim)
EEG_feat_extr
function EEG_feat_extr(in EEGsignal, in varargin)
ECG_feat_extr
function ECG_feat_extr(in ECGSignal, in varargin)