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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. paradigma/assets/gait_detection_clf_package.pkl +0 -0
  2. paradigma/assets/gait_filtering_clf_package.pkl +0 -0
  3. paradigma/assets/ppg_quality_clf_package.pkl +0 -0
  4. paradigma/assets/tremor_detection_clf_package.pkl +0 -0
  5. paradigma/classification.py +115 -0
  6. paradigma/config.py +314 -0
  7. paradigma/constants.py +48 -7
  8. paradigma/feature_extraction.py +811 -547
  9. paradigma/pipelines/__init__.py +0 -0
  10. paradigma/pipelines/gait_pipeline.py +727 -0
  11. paradigma/pipelines/heart_rate_pipeline.py +426 -0
  12. paradigma/pipelines/heart_rate_utils.py +780 -0
  13. paradigma/pipelines/tremor_pipeline.py +299 -0
  14. paradigma/preprocessing.py +363 -0
  15. paradigma/segmenting.py +396 -0
  16. paradigma/testing.py +416 -0
  17. paradigma/util.py +393 -16
  18. paradigma-0.4.1.dist-info/METADATA +138 -0
  19. paradigma-0.4.1.dist-info/RECORD +22 -0
  20. {paradigma-0.3.2.dist-info → paradigma-0.4.1.dist-info}/WHEEL +1 -1
  21. paradigma/gait_analysis.py +0 -415
  22. paradigma/gait_analysis_config.py +0 -266
  23. paradigma/heart_rate_analysis.py +0 -127
  24. paradigma/heart_rate_analysis_config.py +0 -9
  25. paradigma/heart_rate_util.py +0 -173
  26. paradigma/imu_preprocessing.py +0 -232
  27. paradigma/ppg/classifier/LR_PPG_quality.pkl +0 -0
  28. paradigma/ppg/classifier/LR_model.mat +0 -0
  29. paradigma/ppg/feat_extraction/acc_feature.m +0 -20
  30. paradigma/ppg/feat_extraction/peakdet.m +0 -64
  31. paradigma/ppg/feat_extraction/ppg_features.m +0 -53
  32. paradigma/ppg/glob_functions/extract_hr_segments.m +0 -37
  33. paradigma/ppg/glob_functions/extract_overlapping_segments.m +0 -23
  34. paradigma/ppg/glob_functions/jsonlab/AUTHORS.txt +0 -41
  35. paradigma/ppg/glob_functions/jsonlab/ChangeLog.txt +0 -74
  36. paradigma/ppg/glob_functions/jsonlab/LICENSE_BSD.txt +0 -25
  37. paradigma/ppg/glob_functions/jsonlab/LICENSE_GPLv3.txt +0 -699
  38. paradigma/ppg/glob_functions/jsonlab/README.txt +0 -394
  39. paradigma/ppg/glob_functions/jsonlab/examples/.svn/entries +0 -368
  40. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/demo_jsonlab_basic.m.svn-base +0 -180
  41. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/demo_ubjson_basic.m.svn-base +0 -180
  42. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example1.json.svn-base +0 -23
  43. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example2.json.svn-base +0 -22
  44. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example3.json.svn-base +0 -11
  45. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/example4.json.svn-base +0 -34
  46. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_basictest.matlab.svn-base +0 -662
  47. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_selftest.m.svn-base +0 -27
  48. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_selftest.matlab.svn-base +0 -144
  49. paradigma/ppg/glob_functions/jsonlab/examples/.svn/text-base/jsonlab_speedtest.m.svn-base +0 -21
  50. paradigma/ppg/glob_functions/jsonlab/examples/demo_jsonlab_basic.m +0 -180
  51. paradigma/ppg/glob_functions/jsonlab/examples/demo_ubjson_basic.m +0 -180
  52. paradigma/ppg/glob_functions/jsonlab/examples/example1.json +0 -23
  53. paradigma/ppg/glob_functions/jsonlab/examples/example2.json +0 -22
  54. paradigma/ppg/glob_functions/jsonlab/examples/example3.json +0 -11
  55. paradigma/ppg/glob_functions/jsonlab/examples/example4.json +0 -34
  56. paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_basictest.matlab +0 -662
  57. paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_selftest.m +0 -27
  58. paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_selftest.matlab +0 -144
  59. paradigma/ppg/glob_functions/jsonlab/examples/jsonlab_speedtest.m +0 -21
  60. paradigma/ppg/glob_functions/jsonlab/jsonopt.m +0 -32
  61. paradigma/ppg/glob_functions/jsonlab/loadjson.m +0 -566
  62. paradigma/ppg/glob_functions/jsonlab/loadubjson.m +0 -528
  63. paradigma/ppg/glob_functions/jsonlab/mergestruct.m +0 -33
  64. paradigma/ppg/glob_functions/jsonlab/savejson.m +0 -475
  65. paradigma/ppg/glob_functions/jsonlab/saveubjson.m +0 -504
  66. paradigma/ppg/glob_functions/jsonlab/varargin2struct.m +0 -40
  67. paradigma/ppg/glob_functions/sample_prob_final.m +0 -49
  68. paradigma/ppg/glob_functions/synchronization.m +0 -76
  69. paradigma/ppg/glob_functions/tsdf_scan_meta.m +0 -22
  70. paradigma/ppg/hr_functions/Long_TFD_JOT.m +0 -37
  71. paradigma/ppg/hr_functions/PPG_TFD_HR.m +0 -59
  72. paradigma/ppg/hr_functions/TFD toolbox JOT/.gitignore +0 -4
  73. paradigma/ppg/hr_functions/TFD toolbox JOT/CHANGELOG.md +0 -23
  74. paradigma/ppg/hr_functions/TFD toolbox JOT/LICENCE.md +0 -27
  75. paradigma/ppg/hr_functions/TFD toolbox JOT/README.md +0 -251
  76. paradigma/ppg/hr_functions/TFD toolbox JOT/README.pdf +0 -0
  77. paradigma/ppg/hr_functions/TFD toolbox JOT/common/gen_Doppler_kern.m +0 -142
  78. paradigma/ppg/hr_functions/TFD toolbox JOT/common/gen_Doppler_lag_kern.m +0 -314
  79. paradigma/ppg/hr_functions/TFD toolbox JOT/common/gen_lag_kern.m +0 -123
  80. paradigma/ppg/hr_functions/TFD toolbox JOT/dec_tfd.m +0 -154
  81. paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_di_gdtfd.m +0 -194
  82. paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_li_gdtfd.m +0 -200
  83. paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_nonsep_gdtfd.m +0 -229
  84. paradigma/ppg/hr_functions/TFD toolbox JOT/decimated_TFDs/dec_sep_gdtfd.m +0 -241
  85. paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/di_gdtfd.m +0 -157
  86. paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/li_gdtfd.m +0 -190
  87. paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/nonsep_gdtfd.m +0 -196
  88. paradigma/ppg/hr_functions/TFD toolbox JOT/full_TFDs/sep_gdtfd.m +0 -199
  89. paradigma/ppg/hr_functions/TFD toolbox JOT/full_tfd.m +0 -144
  90. paradigma/ppg/hr_functions/TFD toolbox JOT/load_curdir.m +0 -13
  91. paradigma/ppg/hr_functions/TFD toolbox JOT/pics/decimated_TFDs_examples.png +0 -0
  92. paradigma/ppg/hr_functions/TFD toolbox JOT/pics/full_TFDs_examples.png +0 -0
  93. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/check_dec_params_seq.m +0 -79
  94. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/dispEE.m +0 -9
  95. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/dispVars.m +0 -26
  96. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/disp_bytes.m +0 -25
  97. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/fold_vector_full.m +0 -40
  98. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/fold_vector_half.m +0 -34
  99. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/gen_LFM.m +0 -29
  100. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/get_analytic_signal.m +0 -76
  101. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/get_window.m +0 -176
  102. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/isreal_fn.m +0 -11
  103. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/padWin.m +0 -97
  104. paradigma/ppg/hr_functions/TFD toolbox JOT/utils/vtfd.m +0 -149
  105. paradigma/ppg/preprocessing/preprocessing_imu.m +0 -15
  106. paradigma/ppg/preprocessing/preprocessing_ppg.m +0 -13
  107. paradigma/ppg_preprocessing.py +0 -313
  108. paradigma/preprocessing_config.py +0 -69
  109. paradigma/quantification.py +0 -58
  110. paradigma/tremor/TremorFeaturesAndClassification.m +0 -345
  111. paradigma/tremor/feat_extraction/DerivativesExtract.m +0 -22
  112. paradigma/tremor/feat_extraction/ExtractBandSignalsRMS.m +0 -72
  113. paradigma/tremor/feat_extraction/MFCCExtract.m +0 -100
  114. paradigma/tremor/feat_extraction/PSDBandPower.m +0 -52
  115. paradigma/tremor/feat_extraction/PSDEst.m +0 -63
  116. paradigma/tremor/feat_extraction/PSDExtrAxis.m +0 -88
  117. paradigma/tremor/feat_extraction/PSDExtrOpt.m +0 -95
  118. paradigma/tremor/preprocessing/InterpData.m +0 -32
  119. paradigma/tremor/weekly_aggregates/WeeklyAggregates.m +0 -295
  120. paradigma/windowing.py +0 -219
  121. paradigma-0.3.2.dist-info/METADATA +0 -79
  122. paradigma-0.3.2.dist-info/RECORD +0 -108
  123. {paradigma-0.3.2.dist-info → paradigma-0.4.1.dist-info}/LICENSE +0 -0
@@ -1,144 +0,0 @@
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
- >> example1.json
13
- {
14
- "data": {
15
- "firstName": "John",
16
- "lastName": "Smith",
17
- "age": 25,
18
- "address": {
19
- "streetAddress": "21 2nd Street",
20
- "city": "New York",
21
- "state": "NY",
22
- "postalCode": "10021"
23
- },
24
- "phoneNumber": [
25
- {
26
- "type": "home",
27
- "number": "212 555-1234"
28
- },
29
- {
30
- "type": "fax",
31
- "number": "646 555-4567"
32
- }
33
- ]
34
- }
35
- }
36
-
37
- {"data": {"firstName": "John","lastName": "Smith","age": 25,"address": {"streetAddress": "21 2nd Street","city": "New York","state": "NY","postalCode": "10021"},"phoneNumber": [{"type": "home","number": "212 555-1234"},{"type": "fax","number": "646 555-4567"}]}}
38
-
39
- ===============================================
40
- >> example2.json
41
- {
42
- "data": {
43
- "glossary": {
44
- "title": "example glossary",
45
- "GlossDiv": {
46
- "title": "S",
47
- "GlossList": {
48
- "GlossEntry": {
49
- "ID": "SGML",
50
- "SortAs": "SGML",
51
- "GlossTerm": "Standard Generalized Markup Language",
52
- "Acronym": "SGML",
53
- "Abbrev": "ISO 8879:1986",
54
- "GlossDef": {
55
- "para": "A meta-markup language, used to create markup languages such as DocBook.",
56
- "GlossSeeAlso": [
57
- "GML",
58
- "XML"
59
- ]
60
- },
61
- "GlossSee": "markup"
62
- }
63
- }
64
- }
65
- }
66
- }
67
- }
68
-
69
- {"data": {"glossary": {"title": "example glossary","GlossDiv": {"title": "S","GlossList": {"GlossEntry": {"ID": "SGML","SortAs": "SGML","GlossTerm": "Standard Generalized Markup Language","Acronym": "SGML","Abbrev": "ISO 8879:1986","GlossDef": {"para": "A meta-markup language, used to create markup languages such as DocBook.","GlossSeeAlso": ["GML","XML"]},"GlossSee": "markup"}}}}}}
70
-
71
- ===============================================
72
- >> example3.json
73
- {
74
- "data": {
75
- "menu": {
76
- "id": "file",
77
- "value": "_&File",
78
- "popup": {
79
- "menuitem": [
80
- {
81
- "value": "_&New",
82
- "onclick": "CreateNewDoc(\"\"\")"
83
- },
84
- {
85
- "value": "_&Open",
86
- "onclick": "OpenDoc()"
87
- },
88
- {
89
- "value": "_&Close",
90
- "onclick": "CloseDoc()"
91
- }
92
- ]
93
- }
94
- }
95
- }
96
- }
97
-
98
- {"data": {"menu": {"id": "file","value": "_&File","popup": {"menuitem": [{"value": "_&New","onclick": "CreateNewDoc(\"\"\")"},{"value": "_&Open","onclick": "OpenDoc()"},{"value": "_&Close","onclick": "CloseDoc()"}]}}}}
99
-
100
- ===============================================
101
- >> example4.json
102
- {
103
- "data": [
104
- {
105
- "sample": {
106
- "rho": 1
107
- }
108
- },
109
- {
110
- "sample": {
111
- "rho": 2
112
- }
113
- },
114
- [
115
- [1,0],
116
- [1,1],
117
- [1,2]
118
- ],
119
- [
120
- "Paper",
121
- "Scissors",
122
- "Stone"
123
- ]
124
- ]
125
- }
126
-
127
- {"data": [{"sample": {"rho": 1}},{"sample": {"rho": 2}},[[1,0],[1,1],[1,2]],["Paper","Scissors","Stone"]]}
128
-
129
- >> >> ===============================================
130
- >> example1.json
131
- {SUdata{SU firstNameSUJohnSUlastNameSUSmithSUageiSUaddress{SU
132
- postalCodeSU10021}SU phoneNumber[{SUtypeSUhomeSUnumberSU 212 555-1234}{SUtypeSUfaxSUnumberSU 646 555-4567}]}}
133
- ===============================================
134
- >> example2.json
135
- {SUdata{SUglossary{SUtitleSUexample glossarySUGlossDiv{SUtitleCSSU GlossList{SU
136
- GlossEntry{SUIDSUSGMLSUSortAsSUSGMLSU GlossTermSU$Standard Generalized Markup LanguageSUAcronymSUSGMLSUAbbrevSU
137
- ===============================================
138
- >> example3.json
139
- {SUdata{SUmenu{SUidSUfileSUvalueSU_&FileSUpopup{SUmenuitem[{SUvalueSU_&NewSUonclickSUCreateNewDoc(""")}{SUvalueSU_&OpenSUonclickSU OpenDoc()}{SUvalueSU_&CloseSUonclickSU
140
- CloseDoc()}]}}}}
141
- ===============================================
142
- >> example4.json
143
- {SUdata[{SUsample{SUrhoi}}{SUsample{SUrhoi}}[[$i#U
144
- >>
@@ -1,21 +0,0 @@
1
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
- % Benchmarking processing speed of savejson and loadjson
3
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4
-
5
- datalen=[1e3 1e4 1e5 1e6];
6
- len=length(datalen);
7
- tsave=zeros(len,1);
8
- tload=zeros(len,1);
9
- for i=1:len
10
- tic;
11
- json=savejson('data',struct('d1',rand(datalen(i),3),'d2',rand(datalen(i),3)>0.5));
12
- tsave(i)=toc;
13
- data=loadjson(json);
14
- tload(i)=toc-tsave(i);
15
- fprintf(1,'matrix size: %d\n',datalen(i));
16
- end
17
-
18
- loglog(datalen,tsave,'o-',datalen,tload,'r*-');
19
- legend('savejson runtime (s)','loadjson runtime (s)');
20
- xlabel('array size');
21
- ylabel('running time (s)');
@@ -1,180 +0,0 @@
1
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
- % Demonstration of Basic Utilities of JSONlab
3
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4
-
5
- rngstate = rand ('state');
6
- randseed=hex2dec('623F9A9E');
7
- clear data2json json2data
8
-
9
- fprintf(1,'\n%%=================================================\n')
10
- fprintf(1,'%% a simple scalar value \n')
11
- fprintf(1,'%%=================================================\n\n')
12
-
13
- data2json=pi
14
- savejson('',data2json)
15
- json2data=loadjson(ans)
16
-
17
- fprintf(1,'\n%%=================================================\n')
18
- fprintf(1,'%% a complex number\n')
19
- fprintf(1,'%%=================================================\n\n')
20
-
21
- clear i;
22
- data2json=1+2*i
23
- savejson('',data2json)
24
- json2data=loadjson(ans)
25
-
26
- fprintf(1,'\n%%=================================================\n')
27
- fprintf(1,'%% a complex matrix\n')
28
- fprintf(1,'%%=================================================\n\n')
29
-
30
- data2json=magic(6);
31
- data2json=data2json(:,1:3)+data2json(:,4:6)*i
32
- savejson('',data2json)
33
- json2data=loadjson(ans)
34
-
35
- fprintf(1,'\n%%=================================================\n')
36
- fprintf(1,'%% MATLAB special constants\n')
37
- fprintf(1,'%%=================================================\n\n')
38
-
39
- data2json=[NaN Inf -Inf]
40
- savejson('specials',data2json)
41
- json2data=loadjson(ans)
42
-
43
- fprintf(1,'\n%%=================================================\n')
44
- fprintf(1,'%% a real sparse matrix\n')
45
- fprintf(1,'%%=================================================\n\n')
46
-
47
- data2json=sprand(10,10,0.1)
48
- savejson('sparse',data2json)
49
- json2data=loadjson(ans)
50
-
51
- fprintf(1,'\n%%=================================================\n')
52
- fprintf(1,'%% a complex sparse matrix\n')
53
- fprintf(1,'%%=================================================\n\n')
54
-
55
- data2json=data2json-data2json*i
56
- savejson('complex_sparse',data2json)
57
- json2data=loadjson(ans)
58
-
59
- fprintf(1,'\n%%=================================================\n')
60
- fprintf(1,'%% an all-zero sparse matrix\n')
61
- fprintf(1,'%%=================================================\n\n')
62
-
63
- data2json=sparse(2,3);
64
- savejson('all_zero_sparse',data2json)
65
- json2data=loadjson(ans)
66
-
67
- fprintf(1,'\n%%=================================================\n')
68
- fprintf(1,'%% an empty sparse matrix\n')
69
- fprintf(1,'%%=================================================\n\n')
70
-
71
- data2json=sparse([]);
72
- savejson('empty_sparse',data2json)
73
- json2data=loadjson(ans)
74
-
75
- fprintf(1,'\n%%=================================================\n')
76
- fprintf(1,'%% an empty 0-by-0 real matrix\n')
77
- fprintf(1,'%%=================================================\n\n')
78
-
79
- data2json=[];
80
- savejson('empty_0by0_real',data2json)
81
- json2data=loadjson(ans)
82
-
83
- fprintf(1,'\n%%=================================================\n')
84
- fprintf(1,'%% an empty 0-by-3 real matrix\n')
85
- fprintf(1,'%%=================================================\n\n')
86
-
87
- data2json=zeros(0,3);
88
- savejson('empty_0by3_real',data2json)
89
- json2data=loadjson(ans)
90
-
91
- fprintf(1,'\n%%=================================================\n')
92
- fprintf(1,'%% a sparse real column vector\n')
93
- fprintf(1,'%%=================================================\n\n')
94
-
95
- data2json=sparse([0,3,0,1,4]');
96
- savejson('sparse_column_vector',data2json)
97
- json2data=loadjson(ans)
98
-
99
- fprintf(1,'\n%%=================================================\n')
100
- fprintf(1,'%% a sparse complex column vector\n')
101
- fprintf(1,'%%=================================================\n\n')
102
-
103
- data2json=data2json-1i*data2json;
104
- savejson('complex_sparse_column_vector',data2json)
105
- json2data=loadjson(ans)
106
-
107
- fprintf(1,'\n%%=================================================\n')
108
- fprintf(1,'%% a sparse real row vector\n')
109
- fprintf(1,'%%=================================================\n\n')
110
-
111
- data2json=sparse([0,3,0,1,4]);
112
- savejson('sparse_row_vector',data2json)
113
- json2data=loadjson(ans)
114
-
115
- fprintf(1,'\n%%=================================================\n')
116
- fprintf(1,'%% a sparse complex row vector\n')
117
- fprintf(1,'%%=================================================\n\n')
118
-
119
- data2json=data2json-1i*data2json;
120
- savejson('complex_sparse_row_vector',data2json)
121
- json2data=loadjson(ans)
122
-
123
- fprintf(1,'\n%%=================================================\n')
124
- fprintf(1,'%% a structure\n')
125
- fprintf(1,'%%=================================================\n\n')
126
-
127
- data2json=struct('name','Think Different','year',1997,'magic',magic(3),...
128
- 'misfits',[Inf,NaN],'embedded',struct('left',true,'right',false))
129
- savejson('astruct',data2json,struct('ParseLogical',1))
130
- json2data=loadjson(ans)
131
-
132
- fprintf(1,'\n%%=================================================\n')
133
- fprintf(1,'%% a structure array\n')
134
- fprintf(1,'%%=================================================\n\n')
135
-
136
- data2json=struct('name','Nexus Prime','rank',9);
137
- data2json(2)=struct('name','Sentinel Prime','rank',9);
138
- data2json(3)=struct('name','Optimus Prime','rank',9);
139
- savejson('Supreme Commander',data2json)
140
- json2data=loadjson(ans)
141
-
142
- fprintf(1,'\n%%=================================================\n')
143
- fprintf(1,'%% a cell array\n')
144
- fprintf(1,'%%=================================================\n\n')
145
-
146
- data2json=cell(3,1);
147
- data2json{1}=struct('buzz',1.1,'rex',1.2,'bo',1.3,'hamm',2.0,'slink',2.1,'potato',2.2,...
148
- 'woody',3.0,'sarge',3.1,'etch',4.0,'lenny',5.0,'squeeze',6.0,'wheezy',7.0);
149
- data2json{2}=struct('Ubuntu',['Kubuntu';'Xubuntu';'Lubuntu']);
150
- data2json{3}=[10.04,10.10,11.04,11.10]
151
- savejson('debian',data2json,struct('FloatFormat','%.2f'))
152
- json2data=loadjson(ans)
153
-
154
- fprintf(1,'\n%%=================================================\n')
155
- fprintf(1,'%% invalid field-name handling\n')
156
- fprintf(1,'%%=================================================\n\n')
157
-
158
- json2data=loadjson('{"ValidName":1, "_InvalidName":2, ":Field:":3, "项目":"绝密"}')
159
-
160
- fprintf(1,'\n%%=================================================\n')
161
- fprintf(1,'%% a 2D cell array\n')
162
- fprintf(1,'%%=================================================\n\n')
163
-
164
- data2json={{1,{2,3}},{4,5},{6};{7},{8,9},{10}};
165
- savejson('data2json',data2json)
166
- json2data=loadjson(ans) % only savejson works for cell arrays, loadjson has issues
167
-
168
- fprintf(1,'\n%%=================================================\n')
169
- fprintf(1,'%% a 2D struct array\n')
170
- fprintf(1,'%%=================================================\n\n')
171
-
172
- data2json=repmat(struct('idx',0,'data','structs'),[2,3])
173
- for i=1:6
174
- data2json(i).idx=i;
175
- end
176
- savejson('data2json',data2json)
177
- json2data=loadjson(ans)
178
-
179
- rand ('state',rngstate);
180
-
@@ -1,180 +0,0 @@
1
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
- % Demonstration of Basic Utilities of JSONlab
3
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4
-
5
- rngstate = rand ('state');
6
- randseed=hex2dec('623F9A9E');
7
- clear data2json json2data
8
-
9
- fprintf(1,'\n%%=================================================\n')
10
- fprintf(1,'%% a simple scalar value \n')
11
- fprintf(1,'%%=================================================\n\n')
12
-
13
- data2json=pi
14
- saveubjson('',data2json)
15
- json2data=loadubjson(ans)
16
-
17
- fprintf(1,'\n%%=================================================\n')
18
- fprintf(1,'%% a complex number\n')
19
- fprintf(1,'%%=================================================\n\n')
20
-
21
- clear i;
22
- data2json=1+2*i
23
- saveubjson('',data2json)
24
- json2data=loadubjson(ans)
25
-
26
- fprintf(1,'\n%%=================================================\n')
27
- fprintf(1,'%% a complex matrix\n')
28
- fprintf(1,'%%=================================================\n\n')
29
-
30
- data2json=magic(6);
31
- data2json=data2json(:,1:3)+data2json(:,4:6)*i
32
- saveubjson('',data2json)
33
- json2data=loadubjson(ans)
34
-
35
- fprintf(1,'\n%%=================================================\n')
36
- fprintf(1,'%% MATLAB special constants\n')
37
- fprintf(1,'%%=================================================\n\n')
38
-
39
- data2json=[NaN Inf -Inf]
40
- saveubjson('specials',data2json)
41
- json2data=loadubjson(ans)
42
-
43
- fprintf(1,'\n%%=================================================\n')
44
- fprintf(1,'%% a real sparse matrix\n')
45
- fprintf(1,'%%=================================================\n\n')
46
-
47
- data2json=sprand(10,10,0.1)
48
- saveubjson('sparse',data2json)
49
- json2data=loadubjson(ans)
50
-
51
- fprintf(1,'\n%%=================================================\n')
52
- fprintf(1,'%% a complex sparse matrix\n')
53
- fprintf(1,'%%=================================================\n\n')
54
-
55
- data2json=data2json-data2json*i
56
- saveubjson('complex_sparse',data2json)
57
- json2data=loadubjson(ans)
58
-
59
- fprintf(1,'\n%%=================================================\n')
60
- fprintf(1,'%% an all-zero sparse matrix\n')
61
- fprintf(1,'%%=================================================\n\n')
62
-
63
- data2json=sparse(2,3);
64
- saveubjson('all_zero_sparse',data2json)
65
- json2data=loadubjson(ans)
66
-
67
- fprintf(1,'\n%%=================================================\n')
68
- fprintf(1,'%% an empty sparse matrix\n')
69
- fprintf(1,'%%=================================================\n\n')
70
-
71
- data2json=sparse([]);
72
- saveubjson('empty_sparse',data2json)
73
- json2data=loadubjson(ans)
74
-
75
- fprintf(1,'\n%%=================================================\n')
76
- fprintf(1,'%% an empty 0-by-0 real matrix\n')
77
- fprintf(1,'%%=================================================\n\n')
78
-
79
- data2json=[];
80
- saveubjson('empty_0by0_real',data2json)
81
- json2data=loadubjson(ans)
82
-
83
- fprintf(1,'\n%%=================================================\n')
84
- fprintf(1,'%% an empty 0-by-3 real matrix\n')
85
- fprintf(1,'%%=================================================\n\n')
86
-
87
- data2json=zeros(0,3);
88
- saveubjson('empty_0by3_real',data2json)
89
- json2data=loadubjson(ans)
90
-
91
- fprintf(1,'\n%%=================================================\n')
92
- fprintf(1,'%% a sparse real column vector\n')
93
- fprintf(1,'%%=================================================\n\n')
94
-
95
- data2json=sparse([0,3,0,1,4]');
96
- saveubjson('sparse_column_vector',data2json)
97
- json2data=loadubjson(ans)
98
-
99
- fprintf(1,'\n%%=================================================\n')
100
- fprintf(1,'%% a sparse complex column vector\n')
101
- fprintf(1,'%%=================================================\n\n')
102
-
103
- data2json=data2json-1i*data2json;
104
- saveubjson('complex_sparse_column_vector',data2json)
105
- json2data=loadubjson(ans)
106
-
107
- fprintf(1,'\n%%=================================================\n')
108
- fprintf(1,'%% a sparse real row vector\n')
109
- fprintf(1,'%%=================================================\n\n')
110
-
111
- data2json=sparse([0,3,0,1,4]);
112
- saveubjson('sparse_row_vector',data2json)
113
- json2data=loadubjson(ans)
114
-
115
- fprintf(1,'\n%%=================================================\n')
116
- fprintf(1,'%% a sparse complex row vector\n')
117
- fprintf(1,'%%=================================================\n\n')
118
-
119
- data2json=data2json-1i*data2json;
120
- saveubjson('complex_sparse_row_vector',data2json)
121
- json2data=loadubjson(ans)
122
-
123
- fprintf(1,'\n%%=================================================\n')
124
- fprintf(1,'%% a structure\n')
125
- fprintf(1,'%%=================================================\n\n')
126
-
127
- data2json=struct('name','Think Different','year',1997,'magic',magic(3),...
128
- 'misfits',[Inf,NaN],'embedded',struct('left',true,'right',false))
129
- saveubjson('astruct',data2json,struct('ParseLogical',1))
130
- json2data=loadubjson(ans)
131
-
132
- fprintf(1,'\n%%=================================================\n')
133
- fprintf(1,'%% a structure array\n')
134
- fprintf(1,'%%=================================================\n\n')
135
-
136
- data2json=struct('name','Nexus Prime','rank',9);
137
- data2json(2)=struct('name','Sentinel Prime','rank',9);
138
- data2json(3)=struct('name','Optimus Prime','rank',9);
139
- saveubjson('Supreme Commander',data2json)
140
- json2data=loadubjson(ans)
141
-
142
- fprintf(1,'\n%%=================================================\n')
143
- fprintf(1,'%% a cell array\n')
144
- fprintf(1,'%%=================================================\n\n')
145
-
146
- data2json=cell(3,1);
147
- data2json{1}=struct('buzz',1.1,'rex',1.2,'bo',1.3,'hamm',2.0,'slink',2.1,'potato',2.2,...
148
- 'woody',3.0,'sarge',3.1,'etch',4.0,'lenny',5.0,'squeeze',6.0,'wheezy',7.0);
149
- data2json{2}=struct('Ubuntu',['Kubuntu';'Xubuntu';'Lubuntu']);
150
- data2json{3}=[10.04,10.10,11.04,11.10]
151
- saveubjson('debian',data2json,struct('FloatFormat','%.2f'))
152
- json2data=loadubjson(ans)
153
-
154
- fprintf(1,'\n%%=================================================\n')
155
- fprintf(1,'%% invalid field-name handling\n')
156
- fprintf(1,'%%=================================================\n\n')
157
-
158
- json2data=loadubjson(saveubjson('',loadjson('{"ValidName":1, "_InvalidName":2, ":Field:":3, "项目":"绝密"}')))
159
-
160
- fprintf(1,'\n%%=================================================\n')
161
- fprintf(1,'%% a 2D cell array\n')
162
- fprintf(1,'%%=================================================\n\n')
163
-
164
- data2json={{1,{2,3}},{4,5},{6};{7},{8,9},{10}};
165
- saveubjson('data2json',data2json)
166
- json2data=loadubjson(ans) % only savejson works for cell arrays, loadjson has issues
167
-
168
- fprintf(1,'\n%%=================================================\n')
169
- fprintf(1,'%% a 2D struct array\n')
170
- fprintf(1,'%%=================================================\n\n')
171
-
172
- data2json=repmat(struct('idx',0,'data','structs'),[2,3])
173
- for i=1:6
174
- data2json(i).idx=i;
175
- end
176
- saveubjson('data2json',data2json)
177
- json2data=loadubjson(ans)
178
-
179
- rand ('state',rngstate);
180
-
@@ -1,23 +0,0 @@
1
- {
2
- "firstName": "John",
3
- "lastName": "Smith",
4
- "age": 25,
5
- "address":
6
- {
7
- "streetAddress": "21 2nd Street",
8
- "city": "New York",
9
- "state": "NY",
10
- "postalCode": "10021"
11
- },
12
- "phoneNumber":
13
- [
14
- {
15
- "type": "home",
16
- "number": "212 555-1234"
17
- },
18
- {
19
- "type": "fax",
20
- "number": "646 555-4567"
21
- }
22
- ]
23
- }
@@ -1,22 +0,0 @@
1
- {
2
- "glossary": {
3
- "title": "example glossary",
4
- "GlossDiv": {
5
- "title": "S",
6
- "GlossList": {
7
- "GlossEntry": {
8
- "ID": "SGML",
9
- "SortAs": "SGML",
10
- "GlossTerm": "Standard Generalized Markup Language",
11
- "Acronym": "SGML",
12
- "Abbrev": "ISO 8879:1986",
13
- "GlossDef": {
14
- "para": "A meta-markup language, used to create markup languages such as DocBook.",
15
- "GlossSeeAlso": ["GML", "XML"]
16
- },
17
- "GlossSee": "markup"
18
- }
19
- }
20
- }
21
- }
22
- }
@@ -1,11 +0,0 @@
1
- {"menu": {
2
- "id": "file",
3
- "value": "_&File",
4
- "popup": {
5
- "menuitem": [
6
- {"value": "_&New", "onclick": "CreateNewDoc(\"\"\")"},
7
- {"value": "_&Open", "onclick": "OpenDoc()"},
8
- {"value": "_&Close", "onclick": "CloseDoc()"}
9
- ]
10
- }
11
- }}
@@ -1,34 +0,0 @@
1
- [
2
- {
3
- "sample" : {
4
- "rho" : 1
5
- }
6
- },
7
- {
8
- "sample" : {
9
- "rho" : 2
10
- }
11
- },
12
- [
13
- {
14
- "_ArrayType_" : "double",
15
- "_ArraySize_" : [1,2],
16
- "_ArrayData_" : [1,0]
17
- },
18
- {
19
- "_ArrayType_" : "double",
20
- "_ArraySize_" : [1,2],
21
- "_ArrayData_" : [1,1]
22
- },
23
- {
24
- "_ArrayType_" : "double",
25
- "_ArraySize_" : [1,2],
26
- "_ArrayData_" : [1,2]
27
- }
28
- ],
29
- [
30
- "Paper",
31
- "Scissors",
32
- "Stone"
33
- ]
34
- ]