Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ss/daily filter #88

Merged
merged 4 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ch_util/cal_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1998,7 +1998,7 @@ def guess_fwhm(freq, pol="X", dec=None, sigma=False, voltage=False, seconds=Fals

# Divide by declination to convert to degrees hour angle
if dec is not None:
sig /= np.cos(dec)
sig = sig / np.cos(dec)

# If requested, convert to seconds
if seconds:
Expand Down Expand Up @@ -2365,7 +2365,7 @@ def interpolate_gain(freq, gain, weight, flag=None, length_scale=30.0):
train = np.flatnonzero(flag[:, ii])
test = np.flatnonzero(~flag[:, ii])

if train.size > 0:
if (train.size > 0) and (test.size > 0):
xtest = x[test, :]

xtrain = x[train, :]
Expand Down
12 changes: 7 additions & 5 deletions ch_util/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2061,17 +2061,19 @@ def fast_pack_product_array(arr):
more general.
"""

assert arr.ndim == 2
assert arr.shape[0] == arr.shape[1]
assert arr.ndim >= 2
ssiegelx marked this conversation as resolved.
Show resolved Hide resolved
assert arr.shape[-1] == arr.shape[-2]

nfeed = arr.shape[0]
nfeed = arr.shape[-1]
nprod = (nfeed * (nfeed + 1)) // 2

ret = np.zeros(nprod, dtype=np.float64)
shp = arr.shape[:-2] + (nprod,)

ret = np.zeros(shp, dtype=arr.dtype)
iout = 0

for i in range(nfeed):
ret[iout : (iout + nfeed - i)] = arr[i, i:]
ret[..., iout : (iout + nfeed - i)] = arr[..., i, i:]
iout += nfeed - i

return ret
Expand Down