torus_solver.metrics

torus_solver.metrics.bn_over_B(B, normals, *, eps=1e-30)[source]

Compute the normalized normal field B·n/norm(B).

Return type:

Array

Parameters:
  • B (Array)

  • normals (Array)

  • eps (float)

torus_solver.metrics.bn_over_B_metrics(B, normals, weights, *, eps=1e-30)[source]

Return (Bn_over_B, rms, max_abs) with area weights.

Return type:

tuple[Array, Array, Array]

Parameters:
  • B (Array)

  • normals (Array)

  • weights (Array)

  • eps (float)

torus_solver.metrics.weighted_mean(x, weights, *, eps=1e-30)[source]

Weighted mean of a scalar field.

Return type:

Array

Parameters:
  • x (Array)

  • weights (Array)

  • eps (float)

torus_solver.metrics.weighted_p_norm(x, weights, *, p, eps=1e-30)[source]

Weighted p-norm proxy (p>=2) that interpolates between RMS (p=2) and max (p→∞).

Return type:

Array

Parameters:
  • x (Array)

  • weights (Array)

  • p (float)

  • eps (float)

torus_solver.metrics.weighted_rms(x, weights, *, eps=1e-30)[source]

Weighted RMS of a scalar field.

Return type:

Array

Parameters:
  • x (Array)

  • weights (Array)

  • eps (float)