Commits
266 266 | ) |
267 267 | self.assertTrue((gflag == eflag).all(), 'FLAG comparison failed') |
268 268 | self.assertTrue((gfrow == efrow).all(), 'FLAG_ROW comparison failed') |
269 269 | # all flags must be True where wtsp = 0 |
270 270 | self.assertTrue(np.extract(gwtsp == 0, gflag).all()) |
271 271 | self.assertTrue(np.allclose(gsigma, esigma), 'SIGMA comparison failed') |
272 272 | if type(gsisp) != type(None) and type(esisp) != type(None): |
273 273 | self.assertTrue(np.allclose( |
274 274 | gsisp, esisp), 'SIGMA_SPECTRUM comparison failed' |
275 275 | ) |
276 - | |
276 + | |
277 + | skip("temporary .skip for debugging one test") |
277 278 | def test_algorithm(self): |
278 279 | """ Test the algorithm, includes excludechans tests""" |
279 280 | dst = "ngc5921.split.ms" |
280 281 | cflags = np.array(63 * [False]) |
281 282 | cflags[10:21] = True |
282 283 | """ |
283 284 | row_to_rows = [] |
284 285 | for row in range(60): |
285 286 | row_to_rows.append((row, row+1)) |
286 287 | """ |
303 304 | ref = 'ngc5921_statwt_ref_test_algorithm_sep_corr_fitspw.ms' |
304 305 | else: |
305 306 | if fitspw == '': |
306 307 | ref = 'ngc5921_statwt_ref_test_algorithm_combine_corr_no_fitspw.ms' |
307 308 | else: |
308 309 | ref = 'ngc5921_statwt_ref_test_algorithm_combine_corr_has_fitspw.ms' |
309 310 | self.compare(dst, ref) |
310 311 | shutil.rmtree(dst) |
311 312 | c += 1 |
312 313 | |
314 + | skip("temporary skip for debugging one test") | .
313 315 | def test_timebin(self): |
314 316 | """Test time binning""" |
315 317 | dst = "ngc5921.split.timebin.ms" |
316 318 | combine = "corr" |
317 319 | for timebin in ["300s", 10]: |
318 320 | shutil.copytree(src, dst) |
319 321 | myms.open(dst, nomodify=False) |
320 322 | myms.statwt(timebin=timebin, combine=combine) |
321 323 | myms.done() |
322 324 | ref = 'ngc5921_statwt_ref_test_timebin_' + str(timebin) + '.ms' |
323 325 | self.compare(dst, ref) |
324 326 | shutil.rmtree(dst) |
325 327 | |
328 + | skip("temporary skip for debugging one test") | .
326 329 | def test_chanbin(self): |
327 330 | """Test channel binning""" |
328 331 | dst = "ngc5921.split.chanbin_0.ms" |
329 332 | row_to_rows = [] |
330 333 | for i in range(60): |
331 334 | row_to_rows.append([i, i+1]) |
332 335 | bins = [ |
333 336 | [0, 8], [8, 16], [16, 24], [24, 32], [32, 40], [40, 48], |
334 337 | [48, 56], [56,63] |
335 338 | ] |
357 360 | self.assertTrue(y == x-1, "wrong number of columns") |
358 361 | mytb.done() |
359 362 | myms.open(dst, nomodify=False) |
360 363 | myms.statwt(chanbin=chanbin, combine=combine) |
361 364 | myms.done() |
362 365 | if combine == '': |
363 366 | ref = refdir + 'ngc5921_statwt_ref_test_chanbin_sep_corr.ms' |
364 367 | ref = refdir + 'ngc5921_statwt_ref_test_chanbin_combine_corr.ms' |
365 368 | shutil.rmtree(dst) |
366 369 | |
370 + | skip("temporary skip for debugging one test") | .
367 371 | def test_minsamp(self): |
368 372 | """Test minimum number of points""" |
369 373 | dst = "ngc5921.split.minsamp.ms" |
370 374 | combine = "corr" |
371 375 | trow = 12 |
372 376 | for minsamp in [60, 80]: |
373 377 | shutil.copytree(src, dst) |
374 378 | myms.open(dst, nomodify=False) |
375 379 | myms.statwt(minsamp=minsamp, combine=combine) |
376 380 | myms.done() |
399 403 | "Incorrect weight spectrum row " + str(trow) |
400 404 | ) |
401 405 | self.assertTrue( |
402 406 | flag[:,:,trow].all(), "Incorrect flag row " + str(trow) |
403 407 | ) |
404 408 | self.assertTrue( |
405 409 | frow[trow], "Incorrect flagrow row " + str(trow) |
406 410 | ) |
407 411 | shutil.rmtree(dst) |
408 412 | |
413 + | skip("temporary skip for debugging one test") | .
409 414 | def test_default_boundaries(self): |
410 415 | """Test default scan, field, etc boundaries""" |
411 416 | dst = "ngc5921.split.normalbounds.ms" |
412 417 | ref = 'ngc5921_statwt_ref_test_default_boundaries.ms' |
413 418 | timebin = "6000s" |
414 419 | # there are three field_ids, and there is a change in field_id when |
415 420 | # there is a change in scan number, so specifying combine="field" in the |
416 421 | # absence of "scan" will give the same result as combine="" |
417 422 | row_to_rows = [] |
418 423 | for i in range(12): |
430 435 | for i in range(56, 60): |
431 436 | row_to_rows.append([56, 60]) |
432 437 | for combine in ["corr", "corr,field"]: |
433 438 | shutil.copytree(src, dst) |
434 439 | myms.open(dst, nomodify=False) |
435 440 | myms.statwt(timebin=timebin, combine=combine) |
436 441 | myms.done() |
437 442 | self.compare(dst, ref) |
438 443 | shutil.rmtree(dst) |
439 444 | |
445 + | skip("temporary skip for debugging one test") | .
440 446 | def test_no_scan_boundaries(self): |
441 447 | """Test no scan boundaries""" |
442 448 | dst = "ngc5921.no_scan_bounds.ms" |
443 449 | timebin = "6000s" |
444 450 | # ref = os.path.join(datadir, 'ngc5921_statwt_ref_test_no_scan_bounds.ms') |
445 451 | ref = 'ngc5921_statwt_ref_test_no_scan_bounds.ms' |
446 452 | combine = "corr, scan" |
447 453 | shutil.copytree(src, dst) |
448 454 | myms.open(dst, nomodify=False) |
449 455 | myms.statwt(timebin=timebin, combine=combine) |
450 456 | myms.done() |
451 457 | self.compare(dst, ref) |
452 458 | shutil.rmtree(dst) |
453 459 | |
460 + | skip("temporary skip for debugging one test") | .
454 461 | def test_no_scan_nor_field_boundaries(self): |
455 462 | """Test no scan nor field boundaries""" |
456 463 | dst = "ngc5921.no_scan_nor_field_bounds.ms" |
457 464 | timebin = "6000s" |
458 465 | # ref = os.path.join(datadir, 'ngc5921_statwt_ref_test_no_scan_nor_field_bounds.ms') |
459 466 | ref = 'ngc5921_statwt_ref_test_no_scan_nor_field_bounds.ms' |
460 467 | for combine in ["corr,scan,field", "corr,field,scan"]: |
461 468 | shutil.copytree(src, dst) |
462 469 | myms.open(dst, nomodify=False) |
463 470 | myms.statwt(timebin=timebin, combine=combine) |
464 471 | myms.done() |
465 472 | self.compare(dst, ref) |
466 473 | shutil.rmtree(dst) |
467 474 | |
475 + | skip("temporary skip for debugging one test") | .
468 476 | def test_statalg(self): |
469 477 | """Test statalg""" |
470 478 | # just testing inputs |
471 479 | dst = "ngc5921.split.statalg.ms" |
472 480 | for statalg in ["cl", "ch", "h", "f", "bogus"]: |
473 481 | shutil.copytree(src, dst) |
474 482 | myms.open(dst, nomodify=False) |
475 483 | if statalg == "cl": |
476 484 | self.assertTrue(myms.statwt(statalg=statalg)) |
477 485 | elif statalg == "ch": |
500 508 | shutil.copytree(src, dst) |
501 509 | myms.open(dst, nomodify=False) |
502 510 | myms.statwt(timebin=timebin, combine=combine, wtrange=wtrange) |
503 511 | myms.done() |
504 512 | self.compare(dst, ref) |
505 513 | # self._check_weights( |
506 514 | # dst, row_to_rows, 'c', None, True, None, wtrange |
507 515 | # ) |
508 516 | shutil.rmtree(dst) |
509 517 | |
518 + | skip("temporary skip for debugging one test") | .
510 519 | def test_preview(self): |
511 520 | """Test preview mode""" |
512 521 | dst = "ngc5921.split.preview.ms" |
513 522 | [refwt, refwtsp, refflag, reffrow, refdata] = _get_dst_cols(src) |
514 523 | combine = "corr" |
515 524 | timebin = "300s" |
516 525 | wtrange = [1, 2] |
517 526 | preview = True |
518 527 | shutil.copytree(src, dst) |
519 528 | myms.open(dst, nomodify=False) |
525 534 | self.assertTrue(np.all(tstflag == refflag), "FLAGs don't match") |
526 535 | self.assertTrue(np.all(tstfrow == reffrow), "FLAG_ROWs don't match") |
527 536 | self.assertTrue( |
528 537 | np.all(np.isclose(tstwt, refwt)), "WEIGHTs don't match" |
529 538 | ) |
530 539 | self.assertTrue( |
531 540 | np.all(np.isclose(tstwtsp, refwtsp)), "WEIGHT_SPECTRUMs don't match" |
532 541 | ) |
533 542 | shutil.rmtree(dst) |
534 543 | |
544 + | skip("temporary skip for debugging one test") | .
535 545 | def test_data_col(self): |
536 546 | """Test using data column""" |
537 547 | dst = "ngc5921.split.data.ms" |
538 548 | ref = 'ngc5921_statwt_ref_test_data_col.ms' |
539 549 | combine = "corr" |
540 550 | timebin = 1 |
541 551 | data = "data" |
542 552 | """ |
543 553 | row_to_rows = [] |
544 554 | for i in range(60): |
549 559 | self.assertTrue(mytb.removecols("DATA")) |
550 560 | self.assertTrue(mytb.renamecol("CORRECTED_DATA", "DATA")) |
551 561 | mytb.done() |
552 562 | myms.open(dst, nomodify=False) |
553 563 | myms.statwt(timebin=timebin, combine=combine, datacolumn=data) |
554 564 | myms.done() |
555 565 | # self._check_weights(dst, row_to_rows, 'd', None, True, None, None) |
556 566 | self.compare(dst, ref) |
557 567 | shutil.rmtree(dst) |
558 568 | |
569 + | skip("temporary skip for debugging one test") | .
559 570 | def test_sliding_time_window(self): |
560 571 | """Test sliding time window""" |
561 572 | dst = "ngc5921.split.sliding_time_window.ms" |
562 573 | ref = 'ngc5921_statwt_ref_test_sliding_time_window.ms' |
563 574 | timebin = "300s" |
564 575 | """ |
565 576 | row_to_rows = [] |
566 577 | row_to_rows.append([0, 6]) |
567 578 | row_to_rows.append([0, 7]) |
568 579 | row_to_rows.append([0, 8]) |
627 638 | shutil.copytree(src, dst) |
628 639 | myms.open(dst, nomodify=False) |
629 640 | myms.statwt(timebin=timebin, slidetimebin=True) |
630 641 | myms.done() |
631 642 | # self._check_weights( |
632 643 | # dst, row_to_rows, 'c', None, False, None, None |
633 644 | # ) |
634 645 | self.compare(dst, ref) |
635 646 | shutil.rmtree(dst) |
636 647 | |
648 + | skip("temporary skip for debugging one test") | .
637 649 | def test_sliding_window_timebin_int(self): |
638 650 | """Test sliding window with timebin as int specified""" |
639 651 | dst = "ngc5921.split.sliding_time_window.ms" |
640 652 | # row_to_rows = [] |
641 653 | """ |
642 654 | # odd int, timebin = 5 |
643 655 | row_to_rows.append([0, 5]) |
644 656 | row_to_rows.append([0, 5]) |
645 657 | row_to_rows.append([0, 5]) |
646 658 | row_to_rows.append([1, 6]) |
782 794 | shutil.copytree(src, dst) |
783 795 | myms.open(dst, nomodify=False) |
784 796 | myms.statwt(timebin=timebin, slidetimebin=True) |
785 797 | myms.done() |
786 798 | #self._check_weights( |
787 799 | # dst, row_to_rows, 'c', None, False, None, None |
788 800 | #) |
789 801 | self.compare(dst, ref) |
790 802 | shutil.rmtree(dst) |
791 803 | |
804 + | skip("temporary skip for debugging one test") | .
792 805 | def test_residual(self): |
793 806 | """Test using corrected_data - model_data column""" |
794 807 | dst = "ngc5921.split.residualwmodel.ms" |
795 808 | ref = 'ngc5921_statwt_ref_test_residual.ms' |
796 809 | data = "residual" |
797 810 | # row_to_rows = [] |
798 811 | # for i in range(60): |
799 812 | # row_to_rows.append([i, i+1]) |
800 813 | shutil.copytree(src, dst) |
801 814 | myms.open(dst, nomodify=False) |
802 815 | myms.statwt(datacolumn=data) |
803 816 | myms.done() |
804 817 | # self._check_weights( |
805 818 | # dst, row_to_rows, data, None, False, None, None |
806 819 | # ) |
807 820 | self.compare(dst, ref) |
808 821 | shutil.rmtree(dst) |
809 822 | |
823 + | skip("temporary skip for debugging one test") | .
810 824 | def test_residual_no_model(self): |
811 825 | """Test datacolumn='residual' in the absence of a MODEL_DATA column""" |
812 826 | dst = "ngc5921.split.residualwoutmodel.ms" |
813 827 | ref = 'ngc5921_statwt_ref_test_residual_no_model.ms' |
814 828 | data = "residual" |
815 829 | shutil.copytree(src, dst) |
816 830 | self.assertTrue(mytb.open(dst, nomodify=False)) |
817 831 | self.assertTrue(mytb.removecols("MODEL_DATA")) |
818 832 | mytb.done() |
819 833 | myms.open(dst, nomodify=False) |
820 834 | myms.statwt(datacolumn=data) |
821 835 | myms.done() |
822 836 | # self._check_weights( |
823 837 | # dst, row_to_rows, data, None, False, None, None |
824 838 | # ) |
825 839 | self.compare(dst, ref) |
826 840 | shutil.rmtree(dst) |
827 841 | |
842 + | skip("temporary skip for debugging one test") | .
828 843 | def test_residual_data(self): |
829 844 | """Test using data - model_data column""" |
830 845 | dst = "ngc5921.split.residualdatawmodel.ms" |
831 846 | ref = 'ngc5921_statwt_ref_test_residual_data.ms' |
832 847 | data = "residual_data" |
833 848 | # row_to_rows = [] |
834 849 | # for i in range(60): |
835 850 | # row_to_rows.append([i, i+1]) |
836 851 | shutil.copytree(src, dst) |
837 852 | myms.open(dst, nomodify=False) |
838 853 | myms.statwt(datacolumn=data) |
839 854 | myms.done() |
840 855 | # self._check_weights( |
841 856 | # dst, row_to_rows, data, None, False, None, None |
842 857 | # ) |
843 858 | self.compare(dst, ref) |
844 859 | shutil.rmtree(dst) |
845 860 | |
861 + | skip("temporary skip for debugging one test") | .
846 862 | def test_residual_data_no_model(self): |
847 863 | """Test using residual data in absence of MODEL_DATA""" |
848 864 | dst = "ngc5921.split.residualdatawoutmodel.ms" |
849 865 | ref = 'ngc5921_statwt_ref_test_residual_data_no_model.ms' |
850 866 | data = "residual_data" |
851 867 | # row_to_rows = [] |
852 868 | # for i in range(60): |
853 869 | # row_to_rows.append([i, i+1]) |
854 870 | shutil.copytree(src, dst) |
855 871 | self.assertTrue(mytb.open( |
861 877 | mytb.done() |
862 878 | myms.open(dst, nomodify=False) |
863 879 | myms.statwt(datacolumn=data) |
864 880 | myms.done() |
865 881 | # self._check_weights( |
866 882 | # dst, row_to_rows, data, None, False, None, None |
867 883 | # ) |
868 884 | self.compare(dst, ref) |
869 885 | shutil.rmtree(dst) |
870 886 | |
887 + | skip("temporary skip for debugging one test") | .
871 888 | def test_returned_stats(self): |
872 889 | """Test returned stats, CAS-10881""" |
873 890 | dst = "ngc5921.split.statstest.ms" |
874 891 | shutil.copytree(src, dst) |
875 892 | myms.open(dst, nomodify=False) |
876 893 | res = myms.statwt() |
877 894 | myms.done() |
878 895 | self.assertTrue( |
879 896 | np.isclose(res['mean'], 3.691224144843796), |
880 897 | "mean is incorrect" |
881 898 | ) |
882 899 | self.assertTrue( |
883 900 | np.isclose(res['variance'], 6.860972180192186), |
884 901 | "variance is incorrect" |
885 902 | ) |
886 903 | shutil.rmtree(dst) |
887 904 | |
905 + | skip("temporary skip for debugging one test") | .
888 906 | def test_multi_spw_no_spectrum_columns(self): |
889 907 | "Test multi spw with no sigma nor weight spectrum columns works" |
890 908 | for tb in [1, "5s"]: |
891 909 | dst = "statwt_test_vlass_timebin" + str(tb) + ".ms" |
892 910 | shutil.copytree(vlass, dst) |
893 911 | myms.open(dst, nomodify=False) |
894 912 | res = myms.statwt( |
895 913 | combine='scan,field,state', timebin=tb, |
896 914 | datacolumn='residual_data' |
897 915 | ) |