Skip to content

Commit b0b47ef

Browse files
committed
use circular average instead
1 parent 6b183b7 commit b0b47ef

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

hera_pspec/grouping.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,9 +529,9 @@ def average_spectra(uvp_in, blpair_groups=None, time_avg=False,
529529
time_2.extend([np.mean(uvp.time_2_array[blpairts])])
530530
time_avg_arr.extend([np.mean(uvp.time_avg_array[blpairts])])
531531
# Use circular mean to properly handle 2pi wrapping
532-
lst_1.extend([np.angle(np.mean(np.exp(1j * uvp.lst_1_array[blpairts]))) % (2*np.pi)])
533-
lst_2.extend([np.angle(np.mean(np.exp(1j * uvp.lst_2_array[blpairts]))) % (2*np.pi)])
534-
lst_avg_arr.extend([np.angle(np.mean(np.exp(1j * uvp.lst_avg_array[blpairts]))) % (2*np.pi)])
532+
lst_1.extend([utils.circular_average(uvp.lst_1_array[blpairts])])
533+
lst_2.extend([utils.circular_average(uvp.lst_2_array[blpairts])])
534+
lst_avg_arr.extend([utils.circular_average(uvp.lst_avg_array[blpairts])])
535535
else:
536536
blpair_arr.extend(np.ones_like(blpairts, int) * blpg[0])
537537
time_1.extend(uvp.time_1_array[blpairts])

hera_pspec/pspecdata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3491,7 +3491,7 @@ def pspec(self, bls1, bls2, dsets, pols, n_dlys=None,
34913491
uvp.lst_2_array = np.array(lst2)
34923492
# Use circular mean to properly handle 2pi wrapping
34933493
angles = np.array([uvp.lst_1_array, uvp.lst_2_array])
3494-
uvp.lst_avg_array = np.angle(np.mean(np.exp(1j * angles), axis=0)) % (2*np.pi)
3494+
uvp.lst_avg_array = utils.circular_average(angles, axis=0)
34953495
uvp.blpair_array = np.array(blp_arr)
34963496
uvp.Nblpairs = len(np.unique(blp_arr))
34973497
# Ntimes in a uvpspec object now means the total number of times.

0 commit comments

Comments
 (0)