diff --git a/.gitattributes b/.gitattributes index b7dfa0c9310509d8ed3f4dca9c0d886d71c328c1..7957b93d97d60e347695d38736de61bd7761ee4f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -399,8 +399,8 @@ CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/noisestatisticscollector CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/polarizationstatistics.h -text CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/polfitmethod.h -text CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/rfistatistics.h -text -CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/scaleinvariantdilation.h -text CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/sinusfitter.h -text +CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/siroperator.h -text CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/statisticalflagger.h -text CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/surfacefitmethod.h -text CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/svdmitigater.h -text @@ -455,7 +455,7 @@ CEP/DP3/AOFlagger/include/AOFlagger/test/strategy/algorithms/convolutionstest.h CEP/DP3/AOFlagger/include/AOFlagger/test/strategy/algorithms/eigenvaluetest.h -text CEP/DP3/AOFlagger/include/AOFlagger/test/strategy/algorithms/noisestatisticscollectortest.h -text CEP/DP3/AOFlagger/include/AOFlagger/test/strategy/algorithms/noisestatisticstest.h -text -CEP/DP3/AOFlagger/include/AOFlagger/test/strategy/algorithms/scaleinvariantdilationtest.h -text +CEP/DP3/AOFlagger/include/AOFlagger/test/strategy/algorithms/siroperatortest.h -text CEP/DP3/AOFlagger/include/AOFlagger/test/strategy/algorithms/statisticalflaggertest.h -text CEP/DP3/AOFlagger/include/AOFlagger/test/strategy/algorithms/sumthresholdtest.h -text CEP/DP3/AOFlagger/include/AOFlagger/test/strategy/algorithms/thresholdtoolstest.h -text diff --git a/CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/scaleinvariantdilation.h b/CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/siroperator.h similarity index 90% rename from CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/scaleinvariantdilation.h rename to CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/siroperator.h index 883a5f488927c4bcf0ce802b847df39045a63e91..f89e422f19ab2acced8482d3fce491f1a2159666 100644 --- a/CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/scaleinvariantdilation.h +++ b/CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/siroperator.h @@ -1,6 +1,6 @@ -#ifndef SCALEINVARIANTDILATION_H -#define SCALEINVARIANTDILATION_H +#ifndef SIROPERATOR_H +#define SIROPERATOR_H #include <AOFlagger/msio/mask2d.h> #include <AOFlagger/msio/types.h> @@ -8,7 +8,7 @@ /** * This class contains functions that implement an algorithm to dilate - * a flag mask: the "scale invariant rank operator". + * a flag mask: the "scale-invariant rank (SIR) operator". * The amount of dilation is relative to the size of the flagged * areas in the input, hence it is scale invariant. This behaviour is very * effective for application after amplitude based RFI detection and is a step @@ -33,12 +33,12 @@ * * @author A.R. Offringa */ -class ScaleInvariantDilation +class SIROperator { public: /** * This is the proof of concept, reference version of the O(N) algorithm. It is - * fast, but DilateHorizontally() and DilateVertically() have been optimized + * fast, but OperateHorizontally() and OperateVertically() have been optimized * for operating on a mask directly, which is the common mode of operation. * * It contains extra comments to explain the algorithm within the code. @@ -49,7 +49,7 @@ class ScaleInvariantDilation * @param [in] eta The η parameter that specifies the minimum number of good data * that any subsequence should have (see class description for the definition). */ - static void Dilate(bool *flags, const unsigned flagsSize, num_t eta) + static void Operate(bool *flags, const unsigned flagsSize, num_t eta) { // The test for a sample to become flagged can be rewritten as // \\sum_{y=Y1}^{Y2-1} ( η - w(y) ) >= 0. @@ -131,9 +131,9 @@ class ScaleInvariantDilation * @param [in] eta The η parameter that specifies the minimum number of good data * that any subsequence should have. */ - static void DilateHorizontally(Mask2DPtr &mask, num_t eta) + static void OperateHorizontally(Mask2DPtr &mask, num_t eta) { - dilateHorizontally<Mask2D>(*mask, eta); + operateHorizontally<Mask2D>(*mask, eta); } /** @@ -143,14 +143,17 @@ class ScaleInvariantDilation * @param [in] eta The η parameter that specifies the minimum number of good data * that any subsequence should have. */ - static void DilateVertically(Mask2DPtr mask, num_t eta) + static void OperateVertically(Mask2DPtr mask, num_t eta) { XYSwappedMask2D swappedMask(*mask); - dilateHorizontally<XYSwappedMask2D>(swappedMask, eta); + operateHorizontally<XYSwappedMask2D>(swappedMask, eta); } + static void Operate2PassAlgorithm(bool *flags, const unsigned flagsSize, num_t eta) + { + } private: - ScaleInvariantDilation() { } + SIROperator() { } /** * Performs a horizontal dilation directly on a mask. Algorithm is equal to Dilate(). @@ -161,7 +164,7 @@ class ScaleInvariantDilation * that any subsequence should have. */ template<typename MaskLike> - static void dilateHorizontally(MaskLike &mask, num_t eta) + static void operateHorizontally(MaskLike &mask, num_t eta) { const unsigned width = mask.Width(), diff --git a/CEP/DP3/AOFlagger/include/AOFlagger/test/experiments/rankoperatorrocexperiment.h b/CEP/DP3/AOFlagger/include/AOFlagger/test/experiments/rankoperatorrocexperiment.h index e5db5fe90773f339fb40790644fa54c0646ee882..aadbc3dc711dea146a9c0c4cdc7e21a573531617 100644 --- a/CEP/DP3/AOFlagger/include/AOFlagger/test/experiments/rankoperatorrocexperiment.h +++ b/CEP/DP3/AOFlagger/include/AOFlagger/test/experiments/rankoperatorrocexperiment.h @@ -26,7 +26,7 @@ #include <AOFlagger/test/testingtools/unittest.h> #include <AOFlagger/strategy/algorithms/mitigationtester.h> -#include <AOFlagger/strategy/algorithms/scaleinvariantdilation.h> +#include <AOFlagger/strategy/algorithms/siroperator.h> #include <AOFlagger/strategy/algorithms/statisticalflagger.h> #include <AOFlagger/strategy/algorithms/thresholdtools.h> @@ -346,7 +346,7 @@ void RankOperatorROCExperiment::executeTest(enum TestType testType) { const num_t eta = (num_t) i / (num_t) ETA_STEPS; Mask2DPtr resultMask = Mask2D::CreateCopy(input); - ScaleInvariantDilation::DilateVertically(resultMask, eta); + SIROperator::OperateVertically(resultMask, eta); evaluateIterationResults(resultMask, mask, groundTruth, totalRFI, rocResults[i]); } @@ -460,7 +460,7 @@ inline void RankOperatorROCExperiment::TestNoisePerformance(size_t totalRFI, dou { Mask2DPtr tempMask = Mask2D::CreateCopy(input); const num_t eta = i/100.0; - ScaleInvariantDilation::DilateVertically(tempMask, eta); + SIROperator::OperateVertically(tempMask, eta); size_t falsePositives = tempMask->GetCount<true>(); tempMask->Invert(); num_t fpSum = ThresholdTools::Sum(inputImage, tempMask); diff --git a/CEP/DP3/AOFlagger/include/AOFlagger/test/experiments/scaleinvariantdilationexperiment.h b/CEP/DP3/AOFlagger/include/AOFlagger/test/experiments/scaleinvariantdilationexperiment.h index 05a5124d6799f0fe39f55635719ccea163d09516..479cc2bb711745856b057e6de6983c64097a89b9 100644 --- a/CEP/DP3/AOFlagger/include/AOFlagger/test/experiments/scaleinvariantdilationexperiment.h +++ b/CEP/DP3/AOFlagger/include/AOFlagger/test/experiments/scaleinvariantdilationexperiment.h @@ -25,7 +25,7 @@ #include <AOFlagger/test/testingtools/asserter.h> #include <AOFlagger/test/testingtools/unittest.h> -#include <AOFlagger/strategy/algorithms/scaleinvariantdilation.h> +#include <AOFlagger/strategy/algorithms/siroperator.h> #include <AOFlagger/strategy/algorithms/statisticalflagger.h> #include <AOFlagger/util/rng.h> @@ -81,7 +81,7 @@ inline void ScaleInvariantDilationExperiment::TestTimingN::operator()() for(unsigned repeat=0;repeat<_repeatCount;++repeat) { for(unsigned i=0;i<n;++i) flags[i] = prototypeFlags[i]; - ScaleInvariantDilation::Dilate(flags, n, eta); + SIROperator::Operate(flags, n, eta); } file << n << '\t' << (watch.Seconds()/(double) _repeatCount) << '\t' << x << std::endl; delete[] flags; diff --git a/CEP/DP3/AOFlagger/include/AOFlagger/test/strategy/algorithms/algorithmstestgroup.h b/CEP/DP3/AOFlagger/include/AOFlagger/test/strategy/algorithms/algorithmstestgroup.h index 8589ebd8d5f77178b38dca969d449932f6c73432..8316a51b562c7e920aa2b1508994894742a7af8b 100644 --- a/CEP/DP3/AOFlagger/include/AOFlagger/test/strategy/algorithms/algorithmstestgroup.h +++ b/CEP/DP3/AOFlagger/include/AOFlagger/test/strategy/algorithms/algorithmstestgroup.h @@ -26,7 +26,7 @@ #include <AOFlagger/test/strategy/algorithms/eigenvaluetest.h> #include <AOFlagger/test/strategy/algorithms/noisestatisticstest.h> #include <AOFlagger/test/strategy/algorithms/noisestatisticscollectortest.h> -#include <AOFlagger/test/strategy/algorithms/scaleinvariantdilationtest.h> +#include <AOFlagger/test/strategy/algorithms/siroperatortest.h> #include <AOFlagger/test/strategy/algorithms/statisticalflaggertest.h> #include <AOFlagger/test/strategy/algorithms/sumthresholdtest.h> #include <AOFlagger/test/strategy/algorithms/thresholdtoolstest.h> @@ -41,7 +41,7 @@ class AlgorithmsTestGroup : public TestGroup { Add(new EigenvalueTest()); Add(new NoiseStatisticsTest()); Add(new NoiseStatisticsCollectorTest()); - Add(new ScaleInvariantDilationTest()); + Add(new SIROperatorTest()); Add(new StatisticalFlaggerTest()); Add(new SumThresholdTest()); Add(new ThresholdToolsTest()); diff --git a/CEP/DP3/AOFlagger/include/AOFlagger/test/strategy/algorithms/scaleinvariantdilationtest.h b/CEP/DP3/AOFlagger/include/AOFlagger/test/strategy/algorithms/siroperatortest.h similarity index 71% rename from CEP/DP3/AOFlagger/include/AOFlagger/test/strategy/algorithms/scaleinvariantdilationtest.h rename to CEP/DP3/AOFlagger/include/AOFlagger/test/strategy/algorithms/siroperatortest.h index 7e15aa58d8fc87f573ae66dfd3f2499b2981ba53..4f38922fa470c06ee2d33ea55acd5d5bd94e02e7 100644 --- a/CEP/DP3/AOFlagger/include/AOFlagger/test/strategy/algorithms/scaleinvariantdilationtest.h +++ b/CEP/DP3/AOFlagger/include/AOFlagger/test/strategy/algorithms/siroperatortest.h @@ -17,21 +17,21 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef AOFLAGGER_SCALEINVARIANTDILATIONTEST_H -#define AOFLAGGER_SCALEINVARIANTDILATIONTEST_H +#ifndef AOFLAGGER_SIROPERATORTEST_H +#define AOFLAGGER_SIROPERATORTEST_H #include <AOFlagger/test/testingtools/asserter.h> #include <AOFlagger/test/testingtools/unittest.h> #include <AOFlagger/msio/mask2d.h> -#include <AOFlagger/strategy/algorithms/scaleinvariantdilation.h> +#include <AOFlagger/strategy/algorithms/siroperator.h> #include <AOFlagger/util/rng.h> -class ScaleInvariantDilationTest : public UnitTest { +class SIROperatorTest : public UnitTest { public: - ScaleInvariantDilationTest() : UnitTest("Scale invariant dilation") + SIROperatorTest() : UnitTest("Scale invariant dilation") { AddTest(TestSingleDilation(), "Single dilation"); AddTest(TestDilationSpeed(), "Dilation speed"); @@ -110,92 +110,92 @@ class ScaleInvariantDilationTest : public UnitTest { }; -inline void ScaleInvariantDilationTest::TestSingleDilation::operator()() +inline void SIROperatorTest::TestSingleDilation::operator()() { bool *flags = new bool[40]; setFlags(flags, " x "); - ScaleInvariantDilation::Dilate(flags, 10, 0.0); + SIROperator::Operate(flags, 10, 0.0); AssertEquals(flagsToString(flags, 10), " x ", "Eta=0.0, single center flagged, no enlarge"); - ScaleInvariantDilation::Dilate(flags, 10, 0.4); + SIROperator::Operate(flags, 10, 0.4); AssertEquals(flagsToString(flags, 10), " x ", "Eta=0.4, single center flagged"); - ScaleInvariantDilation::Dilate(flags, 10, 0.5); + SIROperator::Operate(flags, 10, 0.5); AssertEquals(flagsToString(flags, 10), " xxx ", "Eta=0.5, from one to three samples"); - ScaleInvariantDilation::Dilate(flags, 10, 0.0); + SIROperator::Operate(flags, 10, 0.0); AssertEquals(flagsToString(flags, 10), " xxx "); - ScaleInvariantDilation::Dilate(flags, 10, 0.25); + SIROperator::Operate(flags, 10, 0.25); AssertEquals(flagsToString(flags, 10), " xxxxx "); - ScaleInvariantDilation::Dilate(flags, 10, 0.16); + SIROperator::Operate(flags, 10, 0.16); AssertEquals(flagsToString(flags, 10), " xxxxx "); - ScaleInvariantDilation::Dilate(flags, 10, 0.17); + SIROperator::Operate(flags, 10, 0.17); AssertEquals(flagsToString(flags, 10), " xxxxxxx "); - ScaleInvariantDilation::Dilate(flags, 10, 1.0); + SIROperator::Operate(flags, 10, 1.0); AssertEquals(flagsToString(flags, 10), "xxxxxxxxxx"); setFlags(flags, "xx xx "); - ScaleInvariantDilation::Dilate(flags, 10, 0.0); + SIROperator::Operate(flags, 10, 0.0); AssertEquals(flagsToString(flags, 10), "xx xx "); - ScaleInvariantDilation::Dilate(flags, 10, 0.19); + SIROperator::Operate(flags, 10, 0.19); AssertEquals(flagsToString(flags, 10), "xx xx ", "Did not fill hole"); setFlags(flags, "xx xx "); - ScaleInvariantDilation::Dilate(flags, 10, 0.2); + SIROperator::Operate(flags, 10, 0.2); AssertEquals(flagsToString(flags, 10), "xxxxx ", "Fills hole"); setFlags(flags, "x "); - ScaleInvariantDilation::Dilate(flags, 10, 0.5); + SIROperator::Operate(flags, 10, 0.5); AssertEquals(flagsToString(flags, 10), "xx ", "Left border, isolated"); - ScaleInvariantDilation::Dilate(flags, 10, 0.4); + SIROperator::Operate(flags, 10, 0.4); AssertEquals(flagsToString(flags, 10), "xxx ", "Left border, combined"); setFlags(flags, " x"); - ScaleInvariantDilation::Dilate(flags, 10, 0.5); + SIROperator::Operate(flags, 10, 0.5); AssertEquals(flagsToString(flags, 10), " xx", "Right border, isolated"); - ScaleInvariantDilation::Dilate(flags, 10, 0.4); + SIROperator::Operate(flags, 10, 0.4); AssertEquals(flagsToString(flags, 10), " xxx", "Right border, combined"); setFlags(flags, " x "); - ScaleInvariantDilation::Dilate(flags, 10, 0.4); + SIROperator::Operate(flags, 10, 0.4); AssertEquals(flagsToString(flags, 10), " x ", "Left border empty"); setFlags(flags, " x "); - ScaleInvariantDilation::Dilate(flags, 10, 0.4); + SIROperator::Operate(flags, 10, 0.4); AssertEquals(flagsToString(flags, 10), " x ", "Right border empty"); // 0 5 0 5 0 5 0 5 setFlags(flags, " xxxxxx xx xx x x xxx xxxxx "); - ScaleInvariantDilation::Dilate(flags, 40, 0.2); + SIROperator::Operate(flags, 40, 0.2); AssertEquals(flagsToString(flags, 40), " xxxxxxxxxxxxx x xxxxxxxxxxxx ", "Input: ' xxxxxx xx xx x x xxx xxxxx '"); setFlags(flags, " xxxxxx xx xx x x xxx xxxxx "); - ScaleInvariantDilation::Dilate(flags, 40, 0.3); + SIROperator::Operate(flags, 40, 0.3); AssertEquals(flagsToString(flags, 40), " xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ", "Input: ' xxxxxx xx xx x x xxx xxxxx '"); setFlags(flags, " xxxxxx xx xx x x xxx xxxxx "); - ScaleInvariantDilation::Dilate(flags, 40, 0.4); + SIROperator::Operate(flags, 40, 0.4); AssertEquals(flagsToString(flags, 40), "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx "); setFlags(flags, "xxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx"); - ScaleInvariantDilation::Dilate(flags, 40, 0.3); + SIROperator::Operate(flags, 40, 0.3); AssertEquals(flagsToString(flags, 40), "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); setFlags(flags, " x x x xx xxx "); - ScaleInvariantDilation::Dilate(flags, 25, 0.5); + SIROperator::Operate(flags, 25, 0.5); AssertEquals(flagsToString(flags, 25), " xxxxxxxxxxxxxxxxxxxx"); delete[] flags; } -inline void ScaleInvariantDilationTest::TestDilationSpeed::operator()() +inline void SIROperatorTest::TestDilationSpeed::operator()() { const unsigned flagsSize = 100000; bool flags[flagsSize]; @@ -203,134 +203,134 @@ inline void ScaleInvariantDilationTest::TestDilationSpeed::operator()() { flags[i] = (RNG::Uniform() >= 0.2); } - ScaleInvariantDilation::Dilate(flags, flagsSize, 0.1); + SIROperator::Operate(flags, flagsSize, 0.1); } -inline void ScaleInvariantDilationTest::TestTimeDilation::operator()() +inline void SIROperatorTest::TestTimeDilation::operator()() { Mask2DPtr mask = Mask2D::CreateSetMaskPtr<false>(10, 1); setMask(mask, " x "); - ScaleInvariantDilation::DilateHorizontally(mask, 0.0); + SIROperator::OperateHorizontally(mask, 0.0); AssertEquals(maskToString(mask), " x ", "Eta=0.0, single center flagged, no enlarge"); - ScaleInvariantDilation::DilateHorizontally(mask, 0.4); + SIROperator::OperateHorizontally(mask, 0.4); AssertEquals(maskToString(mask), " x ", "Eta=0.4, single center flagged"); - ScaleInvariantDilation::DilateHorizontally(mask, 0.5); + SIROperator::OperateHorizontally(mask, 0.5); AssertEquals(maskToString(mask), " xxx ", "Eta=0.5, from one to three samples"); - ScaleInvariantDilation::DilateHorizontally(mask, 0.0); + SIROperator::OperateHorizontally(mask, 0.0); AssertEquals(maskToString(mask), " xxx "); - ScaleInvariantDilation::DilateHorizontally(mask, 0.25); + SIROperator::OperateHorizontally(mask, 0.25); AssertEquals(maskToString(mask), " xxxxx "); - ScaleInvariantDilation::DilateHorizontally(mask, 0.16); + SIROperator::OperateHorizontally(mask, 0.16); AssertEquals(maskToString(mask), " xxxxx "); - ScaleInvariantDilation::DilateHorizontally(mask, 0.17); + SIROperator::OperateHorizontally(mask, 0.17); AssertEquals(maskToString(mask), " xxxxxxx "); - ScaleInvariantDilation::DilateHorizontally(mask, 0.6); + SIROperator::OperateHorizontally(mask, 0.6); AssertEquals(maskToString(mask), "xxxxxxxxxx"); - ScaleInvariantDilation::DilateHorizontally(mask, 1.0); + SIROperator::OperateHorizontally(mask, 1.0); AssertEquals(maskToString(mask), "xxxxxxxxxx"); setMask(mask, "xx xx "); - ScaleInvariantDilation::DilateHorizontally(mask, 0.0); + SIROperator::OperateHorizontally(mask, 0.0); AssertEquals(maskToString(mask), "xx xx "); - ScaleInvariantDilation::DilateHorizontally(mask, 0.19); + SIROperator::OperateHorizontally(mask, 0.19); AssertEquals(maskToString(mask), "xx xx ", "Did not fill hole"); - ScaleInvariantDilation::DilateHorizontally(mask, 0.2); + SIROperator::OperateHorizontally(mask, 0.2); AssertEquals(maskToString(mask), "xxxxx ", "Fill hole"); mask = Mask2D::CreateSetMaskPtr<false>(40, 1); // 0 5 0 5 0 5 0 5 setMask(mask, " xxxxxx xx xx x x xxx xxxxx "); - ScaleInvariantDilation::DilateHorizontally(mask, 0.2); + SIROperator::OperateHorizontally(mask, 0.2); AssertEquals(maskToString(mask), " xxxxxxxxxxxxx x xxxxxxxxxxxx "); setMask(mask, " xxxxxx xx xx x x xxx xxxxx "); - ScaleInvariantDilation::DilateHorizontally(mask, 0.3); + SIROperator::OperateHorizontally(mask, 0.3); AssertEquals(maskToString(mask), " xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx "); setMask(mask, " xxxxxx xx xx x x xxx xxxxx "); - ScaleInvariantDilation::DilateHorizontally(mask, 0.4); + SIROperator::OperateHorizontally(mask, 0.4); AssertEquals(maskToString(mask), "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx "); setMask(mask, "xxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx"); - ScaleInvariantDilation::DilateHorizontally(mask, 0.3); + SIROperator::OperateHorizontally(mask, 0.3); AssertEquals(maskToString(mask), "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); } -inline void ScaleInvariantDilationTest::TestFrequencyDilation::operator()() +inline void SIROperatorTest::TestFrequencyDilation::operator()() { Mask2DPtr mask = Mask2D::CreateSetMaskPtr<false>(1, 10); setMask(mask, " x "); - ScaleInvariantDilation::DilateVertically(mask, 0.0); + SIROperator::OperateVertically(mask, 0.0); AssertEquals(maskToString(mask), " x ", "Eta=0.0, single center flagged, no enlarge"); - ScaleInvariantDilation::DilateVertically(mask, 0.4); + SIROperator::OperateVertically(mask, 0.4); AssertEquals(maskToString(mask), " x ", "Eta=0.4, single center flagged, eta 0.4"); - ScaleInvariantDilation::DilateVertically(mask, 0.5); + SIROperator::OperateVertically(mask, 0.5); AssertEquals(maskToString(mask), " xxx ", "Eta=0.5, from one to three samples"); - ScaleInvariantDilation::DilateVertically(mask, 0.0); + SIROperator::OperateVertically(mask, 0.0); AssertEquals(maskToString(mask), " xxx "); - ScaleInvariantDilation::DilateVertically(mask, 0.25); + SIROperator::OperateVertically(mask, 0.25); AssertEquals(maskToString(mask), " xxxxx "); - ScaleInvariantDilation::DilateVertically(mask, 0.16); + SIROperator::OperateVertically(mask, 0.16); AssertEquals(maskToString(mask), " xxxxx "); - ScaleInvariantDilation::DilateVertically(mask, 0.17); + SIROperator::OperateVertically(mask, 0.17); AssertEquals(maskToString(mask), " xxxxxxx "); - ScaleInvariantDilation::DilateVertically(mask, 0.6); + SIROperator::OperateVertically(mask, 0.6); AssertEquals(maskToString(mask), "xxxxxxxxxx"); - ScaleInvariantDilation::DilateVertically(mask, 1.0); + SIROperator::OperateVertically(mask, 1.0); AssertEquals(maskToString(mask), "xxxxxxxxxx"); setMask(mask, "xx xx "); - ScaleInvariantDilation::DilateVertically(mask, 0.0); + SIROperator::OperateVertically(mask, 0.0); AssertEquals(maskToString(mask), "xx xx "); - ScaleInvariantDilation::DilateVertically(mask, 0.19); + SIROperator::OperateVertically(mask, 0.19); AssertEquals(maskToString(mask), "xx xx ", "Did not fill hole"); - ScaleInvariantDilation::DilateVertically(mask, 0.2); + SIROperator::OperateVertically(mask, 0.2); AssertEquals(maskToString(mask), "xxxxx ", "Fill hole"); mask = Mask2D::CreateSetMaskPtr<false>(1, 40); // 0 5 0 5 0 5 0 5 setMask(mask, " xxxxxx xx xx x x xxx xxxxx "); - ScaleInvariantDilation::DilateVertically(mask, 0.2); + SIROperator::OperateVertically(mask, 0.2); AssertEquals(maskToString(mask), " xxxxxxxxxxxxx x xxxxxxxxxxxx "); setMask(mask, " xxxxxx xx xx x x xxx xxxxx "); - ScaleInvariantDilation::DilateVertically(mask, 0.3); + SIROperator::OperateVertically(mask, 0.3); AssertEquals(maskToString(mask), " xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx "); setMask(mask, " xxxxxx xx xx x x xxx xxxxx "); - ScaleInvariantDilation::DilateVertically(mask, 0.4); + SIROperator::OperateVertically(mask, 0.4); AssertEquals(maskToString(mask), "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx "); setMask(mask, "xxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx"); - ScaleInvariantDilation::DilateVertically(mask, 0.3); + SIROperator::OperateVertically(mask, 0.3); AssertEquals(maskToString(mask), "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); } -inline void ScaleInvariantDilationTest::TestTimeDilationSpeed::operator()() +inline void SIROperatorTest::TestTimeDilationSpeed::operator()() { const unsigned flagsSize = 10000; const unsigned channels = 256; @@ -342,7 +342,7 @@ inline void ScaleInvariantDilationTest::TestTimeDilationSpeed::operator()() mask->SetValue(i, 0, (RNG::Uniform() >= 0.2)); } } - ScaleInvariantDilation::DilateHorizontally(mask, 0.1); + SIROperator::OperateHorizontally(mask, 0.1); } #endif diff --git a/CEP/DP3/AOFlagger/src/strategy/actions/statisticalflagaction.cpp b/CEP/DP3/AOFlagger/src/strategy/actions/statisticalflagaction.cpp index 2152e375c231798c2d6c7e8f4406f690ca3a3522..422a03bac31ee1e8aa6b01a75932564b6483e83c 100644 --- a/CEP/DP3/AOFlagger/src/strategy/actions/statisticalflagaction.cpp +++ b/CEP/DP3/AOFlagger/src/strategy/actions/statisticalflagaction.cpp @@ -23,7 +23,7 @@ #include <AOFlagger/strategy/actions/statisticalflagaction.h> #include <AOFlagger/strategy/algorithms/statisticalflagger.h> -#include <AOFlagger/strategy/algorithms/scaleinvariantdilation.h> +#include <AOFlagger/strategy/algorithms/siroperator.h> #include <AOFlagger/strategy/control/artifactset.h> @@ -39,8 +39,8 @@ namespace rfiStrategy { StatisticalFlagger::DilateFlags(mask, _enlargeTimeSize, _enlargeFrequencySize); //StatisticalFlagger::LineRemover(mask, (size_t) (_maxContaminatedTimesRatio * (double) mask->Width()), (size_t) (_maxContaminatedFrequenciesRatio * (double) mask->Height())); - ScaleInvariantDilation::DilateHorizontally(mask, _minimumGoodTimeRatio); - ScaleInvariantDilation::DilateVertically(mask, _minimumGoodFrequencyRatio); + SIROperator::OperateHorizontally(mask, _minimumGoodTimeRatio); + SIROperator::OperateVertically(mask, _minimumGoodFrequencyRatio); data.SetGlobalMask(mask); //artifacts.SetRevisedData(data); }