Exemple #1
0
      for all chunks:
	load chunk from disk (buffer the io)
	wait for any previous gridding operations to finish up
	deep copy chunk
	call the correct gridding method (single / duel / quad with corrections) to operate on the
	in parallel start up the gridder
	if last chunk then normalize else continue on to start buffering the next chunk
      #end for chunks
    #end for ms
    compact and finalize grids
    write out to disk (either png or FITS)
    optionally stitch together using montage
  '''
  for ms_index,ms in enumerate(ms_names):
    print "NOW IMAGING %s" % ms
    data = data_set_loader.data_set_loader(ms,read_jones_terms=parser_args['do_jones_corrections'])
    data.read_head()
    
    '''
    Create convolution filter
    '''
    filter_creation_timer = timer.timer()
    lambda_min = np.min(data._chan_wavelengths)
    #as per Synthesis Imaging II, pg 24. w is maximum at low elevations and when baseline and source vectors have same azimuth (ie. parallel):
    w_max = data._maximum_baseline_length / lambda_min
    print "The maximum w (measured in wavelengths) is estimated to be", w_max  
    with filter_creation_timer:
      conv = convolution_filter.convolution_filter(parser_args['conv_sup'],
						   parser_args['conv_oversamp'],parser_args['conv'],
						   "1D_AA" if parser_args['wplanes'] <= 1 else ("2D_WPROJ" if parser_args['use_back_end'] == 'CPU' else "1D_WPROJ"),parser_args['wplanes'],
						   parser_args['npix_l'],parser_args['npix_m'],
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
'''

import argparse
import numpy as np
import pylab
import math
from pyrap.tables import *
from helpers import data_set_loader
if __name__ == "__main__":
	parser = argparse.ArgumentParser(description="A small utility to write out a set of jones matricies to a new casa table")
	parser.add_argument("input_ms", help="Name of MS to modify", type=str)
	parser.add_argument("no_direction", help="Name of model FITS image",type=int)
	parser_args = vars(parser.parse_args())
	data = data_set_loader.data_set_loader(parser_args['input_ms'])
	data.read_head()
	assert(data._no_polarization_correlations == 4)
	#compute set of timestamp indicies:
	casa_ms_table = table(parser_args['input_ms'],ack=False,readonly=False)
	time_window_centre = casa_ms_table.getcol("TIME")
	time_indicies = np.zeros(casa_ms_table.nrows(),dtype=np.intp)
	
	timestamp_index = 0
	last_timestamp_time = time_window_centre[0]
	print "FOUND %d ROWS IN MAIN TABLE" % casa_ms_table.nrows()
	for r in range(0,casa_ms_table.nrows()):
	  current_time = time_window_centre[r]
	  if current_time > last_timestamp_time:
	    timestamp_index+=1
	    last_timestamp_time = current_time