-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyxis-bd-averaging.py
58 lines (53 loc) · 1.84 KB
/
pyxis-bd-averaging.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
51
52
53
54
55
56
57
58
"""
Module import here
"""
import os
#import MSResampler_copy
#import sys
import MSResampler
import Pyxis
#from Pyxis.ModSupport import *
#import mqt
import pyrap.tables
from pyrap.tables import table
import numpy as np
#import ms
import imager
#import scipy.special
#import pylab
#import pyfits
#import Tigger
def simulate_imaging_bd_3c147 (hiresms=None, loresms=None, inputcolumn="DATA", outputcolumn="CORRECTED_DATA", dtime=None, dfreq=None):
"""
The function make use of baseline dependent averaging on the 3C147 real data observed on the
2013/01/27/01:00:28.5, at declination 49.51.07.23356, ra 05:42:36.137916
NB: We have removed the fictive baseline of index 7
"""
# make an instance of the class containing the method for bd-averaging
mshi = MSResampler.MSResampler(hiresms+"/", column=inputcolumn)
# BD-averaging, giving the integration time of the shortest baseline, dtime and
# the number of uv-frequency bins dfreq to average
psh=2
qsh=8
arrays = mshi.bd_averaging (dtime,dfreq,psh,qsh)
# arrays is of size (p,q,datacom,flagrowpq,weightpq)
# take the number of time bins of the longest baseline and make low res timeslots
MSResampler.save_visibility_arrays (loresms,arrays,column=outputcolumn)
imager.npix= 2048#1024#2048
imager.cellsize = "2arcsec"
imager.stokes = "I"
imager.weight = "natural"
imager.wprojplanes = 128
#cleaning options
imager.niter = 1000
imager.threshold = "5mJy"
imager.CLEAN_ALGORITHM = "csclean"
imager.make_image(msname = hiresms, column = outputcolumn, restore = True, dirty = False, weight = "natural");
def copy_column_ms(msname=None, inputcolumn='DATA', outputcolumn='CORRECTED_DATA'):
"""
copy column inputcolumn to outputcolumn given the MS
"""
tab = table(msname,readonly=False,ack=False);
dataint = tab.getcol(inputcolumn)
tab.putcol(outputcolumn,dataint.copy())
tab.close()