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

fix: lstcal with multiple bands #958

Merged
merged 4 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion hera_cal/lst_stack/averaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,6 @@ def average_and_inpaint_simultaneously_single_bl(
CNinv_data_dpss = np.array([
basis.T.dot(weighted_data) for weighted_data in mask[:, band] / noise_var[:, band] * stackd[:, band]
])
print(CNinv_data_dpss.shape, CNinv_data_dpss.shape)
dpss_fits = np.array([
a.dot(b) if np.all(np.isfinite(b)) else a.dot(np.zeros_like(b))
for a, b in zip(CNinv_dpss_inv, CNinv_data_dpss)
Expand Down
25 changes: 11 additions & 14 deletions hera_cal/lst_stack/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,38 +106,35 @@ def _expand_degeneracies_to_ant_gains(
if split_pol1 != split_pol2:
continue
for ant in gain_ants:
for bandidx, band in enumerate(inpaint_bands):
raw_ant_gain = amplitude_parameters[f"A_{split_pol1}"] * (
phase_gains.get(
(ant, split_pol1),
np.ones_like(amplitude_parameters[f"A_{split_pol1}"]),
)
)
raw_ant_gain = amplitude_parameters[f"A_{split_pol1}"] * (
phase_gains.get((ant, split_pol1), 1)
)
gg = gains[(ant, split_pol1)] = raw_ant_gain

if smooth_gains:
for bandidx, band in enumerate(inpaint_bands):

if smooth_gains:
# Rephase antenna gains
tau, _ = utils.fft_dly(
raw_ant_gain,
raw_ant_gain[:, band],
np.diff(stack.freq_array[band])[0],
wgts=np.logical_not(stack.flags[:, 0, band, polidx]),
)
rephasor = np.exp(-2.0j * np.pi * tau * stack.freq_array[band])
raw_ant_gain *= rephasor
raw_ant_gain[:, band] *= rephasor

basis = smoothing_functions[bandidx]
smooth_ant_gain = np.array(
[
np.dot(basis, _fmat.dot(_raw_gain))
for _fmat, _raw_gain in zip(
fmats[split_pol1][bandidx], raw_ant_gain
fmats[split_pol1][bandidx], raw_ant_gain[:, band]
)
]
)

# Rephase antenna gains
gains[(ant, split_pol1)] = smooth_ant_gain * rephasor.conj()
else:
gains[(ant, split_pol1)] = raw_ant_gain
gg[:, band] = smooth_ant_gain * rephasor.conj()

return gains

Expand Down
Loading