paradigma 0.1.5__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.5.dist-info/LICENSE +0 -201
  110. paradigma-0.1.5.dist-info/METADATA +0 -18
  111. paradigma-0.1.5.dist-info/RECORD +0 -6
  112. {paradigma-0.1.5.dist-info → paradigma-0.2.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,37 @@
1
+ function [start_idx, end_idx] = extract_hr_segments(label_arr, threshold)
2
+ % Function which calculates the switches between high and low quality. It
3
+ % calculates the length of the high quality parts and returns the correct
4
+ % data indices for every high quality part longer than a specific threshold!
5
+ % Input:
6
+ % - labelArray: Label array containin of 0 (low-quality) and 1 (high-quality)
7
+ % - threshold: minimal required length for HR analysis (f.e. 30s = 30*fs=
8
+ % 900 samples
9
+
10
+ start_idx = [];
11
+ end_idx = [];
12
+
13
+ label_arr = [0; label_arr; 0]; % padding to find switches if the label starts or ends with high quality label!
14
+
15
+ % Find switches from 0 to 1
16
+ zero_one_switch = find(diff(label_arr) == 1);
17
+
18
+ % Find switches from 1 to 0
19
+ one_zero_switch = find(diff(label_arr) == -1);
20
+
21
+ % Ensure the lengths are the same
22
+ if length(zero_one_switch) ~= length(one_zero_switch)
23
+ error('Invalid label array');
24
+ end
25
+
26
+ % Calculate switch lengths for label 1
27
+ switch_lengths = one_zero_switch - zero_one_switch;
28
+
29
+ % Find switch lengths greater than the threshold
30
+ long_switches = find(switch_lengths >= threshold);
31
+
32
+ % Assign start and end indices for long switches
33
+ for i = 1:length(long_switches)
34
+ start_idx(i) = zero_one_switch(long_switches(i));
35
+ end_idx(i) = one_zero_switch(long_switches(i))-1;
36
+ end
37
+ end
@@ -0,0 +1,23 @@
1
+ function [ppg_indices, imu_indices] = extract_overlapping_segments(t_unix_ppg, t_unix_imu)
2
+ % K.I. Veldkamp, PhD student AI4P, 29-02-24
3
+ % Function to extract indices indicating overlapping data between IMU and
4
+ % PPG segment
5
+
6
+ % Convert UNIX milliseconds to seconds
7
+ ppg_time = t_unix_ppg / 1000; % Convert milliseconds to seconds
8
+ imu_time = t_unix_imu / 1000; % Convert milliseconds to seconds
9
+
10
+ % Determine the overlapping time interval
11
+ start_time = max(ppg_time(1), imu_time(1));
12
+ end_time = min(ppg_time(end), imu_time(end));
13
+
14
+ % Convert overlapping time interval to indices
15
+ ppg_start_index = find(ppg_time >= start_time, 1);
16
+ ppg_end_index = find(ppg_time <= end_time, 1, 'last');
17
+ imu_start_index = find(imu_time >= start_time, 1);
18
+ imu_end_index = find(imu_time <= end_time, 1, 'last');
19
+
20
+ % Extract overlapping segments
21
+ ppg_indices = [ppg_start_index, ppg_end_index];
22
+ imu_indices = [imu_start_index, imu_end_index];
23
+ end
@@ -0,0 +1,41 @@
1
+ The author of "jsonlab" toolbox is Qianqian Fang. Qianqian
2
+ is currently an Assistant Professor at Massachusetts General Hospital,
3
+ Harvard Medical School.
4
+
5
+ Address: Martinos Center for Biomedical Imaging,
6
+ Massachusetts General Hospital,
7
+ Harvard Medical School
8
+ Bldg 149, 13th St, Charlestown, MA 02129, USA
9
+ URL: http://nmr.mgh.harvard.edu/~fangq/
10
+ Email: <fangq at nmr.mgh.harvard.edu> or <fangqq at gmail.com>
11
+
12
+
13
+ The script loadjson.m was built upon previous works by
14
+
15
+ - Nedialko Krouchev: http://www.mathworks.com/matlabcentral/fileexchange/25713
16
+ date: 2009/11/02
17
+ - François Glineur: http://www.mathworks.com/matlabcentral/fileexchange/23393
18
+ date: 2009/03/22
19
+ - Joel Feenstra: http://www.mathworks.com/matlabcentral/fileexchange/20565
20
+ date: 2008/07/03
21
+
22
+
23
+ This toolbox contains patches submitted by the following contributors:
24
+
25
+ - Blake Johnson <bjohnso at bbn.com>
26
+ part of revision 341
27
+
28
+ - Niclas Borlin <Niclas.Borlin at cs.umu.se>
29
+ various fixes in revision 394, including
30
+ - loadjson crashes for all-zero sparse matrix.
31
+ - loadjson crashes for empty sparse matrix.
32
+ - Non-zero size of 0-by-N and N-by-0 empty matrices is lost after savejson/loadjson.
33
+ - loadjson crashes for sparse real column vector.
34
+ - loadjson crashes for sparse complex column vector.
35
+ - Data is corrupted by savejson for sparse real row vector.
36
+ - savejson crashes for sparse complex row vector.
37
+
38
+ - Yul Kang <yul.kang.on at gmail.com>
39
+ patches for svn revision 415.
40
+ - savejson saves an empty cell array as [] instead of null
41
+ - loadjson differentiates an empty struct from an empty array
@@ -0,0 +1,74 @@
1
+ ============================================================================
2
+
3
+ JSONlab - a toolbox to encode/decode JSON/UBJSON files in MATLAB/Octave
4
+
5
+ ----------------------------------------------------------------------------
6
+
7
+ JSONlab ChangeLog (key features marked by *):
8
+
9
+ == JSONlab 1.0 (codename: Optimus - Final), FangQ <fangq (at) nmr.mgh.harvard.edu> ==
10
+
11
+ 2015/01/02 polish help info for all major functions, update examples, finalize 1.0
12
+ 2014/12/19 fix a bug to strictly respect NoRowBracket in savejson
13
+
14
+ == JSONlab 1.0.0-RC2 (codename: Optimus - RC2), FangQ <fangq (at) nmr.mgh.harvard.edu> ==
15
+
16
+ 2014/11/22 show progress bar in loadjson ('ShowProgress')
17
+ 2014/11/17 add Compact option in savejson to output compact JSON format ('Compact')
18
+ 2014/11/17 add FastArrayParser in loadjson to specify fast parser applicable levels
19
+ 2014/09/18 start official github mirror: https://github.com/fangq/jsonlab
20
+
21
+ == JSONlab 1.0.0-RC1 (codename: Optimus - RC1), FangQ <fangq (at) nmr.mgh.harvard.edu> ==
22
+
23
+ 2014/09/17 fix several compatibility issues when running on octave versions 3.2-3.8
24
+ 2014/09/17 support 2D cell and struct arrays in both savejson and saveubjson
25
+ 2014/08/04 escape special characters in a JSON string
26
+ 2014/02/16 fix a bug when saving ubjson files
27
+
28
+ == JSONlab 0.9.9 (codename: Optimus - beta), FangQ <fangq (at) nmr.mgh.harvard.edu> ==
29
+
30
+ 2014/01/22 use binary read and write in saveubjson and loadubjson
31
+
32
+ == JSONlab 0.9.8-1 (codename: Optimus - alpha update 1), FangQ <fangq (at) nmr.mgh.harvard.edu> ==
33
+
34
+ 2013/10/07 better round-trip conservation for empty arrays and structs (patch submitted by Yul Kang)
35
+
36
+ == JSONlab 0.9.8 (codename: Optimus - alpha), FangQ <fangq (at) nmr.mgh.harvard.edu> ==
37
+ 2013/08/23 *universal Binary JSON (UBJSON) support, including both saveubjson and loadubjson
38
+
39
+ == JSONlab 0.9.1 (codename: Rodimus, update 1), FangQ <fangq (at) nmr.mgh.harvard.edu> ==
40
+ 2012/12/18 *handling of various empty and sparse matrices (fixes submitted by Niclas Borlin)
41
+
42
+ == JSONlab 0.9.0 (codename: Rodimus), FangQ <fangq (at) nmr.mgh.harvard.edu> ==
43
+
44
+ 2012/06/17 *new format for an invalid leading char, unpacking hex code in savejson
45
+ 2012/06/01 support JSONP in savejson
46
+ 2012/05/25 fix the empty cell bug (reported by Cyril Davin)
47
+ 2012/04/05 savejson can save to a file (suggested by Patrick Rapin)
48
+
49
+ == JSONlab 0.8.1 (codename: Sentiel, Update 1), FangQ <fangq (at) nmr.mgh.harvard.edu> ==
50
+
51
+ 2012/02/28 loadjson quotation mark escape bug, see http://bit.ly/yyk1nS
52
+ 2012/01/25 patch to handle root-less objects, contributed by Blake Johnson
53
+
54
+ == JSONlab 0.8.0 (codename: Sentiel), FangQ <fangq (at) nmr.mgh.harvard.edu> ==
55
+
56
+ 2012/01/13 *speed up loadjson by 20 fold when parsing large data arrays in matlab
57
+ 2012/01/11 remove row bracket if an array has 1 element, suggested by Mykel Kochenderfer
58
+ 2011/12/22 *accept sequence of 'param',value input in savejson and loadjson
59
+ 2011/11/18 fix struct array bug reported by Mykel Kochenderfer
60
+
61
+ == JSONlab 0.5.1 (codename: Nexus Update 1), FangQ <fangq (at) nmr.mgh.harvard.edu> ==
62
+
63
+ 2011/10/21 fix a bug in loadjson, previous code does not use any of the acceleration
64
+ 2011/10/20 loadjson supports JSON collections - concatenated JSON objects
65
+
66
+ == JSONlab 0.5.0 (codename: Nexus), FangQ <fangq (at) nmr.mgh.harvard.edu> ==
67
+
68
+ 2011/10/16 package and release jsonlab 0.5.0
69
+ 2011/10/15 *add json demo and regression test, support cpx numbers, fix double quote bug
70
+ 2011/10/11 *speed up readjson dramatically, interpret _Array* tags, show data in root level
71
+ 2011/10/10 create jsonlab project, start jsonlab website, add online documentation
72
+ 2011/10/07 *speed up savejson by 25x using sprintf instead of mat2str, add options support
73
+ 2011/10/06 *savejson works for structs, cells and arrays
74
+ 2011/09/09 derive loadjson from JSON parser from MATLAB Central, draft savejson.m
@@ -0,0 +1,25 @@
1
+ Copyright 2011-2015 Qianqian Fang <fangq at nmr.mgh.harvard.edu>. All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are
4
+ permitted provided that the following conditions are met:
5
+
6
+ 1. Redistributions of source code must retain the above copyright notice, this list of
7
+ conditions and the following disclaimer.
8
+
9
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list
10
+ of conditions and the following disclaimer in the documentation and/or other materials
11
+ provided with the distribution.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY EXPRESS OR IMPLIED
14
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
15
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
16
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
18
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
21
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
+
23
+ The views and conclusions contained in the software and documentation are those of the
24
+ authors and should not be interpreted as representing official policies, either expressed
25
+ or implied, of the copyright holders.