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

Eq analysis tools update #3692

Open
wants to merge 26 commits into
base: feature/eq_analysis_tools
Choose a base branch
from

Conversation

geograham
Copy link
Contributor

@geograham geograham commented Nov 12, 2024

Closes

#3376

Description

Further additions/updates for the eq analysis feature branch.

See examples/equilibria/anaylsis_toolbox_examples.ex.py for how to use.

Checklist

I confirm that I have completed the following checks:

  • Tests run locally and pass pytest tests --reactor
  • Code quality checks run locally and pass pre-commit run --from-ref develop --to-ref HEAD
  • Documentation built locally and checked sphinx-build -W documentation/source documentation/build

@geograham geograham requested review from a team as code owners November 12, 2024 14:54
@je-cook je-cook force-pushed the feature/eq_analysis_tools branch 2 times, most recently from 24325a3 to f6db784 Compare November 18, 2024 12:51
@je-cook je-cook force-pushed the feature/eq_analysis_tools branch from f6db784 to 53d9294 Compare December 2, 2024 12:01
@geograham geograham requested a review from a team as a code owner December 3, 2024 11:19
@geograham geograham force-pushed the eq_analysis_tools_update branch from cce55ed to 69db0c3 Compare December 3, 2024 14:36
Copy link

sonarqubecloud bot commented Dec 3, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@je-cook je-cook force-pushed the feature/eq_analysis_tools branch from 53d9294 to 64deb3e Compare December 6, 2024 09:25
@geograham geograham force-pushed the feature/eq_analysis_tools branch 2 times, most recently from c652c17 to 76f1400 Compare January 16, 2025 15:17
@geograham geograham force-pushed the eq_analysis_tools_update branch from 69db0c3 to ddc8225 Compare January 16, 2025 16:14
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

Attention: Patch coverage is 23.61111% with 275 lines in your changes missing coverage. Please review.

Project coverage is 74.26%. Comparing base (76f1400) to head (ddc8225).

Files with missing lines Patch % Lines
bluemira/equilibria/analysis.py 0.00% 209 Missing ⚠️
bluemira/equilibria/plotting.py 15.71% 59 Missing ⚠️
bluemira/equilibria/solve.py 66.66% 5 Missing ⚠️
bluemira/equilibria/physics.py 66.66% 2 Missing ⚠️
Additional details and impacted files
@@                      Coverage Diff                      @@
##           feature/eq_analysis_tools    #3692      +/-   ##
=============================================================
- Coverage                      75.20%   74.26%   -0.94%     
=============================================================
  Files                            232      232              
  Lines                          27708    27998     +290     
=============================================================
- Hits                           20838    20793      -45     
- Misses                          6870     7205     +335     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@je-cook je-cook left a comment

Choose a reason for hiding this comment

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

Thanks for this, I've done an initial run through as this is getting quite large. Could we get some tests the make the plots you've added?

examples/equilibria/eudemo_2017.ex.py Outdated Show resolved Hide resolved
examples/equilibria/anaylsis_toolbox_examples.ex.py Outdated Show resolved Hide resolved
bluemira/equilibria/solve.py Outdated Show resolved Hide resolved
bluemira/equilibria/find_legs.py Outdated Show resolved Hide resolved
@geograham geograham force-pushed the eq_analysis_tools_update branch from ddc8225 to 730d865 Compare January 22, 2025 15:11
@geograham geograham requested review from a team as code owners January 22, 2025 15:11
@geograham geograham force-pushed the feature/eq_analysis_tools branch from 76f1400 to bd84305 Compare January 22, 2025 15:14
@je-cook
Copy link
Contributor

je-cook commented Jan 23, 2025

This should solve all the conflicts easily git rebase --onto feature/eq_analysis_tools bd84305. After that I will reset the feature branch to this point so that all your new things are contained within this PR, unless you think otherwise?:
image

@je-cook je-cook self-assigned this Jan 23, 2025
@je-cook je-cook added enhancement New feature or request equilibria Tasks relating to the equilibria module labels Jan 23, 2025
Copy link
Contributor

@je-cook je-cook left a comment

Choose a reason for hiding this comment

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

On the whole really cool. I've been through it all once and run the two examples. We can have a hat about any of this that seems no necessarily straight forward.

I've commented on the example for when I would like the style adjusted or added to, it was easier than tracking it down in the code...

examples/equilibria/anaylsis_toolbox_examples.ex.py Outdated Show resolved Hide resolved
@@ -300,17 +306,25 @@

sof = deepcopy(reference_eq)

diag_ops = EqDiagnosticOptions(
psi_diff=False, split_psi_plots=False, reference_eq=reference_eq
Copy link
Contributor

Choose a reason for hiding this comment

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

split_psi_plots is a bool here but this fails when running the notebook on plotting L742

assert isinstance(ax4, Axes)

@pytest.mark.parametrize(
"legs_to_plot", [DivLegsToPlot.ALL, DivLegsToPlot.UP, DivLegsToPlot.LW]
Copy link
Contributor

Choose a reason for hiding this comment

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

ALL and UP fail for me locally

ALL: AssertionError: assert 2 == 4
UP: One of your chosen equilibria does not have upper_inner legs.

bluemira/equilibria/analysis.py Outdated Show resolved Hide resolved
bluemira/equilibria/analysis.py Outdated Show resolved Hide resolved
bluemira/equilibria/analysis.py Outdated Show resolved Hide resolved
summary_dict = [self._eq.analyse_plasma()]
pd.set_option("display.float_format", "{:.2f}".format)
dataframe = pd.DataFrame(summary_dict).T
dataframe.columns = [self.eq_name]
Copy link
Contributor

Choose a reason for hiding this comment

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

we could possibly use tabulate if this is the main use of pandas, let me know and I'll find a snippet

bluemira/equilibria/analysis.py Outdated Show resolved Hide resolved
je-cook and others added 2 commits January 24, 2025 12:29
* 🎨 Small cleanup

* 🚧 Initial structure
* Create equilibrium comparison plotter class

- compare equilibrium object with reference equilibrium
- split psi plotting
- plotting percentage difference between current and reference equilibrium
- plot reference lcfs

* work on plots before work to update plot instead of producing new plots

* make subplots have the same axes limits

* remove unused argument in call to EquilibriumComparisonPlotter class in _minimal_current

* Add xz_plot_setup to plot_tools.py

* working on updating plot

* remove blank line after docstring

* trying to update colorbar (from stackexchange)

* colorbar updating instead of multiple colorbars

* add # noqa: BLE001 to Exception

* update typing

* pre-commit changes

* fix from github comment

* 🚨 Few missing imports

---------

Co-authored-by: james <[email protected]>
@geograham geograham force-pushed the eq_analysis_tools_update branch from 67f3b20 to 750f145 Compare January 24, 2025 12:31
@geograham geograham force-pushed the feature/eq_analysis_tools branch from bd84305 to e7e9bea Compare January 24, 2025 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request equilibria Tasks relating to the equilibria module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants