paradigma 0.1.2__py3-none-any.whl → 0.2.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 (112) hide show
  1. paradigma/__init__.py +1 -3
  2. paradigma/constants.py +35 -0
  3. paradigma/feature_extraction.py +678 -0
  4. paradigma/gait_analysis.py +413 -0
  5. paradigma/gait_analysis_config.py +244 -0
  6. paradigma/heart_rate_analysis.py +127 -0
  7. paradigma/heart_rate_analysis_config.py +9 -0
  8. paradigma/heart_rate_util.py +173 -0
  9. paradigma/imu_preprocessing.py +229 -0
  10. paradigma/ppg/classifier/LR_PPG_quality.pkl +0 -0
  11. paradigma/ppg/classifier/LR_model.mat +0 -0
  12. paradigma/ppg/feat_extraction/acc_feature.m +20 -0
  13. paradigma/ppg/feat_extraction/peakdet.m +64 -0
  14. paradigma/ppg/feat_extraction/ppg_features.m +53 -0
  15. paradigma/ppg/glob_functions/extract_hr_segments.m +37 -0
  16. paradigma/ppg/glob_functions/extract_overlapping_segments.m +23 -0
  17. paradigma/ppg/glob_functions/jsonlab/AUTHORS.txt +41 -0
  18. paradigma/ppg/glob_functions/jsonlab/ChangeLog.txt +74 -0
  19. paradigma/ppg/glob_functions/jsonlab/LICENSE_BSD.txt +25 -0
  20. paradigma/ppg/glob_functions/jsonlab/LICENSE_GPLv3.txt +699 -0
  21. paradigma/ppg/glob_functions/jsonlab/README.txt +394 -0
  22. paradigma/ppg/glob_functions/jsonlab/examples/.svn/entries +368 -0
  23. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/demo_jsonlab_basic.m.svn-base +180 -0
  24. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/demo_ubjson_basic.m.svn-base +180 -0
  25. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example1.json.svn-base +23 -0
  26. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example2.json.svn-base +22 -0
  27. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example3.json.svn-base +11 -0
  28. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example4.json.svn-base +34 -0
  29. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_basictest.matlab.svn-base +662 -0
  30. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_selftest.m.svn-base +27 -0
  31. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_selftest.matlab.svn-base +144 -0
  32. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_speedtest.m.svn-base +21 -0
  33. paradigma/ppg/glob_functions/jsonlab/examples/demo_jsonlab_basic.m +180 -0
  34. paradigma/ppg/glob_functions/jsonlab/examples/demo_ubjson_basic.m +180 -0
  35. paradigma/ppg/glob_functions/jsonlab/examples/example1.json +23 -0
  36. paradigma/ppg/glob_functions/jsonlab/examples/example2.json +22 -0
  37. paradigma/ppg/glob_functions/jsonlab/examples/example3.json +11 -0
  38. paradigma/ppg/glob_functions/jsonlab/examples/example4.json +34 -0
  39. paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_basictest.matlab +662 -0
  40. paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_selftest.m +27 -0
  41. paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_selftest.matlab +144 -0
  42. paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_speedtest.m +21 -0
  43. paradigma/ppg/glob_functions/jsonlab/jsonopt.m +32 -0
  44. paradigma/ppg/glob_functions/jsonlab/loadjson.m +566 -0
  45. paradigma/ppg/glob_functions/jsonlab/loadubjson.m +528 -0
  46. paradigma/ppg/glob_functions/jsonlab/mergestruct.m +33 -0
  47. paradigma/ppg/glob_functions/jsonlab/savejson.m +475 -0
  48. paradigma/ppg/glob_functions/jsonlab/saveubjson.m +504 -0
  49. paradigma/ppg/glob_functions/jsonlab/varargin2struct.m +40 -0
  50. paradigma/ppg/glob_functions/sample_prob_final.m +49 -0
  51. paradigma/ppg/glob_functions/synchronization.m +76 -0
  52. paradigma/ppg/glob_functions/tsdf_scan_meta.m +22 -0
  53. paradigma/ppg/hr_functions/Long_TFD_JOT.m +37 -0
  54. paradigma/ppg/hr_functions/PPG_TFD_HR.m +59 -0
  55. paradigma/ppg/hr_functions/TFD toolbox JOT/.gitignore +4 -0
  56. paradigma/ppg/hr_functions/TFD toolbox JOT/CHANGELOG.md +23 -0
  57. paradigma/ppg/hr_functions/TFD toolbox JOT/LICENCE.md +27 -0
  58. paradigma/ppg/hr_functions/TFD toolbox JOT/README.md +251 -0
  59. paradigma/ppg/hr_functions/TFD toolbox JOT/README.pdf +0 -0
  60. paradigma/ppg/hr_functions/TFD toolbox JOT/common/gen_Doppler_kern.m +142 -0
  61. paradigma/ppg/hr_functions/TFD toolbox JOT/common/gen_Doppler_lag_kern.m +314 -0
  62. paradigma/ppg/hr_functions/TFD toolbox JOT/common/gen_lag_kern.m +123 -0
  63. paradigma/ppg/hr_functions/TFD toolbox JOT/dec_tfd.m +154 -0
  64. paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_di_gdtfd.m +194 -0
  65. paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_li_gdtfd.m +200 -0
  66. paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_nonsep_gdtfd.m +229 -0
  67. paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_sep_gdtfd.m +241 -0
  68. paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/di_gdtfd.m +157 -0
  69. paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/li_gdtfd.m +190 -0
  70. paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/nonsep_gdtfd.m +196 -0
  71. paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/sep_gdtfd.m +199 -0
  72. paradigma/ppg/hr_functions/TFD toolbox JOT/full_tfd.m +144 -0
  73. paradigma/ppg/hr_functions/TFD toolbox JOT/load_curdir.m +13 -0
  74. paradigma/ppg/hr_functions/TFD toolbox JOT/pics/decimated_TFDs_examples.png +0 -0
  75. paradigma/ppg/hr_functions/TFD toolbox JOT/pics/full_TFDs_examples.png +0 -0
  76. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/check_dec_params_seq.m +79 -0
  77. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/dispEE.m +9 -0
  78. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/dispVars.m +26 -0
  79. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/disp_bytes.m +25 -0
  80. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/fold_vector_full.m +40 -0
  81. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/fold_vector_half.m +34 -0
  82. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/gen_LFM.m +29 -0
  83. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/get_analytic_signal.m +76 -0
  84. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/get_window.m +176 -0
  85. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/isreal_fn.m +11 -0
  86. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/padWin.m +97 -0
  87. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/vtfd.m +149 -0
  88. paradigma/ppg/preprocessing/preprocessing_imu.m +15 -0
  89. paradigma/ppg/preprocessing/preprocessing_ppg.m +13 -0
  90. paradigma/ppg_preprocessing.py +313 -0
  91. paradigma/preprocessing_config.py +64 -0
  92. paradigma/quantification.py +58 -0
  93. paradigma/tremor/TremorFeaturesAndClassification.m +345 -0
  94. paradigma/tremor/feat_extraction/DerivativesExtract.m +22 -0
  95. paradigma/tremor/feat_extraction/ExtractBandSignalsRMS.m +72 -0
  96. paradigma/tremor/feat_extraction/MFCCExtract.m +100 -0
  97. paradigma/tremor/feat_extraction/PSDBandPower.m +52 -0
  98. paradigma/tremor/feat_extraction/PSDEst.m +63 -0
  99. paradigma/tremor/feat_extraction/PSDExtrAxis.m +88 -0
  100. paradigma/tremor/feat_extraction/PSDExtrOpt.m +95 -0
  101. paradigma/tremor/preprocessing/InterpData.m +32 -0
  102. paradigma/tremor/weekly_aggregates/WeeklyAggregates.m +295 -0
  103. paradigma/util.py +50 -0
  104. paradigma/windowing.py +217 -0
  105. paradigma-0.2.0.dist-info/LICENSE +192 -0
  106. paradigma-0.2.0.dist-info/METADATA +58 -0
  107. paradigma-0.2.0.dist-info/RECORD +108 -0
  108. paradigma/dummy.py +0 -3
  109. paradigma-0.1.2.dist-info/LICENSE +0 -201
  110. paradigma-0.1.2.dist-info/METADATA +0 -18
  111. paradigma-0.1.2.dist-info/RECORD +0 -6
  112. {paradigma-0.1.2.dist-info → paradigma-0.2.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,37 @@
1
+ %% Implementation using the toolbox of J. O'Toole
2
+
3
+ % Only the essential code is used. The function nonsep_gdtfd is code from
4
+ % the toolbox of J. O'Toole: Copyright © 2014, John M. O Toole, University College Cork. All rights reserved.
5
+ function HR_smooth_tfd = Long_TFD_JOT(rel_ppg_tfd, MA, fs, kern_type, kern_params)
6
+
7
+ tfd = nonsep_gdtfd(rel_ppg_tfd, kern_type, kern_params); % for now the wigner ville distribution but one could also use the smoothed pseudo WVD --> returns matrix of size NxN
8
+
9
+ if MA.value == 1
10
+ input = tfd';
11
+ tfd = filtfilt(MA.FC,1,input);
12
+ tfd = tfd.';
13
+ end
14
+
15
+ %%----- Get time and frequency axis for tfd-----%%
16
+ [~,M]=size(tfd);
17
+ Ntime=size(tfd,1);
18
+
19
+ ntime=1:Ntime; ntime=ntime./fs-1/fs; % time array
20
+ Mh=ceil(M);
21
+ k=linspace(0,0.5,Mh);
22
+ k=k.*fs; % frequency array
23
+
24
+ %%---Estimate HR using same approach as for given tfd----%%
25
+ [~, k_idx] = max(tfd, [], 1);
26
+
27
+
28
+ count = 0;
29
+
30
+ for i = 2:2:length(rel_ppg_tfd)/fs-4 % starting at 2 and ending at length -4 to discard the first and last 2 sec of the WVD which are influenced by boundary effects
31
+ count = count + 1;
32
+ rel_wvd_idx = ntime>=i & ntime<i+2;
33
+ HR_smooth_tfd(count,1) = 60*mean(k(k_idx(rel_wvd_idx)));
34
+
35
+ end
36
+
37
+ end
@@ -0,0 +1,59 @@
1
+ function HR_smooth_tfd = PPG_TFD_HR(rel_ppg_tfd, tfd_length, MA, fs, kern_type, kern_params)
2
+ % Function to estimate the HR using a particular TFD method, such as WVD,
3
+ % SPWVD or other kernel methods over segments of 30 s. If the remaining segment
4
+ % length is longer than 30 s it is calculated over the entire length to
5
+ % include all data into the analysis.
6
+
7
+ % Input:
8
+ % - rel_ppg_wvd: ppg signal with an addition of 2s on both sides to
9
+ % overcome boundary effects
10
+ % - tfd_length: set the length to calculate time frequency distribution
11
+ % - MA: struct containing the information to perform a moving average
12
+ % filter over the TFD to overcome fundamental frequency switching
13
+ % - fs: sample frequency
14
+ % - kern_type: specified as a string such as 'wvd' for the wigner ville
15
+ % distribution
16
+ % - kern_params: kernel specifications, not relevant for 'wvd', but they
17
+ % are for 'spwvd', 'swvd' etc.
18
+
19
+ % Output:
20
+ % - HR_smooth_tfd: array containing an estimation of the HR for every 2 s
21
+ % of the relevant epoch (without the additional 2 s on both sides)
22
+
23
+ if ~exist('kern_params', 'var')
24
+ kern_params = {}; % Function also works without having imu_label --> then based on ppg_prob alone!
25
+ end
26
+
27
+ edge_add = 4; % adding an additional 4 sec (2 s to both sides) to overcome boundary effects/discontinuities of the WVD, in SPWVD this effect is already diminished due to a double kernel function
28
+ epoch_length = tfd_length + edge_add;
29
+ segment_length = (length(rel_ppg_tfd)-edge_add*fs)/fs; % substract the 4 added sec to obtain the original segment length
30
+
31
+ if segment_length > epoch_length
32
+ n_segments = floor(segment_length/tfd_length); %% Dit moet aangepast worden!!
33
+ else
34
+ n_segments = 1; % for HR segments which are shorter than 30 s due to uneven start and end of the segment which can make the segment 28 s if 1 s is substracted
35
+ end
36
+
37
+ ppg_segments = cell(n_segments,1);
38
+
39
+ for i = 1:n_segments % Split segments in 30 s PPG epochs
40
+
41
+ if i ~= n_segments
42
+ ppg_segments{i} = rel_ppg_tfd(1 + (i-1)*tfd_length*fs: (i*tfd_length+edge_add)*fs);
43
+
44
+ else
45
+
46
+ ppg_segments{i} = rel_ppg_tfd(1 + (i-1)*tfd_length*fs:end);
47
+
48
+ end
49
+
50
+ end
51
+
52
+ HR_smooth_tfd = [];
53
+
54
+ for j = 1:n_segments % Calculate the HR
55
+ ppg = ppg_segments{j};
56
+ HR_tfd = Long_TFD_JOT(ppg, MA, fs, kern_type, kern_params);
57
+ HR_smooth_tfd = [HR_smooth_tfd; HR_tfd];
58
+ end
59
+
@@ -0,0 +1,4 @@
1
+ todo_list.org
2
+ full_TFDs/full_gdtfd_testing_version.m
3
+ notes_decimated_GDTFD_algorithms.org
4
+ docs_pdf_readme/
@@ -0,0 +1,23 @@
1
+ # Change Log
2
+ All notable changes to this project will be documented in this file. Project started
3
+ 2014-04-22 but this log started 2017-05-30, after version 0.2.3. More details can be found
4
+ in the git logs.
5
+
6
+
7
+ ## unreleased
8
+ ### Changed
9
+ - implemented modified-B distribution in 'nonsep' section,
10
+ e.g. tf=full_tfd(x,'nonsep',{'mb',0.01}); but is better to use lag-independent version,
11
+ i.e. tf=full_tfd(x,'LI,{length(x)-1,'cosh',0.01});
12
+ ### Removed
13
+ ### Fixed
14
+ - input argument (Ntime) when calling LI kernel from full_tfd.m (was incorrectly passing
15
+ Nfreq)
16
+ - bug fix in `gen_lag_kern.m` and `gen_Doppler_kern.m` for windows `gauss`, `cosh`, `tukey` as
17
+ default value was 0; now use Matlab will use default value
18
+ - missing `shiftWin` function (centres window) in `gen_lag_kern.m` and
19
+ `gen_Doppler_kern.m` (only used if 5 parameters in window cell); now added
20
+ ### Added
21
+ - this CHANGELOG.md!
22
+ - windows: `blackmanharris`, `chebwin`, and `nuttall` (in `get_window.m`)
23
+
@@ -0,0 +1,27 @@
1
+ Copyright (c) 2014, John M. O' Toole, University College Cork
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+
10
+ Redistributions in binary form must reproduce the above copyright notice, this
11
+ list of conditions and the following disclaimer in the documentation and/or
12
+ other materials provided with the distribution.
13
+
14
+ Neither the name of the University College Cork nor the names of its
15
+ contributors may be used to endorse or promote products derived from
16
+ this software without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
22
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,251 @@
1
+ # Fast and Memory-Efficient Algorithms for Quadratic Time–Frequency Distributions
2
+
3
+ A collection of M-files to compute time–frequency distributions from the quadratic class
4
+ [[1] and [2]](#references). Memory and computational load is limited by controlling the level of over-sampling for the TFD. Oversampling in the TFD is proportional to signal length and bandwidth of the Doppler–lag kernel. Algorithms are optimised to four kernel types: nonseparable, separable, lag-independent, and Doppler-independent kernels.
5
+
6
+ Also included are algorithms to compute decimated, or sub-sampled, TFDs. Again, these
7
+ algorithms are specific to the four kernel types but compute approximate TFDs by a process
8
+ of decimatation.
9
+
10
+ Requires Matlab or Octave (programming environments).
11
+
12
+ Latest version available at [memeff_TFDs homepage](http://otoolej.github.io/code/memeff_TFDs/).
13
+
14
+
15
+ # Contents
16
+ - [quick start](#quick-start)
17
+ - [description](#description)
18
+ - [files](#files)
19
+ - [computational load](#computational-load)
20
+ - [requirements](#requirements)
21
+ - [test computer setup](#test-computer-setup)
22
+ - [licence](#licence)
23
+ - [references](#references)
24
+ - [contact](#contact)
25
+
26
+
27
+ # quick start
28
+ First, add paths using the `load_curdir` function:
29
+ ```matlab
30
+ >> load_curdir;
31
+ ```
32
+
33
+ # description
34
+
35
+ There are two sets of TFD algorithms: one set computes oversampled TFDs and the other
36
+ set computes decimated (sub-sampled or undersampled) TFDs. The first set, for computing
37
+ oversampled TFDs, has four algorithms for specific kernel types, namely the
38
+ - non-separable kernel,
39
+ - separable kernel,
40
+ - Doppler-independent (DI) kernel,
41
+ - and lag-independent (LI) kernel.
42
+
43
+ The function to generate these oversampled TFDs is `full_tfd.m`. The following
44
+ examples, using a test signal, illustrates usage:
45
+
46
+ ```matlab
47
+ % generate test signal:
48
+ N=512;
49
+ x=gen_LFM(N,0.1,0.3) + gen_LFM(N,0.4,0.04);
50
+
51
+ % nonseparable kernel (Choi-Williams kernel):
52
+ tf=full_tfd(x,'nonsep',{'cw',10});
53
+ figure(1); clf; vtfd(tf,x);
54
+
55
+ % separable kernel:
56
+ tf=full_tfd(x,'sep',{{51,'hann'},{101,'hann'}},256,256);
57
+ figure(2); clf; vtfd(tf,x);
58
+
59
+ % Doppler-independent kernel:
60
+ tf=full_tfd(x,'DI',{101,'hann'},[],256);
61
+ figure(3); clf; vtfd(tf,x);
62
+
63
+ % lag-independent kernel:
64
+ tf=full_tfd(x,'LI',{51,'hann'},256,[]);
65
+ figure(4); clf; vtfd(tf,x);
66
+ ```
67
+ ![Examples of oversampled TFDs](pics/full_TFDs_examples.png)
68
+ Type `help full_tfd` for more details.
69
+
70
+ Likewise, the algorithms for decimated TFDs are specific to the four kernel types. The
71
+ function `dec_tfd` computes the decimated TFDs, as the following examples show:
72
+
73
+ ```matlab
74
+ N=1024; Ntime=64; Nfreq=128;
75
+ a=2; b=2;
76
+ ni=[100:2:900]; ki=[150:2:850];
77
+
78
+ x=gen_LFM(N,0.1,0.3)+gen_LFM(N,0.4,0.1);
79
+
80
+ % non-separable kernel:
81
+ c=dec_tfd(x,'nonsep',{'cw',100},N,N,a*4,b*4);
82
+ figure(1); clf; vtfd(c,x);
83
+
84
+ % separable kernel:
85
+ c=dec_tfd(x,'sep',{{51,'hann'},{101,'hann'}},Ntime,Nfreq,a,b);
86
+ figure(2); clf; vtfd(c,x);
87
+
88
+ % Doppler-independent kernel:
89
+ c=dec_tfd(x,'DI',{101,'hann'},N,Nfreq,ni,b);
90
+ figure(3); clf; vtfd(c,x,1,ni);
91
+
92
+ % lag-independent kernel:
93
+ c=dec_tfd(x,'LI',{51,'hann'},Ntime,N,a,ki);
94
+ figure(4); clf; vtfd(c,x,1,[],ki./(N*2));
95
+ ```
96
+ ![Examples of decimated TFDs](pics/decimated_TFDs_examples.png)
97
+
98
+ Type `help dec_tfd` for more details on this function.
99
+
100
+
101
+ # files
102
+ All Matlab files (.m files) have a description and an example in the header. To read this
103
+ header, type `help <filename.m>` in Matlab. Directory structure is as follows:
104
+ ```
105
+ ├── common # directory: files to generate kernel functions
106
+ ├── decimated_TFDs # directory: files to generate decimated TFD for the 4 kernel types
107
+ ├── dec_tfd.m # file: compute decimated TFDs
108
+ ├── full_tfd.m # file: compute oversampled TFDs
109
+ ├── full_TFDs # directory: files to generate oversampled TFD for the 4 kernel types
110
+ ├── LICENCE.md # file: licence file
111
+ ├── load_curdir.m # file: adds paths for matlab/octave
112
+ ├── README.md # file: this README file
113
+ └── utils # directory: miscellaneous files
114
+ ```
115
+
116
+
117
+ # computational load
118
+
119
+ The computational load is measured in terms of the number of FFTs required to compute the
120
+ TFD. Memory load is measured as the total memory required to compute and store the
121
+ TFD. The real-valued signal (i.e. input signal) is of length N.
122
+
123
+ Computational load for the oversampled TFDs (using `full_tfd.m`) is as follows for the
124
+ four kernel types:
125
+
126
+ | kernel-type | computational load | memory (real-valued points) |
127
+ |---------------|------------------------------|-----------------------------|
128
+ | non-separable | 3N²/2 log₂ N | N² |
129
+ | LI | NNtime/2 log₂ Ntime | Ntime × N |
130
+ | DI | NNfreq/2 log₂ Nfreq | N × Nfreq |
131
+ | separable | Pₕ(N log₂N +Ntime log₂Ntime) | Ntime × Nfreq |
132
+ | | + NtimeNfreq/2 log₂ Nfreq | |
133
+
134
+ assuming the FFT of length-N signal requires Nlog₂N computations and using the notation:
135
+
136
+ | symbol | explanation |
137
+ |--------|-------------------------------------------------------------|
138
+ | N | length of signal |
139
+ | Ntime | length of TFD in time direction |
140
+ | Nfreq | length of TFD in frequency direction |
141
+ | Pₕ | Pₕ = P/2, where P is the length of the lag window |
142
+
143
+ And for the decimated TFDs (using `dec_tfd.m`):
144
+
145
+ | kernel-type | computational load | memory (real-valued points) | grid |
146
+ |---------------|------------------------------|-----------------------------|----------|
147
+ | non-separable | N²/2 log₂ N + LJ/2 log₂ J | L × J | ρ[an,bn] |
148
+ | LI | VLtime/2 log₂ Ltime | Ltime × V | ρ[an,kᵢ] |
149
+ | DI | UJfreq/2 log₂ Jfreq | U × Jfreq | ρ[nᵢ,bk] |
150
+ | separable | JfreqN/2 log₂N | Ltime × Jfreq | ρ[an,bn] |
151
+ | | + LtimeJfreq log₂ LtimeJfreq | | |
152
+
153
+ using the extra notation:
154
+
155
+ | symbol | explanation |
156
+ |--------|-------------------------------------------------------------|
157
+ | U | length of sequence nᵢ {nᵢ for 1<=i<=U}, U<=N and 0<=nᵢ<=N-1 |
158
+ | V | length of sequence kᵢ {kᵢ for 1<=i<=V}, V<=N and 0<=kᵢ<=N-1 |
159
+ | J | N/b, b is decimation integer in frequency direction |
160
+ | L | N/a, a is decimation integer in time direction |
161
+ | Jfreq | Nfreq/b, b is decimation integer in frequency direction |
162
+ | Ltime | Ntime/a, a is decimation integer in time direction |
163
+
164
+
165
+ # requirements
166
+ Either Matlab (R2012 or newer,
167
+ [Mathworks website](http://www.mathworks.co.uk/products/matlab/)) or Octave (v3.6 or
168
+ newer, [Octave website](http://www.gnu.org/software/octave/index.html), with the
169
+ 'octave-signal' add-on package).
170
+
171
+
172
+ # test computer setup
173
+ - hardware: Intel(R) Xeon(R) CPU E5-1603 0 @ 2.80GHz; 8GB memory.
174
+ - operating system: Ubuntu GNU/Linux x86_64 distribution (Trusty Tahr, 14.04), with Linux
175
+ kernel 3.13.0-27-generic
176
+ - software: Octave 3.8.1 (using Gnuplot 4.6 patchlevel 4), with 'octave-signal' toolbox
177
+ and Matlab (R2009b, R2012a, and R2013a)
178
+
179
+ ---
180
+
181
+ # licence
182
+
183
+ ```
184
+ Copyright (c) 2014, John M. O' Toole, University College Cork
185
+ All rights reserved.
186
+
187
+ Redistribution and use in source and binary forms, with or without modification,
188
+ are permitted provided that the following conditions are met:
189
+
190
+ Redistributions of source code must retain the above copyright notice, this
191
+ list of conditions and the following disclaimer.
192
+
193
+ Redistributions in binary form must reproduce the above copyright notice, this
194
+ list of conditions and the following disclaimer in the documentation and/or
195
+ other materials provided with the distribution.
196
+
197
+ Neither the name of the University College Cork nor the names of its
198
+ contributors may be used to endorse or promote products derived from
199
+ this software without specific prior written permission.
200
+
201
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
202
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
203
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
204
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
205
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
206
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
207
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
208
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
209
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
210
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
211
+ ```
212
+
213
+
214
+ # references
215
+
216
+ 1. J.M. O' Toole and B. Boashash, “Memory Efficient Algorithms for Quadratic TFDs”,
217
+ Chapter 6.6; in Time–Frequency Signal Processing and Analysis: A
218
+ Comprenhensive Reference, Second Edition, Academic Press, pp. 374–385, 2016 (ISBN: 9780123984999).
219
+
220
+ 2. J.M. O' Toole and B. Boashash, "Fast and memory-efficient algorithms for computing
221
+ quadratic time–frequency distributions", Applied and Computational Harmonic Analysis,
222
+ vol. 35, no. 2, pp. 350–358, 2013.
223
+
224
+ 3. J.M. Oʼ Toole, M. Mesbah, and B. Boashash, “Improved discrete definition of quadratic
225
+ time–frequency distributions,” IEEE Transactions on Signal Processing, vol. 58,
226
+ Feb. 2010, pp. 906-911.
227
+
228
+ 4. J.M. O' Toole, M. Mesbah, and B. Boashash, "A New Discrete Analytic Signal for Reducing
229
+ Aliasing in the Discrete Wigner-Ville Distribution", IEEE Transactions on Signal
230
+ Processing, vol. 56, no. 11, pp. 5427-5434, Nov. 2008.
231
+
232
+ 5. J.M. Oʼ Toole, M. Mesbah, and B. Boashash, “Algorithms for discrete quadratic
233
+ time–frequency distributions,” WSEAS Transactions on Signal Processing, vol. 4,
234
+ May. 2008, pp. 320-329.
235
+
236
+
237
+ ---
238
+
239
+ # contact
240
+
241
+ John M. O' Toole
242
+
243
+ Neonatal Brain Research Group,
244
+ Irish Centre for Maternal and Child Health Research [(INFANT)](https://www.infantcentre.ie/),
245
+ Department of Paediatrics and Child Health,
246
+ Cork University Hospital,
247
+ University College Cork,
248
+ Ireland
249
+
250
+ - email: jotoole -AT- ucc DOT ie
251
+
@@ -0,0 +1,142 @@
1
+ %-------------------------------------------------------------------------------
2
+ % gen_Doppler_kern: smoothing window for Doppler-kernel G1[l]; checks paramaters
3
+ %
4
+ % Syntax: [G1,Q,Qh_floor,Ntime]=gen_Doppler_kern(win_params,N,Ntime)
5
+ %
6
+ % Input:
7
+ % win_params - cell of {win_length,win_type,[win_param],[Doppler_or_time]}
8
+ % e.g. {11,'hamm',0,1}
9
+ % the parameter 'Doppler_or_time' is either:
10
+ % 0 = to define window in the time-domain
11
+ % 1 = to define window in the Doppler-domain (default)
12
+ % N - length of signal
13
+ % Ntime - number of sample points in the time direction
14
+ %
15
+ % Ouput:
16
+ % G1 - Doppler function G_1(1/(QT))
17
+ % Q - length of G1
18
+ % Ntime - returns Ntime as it may be adjusted from input
19
+ %
20
+ % See also: GEN_LAG_KERN, GEN_DOPPLER_LAG_KERN, GET_WINDOW, PADWIN
21
+ %
22
+ % Example:
23
+ % G1=gen_Doppler_kern({111,'cosh',0.1,1},128,512);
24
+ % plot(real(G1));
25
+ %
26
+ %
27
+ % IF window is defined in doppler domain:
28
+ % window function G_1(l/NT) is length Q
29
+ % OR if window is defined in time domain:
30
+ % window function g_1(nT) is length-Q, and then zero-padded
31
+ % to the doppler domain where G_1(l/NT) is length N
32
+ % ENDIF
33
+
34
+ % John M. O' Toole, University College Cork
35
+ % Started: 16-04-2014
36
+ %
37
+ % last update: Time-stamp: <2021-08-24 17:42:57 (otoolej)>
38
+ %-------------------------------------------------------------------------------
39
+ function [G1,Q,Ntime,G1_pad]=gen_Doppler_kern(win_params,N,Ntime)
40
+ if(nargin<3 || isempty(Ntime)), Ntime=[]; end
41
+
42
+
43
+ DBplot=0;
44
+
45
+
46
+ %---------------------------------------------------------------------
47
+ % 1. make sure parameters are ok
48
+ %---------------------------------------------------------------------
49
+ Q=win_params{1};
50
+ % window length can not be greater than N:
51
+ if(Q>N)
52
+ warning('length of g2 too long: chopping down length N');
53
+ Q=N;
54
+ end
55
+ % force window length to be odd-value:
56
+ if(Q/2==fix(Q/2))
57
+ Q=Q-1;
58
+ warning(['Forcing Q to be odd. Q is now Q=',num2str(Q)]);
59
+ end
60
+ Qh_floor=floor(Q/2);
61
+
62
+
63
+ l=length(win_params);
64
+ if( l<2 )
65
+ error('Need at least two window parameters');
66
+ end
67
+ if(isempty(Ntime)), Ntime=Q+1; end
68
+
69
+ if(Ntime<(Q+1))
70
+ warning('Ntime is too short: increasing length to (Q+1)');
71
+ Ntime=Q+1;
72
+ end
73
+
74
+ % force Ntime to be even
75
+ if(rem(Ntime,2)),
76
+ Ntime=Ntime+1;
77
+ warning(['Forcing Ntime to be even. Ntime is now Ntime=',num2str(Ntime)]);
78
+ end
79
+
80
+
81
+
82
+ %---------------------------------------------------------------------
83
+ % 2. call function to generate window
84
+ %---------------------------------------------------------------------
85
+ win_type=win_params{2};
86
+ if( l>=3 ) win_extra_param=win_params{3}; else, win_extra_param=[]; end
87
+ if( l>3 ) win_dft_param=win_params{4}; else, win_dft_param=1; end
88
+
89
+
90
+ % if define in Doppler domain:
91
+ if(win_dft_param==1)
92
+ G1=get_window(Q,win_type,win_extra_param);
93
+ G1=G1(:);
94
+
95
+ G1_pad=padWin(G1,Ntime);
96
+
97
+
98
+ else
99
+ % or defining window in the time-domain:
100
+ g1=get_window(Q,win_type,win_extra_param,0);
101
+ g1=padWin(g1,N);
102
+ G1_length=N;
103
+
104
+ G1=real( fft(g1) );
105
+ G1=G1./G1(1);
106
+ Ntime=N; Q=N;
107
+ end
108
+
109
+
110
+ %---------------------------------------------------------------------
111
+ % 3. [OPTIONAL] post-process window
112
+ %---------------------------------------------------------------------
113
+ % a. if normalizing window:
114
+ if(length(win_params)>4)
115
+ if(strcmpi(win_params{5},'y')==1)
116
+ G1=G1./sum(G1);
117
+ end
118
+ end
119
+
120
+ % b. if (time) reversing window
121
+ if(length(win_params)>5 )
122
+ G1=shiftWin(G1);
123
+ G1_pad=shiftWin(G1_pad);
124
+ end
125
+
126
+
127
+ if(DBplot)
128
+ figure(20); clf; hold all;
129
+ if(exist('G1_pad','var'))
130
+ subplot(211); plot(G1_pad);
131
+ end
132
+ subplot(212); plot(real(G1));
133
+ end
134
+
135
+
136
+
137
+
138
+ function w=shiftWin(w)
139
+ %---------------------------------------------------------------------
140
+ % shift window to centre
141
+ %---------------------------------------------------------------------
142
+ w=circshift(w(:),ceil(length(w)/2));