Skip to content
Open
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: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Performance Improvements
Bug Fixes

- Fixes bug in ``auglag`` optimizers which prevented them from accepting solver hyperparameters.
- Adjusts the `quad_weights` of coil objectives of type `_broadcast_input = "node"` to ensure their outputs are roughly independent of grid resolution.
- Fixes bug in modified Cholesky factorization used by the trust-region
subproblems when the Gershgorin lower bound of the Hessian was exactly zero
(e.g. a Hessian with an all-zero row), producing NaN steps in ``fmintr`` and
Expand Down
8 changes: 5 additions & 3 deletions desc/objectives/_coils.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,11 @@
)

_build_coilset_tree()
quad_weights = np.concatenate([g.spacing[:, 2] for g in grid])[
self._coilset_tree["objective_mask"]
]
quad_weights = np.sqrt(

Check warning on line 223 in desc/objectives/_coils.py

View check run for this annotation

Codecov / codecov/patch

desc/objectives/_coils.py#L223

Added line #L223 was not covered by tests
np.concatenate([g.spacing[:, 2] for g in grid])[
self._coilset_tree["objective_mask"]
]
)

if self._broadcast_input.lower() == "node":
grid_nodes_unmasked = [
Expand Down
3,464 changes: 1,703 additions & 1,761 deletions docs/notebooks/tutorials/coil_stage_two_optimization.ipynb

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion tests/test_objective_funs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3809,11 +3809,15 @@ def test_compute_scalar_resolution_coils(self, objective):
f = np.zeros_like(self.res_array, dtype=float)
for i, res in enumerate(self.res_array):
obj = ObjectiveFunction(
objective(coilset, grid=LinearGrid(N=int(5 + 3 * res))),
objective(coilset, grid=LinearGrid(N=int(5 + 3 * res)), target=1),
Comment thread
singh-jaydeep marked this conversation as resolved.
use_jit=False,
)
obj.build(verbose=0)
f[i] = obj.compute_scalar(obj.x())

# verify obj.compute_scalar is not zero, so the resolution test is meaningful
assert not np.isclose(f[-1], 0, atol=1e-8)

np.testing.assert_allclose(f, f[-1], rtol=1e-2, atol=1e-12)

@pytest.mark.unit
Expand Down
Loading