Exemple #1
0
            imagename = target+'.image.pbcor'
        command = "exportfits(imagename='{0}{1}', fitsimage='{0}{2}', velocity=True,optical=False,overwrite=True,dropstokes=True,stokeslast=True,history=True,dropdeg=True)".format(img_dir,imagename,fitsname)
        logger.info('Executing command: '+command)
        exec(command)
        cf.check_casalog(config,config_raw,logger,casalog)
        coord_chn = False
    logger.info('Completed generation of clean image(s).')
    
    
# Read configuration file with parameters
config_file = sys.argv[-1]
config,config_raw = cf.read_config(config_file)
interactive = config['global']['interactive']

# Set up your logger
logger = cf.get_logger(LOG_FILE_INFO  = '{}.log'.format(config['global']['project_name']),
                    LOG_FILE_ERROR = '{}_errors.log'.format(config['global']['project_name'])) # Set up your logger

# Define MS file name
msfile = '{0}.ms'.format(config['global']['project_name'])

#Remove previous image files
targets = config['calibration']['target_names']
img_path = config['global']['img_dir']+'/'
cf.check_casaversion(logger)
logger.info('Deleting any existing clean image(s).')
for target in targets:
    del_list = [img_path+target+'.mask',img_path+target+'.model',img_path+target+'.pb',img_path+target+'.psf',img_path+target+'.residual',img_path+target+'.sumwt',img_path+target+'.weight']
    del_list.extend(glob.glob(img_path+'{}.image*'.format(target)))
    if len(del_list) > 0:
        for file_path in del_list:
            try:
Exemple #2
0
import glob, numpy
import imp
imp.load_source('common_functions', 'common_functions.py')
import common_functions as cf

# Read configuration file with parameters
config_file = sys.argv[-1]
config, config_raw = cf.read_config(config_file)

HCG = config['combine']['hcg']
proj_IDs = config['combine']['proj_ids']

# Set up your logger
logger = cf.get_logger(LOG_FILE_INFO='HCG{}.log'.format(str(HCG)),
                       LOG_FILE_ERROR='HCG{}_errors.log'.format(
                           str(HCG)))  # Set up your logger

logger.info(
    'Starting joint (clean) imaging of HCG {0} from the projects: {1}'.format(
        str(HCG), proj_IDs))

msfiles = []
for proj in proj_IDs:
    msfile = '../{0}/sources/HCG{1}*.*split.contsub'.format(proj, str(HCG))
    new_files = glob.glob(msfile)
    if len(new_files) > 0:
        msfiles.extend(new_files)
        logger.info('MS file(s) added to combine list: {}'.format(new_files))
    else:
        logger.warning('MS not found: {}'.format(msfile))