예제 #1
0
def _run(msname='$MS',clean=False,path='${im.WSCLEAN_PATH}',**kw):
    """ Run WSCLEAN """
    msname,path = interpolate_locals('msname path')
    path = argo.findImager(path,imager_name='WSCLEAN')
    if path is False:
        abort('Could not find WSCLEAN in system path, alises or at $path')

    # make dict of imager arguments that have been specified globally or locally
    args = dict([ (arg,globals()[arg.replace("-","_")]) for arg in _wsclean_args 
                    if arg.replace("-","_") in globals() and globals()[arg.replace("-","_")] is not None ]);
    args.update([ (arg,kw[arg]) for arg in _wsclean_args if arg in kw ])

    # map image size/resolution parameters
    csz = kw.get('cellsize',cellsize)
    np = kw.get('npix',npix)
    args['scale'] = csz if isinstance(csz,(int,float)) else argo.toDeg(csz)
    args['size']= '%d %d'%(np,np)

    # map weight parameters
    wgt = args['weight'];
    if wgt == "robust" or wgt == "briggs":
        args['weight'] = 'briggs %.2f'%(kw.get('robust',robust))

    # map threshold
    if isinstance(args['threshold'],str):
        args['threshold'] = im.argo.toJy(args['threshold'])
    
    # map clean parameter
    if not clean:
        args['niter'] = 0

    ms.FIELD is not None and args.setdefault('field',ms.FIELD)
    x.sh(argo.gen_run_cmd(path,args,suf='-',assign=' ',pos_args=[msname] if not isinstance(msname,(list,tuple)) else msname))
예제 #2
0
def deconv(dirty_image,
           psf_image,
           model_image='${im.MODEL_IMAGE}',
           residual_image='${im.RESIDUAL_IMAGE}',
           restored_image='${im.RESTORED_IMAGE}',
           image_prefix='${im.BASENAME_IMAGE}',
           path='$MORESANE_PATH',
           **kw):
    """ Runs PyMORESANE """

    # Check if PyMORESANE is where it is said to be
    model_image, residual_image, restored_image, path = interpolate_locals(
        'model_image residual_image restored_image path')
    found_path = argo.findImager(path, imager_name='PyMORESANE')
    if not found_path:
        abort('could not find PyMORESANE at $path')

    kw['modelname'] = model_image
    kw['residualname'] = residual_image
    kw['restoredname'] = restored_image

    # make dict of imager arguments that have been specified globally or locally
    args = dict([(arg, globals()[arg]) for arg in _moresane_args
                 if arg in globals() and globals()[arg] is not None])
    args.update([(arg, kw[arg]) for arg in _moresane_args if arg in kw])

    x.sh(
        argo.gen_run_cmd(path,
                         args,
                         suf='--',
                         assign='=',
                         pos_args=[dirty_image, psf_image, image_prefix]))
예제 #3
0
파일: moresane.py 프로젝트: SpheMakh/pyxis
def deconv(dirty_image,psf_image,
                 model_image='${im.MODEL_IMAGE}',
                 residual_image='${im.RESIDUAL_IMAGE}',
                 restored_image='${im.RESTORED_IMAGE}',
                 image_prefix='${im.BASENAME_IMAGE}',
                 path='$MORESANE_PATH',**kw):
    """ Runs PyMORESANE """

    # Check if PyMORESANE is where it is said to be
    model_image,residual_image,restored_image,path = interpolate_locals('model_image residual_image restored_image path')
    found_path = argo.findImager(path,imager_name='PyMORESANE') 
    if not found_path:
        abort('could not find PyMORESANE at $path')
   
    kw['modelname'] = model_image
    kw['residualname'] = residual_image
    kw['restoredname'] = restored_image
    
    # make dict of imager arguments that have been specified globally or locally
    args = dict([ (arg,globals()[arg]) for arg in _moresane_args if arg in globals() and globals()[arg] is not None ]);
    args.update([ (arg,kw[arg]) for arg in _moresane_args if arg in kw ])

    x.sh(argo.gen_run_cmd(path,args,suf='--',assign='=',pos_args=[dirty_image,psf_image,image_prefix]))