-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcalc-psf.py
50 lines (41 loc) · 1.47 KB
/
calc-psf.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from tasks import *
from taskinit import *
import casac
import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as mpl
import pylab as pl
global deg2rad
deg2rad = pl.pi/180.;
import blib
reload(blib)
import sys
from optparse import OptionParser
usage = "usage: %prog options"
parser = OptionParser(usage=usage);
# O1 for Option
parser.add_option("--ms", type = 'string', dest = 'ms', default=None,
help = 'Name of MS [None]');
parser.add_option("--uvrange", type = 'string', dest = 'uvrange', default=None,
help = 'uvrange [None]');
parser.add_option("--weight", type = 'string', dest = 'weight', default=None,
help = 'weight [None]');
parser.add_option("--nxy", type = 'int', dest = 'nxy', default=512,
help = 'Number of pixels in each direction [512]');
parser.add_option('--cell', type='string', dest='cell', default='1arcsec',
help = 'Pixel Size [1arcsec]');
parser.add_option('--robust', type='float', dest='robust', default=0.0,
help = 'Robust value If weight=\'briggs\' [0.0]');
parser.add_option("-o", type = 'string', dest = 'o', default=512,
help = 'Number of pixels in each direction [512]');
(options, args) = parser.parse_args();
if len(sys.argv)==1:
parser.print_help();
dummy = sys.exit(0);
im.open(options.ms);
im.defineimage(nx = options.nxy, cellx = options.cell, celly = options.cell);
im.selectvis(uvrange=options.uvrange);
im.weight(type=options.weight, robust=options.robust);
im.approximatepsf(options.o);
im.close()
im.done();