def combine_ms(target_info): output = os.path.join(mkdtemp(dir=scratch), "combined.MS") run_ndppp(get_parset_subset(input_parset, "combine.parset", scratch), { "msin": str(target_info["datafiles"]), "msout": output }) target_info["combined_ms"] = output
def combine_ms(target_info): output = os.path.join(mkdtemp(dir=scratch), "combined.MS") run_ndppp( get_parset_subset(input_parset, "combine.parset", scratch), {"msin": str(target_info["datafiles"]), "msout": output}, ) target_info["combined_ms"] = output
def phaseonly(target_info): # We chdir to the scratch directory initially, so that logs get dumped # there, then we'll copy the logs to the output directory when we're # done. try: os.chdir(os.path.dirname(target_info["combined_ms"])) run_calibrate_standalone( get_parset_subset(input_parset, "phaseonly.parset", scratch), target_info["combined_ms"], target_info["skymodel"]) for logfile in glob.glob( os.path.join(os.path.dirname(target_info["combined_ms"]), "*log")): shutil.copy(logfile, target_info["output_dir"]) except Exception, e: print "Error in phaseonly with %s" % (target_info["combined_ms"]) print str(e) raise
def phaseonly(target_info): # We chdir to the scratch directory initially, so that logs get dumped # there, then we'll copy the logs to the output directory when we're # done. try: os.chdir(os.path.dirname(target_info["combined_ms"])) run_calibrate_standalone( get_parset_subset(input_parset, "phaseonly.parset", scratch), target_info["combined_ms"], target_info["skymodel"], ) for logfile in glob.glob(os.path.join(os.path.dirname(target_info["combined_ms"]), "*log")): shutil.copy(logfile, target_info["output_dir"]) except Exception, e: print "Error in phaseonly with %s" % (target_info["combined_ms"]) print str(e) raise
ms_target["SAP00%d_band%d" % (beam, band)] = target_info start_sb += band_size # Copy to working directories for name in ms_target.iterkeys(): print "Copying %s to scratch area" % (name, ) ms_target[name]["datafiles"] = copy_to_work_area( ms_target[name]["datafiles"], scratch) # We'll run as many simultaneous jobs as we have CPUs pool = ThreadPool(cpu_count()) # Calibration of each calibrator subband os.chdir(ms_cal['output_dir']) # Logs will get dumped here clear_calibrate_stand_alone_logs() calcal_parset = get_parset_subset(input_parset, "calcal.parset", scratch) def calibrate_calibrator(cal): source = table( "%s::OBSERVATION" % (cal, )).getcol("LOFAR_TARGET")['array'][0].lower().replace( ' ', '') skymodel = os.path.join(input_parset.getString("skymodel_dir"), "%s.skymodel" % (source, )) print "Calibrating %s with skymodel %s" % (cal, skymodel) run_calibrate_standalone(calcal_parset, cal, skymodel, replace_parmdb=True, replace_sourcedb=True)
assert os.path.exists(target_info["skymodel"]) ms_target["SAP00%d_band%d" % (beam, band)] = target_info start_sb += band_size # Copy to working directories for name in ms_target.iterkeys(): print "Copying %s to scratch area" % (name,) ms_target[name]["datafiles"] = copy_to_work_area(ms_target[name]["datafiles"], scratch) # We'll run as many simultaneous jobs as we have CPUs pool = ThreadPool(cpu_count()) # Calibration of each calibrator subband os.chdir(ms_cal["output_dir"]) # Logs will get dumped here clear_calibrate_stand_alone_logs() calcal_parset = get_parset_subset(input_parset, "calcal.parset", scratch) def calibrate_calibrator(cal): source = table("%s::OBSERVATION" % (cal,)).getcol("LOFAR_TARGET")["array"][0].lower().replace(" ", "") skymodel = os.path.join(input_parset.getString("skymodel_dir"), "%s.skymodel" % (source,)) print "Calibrating %s with skymodel %s" % (cal, skymodel) run_calibrate_standalone(calcal_parset, cal, skymodel, replace_parmdb=True, replace_sourcedb=True) with time_code("Calibration of calibrator"): pool.map(calibrate_calibrator, ms_cal["datafiles"]) # Clip calibrator parmdbs def clip_parmdb(sb): run_process( input_parset.getString("pdbclip.executable"), "--auto",