casalog.post(f"Removing '{path_to_remove}'")
_remove_image(path_to_remove)
assert not os.path.exists(path_to_remove)
# Tweak spw parameter into _spw
_spw = '*' + spw if spw.startswith(':') else spw
_spw = ['*' + v if v.startswith(':') else v for v in spw]
# Compute baseline selection string from antenna
def antenna_to_baseline(s):
elif len(s) > 3 and s.endswith('&&&'):
return '{0}&&&'.format(s)
if isinstance(antenna, str):
baseline = antenna_to_baseline(antenna)
baseline = [antenna_to_baseline(a) for a in antenna]
# Handle image spectral axis parameters
imnchan, imstart, imwidth = _configure_spectral_axis(
mode, nchan, start, width, restfreq
# Handle image restfreq parameter's default value
_restfreq = _get_restfreq_if_empty(
infiles, _spw, field, restfreq
_sorted = old_way.sort_vis(infiles, _spw, mode, imwidth, field,
antenna, scan, intent, timerange)
sorted_field = _sorted[1]
sorted_antenna = _sorted[3]
sorted_intent = _sorted[5]
sorted_timerange = _sorted[6]
def antenna_to_baseline(s):
elif len(s) > 3 and s.endswith('&&&'):
return '{0}&&&'.format(s)
if isinstance(sorted_antenna, str):
sorted_baseline = antenna_to_baseline(sorted_antenna)
sorted_baseline = [antenna_to_baseline(a) for a in sorted_antenna]
# Handle image geometric parameters
ephem_sources = ['MERCURY', 'VENUS', 'MARS', 'JUPITER', 'SATURN',
'URANUS', 'NEPTUNE', 'PLUTO', 'SUN', 'MOON', 'TRACKFIELD']
if isinstance(phasecenter, str) and phasecenter.strip().upper() in ephem_sources:
'MERCURY', 'VENUS', 'MARS', 'JUPITER', 'SATURN',
'URANUS', 'NEPTUNE', 'PLUTO', 'SUN', 'MOON', 'TRACKFIELD'
if isinstance(phasecenter, str) and (
phasecenter.strip().upper() in ephem_sources
_ephemsrcname = phasecenter
_imsize, _cell, _phasecenter = _handle_image_params(
imsize, cell, phasecenter, sorted_vis,
sorted_field, sorted_spw, sorted_antenna,
sorted_scan, sorted_intent, sorted_timerange,
_restfreq, pointingcolumn, _ephemsrcname
# Set up PySynthesisImager input parameters
# - List all parameters that you need here
# - Defaults will be assumed for unspecified parameters
# - Nearly all parameters are identical to that in the task. Please look at the
# list of parameters under __init__ using " help ImagerParameters " )
casalog.post('*** Creating paramList ***', origin=origin)
paramList = ImagerParameters(
msname=sorted_vis, # 'sdimaging.ms',
msname=infiles, # 'sdimaging.ms',
field=sorted_field, # '',
timestr=sorted_timerange,
imagename=output_path_prefix, # 'try2',
phasecenter=_phasecenter, # 'J2000 17:18:29 +59.31.23',
imsize=_imsize, # [75,75],