Commits
George Moellenbrock authored and Ville Suoranta committed b57a321e7f4 Merge
286 286 | if os.path.exists(self.testout): |
287 287 | shutil.rmtree(self.testout) |
288 288 | |
289 289 | def test_comb(self): |
290 290 | fringefit(vis=self.polcombtestms, caltable=self.testout, refant='0', spw='2~3', corrcomb='none') |
291 291 | |
292 292 | tblocal.open(self.testout) |
293 293 | none_result = np.nanmean(tblocal.getcol('SNR')) |
294 294 | tblocal.close() |
295 295 | |
296 - | fringefit(vis=self.polcombtestms, caltable=self.testout, refant='0', spw='2~3', corrcomb='all') |
296 + | fringefit(vis=self.polcombtestms, caltable=self.testout, refant='0', spw='2~3', corrcomb='stokes') # formerly 'all' |
297 297 | |
298 298 | tblocal.open(self.testout) |
299 299 | combine_result = np.nanmean(tblocal.getcol('SNR')) |
300 300 | tblocal.close() |
301 301 | |
302 302 | self.assertTrue(combine_result > none_result) |
303 303 | |
304 + | class Fringefit_corrcomb2(unittest.TestCase): |
305 + | polcombtestms = 'TPOL0006b_scan5_copy.ms' |
306 + | testout = polcombtestms+'.ffcal' |
307 + | |
308 + | def setUp(self): |
309 + | shutil.copytree(os.path.join(datapath, 'TPOL0006b_scan5.ms'),self.polcombtestms) |
310 + | # For local testing before data is in the DR |
311 + | #datapath0='/home/daibutsu/gmoellen/JIRA/CAS-14195/testdir/' |
312 + | #shutil.copytree(os.path.join(datapath0, 'TPOL0006b_scan5.ms'),self.polcombtestms) |
313 + | |
314 + | def tearDown(self): |
315 + | shutil.rmtree(self.polcombtestms) |
316 + | if os.path.exists(self.testout): |
317 + | shutil.rmtree(self.testout) |
318 + | |
319 + | def test_corrcomb2(self): |
320 + | |
321 + | # NB: No SNR improvement tests here (cf test_corrcomb) |
322 + | # because these (raw) data are not coherent (not aligned) |
323 + | # between polarizations |
324 + | # TBD: add a solve for pol alignment (zerorates=True), and |
325 + | # add it as a prior cal in each corrcomb!='none' test |
326 + | |
327 + | # corrdepflags=False, corrcomb='none' |
328 + | # ant id=6 completely flagged |
329 + | fringefit(vis=self.polcombtestms, caltable=self.testout, |
330 + | spw='0,1', |
331 + | refant='0',solint='inf', |
332 + | corrdepflags=False,corrcomb='none',concatspws=False) |
333 + | tblocal.open(self.testout) |
334 + | fl=tblocal.getcol('FLAG') |
335 + | tblocal.close() |
336 + | #print(np.sum(fl),np.sum(fl)==16) |
337 + | #print(fl[:,0,6::10]) # both pols |
338 + | #print(np.alltrue(fl[:,0,6::10])) |
339 + | |
340 + | self.assertTrue(np.sum(fl)==16) # 4 params in 2 pols in 2 spws |
341 + | self.assertTrue(np.all(fl[:,0,6::10])) # both pols flagged |
342 + | |
343 + | |
344 + | # corrdepflags=True, corrcomb='none' |
345 + | # ant id=6 pol id=1 only flagged |
346 + | fringefit(vis=self.polcombtestms, caltable=self.testout, |
347 + | spw='0,1', |
348 + | refant='0',solint='inf', |
349 + | corrdepflags=True,corrcomb='none',concatspws=False) |
350 + | tblocal.open(self.testout) |
351 + | fl=tblocal.getcol('FLAG') |
352 + | tblocal.close() |
353 + | #print(np.sum(fl),np.sum(fl)==8) |
354 + | #print(fl[4:,0,6::10]) # 2nd pol only |
355 + | #print(np.alltrue(fl[4:,0,6::10])) |
356 + | |
357 + | self.assertTrue(np.sum(fl)==8) # 4 params in 1 pol in 2 spws |
358 + | self.assertTrue(np.all(fl[4:,0,6::10])) # 2nd pol only flagged |
359 + | |
360 + | # corrdepflags=True, corrcomb='stokes' |
361 + | # ant id=6 completely flagged |
362 + | # solutions identical in both pols |
363 + | fringefit(vis=self.polcombtestms, caltable=self.testout, |
364 + | spw='0,1', |
365 + | refant='0',solint='inf', |
366 + | corrdepflags=True,corrcomb='stokes',concatspws=False) |
367 + | tblocal.open(self.testout) |
368 + | fl=tblocal.getcol('FLAG') |
369 + | sol=tblocal.getcol('FPARAM') |
370 + | tblocal.close() |
371 + | #print(np.sum(fl),np.sum(fl)==16) |
372 + | #print(fl[:,0,6::10]) # both pols |
373 + | #print(np.alltrue(fl[:,0,6::10])) |
374 + | #print(np.alltrue(sol[0:4,0,:]==sol[4:,0,:])) # same soln in both pols |
375 + | |
376 + | self.assertTrue(np.sum(fl)==16) # 4 params in 2 pols in 2 spws |
377 + | self.assertTrue(np.all(fl[:,0,6::10])) # both pols flagged |
378 + | self.assertTrue(np.all(sol[0:4,0,:]==sol[4:,0,:])) # same soln in both pols |
379 + | |
380 + | # corrdepflags=True, corrcomb='parallel' |
381 + | # nothing flagged (ant id=6 pol id=0 solutions used for both pols) |
382 + | # solutions identical in both pols |
383 + | fringefit(vis=self.polcombtestms, caltable=self.testout, |
384 + | spw='0,1', |
385 + | refant='0',solint='inf', |
386 + | corrdepflags=True,corrcomb='parallel',concatspws=False) |
387 + | tblocal.open(self.testout) |
388 + | fl=tblocal.getcol('FLAG') |
389 + | sol=tblocal.getcol('FPARAM') |
390 + | tblocal.close() |
391 + | #print(np.sum(fl),np.sum(fl)==0) # no flagged solutions! |
392 + | #print(np.alltrue(sol[0:4,0,:]==sol[4:,0,:])) # same soln in both pols |
393 + | |
394 + | self.assertTrue(np.sum(fl)==0) # nothing flagged |
395 + | self.assertTrue(np.all(sol[0:4,0,:]==sol[4:,0,:])) # same soln in both pols |
396 + | |
397 + | # corrdepflags=True, corrcomb='stokes', concatspws=True |
398 + | # ant id=6 fully flagged |
399 + | # solutions identical in both pols |
400 + | fringefit(vis=self.polcombtestms, caltable=self.testout, |
401 + | spw='0,1,2,3',combine='spw', |
402 + | refant='0',solint='inf', |
403 + | corrdepflags=True,corrcomb='stokes',concatspws=True) |
404 + | tblocal.open(self.testout) |
405 + | fl=tblocal.getcol('FLAG') |
406 + | sol=tblocal.getcol('FPARAM') |
407 + | tblocal.close() |
408 + | # print(np.sum(fl),np.sum(fl)==8) |
409 + | # print(fl[:,0,6::10]) # both pols |
410 + | # print(np.alltrue(fl[:,0,6::10])) |
411 + | # print(np.alltrue(sol[0:4,0,:]==sol[4:,0,:])) # same soln in both pols |
412 + | self.assertTrue(np.sum(fl)==8) # ant id 6 completely flagged |
413 + | self.assertTrue(np.all(fl[:,0,6::10])) # both pols flagged |
414 + | self.assertTrue(np.all(sol[0:4,0,:]==sol[4:,0,:])) # same soln in both pols |
415 + | |
416 + | |
417 + | # corrdepflags=True, corrcomb='parallel', concatspws=True |
418 + | # no solutions flagged |
419 + | # solutions identical in both pols |
420 + | fringefit(vis=self.polcombtestms, caltable=self.testout, |
421 + | spw='0,1,2,3',combine='spw', |
422 + | refant='0',solint='inf', |
423 + | corrdepflags=True,corrcomb='parallel',concatspws=True) |
424 + | tblocal.open(self.testout) |
425 + | fl=tblocal.getcol('FLAG') |
426 + | sol=tblocal.getcol('FPARAM') |
427 + | tblocal.close() |
428 + | # print(np.sum(fl),np.sum(fl)==0) # no flagged solutions! |
429 + | # print(np.alltrue(sol[0:4,0,:]==sol[4:,0,:])) # same soln in both pols |
430 + | self.assertTrue(np.sum(fl)==0) # nothing flagged |
431 + | self.assertTrue(np.all(sol[0:4,0,:]==sol[4:,0,:])) # same soln in both pols |
432 + | |
433 + | |
434 + | |
435 + | |
304 436 | class Fringefit_paramactive_caltable(unittest.TestCase): |
305 437 | prefix = 'n08c1' |
306 438 | msfile = prefix + '.ms' |
307 439 | testcallib = 'testcaltable.txt' |
308 440 | |
309 441 | preapplytable = 'topreapply.cal' |
310 442 | nocallib = 'nocallib.cal' |
311 443 | withcallib = 'withcallib.cal' |
312 444 | manualdefault = 'manualcallib.cal' |
313 445 | |