paradigma 0.3.2__py3-none-any.whl → 0.4.0__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 (122) 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.3.2.dist-info → paradigma-0.4.0.dist-info}/METADATA +58 -14
  19. paradigma-0.4.0.dist-info/RECORD +22 -0
  20. {paradigma-0.3.2.dist-info → paradigma-0.4.0.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/RECORD +0 -108
  122. {paradigma-0.3.2.dist-info → paradigma-0.4.0.dist-info}/LICENSE +0 -0
@@ -1,241 +0,0 @@
1
- %-------------------------------------------------------------------------------
2
- % dec_sep_gdtfd: Decimated TFD with separable kernel of the form g[l,m]=G1[l]g2[m]. For
3
- % efficient implement define windows G1[l] and g2[m] as band-limited functions.
4
- %
5
- % TFD is decimated with integer factors a,b as ρ[an,bk]
6
- %
7
- % Syntax: tfd=dec_sep_gdtfd(x,dopp_win_params,lag_win_params,time_dec,freq_dec,Ntime,Nfreq)
8
- %
9
- % Inputs:
10
- % x = input signal (either real-valued signal of length-N or
11
- % complex-valued analytic signal of length-2N)
12
- %
13
- % dopp_win_params = Doppler window parameters in cell form:
14
- % {win_length,win_type,win_param,Doppler_or_not} where
15
- % - win_length is the sample length of the window
16
- % - win_type is the type of window
17
- % - [optional] win_param is the parameter of the window
18
- % - [optional] Doppler_or_not is either 1 (define window in the Doppler
19
- % domain, which is the default) or 0 (define window in the time domain)
20
- % e.g. {121, 'hamm'}; {121, 'tukey', 0.2}; {127,'cosh',0.01,0}
21
- %
22
- % lag_win_params = lag window parameters in cell form:
23
- % {win_length,win_type,win_param,lag_or_not} where
24
- % - win_length is the sample length of the window
25
- % - win_type is the type of window
26
- % - [optional] win_param is the parameter of the window
27
- % - [optional] lag_or_not is either 0 (define window in the lag
28
- % domain, which is the default) or 1 (define window the frequency domain)
29
- % e.g. {121, 'hamm'}; {121, 'tukey', 0.2}; {127,'cosh',0.01,0}
30
- %
31
- % time_dec = decimation factor a in the time domain; a/Ntime is integer
32
- % freq_dec = decimation factor b in the frequency domain; b/Nfreq is integer
33
- %
34
- % Nfreq = frequency oversampling value; must be greater than length of lag window
35
- % Ntime = time oversampling value; must be greater than length of Doppler window
36
- %
37
- % Outputs:
38
- % tfd = (a/Ntime) x (b/Nfreq) time–frequency distribution
39
- %
40
- % See also: SEP_GDTFD, GET_ANALYTIC_SIGNAL, GEN_LAG_KERN, GEN_DOPPLER_KERN, FFT
41
- %
42
- % Example:
43
- % N=1024; Ntime=64; Nfreq=128; a=1; b=2;
44
- % x=gen_LFM(N,0.1,0.3)+gen_LFM(N,0.4,0.1);
45
- %
46
- % c=dec_sep_gdtfd(x,{51,'hann'},{101,'hann'},a,b,Ntime,Nfreq);
47
- % vtfd(c,x);
48
-
49
- % John M. O' Toole, University College Cork
50
- % Started: 24-04-2014
51
- %
52
- % last update: Time-stamp: <2014-07-23 15:25:51 (otoolej)>
53
- %-------------------------------------------------------------------------------
54
- function tfd=dec_sep_gdtfd(x,dopp_win_params,lag_win_params,time_dec,freq_dec,Ntime, ...
55
- Nfreq)
56
- if(nargin<2 || isempty(dopp_win_params)), dopp_win_params={51,'hann'}; end
57
- if(nargin<3 || isempty(lag_win_params)), lag_win_params={151,'hann'}; end
58
- if(nargin<4 || isempty(time_dec)), time_dec=1; end
59
- if(nargin<5 || isempty(freq_dec)), freq_dec=1; end
60
- if(nargin<6 || isempty(Ntime)), Ntime=[]; end
61
- if(nargin<7 || isempty(Nfreq)), Nfreq=[]; end
62
-
63
- DBplot=0;
64
- DBmem=0;
65
- DBtest=0;
66
- DBtime=0;
67
- DBverbose=0;
68
-
69
-
70
- if(DBtime), time_start=tic; end
71
- %---------------------------------------------------------------------
72
- % 1. convert real-valued signal to analytic signal of length 2N
73
- %---------------------------------------------------------------------
74
- [z,N2,N,Nh]=get_analytic_signal(x);
75
-
76
-
77
- %---------------------------------------------------------------------
78
- % 2. generate kernel windows and check decimation parameters
79
- %---------------------------------------------------------------------
80
- [G1,Q,Ntime]=gen_Doppler_kern(dopp_win_params,N,Ntime);
81
- Qh=ceil(Q/2);
82
-
83
- [g2,P,Ph_floor,Nfreq]=gen_lag_kern(lag_win_params,N,Nfreq);
84
- Nh=ceil(Nfreq/2); Ph=ceil(P/2);
85
-
86
-
87
- % check decimation parameters and return as sequence:
88
- if(length(time_dec)>1 || length(freq_dec)>1)
89
- error('Frequency and time decimation parameters should be scalar');
90
- end
91
- [n_seq,L,time_dec]=check_dec_params_seq(time_dec,Ntime,'time',1);
92
- [k_seq,J,freq_dec]=check_dec_params_seq(freq_dec,Nfreq,'frequency',1);
93
- Jh=ceil(J/2); J_extend=2*Jh+2; P_extend=2*Ph+2;
94
-
95
- if(DBmem), s=whos; fprintf('start: mem=%s\n',disp_bytes(sum([s.bytes]))); end
96
-
97
- tfd=zeros(L,J_extend);
98
- m_real=1:(Jh+1); m_imag=(J_extend-Jh):(J_extend);
99
-
100
- if(DBverbose),
101
- dispVars(N,Ntime,Nfreq,L,J,Jh,J_extend,P,Ph,Q,Qh,P_extend);
102
- dispVars(length(m_real),length(m_imag),m_real(end),m_imag(1));
103
- end
104
-
105
- if(DBmem), s=whos; fprintf('declare TFD: mem=%s\n',disp_bytes(sum([s.bytes]))); end
106
-
107
-
108
- %---------------------------------------------------------------------
109
- % 2. generate time--lag signal function (for positive-lag values only)
110
- %---------------------------------------------------------------------
111
- l=0:(Qh-1); lb=1:(Qh-1);
112
- n=0:N-1;
113
- for m=0:Jh
114
-
115
- %-------------------------------------------------------------------------
116
- % a) Form lag-slice of windowed time-lag function and then fold in
117
- % the lag direction.
118
- %-------------------------------------------------------------------------
119
- R_lag_slice=zeros(N,1);
120
- for p=0:freq_dec-1
121
- mmod=p.*J+m;
122
-
123
- if(mmod<=Ph)
124
- inp=mod(n+mmod,N2); inn=mod(n-mmod,N2);
125
- i1=mod(n+mmod,N2); i2=mod(n-mmod,N2);
126
-
127
- R_lag_slice=R_lag_slice+z(inp+1).*conj(z(inn+1)).*g2(mmod+1);
128
- elseif(mmod>Nfreq-Ph)
129
- inp=mod(n+Nfreq-mmod,N2); inn=mod(n-Nfreq+mmod,N2);
130
-
131
- R_lag_slice=R_lag_slice+conj(z(inp+1)).*z(inn+1).*g2(P-Nfreq+mmod+1);
132
- end
133
- end
134
-
135
-
136
- %-------------------------------------------------------------------------
137
- % b) DFT to the Doppler--lag domain..
138
- %-------------------------------------------------------------------------
139
- R_lag_slice=fft(R_lag_slice);
140
-
141
- %-------------------------------------------------------------------------
142
- % c) Multiply by Doppler window G1
143
- %-------------------------------------------------------------------------
144
- r_lag_slice=zeros(Ntime,1);
145
- r_lag_slice(l+1)=R_lag_slice(l+1).*G1(l+1);
146
- r_lag_slice(Ntime-lb+1)=R_lag_slice(N-lb+1).*G1(Q-lb+1);
147
-
148
- %-------------------------------------------------------------------------
149
- % d) Fold in the Doppler direction
150
- %-------------------------------------------------------------------------
151
- r_lag_fold=fold_vector_full(r_lag_slice,L,time_dec);
152
-
153
- %-------------------------------------------------------------------------
154
- % e) DFT the lag slice to the time--lag domain
155
- %-------------------------------------------------------------------------
156
- r_lag_fold=ifft(r_lag_fold);
157
-
158
- tfd(:,m_real(m+1))=real(r_lag_fold);
159
- tfd(:,m_imag(m+1))=imag(r_lag_fold);
160
- end
161
-
162
-
163
- if(DBmem), s=whos; fprintf('R: mem=%s\n',disp_bytes(sum([s.bytes]))); end
164
-
165
- %-------------------------------------------------------------------------
166
- % 4. Expand R for positive and negative lag values and DFT back to
167
- % time--frequency domain
168
- %-------------------------------------------------------------------------
169
- m=0:Jh; mb=1:(Jh-1);
170
- for n=0:2:(L-2)
171
- R_even_half=complex(tfd(n+1,m_real),tfd(n+1,m_imag));
172
- R_odd_half =complex(tfd(n+2,m_real),tfd(n+2,m_imag));
173
-
174
- R_tslice_even=zeros(J,1); R_tslice_odd=zeros(J,1);
175
- R_tslice_even(m+1)=R_even_half(m+1);
176
- R_tslice_odd(m+1) =R_odd_half(m+1);
177
- R_tslice_even(J-mb+1)=conj( R_even_half(mb+1) );
178
- R_tslice_odd(J-mb+1) =conj( R_odd_half(mb+1) );
179
-
180
- tfd_time_slice=fft( R_tslice_even+j.*R_tslice_odd );
181
-
182
- tfd(n+1,1:J)=real(tfd_time_slice);
183
- tfd(n+2,1:J)=imag(tfd_time_slice);
184
- end
185
-
186
- % one extra FFT if L is odd:
187
- if(rem(L,2))
188
- R_even_half=complex(tfd(L,m_real),tfd(L,m_imag));
189
-
190
- R_tslice_even=zeros(J,1);
191
- R_tslice_even(m+1)=R_even_half(m+1);
192
- R_tslice_even(J-mb+1)=conj( R_even_half(mb+1) );
193
-
194
- tfd_time_slice=fft( R_tslice_even+j.*R_tslice_odd );
195
-
196
- tfd(L,1:J)=real(tfd_time_slice);
197
- end
198
-
199
- tfd=tfd(:,1:J);
200
-
201
- if(DBmem), s=whos; fprintf('end: mem=%s\n',disp_bytes(sum([s.bytes]))); end
202
-
203
- scale_factor=1/Nfreq;
204
- tfd=tfd.*scale_factor;
205
-
206
- if(DBtime), dispVars( toc(time_start) ); end
207
-
208
- %---------------------------------------------------------------------
209
- % END; testing and plotting
210
- %---------------------------------------------------------------------
211
- if(DBtest)
212
- if(DBtime), time_start=tic; end
213
- tfd_test=full_gdtfd_testing_version(x,'sep',{dopp_win_params,lag_win_params});
214
- if(DBtime), dispVars( toc(time_start) ); end
215
-
216
- a=N/Ntime; b=N/Nfreq;
217
- if( a==floor(a) && b==floor(b) )
218
- dispEE(tfd_test( (a.*n_seq)+1,(b.*k_seq)+1),tfd./(a*b));
219
- end
220
-
221
- % $$$ figure(100); clf; hold all;
222
- % $$$ k=10; plot(tfd_test(n_seq+1,k_seq(k)+1)); plot(tfd(:,k+1));
223
- % $$$ keyboard;
224
- end
225
- if(DBverbose)
226
- fprintf('size=%dx%d; max=%g; total energ:%d\n', size(tfd,1), size(tfd,2), max(tfd(:)), ...
227
- sum(tfd(:)));
228
- end
229
- if(DBplot)
230
- figure(1); clf;
231
- vtfd(tfd,real(x(1:N)));
232
-
233
- % $$$ figure(9); clf; hold all;
234
- % $$$ subplot(211); hold all; plot(sum(tfd')'); plot( abs(z(1:N)).^2 );
235
- % $$$ subplot(212); hold all; plot(sum(tfd')' - abs(z(n_seq+1)).^2 );
236
- % $$$
237
- % $$$ figure(10); clf; hold all;
238
- % $$$ Z=fft(z);
239
- % $$$ subplot(211); hold all; plot(sum(tfd)); plot( abs(Z(1:N)).^2./(2*N) );
240
- % $$$ subplot(212); hold all; plot(sum(tfd)' - abs(Z(k_seq+1)).^2./(2*N) );
241
- end
@@ -1,157 +0,0 @@
1
- %-------------------------------------------------------------------------------
2
- % di_gdtfd: TFD with Doppler-independent (DI) kernel g[l,m]=g₂[m]
3
- %
4
- % Syntax: tfd=di_gdtfd(x,lag_win_params,Nfreq)
5
- %
6
- % Inputs:
7
- % x = input signal (either real-valued signal of length-N or
8
- % complex-valued analytic signal of length-2N)
9
- %
10
- % lag_win_params = lag window parameters in cell form:
11
- % {win_length,win_type,win_param,lag_or_not} where
12
- % - win_length is the sample length of the window
13
- % - win_type is the type of window
14
- % - [optional] win_param is the parameter of the window
15
- % - [optional] lag_or_not is either 0 (define window in the lag
16
- % domain, which is the default) or 0 (define window the frequency domain)
17
- % e.g. {121, 'hamm'}; {121, 'tukey', 0.2}; {127,'cosh',0.01,0}
18
- %
19
- % Nfreq = frequency oversampling value; must be greater than length of lag window
20
- %
21
- % Outputs:
22
- % tfd = N x Nfreq time-frequency distribution
23
- %
24
- % See also: DEC_DI_GDTFD, GET_ANALYTIC_SIGNAL, GEN_LAG_KERN, FFT
25
- %
26
- % Example:
27
- % N=512; Ntime=256; Nfreq=256;
28
- % x=gen_LFM(N,0.1,0.3)+gen_LFM(N,0.4,0.1);
29
- %
30
- % c=di_gdtfd(x,{51,'hann'},Nfreq);
31
- % vtfd(c,x);
32
-
33
- % John M. O' Toole, University College Cork
34
- % Started: 16-04-2014
35
- %
36
- % last update: Time-stamp: <2014-07-23 16:31:30 (otoolej)>
37
- %-------------------------------------------------------------------------------
38
- function tfd=di_gdtfd(x,lag_win_params,Nfreq)
39
- if(nargin<2 || isempty(lag_win_params)), lag_win_params={101,'hamm'}; end
40
- if(nargin<3 || isempty(Nfreq)), Nfreq=[]; end
41
-
42
-
43
- DBplot=0;
44
- DBmem=0;
45
- DBcompare=0;
46
- DBtest=0;
47
- DBtime=0;
48
-
49
-
50
- if(DBtime), time_start=tic; end
51
- %---------------------------------------------------------------------
52
- % 1. convert real-valued signal to analytic signal of length 2N
53
- %---------------------------------------------------------------------
54
- [z,N2,N,Nh]=get_analytic_signal(x);
55
-
56
-
57
- %---------------------------------------------------------------------
58
- % 2. generate time--lag signal function (for positive-lag values only)
59
- %---------------------------------------------------------------------
60
- [g2,P,Ph_floor,Nfreq]=gen_lag_kern(lag_win_params,N,Nfreq);
61
- Nh=ceil(Nfreq/2);
62
- Ph=ceil(P/2);
63
-
64
- if(DBmem), s=whos; fprintf('start: mem=%s\n',disp_bytes(sum([s.bytes]))); end
65
- tfd=zeros(N,Nfreq);
66
- m_real=1:Ph; m_imag=(Nfreq-Ph+1):Nfreq;
67
-
68
- m=0:(Ph-1);
69
- for n=0:N-1
70
- inp=mod(n+m,N2); inn=mod(n-m,N2);
71
- K_time_slice=g2(m+1).*z(inp+1).*conj( z(inn+1) );
72
-
73
- tfd(n+1,m_real)=real( K_time_slice );
74
- tfd(n+1,m_imag)=imag( K_time_slice );
75
- end
76
-
77
-
78
- if(DBcompare)
79
- K=zeros(N,Nh);
80
- for n=0:N-1
81
- inp=mod(n+m,N2); inn=mod(n-m,N2);
82
- K(n+1,m+1)=g2(m+1).*z(inp+1).*conj( z(inn+1) );
83
- end
84
- Ktest=complex(tfd(:,m_real),tfd(:,m_imag));
85
- dispEE(Ktest,K(:,m+1));
86
- end
87
- if(DBmem), s=whos; fprintf('K: mem=%s\n',disp_bytes(sum([s.bytes]))); end
88
-
89
-
90
- %-------------------------------------------------------------------------
91
- % 3. Expand R for positive and negative lag values and DFT back to
92
- % time--frequency domain
93
- %-------------------------------------------------------------------------
94
- m=0:(Ph-1); mb=1:(Ph-1);
95
- for n=0:2:N-2
96
- R_even_half=complex(tfd(n+1,m_real),tfd(n+1,m_imag));
97
- R_odd_half =complex(tfd(n+2,m_real),tfd(n+2,m_imag));
98
-
99
- R_tslice_even=zeros(1,Nfreq); R_tslice_odd=zeros(1,Nfreq);
100
- R_tslice_even(m+1)=R_even_half(m+1);
101
- R_tslice_odd(m+1) =R_odd_half(m+1);
102
- R_tslice_even(Nfreq-mb+1)=conj( R_even_half(mb+1) );
103
- R_tslice_odd(Nfreq-mb+1) =conj( R_odd_half(mb+1) );
104
-
105
- tfd_time_slice=fft( R_tslice_even+j.*R_tslice_odd );
106
-
107
- tfd(n+1,:)=real(tfd_time_slice);
108
- tfd(n+2,:)=imag(tfd_time_slice);
109
- end
110
-
111
- if(DBmem), s=whos; fprintf('tfd: mem=%s\n',disp_bytes(sum([s.bytes]))); end
112
-
113
-
114
- if(DBcompare)
115
- Rfull=zeros(N,Nfreq);
116
- Rfull(:,m+1)=K(:,m+1);
117
- Rfull(:,Nfreq-mb+1)=conj( Rfull(:,mb+1) );
118
-
119
- tfd_test=fft( Rfull.' ).';
120
- dispEE(tfd_test,tfd);
121
- end
122
-
123
-
124
- if(DBmem), s=whos; fprintf('end: mem=%s\n',disp_bytes(sum([s.bytes]))); end
125
-
126
- scale_factor=1/Nfreq;
127
- tfd=tfd.*scale_factor;
128
-
129
-
130
- if(DBtime), dispVars( toc(time_start) ); end
131
-
132
-
133
- %---------------------------------------------------------------------
134
- % END; testing and plotting
135
- %---------------------------------------------------------------------
136
- if(DBtest)
137
- if(DBtime), time_start=tic; end
138
- tfd_test=full_gdtfd_testing_version(x,'pwvd',{P,lag_win_params{2:end}});
139
- if(DBtime), dispVars( toc(time_start) ); end
140
- if(Nfreq==N)
141
- dispEE(tfd_test,tfd);
142
- else
143
- b=N/Nfreq;
144
- if( b==floor(b) )
145
- dispEE(tfd_test(:,1:b:end),tfd./b);
146
- end
147
- end
148
- end
149
- if(DBplot)
150
- figure(1); clf;
151
- vtfd(tfd,real(x(1:N)));
152
-
153
- figure(9); clf; hold all;
154
- subplot(211); hold all; plot(sum(tfd')'); plot( abs(z(1:N)).^2 );
155
- subplot(212); hold all; plot(sum(tfd')' - abs(z(1:N)).^2 );
156
- end
157
-
@@ -1,190 +0,0 @@
1
- %-------------------------------------------------------------------------------
2
- % li_gdtfd: TFD with lag-independent (LI) kernel g[l,m]=G₁[l]
3
- %
4
- % Syntax: tfd=li_gdtfd(x,dopp_win_params,Ntime)
5
- %
6
- % Inputs:
7
- % x = input signal (either real-valued signal of length-N or
8
- % complex-valued analytic signal of length-2N)
9
- %
10
- % dopp_win_params = Doppler window parameters in cell form:
11
- % {win_length,win_type,win_param,Doppler_or_not} where
12
- % - win_length is the sample length of the window
13
- % - win_type is the type of window
14
- % - [optional] win_param is the parameter of the window
15
- % - [optional] Doppler_or_not is either 1 (define window in the Doppler
16
- % domain, which is the default) or 0 (define window the time domain)
17
- % e.g. {121, 'hamm'}; {121, 'tukey', 0.2}; {127,'cosh',0.01,0}
18
- %
19
- % Ntime = time oversampling value; must be greater than length of Doppler window
20
- %
21
- % Outputs:
22
- % tfd = Ntime x N time-frequency distribution
23
- %
24
- % See also: DEC_LI_GDTFD, GET_ANALYTIC_SIGNAL, GEN_DOPPLER_KERN, FFT
25
- %
26
- % Example:
27
- % N=10000; Ntime=256;
28
- % x=gen_LFM(N,0.1,0.3)+gen_LFM(N,0.4,0.1);
29
- %
30
- % c=li_gdtfd(x,{51,'hamm'},Ntime);
31
- % vtfd(c,x);
32
- %
33
- % Example:
34
- %
35
- %
36
-
37
- % John M. O' Toole, University College Cork
38
- % Started: 16-04-2014
39
- %
40
- % last update: Time-stamp: <2014-07-23 15:28:16 (otoolej)>
41
- %-------------------------------------------------------------------------------
42
- function [tfd,G1]=li_gdtfd(x,dopp_win_params,Ntime)
43
- if(nargin<2 || isempty(dopp_win_params)), dopp_win_params={11,'hamm',0,1}; end
44
- if(nargin<3 || isempty(Ntime)), Ntime=[]; end
45
-
46
-
47
- DBplot=0;
48
- DBmem=0;
49
- DBcompare=0;
50
- DBtest=0;
51
- DBtime=0;
52
-
53
- if(DBtime), time_start=tic; end
54
- %---------------------------------------------------------------------
55
- % 1. convert real-valued signal to analytic signal of length 2N
56
- %---------------------------------------------------------------------
57
- [z,N2,N,Nh]=get_analytic_signal(x);
58
-
59
-
60
- %---------------------------------------------------------------------
61
- % 2. generate Doppler--frequency signal function
62
- % (for positive-Doppler values only)
63
- %---------------------------------------------------------------------
64
- [G1,Q,Ntime]=gen_Doppler_kern(dopp_win_params,N,Ntime);
65
- Nh=ceil(Ntime/2);
66
- Qh=ceil(Q/2);
67
-
68
- Z=fft(z);
69
- if(DBmem), s=whos; fprintf('start: mem=%s\n',disp_bytes(sum([s.bytes]))); end
70
- tfd=zeros(Ntime,N);
71
- l_real=1:Qh; l_imag=(Ntime-Qh+1):Ntime;
72
-
73
-
74
- l=0:(Qh-1);
75
- for k=0:N-1
76
- inp=mod(k+l,N2); inn=mod(k-l,N2);
77
- inpN=mod(k+l+N,N2); innN=mod(k-l-N,N2);
78
- K_doppler_slice=G1(l+1).*( Z(inp+1).*conj( Z(inn+1) ) + ...
79
- Z(inpN+1).*conj( Z(innN+1) ) );
80
-
81
- tfd(l_real,k+1)=real( K_doppler_slice )./2;
82
- tfd(l_imag,k+1)=imag( K_doppler_slice )./2;
83
- end
84
-
85
-
86
- % $$$ Ktesting=zeros(N,ceil(N/2)+1); m=0:(ceil(N/2));
87
- % $$$ for n=0:N-1
88
- % $$$ inp=mod(n+m,N2); inn=mod(n-m,N2);
89
- % $$$ Ktesting(n+1,m+1)=z(inp+1).*conj( z(inn+1) );
90
- % $$$ end
91
- % $$$ Kfull=zeros(N); mb=1:(ceil(N/2)-1);
92
- % $$$ Kfull(:,m+1)=Ktesting(:,m+1);
93
- % $$$ Kfull(:,N-mb+1)=conj( Ktesting(:,mb+1) );
94
- % $$$
95
- % $$$ Ktest=complex(tfd(l_real,:),tfd(l_imag,:));
96
- % $$$ kk=fft(fft(Kfull.').');
97
- % $$$ kk=kk(l+1,:).*2;
98
- % $$$ dispVars(size(kk),size(Ktest));
99
- % $$$ dispEE(Ktest,kk);
100
- % $$$ figure(10); clf; vtfd(abs(Ktest));
101
- % $$$ figure(11); clf; vtfd(abs(Ktest-kk));
102
-
103
- if(DBcompare)
104
- K=zeros(Nh,N);
105
- for k=0:N-1
106
- inp=mod(k+l,N2); inn=mod(k-l,N2);
107
- inpN=mod(k+l+N,N2); innN=mod(k-l-N,N2);
108
- K(l+1,k+1)=G1(l+1).*( Z(inp+1).*conj( Z(inn+1) ) + ...
109
- Z(inpN+1).*conj( Z(innN+1) ) );
110
- end
111
- Ktest=complex(tfd(l_real,:),tfd(l_imag,:));
112
- dispEE(Ktest,K(l+1,:));
113
- end
114
- if(DBmem), s=whos; fprintf('K: mem=%s\n',disp_bytes(sum([s.bytes]))); end
115
-
116
-
117
-
118
-
119
- %-------------------------------------------------------------------------
120
- % 3. Expand R for positive and negative lag values and DFT back to
121
- % time--frequency domain
122
- %-------------------------------------------------------------------------
123
- l=0:(Qh-1); lb=1:(Qh-1);
124
- for k=0:2:N-2
125
- R_even_half=complex(tfd(l_real,k+1),tfd(l_imag,k+1));
126
- R_odd_half =complex(tfd(l_real,k+2),tfd(l_imag,k+2));
127
-
128
- R_tslice_even=zeros(Ntime,1); R_tslice_odd=zeros(Ntime,1);
129
- R_tslice_even(l+1)=R_even_half(l+1);
130
- R_tslice_odd(l+1) =R_odd_half(l+1);
131
- R_tslice_even(Ntime-lb+1)=conj( R_even_half(lb+1) );
132
- R_tslice_odd(Ntime-lb+1) =conj( R_odd_half(lb+1) );
133
-
134
- tfd_time_slice=ifft( R_tslice_even+j.*R_tslice_odd );
135
-
136
- tfd(:,k+1)=real(tfd_time_slice);
137
- tfd(:,k+2)=imag(tfd_time_slice);
138
- end
139
-
140
- if(DBmem), s=whos; fprintf('tfd: mem=%s\n',disp_bytes(sum([s.bytes]))); end
141
-
142
-
143
-
144
- if(DBcompare)
145
- Rfull=zeros(Ntime,N);
146
- Rfull(l+1,:)=K(l+1,:);
147
- Rfull(Ntime-lb+1,:)=conj( Rfull(lb+1,:) );
148
-
149
- tfd_test=ifft( Rfull );
150
- dispEE(tfd_test,tfd);
151
- end
152
-
153
-
154
- if(DBmem), s=whos; fprintf('end: mem=%s\n',disp_bytes(sum([s.bytes]))); end
155
-
156
- scale_factor=1/N;
157
- tfd=tfd.*scale_factor;
158
-
159
- if(DBtime), dispVars( toc(time_start) ); end
160
-
161
-
162
- %---------------------------------------------------------------------
163
- % END; testing and plotting
164
- %---------------------------------------------------------------------
165
- if(DBtest)
166
- if(DBtime), time_start=tic; end
167
- tfd_test=full_gdtfd_testing_version(x,'swvd',dopp_win_params);
168
- if(DBtime), dispVars( toc(time_start) ); end
169
- if(Ntime==N)
170
- dispEE(tfd_test,tfd);
171
- else
172
- a=N/Ntime;
173
- if( a==floor(a) )
174
- dispEE(tfd_test(1:a:end,:),tfd./a);
175
- end
176
- end
177
- end
178
- if(DBplot)
179
- figure(1); clf;
180
- vtfd(tfd,real(x(1:N)));
181
-
182
- figure(9); clf; hold all;
183
- Z=fft(z);
184
- subplot(211); hold all; plot(sum(tfd)); plot( abs(Z(1:N)).^2./(2*N) );
185
- subplot(212); hold all; plot(sum(tfd)' - abs(Z(1:N)).^2./(2*N) );
186
- end
187
-
188
-
189
-
190
-