示例#1
0
def split(uvo, uvc, so, lines=[]):
    """ Split in different files LL and RR """
    stks = ['ll', 'rr', 'lr', 'rl']
    for stk in stks:
        for lin in lines:
            path = '{}/{}.{}.{}'.format(uvc, so, lin, stk)
            if os.path.exists(path): shutil.rmtree(path)

            miriad.uvaver({
                'vis': '{}/{}.{}'.format(uvo, so, lin),
                'out': '{}/{}.{}.{}'.format(uvc, so, lin, stk),
                'select': 'pol({})'.format(stk)
            })
示例#2
0
文件: squint.py 项目: mef51/smautils
def split(uvo, uvc, so, lines=[]):
    """ Split in different files LL and RR """
    from subprocess import CalledProcessError
    stks = ['ll', 'rr', 'lr', 'rl']
    for stk in stks:
        for lin in lines:
            path = '{}/{}.{}.{}'.format(uvc, so, lin, stk)
            if os.path.exists(path): shutil.rmtree(path)

            try:
                miriad.uvaver({
                    'vis': '{}/{}.{}'.format(uvo, so, lin),
                    'out': '{}/{}.{}.{}'.format(uvc, so, lin, stk),
                    'select': 'pol({})'.format(stk)
                })
            except CalledProcessError:
                print("### Retrying with stokes selection instead")
                miriad.uvaver({
                    'vis': '{}/{}.{}'.format(uvo, so, lin),
                    'out': '{}/{}.{}.{}'.format(uvc, so, lin, stk),
                    'stokes': stk
                })
示例#3
0
sb = 'usb'
numChannels = miriad.getNumChannels('{}.{}'.format(vis, sb))
ch = miriad.averageVelocityLine('{}.{}'.format(vis, sb), 5)

freq = 345.8
lab = 'cnt.usb'
free = '6,107,275,478,500,725,762,815,833,1096,1109,1351,1366,1531'

path = '{}.{}'.format(vis, lab)
if os.path.exists(path): shutil.rmtree(path)
for path in glob.glob('tmp.*'):
    if os.path.exists(path): shutil.rmtree(path)

print("Starting with:", vis + '.' + sb)

miriad.uvaver({'vis': '{}.{}'.format(vis, sb), 'out': 'tmp.1'})
miriad.uvputhd({
    'vis': 'tmp.1',
    'out': 'tmp.2',
    'hdvar': 'restfreq',
    'varval': freq
})
miriad.uvredo({'vis': 'tmp.2', 'out': 'tmp.3', 'options': 'velocity'})

# this is because we average 5 velocity channels into 1
miriad.uvflag({'vis': 'tmp.3', 'flagval': 'f', 'edge': '5,5'})
miriad.uvaver({'vis': 'tmp.3', 'out': 'tmp.4', 'line': ch})
miriad.uvlist({'vis': 'tmp.3', 'options': 'spec'})
miriad.uvlist({'vis': 'tmp.4', 'options': 'spec'})

miriad.smauvspec({
示例#4
0
#!/usr/bin/python3

import shutil, glob, os
import miriad

# GETSTOKES:

so="smc.8"

visin = combined.usb.
stokesout = '{}.stokes'.format(so)

if os.path.exists(stokesout): shutil.rmtree(stokesout)
miriad.uvaver({
	'vis': visin,
	'out': stokesout,
	'select': 'so({})'.format(so),
	'interval': 5
})

print("Made:", stokesout)
示例#5
0
    win = '23'
    sb = 'usb'
    freq = 347.3306
    lab = 'sio8-7'
    free = '74,124'

vis = 'UVDATA/{}'.format(so)
path = '{}.{}'.format(vis, lab)
if os.path.exists(path): shutil.rmtree(path)
for path in glob.glob('tmp.*'):
    if os.path.exists(path): shutil.rmtree(path)

print("Starting with:", vis + '.' + sb)
miriad.uvaver({
    'vis': '{}.{}'.format(vis, sb),
    'out': 'tmp.1',
    'select': 'win({})'.format(win),
})

miriad.uvputhd({
    'vis': 'tmp.1',
    'out': 'tmp.2',
    'hdvar': 'restfreq',
    'varval': freq
})

miriad.uvredo({'vis': 'tmp.2', 'out': 'tmp.3', 'options': 'velocity'})

miriad.uvlist({'vis': 'tmp.3', 'options': 'spec'})

miriad.smauvspec({
示例#6
0
def selfcal(so, uvc, lines=[]):
    """
	Original map used for selfcal in MAPS
	Independent step for RR and LL (u,v) files
	1. Selcalibration of continuum
	2. Applying selfcalibration  for continuum
	3. Copyinggains to Line data (all in the USB)
	4. Applying selfcalibration  for lines
	5. Concanate LL and RR in ine file
	6. Resort data

	lines: ex. ['co3-2', 'sio8-7', 'cnt.usb', 'usb']
	"""
    calibrator = 'cnt.usb'
    for stk in ['ll', 'rr']:
        for sb in [calibrator]:
            miriad.selfcal({
                'vis': '{}/{}.{}.{}'.format(uvc, so, sb, stk),
                'model': 'MAPS/{}.cont.usb.i.cc'.format(so),
                'refant': 6,
                'interval': 8,
                'options': 'phase'
            })
            miriad.gpplt({
                'vis': '{}/{}.{}.{}'.format(uvc, so, sb, stk),
                'device': '1/xs',
                'yaxis': 'phase',
                'nxy': '1,3'
            })
            input("Press enter to continue...")

            path = '{}/{}.{}.{}.slfc'.format(uvc, so, sb, stk)
            if os.path.exists(path): shutil.rmtree(path)

            miriad.uvaver({
                'vis': '{}/{}.{}.{}'.format(uvc, so, sb, stk),
                'out': '{}/{}.{}.{}.slfc'.format(uvc, so, sb, stk)
            })
        for lin in [l for l in lines if l != calibrator
                    ]:  # iterate over lines excluding the calibrator
            path = '{}/{}.{}.{}.slfc'.format(uvc, so, lin, stk)
            if os.path.exists(path): shutil.rmtree(path)

            miriad.gpcopy({
                'vis': '{}/{}.cnt.usb.{}'.format(uvc, so, stk),
                'out': '{}/{}.{}.{}'.format(uvc, so, lin, stk),
            })
            miriad.uvaver({
                'vis': '{}/{}.{}.{}'.format(uvc, so, lin, stk),
                'out': '{}/{}.{}.{}.slfc'.format(uvc, so, lin, stk),
            })

    for lin in lines:
        vis = '{}/{}.{}'.format(uvc, so, lin)
        for folder in [
                'tmp.5', 'tmp.6',
                '{}/{}.{}.corrected.slfc'.format(uvc, so, lin)
        ]:
            if os.path.exists(folder): shutil.rmtree(folder)

        miriad.uvcat({
            'vis': '{0}.rr.slfc,{0}.ll.slfc,{0}.rl,{0}.lr'.format(vis),
            'out': 'tmp.5',
        })
        miriad.uvsort({
            'vis': 'tmp.5',
            'out': 'tmp.6',
        })
        miriad.uvaver({
            'vis': 'tmp.6',
            'out': '{}/{}.{}.corrected.slfc'.format(uvc, so, lin),
            'interval': 5
        })