Skip to content
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

Add 4th order derivative transforms #586

Merged
merged 22 commits into from
Jul 31, 2023
Merged

Add 4th order derivative transforms #586

merged 22 commits into from
Jul 31, 2023

Conversation

unalmis
Copy link
Collaborator

@unalmis unalmis commented Jul 17, 2023

desc/transform.py Outdated Show resolved Hide resolved
@unalmis unalmis marked this pull request as ready for review July 18, 2023 15:53
@unalmis unalmis requested review from f0uriest and ddudt July 18, 2023 18:39
desc/transform.py Outdated Show resolved Hide resolved
@unalmis unalmis requested a review from dpanici July 18, 2023 20:02
@f0uriest
Copy link
Member

f0uriest commented Jul 19, 2023 via email

@unalmis unalmis added the run_benchmarks Run timing benchmarks on this PR against current master branch label Jul 19, 2023
@unalmis unalmis marked this pull request as draft July 19, 2023 02:44
desc/transform.py Outdated Show resolved Hide resolved
@unalmis unalmis added run_benchmarks Run timing benchmarks on this PR against current master branch and removed run_benchmarks Run timing benchmarks on this PR against current master branch labels Jul 19, 2023
@github-actions
Copy link
Contributor

|             benchmark_name             |        dt(%)        |        dt(s)        |      t_new(s)      |      t_old(s)      | 
| ------------------------------- | ------------------- | ------------------- | ------------------ | ------------------ |
+test_build_transform_fft_lowres        | -1.38+/-0.86 | -1.67e-04+/-1.0e-04 | 1.20e-02+/-7.4e-05 | 1.21e-02+/-7.3e-05 |
+test_build_transform_fft_midres        | -2.23+/-0.51 | -2.40e-03+/-5.5e-04 | 1.05e-01+/-4.1e-04 | 1.08e-01+/-3.6e-04 |
+test_build_transform_fft_highres       | -1.76+/-0.54 | -9.08e-03+/-2.8e-03 | 5.06e-01+/-2.6e-03 | 5.15e-01+/-1.0e-03 |
 test_equilibrium_init_lowres           | -1.17+/-1.39 | -5.73e-03+/-6.8e-03 | 4.86e-01+/-6.8e-03 | 4.92e-01+/-5.9e-04 |
+test_equilibrium_init_medres           | -1.40+/-0.40 | -3.24e-02+/-9.4e-03 | 2.28e+00+/-5.0e-03 | 2.32e+00+/-7.9e-03 |
+test_equilibrium_init_highres          | -0.70+/-0.32 | -5.38e-02+/-2.5e-02 | 7.68e+00+/-1.3e-02 | 7.73e+00+/-2.1e-02 |
+test_objective_compile_heliotron       | -1.67+/-1.11 | -1.96e-01+/-1.3e-01 | 1.16e+01+/-6.7e-02 | 1.17e+01+/-1.1e-01 |
 test_objective_compile_dshape_current  | -3.45+/-4.47 | -1.40e-01+/-1.8e-01 | 3.91e+00+/-1.2e-01 | 4.05e+00+/-1.3e-01 |
 test_objective_compile_atf             | -1.17+/-2.19 | -1.44e-01+/-2.7e-01 | 1.22e+01+/-1.7e-01 | 1.23e+01+/-2.1e-01 |
 test_objective_compute_heliotron       | -2.45+/-353.25 | -6.01e-04+/-8.7e-02 | 2.39e-02+/-6.0e-02 | 2.45e-02+/-6.2e-02 |
 test_objective_compute_dshape_current  | -1.45+/-416.78 | -1.59e-04+/-4.6e-02 | 1.08e-02+/-3.2e-02 | 1.10e-02+/-3.3e-02 |
 test_objective_compute_atf             | -1.31+/-368.22 | -3.07e-04+/-8.6e-02 | 2.31e-02+/-6.0e-02 | 2.34e-02+/-6.1e-02 |
-test_objective_jac_heliotron           | +15.97+/-0.41 | +7.83e-01+/-2.0e-02 | 5.68e+00+/-1.3e-02 | 4.90e+00+/-1.6e-02 |
 test_objective_jac_dshape_current      | -2.42+/-4.55 | -2.93e-03+/-5.5e-03 | 1.18e-01+/-2.0e-03 | 1.21e-01+/-5.1e-03 |
 test_objective_jac_atf                 | -0.44+/-0.90 | -2.33e-02+/-4.8e-02 | 5.31e+00+/-2.3e-02 | 5.33e+00+/-4.2e-02 |
 test_perturb_1                         | -0.56+/-45.17 | -4.79e-02+/-3.8e+00 | 8.47e+00+/-2.7e+00 | 8.52e+00+/-2.7e+00 |
 test_perturb_2                         | -0.59+/-3.01 | -8.70e-02+/-4.4e-01 | 1.46e+01+/-3.0e-01 | 1.47e+01+/-3.2e-01 |

@PlasmaControl PlasmaControl deleted a comment from github-actions bot Jul 19, 2023
    determined to be cause of the bug. The transform matrices
    attribute is being assigned and is persistent. The error the
    previous commits were trying to isolate was just an issue with
    loosing the matrices attribute while saving to output.
    By calling .matrics property attribute everywhere we do not need
    a _set_up method.
@unalmis unalmis marked this pull request as ready for review July 19, 2023 04:43
@unalmis unalmis removed the run_benchmarks Run timing benchmarks on this PR against current master branch label Jul 19, 2023
f0uriest
f0uriest previously approved these changes Jul 19, 2023
@codecov
Copy link

codecov bot commented Jul 19, 2023

Codecov Report

Merging #586 (d76d9dd) into master (d896b0a) will increase coverage by 0.07%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #586      +/-   ##
==========================================
+ Coverage   94.14%   94.21%   +0.07%     
==========================================
  Files          74       74              
  Lines       17426    17646     +220     
==========================================
+ Hits        16405    16626     +221     
+ Misses       1021     1020       -1     
Files Changed Coverage Δ
desc/compute/_core.py 100.00% <ø> (ø)
desc/io/equilibrium_io.py 85.89% <ø> (ø)
desc/basis.py 97.82% <100.00%> (+0.03%) ⬆️
desc/transform.py 91.30% <100.00%> (+0.37%) ⬆️

desc/basis.py Show resolved Hide resolved
Copy link
Collaborator

@dpanici dpanici left a comment

Choose a reason for hiding this comment

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

could you add a correctness test for the jacobi derivative 4th order? like some crude check against finite differences or something, just to make sure things are correct.

@unalmis unalmis dismissed stale reviews from dpanici and f0uriest via 60a5bb0 July 25, 2023 15:31
tests/test_basis.py Outdated Show resolved Hide resolved
@unalmis unalmis marked this pull request as ready for review July 25, 2023 17:52
@unalmis
Copy link
Collaborator Author

unalmis commented Jul 25, 2023

Made requested change to merge some changes from #556

desc/compute/_core.py Outdated Show resolved Hide resolved
@unalmis unalmis mentioned this pull request Jul 25, 2023
@unalmis unalmis requested review from f0uriest and dpanici July 25, 2023 18:47
@unalmis unalmis removed the run_benchmarks Run timing benchmarks on this PR against current master branch label Jul 25, 2023
Copy link
Member

Choose a reason for hiding this comment

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

Is there any particular order to the entries in this file? I think at one point they were sorted alphabetically by derivative order and I'd like to keep that if possible to make code generation and maintenance easier.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They have now been sorted using the script I made here: https://github.com/PlasmaControl/DESC/blob/basis_vectors/docs/sort_compute_funs.py

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It looks like sorting them alphabetically doubled the diff size. If you want a custom sort order with lower case first that can be done via the one-line modification to the script as discussed here https://stackoverflow.com/a/28136499.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks! The actual order isn't so important as long as there is some logic to it so its reproducible and we can keep it in order.

f0uriest
f0uriest previously approved these changes Jul 25, 2023
setup.cfg Show resolved Hide resolved
f0uriest
f0uriest previously approved these changes Jul 27, 2023
@unalmis unalmis merged commit 32398c3 into master Jul 31, 2023
21 checks passed
@unalmis unalmis deleted the higher_order_deriv branch July 31, 2023 22:12
@unalmis unalmis self-assigned this Aug 17, 2024
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.

3 participants