Skip to content

Ts/bd min #623

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 35 commits into from
Closed

Ts/bd min #623

wants to merge 35 commits into from

Conversation

dpanici
Copy link
Collaborator

@dpanici dpanici commented Aug 15, 2023

Add new objective to minimize variance of |B| times minimum distance from plasma to winding surface. This is to try to ensure that the equilibrium magnetic field is more feasible to create with the given winding surface by penalizing having larger magnetic fields farther away from the winding surface.

@dpanici dpanici marked this pull request as draft August 15, 2023 18:54
@dpanici dpanici closed this Aug 15, 2023
@Tal-Shpigel Tal-Shpigel reopened this Aug 16, 2023
@Tal-Shpigel
Copy link
Collaborator

Tal-Shpigel commented Aug 16, 2023

  • Update with master
  • Change objective name
  • Wait for test to run, add test to increase converge if needed

@Tal-Shpigel
Copy link
Collaborator

We made this objective to create equilibrium surfaces that could be more readily reproduced from a surface current and, ultimately, coils.
This is the problem we had:
Screenshot 2023-08-16 at 19 20 20

Using the objective, minimizing the surface variance of |B|*d_min yielded good initial results:
Screenshot 2023-08-16 at 19 22 21

And was recreated fairly well by a surface current:
trace50_transits_trace_M_50_N_160_alpha_0_modopt_ct32NFP4_opt7

@codecov
Copy link

codecov bot commented Aug 22, 2023

Codecov Report

Merging #623 (5251473) into master (f1f2588) will decrease coverage by 0.01%.
Report is 23 commits behind head on master.
The diff coverage is 94.54%.

❗ Current head 5251473 differs from pull request most recent head 7d2c7a6. Consider uploading reports for the commit 7d2c7a6 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #623      +/-   ##
==========================================
- Coverage   94.41%   94.41%   -0.01%     
==========================================
  Files          79       79              
  Lines       18589    18644      +55     
==========================================
+ Hits        17551    17602      +51     
- Misses       1038     1042       +4     
Files Changed Coverage Δ
desc/objectives/__init__.py 100.00% <ø> (ø)
desc/objectives/_geometry.py 93.71% <94.54%> (+0.15%) ⬆️

... and 1 file with indirect coverage changes

@dpanici dpanici marked this pull request as ready for review September 8, 2023 17:17
else: # do hardmin
dmin_data = d.min(axis=-1)

B_dmin_data = jnp.array([d_min * B for d_min, B in zip(dmin_data, data["|B|"])])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't these just be broadcasted normally?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, though when I make that change our test fails... it must not be a good test then

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might also be something weird with array shaping. I'd double check the sizes and values of things to make sure it's doing what you want.

@dpanici dpanici marked this pull request as draft October 4, 2023 19:15
@github-actions
Copy link
Contributor

|             benchmark_name             |         dt(%)          |         dt(s)          |        t_new(s)        |        t_old(s)        | 
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
 test_build_transform_fft_lowres         |     +3.50 +/- 5.37     | +8.22e-04 +/- 1.26e-03 |  2.43e-02 +/- 1.2e-03  |  2.35e-02 +/- 3.0e-04  |
 test_build_transform_fft_midres         |     +5.71 +/- 6.51     | +7.70e-03 +/- 8.78e-03 |  1.43e-01 +/- 8.7e-03  |  1.35e-01 +/- 9.5e-04  |
 test_build_transform_fft_highres        |     +1.90 +/- 1.14     | +1.18e-02 +/- 7.02e-03 |  6.30e-01 +/- 4.6e-03  |  6.19e-01 +/- 5.3e-03  |
 test_equilibrium_init_lowres            |     -2.08 +/- 5.00     | -1.12e-02 +/- 2.69e-02 |  5.27e-01 +/- 1.7e-02  |  5.38e-01 +/- 2.1e-02  |
 test_equilibrium_init_medres            |     -1.20 +/- 5.26     | -8.27e-03 +/- 3.62e-02 |  6.79e-01 +/- 2.7e-02  |  6.87e-01 +/- 2.4e-02  |
 test_equilibrium_init_highres           |     -1.21 +/- 3.09     | -1.45e-02 +/- 3.70e-02 |  1.18e+00 +/- 2.4e-02  |  1.20e+00 +/- 2.8e-02  |
 test_objective_compile_dshape_current   |     -1.02 +/- 6.32     | -6.55e-02 +/- 4.04e-01 |  6.34e+00 +/- 2.9e-01  |  6.40e+00 +/- 2.8e-01  |
 test_objective_compile_atf              |     +3.41 +/- 4.61     | +6.10e-01 +/- 8.24e-01 |  1.85e+01 +/- 6.8e-01  |  1.79e+01 +/- 4.6e-01  |
 test_objective_compute_dshape_current   |     -4.05 +/- 4.89     | -1.75e-04 +/- 2.11e-04 |  4.15e-03 +/- 1.4e-04  |  4.32e-03 +/- 1.6e-04  |
 test_objective_compute_atf              |     +2.90 +/- 3.79     | +4.09e-04 +/- 5.34e-04 |  1.45e-02 +/- 4.4e-04  |  1.41e-02 +/- 3.1e-04  |
 test_objective_jac_dshape_current       |     +0.65 +/- 9.80     | +1.05e-03 +/- 1.57e-02 |  1.62e-01 +/- 1.2e-02  |  1.61e-01 +/- 1.0e-02  |
 test_objective_jac_atf                  |     +2.31 +/- 1.69     | +1.73e-01 +/- 1.27e-01 |  7.66e+00 +/- 1.1e-01  |  7.49e+00 +/- 6.8e-02  |
 test_perturb_1                          |     -1.60 +/- 13.39    | -1.72e-01 +/- 1.44e+00 |  1.06e+01 +/- 9.6e-01  |  1.07e+01 +/- 1.1e+00  |
 test_perturb_2                          |     +0.15 +/- 4.79     | +2.95e-02 +/- 9.70e-01 |  2.03e+01 +/- 5.3e-01  |  2.03e+01 +/- 8.1e-01  |

@dpanici dpanici closed this Feb 1, 2024
dpanici added a commit that referenced this pull request Apr 8, 2025
…#1673)

Updates the requirements on
[pytest-cov](https://github.com/pytest-dev/pytest-cov) to permit the
latest version.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst">pytest-cov's
changelog</a>.</em></p>
<blockquote>
<h2>6.1.1 (2025-04-05)</h2>
<ul>
<li>Fixed breakage that occurs when <code>--cov-context</code> and the
<code>no_cover</code> marker are used together.</li>
</ul>
<h2>6.1.0 (2025-04-01)</h2>
<ul>
<li>Change terminal output to use full width lines for the coverage
header.
Contributed by Tsvika Shapira in
<code>[#678](pytest-dev/pytest-cov#678)
&lt;https://github.com/pytest-dev/pytest-cov/pull/678&gt;</code>_.</li>
<li>Removed unnecessary CovFailUnderWarning. Fixes
<code>[#675](pytest-dev/pytest-cov#675)
&lt;https://github.com/pytest-dev/pytest-cov/issues/675&gt;</code>_.</li>
<li>Fixed the term report not using the precision specified via
<code>--cov-precision</code>.</li>
</ul>
<h2>6.0.0 (2024-10-29)</h2>
<ul>
<li>Updated various documentation inaccuracies, especially on subprocess
handling.</li>
<li>Changed fail under checks to use the precision set in the coverage
configuration.
Now it will perform the check just like <code>coverage report</code>
would.</li>
<li>Added a <code>--cov-precision</code> cli option that can override
the value set in your coverage configuration.</li>
<li>Dropped support for now EOL Python 3.8.</li>
</ul>
<h2>5.0.0 (2024-03-24)</h2>
<ul>
<li>Removed support for xdist rsync (now deprecated).
Contributed by Matthias Reichenbach in
<code>[#623](pytest-dev/pytest-cov#623)
&lt;https://github.com/pytest-dev/pytest-cov/pull/623&gt;</code>_.</li>
<li>Switched docs theme to Furo.</li>
<li>Various legacy Python cleanup and CI improvements.
Contributed by Christian Clauss and Hugo van Kemenade in
<code>[#630](pytest-dev/pytest-cov#630)
&lt;https://github.com/pytest-dev/pytest-cov/pull/630&gt;</code><em>,
<code>[#631](pytest-dev/pytest-cov#631)
&lt;https://github.com/pytest-dev/pytest-cov/pull/631&gt;</code></em>,
<code>[#632](pytest-dev/pytest-cov#632)
&lt;https://github.com/pytest-dev/pytest-cov/pull/632&gt;</code>_ and
<code>[#633](pytest-dev/pytest-cov#633)
&lt;https://github.com/pytest-dev/pytest-cov/pull/633&gt;</code>_.</li>
<li>Added a <code>pyproject.toml</code> example in the docs.
Contributed by Dawn James in
<code>[#626](pytest-dev/pytest-cov#626)
&lt;https://github.com/pytest-dev/pytest-cov/pull/626&gt;</code>_.</li>
<li>Modernized project's pre-commit hooks to use ruff. Initial POC
contributed by
Christian Clauss in
<code>[#584](pytest-dev/pytest-cov#584)
&lt;https://github.com/pytest-dev/pytest-cov/pull/584&gt;</code>_.</li>
<li>Dropped support for Python 3.7.</li>
</ul>
<h2>4.1.0 (2023-05-24)</h2>
<ul>
<li>Updated CI with new Pythons and dependencies.</li>
<li>Removed rsyncdir support. This makes pytest-cov compatible with
xdist 3.0.
Contributed by Sorin Sbarnea in
<code>[#558](pytest-dev/pytest-cov#558)
&lt;https://github.com/pytest-dev/pytest-cov/pull/558&gt;</code>_.</li>
<li>Optimized summary generation to not be performed if no reporting is
active (for example,
when <code>--cov-report=''</code> is used without
<code>--cov-fail-under</code>).
Contributed by Jonathan Stewmon in
<code>[#589](pytest-dev/pytest-cov#589)
&lt;https://github.com/pytest-dev/pytest-cov/pull/589&gt;</code>_.</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/pytest-dev/pytest-cov/commit/9463242e3a7bc18a56b8f18c01b4dfb50087e5ed"><code>9463242</code></a>
Bump version: 6.1.0 → 6.1.1</li>
<li><a
href="https://github.com/pytest-dev/pytest-cov/commit/7f2781b47fc9bd4a8e94ff86b4f69f5959c3d907"><code>7f2781b</code></a>
Update changelog.</li>
<li><a
href="https://github.com/pytest-dev/pytest-cov/commit/a59548f3adcb757ea8afcb40d8d849af49f6e925"><code>a59548f</code></a>
Allow the context plugin to check if the controller is running or not.
Fixes ...</li>
<li><a
href="https://github.com/pytest-dev/pytest-cov/commit/10f8cde38c3b0aaf2c75d9ed62d4f333d8809d96"><code>10f8cde</code></a>
Bump version: 6.0.0 → 6.1.0</li>
<li><a
href="https://github.com/pytest-dev/pytest-cov/commit/10b14afffcd53b19967785c0b3e8b35ebac70b6f"><code>10b14af</code></a>
Update changelog.</li>
<li><a
href="https://github.com/pytest-dev/pytest-cov/commit/aa57aed273475b4f9975cc9a8a1662b336718662"><code>aa57aed</code></a>
Refactor a bit the internals to be a bit less boilerplatey and have more
clar...</li>
<li><a
href="https://github.com/pytest-dev/pytest-cov/commit/e760099a7fd5f49c235dc798bf7f222c0372b7e3"><code>e760099</code></a>
Make sure the CLI precision is used when creating report. Fixes <a
href="https://github.com/pytest-dev/pytest-cov/issues/674">#674</a>.</li>
<li><a
href="https://github.com/pytest-dev/pytest-cov/commit/44540e1e9f02f3b69b62834636cf3057edc960d6"><code>44540e1</code></a>
Remove unnecessary CovFailUnderWarning. Closes <a
href="https://github.com/pytest-dev/pytest-cov/issues/675">#675</a>.</li>
<li><a
href="https://github.com/pytest-dev/pytest-cov/commit/204af146f8f4ff03076825a693ee6aef587deb6b"><code>204af14</code></a>
Update changelog.</li>
<li><a
href="https://github.com/pytest-dev/pytest-cov/commit/089e7bb5c16dcfdedd54f27fda094ccb3eeaae2c"><code>089e7bb</code></a>
Upgrade ruff.</li>
<li>Additional commits viewable in <a
href="https://github.com/pytest-dev/pytest-cov/compare/v2.6.0...v6.1.1">compare
view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants