Skip to content

Commit 234e7fa

Browse files
committed
Bugfixed that showed up at the first test
1 parent 0746708 commit 234e7fa

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

factor/scripts/pre_average_multi.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ def BLavg_multi(sorted_ms_dict, baseline_dict, input_colname, output_colname, io
255255
else:
256256
newgroup.append(sorted_ms_dict['msnames'][msindex])
257257

258+
print "BLavg_multi: Working on",len(ms_groups),"groups of measurement sets."
258259
#### loop over all groups
259260
msindex = 0
260261
for ms_names in ms_groups:
@@ -304,16 +305,16 @@ def BLavg_multi(sorted_ms_dict, baseline_dict, input_colname, output_colname, io
304305
sys.exit(1)
305306

306307
### iteration on baseline combination
307-
for ant in itertools.product(set(ant1), set(ant2)):
308+
for ant in itertools.product(set(ant1_list[0]), set(ant2_list[0])):
308309
if ant[0] >= ant[1]:
309310
continue
310311
sel_list = []
311312
weights_list = []
312313
data_list = []
313314
# select data from all MSs
314315
for msindex in xrange(len(ms_names)):
315-
sel1 = np.where(ant1 == ant[0])[0]
316-
sel2 = np.where(ant2 == ant[1])[0]
316+
sel1 = np.where(ant1_list[msindex] == ant[0])[0]
317+
sel2 = np.where(ant2_list[msindex] == ant[1])[0]
317318
sel_list.append( sorted(list(frozenset(sel1).intersection(sel2))) )
318319

319320
# # get weights and data
@@ -327,14 +328,13 @@ def BLavg_multi(sorted_ms_dict, baseline_dict, input_colname, output_colname, io
327328
endidx = [data.shape[0]]
328329
for msindex in xrange(1,len(ms_names)):
329330
#pad gap between obs
330-
numfill = np.max(all_time_list[msindex-1]) - np.min(all_time_list[msindex])
331-
filltimes = np.arange(np.min(all_time_list[msindex]),np.max(all_time_list[msindex-1]),timepersample)
331+
filltimes = np.arange(np.max(all_time_list[msindex-1]),np.min(all_time_list[msindex]),timepersample)
332332
fillshape[0] = len(filltimes)
333-
data.concatenate( (data,np.zeros(fillshape)) )
334-
weights.concatenate( (weights,np.zeros(fillshape)) )
333+
data = np.concatenate( (data,np.zeros(fillshape)), axis=0 )
334+
weights = np.concatenate( (weights,np.zeros(fillshape)), axis=0 )
335335
startidx.append(data.shape[0])
336-
data.concatenate( (data,all_data_list[msindex][sel_list[msindex],:,:]) )
337-
weights.concatenate( (weights,all_weights_list[msindex][sel_list[msindex],:,:]) )
336+
data = np.concatenate( (data,all_data_list[msindex][sel_list[msindex],:,:]), axis=0 )
337+
weights = np.concatenate( (weights,all_weights_list[msindex][sel_list[msindex],:,:]), axis=0 )
338338
endidx.append(data.shape[0])
339339

340340
# compute the FWHM
@@ -376,7 +376,7 @@ def BLavg_multi(sorted_ms_dict, baseline_dict, input_colname, output_colname, io
376376
ms.putcol('FLAG', all_flags_list[msindex]) # this saves flags of nans, which is always good
377377
ms.putcol('WEIGHT_SPECTRUM', all_weights_list[msindex])
378378
ms.close()
379-
print "Finished one group of measurement sets."
379+
print "BLavg_multi: Finished one group of measurement sets."
380380

381381

382382
def smooth(x, window_len=10, window='hanning'):

0 commit comments

Comments
 (0)