Commit : Wavelet Denoising (BETA) added.

This commit is contained in:
Rafat Hussain 2017-08-14 16:33:23 +05:30
parent 32dab0c338
commit 9e08b4e93a
18 changed files with 132170 additions and 44 deletions

2048
data/Blocks7.txt Normal file

File diff suppressed because it is too large Load Diff

2048
data/Bumps7.txt Normal file

File diff suppressed because it is too large Load Diff

2048
data/Doppler8.txt Normal file

File diff suppressed because it is too large Load Diff

2048
data/HeaviSine8.txt Normal file

File diff suppressed because it is too large Load Diff

1024
data/PiecePoly20.txt Normal file

File diff suppressed because it is too large Load Diff

2048
data/PiecePolynomial6.txt Normal file

File diff suppressed because it is too large Load Diff

1024
data/PieceRegular10.txt Normal file

File diff suppressed because it is too large Load Diff

2048
data/PieceRegular6.txt Normal file

File diff suppressed because it is too large Load Diff

800
data/bumps6.txt Normal file
View File

@ -0,0 +1,800 @@
-1.6767
0.72166
0.67185
0.032496
0.86367
-0.46865
0.19288
0.49161
0.26748
-0.87929
-0.73515
-0.38756
-0.69925
-1.5703
0.75588
0.5294
-0.5978
1.4826
-0.057172
1.2967
1.0696
-0.33913
-0.52662
1.0579
0.58289
-0.73201
-0.78396
1.0947
-0.49741
-0.65714
-0.034562
0.76354
-0.25936
0.8759
-0.30639
-0.4633
-0.44075
-1.9808
0.99643
-0.0958
-0.11853
-0.91163
-0.027314
0.35386
2.8151
1.3011
0.51132
-0.33284
-2.1671
1.8455
-1.1525
0.49215
0.76668
-1.266
-2.0075
1.042
-0.14152
1.0209
-0.8342
0.34541
-0.27282
0.063822
0.78823
0.12445
-1.3926
-0.63137
1.8474
-0.14454
-0.18299
0.16005
1.8592
-2.2734
-0.65969
-1.7671
0.065591
-0.45918
0.92118
-0.4691
0.30254
-0.28309
-0.61878
0.43903
2.2957
0.46457
-2.4205
-1.3053
-1.5407
1.7266
0.2769
0.91494
-0.75993
0.18514
-0.075193
-0.58771
-0.79935
0.67348
2.1975
3.7539
3.6454
3.6425
5.5747
7.5241
7.311
5.214
6.2046
5.0606
5.6248
3.4838
2.6398
1.3781
1.8915
0.26372
0.42347
-0.66314
0.048844
-0.0090891
-1.1122
1.9109
-1.8006
-0.96107
1.0398
-0.6453
1.3331
0.30353
-0.47365
-0.41239
2.8906
3.4071
4.6502
6.0105
5.797
9.0042
8.6098
6.8693
7.3399
7.4701
6.6091
4.2172
1.8747
2.5045
0.18352
1.13
3.2199
0.49253
2.1461
1.8323
1.1139
3.2405
3.4121
3.8176
5.6834
5.2998
7.7896
4.4501
4.5555
5.5688
3.6487
4.8511
4.595
2.4904
3.2967
3.4377
-0.30872
1.2064
1.0509
0.45589
-0.70316
1.9036
1.3016
0.98537
1.3596
1.7112
-1.4304
-0.607
-0.63204
-0.72734
-1.0273
-0.31238
-0.62147
1.3428
0.13887
0.72632
2.1584
-1.0134
0.49747
-0.52692
0.88718
-1.5265
0.57204
-0.85982
-0.24201
0.47674
1.6177
-0.14317
0.47651
0.68378
-1.5943
-2.4524
-0.82688
0.7219
-0.14781
1.7049
-0.70859
-0.26519
1.379
0.94018
-0.41558
-0.38434
0.4771
0.14104
-0.47159
-0.94515
-0.63622
-1.096
0.76221
-0.94511
-0.67555
2.1709
2.8988
3.2046
0.47725
-0.017649
3.0412
0.7023
2.8518
4.3749
4.3611
3.2626
4.9381
6.8391
6.4672
6.5378
6.1944
6.868
8.1778
6.8547
8.4479
7.6793
7.6529
6.7262
6.4574
7.0603
7.237
8.1007
8.5111
6.8208
5.8115
6.488
9.8504
7.5047
6.9365
8.3783
8.6585
8.4763
6.137
7.3377
8.149
6.1884
9.7506
6.7148
7.2796
6.8942
8.1101
7.0392
5.5981
4.3979
4.1192
4.6389
3.0348
1.6154
2.8638
0.97095
0.64134
0.9277
3.393
3.2647
0.65323
1.3864
0.40858
0.34521
-0.013242
-1.1468
-1.5252
-0.92468
0.76883
1.7496
0.70832
-1.6195
-0.18419
-1.4846
1.5155
-0.20335
-1.0738
0.82304
0.18354
1.1868
0.71035
-0.65988
-0.47881
-1.0364
1.0214
1.4648
-0.95915
0.00049512
-0.81039
-1.2337
-0.44541
1.313
2.2554
1.1276
-0.31847
-0.47442
0.1197
-0.36551
1.2555
-0.79417
0.71875
-1.9066
-0.21176
1.7119
-0.36833
-0.10583
-0.29509
-1.2763
0.83482
-0.03458
-0.31222
1.9105
-1.6256
1.1519
1.8271
-0.0009501
-0.70981
1.8757
-0.77052
0.44052
-0.77347
2.0475
0.41174
0.826
-0.044081
1.9727
0.72225
0.34157
0.43566
-0.19295
0.62202
0.048644
0.54729
3.7591
-0.072933
-0.26263
1.421
0.041181
0.22485
-1.8904
1.3111
-0.60504
1.1994
1.4164
1.6345
0.70865
0.078886
1.5622
2.309
0.033343
-0.43958
0.35494
0.83378
3.3211
-1.0384
1.7388
1.7949
1.7024
1.6972
1.6257
4.1026
3.4665
2.4143
2.7657
2.9863
4.6267
4.0628
4.602
3.9584
3.868
6.1963
5.0329
6.4678
6.0719
5.0085
7.2593
6.2524
6.9503
5.428
6.2528
6.7903
6.7117
6.4827
5.67
7.4407
5.9906
6.0129
6.3112
7.5659
7.4273
6.1503
6.846
6.2065
5.623
6.3812
7.5817
6.9163
6.7305
8.5031
5.3629
6.1196
5.8455
5.276
7.9106
8.0551
6.1611
4.7321
7.931
5.6309
7.4212
7.3641
6.1199
4.1945
5.9414
6.2486
7.4172
5.1539
5.228
6.0029
5.0445
5.6298
6.4241
4.962
6.0779
5.3627
4.9836
5.8392
4.9202
6.4157
5.3382
5.938
3.2413
6.0579
4.102
4.0396
5.1296
5.9863
5.783
4.4274
5.5049
6.2918
3.0518
3.1792
1.8224
2.0787
1.3441
0.86307
3.1884
2.4151
0.17109
0.93545
2.3153
1.1201
2.0555
-0.99153
0.9585
1.0962
-0.29846
2.0099
0.88858
-1.8368
-1.0727
1.5504
0.32459
1.4854
0.15435
0.68867
-1.1702
-0.33452
-0.13274
1.3219
-0.28669
0.28494
0.17292
-0.4985
1.2927
1.543
0.42477
0.69877
0.83893
-1.1609
1.357
-1.8824
-0.90972
-0.4917
0.48267
0.41443
-0.50514
-1.2486
0.63696
-0.57146
0.67604
0.58168
1.3112
-1.0345
-0.71636
0.41991
-1.0641
-0.61833
-0.03578
-0.24298
0.80813
-0.66023
0.55094
-0.55651
-0.92706
1.6989
-0.058475
-0.12628
-0.58587
-0.37392
1.084
-0.69002
-0.86797
-0.37787
-1.5603
0.33947
-0.64016
2.2639
0.84064
-1.0056
2.0281
0.043279
-0.62092
-0.73402
0.15044
-0.052086
0.91022
0.098474
0.15853
-1.2166
-0.79532
-0.43051
1.6539
-1.7575
-1.0255
-0.39424
-0.24131
-0.35303
-1.3536
2.5103
1.0449
-1.9665
-0.10216
1.8162
0.52612
0.36978
0.55109
-0.1089
-0.95415
0.77898
2.3458
-1.4312
0.31331
0.59261
1.0144
0.1187
0.70385
2.1198
0.15197
-1.3874
-1.7153
-0.78636
0.65922
0.65659
0.79224
-0.38336
-1.62
1.0468
0.22501
-0.47771
0.92363
0.64716
-0.5598
0.58023
0.27702
1.3096e-005
-2.1335
-1.0128
-0.59172
1.1292
0.10683
0.21885
-0.74012
-1.2693
0.60222
0.66201
-0.66181
-0.78853
-0.76661
-0.2446
0.96906
0.24396
-1.3597
0.079872
1.0912
0.30671
0.5757
1.1942
-0.37265
-0.15348
-0.16259
0.028869
-0.10252
0.10473
1.2044
-1.2208
-0.75592
-0.5446
-0.34936
-0.79987
-1.4023
-0.13104
-0.46432
0.079216
-0.38917
0.36207
-0.79278
-1.1265
0.083357
1.3023
-0.85105
0.065807
0.96388
-0.12916
1.09
0.089076
1.7133
-1.8379
-0.89689
0.2466
1.1425
1.7813
2.028
2.5002
2.8911
2.742
2.7165
2.1593
4.333
5.0275
3.3598
5.5858
6.4838
6.9201
5.6166
6.3335
7.4131
7.1268
6.5762
6.7152
6.8339
4.9649
7.0346
7.7847
4.0395
5.6799
4.9381
5.0001
2.9729
2.6346
2.7508
1.8195
2.6121
2.5431
0.57303
1.2708
0.14314
1.7765
-1.394
-0.32754
3.349
0.85253
1.0331
1.0974
-0.10298
-0.2349
0.37345
0.43714
-0.021712
-1.8485
1.0306
-0.51161
1.0095
0.017927
0.029016
-0.52681
-1.5543
-0.37856
0.95705
-1.7858
0.83317
0.18818
-0.4865
0.60845
-0.71101
-0.89356
-0.20043
0.4842
0.21177
0.40839
1.7479
1.1724
1.9265
2.6437
-1.6559
-0.68976
-0.017169
1.5001
0.8215
1.5963
0.54355
-0.72756
-0.36009
-0.22316
-0.52598
-0.29642
-0.029568
-1.0336
1.06
0.38794
-0.27812
-0.35033
-0.22645
0.20176
0.70605
-0.038814
-0.34347
-0.62761
-0.5028
0.5461
1.1276
1.24
-0.64214
-1.4566
1.3312
0.053646
1.2391
0.73185
1.1131
0.32015
-0.57213
-3.536
-0.59941
-0.03819
-1.3105
-0.50005
-0.44309
0.57528
0.086497
2.4384
1.1295
-0.1952
-0.044796
1.522
1.5067
2.9494
3.9087
3.3204
5.2219
5.6532
3.944
5.0768
5.0749
2.03
3.8737
4.5364
1.0323
2.1827
1.6892
1.4933
0.70228
3.0377
4.1547
5.5056
5.0936
7.249
7.724
7.5035
8.8902
8.7646
7.9654
5.7719
9.7688

82
denoise.html Normal file
View File

@ -0,0 +1,82 @@
<div class="row marketing">
<div class="col-md-3"></div>
<div class="col-md-6 col-sm-12">
<select class="wide-control form-control default" data-ng-model="selected.wdisplay"
data-ng-options="wdisplays.indexOf(e) as e for e in wdisplays" data-ng-change="updateGraph()">
<option value=""> Select Outputs </option>
</select>
</div>
<div class="col-md-3"></div>
</div>
<div class="row marketing">
<div class="col-md-2"></div>
<div class="col-md-8 col-sm-12">
<div id="graph1" style="width:100%"></div>
</div>
<div class="col-md-2"></div>
</div>
<div class="row marketing">
<div class="col-md-6">
<select class="wide-control form-control default" data-ng-model="selected.dnmethod"
data-ng-options="d.dnmethod for d in dnmethods" required>
<option value=""> Denoising Method </option>
</select>
</div>
<div class="col-md-6">
<select class="wide-control form-control default" data-ng-model="selected.threshold"
data-ng-options="t.threshold for t in thresholds" required>
<option value=""> Thresholding Method </option>
</select>
</div>
<div class="col-md-6">
<select class="wide-control form-control default" data-ng-model="selected.family"
data-ng-options="a.family for a in wavedb" required>
<option value=""> Wavelet Family </option>
</select>
</div>
<div class="col-md-6">
<select class="wide-control form-control default" data-ng-model="selected.wavelet"
data-ng-options="b.wavelet for b in selected.family.wavelets" data-ng-change="getMaxIter()" required>
<option value=""> Wavelet </option>
</select>
</div>
<div class="col-md-6">
<select class="wide-control form-control default" data-ng-model="selected.method"
data-ng-options="c.method for c in methods" required>
<option value=""> Wavelet Methods </option>
</select>
</div>
<div class="col-md-6">
<select class="wide-control form-control default" data-ng-model="selected.level"
data-ng-options="e for e in levels" required>
<option value=""> Decomposition Levels </option>
</select>
</div>
<div class="col-md-6">
<button class="btn btn-primary btn-block" data-ng-click="denoiseSignal()">
<span class="glyphicon glyphicon-share-alt pull-left" data-position="left"></span>GO</button>
</div>
<div class="col-md-6">
<button class="btn btn-primary btn-block" id="reportButton" data-ng-click="viewReport()" disabled>
<span class="glyphicon glyphicon-share-alt pull-left" data-position="left"></span>View Report</button>
</div>
<script type="text/ng-template" id="myModalContent2.html">
<div class="modal-header">
<h3 class="modal-title" style="font-family:Lucida Console;color:black;font-size:large">Wavelet Denoising Output</h3>
</div>
<div class="modal-body" style="font-family:Lucida Console;color:blue;font-size:small">
<p>Method : {{method}} ({{ext}})</p>
<p>Wavelet : {{wname}}</p>
<p>Denoising : {{dnmethod}}</p>
<p>Threshold : {{threshold}}</p>
<p>Decomposition level : {{level}}</p>
<p>Denoised Signal : [<span data-ng-repeat="a1 in appx track by $index">{{a1}} {{$last ? '' : ', '}}</span>]</p>
</div>
<div class="modal-footer">
<!--button class="btn btn-primary" type="button" ng-click="ok()" disabled>OK</button-->
<button class="btn btn-warning" type="button" ng-click="cancel()">Cancel</button>
</div>
</script>
</div>

57
frdenoise.html Normal file
View File

@ -0,0 +1,57 @@
<div class="header clearfix">
<h3 class="text-muted">Wavelib : Wavelet Transform Online Demo</h3>
</div>
<div class="row marketing">
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">
<h4> Test Signals</h4>
</div>
<div class="panel-body">
<button class="btn btn-primary btn-block"><span class="glyphicon glyphicon-hand-down pull-left" data-position="left">
</span>Select Example</button>
<select class="wide-control form-control default" data-ng-model="tvalue" data-ng-change="testInput()" id="testsig1">
<option value=""> SELECT INPUT </option>
<option>Noisy Bumps</option>
<option>Noisy Doppler</option>
<option>Noisy Heavisine</option>
<option>Noisy Piecewise Polynomial</option>
<option>Noisy Piecewise Regular</option>
</select>
</div>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">
<h4>Data Input</h4>
</div>
<div class="panel-body">
<input class="wide-control form-control default" type="text" data-ng-model="inp1" placeholder="Copy and Paste Data Vector">
<button class="btn btn-primary btn-block" data-ng-click="dataInput()">
<span class="glyphicon glyphicon-share-alt pull-left" data-position="left"></span>GO</button>
</div>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">
<h4> File Input</h4>
</div>
<div class="panel-body">
<span class="btn btn-block btn-primary btn-file">
Browse<input type="file" id="finp1" ></input>
</span>
<button class="btn btn-primary btn-block" data-ng-click="fileInput()" data-uib="twitter%20bootstrap/button" data-ver="1">
<span class="glyphicon glyphicon-folder-open pull-left" data-position="left"></span>Upload</button>
</div>
</div>
</div>
</div>

View File

@ -1,19 +1,19 @@
<div class="header clearfix">
<h3 class="text-muted">Wavelib : Wavelet Transform Online Demo</h3>
</div>
<div class="header clearfix">
<h3 class="text-muted">Wavelib : Wavelet Transform Online Demo</h3>
</div>
<div class="row marketing">
<div class="row marketing">
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">
<h4> Test Signals</h4>
</div>
<div class="panel-body">
<button class="btn btn-primary btn-block"><span class="glyphicon glyphicon-hand-down pull-left" data-position="left">
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">
<h4> Test Signals</h4>
</div>
<div class="panel-body">
<button class="btn btn-primary btn-block"><span class="glyphicon glyphicon-hand-down pull-left" data-position="left">
</span>Select Example</button>
<select class="wide-control form-control default" data-ng-model="tvalue" data-ng-change="testInput()" id="testsig1">
<select class="wide-control form-control default" data-ng-model="tvalue" data-ng-change="testInput()" id="testsig1">
<option value=""> SELECT INPUT </option>
<option>ECG</option>
<option>Heavisine</option>
@ -24,37 +24,37 @@
<option>Noisy Heavisine</option>
<option>El Nino Data</option>
</select>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">
<h4>Data Input</h4>
</div>
<div class="panel-body">
<input class="wide-control form-control default" type="text" data-ng-model="inp1" placeholder="Copy and Paste Data Vector">
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">
<h4>Data Input</h4>
</div>
<div class="panel-body">
<input class="wide-control form-control default" type="text" data-ng-model="inp1" placeholder="Copy and Paste Data Vector">
<button class="btn btn-primary btn-block" data-ng-click="dataInput()">
<button class="btn btn-primary btn-block" data-ng-click="dataInput()">
<span class="glyphicon glyphicon-share-alt pull-left" data-position="left"></span>GO</button>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">
<h4> File Input</h4>
</div>
<div class="panel-body">
<span class="btn btn-block btn-primary btn-file">
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">
<h4> File Input</h4>
</div>
<div class="panel-body">
<span class="btn btn-block btn-primary btn-file">
Browse<input type="file" id="finp1" ></input>
</span>
<button class="btn btn-primary btn-block" data-ng-click="fileInput()" data-uib="twitter%20bootstrap/button" data-ver="1">
<button class="btn btn-primary btn-block" data-ng-click="fileInput()" data-uib="twitter%20bootstrap/button" data-ver="1">
<span class="glyphicon glyphicon-folder-open pull-left" data-position="left"></span>Upload</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

26181
js/angular.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,10 @@ app.config(function($routeProvider){
templateUrl: 'front.html',
controller: 'mainController'
})
.when('/frdenoise', {
templateUrl: 'frdenoise.html',
controller: 'mainController'
})
.when('/display', {
templateUrl: 'display.html',
controller: 'displayController'
@ -19,6 +23,10 @@ app.config(function($routeProvider){
templateUrl: 'cdisplay.html',
controller: 'cdisplayController'
})
.when('/denoise', {
templateUrl: 'denoise.html',
controller: 'denoiseController'
})
.when('/about', {
templateUrl: 'about.html',
controller: 'mainController'
@ -39,13 +47,18 @@ app.controller('mainController', function ($scope, $http, wave) {
if (value == "Discrete Wavelet Transform") {
wave.transform = 1;
location.href = '#/front';
} else if (value == "Continuous Wavelet Transform") {
wave.transform = 2;
location.href = '#/front';
} else if (value == "Wavelet Packet Transform") {
wave.transform = 3;
location.href = '#/front';
} else if (value == "Wavelet Denoising" || value == "Wavelet Denoising (BETA)") {
wave.transform = 4;
location.href = '#/frdenoise';
}
location.href = '#/front';
}
@ -83,6 +96,8 @@ app.controller('mainController', function ($scope, $http, wave) {
location.href = '#/display';
} else if (wave.transform == 2) {
location.href = '#/cdisplay';
} else if (wave.transform == 4) {
location.href = '#/denoise';
}
}
@ -147,6 +162,8 @@ app.controller('mainController', function ($scope, $http, wave) {
location.href = '#/display';
} else if (wave.transform == 2) {
location.href = '#/cdisplay';
} else if (wave.transform == 4) {
location.href = '#/denoise';
}
}
@ -171,8 +188,14 @@ app.controller('mainController', function ($scope, $http, wave) {
urlx = "https://raw.githubusercontent.com/rafat/rafat.github.io/master/sites/wavelib/data/piecepoly.txt";
} else if (value == "Noisy Bumps") {
urlx = "https://raw.githubusercontent.com/rafat/rafat.github.io/master/sites/wavelib/data/noisybumps.txt";
} else if (value == "Noisy Doppler") {
urlx = "https://raw.githubusercontent.com/rafat/rafat.github.io/master/sites/wavelib/data/noisydoppler.txt";
} else if (value == "Noisy Heavisine") {
urlx = "https://raw.githubusercontent.com/rafat/rafat.github.io/master/sites/wavelib/data/noisyheavisine.txt";
} else if (value == "Noisy Piecewise Polynomial") {
urlx = "https://raw.githubusercontent.com/rafat/rafat.github.io/master/sites/wavelib/data/noisypiecepoly.txt";
} else if (value == "Noisy Piecewise Regular") {
urlx = "https://raw.githubusercontent.com/rafat/rafat.github.io/master/sites/wavelib/data/noisypieceregular.txt";
} else if (value == "El Nino Data") {
urlx = "https://raw.githubusercontent.com/rafat/rafat.github.io/master/sites/wavelib/data/sst_nino3.dat";
} else {
@ -217,6 +240,8 @@ app.controller('mainController', function ($scope, $http, wave) {
location.href = '#/display';
} else if (wave.transform == 2) {
location.href = '#/cdisplay';
} else if (wave.transform == 4) {
location.href = '#/denoise';
}
}, function (response) {
$scope.data = response.data || "Request failed";
@ -660,6 +685,364 @@ app.controller('reportController', function ($scope, $modalInstance, items, wave
};
});
app.controller('denoiseController', function ($scope, $http, $modal, wave) {
var lbl = [];
var sigData = [];
$scope.MaxIter = 0;
$scope.selected = {};
$scope.wdisplays = [];
for (var i = 0; i < wave.sigLength; ++i) {
lbl[i] = i;
sigData[i] = wave.sigData[i];
}
var g = {
x: lbl,
y: sigData,
type: 'scatter'
}
var gdata = [g];
Plotly.newPlot('graph1',gdata);
$scope.levels = [];
$scope.getMaxIter = function () {
var flength = $scope.selected.wavelet.filtlength;
var slength = wave.sigLength;
$scope.MaxIter = Math.floor(Math.log(slength / (flength - 1)) / Math.log(2.0));
$scope.levels = [];
for (var i = 0; i < $scope.MaxIter; i++) {
$scope.levels[i] = i + 1;
}
}
$scope.dnmethods = [
{
"id": "0",
"dnmethod": "Sureshrink"
}, {
"id": "1",
"dnmethod": "Visushrink"
}
];
$scope.thresholds = [
{
"id": "0",
"threshold": "soft"
}, {
"id": "1",
"threshold": "hard"
}
];
$scope.wavedb = [
{
"id": "0",
"family": "haar",
"wavelets": [
{ "wavelet": "haar", "filtlength": "2" }
]
}, {
"id": "1",
"family": "daubechies",
"wavelets": [
{ "wavelet": "db1", "filtlength": "2" },
{ "wavelet": "db2", "filtlength": "4" },
{ "wavelet": "db3", "filtlength": "6" },
{ "wavelet": "db4", "filtlength": "8" },
{ "wavelet": "db5", "filtlength": "10" },
{ "wavelet": "db6", "filtlength": "12" },
{ "wavelet": "db7", "filtlength": "14" },
{ "wavelet": "db8", "filtlength": "16" },
{ "wavelet": "db9", "filtlength": "18" },
{ "wavelet": "db10", "filtlength": "20" },
{ "wavelet": "db11", "filtlength": "22" },
{ "wavelet": "db12", "filtlength": "24" },
{ "wavelet": "db13", "filtlength": "26" },
{ "wavelet": "db14", "filtlength": "28" },
{ "wavelet": "db15", "filtlength": "30" }
]
}, {
"id": "2",
"family": "biorthogonal",
"wavelets": [
{ "wavelet": "bior1.1", "filtlength": "2" },
{ "wavelet": "bior1.3", "filtlength": "6" },
{ "wavelet": "bior1.5", "filtlength": "10" },
{ "wavelet": "bior2.2", "filtlength": "6" },
{ "wavelet": "bior2.4", "filtlength": "10" },
{ "wavelet": "bior2.6", "filtlength": "14" },
{ "wavelet": "bior2.8", "filtlength": "18" },
{ "wavelet": "bior3.1", "filtlength": "4" },
{ "wavelet": "bior3.3", "filtlength": "8" },
{ "wavelet": "bior3.5", "filtlength": "12" },
{ "wavelet": "bior3.7", "filtlength": "16" },
{ "wavelet": "bior3.9", "filtlength": "20" },
{ "wavelet": "bior4.4", "filtlength": "10" },
{ "wavelet": "bior5.5", "filtlength": "12" },
{ "wavelet": "bior6.8", "filtlength": "18" }
]
}, {
"id": "3",
"family": "coiflets",
"wavelets": [
{ "wavelet": "coif1", "filtlength": "6" },
{ "wavelet": "coif2", "filtlength": "12" },
{ "wavelet": "coif3", "filtlength": "18" },
{ "wavelet": "coif4", "filtlength": "24" },
{ "wavelet": "coif5", "filtlength": "30" }
]
}, {
"id": "4",
"family": "symmlets",
"wavelets": [
{ "wavelet": "sym2", "filtlength": "4" },
{ "wavelet": "sym3", "filtlength": "6" },
{ "wavelet": "sym4", "filtlength": "8" },
{ "wavelet": "sym5", "filtlength": "10" },
{ "wavelet": "sym6", "filtlength": "12" },
{ "wavelet": "sym7", "filtlength": "14" },
{ "wavelet": "sym8", "filtlength": "16" },
{ "wavelet": "sym9", "filtlength": "18" },
{ "wavelet": "sym10", "filtlength": "20" }
]
}
];
$scope.methods = [
{
"id": "0",
"method": "DWT (Symmetric)"
}, {
"id": "1",
"method": "DWT (Periodic)"
}, {
"id": "2",
"method": "SWT"
}, {
"id": "3",
"method": "MODWT"
}
];
$scope.denoiseSignal = function () {
var method;
var ext = "NULL";
var dnmethod;
var threshold;
if (typeof $scope.selected.family == 'undefined' || typeof $scope.selected.wavelet == 'undefined' ||
typeof $scope.selected.method == 'undefined' || typeof $scope.selected.dnmethod == 'undefined' ||
typeof $scope.selected.threshold == 'undefined') {
alert("Please Selct All Values : Family, Wavelet, Transform Method, denoising method and Thresholding");
return;
}
if ($scope.selected.method.id == "0") {
method = "dwt";
ext = "sym";
} else if ($scope.selected.method.id == "1") {
method = "dwt";
ext = "per";
} else if ($scope.selected.method.id == "2") {
method = "swt";
ext = "per";
} else if ($scope.selected.method.id == "3") {
method = "modwt";
ext = "per";
}
//console.log($scope.selected.dnmethod);
if ($scope.selected.family.family == "biorthogonal" && method == "modwt") {
alert("the Method MODWT is not implemented for biorthogonal wavelets");
return;
}
if (method == "swt") {
var div = parseInt(Math.pow(2, J));
if ((N % div) != 0) {
alert("In SWT the data length should be divisible by 2^(Number of Decomposition Levels)");
return;
}
}
dnmethod = $scope.selected.dnmethod.dnmethod;
threshold = $scope.selected.threshold.threshold;
//console.log(threshold);
var N = wave.sigLength;
var flength = $scope.selected.wavelet.filtlength;
var J = $scope.selected.level;
//console.log(wave.sigData);
wave.J = J;
wave.method = method;
wave.ext = ext;
wave.dnmethod = dnmethod;
wave.threshold = threshold;
//wave.output = [];
//wave.filters = [];
wave.wname = $scope.selected.wavelet.wavelet;
//console.log(wave.sigData, N, wave.wname, method, J, ext, wave.output, wave.length, wave.lenlength, wave.filters, flength);
var wave_denoise = Module.cwrap('wdenoise', 'null', ['number', 'number', 'number','string','string','string','string','string','number']);
//[wave.sigData, N, wave.wname, method, J, ext, wave.output, wave.length, wave.lenlength, wave.filters, flength]);
//[wave.sigData,N,J,wave.wname,method,ext,dnmethod.threshold,wave.denoised]
//input signal on heap
var inpdata = wave.sigLength * wave.sigData.BYTES_PER_ELEMENT;
var inpPtr = Module._malloc(inpdata);
var inpHeap = new Uint8Array(Module.HEAPU8.buffer, inpPtr, inpdata);
inpHeap.set(new Uint8Array(wave.sigData.buffer));
//output on heap
var outdata = wave.sigLength * wave.sigData.BYTES_PER_ELEMENT;
var outPtr = Module._malloc(outdata);
var outHeap = new Uint8Array(Module.HEAPU8.buffer, outPtr, outdata);
//inpHeap.set(new Uint8Array(wave.sigData.buffer));
//wave_transform(inpHeap.byteOffset, N, wave.wname, method, J, ext, outHeap.byteOffset, lenHeap.byteOffset, filtHeap.byteOffset);
wave_denoise(inpHeap.byteOffset,N,J,dnmethod,wave.wname,method,ext,threshold,outHeap.byteOffset)
wave.denoised = new Float64Array(outHeap.buffer, outHeap.byteOffset, wave.sigLength);
//console.log(wave.filter);
Module._free(inpHeap.byteOffset);
Module._free(outHeap.byteOffset);
$scope.wdisplays = new Array(3);
$scope.wdisplays[0] = "Input Signal";
$scope.wdisplays[1] = "Denoised Signal";
$scope.wdisplays[2] = "Noise";
var lbl = [];
var sigData = [];
for (var i = 0; i < wave.sigLength; ++i) {
lbl[i] = i;
sigData[i] = wave.denoised[i];
}
var g = {
x: lbl,
y: sigData,
type: 'scatter'
}
var gdata = [g];
Plotly.newPlot('graph1',gdata);
/*
g = new Dygraph(document.getElementById("graph1"),
lbl,
{
legend: 'always',
color: '#3399ff',
animatedZooms: true,
title: 'Full Decomposition'
}
);
*/
document.getElementById("reportButton").disabled = false;
}
$scope.updateGraph = function () {
//console.log($scope.selected.wdisplay);
var lbl = [];
var sigData = [];
if ($scope.selected.wdisplay == 0) {
for (var i = 0; i < wave.sigLength; ++i) {
lbl[i] = i ;
sigData[i] = wave.sigData[i];
}
} else if ($scope.selected.wdisplay == 1) {
for (var i = 0; i < wave.sigLength; ++i) {
lbl[i] = i;
sigData[i] = wave.denoised[i];
}
} else if ($scope.selected.wdisplay == 2) {
for (var i = 0; i < wave.sigLength; ++i) {
lbl[i] = i;
sigData[i] = wave.sigData[i] - wave.denoised[i];
}
}
var g = {
x: lbl,
y: sigData,
type: 'scatter'
}
var gdata = [g];
Plotly.newPlot('graph1',gdata);
}
$scope.items = ['item1', 'item2', 'item3'];
$scope.viewReport = function () {
//window.open('#/report', '_blank');
var modalInstance = $modal.open({
templateUrl: 'myModalContent2.html',
controller: 'dreportController',
windowClass: 'large-Modal',
resolve: {
items: function () {
return $scope.items;
}
}
});
modalInstance.result.then(function (selectedItem) {
$scope.selected = selectedItem;
});
}
});
app.controller('dreportController', function ($scope, $modalInstance, items, wave) {
//$scope.wname = wave.wname;
$scope.length = wave.sigLength;
$scope.method = wave.method;
$scope.ext = wave.ext;
$scope.dnmethod = wave.dnmethod;
$scope.threshold = wave.threshold;
$scope.wname = wave.wname;
$scope.level = wave.J;
$scope.appx = [];
for (var i = 0; i < $scope.length; i++) {
$scope.appx[i] = wave.denoised[i];
}
//console.log($scope.details);
$scope.items = items;
$scope.selected = {
item: $scope.items[0]
};
/*
$scope.ok = function () {
$modalInstance.close($scope.selected.item);
};
*/
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
});
app.controller('cdisplayController', function ($scope, $http, wave) {
//console.log(wave.sigLength);
var lbl = [];

90269
js/plotly.js Normal file

File diff suppressed because it is too large Load Diff

17
js/wavelib.bak3.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4,11 +4,12 @@
<div class="panel panel-default">
<div class="panel-body">
<button class="btn btn-primary btn-block"><span class="glyphicon glyphicon-hand-down pull-left" data-position="left">
</span>Select Wavelet Transform</button>
</span>Selection</button>
<select class="wide-control form-control default" data-ng-model="transform" data-ng-change="setTransform()" id="wavevalue">
<option value=""> Select Wavelet Transform </option>
<option value=""> Make A Selection </option>
<option>Discrete Wavelet Transform</option>
<option>Continuous Wavelet Transform</option>
<option>Wavelet Denoising (BETA)</option>
</select>
</div>
</div>