def process_ms(msname, outfn): station_map = utils.get_station_map(msname) station_names = sorted(station_map.keys()) stations2 = sorted(map(station_map.get, station_names)) ref_station_name = '1' # ANTENNA table has ID, Name and 'Station' fields'; here we want the last of these ref_station2 = station_map[ref_station_name] ref_s_ind2 = stations2.index(ref_station2) swid, pol_id, polind, = (0, 0, 0) for timeq in timeqs: delays, phases, rates, sigs = [], [], [], [] for pol_id in [0,3]: dels, phs, rs, sig = fringer.fit_fringe_lm(msname, stations2, ref_s_ind2, swid, polind, pol_id, timeq, solint=300) delays.append(dels) phases.append(phs) rates.append(rs) sigs.append(sig) outf = file(outfn, 'w') print >>outf, "#\n#{}\n#".format(timeq) utils.print_res(station_map, stations2, phases, delays, rates, sigs=sigs, outf=outf)
stations2 = [0, 1, 2, 3, 4, 5, 6, 7, 9, 10] ref_station_name = myrefant # '1' is Effelsberg ref_station2 = station_map[ref_station_name] ref_s_ind2 = stations2.index(ref_station2) swid, polind, = (0, 0) #stations2 = [0,1,2,3,4,5,6,7,9,10] stations2 = [0, 1, 2, 3, 4, 5, 6, 7, 9, 10] for timeq, swid in itertools.product(timeqs, range(4)): timeq2 = ffd.actual_timerangeq(msname, timeq) delays, phases, rates, sigs = [], [], [], [] for pol_id in [0, 3]: print "# Doing a thing", swid, pol_id dels, phs, rs, sig = fringer.fit_fringe_lm(msname, stations2, ref_s_ind2, swid, polind, pol_id, timeq2, solint=mysolint, threshold=1000) delays.append(dels) phases.append(phs) rates.append(rs) sigs.append(sig) print "#\n#{}\n# IF {}\n#".format(timeq, swid + 1) utils.print_res(station_map, stations2, phases, delays, rates)
station_map = utils.get_station_map(msname) station_names = sorted(station_map.keys()) stations2 = sorted(map(station_map.get, station_names)) # station 8 missing; stations2 = [0, 1, 2, 3, 4, 5, 6, 7, 9, 10] #ref_station_name = '1' # Effelsberg ref_station_name = '3' ref_station2 = station_map[ref_station_name] ref_s_ind2 = stations2.index(ref_station2) swid, pol_id, polind, = (0, 0, 0) for timeq, swid in itertools.product(timeqs[:1], range(4)[:1]): timeq2 = ffd.actual_timerangeq(msname, timeq) delays, phases, rates, sigs = [], [], [], [] for pol_id in [0,3]: dels, phs, rs, sig = fringer.fit_fringe_lm(msname, stations2, ref_s_ind2, swid, polind, pol_id, timeq2, solint=300) delays.append(dels) phases.append(phs) rates.append(rs) sigs.append(sig) print "#\n#{}, IF={}\n#".format(timeq, swid) utils.print_res(station_map, stations2, delays, rates) # for pol r, presumably. aips_phases = [-1.52, -1.65, 0.0, -0.31, -2.78, 1.71, -2.05, 0.85, 0.24, 0.99]
ref_station2 = station_map[ref_station_name] ref_s_ind2 = stations2.index(ref_station2) polind = 0 swids = range(8) shape = (2, len(stations2), len(swids)) delays = np.zeros(shape, np.float, order='F') # Looks like we don't need 'F'. phases = np.zeros(shape, np.float, order='F') rates = np.zeros(shape, np.float, order='F') sigs = [] for timeq, swid in itertools.product(timeqs, swids): casalog.post("doing a thing {}".format(swid)) timeq2 = ffd.actual_timerangeq(msname, timeq) for pol_id in [0,1]: dels, phs, rs, sig = fringer.fit_fringe_lm(msname, stations2, ref_s_ind2, swid, polind, pol_id, timeq2, datacol="CORRECTED_DATA", solint=300, threshold=1000) delays[pol_id, :, swid] = dels phases[pol_id, :, swid] = phs rates[pol_id, :, swid] = rs sigs.append(sig) print "#\n#{}, IF={}\n#".format(timeq, swid) # utils.print_res(station_map, stations2, delays, rates) stationt = ",".join(map(str, stations2)) spwt = ",".join(map(str, swids)) darr = -delays*1e9 pharr = -180*phases/np.pi
all_rates = [] for timeq, swid in itertools.product(timeqs, swids): # ref_station = utils.station_by_name(msname, ref_station_name) # stations2 = utils.get_stations(msname, timeq) ref_station = 1 # stations2 = [0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11] stations2 = [1, 2, 3, 4, 5, 6, 8, 9, 10, 11] delays, phases, rates, sigs = [], [], [], [] for pol_id in [0, 3]: dels, phs, rs, sig = fringer.fit_fringe_lm(msname, stations2, ref_station, swid, polind, pol_id, timeq, solint=solint, datacol="CORRECTED_DATA", threshold=threshold, ref_weights=True) delays.append(dels) phases.append(phs) rates.append(rs) sigs.append(sig) all_delays.append(delays) all_phases.append(phases) all_rates.append(rates) print "#\n#{}, IF={}\n#".format(timeq, swid) station_map = utils.get_station_map(msname) utils.print_res(station_map, stations2, phases, delays, rates)