Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
psrdada_cpp
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
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Tobias Winchen
psrdada_cpp
Commits
a0b932ca
Commit
a0b932ca
authored
4 years ago
by
Tobias Winchen
Browse files
Options
Downloads
Patches
Plain Diff
Use proper float comparision
parent
58591230
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
psrdada_cpp/effelsberg/edd/test/src/SpectralKurtosisTester.cpp
+6
-6
6 additions, 6 deletions
...da_cpp/effelsberg/edd/test/src/SpectralKurtosisTester.cpp
with
6 additions
and
6 deletions
psrdada_cpp/effelsberg/edd/test/src/SpectralKurtosisTester.cpp
+
6
−
6
View file @
a0b932ca
...
...
@@ -22,7 +22,7 @@ void SpectralKurtosisTester::TearDown()
{
}
void
SpectralKurtosisTester
::
test_vector_generation
(
std
::
size_t
sample_size
,
std
::
size_t
window_size
,
void
SpectralKurtosisTester
::
test_vector_generation
(
std
::
size_t
sample_size
,
std
::
size_t
window_size
,
bool
with_rfi
,
float
rfi_freq
,
float
rfi_amp
,
const
std
::
vector
<
int
>
&
rfi_window_indices
,
std
::
vector
<
std
::
complex
<
float
>>
&
samples
)
...
...
@@ -33,12 +33,12 @@ void SpectralKurtosisTester::test_vector_generation(std::size_t sample_size, std
tv
.
generate_test_vector
(
rfi_window_indices
,
samples
);
}
void
SpectralKurtosisTester
::
sk_computation
(
std
::
size_t
nch
,
std
::
size_t
window_size
,
void
SpectralKurtosisTester
::
sk_computation
(
std
::
size_t
nch
,
std
::
size_t
window_size
,
const
std
::
vector
<
std
::
complex
<
float
>>
&
samples
,
RFIStatistics
&
stat
)
{
float
sk_min
=
0.8
;
float
sk_max
=
1.2
;
float
sk_max
=
1.2
;
SpectralKurtosis
sk
(
nch
,
window_size
,
sk_min
,
sk_max
);
sk
.
compute_sk
(
samples
,
stat
);
}
...
...
@@ -68,7 +68,7 @@ TEST_F(SpectralKurtosisTester, sk_withoutRFI)
std
::
size_t
nch
=
1
;
sk_computation
(
nch
,
window_size
,
samples
,
stat
);
float
expected_rfi_fraction
=
0
;
EXPECT_EQ
(
expected_rfi_fraction
,
stat
.
rfi_fraction
);
EXPECT_
FLOAT_
EQ
(
expected_rfi_fraction
,
stat
.
rfi_fraction
);
}
TEST_F
(
SpectralKurtosisTester
,
sk_withRFI
)
...
...
@@ -83,7 +83,7 @@ TEST_F(SpectralKurtosisTester, sk_withRFI)
std
::
size_t
nch
=
1
;
sk_computation
(
nch
,
window_size
,
samples
,
stat
);
float
expected_rfi_fraction
=
(
rfi_window_indices
.
size
()
/
float
(
sample_size
/
window_size
))
+
0.01
;
EXPECT_EQ
(
expected_rfi_fraction
,
stat
.
rfi_fraction
);
//To check: fails inspite of actual and expected values being same.
EXPECT_
FLOAT_
EQ
(
expected_rfi_fraction
,
stat
.
rfi_fraction
);
//To check: fails inspite of actual and expected values being same.
}
TEST_F
(
SpectralKurtosisTester
,
sk_replacement
)
...
...
@@ -100,7 +100,7 @@ TEST_F(SpectralKurtosisTester, sk_replacement)
std
::
vector
<
int
>
rfi_window_indices
{
1
,
2
,
3
,
4
,
6
,
7
,
8
,
9
,
20
,
30
,
40
};
std
::
vector
<
std
::
complex
<
float
>>
samples
;
tv
.
generate_test_vector
(
rfi_window_indices
,
samples
);
//generating test vector
//SK
std
::
size_t
nch
=
1
;
float
sk_min
=
0.8
;
...
...
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