Skip to content
Snippets Groups Projects
Commit acff1376 authored by Alexander Kutkin's avatar Alexander Kutkin
Browse files

adjustments

parent d72a6fc0
No related branches found
No related tags found
No related merge requests found
...@@ -42,7 +42,7 @@ def modify_filename(fname, string, ext=None): ...@@ -42,7 +42,7 @@ def modify_filename(fname, string, ext=None):
return fbase + string + fext return fbase + string + fext
def wsclean(msin, datacolumn='DATA', outname=None, pixelsize=3, imagesize=3072, mgain=0.8, multifreq=0, autothresh=0.3, def wsclean(msin, wsclean_bin='wsclean', datacolumn='DATA', outname=None, pixelsize=3, imagesize=3072, mgain=0.8, multifreq=0, autothresh=0.3,
automask=3, niter=1000000, multiscale=False, save_source_list=True, automask=3, niter=1000000, multiscale=False, save_source_list=True,
clearfiles=True, clip_model_level=None, clearfiles=True, clip_model_level=None,
fitsmask=None, kwstring=''): fitsmask=None, kwstring=''):
...@@ -361,10 +361,13 @@ def remove_model_components_below_level(model, level=0.0, out=None): ...@@ -361,10 +361,13 @@ def remove_model_components_below_level(model, level=0.0, out=None):
return out return out
def main(msin, outbase=None, cfgfile='imcal.yml'): def main(msin, steps='all', outbase=None, cfgfile='imcal.yml'):
msin = msin.rstrip('/') msin = msin.rstrip('/')
logging.info('Processing {}'.format(msin)) logging.info('Processing {}'.format(msin))
logging.info('The config file: {}'.format(cfgfile)) logging.info('The config file: {}'.format(cfgfile))
logging.info('Running steps: {}'.format(args.steps))
with open(cfgfile) as f: with open(cfgfile) as f:
cfg = yaml.safe_load(f) cfg = yaml.safe_load(f)
...@@ -413,18 +416,20 @@ def main(msin, outbase=None, cfgfile='imcal.yml'): ...@@ -413,18 +416,20 @@ def main(msin, outbase=None, cfgfile='imcal.yml'):
logging.info('The final image exists. Exiting...') logging.info('The final image exists. Exiting...')
return 0 return 0
if cfg['nvss']['doit'] :
# if (not os.path.exists(ms_split)) and (cfg['split1']['startchan'] or cfg['split1']['nchan']):
ms_split = split_ms(msin, msout_path=ms_split, **cfg['split1'])
print('------------------makesource') if cfg['nvss']:
logging.debug('Using NVSS catalog for initial phase calibration')
if (not os.path.exists(ms_split)) and (cfg['split']['startchan'] or cfg['split']['nchan']):
ms_split = split_ms(msin, msout_path=ms_split, **cfg['split'])
makesourcedb('nvss-model.txt', out=nvssMod) makesourcedb('nvss-model.txt', out=nvssMod)
print('-------------nvssCal')
dical(ms_split, nvssMod, msout=dical0, h5out=h5_0, **cfg['nvssCal']) dical(ms_split, nvssMod, msout=dical0, h5out=h5_0, **cfg['nvss'])
view_sols(h5_0, outname=msbase+'_sols_dical0') view_sols(h5_0, outname=msbase+'_sols_dical0')
else : else :
ms_split = split_ms(msin, msout_path=dical0, **cfg['split1']) # if (not os.path.exists(ms_split)) and (cfg['split']['startchan'] or cfg['split']['nchan']):
ms_split = split_ms(msin, msout_path=dical0, **cfg['split'])
if not os.path.exists(img0 +'-image.fits') and (not os.path.exists(img0 +'-MFS-image.fits')): if not os.path.exists(img0 +'-image.fits') and (not os.path.exists(img0 +'-MFS-image.fits')):
img_max = get_image_max(dical0) img_max = get_image_max(dical0)
...@@ -533,13 +538,13 @@ if __name__ == "__main__": ...@@ -533,13 +538,13 @@ if __name__ == "__main__":
parser.add_argument('-c', '--config', action='store', parser.add_argument('-c', '--config', action='store',
dest='configfile', help='Config file', type=str) dest='configfile', help='Config file', type=str)
parser.add_argument('-o', '--outbase', default=None, help='output prefix', type=str) parser.add_argument('-o', '--outbase', default=None, help='output prefix', type=str)
parser.add_argument('-s', '--steps', default='all', help='steps to run', type=str)
args = parser.parse_args() args = parser.parse_args()
configfile = args.configfile or \ configfile = args.configfile or \
os.path.join(os.path.dirname(os.path.realpath(__file__)), 'imcal.yml') os.path.join(os.path.dirname(os.path.realpath(__file__)), 'imcal.yml')
msin = args.msin # msin = args.msin
logging.info('Using config file: {}'.format(os.path.abspath(configfile))) main(args.msin, outbase=args.outbase, steps=args.steps, cfgfile=configfile)
main(msin, outbase=args.outbase, cfgfile=configfile)
extime = Time.now() - t0 extime = Time.now() - t0
print("Execution time: {:.1f} min".format(extime.to("minute").value)) print("Execution time: {:.1f} min".format(extime.to("minute").value))
#:=========================================================================== #:===========================================================================
# Settings for imcal # Settings for imcal
#:=========================================================================== #:===========================================================================
#global: # provide executables here global: # provide executables here
# dppp_bin: 'DPPP' singularity_image_path: $HOME/lofar-pipeline.sif # leave empty to not use the singularity image
# wsclean_bin: 'wsclean' dppp_bin: 'DP3'
# makesourcedb_bin: 'makesourcedb' wsclean_bin: 'wsclean'
# bbs2model_bin: 'bbs2model' makesourcedb_bin: 'makesourcedb'
# render_bin: 'render' bbs2model_bin: 'bbs2model'
render_bin: 'render'
####################### IMAGING #######################
steps: 'all' # or list, e.g. ['clean1',[]], etc...
split1:
############################## SPLIT ##########################################
split:
startchan: 0 # start channel to split from startchan: 0 # start channel to split from
nchan: 0 # 0 means till the end nchan: 0 # 0 means till the end
nvssCal: # DPPP setup for direction independent calibration ####################### NVSS calibration ######################################
nvss: False
# calibrate against the NVSS catalog. Generally works well
# except for cases with and extended Apertif source unresolved by NVSS
nvssCal:
solint: 60 solint: 60
mode: 'phaseonly' mode: 'phaseonly'
uvlambdamin: 500 # Ignore baselines / channels with UV < uvlambdamin wavele$ uvlambdamin: 500 # Ignore baselines / channels with UV < uvlambdamin wavele$
nvss: ############################## MASK ##########################################
doit : False
clean0: # initial clean clean0: # initial clean
max_over_thresh: 250 # the threshold for initial CLEAN is set to image_max/max_over_thresh max_over_thresh: 250 # the threshold for initial CLEAN is set to image_max/max_over_thresh
# TODO add fixed threshold of 100 uJy # TODO add fixed threshold of 100 uJy
############################## SPLIT ##########################################
clean1: # wsclean setup clean1: # wsclean setup
imagesize: 3072 imagesize: 3072
pixelsize: 3 pixelsize: 3
...@@ -111,7 +116,7 @@ clean5: ...@@ -111,7 +116,7 @@ clean5:
pixelsize: 3 pixelsize: 3
multifreq: 6 multifreq: 6
automask: 3.5 automask: 3.5
autothresh: 1.0 autothresh: 0.5
multiscale: True multiscale: True
clip_model_level: null clip_model_level: null
kwstring: '-use-wgridder -parallel-deconvolution 1400 -parallel-gridding 8 -deconvolution-channels 3 -weight briggs -1.5' kwstring: '-use-wgridder -parallel-deconvolution 1400 -parallel-gridding 8 -deconvolution-channels 3 -weight briggs -1.5'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment