paradigma 0.3.2__py3-none-any.whl → 0.4.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. paradigma/assets/gait_detection_clf_package.pkl +0 -0
  2. paradigma/assets/gait_filtering_clf_package.pkl +0 -0
  3. paradigma/assets/ppg_quality_clf_package.pkl +0 -0
  4. paradigma/assets/tremor_detection_clf_package.pkl +0 -0
  5. paradigma/classification.py +115 -0
  6. paradigma/config.py +314 -0
  7. paradigma/constants.py +48 -7
  8. paradigma/feature_extraction.py +811 -547
  9. paradigma/pipelines/__init__.py +0 -0
  10. paradigma/pipelines/gait_pipeline.py +727 -0
  11. paradigma/pipelines/heart_rate_pipeline.py +426 -0
  12. paradigma/pipelines/heart_rate_utils.py +780 -0
  13. paradigma/pipelines/tremor_pipeline.py +299 -0
  14. paradigma/preprocessing.py +363 -0
  15. paradigma/segmenting.py +396 -0
  16. paradigma/testing.py +416 -0
  17. paradigma/util.py +393 -16
  18. paradigma-0.4.1.dist-info/METADATA +138 -0
  19. paradigma-0.4.1.dist-info/RECORD +22 -0
  20. {paradigma-0.3.2.dist-info → paradigma-0.4.1.dist-info}/WHEEL +1 -1
  21. paradigma/gait_analysis.py +0 -415
  22. paradigma/gait_analysis_config.py +0 -266
  23. paradigma/heart_rate_analysis.py +0 -127
  24. paradigma/heart_rate_analysis_config.py +0 -9
  25. paradigma/heart_rate_util.py +0 -173
  26. paradigma/imu_preprocessing.py +0 -232
  27. paradigma/ppg/classifier/LR_PPG_quality.pkl +0 -0
  28. paradigma/ppg/classifier/LR_model.mat +0 -0
  29. paradigma/ppg/feat_extraction/acc_feature.m +0 -20
  30. paradigma/ppg/feat_extraction/peakdet.m +0 -64
  31. paradigma/ppg/feat_extraction/ppg_features.m +0 -53
  32. paradigma/ppg/glob_functions/extract_hr_segments.m +0 -37
  33. paradigma/ppg/glob_functions/extract_overlapping_segments.m +0 -23
  34. paradigma/ppg/glob_functions/jsonlab/AUTHORS.txt +0 -41
  35. paradigma/ppg/glob_functions/jsonlab/ChangeLog.txt +0 -74
  36. paradigma/ppg/glob_functions/jsonlab/LICENSE_BSD.txt +0 -25
  37. paradigma/ppg/glob_functions/jsonlab/LICENSE_GPLv3.txt +0 -699
  38. paradigma/ppg/glob_functions/jsonlab/README.txt +0 -394
  39. paradigma/ppg/glob_functions/jsonlab/examples/.svn/entries +0 -368
  40. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/demo_jsonlab_basic.m.svn-base +0 -180
  41. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/demo_ubjson_basic.m.svn-base +0 -180
  42. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example1.json.svn-base +0 -23
  43. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example2.json.svn-base +0 -22
  44. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example3.json.svn-base +0 -11
  45. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example4.json.svn-base +0 -34
  46. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_basictest.matlab.svn-base +0 -662
  47. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_selftest.m.svn-base +0 -27
  48. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_selftest.matlab.svn-base +0 -144
  49. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_speedtest.m.svn-base +0 -21
  50. paradigma/ppg/glob_functions/jsonlab/examples/demo_jsonlab_basic.m +0 -180
  51. paradigma/ppg/glob_functions/jsonlab/examples/demo_ubjson_basic.m +0 -180
  52. paradigma/ppg/glob_functions/jsonlab/examples/example1.json +0 -23
  53. paradigma/ppg/glob_functions/jsonlab/examples/example2.json +0 -22
  54. paradigma/ppg/glob_functions/jsonlab/examples/example3.json +0 -11
  55. paradigma/ppg/glob_functions/jsonlab/examples/example4.json +0 -34
  56. paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_basictest.matlab +0 -662
  57. paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_selftest.m +0 -27
  58. paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_selftest.matlab +0 -144
  59. paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_speedtest.m +0 -21
  60. paradigma/ppg/glob_functions/jsonlab/jsonopt.m +0 -32
  61. paradigma/ppg/glob_functions/jsonlab/loadjson.m +0 -566
  62. paradigma/ppg/glob_functions/jsonlab/loadubjson.m +0 -528
  63. paradigma/ppg/glob_functions/jsonlab/mergestruct.m +0 -33
  64. paradigma/ppg/glob_functions/jsonlab/savejson.m +0 -475
  65. paradigma/ppg/glob_functions/jsonlab/saveubjson.m +0 -504
  66. paradigma/ppg/glob_functions/jsonlab/varargin2struct.m +0 -40
  67. paradigma/ppg/glob_functions/sample_prob_final.m +0 -49
  68. paradigma/ppg/glob_functions/synchronization.m +0 -76
  69. paradigma/ppg/glob_functions/tsdf_scan_meta.m +0 -22
  70. paradigma/ppg/hr_functions/Long_TFD_JOT.m +0 -37
  71. paradigma/ppg/hr_functions/PPG_TFD_HR.m +0 -59
  72. paradigma/ppg/hr_functions/TFD toolbox JOT/.gitignore +0 -4
  73. paradigma/ppg/hr_functions/TFD toolbox JOT/CHANGELOG.md +0 -23
  74. paradigma/ppg/hr_functions/TFD toolbox JOT/LICENCE.md +0 -27
  75. paradigma/ppg/hr_functions/TFD toolbox JOT/README.md +0 -251
  76. paradigma/ppg/hr_functions/TFD toolbox JOT/README.pdf +0 -0
  77. paradigma/ppg/hr_functions/TFD toolbox JOT/common/gen_Doppler_kern.m +0 -142
  78. paradigma/ppg/hr_functions/TFD toolbox JOT/common/gen_Doppler_lag_kern.m +0 -314
  79. paradigma/ppg/hr_functions/TFD toolbox JOT/common/gen_lag_kern.m +0 -123
  80. paradigma/ppg/hr_functions/TFD toolbox JOT/dec_tfd.m +0 -154
  81. paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_di_gdtfd.m +0 -194
  82. paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_li_gdtfd.m +0 -200
  83. paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_nonsep_gdtfd.m +0 -229
  84. paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_sep_gdtfd.m +0 -241
  85. paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/di_gdtfd.m +0 -157
  86. paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/li_gdtfd.m +0 -190
  87. paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/nonsep_gdtfd.m +0 -196
  88. paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/sep_gdtfd.m +0 -199
  89. paradigma/ppg/hr_functions/TFD toolbox JOT/full_tfd.m +0 -144
  90. paradigma/ppg/hr_functions/TFD toolbox JOT/load_curdir.m +0 -13
  91. paradigma/ppg/hr_functions/TFD toolbox JOT/pics/decimated_TFDs_examples.png +0 -0
  92. paradigma/ppg/hr_functions/TFD toolbox JOT/pics/full_TFDs_examples.png +0 -0
  93. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/check_dec_params_seq.m +0 -79
  94. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/dispEE.m +0 -9
  95. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/dispVars.m +0 -26
  96. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/disp_bytes.m +0 -25
  97. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/fold_vector_full.m +0 -40
  98. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/fold_vector_half.m +0 -34
  99. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/gen_LFM.m +0 -29
  100. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/get_analytic_signal.m +0 -76
  101. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/get_window.m +0 -176
  102. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/isreal_fn.m +0 -11
  103. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/padWin.m +0 -97
  104. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/vtfd.m +0 -149
  105. paradigma/ppg/preprocessing/preprocessing_imu.m +0 -15
  106. paradigma/ppg/preprocessing/preprocessing_ppg.m +0 -13
  107. paradigma/ppg_preprocessing.py +0 -313
  108. paradigma/preprocessing_config.py +0 -69
  109. paradigma/quantification.py +0 -58
  110. paradigma/tremor/TremorFeaturesAndClassification.m +0 -345
  111. paradigma/tremor/feat_extraction/DerivativesExtract.m +0 -22
  112. paradigma/tremor/feat_extraction/ExtractBandSignalsRMS.m +0 -72
  113. paradigma/tremor/feat_extraction/MFCCExtract.m +0 -100
  114. paradigma/tremor/feat_extraction/PSDBandPower.m +0 -52
  115. paradigma/tremor/feat_extraction/PSDEst.m +0 -63
  116. paradigma/tremor/feat_extraction/PSDExtrAxis.m +0 -88
  117. paradigma/tremor/feat_extraction/PSDExtrOpt.m +0 -95
  118. paradigma/tremor/preprocessing/InterpData.m +0 -32
  119. paradigma/tremor/weekly_aggregates/WeeklyAggregates.m +0 -295
  120. paradigma/windowing.py +0 -219
  121. paradigma-0.3.2.dist-info/METADATA +0 -79
  122. paradigma-0.3.2.dist-info/RECORD +0 -108
  123. {paradigma-0.3.2.dist-info → paradigma-0.4.1.dist-info}/LICENSE +0 -0
@@ -1,40 +0,0 @@
1
- %-------------------------------------------------------------------------------
2
- % fold_vector_full: fold the vector for frequency decimation:
3
- %
4
- % y[n] = y[n] + sum_{p=0}^{a-l} x[pJ+n]
5
- %
6
- % for n=0,1,...,J-1
7
- %
8
- % which returns DFT{y[n]} = Y[ak]
9
- %
10
- % Syntax: y=fold_vector_full(x,J,a)
11
- %
12
- % Inputs:
13
- % x,J,a -
14
- %
15
- % Outputs:
16
- % y -
17
- %
18
- % Example:
19
- %
20
- %
21
-
22
- % John M. O' Toole, University College Cork
23
- % Started: 23-04-2014
24
- %
25
- % last update: Time-stamp: <2014-04-23 17:11:54 (otoolej)>
26
- %-------------------------------------------------------------------------------
27
- function y=fold_vector_full(x,J,a)
28
- % Assume that all parameters (J,a) are sane.
29
-
30
- y=zeros(J,1);
31
- x=x(:);
32
-
33
- n=0:J-1;
34
- y(n+1)=x(n+1);
35
- for p=1:a-1
36
- y(n+1)=y(n+1)+x(p*J+n+1);
37
- end
38
-
39
- % scale by decimation factor:
40
- y=y./a;
@@ -1,34 +0,0 @@
1
- %-------------------------------------------------------------------------------
2
- % fold_vector_half: Fold vector
3
- %
4
- % y[n] = y[n] + sum_{p=0}^{a-l} x[pJ+n]
5
- %
6
- % for n=0,1,...,Jh
7
- %
8
- % Syntax: y=fold_vector_half(x,J,Jh,a)
9
- %
10
- % Inputs:
11
- % x,J,Jh,a -
12
- %
13
- % Outputs:
14
- % y -
15
- %
16
- % Example:
17
- %
18
- %
19
-
20
- % John M. O' Toole, University College Cork
21
- % Started: 23-04-2014
22
- %
23
- % last update: Time-stamp: <2014-04-23 14:05:04 (otoolej)>
24
- %-------------------------------------------------------------------------------
25
- function y=fold_vector_half(x,J,Jh,a)
26
- % Assume that all parameters (J,Jh,a) are sane.
27
-
28
- y=zeros(Jh+1,1);
29
- x=x(:);
30
-
31
- n=0:(Jh);
32
- for p=0:a-1
33
- y(n+1)=y(n+1)+x(p*J+n+1);
34
- end
@@ -1,29 +0,0 @@
1
- %-------------------------------------------------------------------------------
2
- % Generate a linear frequency modulated (LFM) signal
3
- %
4
- % USE: sig=gen_LFM(N,fstart,fstop,phase)
5
- %
6
- % INPUT:
7
- % N = length of LFM signal
8
- % fstart = starting frequency
9
- % fend = ending frequency
10
- % phase = (optional) phase offset
11
- %
12
- % OUTPUT:
13
- % sig = LFM signal of length-N
14
- %
15
- % EXAMPLE:
16
- % N=256; fstart=0.1; fend=0.4;
17
- % x=gen_LFM(N,fstart,fend);
18
- % plot(x);
19
- %-------------------------------------------------------------------------------
20
- function sig=gen_LFM(N,fstart,fstop,phase)
21
- if(nargin<1 || isempty(N)) N=128; end
22
- if(nargin<2 || isempty(fstart)) fstart=0.1; end
23
- if(nargin<3 || isempty(fstop)) fstop=0.4; end
24
- if(nargin<4 || isempty(phase)) phase=0; end
25
-
26
-
27
-
28
- n=0:N-1;
29
- sig=cos( 2*pi.*(fstart.*n + ((fstop-fstart)/(2*N)).*(n.^2)) + phase );
@@ -1,76 +0,0 @@
1
- %-------------------------------------------------------------------------------
2
- % get_analytic_signal: analytic signal as per [1]
3
- %
4
- % Syntax: [z,N2,N,Nh]=get_analytic_signal(z)
5
- %
6
- % INPUT:
7
- % s = real-valued signal
8
- %
9
- % OUTPUT:
10
- % z = complex-valued analytic signal
11
- %
12
- % EXAMPLE:
13
- % N=64; f=0.1; N2=2*N;
14
- % s=cos( 2*pi*f.*(0:N-1));
15
- % z=get_analytic_signal(s);
16
- % plot(1:N2,real(z),1:N2,imag(z));
17
- % legend('real','imaginary');
18
- %
19
- %
20
- % [1] J. M. O' Toole, M. Mesbah, and B. Boashash, "A New Discrete Analytic Signal for
21
- % Reducing Aliasing in the Discrete Wigner-Ville Distribution", IEEE Trans. on Signal
22
- % Processing, vol. 56, no. 11, pp. 5427-5434, Nov. 2008.
23
-
24
-
25
- % John M. O' Toole, University College Cork
26
- % Started: 14-04-2014
27
- %
28
- % last update: Time-stamp: <2016-08-11 17:18:41 (otoolej)>
29
- %-------------------------------------------------------------------------------
30
- function [z,N2,N,Nh]=get_analytic_signal(z)
31
- if(rem(length(z),2))
32
- warn_str=sprintf(['odd-length signal.\nCurrently, code works for even-length signal ' ...
33
- 'only.\n\nRemoving last sample of the signal to force to ' ...
34
- 'even-length.\n']);
35
- warning(warn_str);
36
- z=z(1:(end-1));
37
- end
38
-
39
-
40
- if(isreal(z))
41
- z=gen_analytic(z);
42
- else
43
- warn_str=sprintf(['using complex-valued signal; assuming this is an analytic signal ' ...
44
- 'zero-padded to length-2N?\n\n If unsure, input the real part ' ...
45
- 'of signal only, i.e. real(x)\n'] );
46
- warning(warn_str);
47
- end
48
- N2=length(z); N=N2/2; Nh=ceil(N/2);
49
-
50
- if(N~=fix(N))
51
- error('Analytic signal must be length 2N.');
52
- end
53
-
54
-
55
-
56
- function z=gen_analytic(s1)
57
- %---------------------------------------------------------------------
58
- % generate the analytic signal (with zero-padding in the time-direction)
59
- %---------------------------------------------------------------------
60
- s1=real(s1);
61
- N=length(s1); N2=2*N;
62
-
63
- % 1. zero-pad N-point signal to 2N
64
- s1=[s1(:); zeros(N,1)];
65
- S1=fft(s1);
66
-
67
- % 2. Get analytic signal of 2N-point signal
68
- H=zeros(N2,1);
69
- H([1 N+1])=1;
70
- H(2:N)=2;
71
- z_cb=ifft(S1.*H);
72
-
73
-
74
- % 3. Force the second half of the time-domain signal to zero.
75
- z=[z_cb(1:N); zeros(N,1)];
76
-
@@ -1,176 +0,0 @@
1
- %--------------------------------------------------------------------------------
2
- % General function to calculate a window function (mostly a wrapper for the existing
3
- % window functions).
4
- %
5
- % USE: win = get_window( win_length, win_type, [win_param], [DFT_WINDOW], [Npad] )
6
- %
7
- % INPUT:
8
- % win_length = length of window
9
- % win_type = type of window: { 'delta' | 'rect' | 'bart' | 'hamm'
10
- % | 'hann' | 'tukey' | 'gauss' | 'cosh' | 'blackmanharris' }
11
- % win_param = (optional) window parameter.
12
- % DFT_WINDOW = (optional) parameter { 0 | 1 }.
13
- % If 1 returns DFT of window.
14
- % Npad = (optional) zero-pad window to length Npad.
15
- %
16
- % OUTPUT:
17
- % win = window
18
- %
19
- % See also: BARTLETT, HANNING, HAMMING, GAUSSWIN, TUKEYWIN, CIRCSHIFT, FFT
20
- %
21
- % EXAMPLE
22
- % N=64;
23
- % win=get_window(N,'tukey',0.4,0,2*N);
24
- % plot(win);
25
-
26
-
27
- % Copyright (C) 2007,2008 John M. O' Toole, The University of Queensland
28
- %
29
- % This program is free software: you can redistribute it and/or modify
30
- % it under the terms of the GNU General Public License as published by
31
- % the Free Software Foundation, either version 3 of the License, or
32
- % (at your option) any later version.
33
- %
34
- % This program is distributed in the hope that it will be useful,
35
- % but WITHOUT ANY WARRANTY; without even the implied warranty of
36
- % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
37
- % GNU General Public License for more details.
38
- %
39
- % You should have received a copy of the GNU General Public License
40
- % along with this program. If not, see <http://www.gnu.org/licenses/>.
41
- %--------------------------------------------------------------------------------
42
- function win = get_window( win_length, win_type, win_param, DFT_WINDOW, Npad )
43
- if( nargin<3 ) win_param=[]; end
44
- if( nargin<4 ) DFT_WINDOW=0; end
45
- if( nargin<5 ) Npad=0; end
46
-
47
-
48
- win=get_win(win_length,win_type,win_param,DFT_WINDOW);
49
- win=shift_win(win);
50
-
51
- if(Npad>0)
52
- win=pad_win(win,Npad);
53
- end
54
-
55
-
56
-
57
- function win=get_win(win_length, win_type, win_param, DFT_WINDOW )
58
- %--------------------------------------------------------------------------------
59
- % Get the window. Negative indices are first.
60
- %--------------------------------------------------------------------------------
61
-
62
- switch win_type
63
- case 'delta'
64
- win=zeros(win_length,1);
65
- wh = floor(win_length/2);
66
- win(wh+1)=1;
67
- case 'rect'
68
- win(1:win_length) = 1;
69
- case {'bart', 'bartlett'}
70
- win = bartlett( win_length );
71
- case {'hamm', 'hamming'}
72
- win = hamming( win_length );
73
- case {'hann', 'hanning'}
74
- win = hanning( win_length );
75
- case 'tukey'
76
- % NOTE: seems to be problem with Octave's (v2.9.12) tukeywin.m for N odd.
77
- if(isempty(win_param))
78
- win = tukeywin( win_length );
79
- else
80
- win = tukeywin( win_length, win_param );
81
- end
82
- case 'gauss'
83
- if(isempty(win_param))
84
- win = gausswin( win_length );
85
- else
86
- win = gausswin( win_length, win_param );
87
- end
88
- case 'cosh'
89
- win_hlf = fix( win_length / 2);
90
-
91
- if(isempty(win_param))
92
- win_param = 0.01;
93
- end
94
- for m = -win_hlf:win_hlf
95
- win(mod(m,win_length)+1) = cosh( m ).^( -2 * win_param );
96
- end
97
- win = fftshift(win);
98
- case {'blackmanharris', 'bmh'}
99
- win = blackmanharris(win_length, 'symmetric');
100
- case {'nuttall'}
101
- win = nuttallwin(win_length, 'symmetric');
102
- case {'dolph', 'chebwin'}
103
- win = chebwin(win_length, win_param);
104
-
105
- otherwise
106
- error(['Unknown window type ' win_type]);
107
- end
108
-
109
-
110
- %---------------------------------------------------------------------
111
- % If want the DFT of win
112
- %---------------------------------------------------------------------
113
- if(DFT_WINDOW)
114
- win=circshift(win(:),ceil(win_length/2));
115
- win=fft(win);
116
- win=circshift(win(:),floor(win_length/2));
117
- end
118
-
119
-
120
- function w=shift_win(w)
121
- %--------------------------------------------------------------------------------
122
- % Shift the window so that positive indices are first.
123
- %--------------------------------------------------------------------------------
124
- N=length(w);
125
- w=circshift(w(:),ceil(N/2));
126
-
127
-
128
-
129
- function w_pad=pad_win(w,Npad)
130
- %--------------------------------------------------------------------------------
131
- %
132
- % Pad window to Npad.
133
- %
134
- % Presume that positive window indices are first.
135
- %
136
- % When N is even use method described in [1]
137
- %
138
- % References:
139
- % [1] S. Lawrence Marple, Jr., Computing the discrete-time analytic
140
- % signal via FFT, IEEE Transactions on Signal Processing, Vol. 47,
141
- % No. 9, September 1999, pp.2600--2603.
142
- %
143
- %--------------------------------------------------------------------------------
144
- w=w(:);
145
- w_pad=zeros(Npad,1);
146
- N=length(w);
147
- Nh=floor(N/2);
148
- if(Npad<N) error('Npad is less than N'); end
149
-
150
-
151
- % Trival case:
152
- if(N==Npad)
153
- w_pad=w;
154
- return;
155
- end
156
-
157
-
158
- % For N odd:
159
- if( rem(N,2)==1 )
160
- n=0:Nh;
161
- w_pad(n+1)=w(n+1);
162
- n=1:Nh;
163
- w_pad(Npad-n+1)=w(N-n+1);
164
-
165
- % For N even:
166
- % split the Nyquist frequency in two and distribute over positive
167
- % and negative indices.
168
- else
169
- n=0:(Nh-1);
170
- w_pad(n+1)=w(n+1);
171
- w_pad(Nh+1)=w(Nh+1)/2;
172
-
173
- n=1:Nh-1;
174
- w_pad(Npad-n+1)=w(N-n+1);
175
- w_pad(Npad-Nh+1)=w(Nh+1)/2;
176
- end
@@ -1,11 +0,0 @@
1
- function flag = isreal_fn(fn,E)
2
- % ISREAL_FN - is 'fn' real valued
3
-
4
- if(nargin<2)
5
- E=sum(abs(fn(:)).^2) * 1e-12;
6
- end
7
- flag=1;
8
-
9
- if( max( abs(imag(fn(:))) ) > E ) flag=0; end
10
-
11
-
@@ -1,97 +0,0 @@
1
- %--------------------------------------------------------------------------------
2
- %
3
- % Pad window to Npad.
4
- %
5
- % Presume that positive window indices are first.
6
- %
7
- % USE: w_pad=padWin(w,Npad)
8
- %
9
- % INPUT:
10
- % w = window (vector) of length N
11
- % Npad = pad window to length N (Npad>N)
12
- %
13
- % OUTPUT:
14
- % w_pad = window of length N zeropadded to length Npad
15
- %
16
- %
17
- % When N is even use method described in [1]
18
- %
19
- % References:
20
- % [1] S. Lawrence Marple, Jr., Computing the discrete-time analytic
21
- % signal via FFT, IEEE Transactions on Signal Processing, Vol. 47,
22
- % No. 9, September 1999, pp.2600--2603.
23
- %
24
- %
25
- % STARTED: 04-01-2008
26
-
27
- % Copyright (c) 2010, John M. O' Toole, The University of Queensland
28
- % All rights reserved.
29
- %
30
- % Redistribution and use in source and binary forms, with or without
31
- % modification, are permitted provided that the following
32
- % conditions are met:
33
- % * Redistributions of source code must retain the above
34
- % copyright notice, this list of conditions and the following
35
- % disclaimer.
36
- % * Redistributions in binary form must reproduce the above
37
- % copyright notice, this list of conditions and the following
38
- % disclaimer in the documentation and/or other materials
39
- % provided with the distribution.
40
- % * Neither the name of the The University of Queensland nor the
41
- % names of its contributors may be used to endorse or promote
42
- % products derived from this software without specific prior
43
- % written permission.
44
- %
45
- % THIS SOFTWARE IS PROVIDED BY JOHN M. O' TOOLE ''AS IS'' AND ANY
46
- % EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47
- % IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
48
- % PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JOHN M. O' TOOLE BE
49
- % LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
50
- % CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
51
- % OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
52
- % BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
53
- % LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
54
- % (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
55
- % USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
56
- % DAMAGE.
57
- %--------------------------------------------------------------------------------
58
- function w_pad=padWin(w,Npad)
59
- DB=0;
60
- w=w(:);
61
- w_pad=zeros(Npad,1);
62
- N=length(w);
63
- Nh=floor(N/2);
64
- if(DB) dispVars(N,Npad); end
65
- if(Npad<N) error('Npad is less than N'); end
66
-
67
-
68
- % Trival case:
69
- if(N==Npad)
70
- w_pad=w;
71
- return;
72
- end
73
-
74
-
75
- % For N odd:
76
- if( rem(N,2)==1 )
77
- if(DB) dispDB('odd'); end
78
- n=0:Nh;
79
- w_pad(n+1)=w(n+1);
80
- n=1:Nh;
81
- w_pad(Npad-n+1)=w(N-n+1);
82
-
83
- % For N even:
84
- % split the Nyquist frequency in two and distribute over positive
85
- % and negative indices.
86
- else
87
- if(DB) dispDB('even'); end
88
- n=0:(Nh-1);
89
- w_pad(n+1)=w(n+1);
90
- w_pad(Nh+1)=w(Nh+1)/2;
91
-
92
- n=1:Nh-1;
93
- w_pad(Npad-n+1)=w(N-n+1);
94
- w_pad(Npad-Nh+1)=w(Nh+1)/2;
95
- end
96
-
97
-
@@ -1,149 +0,0 @@
1
- %-------------------------------------------------------------------------------
2
- % Plot TFD and time/frequency plots
3
- %
4
- % USE: vtfd(tfd,sig,Fs)
5
- %
6
- % INPUT:
7
- % tfd - the time-frequency distribution
8
- % sig - time-domain signal
9
- % Fs - sampling frequency
10
-
11
- %
12
- % Copyright (c) 2010, John M. O' Toole, The University of Queensland
13
- % All rights reserved.
14
- %
15
- % Redistribution and use in source and binary forms, with or without
16
- % modification, are permitted provided that the following
17
- % conditions are met:
18
- % * Redistributions of source code must retain the above
19
- % copyright notice, this list of conditions and the following
20
- % disclaimer.
21
- % * Redistributions in binary form must reproduce the above
22
- % copyright notice, this list of conditions and the following
23
- % disclaimer in the documentation and/or other materials
24
- % provided with the distribution.
25
- % * Neither the name of the The University of Queensland nor the
26
- % names of its contributors may be used to endorse or promote
27
- % products derived from this software without specific prior
28
- % written permission.
29
- %
30
- % THIS SOFTWARE IS PROVIDED BY JOHN M. O' TOOLE ''AS IS'' AND ANY
31
- % EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32
- % IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
33
- % PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JOHN M. O' TOOLE BE
34
- % LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
35
- % CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
36
- % OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
37
- % BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
38
- % LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39
- % (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
40
- % USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
41
- % DAMAGE.
42
- %-------------------------------------------------------------------------------
43
- function [h_image,h_time,h_freq]=vtfd(tfd,s1,FS,n,k)
44
- if(nargin<3 || isempty(FS))
45
- FS=1;
46
- end
47
- if(nargin<2 || isempty(s1))
48
- TFD_ONLY=1;
49
- Ntime=size(tfd,1);
50
- else
51
- TFD_ONLY=0;
52
- Ntime=length(s1);
53
- end
54
- if(nargin<4 || isempty(n)), n=[]; end
55
- if(nargin<5 || isempty(k)), k=[]; end
56
-
57
-
58
- [N,M]=size(tfd);
59
-
60
-
61
- % $$$ clf;
62
-
63
-
64
- %---------------------------------------------------------------------
65
- % Frame sizes:
66
- %---------------------------------------------------------------------
67
- X_AXIS_WIDTH=0.75;
68
- Y_AXIS_HEIGHT=0.75;
69
- X_AXIS_START=0.23;
70
- Y_AXIS_START=0.23;
71
- TIME_FREQ_PLOTS_WIDTH=0.15;
72
- TIME_FREQ_PLOTS_GAP=0.07;
73
-
74
-
75
- %---------------------------------------------------------------------
76
- % X/Y tick labels
77
- %---------------------------------------------------------------------
78
- if(isempty(n))
79
- ntime=1:Ntime; ntime=ntime./FS;
80
- n=linspace(ntime(1),ntime(end),N);
81
- else
82
- ntime=n;
83
- end
84
- Mh_time=ceil(Ntime/2); Mh=ceil(M/2);
85
- if(isempty(k))
86
-
87
- k=linspace(0,0.5,Mh);
88
- k_time=linspace(0,0.5,Mh_time);
89
- k=k.*FS;
90
- else
91
- k_time=k;
92
- end
93
- % $$$ keyboard;
94
-
95
- if(TFD_ONLY)
96
- imagesc(k,n,tfd); axis('xy');
97
-
98
- % seems to bug with Octave and gnuplot, so have to force square:
99
- if(is_octave), axis('square'); end
100
-
101
- else
102
- %---------------------------------------------------------------------
103
- % 1. time plot
104
- %---------------------------------------------------------------------
105
- s1=real(s1);
106
- h_time=subplot(2,2,1);
107
- set(h_time,'position',[(X_AXIS_START-TIME_FREQ_PLOTS_WIDTH-TIME_FREQ_PLOTS_GAP) ...
108
- Y_AXIS_START TIME_FREQ_PLOTS_WIDTH ...
109
- Y_AXIS_HEIGHT]);
110
- plot(s1,1:length(s1));
111
- axis('tight');
112
- grid('on');
113
- set(h_time,'xticklabel',[]); set(h_time,'yticklabel',[]);
114
-
115
-
116
- %---------------------------------------------------------------------
117
- % 2. freq plot
118
- %---------------------------------------------------------------------
119
- S1=fft(s1);
120
- h_freq=subplot(2,2,4);
121
- set(h_freq,'position',[X_AXIS_START (Y_AXIS_START- ...
122
- TIME_FREQ_PLOTS_WIDTH-TIME_FREQ_PLOTS_GAP) ...
123
- X_AXIS_WIDTH TIME_FREQ_PLOTS_WIDTH]);
124
- plot(1:Mh_time,abs(S1(1:Mh_time)).^2);
125
- axis('tight');
126
- grid('on');
127
- set(h_freq,'xticklabel',[]); set(h_freq,'yticklabel',[]);
128
-
129
-
130
- %---------------------------------------------------------------------
131
- % 2. time-freq plot
132
- %---------------------------------------------------------------------
133
- h_image=subplot(2,2,2);
134
- set(h_image,'position',[X_AXIS_START Y_AXIS_START X_AXIS_WIDTH ...
135
- Y_AXIS_HEIGHT]);
136
-
137
- imagesc(k,n,tfd); axis('xy');
138
-
139
- % seems to bug with Octave and gnuplot, so have to force square:
140
- if(is_octave), axis('square'); end
141
- end
142
-
143
-
144
- function r = is_octave ()
145
- persistent x;
146
- if (isempty (x))
147
- x = exist ('OCTAVE_VERSION', 'builtin');
148
- end
149
- r = x;
@@ -1,15 +0,0 @@
1
- function [IMU_filt, t_tar] = preprocessing_imu(t_orig, IMU_sample, fs_imu)
2
- %%----Preprocessing of the IMU pipeline----%%
3
- % Resampling to a uniform sampling rate at 30 Hz
4
- t_tar = t_orig(1):1/fs_imu:t_orig(end); % Correct target for resampling (by usage of t_start = t_orig(1) and t_end = t_orig(end));
5
- signal_resampled = spline(t_orig, IMU_sample', t_tar);
6
-
7
- % High-pass filter for detrending
8
- [b,a]=butter(4,0.2/(fs_imu/2),'high'); % high-pass filter for gravity removal
9
- IMU_filt = filtfilt(b,a,double(signal_resampled'));
10
-
11
- % [zhi,phi,khi] = butter(4,0.2,'high');
12
- % soshi = zp2sos(zhi,phi,khi);
13
- % IMU_filt2 = filtfilt(soshi,double(signal_resampled'));
14
- end
15
-
@@ -1,13 +0,0 @@
1
- function [PPG_data, t_tar] = preprocessing_ppg(t_orig, PPG_sample, fs_ppg)
2
-
3
- % Resampling to a uniform sampling rate at 30 Hz
4
- t_tar = t_orig(1):1/fs_ppg:t_orig(end); % Correct target for resampling (by usage of t_start and t_end);
5
- signal_resampled = spline(t_orig, PPG_sample, t_tar); % Spline interpolation used for resampling
6
-
7
- % Band-pass filter for detrending
8
-
9
- [b,a]=butter(4,[0.4, 3.5]/(fs_ppg/2),'bandpass'); % band-pass filter for detrending
10
- PPG_filt = filtfilt(b,a,double(signal_resampled)); % Apply filter
11
- PPG_data = PPG_filt'; % In case of a sample package error where PPG_filt consists of multiple "parts"
12
-
13
- end