-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsyn2_denoising.m
278 lines (254 loc) · 7.37 KB
/
syn2_denoising.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
clc
clear
%% --------------------- loading data ------------------------------
% load('data_noise_new7.mat');
% data.org = data_noise;
% load original_synthetic_data.mat;
% pure_noise = data_noise - data_e;
% data.org = pure_noise + data_e;
addpath(genpath('./subroutines'));
load('ex_synth+Noise.mat');
data.org = syntNoisy3_z;
load('ex_synth.mat');
data_e = synt_80_z(1:length(syntNoisy3_z));
data_noise = syntNoisy3_z;
figure
plot(data_e)
figure
plot(data_noise)
%% ------------------ papameters input ----------------------------
sample = 10; % Sampling rate of seismic record
% -------------
% 1、If the band range of the effective signal is known in advance
% the band range of the effective signal can be set
% 2、If the band range of the effective signal is unknown in advance,
% the band range of the effective signal can be set of 0~ 1/sample/2
%
opt.f_s = 0; % The cut-off frequency1
opt.f_e = sample/2; % The cut-off frequency2
opt.dt = 1/sample; % sampling time (sec)
% opt.nrs is the starting sample when calculating the ROV curve.
opt.nrs = 8;
% opt.bwconn is the connectivity form (4 or 8) of the pixel.
opt.bwconn = 4;
%% --------------- Start the denoising program ---------------------------
tic
dn = para_free_denoising0(data, opt);
toc
[noise_free_tf, ~] = wsst(data_e, sample);
% pure_noise = data_noise - data_e;
%% ------------------ map the denoising result -----------------------------
t = 1:length(data_noise);
tt = t/sample;
t_max = length(data_noise)/sample;
%%
font1 = 15;
line1 = 1;
tf_max = max(max(abs(dn.org_tf)));
clim2 = 0.5;
f1 = 0;
f2 = sample/2;
f_tick = [f1:1:f2];
for i =1
figure
subplot 221
plot(tt, data_e(t), 'LineWidth', line1)
xlim([0 t_max]);
ylim([-1 1]);
xlabel('Time (s)', 'FontWeight','bold');
ylabel('Normalized amplitude', 'FontWeight','bold');
set(gca, 'fontsize', font1, 'TickDir', 'out')
grid minor;
grid on;
subplot 222
pcolor(tt, dn.org_f, abs(noise_free_tf(:, t)));
shading interp;
ylim([f1 f2]);
xlim([0 t_max]);
xlabel('Time (s)', 'FontWeight','bold');
ylabel('Frequency (Hz)', 'FontWeight','bold');
set(gca, 'fontsize', font1, 'ytick', f_tick, 'TickDir', 'out');
clim([0 max(max(abs(noise_free_tf)))*clim2]);
grid minor;
grid on;
subplot 223
plot(tt, data_noise, 'LineWidth', line1)
xlim([0 t_max]);
ylim([-1 1]);
xlabel('Time (s)', 'FontWeight','bold');
ylabel('Normalized amplitude', 'FontWeight','bold');
set(gca, 'fontsize', font1, 'TickDir', 'out')
grid minor;
grid on;
subplot 224
pcolor(tt, dn.org_f, (abs(dn.org_tf)));
% imagesc(tt, (dn.org_f), (abs(dn.org_tf)));
shading interp;
ylim([f1 f2]);
xlim([0 t_max]);
xlabel('Time (s)', 'FontWeight','bold');
ylabel('Frequency (Hz)', 'FontWeight','bold');
set(gca, 'fontsize', font1, 'ytick', f_tick, 'TickDir', 'out');
clim([0 tf_max*clim2]);
grid minor;
grid on;
end
%%
for i =1
figure
subplot 321
plot(tt, data_noise./max(abs(data_noise)), 'LineWidth', line1)
xlim([0 t_max]);
ylim([-1 1]);
xlabel('Time (s)', 'FontWeight','bold');
ylabel('Normalized amplitude', 'FontWeight','bold');
set(gca, 'fontsize', font1, 'TickDir', 'out')
grid minor;
grid on;
subplot 322
pcolor(tt, dn.org_f, abs(dn.org_tf));
shading interp;
ylim([f1 f2]);
xlim([0 t_max]);
xlabel('Time (s)', 'FontWeight','bold');
ylabel('Frequency (Hz)', 'FontWeight','bold');
set(gca, 'fontsize', font1, 'ytick', f_tick, 'TickDir', 'out');
clim([0 max(max(abs(noise_free_tf)))*clim2]);
grid minor;
grid on;
subplot 323
plot(tt, dn.gcv_dw./max(abs(dn.gcv_dw)), 'LineWidth', line1)
xlim([0 t_max]);
ylim([-1 1]);
xlabel('Time (s)', 'FontWeight','bold');
ylabel('Normalized amplitude', 'FontWeight','bold');
set(gca, 'fontsize', font1, 'TickDir', 'out')
grid minor;
grid on;
subplot 324
pcolor(tt, dn.org_f, (abs(dn.gcv_tf)));
% imagesc(tt, (dn.org_f), (abs(dn.org_tf)));
shading interp;
ylim([f1 f2]);
xlim([0 t_max]);
xlabel('Time (s)', 'FontWeight','bold');
ylabel('Frequency (Hz)', 'FontWeight','bold');
set(gca, 'fontsize', font1, 'ytick', f_tick, 'TickDir', 'out');
clim([0 tf_max*clim2]);
grid minor;
grid on;
subplot 325
plot(tt, dn.final_dw./max(abs(dn.final_dw)), 'LineWidth', line1)
xlim([0 t_max]);
ylim([-1 1]);
xlabel('Time (s)', 'FontWeight','bold');
ylabel('Normalized amplitude', 'FontWeight','bold');
set(gca, 'fontsize', font1, 'TickDir', 'out')
grid minor;
grid on;
subplot 326
pcolor(tt, dn.org_f, (abs(dn.final_tf)));
% imagesc(tt, (dn.org_f), (abs(dn.org_tf)));
shading interp;
ylim([f1 f2]);
xlim([0 t_max]);
xlabel('Time (s)', 'FontWeight','bold');
ylabel('Frequency (Hz)', 'FontWeight','bold');
set(gca, 'fontsize', font1, 'ytick', f_tick, 'TickDir', 'out');
clim([0 tf_max*clim2]);
grid minor;
grid on;
end
%%
for i = 1
figure
subplot 321
plot(tt, data_e(t), 'LineWidth', line1)
xlim([0 t_max]);
ylim([-1 1]);
xlabel('Time (s)', 'FontWeight','bold');
ylabel('Normalized amplitude', 'FontWeight','bold');
set(gca, 'fontsize', font1, 'TickDir', 'out')
grid minor;
grid on;
axes('Position',[0.35656819610308 0.853122362869192 0.16 0.11]); % 生成子图 最简单的方式
x = t(26*sample: 34*sample);
y1 = data_e(x);
% y2 = dn.final_dw(x);
plot(tt(x),y1,'linewidth', 1);
set(gca,'FontWeight','bold');
ylim([-0.4 0.4])
grid minor;
grid on;
subplot 322
pcolor(tt, dn.org_f, abs(noise_free_tf(:, t)));
shading interp;
ylim([f1 f2]);
xlim([0 t_max]);
xlabel('Time (s)', 'FontWeight','bold');
ylabel('Frequency (Hz)', 'FontWeight','bold');
set(gca, 'fontsize', font1, 'ytick', f_tick, 'TickDir', 'out');
clim([0 max(max(abs(noise_free_tf)))*clim2]);
grid minor;
grid on;
subplot 323
plot(tt, data_noise, 'LineWidth', line1)
xlim([0 t_max]);
ylim([-1 1]);
xlabel('Time (s)', 'FontWeight','bold');
ylabel('Normalized amplitude', 'FontWeight','bold');
set(gca, 'fontsize', font1, 'TickDir', 'out')
grid minor;
grid on;
axes('Position',[0.355939660590823 0.553544303797465 0.16 0.11]); % 生成子图 最简单的方式
x = t(26*sample: 34*sample);
y1 = data_noise(x);
% y2 = dn.final_dw(x);
plot(tt(x),y1,'linewidth', 1);
set(gca,'FontWeight','bold');
ylim([-0.4 0.4])
grid minor;
grid on;
subplot 324
pcolor(tt, dn.org_f, (abs(dn.org_tf)));
% imagesc(tt, (dn.org_f), (abs(dn.org_tf)));
shading interp;
ylim([f1 f2]);
xlim([0 t_max]);
xlabel('Time (s)', 'FontWeight','bold');
ylabel('Frequency (Hz)', 'FontWeight','bold');
set(gca, 'fontsize', font1, 'ytick', f_tick, 'TickDir', 'out');
clim([0 tf_max*clim2]);
grid minor;
grid on;
subplot 325
plot(tt, dn.final_dw./max(abs(dn.final_dw)), 'LineWidth', line1)
xlim([0 t_max]);
ylim([-1 1]);
xlabel('Time (s)', 'FontWeight','bold');
ylabel('Normalized amplitude', 'FontWeight','bold');
set(gca, 'fontsize', font1, 'TickDir', 'out')
grid minor;
grid on;
axes('Position',[0.35656819610308 0.253966244725737 0.16 0.11]); % 生成子图 最简单的方式
x = t(26*sample: 34*sample);
% y1 = data_e(x);
y1 = dn.final_dw(x);
plot(tt(x), y1,'linewidth', 1);
set(gca,'FontWeight','bold');
ylim([-0.4 0.4])
grid minor;
grid on;
subplot 326
pcolor(tt, dn.org_f, (abs(dn.final_tf)));
% imagesc(tt, (dn.org_f), (abs(dn.org_tf)));
shading interp;
ylim([f1 f2]);
xlim([0 t_max]);
xlabel('Time (s)', 'FontWeight','bold');
ylabel('Frequency (Hz)', 'FontWeight','bold');
set(gca, 'fontsize', font1, 'ytick', f_tick, 'TickDir', 'out');
clim([0 tf_max*clim2]);
grid minor;
grid on;
end