-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathebThreshold.m
42 lines (32 loc) · 1.26 KB
/
ebThreshold.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
function eegDataBlob = ebThreshold(eegDataBlob, upperLimit, lowerLimit)
% eegDataBlob = ebThreshold(eegDataBlob, upperLimit, lowerLimit)
%
% Takes an eegDataBlob as input and thresholds the extremes of the
% amplitudes. Returns a blob with the revised data IN PLACE. The defaults
% are +/- 200 as described (sort of) in Ahani et al (2014).
%
% MDT
% 2016.03.06
% Version 0.0.1
% Setup any blanked variables
if nargin < 3
lowerLimit = -200;
end
if nargin < 2
upperLimit = 200;
end
% Add the limits to the eegDataBlob so we remember what we used!
eegDataBlob.lowerVoltThreshold = lowerLimit;
eegDataBlob.upperVoltThreshold = upperLimit;
% Do it!
eegDataBlob.data(eegDataBlob.data > upperLimit) = upperLimit;
eegDataBlob.data(eegDataBlob.data < lowerLimit) = lowerLimit;
end
% NB: In Ahani et al., the thresholds are at 200 and 2 microvolts, but
% their data appears to be referenced differently, our data is centered at
% zero microvolts, so we use the upper cutoff.
%
% Ahani, A., Wahbeh, H., Nezamfar, H., Miller, M., Erdogmus, D., & Oken, B.
% (2014). Quantitative change of EEG and respiration signals during
% mindfulness meditation. Journal of neuroengineering and rehabilitation,
% 11(1), 1.