Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 14, 2025
1 parent b60325d commit 81e2433
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion hera_filters/dspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -2992,7 +2992,7 @@ def sparse_linear_fit_2D(
axis_1_pcond = np.linalg.pinv(
XTX_axis_1 + np.eye(XTX_axis_1.shape[0]) * axis_1_lambda
)

# Compute the preconditioner for the second axis
XTX_axis_2 = np.dot(axis_2_basis.T.conj() * axis_2_wgts, axis_2_basis)
eigenval, _ = np.linalg.eig(XTX_axis_2)
Expand Down
4 changes: 2 additions & 2 deletions hera_filters/tests/test_dspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,7 @@ def test_precondition_sparse_solver():
axis_1_weights = (~time_flags[:, 0]).astype(float) * rng.integers(1, 10, size=(ntimes,))
axis_2_weights = (~freq_flags[0]).astype(float)
wgts = np.outer(axis_1_weights, axis_2_weights)

# Add frequency dependence to the weights to make the problem more ill-conditioned
wgts *= (freqs / 150e6) ** -3.5

Expand Down Expand Up @@ -1589,4 +1589,4 @@ def test_precondition_sparse_solver():
# Check that the fit closely matches to the separable fit
np.testing.assert_allclose(sol, sol_sparse, atol=1e-8, rtol=1e-6)
np.testing.assert_allclose(sol, sol_sparse_precond, atol=1e-8, rtol=1e-6)
np.testing.assert_array_less(meta_precond['iter_num'], meta['iter_num'])
np.testing.assert_array_less(meta_precond['iter_num'], meta['iter_num'])

0 comments on commit 81e2433

Please sign in to comment.