Skip to content

Commit

Permalink
Hermitian pinv in simultaneous inpainting
Browse files Browse the repository at this point in the history
I've noticed some instances of pinvs not working because an SVD doesn't converge, but adding this option seems to avoid that (not sure why). It's also supposed to be slightly faster!
  • Loading branch information
jsdillon committed Jan 9, 2025
1 parent fe6902c commit 6814a27
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hera_cal/lst_stack/averaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ def average_and_inpaint_simultaneously_single_bl(
/ base_noise_var[night_index, band],
basis,
)
_CNinv_1sample_dpss_inv = np.linalg.pinv(_CNinv_1sample_dpss)
_CNinv_1sample_dpss_inv = np.linalg.pinv(_CNinv_1sample_dpss, hermitian=True)
CNinv_1sample_dpss.append(_CNinv_1sample_dpss)
CNinv_1sample_dpss_inv.append(_CNinv_1sample_dpss_inv)
cache[hash_key] = (_CNinv_1sample_dpss, _CNinv_1sample_dpss_inv)
Expand Down Expand Up @@ -542,7 +542,7 @@ def average_and_inpaint_simultaneously_single_bl(
is_unflagged_night = ~np.all(stackf[:, band], axis=1)

# Compute weighted sample mean from per-day DPSS-fits and noise-weighted covariance matrix
inv_sum_CNinv_dpss = np.linalg.pinv(sum_CNinv_dpss)
inv_sum_CNinv_dpss = np.linalg.pinv(sum_CNinv_dpss, hermitian=True)
sample_mean_dpss = inv_sum_CNinv_dpss @ np.einsum(
"nde,nd->e", CNinv_dpss[is_unflagged_night], dpss_fits[is_unflagged_night]
)
Expand Down

0 comments on commit 6814a27

Please sign in to comment.