Commits
238 238 | |
239 239 | exists = -1; |
240 240 | exists = configuration.fieldNumber ("denoising_lib"); |
241 241 | if (exists >= 0) |
242 242 | { |
243 243 | configuration.get (exists, withDenoisingLib_p); |
244 244 | |
245 245 | if (withDenoisingLib_p) |
246 246 | { |
247 247 | logger_p << LogIO::NORMAL << LogOrigin("UVContSubTVI", __FUNCTION__) |
248 - | << "Using denoising lib (GSL based)" << LogIO::POST; |
248 + | << "Using GSL based multiparameter regression with linear least-squares fitting" << LogIO::POST; |
249 249 | } |
250 250 | } |
251 251 | |
252 252 | exists = -1; |
253 253 | exists = configuration.fieldNumber ("nthreads"); |
254 254 | if (exists >= 0) |
255 255 | { |
256 256 | configuration.get (exists, nThreads_p); |
257 257 | |
258 258 | if (nThreads_p > 1) |
298 298 | return ret; |
299 299 | } |
300 300 | |
301 301 | // ----------------------------------------------------------------------- |
302 302 | // |
303 303 | // ----------------------------------------------------------------------- |
304 304 | void UVContSubTVI::initialize() |
305 305 | { |
306 306 | // Populate nchan input-output maps |
307 307 | uInt spw_idx = 0; |
308 - | for(auto spwInp: spwInpChanIdxMap_p) |
308 + | for (auto spwInp: spwInpChanIdxMap_p) |
309 309 | { |
310 310 | auto spw = spwInp.first; |
311 311 | spwOutChanNumMap_p[spw] = spwInp.second.size(); |
312 312 | spw_idx++; |
313 313 | } |
314 314 | |
315 315 | // Process line-free channel selection |
316 316 | for (const auto item: fitspw_p) { |
317 317 | unordered_map<int, Vector<Bool> > lineFreeChannelMaskMap; |
318 318 | // Parse line-free channel selection using MSSelection syntax |
319 319 | const auto fieldID = item.first; |
320 - | auto fieldFitspw = item.second; |
320 + | const auto fieldFitspw = item.second; |
321 321 | |
322 322 | logger_p << LogIO::NORMAL << LogOrigin("UVContSubTVI", __FUNCTION__) |
323 323 | << "Parsing fitspw string for field: " << fieldNameFromId(fieldID) |
324 324 | << ", fitspw: '" << fieldFitspw << "'" << LogIO::POST; |
325 325 | |
326 326 | if ("NONE" == fieldFitspw) { |
327 327 | // Not inserting any entries in perFieldLineFreeChannelMaskMap_p[fieldID] |
328 328 | // implies no transformation for that field (inputVis -> outputVis) |
329 329 | continue; |
330 330 | } |
331 331 | |
332 332 | if (fieldFitspw.empty()) { |
333 333 | // -1 is the "all-fields-included" field pseudo-index |
334 334 | // empty selection -> all SPW, channels, leave all SPW masks unset |
335 335 | if (-1 == fieldID) { |
336 - | perFieldLineFreeChannelMaskMap_p.insert(std::make_pair(fieldID, lineFreeChannelMaskMap)); |
336 + | perFieldLineFreeChannelMaskMap_p.emplace(fieldID, lineFreeChannelMaskMap); |
337 337 | } |
338 338 | continue; |
339 339 | } |
340 340 | |
341 341 | // Some selection string |
342 342 | MSSelection mssel; |
343 343 | mssel.setSpwExpr(fieldFitspw); |
344 - | Matrix<Int> spwchan = mssel.getChanList(&(inputVii_p->ms())); |
344 + | const auto spwchan = mssel.getChanList(&(inputVii_p->ms())); |
345 345 | |
346 - | // Create line-free channel map |
347 - | uInt nSelections = spwchan.shape()[0]; |
348 - | map<Int,vector<Int> > lineFreeChannelMap; |
349 - | Int channelStart,channelStop,channelStep; |
350 - | for(uInt selection_i=0; selection_i<nSelections; ++selection_i) |
346 + | // Create line-free channel map based on MSSelection channel ranges |
347 + | const auto nSelections = spwchan.shape()[0]; |
348 + | unordered_map<Int,vector<Int> > lineFreeChannelMap; |
349 + | for (uInt selection_i=0; selection_i<nSelections; ++selection_i) |
351 350 | { |
352 351 | auto spw = spwchan(selection_i,0); |
353 - | channelStart = spwchan(selection_i,1); |
354 - | channelStop = spwchan(selection_i,2); |
355 - | channelStep = spwchan(selection_i,3); |
356 352 | if (lineFreeChannelMap.find(spw) == lineFreeChannelMap.end()) |
357 353 | { |
358 354 | lineFreeChannelMap[spw].clear(); // Accessing the vector creates it |
359 355 | } |
360 356 | |
361 - | for (Int inpChan=channelStart;inpChan<=channelStop;inpChan += channelStep) |
357 + | const auto channelStart = spwchan(selection_i,1); |
358 + | const auto channelStop = spwchan(selection_i,2); |
359 + | const auto channelStep = spwchan(selection_i,3); |
360 + | for (auto inpChan=channelStart; inpChan<=channelStop; inpChan += channelStep) |
362 361 | { |
363 362 | lineFreeChannelMap[spw].push_back(inpChan); |
364 363 | } |
365 364 | } |
366 365 | |
367 366 | // Create line-free channel mask |
368 - | uInt selChan; |
369 - | for(auto const spwInp: spwInpChanIdxMap_p) |
367 + | for (auto const spwInp: spwInpChanIdxMap_p) |
370 368 | { |
371 - | auto spw = spwInp.first; |
369 + | const auto spw = spwInp.first; |
372 370 | if (lineFreeChannelMaskMap.find(spw) == lineFreeChannelMaskMap.end()) |
373 371 | { |
374 372 | lineFreeChannelMaskMap[spw] = Vector<Bool>(spwInp.second.size(),True); |
375 373 | for (uInt selChanIdx=0; selChanIdx<lineFreeChannelMap[spw].size(); |
376 374 | ++selChanIdx) |
377 375 | { |
378 - | selChan = lineFreeChannelMap[spw][selChanIdx]; |
376 + | const auto selChan = lineFreeChannelMap[spw][selChanIdx]; |
379 377 | lineFreeChannelMaskMap[spw](selChan) = False; |
380 378 | } |
381 379 | } |
382 380 | spw_idx++; |
383 381 | } |
384 382 | |
385 383 | perFieldLineFreeChannelMaskMap_p.emplace(fieldID, lineFreeChannelMaskMap); |
386 384 | } |
387 385 | } |
388 386 | |