Commits
193 193 | // Determine columns to check |
194 194 | VisBufferComponents2 columns; |
195 195 | columns += VisBufferComponent2::FlagCube; |
196 196 | |
197 197 | // Compare |
198 198 | SCOPED_TRACE("Comparing propagated flags"); |
199 199 | compareVisibilityIterators(*testTVI,*refTVI,columns,tolerance); |
200 200 | |
201 201 | } |
202 202 | |
203 + | // ----------------------------------------------------------------------- |
204 + | // |
205 + | // ----------------------------------------------------------------------- |
206 + | void ChannelAverageTVICompareTest::testWriteFlags() |
207 + | { |
208 + | //Tolerance for booleans is just 0 |
209 + | Float tolerance = 0; |
210 + | |
211 + | // Create VisibilityIterator2 pointing to reference file |
212 + | MeasurementSet msRef(referenceFile_p, Table::Update); |
213 + | vi::VisibilityIterator2 refVI(msRef, SortColumns(), true); |
214 + | |
215 + | // Propagate flags in raw MS (takes into account the chanbin) |
216 + | flagEachOtherChannel(refVI, true, refConfiguration_p.asInt("chanbin")); |
217 + | |
218 + | //Create channel average TVI pointing to the testing file |
219 + | { |
220 + | MeasurementSet msTest(testFile_p, Table::Update); |
221 + | vi::VisibilityIterator2* testVI = |
222 + | new vi::VisibilityIterator2(msTest, SortColumns(), true); |
223 + | Record configuration; |
224 + | configuration.define ("chanbin", 8); |
225 + | ChannelAverageTVIFactory testFactory(configuration, |
226 + | testVI->getImpl()); |
227 + | VisibilityIterator2 testTVI(testFactory); |
228 + | |
229 + | // Propagate flags using the TVI |
230 + | flagEachOtherChannel(testTVI, false); |
231 + | |
232 + | //testVI is deleted by testTVI destructor (!) |
233 + | } |
234 + | |
235 + | // Create VisibilityIterator2 pointing to test file |
236 + | //(after flags have been written) |
237 + | MeasurementSet msTestAfter(testFile_p); |
238 + | vi::VisibilityIterator2 testVIAfter(msTestAfter); |
239 + | |
240 + | // Determine columns to check |
241 + | VisBufferComponents2 columns; |
242 + | columns += VisBufferComponent2::FlagCube; |
243 + | |
244 + | SCOPED_TRACE("Comparing propagated flags"); |
245 + | compareVisibilityIterators(testVIAfter, refVI, columns, tolerance); |
246 + | } |
203 247 | |
204 248 | // ----------------------------------------------------------------------- |
205 249 | // |
206 250 | // ----------------------------------------------------------------------- |
207 251 | void ChannelAverageTVICompareTest::propagateFlags() |
208 252 | { |
209 253 | // Create MSTransformIterator pointing to reference file |
210 254 | refConfiguration_p.define("factory",False); |
211 255 | MSTransformIteratorFactory refFactory(refConfiguration_p); |
212 256 | VisibilityIterator2 refTVI(refFactory); |
235 279 | TEST_F(ChannelAverageTVICompareTest, CompareMSTransformTransformedData) |
236 280 | { |
237 281 | testCompareMSTransformTransformedData(); |
238 282 | } |
239 283 | |
240 284 | TEST_F(ChannelAverageTVICompareTest, CompareMSTransformPropagatedFlags) |
241 285 | { |
242 286 | testCompareMSTransformPropagatedFlags(); |
243 287 | } |
244 288 | |
289 + | TEST_F(ChannelAverageTVICompareTest, TestWriteFlags) |
290 + | { |
291 + | testWriteFlags(); |
292 + | } |
293 + | |
245 294 | TEST(ChannelAverageTVIConfTest, NoChanbinParam) |
246 295 | { |
247 296 | Record configuration; |
248 297 | ChannelAverageTVIFactory testFactory(configuration, nullptr); |
249 298 | ASSERT_THROW(VisibilityIterator2 testTVI(testFactory), AipsError); |
250 299 | } |
251 300 | |
252 301 | TEST(ChannelAverageTVIConfTest, WrongChanbinType) |
253 302 | { |
254 303 | //Checks that an exception is thrown if chanbin parameter |