diff --git a/CEP/DP3/AOFlagger/include/AOFlagger/gui/strategyframes/timeselectionframe.h b/CEP/DP3/AOFlagger/include/AOFlagger/gui/strategyframes/timeselectionframe.h index 7ee8efa2c615ef9f1c96de46d59759d0ee48c1b0..58c317d9a5d185a31a5e0e1516d4b3a533152969 100644 --- a/CEP/DP3/AOFlagger/include/AOFlagger/gui/strategyframes/timeselectionframe.h +++ b/CEP/DP3/AOFlagger/include/AOFlagger/gui/strategyframes/timeselectionframe.h @@ -36,35 +36,22 @@ class TimeSelectionFrame : public Gtk::Frame { TimeSelectionFrame(rfiStrategy::TimeSelectionAction &action, EditStrategyWindow &editStrategyWindow) : Gtk::Frame("Time selection"), _editStrategyWindow(editStrategyWindow), _action(action), - _partCountLabel("Part count:"), - _partCountScale(0, 1000, 1), - _selectionCountLabel("Selection count:"), - _selectionCountScale(0, 1000, 1), + _thresholdLabel("Threshold:"), + _thresholdScale(0, 10, 0.1), _applyButton(Gtk::Stock::APPLY) { - _box.pack_start(_partCountLabel); - _partCountLabel.show(); + _box.pack_start(_thresholdLabel); - _box.pack_start(_partCountScale); - _partCountScale.set_value(_action.PartCount()); - _partCountScale.show(); - - _box.pack_start(_selectionCountLabel); - _selectionCountLabel.show(); - - _box.pack_start(_selectionCountScale); - _selectionCountScale.set_value(_action.SelectionCount()); - _selectionCountScale.show(); + _box.pack_start(_thresholdScale); + _thresholdScale.set_value(_action.Threshold()); _buttonBox.pack_start(_applyButton); _applyButton.signal_clicked().connect(sigc::mem_fun(*this, &TimeSelectionFrame::onApplyClicked)); - _applyButton.show(); _box.pack_start(_buttonBox); - _buttonBox.show(); add(_box); - _box.show(); + _box.show_all(); } private: EditStrategyWindow &_editStrategyWindow; @@ -72,16 +59,13 @@ class TimeSelectionFrame : public Gtk::Frame { Gtk::VBox _box; Gtk::HButtonBox _buttonBox; - Gtk::Label _partCountLabel; - Gtk::HScale _partCountScale; - Gtk::Label _selectionCountLabel; - Gtk::HScale _selectionCountScale; + Gtk::Label _thresholdLabel; + Gtk::HScale _thresholdScale; Gtk::Button _applyButton; void onApplyClicked() { - _action.SetPartCount((size_t) _partCountScale.get_value()); - _action.SetSelectionCount((size_t) _selectionCountScale.get_value()); + _action.SetThreshold(_thresholdScale.get_value()); _editStrategyWindow.UpdateAction(&_action); } }; diff --git a/CEP/DP3/AOFlagger/include/AOFlagger/imaging/observatorium.h b/CEP/DP3/AOFlagger/include/AOFlagger/imaging/observatorium.h index 80d8249852e741f70a34214dca7c8bf800db8744..e9f13474d2acbabdf3c2d88a4cc935eb14481b96 100644 --- a/CEP/DP3/AOFlagger/include/AOFlagger/imaging/observatorium.h +++ b/CEP/DP3/AOFlagger/include/AOFlagger/imaging/observatorium.h @@ -172,7 +172,7 @@ struct WSRTObservatorium : public Observatorium void initBand() { GetBandInfo().windowIndex = 0; - GetBandInfo().channelCount = 16*16; + GetBandInfo().channelCount = 16*4; SetChannelWidthHz(10000.0 * 256.0 * 16.0 / GetBandInfo().channelCount); for(size_t i=0;i<GetBandInfo().channelCount;++i) { diff --git a/CEP/DP3/AOFlagger/include/AOFlagger/strategy/actions/timeselectionaction.h b/CEP/DP3/AOFlagger/include/AOFlagger/strategy/actions/timeselectionaction.h index 5ce2e125c20e016b3122ba1e1a372249c32e7315..0a03be862363c35381d8398d0b1f54447bb01091 100644 --- a/CEP/DP3/AOFlagger/include/AOFlagger/strategy/actions/timeselectionaction.h +++ b/CEP/DP3/AOFlagger/include/AOFlagger/strategy/actions/timeselectionaction.h @@ -31,7 +31,7 @@ namespace rfiStrategy { */ class TimeSelectionAction : public Action { public: - TimeSelectionAction() : _partCount(25), _selectionCount(20), _manualSelection(false), _threshold(3.5) + TimeSelectionAction() : _threshold(3.5) { } ~TimeSelectionAction() @@ -43,28 +43,15 @@ namespace rfiStrategy { } virtual void Perform(ArtifactSet &artifacts, class ProgressListener &) { - if(_manualSelection) - ManualSelection(artifacts); - else - AutomaticSelection(artifacts); + AutomaticSelection(artifacts); } virtual ActionType Type() const { return TimeSelectionActionType; } - size_t PartCount() const { return _partCount; } - void SetPartCount(size_t partCount) { _partCount = partCount; } - - size_t SelectionCount() const { return _selectionCount; } - void SetSelectionCount(size_t selectionCount) { _selectionCount = selectionCount; } - num_t Threshold() const { return _threshold; } void SetThreshold(num_t threshold) { _threshold = threshold; } private: - void ManualSelection(ArtifactSet &artifacts); void AutomaticSelection(ArtifactSet &artifacts); - size_t _partCount; - size_t _selectionCount; - bool _manualSelection; num_t _threshold; }; diff --git a/CEP/DP3/AOFlagger/include/AOFlagger/test/results/filterresultstest.h b/CEP/DP3/AOFlagger/include/AOFlagger/test/results/filterresultstest.h index 6096184a2b0836e29e5c8915b1800e76adb019bc..46141e473b4bfadb22a0e563838cd81f1f569a0d 100644 --- a/CEP/DP3/AOFlagger/include/AOFlagger/test/results/filterresultstest.h +++ b/CEP/DP3/AOFlagger/include/AOFlagger/test/results/filterresultstest.h @@ -218,7 +218,7 @@ class FilterResultsTest : public UnitTest { statFile << '\n'; } - static void SaveImaged(rfiStrategy::ArtifactSet &artifacts, const std::string &filename, bool difference, double centerPower, double sidelobePower, double onAxisPower) + static void SaveImaged(const TimeFrequencyData &original, rfiStrategy::ArtifactSet &artifacts, const std::string &filename, bool difference, double centerPower, double sidelobePower, double onAxisPower) { UVImager imager(1024*1.5, 1024*1.5); @@ -226,7 +226,7 @@ class FilterResultsTest : public UnitTest { if(difference) { data = - TimeFrequencyData::CreateTFDataFromDiff(artifacts.OriginalData(), artifacts.ContaminatedData()); + TimeFrequencyData::CreateTFDataFromDiff(original, artifacts.ContaminatedData()); } else { data = new TimeFrequencyData(artifacts.ContaminatedData()); @@ -260,14 +260,15 @@ class FilterResultsTest : public UnitTest { artifacts.SetOriginalData(data.first); artifacts.SetContaminatedData(data.first); - data.first.SetImagesToZero(); - artifacts.SetRevisedData(data.first); + TimeFrequencyData zero(data.first); + zero.SetImagesToZero(); + artifacts.SetRevisedData(zero); artifacts.SetMetaData(data.second); strategy->Perform(artifacts, listener); - SaveImaged(artifacts, appliedName, false, centerPower, sidelobePower, onAxisPower); - SaveImaged(artifacts, differenceName, true, centerPower, sidelobePower, onAxisPower); + SaveImaged(data.first, artifacts, appliedName, false, centerPower, sidelobePower, onAxisPower); + SaveImaged(data.first, artifacts, differenceName, true, centerPower, sidelobePower, onAxisPower); } static void RunAllMethods(std::pair<TimeFrequencyData, TimeFrequencyMetaDataPtr> data, const std::string &setPrefix, const std::string &setName, double centerPower, double sidelobePower, double onAxisPower) diff --git a/CEP/DP3/AOFlagger/src/strategy/actions/timeselectionaction.cpp b/CEP/DP3/AOFlagger/src/strategy/actions/timeselectionaction.cpp index 34ca38ee9f8b2d01124240a796cf7a39a86a22c4..d017971929c61393bc38608c3e5a52efb27164fc 100644 --- a/CEP/DP3/AOFlagger/src/strategy/actions/timeselectionaction.cpp +++ b/CEP/DP3/AOFlagger/src/strategy/actions/timeselectionaction.cpp @@ -35,47 +35,6 @@ namespace rfiStrategy { -void TimeSelectionAction::ManualSelection(ArtifactSet &artifacts) -{ - TimeFrequencyData &model = artifacts.RevisedData(); - TimeFrequencyData &original = artifacts.OriginalData(); - TimeFrequencyData &contaminated = artifacts.ContaminatedData(); - size_t timeSteps = model.ImageWidth(); - Mask2DPtr mask = Mask2D::CreateCopy(contaminated.GetSingleMask()); - std::multimap<double, size_t> orderedQualities; - size_t - partCount = _partCount, - selectCount = _selectionCount; - if(partCount > original.ImageWidth()) - partCount = original.ImageWidth(); - if(selectCount > partCount) - selectCount = partCount; - - Image2DCPtr - originalImg = original.GetSingleImage(), - modelImg = model.GetSingleImage(); - - for(size_t p = 0; p < partCount; ++p) - { - size_t - startX = p * timeSteps / partCount, - endX = (p+1) * timeSteps / partCount; - double quality = RFIStatistics::DataQuality(originalImg, modelImg, mask, startX, endX); - orderedQualities.insert(std::pair<double, size_t>(quality, p)); - } - for(size_t i=0;i<partCount - selectCount; ++i) - { - std::map<double, size_t>::iterator mi = orderedQualities.begin(); - size_t part = mi->second; - orderedQualities.erase(mi); - size_t - startX = part * timeSteps / partCount, - endX = (part+1) * timeSteps / partCount; - mask->SetAllVertically<true>(startX, endX); - } - contaminated.SetGlobalMask(mask); -} - /** * Automatic selection selects all timesteps which RMS is higher than some value relative to the stddev of * all timesteps.