This repository has been archived by the owner on Sep 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from spectre-team/develop
Release 3.5.1 Introduces: * skeleton for signal processing through wavelets Fixes: * build dependencies problems
- Loading branch information
Showing
25 changed files
with
973 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* ConvolutionTest.cpp | ||
* Tests convolution of the signal with given filter. | ||
* | ||
Copyright 2018 Michal Gallus | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
#include <gtest/gtest.h> | ||
#include "Spectre.libWavelet\Convolution.h" | ||
|
||
namespace | ||
{ | ||
using namespace spectre::algorithm::wavelet; | ||
|
||
TEST(ConvolutionInitialization, initializes) | ||
{ | ||
EXPECT_NO_THROW(Convolution()); | ||
} | ||
|
||
class ConvolutionTest : public ::testing::Test | ||
{ | ||
protected: | ||
Convolution convolution; | ||
}; | ||
|
||
TEST_F(ConvolutionTest, properly_convolves_the_kernel_over_a_signal) | ||
{ | ||
Signal signal = { 1.0, 2.0, 3.0, 4.0 }; | ||
Signal kernel = { -0.5, 1.0 }; | ||
Signal result = convolution.Convolve(kernel, signal); | ||
Signal correctResult = { -0.5, 0.0, 0.5, 1.0 }; | ||
ASSERT_EQ(correctResult, result); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/Spectre.libWavelet.Tests/MeanAbsoluteDeviationNoiseEstimatorTest.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* MeanAbsoluteDeviationNoiseEstimatorTest.cpp | ||
* Tests Mean Absolute Deviation noise estimator. | ||
* | ||
Copyright 2018 Michal Gallus | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
#include <gtest/gtest.h> | ||
#include "Spectre.libWavelet\MeanAbsoluteDeviationNoiseEstimator.h" | ||
|
||
namespace | ||
{ | ||
using namespace spectre::algorithm::wavelet; | ||
|
||
TEST(MeanAbsoluteDeviationNoiseEstimatorInitialization, initializes) | ||
{ | ||
EXPECT_NO_THROW(MeanAbsoluteDeviationNoiseEstimator(5.0)); | ||
EXPECT_NO_THROW(MeanAbsoluteDeviationNoiseEstimator()); | ||
} | ||
|
||
class MeanAbsoluteDeviationNoiseEstimatorTest : public ::testing::Test | ||
{ | ||
protected: | ||
MeanAbsoluteDeviationNoiseEstimator estimator; | ||
}; | ||
|
||
TEST_F(MeanAbsoluteDeviationNoiseEstimatorTest, estimates_noise_for_regular_input) | ||
{ | ||
Signal signal = { 1.0f, 2.0f, 3.0f }; | ||
DataType maxAbsoluteError = 0.0001; | ||
constexpr DataType result = static_cast<DataType>(1.4650890114825907); | ||
|
||
DataType estimate = estimator.Estimate(signal); | ||
ASSERT_NEAR(estimate, result, maxAbsoluteError); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* SoftThresholderTest.cpp | ||
* Testing of the soft tresholding. | ||
* | ||
Copyright 2018 Michal Gallus | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
#include <gtest/gtest.h> | ||
#include "Spectre.libWavelet\SoftThresholder.h" | ||
|
||
namespace | ||
{ | ||
using namespace spectre::algorithm::wavelet; | ||
|
||
TEST(SoftThresholderInitialization, initializes) | ||
{ | ||
EXPECT_NO_THROW(SoftThresholder(0.0)); | ||
EXPECT_NO_THROW(SoftThresholder(9.0)); | ||
EXPECT_NO_THROW(SoftThresholder(-11.0)); | ||
} | ||
|
||
class SoftThresholderTest : public ::testing::Test | ||
{ | ||
public: | ||
SoftThresholderTest() : tresholder(1.0) {} | ||
protected: | ||
SoftThresholder tresholder; | ||
}; | ||
|
||
TEST_F(SoftThresholderTest, properly_tresholds_signal) | ||
{ | ||
Signal input = { -1.0f, 2.0f, -3.0f, 4.0f }; | ||
Signal output = tresholder(input); | ||
Signal correctOutput = { -0.0f, 1.0f, -2.0f, 3.0f }; | ||
ASSERT_EQ(correctOutput, output); | ||
} | ||
} |
Oops, something went wrong.