Skip to content

Commit

Permalink
add normalization for surfacecurrentregularization
Browse files Browse the repository at this point in the history
  • Loading branch information
dpanici committed Oct 2, 2024
1 parent b647b00 commit 4e7cc7e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions desc/objectives/_coils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1700,12 +1700,10 @@ class SurfaceCurrentRegularization(_Objective):
worse the normal field.
normalize : bool, optional
Whether to compute the error in physical units or non-dimensionalize.
Note: has no effect on this objective.
normalize_target : bool
Whether target should be normalized before comparing to computed values.
if `normalize` is `True` and the target is in physical units, this should also
be set to True.
Note: has no effect on this objective.
loss_function : {None, 'mean', 'min', 'max'}, optional
Loss function to apply to the objective values once computed. This loss function
is called on the raw compute value, before any shifting, scaling, or
Expand Down Expand Up @@ -1816,6 +1814,10 @@ def build(self, use_jit=True, verbose=1):
has_axis=source_grid.axis.size,
)

self._normalization = np.max(
[abs(surface_current_field.I + surface_current_field.G), 1]
)

self._constants = {
"surface_transforms": surface_transforms,
"quad_weights": source_grid.weights * jnp.sqrt(source_grid.num_nodes),
Expand Down

0 comments on commit 4e7cc7e

Please sign in to comment.