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 single model evaluation example notebook #3553

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jonmaddock
Copy link
Contributor

Add an example notebook demonstrating single-model evaluation in Process, without using the CLI and input/output files.

@jonmaddock jonmaddock linked an issue Feb 20, 2025 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Feb 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 31.18%. Comparing base (b7aefc2) to head (d5ade21).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3553      +/-   ##
==========================================
- Coverage   31.55%   31.18%   -0.37%     
==========================================
  Files          82       83       +1     
  Lines       19565    20024     +459     
==========================================
+ Hits         6173     6245      +72     
- Misses      13392    13779     +387     

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

Copy link
Contributor

@timothy-nunn timothy-nunn left a comment

Choose a reason for hiding this comment

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

Couple of issues probably caused by different versions of Jupyter/matplotlib.

Is it worth noting somewhere that this notebook will only become easier as the Pythonisation continues? I'm in two minds, and I'll leave that up to you.

"name": "stdout",
"output_type": "stream",
"text": [
"pdivt = 42.364607206184246\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be 0? Does the notebook need to be re-run from scratch and re-pushed?

"source": [
"def run_impurities(w_imp_fracs):\n",
" \"\"\"Calculate responses to W impurities.\"\"\"\n",
" n = w_imp_fracs.shape[0]\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think commenting that n here is the number of times we change the W frac and observe the responses helps make this clearer quicker.

Comment on lines +266 to +269
" p_plasma_rad_mw = np.empty(n)\n",
" pdivt = np.empty(n)\n",
" p_l_h_threshold_mw = np.empty(n)\n",
" con15 = np.empty(n)\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary to do this, or can we just make these as normal arrays and append the values?

Then comment on the loop that we are iterating over the W frac test points and storing key physical responses at each test point.

"ax.set_title(\"W impurity fraction against radiated and divertor power\")\n",
"ax.set_xlabel(\"W impurity fraction\")\n",
"ax.set_ylabel(\"Power (MW)\")\n",
"ax.legend()"
Copy link
Contributor

Choose a reason for hiding this comment

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

This didn't work for me without adding %matplotlib inline to the top of the cell

"ax.set_ylabel(\"L-H threshold constraint value\")\n",
"ax.hlines(0.0, xmin=ax.get_xlim()[0], xmax=ax.get_xlim()[1], colors=\"r\")\n",
"ax.annotate(\"Satisfied\", (0.0, 0.1))\n",
"ax.annotate(\"Violated\", (0.0, -0.15))"
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above, figures did not display until %matplotlib inline

@@ -62,3 +62,4 @@ python_modules.txt
quench_data.DAT
env-fork
*SIG_TF.json
!examples/data/*
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
!examples/data/*
!examples/data/*IN.DAT

Otherwise the MFILE and OUT file become untracked when they should not be

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.

Individual model running examples
3 participants