ukaea / paramak

Create parametric 3D fusion reactor CAD models
https://paramak.readthedocs.io/en/main/
37 stars 12 forks source link

removed .py script examples and replaced with .ipynb #830

Closed shimwell closed 3 years ago

shimwell commented 3 years ago

Proposed changes

The py files were becoming a bit of a burden to maintain and the ipynb files were starting to duplicate them.

This PR tidies up the examples so that all the examples are on python notebooks instead of py scripts.

TODO -[ ] update links in the documentation rst files -[ ] convert neutroncis examples to notebooks

Types of changes

What types of changes does your code introduce to the Paramak? Put an x in the boxes that apply

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

RemDelaporteMathurin commented 3 years ago

@Shimwell these notebooks will look fab! I recently learned my way through testing demos notebooks in the CI by first converting them to .py with nbconvert and then run them. If you're interested let me know

shimwell commented 3 years ago

@Shimwell these notebooks will look fab! I recently learned my way through testing demos notebooks in the CI by first converting them to .py with nbconvert and then run them. If you're interested let me know

Thanks Remi, there is a method used to test the notebooks in this PR but I would be keen to take a look at anything just in case the method I have can be improved on

https://github.com/ukaea/paramak/blob/develop/tests/notebook_testing.py

RemDelaporteMathurin commented 3 years ago

@Shimwell this is what I use for FESTIM. It is a seperated workflow that runs in parrallel to the unit test suite.

# This is a basic workflow to help you get started with Actions

name: Test demos

# Controls when the action will run. 
on:
  # Triggers the workflow on push or pull request events but only for the master branch
  push:
    branches:
    - master
    - dev
  pull_request:
    branches:
    - master
    - dev

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest
    container: quay.io/fenicsproject/stable:latest
    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2

      # Runs a single command using the runners shell
      - name: Run the notebooks
        run: |
          jupyter-nbconvert --to python demos/demo_multi_materials.ipynb
          mkdir outputs
          python3 -m demos.demo_multi_materials
          jupyter-nbconvert --to python demos/demo_meshes.ipynb
          python3 -m demos.demo_meshes
          jupyter-nbconvert --to python demos/demo_derived_quantities.ipynb
          python3 -m demos.demo_derived_quantities
          jupyter-nbconvert --to python demos/demo_Ogorodnikova.ipynb
          python3 -m demos.demo_Ogorodnikova
          jupyter-nbconvert --to python demos/demo_coupled_heat_transfer.ipynb
          python3 -m demos.demo_coupled_heat_transfer
codecov[bot] commented 3 years ago

Codecov Report

Merging #830 (96b8a05) into develop (00ca6e5) will increase coverage by 0.42%. The diff coverage is 92.30%.

:exclamation: Current head 96b8a05 differs from pull request most recent head d36ba50. Consider uploading reports for the commit d36ba50 to get more accurate results Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #830      +/-   ##
===========================================
+ Coverage    94.23%   94.66%   +0.42%     
===========================================
  Files           75       75              
  Lines         5345     5377      +32     
===========================================
+ Hits          5037     5090      +53     
+ Misses         308      287      -21     
Impacted Files Coverage Δ
...tric_neutronics/make_faceteted_neutronics_model.py 0.00% <0.00%> (ø)
...k/parametric_components/vacuum_vessel_inner_leg.py 93.33% <60.00%> (+67.87%) :arrow_up:
paramak/reactor.py 91.60% <75.00%> (-0.20%) :arrow_down:
paramak/parametric_reactors/ball_reactor.py 98.91% <96.00%> (-1.09%) :arrow_down:
paramak/parametric_reactors/submersion_reactor.py 98.64% <97.82%> (-0.41%) :arrow_down:
paramak/neutronics_utils.py 84.72% <100.00%> (-1.39%) :arrow_down:
paramak/parametric_neutronics/neutronics_model.py 93.68% <100.00%> (-0.05%) :arrow_down:
...ak/parametric_reactors/single_null_ball_reactor.py 75.00% <0.00%> (-25.00%) :arrow_down:
...ametric_reactors/single_null_submersion_reactor.py 75.00% <0.00%> (-25.00%) :arrow_down:
paramak/utils.py 97.30% <0.00%> (-2.31%) :arrow_down:
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 7214f8d...d36ba50. Read the comment docs.

shimwell commented 3 years ago

Screenshot from 2021-05-07 18-42-07