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.
- paradigma/__init__.py +1 -3
- paradigma/constants.py +35 -0
- paradigma/feature_extraction.py +678 -0
- paradigma/gait_analysis.py +413 -0
- paradigma/gait_analysis_config.py +244 -0
- paradigma/heart_rate_analysis.py +127 -0
- paradigma/heart_rate_analysis_config.py +9 -0
- paradigma/heart_rate_util.py +173 -0
- paradigma/imu_preprocessing.py +229 -0
- paradigma/ppg/classifier/LR_PPG_quality.pkl +0 -0
- paradigma/ppg/classifier/LR_model.mat +0 -0
- paradigma/ppg/feat_extraction/acc_feature.m +20 -0
- paradigma/ppg/feat_extraction/peakdet.m +64 -0
- paradigma/ppg/feat_extraction/ppg_features.m +53 -0
- paradigma/ppg/glob_functions/extract_hr_segments.m +37 -0
- paradigma/ppg/glob_functions/extract_overlapping_segments.m +23 -0
- paradigma/ppg/glob_functions/jsonlab/AUTHORS.txt +41 -0
- paradigma/ppg/glob_functions/jsonlab/ChangeLog.txt +74 -0
- paradigma/ppg/glob_functions/jsonlab/LICENSE_BSD.txt +25 -0
- paradigma/ppg/glob_functions/jsonlab/LICENSE_GPLv3.txt +699 -0
- paradigma/ppg/glob_functions/jsonlab/README.txt +394 -0
- paradigma/ppg/glob_functions/jsonlab/examples/.svn/entries +368 -0
- paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/demo_jsonlab_basic.m.svn-base +180 -0
- paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/demo_ubjson_basic.m.svn-base +180 -0
- paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example1.json.svn-base +23 -0
- paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example2.json.svn-base +22 -0
- paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example3.json.svn-base +11 -0
- paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example4.json.svn-base +34 -0
- paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_basictest.matlab.svn-base +662 -0
- paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_selftest.m.svn-base +27 -0
- paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_selftest.matlab.svn-base +144 -0
- paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_speedtest.m.svn-base +21 -0
- paradigma/ppg/glob_functions/jsonlab/examples/demo_jsonlab_basic.m +180 -0
- paradigma/ppg/glob_functions/jsonlab/examples/demo_ubjson_basic.m +180 -0
- paradigma/ppg/glob_functions/jsonlab/examples/example1.json +23 -0
- paradigma/ppg/glob_functions/jsonlab/examples/example2.json +22 -0
- paradigma/ppg/glob_functions/jsonlab/examples/example3.json +11 -0
- paradigma/ppg/glob_functions/jsonlab/examples/example4.json +34 -0
- paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_basictest.matlab +662 -0
- paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_selftest.m +27 -0
- paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_selftest.matlab +144 -0
- paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_speedtest.m +21 -0
- paradigma/ppg/glob_functions/jsonlab/jsonopt.m +32 -0
- paradigma/ppg/glob_functions/jsonlab/loadjson.m +566 -0
- paradigma/ppg/glob_functions/jsonlab/loadubjson.m +528 -0
- paradigma/ppg/glob_functions/jsonlab/mergestruct.m +33 -0
- paradigma/ppg/glob_functions/jsonlab/savejson.m +475 -0
- paradigma/ppg/glob_functions/jsonlab/saveubjson.m +504 -0
- paradigma/ppg/glob_functions/jsonlab/varargin2struct.m +40 -0
- paradigma/ppg/glob_functions/sample_prob_final.m +49 -0
- paradigma/ppg/glob_functions/synchronization.m +76 -0
- paradigma/ppg/glob_functions/tsdf_scan_meta.m +22 -0
- paradigma/ppg/hr_functions/Long_TFD_JOT.m +37 -0
- paradigma/ppg/hr_functions/PPG_TFD_HR.m +59 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/.gitignore +4 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/CHANGELOG.md +23 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/LICENCE.md +27 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/README.md +251 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/README.pdf +0 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/common/gen_Doppler_kern.m +142 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/common/gen_Doppler_lag_kern.m +314 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/common/gen_lag_kern.m +123 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/dec_tfd.m +154 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_di_gdtfd.m +194 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_li_gdtfd.m +200 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_nonsep_gdtfd.m +229 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_sep_gdtfd.m +241 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/di_gdtfd.m +157 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/li_gdtfd.m +190 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/nonsep_gdtfd.m +196 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/sep_gdtfd.m +199 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/full_tfd.m +144 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/load_curdir.m +13 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/pics/decimated_TFDs_examples.png +0 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/pics/full_TFDs_examples.png +0 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/utils/check_dec_params_seq.m +79 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/utils/dispEE.m +9 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/utils/dispVars.m +26 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/utils/disp_bytes.m +25 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/utils/fold_vector_full.m +40 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/utils/fold_vector_half.m +34 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/utils/gen_LFM.m +29 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/utils/get_analytic_signal.m +76 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/utils/get_window.m +176 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/utils/isreal_fn.m +11 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/utils/padWin.m +97 -0
- paradigma/ppg/hr_functions/TFD toolbox JOT/utils/vtfd.m +149 -0
- paradigma/ppg/preprocessing/preprocessing_imu.m +15 -0
- paradigma/ppg/preprocessing/preprocessing_ppg.m +13 -0
- paradigma/ppg_preprocessing.py +313 -0
- paradigma/preprocessing_config.py +64 -0
- paradigma/quantification.py +58 -0
- paradigma/tremor/TremorFeaturesAndClassification.m +345 -0
- paradigma/tremor/feat_extraction/DerivativesExtract.m +22 -0
- paradigma/tremor/feat_extraction/ExtractBandSignalsRMS.m +72 -0
- paradigma/tremor/feat_extraction/MFCCExtract.m +100 -0
- paradigma/tremor/feat_extraction/PSDBandPower.m +52 -0
- paradigma/tremor/feat_extraction/PSDEst.m +63 -0
- paradigma/tremor/feat_extraction/PSDExtrAxis.m +88 -0
- paradigma/tremor/feat_extraction/PSDExtrOpt.m +95 -0
- paradigma/tremor/preprocessing/InterpData.m +32 -0
- paradigma/tremor/weekly_aggregates/WeeklyAggregates.m +295 -0
- paradigma/util.py +50 -0
- paradigma/windowing.py +217 -0
- paradigma-0.2.0.dist-info/LICENSE +192 -0
- paradigma-0.2.0.dist-info/METADATA +58 -0
- paradigma-0.2.0.dist-info/RECORD +108 -0
- paradigma/dummy.py +0 -3
- paradigma-0.1.2.dist-info/LICENSE +0 -201
- paradigma-0.1.2.dist-info/METADATA +0 -18
- paradigma-0.1.2.dist-info/RECORD +0 -6
- {paradigma-0.1.2.dist-info → paradigma-0.2.0.dist-info}/WHEEL +0 -0
paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_basictest.matlab.svn-base
ADDED
|
@@ -0,0 +1,662 @@
|
|
|
1
|
+
|
|
2
|
+
< M A T L A B >
|
|
3
|
+
Copyright 1984-2007 The MathWorks, Inc.
|
|
4
|
+
Version 7.4.0.287 (R2007a)
|
|
5
|
+
January 29, 2007
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
To get started, type one of these: helpwin, helpdesk, or demo.
|
|
9
|
+
For product information, visit www.mathworks.com.
|
|
10
|
+
|
|
11
|
+
>> >> >> >> >> >> >> >> >>
|
|
12
|
+
%=================================================
|
|
13
|
+
>> % a simple scalar value
|
|
14
|
+
>> %=================================================
|
|
15
|
+
|
|
16
|
+
>> >>
|
|
17
|
+
data2json =
|
|
18
|
+
|
|
19
|
+
3.1416
|
|
20
|
+
|
|
21
|
+
>>
|
|
22
|
+
ans =
|
|
23
|
+
|
|
24
|
+
[3.141592654]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
>>
|
|
28
|
+
json2data =
|
|
29
|
+
|
|
30
|
+
3.1416
|
|
31
|
+
|
|
32
|
+
>> >>
|
|
33
|
+
%=================================================
|
|
34
|
+
>> % a complex number
|
|
35
|
+
>> %=================================================
|
|
36
|
+
|
|
37
|
+
>> >> >>
|
|
38
|
+
data2json =
|
|
39
|
+
|
|
40
|
+
1.0000 + 2.0000i
|
|
41
|
+
|
|
42
|
+
>>
|
|
43
|
+
ans =
|
|
44
|
+
|
|
45
|
+
{
|
|
46
|
+
"_ArrayType_": "double",
|
|
47
|
+
"_ArraySize_": [1,1],
|
|
48
|
+
"_ArrayIsComplex_": 1,
|
|
49
|
+
"_ArrayData_": [1,2]
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
>>
|
|
54
|
+
json2data =
|
|
55
|
+
|
|
56
|
+
1.0000 + 2.0000i
|
|
57
|
+
|
|
58
|
+
>> >>
|
|
59
|
+
%=================================================
|
|
60
|
+
>> % a complex matrix
|
|
61
|
+
>> %=================================================
|
|
62
|
+
|
|
63
|
+
>> >> >>
|
|
64
|
+
data2json =
|
|
65
|
+
|
|
66
|
+
35.0000 +26.0000i 1.0000 +19.0000i 6.0000 +24.0000i
|
|
67
|
+
3.0000 +21.0000i 32.0000 +23.0000i 7.0000 +25.0000i
|
|
68
|
+
31.0000 +22.0000i 9.0000 +27.0000i 2.0000 +20.0000i
|
|
69
|
+
8.0000 +17.0000i 28.0000 +10.0000i 33.0000 +15.0000i
|
|
70
|
+
30.0000 +12.0000i 5.0000 +14.0000i 34.0000 +16.0000i
|
|
71
|
+
4.0000 +13.0000i 36.0000 +18.0000i 29.0000 +11.0000i
|
|
72
|
+
|
|
73
|
+
>>
|
|
74
|
+
ans =
|
|
75
|
+
|
|
76
|
+
{
|
|
77
|
+
"_ArrayType_": "double",
|
|
78
|
+
"_ArraySize_": [6,3],
|
|
79
|
+
"_ArrayIsComplex_": 1,
|
|
80
|
+
"_ArrayData_": [
|
|
81
|
+
[35,26],
|
|
82
|
+
[3,21],
|
|
83
|
+
[31,22],
|
|
84
|
+
[8,17],
|
|
85
|
+
[30,12],
|
|
86
|
+
[4,13],
|
|
87
|
+
[1,19],
|
|
88
|
+
[32,23],
|
|
89
|
+
[9,27],
|
|
90
|
+
[28,10],
|
|
91
|
+
[5,14],
|
|
92
|
+
[36,18],
|
|
93
|
+
[6,24],
|
|
94
|
+
[7,25],
|
|
95
|
+
[2,20],
|
|
96
|
+
[33,15],
|
|
97
|
+
[34,16],
|
|
98
|
+
[29,11]
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
>>
|
|
104
|
+
json2data =
|
|
105
|
+
|
|
106
|
+
35.0000 +26.0000i 1.0000 +19.0000i 6.0000 +24.0000i
|
|
107
|
+
3.0000 +21.0000i 32.0000 +23.0000i 7.0000 +25.0000i
|
|
108
|
+
31.0000 +22.0000i 9.0000 +27.0000i 2.0000 +20.0000i
|
|
109
|
+
8.0000 +17.0000i 28.0000 +10.0000i 33.0000 +15.0000i
|
|
110
|
+
30.0000 +12.0000i 5.0000 +14.0000i 34.0000 +16.0000i
|
|
111
|
+
4.0000 +13.0000i 36.0000 +18.0000i 29.0000 +11.0000i
|
|
112
|
+
|
|
113
|
+
>> >>
|
|
114
|
+
%=================================================
|
|
115
|
+
>> % MATLAB special constants
|
|
116
|
+
>> %=================================================
|
|
117
|
+
|
|
118
|
+
>> >>
|
|
119
|
+
data2json =
|
|
120
|
+
|
|
121
|
+
NaN Inf -Inf
|
|
122
|
+
|
|
123
|
+
>>
|
|
124
|
+
ans =
|
|
125
|
+
|
|
126
|
+
{
|
|
127
|
+
"specials": ["_NaN_","_Inf_","-_Inf_"]
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
>>
|
|
132
|
+
json2data =
|
|
133
|
+
|
|
134
|
+
specials: [NaN Inf -Inf]
|
|
135
|
+
|
|
136
|
+
>> >>
|
|
137
|
+
%=================================================
|
|
138
|
+
>> % a real sparse matrix
|
|
139
|
+
>> %=================================================
|
|
140
|
+
|
|
141
|
+
>> >>
|
|
142
|
+
data2json =
|
|
143
|
+
|
|
144
|
+
(1,2) 0.6557
|
|
145
|
+
(9,2) 0.7577
|
|
146
|
+
(3,5) 0.8491
|
|
147
|
+
(10,5) 0.7431
|
|
148
|
+
(10,8) 0.3922
|
|
149
|
+
(7,9) 0.6787
|
|
150
|
+
(2,10) 0.0357
|
|
151
|
+
(6,10) 0.9340
|
|
152
|
+
(10,10) 0.6555
|
|
153
|
+
|
|
154
|
+
>>
|
|
155
|
+
ans =
|
|
156
|
+
|
|
157
|
+
{
|
|
158
|
+
"sparse": {
|
|
159
|
+
"_ArrayType_": "double",
|
|
160
|
+
"_ArraySize_": [10,10],
|
|
161
|
+
"_ArrayIsSparse_": 1,
|
|
162
|
+
"_ArrayData_": [
|
|
163
|
+
[1,2,0.6557406992],
|
|
164
|
+
[9,2,0.7577401306],
|
|
165
|
+
[3,5,0.8491293059],
|
|
166
|
+
[10,5,0.7431324681],
|
|
167
|
+
[10,8,0.3922270195],
|
|
168
|
+
[7,9,0.6787351549],
|
|
169
|
+
[2,10,0.03571167857],
|
|
170
|
+
[6,10,0.9339932478],
|
|
171
|
+
[10,10,0.6554778902]
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
>>
|
|
178
|
+
json2data =
|
|
179
|
+
|
|
180
|
+
sparse: [10x10 double]
|
|
181
|
+
|
|
182
|
+
>> >>
|
|
183
|
+
%=================================================
|
|
184
|
+
>> % a complex sparse matrix
|
|
185
|
+
>> %=================================================
|
|
186
|
+
|
|
187
|
+
>> >>
|
|
188
|
+
data2json =
|
|
189
|
+
|
|
190
|
+
(1,2) 0.6557 - 0.6557i
|
|
191
|
+
(9,2) 0.7577 - 0.7577i
|
|
192
|
+
(3,5) 0.8491 - 0.8491i
|
|
193
|
+
(10,5) 0.7431 - 0.7431i
|
|
194
|
+
(10,8) 0.3922 - 0.3922i
|
|
195
|
+
(7,9) 0.6787 - 0.6787i
|
|
196
|
+
(2,10) 0.0357 - 0.0357i
|
|
197
|
+
(6,10) 0.9340 - 0.9340i
|
|
198
|
+
(10,10) 0.6555 - 0.6555i
|
|
199
|
+
|
|
200
|
+
>>
|
|
201
|
+
ans =
|
|
202
|
+
|
|
203
|
+
{
|
|
204
|
+
"complex_sparse": {
|
|
205
|
+
"_ArrayType_": "double",
|
|
206
|
+
"_ArraySize_": [10,10],
|
|
207
|
+
"_ArrayIsComplex_": 1,
|
|
208
|
+
"_ArrayIsSparse_": 1,
|
|
209
|
+
"_ArrayData_": [
|
|
210
|
+
[1,2,0.6557406992,-0.6557406992],
|
|
211
|
+
[9,2,0.7577401306,-0.7577401306],
|
|
212
|
+
[3,5,0.8491293059,-0.8491293059],
|
|
213
|
+
[10,5,0.7431324681,-0.7431324681],
|
|
214
|
+
[10,8,0.3922270195,-0.3922270195],
|
|
215
|
+
[7,9,0.6787351549,-0.6787351549],
|
|
216
|
+
[2,10,0.03571167857,-0.03571167857],
|
|
217
|
+
[6,10,0.9339932478,-0.9339932478],
|
|
218
|
+
[10,10,0.6554778902,-0.6554778902]
|
|
219
|
+
]
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
>>
|
|
225
|
+
json2data =
|
|
226
|
+
|
|
227
|
+
complex_sparse: [10x10 double]
|
|
228
|
+
|
|
229
|
+
>> >>
|
|
230
|
+
%=================================================
|
|
231
|
+
>> % an all-zero sparse matrix
|
|
232
|
+
>> %=================================================
|
|
233
|
+
|
|
234
|
+
>> >> >>
|
|
235
|
+
ans =
|
|
236
|
+
|
|
237
|
+
{
|
|
238
|
+
"all_zero_sparse": {
|
|
239
|
+
"_ArrayType_": "double",
|
|
240
|
+
"_ArraySize_": [2,3],
|
|
241
|
+
"_ArrayIsSparse_": 1,
|
|
242
|
+
"_ArrayData_": null
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
>>
|
|
248
|
+
json2data =
|
|
249
|
+
|
|
250
|
+
all_zero_sparse: [2x3 double]
|
|
251
|
+
|
|
252
|
+
>> >>
|
|
253
|
+
%=================================================
|
|
254
|
+
>> % an empty sparse matrix
|
|
255
|
+
>> %=================================================
|
|
256
|
+
|
|
257
|
+
>> >> >>
|
|
258
|
+
ans =
|
|
259
|
+
|
|
260
|
+
{
|
|
261
|
+
"empty_sparse": {
|
|
262
|
+
"_ArrayType_": "double",
|
|
263
|
+
"_ArraySize_": [0,0],
|
|
264
|
+
"_ArrayIsSparse_": 1,
|
|
265
|
+
"_ArrayData_": null
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
>>
|
|
271
|
+
json2data =
|
|
272
|
+
|
|
273
|
+
empty_sparse: []
|
|
274
|
+
|
|
275
|
+
>> >>
|
|
276
|
+
%=================================================
|
|
277
|
+
>> % an empty 0-by-0 real matrix
|
|
278
|
+
>> %=================================================
|
|
279
|
+
|
|
280
|
+
>> >> >>
|
|
281
|
+
ans =
|
|
282
|
+
|
|
283
|
+
{
|
|
284
|
+
"empty_0by0_real": {
|
|
285
|
+
"_ArrayType_": "double",
|
|
286
|
+
"_ArraySize_": [0,0],
|
|
287
|
+
"_ArrayData_": null
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
>>
|
|
293
|
+
json2data =
|
|
294
|
+
|
|
295
|
+
empty_0by0_real: []
|
|
296
|
+
|
|
297
|
+
>> >>
|
|
298
|
+
%=================================================
|
|
299
|
+
>> % an empty 0-by-3 real matrix
|
|
300
|
+
>> %=================================================
|
|
301
|
+
|
|
302
|
+
>> >> >>
|
|
303
|
+
ans =
|
|
304
|
+
|
|
305
|
+
{
|
|
306
|
+
"empty_0by3_real": {
|
|
307
|
+
"_ArrayType_": "double",
|
|
308
|
+
"_ArraySize_": [0,3],
|
|
309
|
+
"_ArrayData_": null
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
>>
|
|
315
|
+
json2data =
|
|
316
|
+
|
|
317
|
+
empty_0by3_real: [0x3 double]
|
|
318
|
+
|
|
319
|
+
>> >>
|
|
320
|
+
%=================================================
|
|
321
|
+
>> % a sparse real column vector
|
|
322
|
+
>> %=================================================
|
|
323
|
+
|
|
324
|
+
>> >> >>
|
|
325
|
+
ans =
|
|
326
|
+
|
|
327
|
+
{
|
|
328
|
+
"sparse_column_vector": {
|
|
329
|
+
"_ArrayType_": "double",
|
|
330
|
+
"_ArraySize_": [5,1],
|
|
331
|
+
"_ArrayIsSparse_": 1,
|
|
332
|
+
"_ArrayData_": [
|
|
333
|
+
[2,3],
|
|
334
|
+
[4,1],
|
|
335
|
+
[5,4]
|
|
336
|
+
]
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
>>
|
|
342
|
+
json2data =
|
|
343
|
+
|
|
344
|
+
sparse_column_vector: [5x1 double]
|
|
345
|
+
|
|
346
|
+
>> >>
|
|
347
|
+
%=================================================
|
|
348
|
+
>> % a sparse complex column vector
|
|
349
|
+
>> %=================================================
|
|
350
|
+
|
|
351
|
+
>> >> >>
|
|
352
|
+
ans =
|
|
353
|
+
|
|
354
|
+
{
|
|
355
|
+
"complex_sparse_column_vector": {
|
|
356
|
+
"_ArrayType_": "double",
|
|
357
|
+
"_ArraySize_": [5,1],
|
|
358
|
+
"_ArrayIsComplex_": 1,
|
|
359
|
+
"_ArrayIsSparse_": 1,
|
|
360
|
+
"_ArrayData_": [
|
|
361
|
+
[2,3,-3],
|
|
362
|
+
[4,1,-1],
|
|
363
|
+
[5,4,-4]
|
|
364
|
+
]
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
>>
|
|
370
|
+
json2data =
|
|
371
|
+
|
|
372
|
+
complex_sparse_column_vector: [5x1 double]
|
|
373
|
+
|
|
374
|
+
>> >>
|
|
375
|
+
%=================================================
|
|
376
|
+
>> % a sparse real row vector
|
|
377
|
+
>> %=================================================
|
|
378
|
+
|
|
379
|
+
>> >> >>
|
|
380
|
+
ans =
|
|
381
|
+
|
|
382
|
+
{
|
|
383
|
+
"sparse_row_vector": {
|
|
384
|
+
"_ArrayType_": "double",
|
|
385
|
+
"_ArraySize_": [1,5],
|
|
386
|
+
"_ArrayIsSparse_": 1,
|
|
387
|
+
"_ArrayData_": [
|
|
388
|
+
[2,3],
|
|
389
|
+
[4,1],
|
|
390
|
+
[5,4]
|
|
391
|
+
]
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
>>
|
|
397
|
+
json2data =
|
|
398
|
+
|
|
399
|
+
sparse_row_vector: [0 3 0 1 4]
|
|
400
|
+
|
|
401
|
+
>> >>
|
|
402
|
+
%=================================================
|
|
403
|
+
>> % a sparse complex row vector
|
|
404
|
+
>> %=================================================
|
|
405
|
+
|
|
406
|
+
>> >> >>
|
|
407
|
+
ans =
|
|
408
|
+
|
|
409
|
+
{
|
|
410
|
+
"complex_sparse_row_vector": {
|
|
411
|
+
"_ArrayType_": "double",
|
|
412
|
+
"_ArraySize_": [1,5],
|
|
413
|
+
"_ArrayIsComplex_": 1,
|
|
414
|
+
"_ArrayIsSparse_": 1,
|
|
415
|
+
"_ArrayData_": [
|
|
416
|
+
[2,3,-3],
|
|
417
|
+
[4,1,-1],
|
|
418
|
+
[5,4,-4]
|
|
419
|
+
]
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
>>
|
|
425
|
+
json2data =
|
|
426
|
+
|
|
427
|
+
complex_sparse_row_vector: [1x5 double]
|
|
428
|
+
|
|
429
|
+
>> >>
|
|
430
|
+
%=================================================
|
|
431
|
+
>> % a structure
|
|
432
|
+
>> %=================================================
|
|
433
|
+
|
|
434
|
+
>> >>
|
|
435
|
+
data2json =
|
|
436
|
+
|
|
437
|
+
name: 'Think Different'
|
|
438
|
+
year: 1997
|
|
439
|
+
magic: [3x3 double]
|
|
440
|
+
misfits: [Inf NaN]
|
|
441
|
+
embedded: [1x1 struct]
|
|
442
|
+
|
|
443
|
+
>>
|
|
444
|
+
ans =
|
|
445
|
+
|
|
446
|
+
{
|
|
447
|
+
"astruct": {
|
|
448
|
+
"name": "Think Different",
|
|
449
|
+
"year": 1997,
|
|
450
|
+
"magic": [
|
|
451
|
+
[8,1,6],
|
|
452
|
+
[3,5,7],
|
|
453
|
+
[4,9,2]
|
|
454
|
+
],
|
|
455
|
+
"misfits": ["_Inf_","_NaN_"],
|
|
456
|
+
"embedded": {
|
|
457
|
+
"left": true,
|
|
458
|
+
"right": false
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
>>
|
|
465
|
+
json2data =
|
|
466
|
+
|
|
467
|
+
astruct: [1x1 struct]
|
|
468
|
+
|
|
469
|
+
>> >>
|
|
470
|
+
%=================================================
|
|
471
|
+
>> % a structure array
|
|
472
|
+
>> %=================================================
|
|
473
|
+
|
|
474
|
+
>> >> >> >> >>
|
|
475
|
+
ans =
|
|
476
|
+
|
|
477
|
+
{
|
|
478
|
+
"Supreme Commander": [
|
|
479
|
+
{
|
|
480
|
+
"name": "Nexus Prime",
|
|
481
|
+
"rank": 9
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
"name": "Sentinel Prime",
|
|
485
|
+
"rank": 9
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
"name": "Optimus Prime",
|
|
489
|
+
"rank": 9
|
|
490
|
+
}
|
|
491
|
+
]
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
>>
|
|
496
|
+
json2data =
|
|
497
|
+
|
|
498
|
+
Supreme_0x20_Commander: {[1x1 struct] [1x1 struct] [1x1 struct]}
|
|
499
|
+
|
|
500
|
+
>> >>
|
|
501
|
+
%=================================================
|
|
502
|
+
>> % a cell array
|
|
503
|
+
>> %=================================================
|
|
504
|
+
|
|
505
|
+
>> >> >> >> >>
|
|
506
|
+
data2json =
|
|
507
|
+
|
|
508
|
+
[1x1 struct]
|
|
509
|
+
[1x1 struct]
|
|
510
|
+
[1x4 double]
|
|
511
|
+
|
|
512
|
+
>>
|
|
513
|
+
ans =
|
|
514
|
+
|
|
515
|
+
{
|
|
516
|
+
"debian": [
|
|
517
|
+
[
|
|
518
|
+
{
|
|
519
|
+
"buzz": 1.10,
|
|
520
|
+
"rex": 1.20,
|
|
521
|
+
"bo": 1.30,
|
|
522
|
+
"hamm": 2.00,
|
|
523
|
+
"slink": 2.10,
|
|
524
|
+
"potato": 2.20,
|
|
525
|
+
"woody": 3.00,
|
|
526
|
+
"sarge": 3.10,
|
|
527
|
+
"etch": 4.00,
|
|
528
|
+
"lenny": 5.00,
|
|
529
|
+
"squeeze": 6.00,
|
|
530
|
+
"wheezy": 7.00
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
"Ubuntu": [
|
|
534
|
+
"Kubuntu",
|
|
535
|
+
"Xubuntu",
|
|
536
|
+
"Lubuntu"
|
|
537
|
+
]
|
|
538
|
+
},
|
|
539
|
+
[10.04,10.10,11.04,11.10]
|
|
540
|
+
]
|
|
541
|
+
]
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
>>
|
|
546
|
+
json2data =
|
|
547
|
+
|
|
548
|
+
debian: {{1x3 cell}}
|
|
549
|
+
|
|
550
|
+
>> >>
|
|
551
|
+
%=================================================
|
|
552
|
+
>> % invalid field-name handling
|
|
553
|
+
>> %=================================================
|
|
554
|
+
|
|
555
|
+
>> >>
|
|
556
|
+
json2data =
|
|
557
|
+
|
|
558
|
+
ValidName: 1
|
|
559
|
+
x0x5F_InvalidName: 2
|
|
560
|
+
x0x3A_Field_0x3A_: 3
|
|
561
|
+
x0xE9A1B9__0xE79BAE_: '绝密'
|
|
562
|
+
|
|
563
|
+
>> >>
|
|
564
|
+
%=================================================
|
|
565
|
+
>> % a 2D cell array
|
|
566
|
+
>> %=================================================
|
|
567
|
+
|
|
568
|
+
>> >> >>
|
|
569
|
+
ans =
|
|
570
|
+
|
|
571
|
+
{
|
|
572
|
+
"data2json": [
|
|
573
|
+
[
|
|
574
|
+
[
|
|
575
|
+
1,
|
|
576
|
+
[
|
|
577
|
+
2,
|
|
578
|
+
3
|
|
579
|
+
]
|
|
580
|
+
],
|
|
581
|
+
7
|
|
582
|
+
],
|
|
583
|
+
[
|
|
584
|
+
[
|
|
585
|
+
4,
|
|
586
|
+
5
|
|
587
|
+
],
|
|
588
|
+
[
|
|
589
|
+
8,
|
|
590
|
+
9
|
|
591
|
+
]
|
|
592
|
+
],
|
|
593
|
+
[
|
|
594
|
+
6,
|
|
595
|
+
10
|
|
596
|
+
]
|
|
597
|
+
]
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
>>
|
|
602
|
+
json2data =
|
|
603
|
+
|
|
604
|
+
data2json: {{1x2 cell} [2x2 double] [6 10]}
|
|
605
|
+
|
|
606
|
+
>> >>
|
|
607
|
+
%=================================================
|
|
608
|
+
>> % a 2D struct array
|
|
609
|
+
>> %=================================================
|
|
610
|
+
|
|
611
|
+
>> >>
|
|
612
|
+
data2json =
|
|
613
|
+
|
|
614
|
+
2x3 struct array with fields:
|
|
615
|
+
idx
|
|
616
|
+
data
|
|
617
|
+
|
|
618
|
+
>> >>
|
|
619
|
+
ans =
|
|
620
|
+
|
|
621
|
+
{
|
|
622
|
+
"data2json": [
|
|
623
|
+
[
|
|
624
|
+
{
|
|
625
|
+
"idx": 1,
|
|
626
|
+
"data": "structs"
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
"idx": 2,
|
|
630
|
+
"data": "structs"
|
|
631
|
+
}
|
|
632
|
+
],
|
|
633
|
+
[
|
|
634
|
+
{
|
|
635
|
+
"idx": 3,
|
|
636
|
+
"data": "structs"
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
"idx": 4,
|
|
640
|
+
"data": "structs"
|
|
641
|
+
}
|
|
642
|
+
],
|
|
643
|
+
[
|
|
644
|
+
{
|
|
645
|
+
"idx": 5,
|
|
646
|
+
"data": "structs"
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
"idx": 6,
|
|
650
|
+
"data": "structs"
|
|
651
|
+
}
|
|
652
|
+
]
|
|
653
|
+
]
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
>>
|
|
658
|
+
json2data =
|
|
659
|
+
|
|
660
|
+
data2json: {{1x2 cell} {1x2 cell} {1x2 cell}}
|
|
661
|
+
|
|
662
|
+
>> >> >> >>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
2
|
+
% Regression Test Unit of loadjson and savejson
|
|
3
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
4
|
+
|
|
5
|
+
for i=1:4
|
|
6
|
+
fname=sprintf('example%d.json',i);
|
|
7
|
+
if(exist(fname,'file')==0) break; end
|
|
8
|
+
fprintf(1,'===============================================\n>> %s\n',fname);
|
|
9
|
+
json=savejson('data',loadjson(fname));
|
|
10
|
+
fprintf(1,'%s\n',json);
|
|
11
|
+
fprintf(1,'%s\n',savejson('data',loadjson(fname),'Compact',1));
|
|
12
|
+
data=loadjson(json);
|
|
13
|
+
savejson('data',data,'selftest.json');
|
|
14
|
+
data=loadjson('selftest.json');
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
for i=1:4
|
|
18
|
+
fname=sprintf('example%d.json',i);
|
|
19
|
+
if(exist(fname,'file')==0) break; end
|
|
20
|
+
fprintf(1,'===============================================\n>> %s\n',fname);
|
|
21
|
+
json=saveubjson('data',loadjson(fname));
|
|
22
|
+
fprintf(1,'%s\n',json);
|
|
23
|
+
data=loadubjson(json);
|
|
24
|
+
savejson('',data);
|
|
25
|
+
saveubjson('data',data,'selftest.ubj');
|
|
26
|
+
data=loadubjson('selftest.ubj');
|
|
27
|
+
end
|