DESC icon indicating copy to clipboard operation
DESC copied to clipboard

Add point B measurement error objective

Open dpanici opened this issue 11 months ago • 4 comments

  • Adds objective for B measurements at points (outside the plasma, though this is not something I check for explicitly, it just does not make sense if plasma currents are present as the virtual casing principle will get the plasma contribution incorrect).

  • Currently not added in the public objective API, as we may want to think of having an overrarching "MagneticDiagnostic" objective that tries to minimize the re-computation of the magnetic field (think, concatenate all of the eval coords for both point B measurements for B probes, as well as the points along the curves for flux/mirnov and partial/full rogowski loops, to better take advantage of vectorization. I will think of a possible API for this

  • [x] change print value to be more intuitive for this objective (show error in matching targets, not just the compute value)

dpanici avatar Dec 08 '24 21:12 dpanici

|             benchmark_name             |         dt(%)          |         dt(s)          |        t_new(s)        |        t_old(s)        | 
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
 test_build_transform_fft_midres         |     +1.56 +/- 6.03     | +1.05e-02 +/- 4.05e-02 |  6.83e-01 +/- 1.6e-02  |  6.72e-01 +/- 3.7e-02  |
 test_build_transform_fft_highres        |     +0.48 +/- 3.70     | +4.44e-03 +/- 3.41e-02 |  9.26e-01 +/- 1.6e-02  |  9.21e-01 +/- 3.0e-02  |
 test_equilibrium_init_lowres            |     +4.09 +/- 4.62     | +1.83e-01 +/- 2.06e-01 |  4.64e+00 +/- 9.2e-02  |  4.46e+00 +/- 1.8e-01  |
 test_objective_compile_atf              |     +1.61 +/- 3.80     | +9.83e-02 +/- 2.32e-01 |  6.21e+00 +/- 1.8e-01  |  6.11e+00 +/- 1.4e-01  |
 test_objective_compute_atf              |     -2.45 +/- 5.81     | -4.91e-05 +/- 1.16e-04 |  1.95e-03 +/- 1.1e-04  |  2.00e-03 +/- 4.8e-05  |
 test_objective_jac_atf                  |     -0.36 +/- 1.93     | -6.24e-03 +/- 3.35e-02 |  1.73e+00 +/- 2.9e-02  |  1.73e+00 +/- 1.6e-02  |
 test_perturb_1                          |     +3.11 +/- 3.10     | +4.26e-01 +/- 4.26e-01 |  1.41e+01 +/- 3.9e-01  |  1.37e+01 +/- 1.7e-01  |
 test_proximal_jac_atf                   |     -0.32 +/- 1.32     | -1.77e-02 +/- 7.34e-02 |  5.54e+00 +/- 6.9e-02  |  5.56e+00 +/- 2.5e-02  |
 test_proximal_freeb_compute             |     -0.71 +/- 2.59     | -1.14e-03 +/- 4.14e-03 |  1.59e-01 +/- 2.7e-03  |  1.60e-01 +/- 3.2e-03  |
 test_solve_fixed_iter                   |     +1.68 +/- 6.43     | +4.37e-01 +/- 1.67e+00 |  2.64e+01 +/- 1.6e+00  |  2.60e+01 +/- 4.9e-01  |
 test_objective_compute_ripple           |     +1.94 +/- 6.41     | +4.16e-03 +/- 1.37e-02 |  2.18e-01 +/- 1.4e-02  |  2.14e-01 +/- 1.1e-03  |
 test_objective_grad_ripple              |     +1.00 +/- 3.92     | +9.38e-03 +/- 3.67e-02 |  9.47e-01 +/- 3.1e-02  |  9.38e-01 +/- 1.9e-02  |
 test_build_transform_fft_lowres         |     +0.37 +/- 2.93     | +2.08e-03 +/- 1.65e-02 |  5.65e-01 +/- 1.2e-02  |  5.63e-01 +/- 1.1e-02  |
 test_equilibrium_init_medres            |     +0.23 +/- 1.53     | +1.14e-02 +/- 7.65e-02 |  5.02e+00 +/- 5.6e-02  |  5.01e+00 +/- 5.3e-02  |
 test_equilibrium_init_highres           |     +0.25 +/- 0.84     | +1.40e-02 +/- 4.71e-02 |  5.64e+00 +/- 3.4e-02  |  5.63e+00 +/- 3.3e-02  |
 test_objective_compile_dshape_current   |     +0.69 +/- 5.42     | +2.31e-02 +/- 1.82e-01 |  3.38e+00 +/- 1.3e-01  |  3.35e+00 +/- 1.3e-01  |
 test_objective_compute_dshape_current   |     +0.30 +/- 7.42     | +2.39e-06 +/- 5.86e-05 |  7.93e-04 +/- 4.9e-05  |  7.90e-04 +/- 3.2e-05  |
 test_objective_jac_dshape_current       |     -0.90 +/- 14.49    | -2.95e-04 +/- 4.73e-03 |  3.23e-02 +/- 2.7e-03  |  3.26e-02 +/- 3.9e-03  |
 test_perturb_2                          |     +0.02 +/- 0.88     | +3.00e-03 +/- 1.48e-01 |  1.69e+01 +/- 1.3e-01  |  1.69e+01 +/- 6.8e-02  |
 test_proximal_jac_atf_with_eq_update    |     +0.25 +/- 0.33     | +3.44e-02 +/- 4.55e-02 |  1.36e+01 +/- 3.4e-02  |  1.36e+01 +/- 3.1e-02  |
 test_proximal_freeb_jac                 |     +0.66 +/- 1.42     | +3.32e-02 +/- 7.09e-02 |  5.03e+00 +/- 5.5e-02  |  5.00e+00 +/- 4.5e-02  |
 test_solve_fixed_iter_compiled          |     -1.08 +/- 1.09     | -8.71e-02 +/- 8.79e-02 |  7.97e+00 +/- 6.9e-02  |  8.06e+00 +/- 5.4e-02  |
 test_LinearConstraintProjection_build   |     +0.16 +/- 2.70     | +1.37e-02 +/- 2.27e-01 |  8.40e+00 +/- 1.4e-01  |  8.39e+00 +/- 1.8e-01  |
 test_objective_compute_ripple_bounce1d  |     +0.15 +/- 3.88     | +4.46e-04 +/- 1.14e-02 |  2.93e-01 +/- 9.1e-03  |  2.92e-01 +/- 6.7e-03  |
 test_objective_grad_ripple_bounce1d     |     +0.33 +/- 2.70     | +3.63e-03 +/- 2.99e-02 |  1.11e+00 +/- 2.1e-02  |  1.11e+00 +/- 2.1e-02  |

Github CI performance can be noisy. When evaluating the benchmarks, developers should take this into account.

github-actions[bot] avatar Dec 08 '24 22:12 github-actions[bot]

Codecov Report

:x: Patch coverage is 99.05660% with 1 line in your changes missing coverage. Please review. :white_check_mark: Project coverage is 95.77%. Comparing base (4d9525d) to head (3caa683).

Files with missing lines Patch % Lines
desc/objectives/_reconstruction.py 98.95% 1 Missing :warning:
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #1436    +/-   ##
========================================
  Coverage   95.76%   95.77%            
========================================
  Files         101      102     +1     
  Lines       27754    27856   +102     
========================================
+ Hits        26579    26679   +100     
- Misses       1175     1177     +2     
Files with missing lines Coverage Δ
desc/magnetic_fields/_current_potential.py 99.60% <100.00%> (+<0.01%) :arrow_up:
desc/objectives/__init__.py 100.00% <100.00%> (ø)
desc/objectives/objective_funs.py 94.70% <100.00%> (+0.02%) :arrow_up:
desc/objectives/_reconstruction.py 98.95% <98.95%> (ø)

... and 2 files with indirect coverage changes

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Dec 10 '24 17:12 codecov[bot]

Memory benchmark result

|               Test Name                |      %Δ      |    Master (MB)     |      PR (MB)       |    Δ (MB)    |    Time PR (s)     |  Time Master (s)   |
| -------------------------------------- | ------------ | ------------------ | ------------------ | ------------ | ------------------ | ------------------ |
  test_objective_jac_w7x                 |    2.18 %    |     3.877e+03      |     3.962e+03      |    84.39     |       38.47        |       35.67        |
  test_proximal_jac_w7x_with_eq_update   |    0.38 %    |     6.590e+03      |     6.615e+03      |    24.81     |       163.88       |       163.87       |
  test_proximal_freeb_jac                |   -0.05 %    |     1.319e+04      |     1.318e+04      |    -7.08     |       85.36        |       83.85        |
  test_proximal_freeb_jac_blocked        |    0.32 %    |     7.599e+03      |     7.624e+03      |    24.62     |       76.44        |       76.23        |
  test_proximal_freeb_jac_batched        |    0.20 %    |     7.616e+03      |     7.631e+03      |    15.39     |       75.63        |       76.34        |
  test_proximal_jac_ripple               |   -3.54 %    |     3.473e+03      |     3.350e+03      |   -122.96    |       61.90        |       62.51        |
  test_proximal_jac_ripple_bounce1d      |   -0.81 %    |     3.523e+03      |     3.495e+03      |    -28.39    |       78.06        |       78.28        |
  test_eq_solve                          |   -0.89 %    |     2.040e+03      |     2.021e+03      |    -18.21    |       95.44        |       95.53        |

For the memory plots, go to the summary of Memory Benchmarks workflow and download the artifact.

github-actions[bot] avatar May 01 '25 19:05 github-actions[bot]

Draft until #1783 is thought through

dpanici avatar Jun 18 '25 20:06 dpanici