Example #1
0
    def finish(self):
        if self.testname is not None:
            self.finish_test()
        self.logger = None
        # in recording mode, pause before exiting
        if self.recording and "-nopause" not in sys.argv:
            self.mqs.disconnect()
            octopussy.stop()
            if self._assay_stat:
                print(
                    """\n*** ERROR ***: Assay data recording failed, please review the log.\n"""
                )
            a = input("""\n\n
Since you're running the assayer in recording mode, we have disconnected 
from the meqserver without stopping it. You may wish to run the browser to
ensure that tree state is correct. Run the browser now (Y/n)? """).rstrip()
            if not a or a[0].lower() == 'y':
                os.system("meqbrowser.py")
            print(
                """\n\nReminder: you may need to kill the meqserver manually."""
            )
        else:
            meqserver.stop_default_mqs()
        self.mqs = None
        return self._assay_stat
Example #2
0
  def finish (self):
    if self.testname is not None:
      self.finish_test();
    self.logger = None;
    # in recording mode, pause before exiting
    if self.recording and "-nopause" not in sys.argv:
      self.mqs.disconnect();
      octopussy.stop();
      if self._assay_stat:
        print """\n*** ERROR ***: Assay data recording failed, please review the log.\n""";
      a = raw_input("""\n\n
Since you're running the assayer in recording mode, we have disconnected 
from the meqserver without stopping it. You may wish to run the browser to
ensure that tree state is correct. Run the browser now (Y/n)? """).rstrip();
      if not a or a[0].lower() == 'y':
        os.system("meqbrowser.py");
      print """\n\nReminder: you may need to kill the meqserver manually.""";
    else:
      meqserver.stop_default_mqs();
    self.mqs = None;
    return self._assay_stat;
	  traceback.print_exc();

    print "### No more commands";

  ### Cleanup time
  except:
    print "Exception caught:";
    traceback.print_exc();
    retcode = 1;
  finally:
    if not mqs.current_server:
      print "### The meqserver appears to have died on us :( Please check for core files and such.";
      retcode = 1;
    else:
      # check for accumulated errors
      if mqs.num_errors():
        print "### meqserver reported %d error(s) during the run:"%mqs.num_errors();
        for (i,err) in enumerate(mqs.get_error_log()):
          print "###   %03d: %s"%(i,err[1]);   
        retcode = 1
      print "### Stopping the meqserver";
    # this halts the meqserver
    try:
      meqserver.stop_default_mqs();
    except:
      traceback.print_exc();
      print "### There was an error stopping the meqserver cleanly. Exiting anyway.";
      sys.exit(1);
    # now we can exit
    print "### All your batch are belong to us. Bye!" if not retcode else "### All your batch are not belong to us, returning with error code";
    sys.exit(retcode);
Example #4
0
def testMeqtreesBatchJob():
    trace_sync = True
    #  sys.settrace(trace_lines);

    if len(sys.argv) > 1:
        newdir = PACKAGE_TEST_DIR
        print("========== Changing working directory to", newdir)
        os.chdir(newdir)
        print("========== Making required symlinks")
        run("rm {0:s}/WSRT_ANTENNA ; ln -s {1:s}".format(
            PACKAGE_TEST_DIR,
            path(os.path.join(PACKAGE_TEST_DIR, "WSRT_ANTENNA"))))
        run("rm {0:s}/test-lsm.txt; ln -s {1:s}".format(
            PACKAGE_TEST_DIR, path(os.path.join(path("test-lsm.txt")))))

    if not os.access(".", os.R_OK | os.W_OK):
        print("Directory", os.getcwd(),
              "not writable, can't run tests in here.")
        print(
            "You may choose to run the tests in a different directory by giving it as an argument to this script."
        )
        sys.exit(1)

    ## check if we have owlcat or owlcat.sh
    owlcat = ""
    for dirname in os.environ['PATH'].split(':'):
        for binary in "owlcat", "owlcat.sh":
            tmp = os.path.join(dirname, binary)
            if os.path.exists(tmp):
                owlcat = tmp
                break
        if owlcat:
            break
    if not owlcat:
        raise RuntimeError("Can't locate owlcat or owlcat.sh")

    ## make simulated MS
    print("========== Removing files")

    run("rm -fr {0:s}/WSRT.MS* {0:s}/WSRT*img {0:s}/WSRT*fits".format(
        PACKAGE_TEST_DIR))
    print("========== Running makems")
    run("makems %s" % path(os.path.join(PACKAGE_TEST_DIR, "WSRT_makems.cfg")))
    run("mv {0:s}/WSRT.MS_p0 {0:s}/WSRT.MS".format(PACKAGE_TEST_DIR))
    os.environ["MEQTREES_CATTERY_PATH"] = Cattery.__path__[0]
    run("pyxis {0:s}/WSRT.MS ms.prep".format(PACKAGE_TEST_DIR))
    #TODO: this is hacky, bug in CASAcore
    run("ls -ld {0:s}/WSRT.MS".format(PACKAGE_TEST_DIR))
    run("{0:s} downweigh-redundant-baselines {1:s}/WSRT.MS".format(
        owlcat, PACKAGE_TEST_DIR))
    run("lwimager ms={0:s}/WSRT.MS data=CORRECTED_DATA mode=channel weight=natural npix=10"
        .format(PACKAGE_TEST_DIR))
    # make test LSMs
    run("""tigger-convert {0:s}/test-lsm.txt --rename --format "ra_d dec_d i q u v" --center 0.1deg,60.5deg -f"""
        .format(PACKAGE_TEST_DIR))
    run("""tigger-convert {0:s}/test-lsm.lsm.html {0:s}/test-lsm1.txt --output-format "name ra_h dec_d i q u v freq0 spi rm tags..." -f"""
        .format(PACKAGE_TEST_DIR))
    run("""cut -d " " -f 1-10 {0:s}/test-lsm1.txt >{0:s}/test-lsm1.txt.tmp""".
        format(PACKAGE_TEST_DIR))
    run("""diff {0:s}/test-lsm1.txt.tmp {1:s} || diff {0:s}/test-lsm1.txt.tmp {2:s}"""
        .format(
            PACKAGE_TEST_DIR,
            path(os.path.join(PACKAGE_TEST_DIR, 'test-lsm1.txt.reference')),
            path(os.path.join(PACKAGE_TEST_DIR, 'test-lsm2.txt.reference'))))
    run("""tigger-convert {0:s}/test-lsm1.txt --format "name ra_h dec_d i q u v freq0 spi rm tags..." -f"""
        .format(PACKAGE_TEST_DIR))
    run("""{0:s} plot-ms {1:s}/WSRT.MS DATA:I -o data_i.png""".format(
        owlcat, PACKAGE_TEST_DIR))
    run("""{0:s} run-imager ms={1:s}/WSRT.MS name_dirty=tmp""".format(
        owlcat, PACKAGE_TEST_DIR))

    print("importing meqserver")
    from Timba.Apps import meqserver
    print("importing Compile")
    from Timba.TDL import Compile
    print("importing TDLOptions")
    from Timba.TDL import TDLOptions

    # This starts a meqserver. Note how we pass the "-mt 2" option to run two threads.
    # A proper pipeline script may want to get the value of "-mt" from its own arguments (sys.argv).
    print("Starting meqserver")
    mqs = meqserver.default_mqs(wait_init=10, extra=["-mt", "2"])

    try:
        ## make simulation with perfect MODEL_DATA
        script = path(os.path.join(PACKAGE_TEST_DIR, "sim.py"))
        print("========== Compiling", script)
        TDLOptions.config.read(
            path(os.path.join(PACKAGE_TEST_DIR, "testing.tdl.conf")))
        TDLOptions.config.set(
            "calibrate", "ms_sel.msname",
            os.path.join(PACKAGE_TEST_DIR,
                         TDLOptions.config.get("calibrate", "ms_sel.msname")))
        TDLOptions.config.set(
            "calibrate", "tiggerlsm.filename",
            os.path.join(
                PACKAGE_TEST_DIR,
                TDLOptions.config.get("calibrate", "tiggerlsm.filename")))
        TDLOptions.config.set(
            "calibrate", "lsm.filename",
            os.path.join(PACKAGE_TEST_DIR,
                         TDLOptions.config.get("calibrate", "lsm.filename")))
        TDLOptions.config.set(
            "calibrate", "cal_g_diag.g_diag.table_name",
            os.path.join(
                PACKAGE_TEST_DIR,
                TDLOptions.config.get("calibrate",
                                      "cal_g_diag.g_diag.table_name")))
        TDLOptions.config.set(
            "calibrate", "cal_g_offdiag.g_offdiag.table_name",
            os.path.join(
                PACKAGE_TEST_DIR,
                TDLOptions.config.get("calibrate",
                                      "cal_g_offdiag.g_offdiag.table_name")))
        TDLOptions.config.set(
            "simulate-model", "lsm.filename",
            os.path.join(
                PACKAGE_TEST_DIR,
                TDLOptions.config.get("simulate-model", "lsm.filename")))
        TDLOptions.config.set(
            "simulate-model", "ms_sel.msname",
            os.path.join(
                PACKAGE_TEST_DIR,
                TDLOptions.config.get("simulate-model", "ms_sel.msname")))
        TDLOptions.config.set(
            "simulate-model", "tiggerlsm.filename",
            os.path.join(
                PACKAGE_TEST_DIR,
                TDLOptions.config.get("simulate-model", "tiggerlsm.filename")))
        TDLOptions.config.set(
            "calibrate", "img_sel.output_fitsname",
            os.path.join(PACKAGE_TEST_DIR,
                         "WSRT.MS.CORRECTED_DATA.channel.1ch.fits"))
        TDLOptions.config.set(
            "simulate-model", "img_sel.output_fitsname",
            os.path.join(PACKAGE_TEST_DIR,
                         "WSRT.MS.MODEL_DATA.channel.1ch.fits"))
        with open(os.path.join(PACKAGE_TEST_DIR, "testing_tmp.tdl.conf"),
                  "w") as f:
            TDLOptions.config.write(f)
        TDLOptions.config.read(
            path(os.path.join(PACKAGE_TEST_DIR, "testing_tmp.tdl.conf")))
        # needs to re-read because of a Timba perculiarity
        mod, ns, msg = Compile.compile_file(mqs,
                                            script,
                                            config="simulate-model")
        print("========== Simulating MODEL_DATA ")
        mod._tdl_job_1_simulate_MS(mqs, None, wait=True)
        print("========== Imaging MODEL_DATA ")
        TDLOptions.get_job_func('make_dirty_image')(mqs,
                                                    None,
                                                    wait=True,
                                                    run_viewer=False)

        ## compare against reference image
        print("========== Verifying test image ")
        if not os.path.exists(
                os.path.join(PACKAGE_TEST_DIR,
                             "WSRT.MS.MODEL_DATA.channel.1ch.fits")):
            raise RuntimeError("Output FITS file does not exist")
        if not os.path.exists(
                os.path.join(PACKAGE_TEST_DIR, "test-refimage.fits")):
            raise RuntimeError("Reference FITS file does not exist")
        verify_image(os.path.join(PACKAGE_TEST_DIR,
                                  "WSRT.MS.MODEL_DATA.channel.1ch.fits"),
                     path(os.path.join(PACKAGE_TEST_DIR,
                                       "test-refimage.fits")),
                     maxdelta=1e-3)

        print("========== Compiling script with modified config")
        TDLOptions.init_options("simulate-model", save=False)
        TDLOptions.set_option("me.g_enable", True)
        mod, ns, msg = Compile.compile_file(mqs, script, config=None)
        print("========== Simulating DATA ")
        TDLOptions.set_option("ms_sel.output_column", "DATA")
        mod._tdl_job_1_simulate_MS(mqs, None, wait=True)
        print("========== Imaging DATA ")
        TDLOptions.set_option("img_sel.imaging_column", "DATA")
        TDLOptions.get_job_func('make_dirty_image')(mqs,
                                                    None,
                                                    wait=True,
                                                    run_viewer=False)

        ## calibrate
        script = path(os.path.join(PACKAGE_TEST_DIR, "cal.py"))
        print("========== Compiling", script)
        mod, ns, msg = Compile.compile_file(mqs, script, config="calibrate")
        print("========== Calibrating ")
        TDLOptions.get_job_func('cal_G_diag')(mqs, None, wait=True)
        print("========== Imaging MODEL_DATA ")
        TDLOptions.get_job_func('make_dirty_image')(mqs,
                                                    None,
                                                    wait=True,
                                                    run_viewer=False)

    finally:
        print("Stopping meqserver")
        # this halts the meqserver
        meqserver.stop_default_mqs()

    print("========== Making plots of solutions ")
    run("""{0:s} plot-ms {1:s}/WSRT.MS CORRECTED_DATA:I -I ">0" -o {1:s}/corrected_data_i.png"""
        .format(owlcat, PACKAGE_TEST_DIR))
    run("""{0:s} plot-parms -l {1:s}/WSRT.MS/G_diag.fmep""".format(
        owlcat, PACKAGE_TEST_DIR))
    run("""{0:s} plot-parms {1:s}/WSRT.MS/G_diag.fmep G:*/norm -o {1:s}/parmplot.png"""
        .format(owlcat, PACKAGE_TEST_DIR))
    run("""{0:s} downweigh-redundant-baselines {1:s}/WSRT.MS""".format(
        owlcat, PACKAGE_TEST_DIR))

    ## compare against reference image
    print("========== Verifying residual image ")
    if not os.path.exists(
            os.path.join(PACKAGE_TEST_DIR,
                         "WSRT.MS.CORRECTED_DATA.channel.1ch.fits")):
        raise RuntimeError("Output FITS file does not exist")
    if not os.path.exists(
            os.path.join(PACKAGE_TEST_DIR, "test-refresidual.fits")):
        raise RuntimeError("Reference FITS file does not exist")
    verify_image(os.path.join(PACKAGE_TEST_DIR,
                              "WSRT.MS.CORRECTED_DATA.channel.1ch.fits"),
                 os.path.join(PACKAGE_TEST_DIR, "test-refresidual.fits"),
                 maxdelta=1e-3)

    ## all tests succeeded
    print("========== Break out the bubbly, this hog is airborne!")

    # now we can exit
    print("Bye!")
    # or was interrupted by an exception midway through, we use a try...finally block.
    try:

        TDLOptions.config.read("batch_sim_example.tdl.conf")

        script = "example-sim.py"
        print("========== Compiling batch job 1")
        mod, ns, msg = Compile.compile_file(mqs, script, config="batch job 1")
        print("========== Running batch job 1")
        mod._tdl_job_1_simulate_MS(mqs, None, wait=True)

        print("========== Compiling batch job 2")
        mod, ns, msg = Compile.compile_file(mqs, script, config="batch job 2")
        print("========== Running batch job 2")
        mod._tdl_job_1_simulate_MS(mqs, None, wait=True)

        print("========== Compiling batch job 2 with modified config")
        TDLOptions.init_options("batch job 2", save=False)
        TDLOptions.set_option("me.enable_G", False)
        mod, ns, msg = Compile.compile_file(mqs, script, config=None)
        print("========== Running batch job 2")
        mod._tdl_job_1_simulate_MS(mqs, None, wait=True)

    ### Cleanup time
    finally:
        print("Stopping meqserver")
        # this halts the meqserver
        meqserver.stop_default_mqs()
        # now we can exit
        print("Bye!")
Example #6
0
def testMeqtreesBatchJob():
  trace_sync = True;
#  sys.settrace(trace_lines);
  
  if len(sys.argv) > 1:
    newdir = PACKAGE_TEST_DIR;
    print("========== Changing working directory to",newdir);
    os.chdir(newdir);
    print("========== Making required symlinks");
    run("rm {0:s}/WSRT_ANTENNA ; ln -s {1:s}".format(PACKAGE_TEST_DIR, 
                                                     path(os.path.join(PACKAGE_TEST_DIR, "WSRT_ANTENNA"))));
    run("rm {0:s}/test-lsm.txt; ln -s {1:s}".format(PACKAGE_TEST_DIR,
                                                    path(os.path.join(path("test-lsm.txt")))));

  if not os.access(".",os.R_OK|os.W_OK):
    print("Directory",os.getcwd(),"not writable, can't run tests in here.")
    print("You may choose to run the tests in a different directory by giving it as an argument to this script.")
    sys.exit(1);

  ## check if we have owlcat or owlcat.sh
  owlcat = "";
  for dirname in os.environ['PATH'].split(':'):
    for binary in "owlcat","owlcat.sh":
      tmp = os.path.join(dirname,binary);
      if os.path.exists(tmp):
        owlcat = tmp;
        break;
    if owlcat:
      break;
  if not owlcat:
    raise RuntimeError("Can't locate owlcat or owlcat.sh");
    
    
  ## make simulated MS
  print("========== Removing files");
  
  run("rm -fr {0:s}/WSRT.MS* {0:s}/WSRT*img {0:s}/WSRT*fits".format(PACKAGE_TEST_DIR));
  print("========== Running makems");
  run("makems %s" % path(os.path.join(PACKAGE_TEST_DIR, "WSRT_makems.cfg")));
  run("mv {0:s}/WSRT.MS_p0 {0:s}/WSRT.MS".format(PACKAGE_TEST_DIR));
  os.environ["MEQTREES_CATTERY_PATH"] = Cattery.__path__[0]
  run("pyxis {0:s}/WSRT.MS ms.prep".format(PACKAGE_TEST_DIR)); #TODO: this is hacky, bug in CASAcore
  run("ls -ld {0:s}/WSRT.MS".format(PACKAGE_TEST_DIR));
  run("{0:s} downweigh-redundant-baselines {1:s}/WSRT.MS".format(owlcat, PACKAGE_TEST_DIR));
  run("lwimager ms={0:s}/WSRT.MS data=CORRECTED_DATA mode=channel weight=natural npix=10".format(PACKAGE_TEST_DIR));
  # make test LSMs
  run("""tigger-convert {0:s}/test-lsm.txt --rename --format "ra_d dec_d i q u v" --center 0.1deg,60.5deg -f""".format(PACKAGE_TEST_DIR));
  run("""tigger-convert {0:s}/test-lsm.lsm.html {0:s}/test-lsm1.txt --output-format "name ra_h dec_d i q u v freq0 spi rm tags..." -f""".format(PACKAGE_TEST_DIR));
  run("""cut -d " " -f 1-10 {0:s}/test-lsm1.txt >{0:s}/test-lsm1.txt.tmp""".format(PACKAGE_TEST_DIR));
  run("""diff {0:s}/test-lsm1.txt.tmp {1:s}""".format(PACKAGE_TEST_DIR, path(os.path.join(PACKAGE_TEST_DIR, 'test-lsm1.txt.reference'))));
  run("""tigger-convert {0:s}/test-lsm1.txt --format "name ra_h dec_d i q u v freq0 spi rm tags..." -f""".format(PACKAGE_TEST_DIR));
  run("""{0:s} plot-ms {1:s}/WSRT.MS DATA:I -o data_i.png""".format(owlcat, PACKAGE_TEST_DIR));
  run("""{0:s} run-imager ms={1:s}/WSRT.MS name_dirty=tmp""".format(owlcat, PACKAGE_TEST_DIR));

  print("importing meqserver")
  from Timba.Apps import meqserver
  print("importing Compile")
  from Timba.TDL import Compile
  print("importing TDLOptions")
  from Timba.TDL import TDLOptions

  # This starts a meqserver. Note how we pass the "-mt 2" option to run two threads.
  # A proper pipeline script may want to get the value of "-mt" from its own arguments (sys.argv).
  print("Starting meqserver");
  mqs = meqserver.default_mqs(wait_init=10,extra=["-mt","2"]);

  try:
    ## make simulation with perfect MODEL_DATA
    script = path(os.path.join(PACKAGE_TEST_DIR, "sim.py"));
    print("========== Compiling",script);
    TDLOptions.config.read(path(os.path.join(PACKAGE_TEST_DIR, "testing.tdl.conf")));
    TDLOptions.config.set("calibrate", "ms_sel.msname", os.path.join(PACKAGE_TEST_DIR, TDLOptions.config.get("calibrate", "ms_sel.msname")))
    TDLOptions.config.set("calibrate", "tiggerlsm.filename", os.path.join(PACKAGE_TEST_DIR, TDLOptions.config.get("calibrate", "tiggerlsm.filename")))
    TDLOptions.config.set("calibrate", "lsm.filename", os.path.join(PACKAGE_TEST_DIR, TDLOptions.config.get("calibrate", "lsm.filename")))
    TDLOptions.config.set("calibrate", "cal_g_diag.g_diag.table_name", os.path.join(PACKAGE_TEST_DIR, TDLOptions.config.get("calibrate", "cal_g_diag.g_diag.table_name")))
    TDLOptions.config.set("calibrate", "cal_g_offdiag.g_offdiag.table_name", os.path.join(PACKAGE_TEST_DIR, TDLOptions.config.get("calibrate", "cal_g_offdiag.g_offdiag.table_name")))
    TDLOptions.config.set("simulate-model", "lsm.filename", os.path.join(PACKAGE_TEST_DIR, TDLOptions.config.get("simulate-model", "lsm.filename")))
    TDLOptions.config.set("simulate-model", "ms_sel.msname", os.path.join(PACKAGE_TEST_DIR, TDLOptions.config.get("simulate-model", "ms_sel.msname")))
    TDLOptions.config.set("simulate-model", "tiggerlsm.filename", os.path.join(PACKAGE_TEST_DIR, TDLOptions.config.get("simulate-model", "tiggerlsm.filename")))
    TDLOptions.config.set("calibrate", "img_sel.output_fitsname", os.path.join(PACKAGE_TEST_DIR, "WSRT.MS.CORRECTED_DATA.channel.1ch.fits"))
    TDLOptions.config.set("simulate-model", "img_sel.output_fitsname", os.path.join(PACKAGE_TEST_DIR, "WSRT.MS.MODEL_DATA.channel.1ch.fits"))
    with open(os.path.join(PACKAGE_TEST_DIR, "testing_tmp.tdl.conf"), "w") as f:
      TDLOptions.config.write(f)
    TDLOptions.config.read(path(os.path.join(PACKAGE_TEST_DIR, "testing_tmp.tdl.conf"))); # needs to re-read because of a Timba perculiarity
    mod,ns,msg = Compile.compile_file(mqs, script, config="simulate-model");
    print("========== Simulating MODEL_DATA ");
    mod._tdl_job_1_simulate_MS(mqs,None,wait=True);
    print("========== Imaging MODEL_DATA ");
    TDLOptions.get_job_func('make_dirty_image')(mqs,None,wait=True,run_viewer=False);

    ## compare against reference image
    print("========== Verifying test image ");
    if not os.path.exists(os.path.join(PACKAGE_TEST_DIR, "WSRT.MS.MODEL_DATA.channel.1ch.fits")): raise RuntimeError("Output FITS file does not exist")
    if not os.path.exists(os.path.join(PACKAGE_TEST_DIR, "test-refimage.fits")): raise RuntimeError("Reference FITS file does not exist")
    verify_image(os.path.join(PACKAGE_TEST_DIR, "WSRT.MS.MODEL_DATA.channel.1ch.fits"), 
                 path(os.path.join(PACKAGE_TEST_DIR, "test-refimage.fits")), 
                 maxdelta=1e-3);

    print("========== Compiling script with modified config");
    TDLOptions.init_options("simulate-model",save=False);
    TDLOptions.set_option("me.g_enable",True);
    mod,ns,msg = Compile.compile_file(mqs,script,config=None);
    print("========== Simulating DATA ");
    TDLOptions.set_option("ms_sel.output_column","DATA");
    mod._tdl_job_1_simulate_MS(mqs,None,wait=True);
    print("========== Imaging DATA ");
    TDLOptions.set_option("img_sel.imaging_column","DATA");
    TDLOptions.get_job_func('make_dirty_image')(mqs,None,wait=True,run_viewer=False);

    ## calibrate
    script = path(os.path.join(PACKAGE_TEST_DIR, "cal.py"));
    print("========== Compiling",script);
    mod,ns,msg = Compile.compile_file(mqs,script,config="calibrate");
    print("========== Calibrating ");
    TDLOptions.get_job_func('cal_G_diag')(mqs,None,wait=True);
    print("========== Imaging MODEL_DATA ");
    TDLOptions.get_job_func('make_dirty_image')(mqs,None,wait=True,run_viewer=False);
    
  finally:
    print("Stopping meqserver");
    # this halts the meqserver
    meqserver.stop_default_mqs();
    
  print("========== Making plots of solutions ");
  run("""{0:s} plot-ms {1:s}/WSRT.MS CORRECTED_DATA:I -I ">0" -o {1:s}/corrected_data_i.png""".format(owlcat, PACKAGE_TEST_DIR));
  run("""{0:s} plot-parms -l {1:s}/WSRT.MS/G_diag.fmep""".format(owlcat, PACKAGE_TEST_DIR));
  run("""{0:s} plot-parms {1:s}/WSRT.MS/G_diag.fmep G:*/norm -o {1:s}/parmplot.png""".format(owlcat, PACKAGE_TEST_DIR));
  run("""{0:s} downweigh-redundant-baselines {1:s}/WSRT.MS""".format(owlcat, PACKAGE_TEST_DIR));

  ## compare against reference image
  print("========== Verifying residual image ");
  if not os.path.exists(os.path.join(PACKAGE_TEST_DIR, "WSRT.MS.CORRECTED_DATA.channel.1ch.fits")): raise RuntimeError("Output FITS file does not exist")
  if not os.path.exists(os.path.join(PACKAGE_TEST_DIR, "test-refresidual.fits")): raise RuntimeError("Reference FITS file does not exist")
  verify_image(os.path.join(PACKAGE_TEST_DIR, "WSRT.MS.CORRECTED_DATA.channel.1ch.fits"),
               os.path.join(PACKAGE_TEST_DIR, "test-refresidual.fits"),
               maxdelta=1e-3);

  ## all tests succeeded
  print("========== Break out the bubbly, this hog is airborne!");

  # now we can exit
  print("Bye!");