Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tff2020
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
skmad-suite
tff2020
Commits
a08c0210
Commit
a08c0210
authored
4 years ago
by
Marina Kreme
Browse files
Options
Downloads
Patches
Plain Diff
refactor
parent
c78b421b
No related branches found
No related tags found
No related merge requests found
Pipeline
#5949
passed
4 years ago
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/tfgm/tf_fading/interpolation_solver.m
+37
-18
37 additions, 18 deletions
matlab/tfgm/tf_fading/interpolation_solver.m
with
37 additions
and
18 deletions
matlab/tfgm/tf_fading/interpolation_solver.m
+
37
−
18
View file @
a08c0210
function
x_interp
=
solver_tfgm_interp
(
X
,
mask
,
idgt
)
function
x_est
=
interpolation_solver
(
x
,
mask
,
dgt
,
idgt
,
dgt_params
,
...
,
%% x_interp= solver_tfgm_interp(X, mask, idgt)
signal_params
,
fig_dir
)
%% x_est= interpolation_solver(x, mask, dgt, idgt, dgt_params,...,
% signal_params, fig_dir)
% Time-frequency fading solver using linear interpolation and random phases
% This function apply a linear interpolation along
% This function apply a linear interpolation along
% the frequency axis of the magnitude of observation time-frequency matrix
% the frequency axis of the magnitude of observation time-frequency matrix
% and draws the related phase uniformly at random.
% and draws the related phase uniformly at random.
%
%
% Inputs:
% Inputs:
% - X: time-frequency matrix
% - x (nd array): mix signal
% - mask: binary mask
% - mask (nd- array): time-frequency mask
% - idgt: Inverse of Gabor transform operator
% - idgt,dgt (handle): DGT and IDGT . see utils/get_stft_operators.m
% - dgt_params (struct) : DGT parameters
% - signal_params (struct) . :signals parameters
% - fig_dir : folder where figures are stored
% Outputs:
% Outputs:
% -x_
interp
: estimated signal
% -x_
est (nd array)
: estimated signal
%
%
%
%
% Author: Marina KREME
% Author: Marina KREME
%%
%%
x_tf
=
dgt
(
x
);
X
_abs
=
abs
(
X
);
x
_abs
=
abs
(
x_tf
);
X
_ang
=
angle
(
X
);
x
_ang
=
angle
(
x_tf
);
mask_copy
=
mask
;
mask_copy
=
mask
;
%% modulus interpolation
%%
Y
=
X_abs
.*
(
1
-
mask_copy
);
y_tf
=
x_abs
.*
(
1
-
mask_copy
);
figure
;
plotdgtreal
(
y_tf
,
dgt_params
.
(
'hop'
),
dgt_params
.
(
'nbins'
),
signal_params
.
(
'fs'
));
title
(
'Mask Before Interpolated TF matrix'
)
saveas
(
gcf
,
fullfile
(
fig_dir
,
'interp_mask.pdf'
));
figure
;
imagesc
(
Y
);
title
(
'before interp'
);
Z
=
(
Y
==
0
);
%%
z_tf
=
(
y_tf
==
0
);
y_tf
(
z_tf
)
=
interp1
(
find
(
~
z_tf
),
y_tf
(
~
z_tf
),
find
(
z_tf
),
'linear'
);
Y
(
Z
)
=
interp1
(
find
(
~
Z
),
Y
(
~
Z
),
find
(
Z
),
'linear'
);
figure
figure
;
imagesc
(
Y
);
title
(
'after interp'
)
plotdgtreal
(
y_tf
,
dgt_params
.
(
'hop'
),
dgt_params
.
(
'nbins'
),
signal_params
.
(
'fs'
));
title
(
'Interpolated TF matrix'
)
saveas
(
gcf
,
fullfile
(
fig_dir
,
'interp_tf_est.pdf'
));
%%
%%
X
_ang
(
mask
==
1
)
=
2
*
pi
*
rand
(
sum
(
mask
(:)),
1
);
x
_ang
(
mask
==
1
)
=
2
*
pi
*
rand
(
sum
(
mask
(:)),
1
);
X_interp
=
abs
(
Y
)
.*
exp
(
1
i
.*
X
_ang
);
x_est
=
abs
(
y_tf
)
.*
exp
(
1
i
.*
x
_ang
);
x_
interp
=
compute_idgt
(
X_interp
,
idg
t
);
x_
est
=
idgt
(
x_es
t
);
figure
;
plot_spectrogram
(
x_est
,
dgt_params
,
signal_params
,
dgt
);
title
(
'Reconstructed signal by interp'
)
saveas
(
gcf
,
fullfile
(
fig_dir
,
'interp_sig_est.pdf'
));
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment