From fad307f4de4a986cba92329a4f9138f68060e64c Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Tue, 9 Feb 2021 20:08:57 +0000 Subject: [PATCH 1/8] :whale: version tagged dockerfile as suggested in pullrequest.com review --- Dockerfile | 2 +- DockerfileDependencies | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 790bafe77..f9efa9c0e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,7 +40,7 @@ # docker run --rm ukaea/paramak pytest /tests # docker run --rm ukaea/paramak /bin/bash -c "cd .. && bash run_tests.sh" -FROM continuumio/miniconda3 +FROM continuumio/miniconda3:4.9.2 # By default this Dockerfile builds with the latest release of CadQuery 2 ARG cq_version=2 diff --git a/DockerfileDependencies b/DockerfileDependencies index cf5d87e12..4d8111f76 100644 --- a/DockerfileDependencies +++ b/DockerfileDependencies @@ -40,7 +40,7 @@ # docker run --rm ukaea/paramak pytest /tests # docker run --rm ukaea/paramak /bin/bash -c "cd .. && bash run_tests.sh" -FROM continuumio/miniconda3 +FROM continuumio/miniconda3:4.9.2 # By default this Dockerfile builds with the latest release of CadQuery 2 ARG cq_version=2 From 795cb77e6d065176a4901e4bfa0bd5bdb0d8ea16 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Tue, 9 Feb 2021 20:17:47 +0000 Subject: [PATCH 2/8] pullrequest.com suggestions subprocess instead of os.system --- examples/example_parametric_reactors/make_animation.py | 6 +++--- paramak/neutronics_utils.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/example_parametric_reactors/make_animation.py b/examples/example_parametric_reactors/make_animation.py index 4d88c9542..082f4b94e 100644 --- a/examples/example_parametric_reactors/make_animation.py +++ b/examples/example_parametric_reactors/make_animation.py @@ -2,7 +2,7 @@ them into gif animations using the command line tool convert, you will need to have imagemagick installed to convert the svg images to a gif animation """ -import os +import subprocess import numpy as np import paramak @@ -60,7 +60,7 @@ def rotate_single_reactor(number_of_images=100): print("made", str(i + 1), "models out of", str(number_of_images)) - os.system("convert -delay 15 rotation_*.svg rotated.gif") + subprocess.check_call(["convert", "-delay", "15", "rotation_*.svg", "rotated.gif"]) print("animation file made as saved as rotated.gif") @@ -102,7 +102,7 @@ def make_random_reactors(number_of_images=11): print("made", str(i + 1), "models out of", str(number_of_images)) - os.system("convert -delay 40 random_*.svg randoms.gif") + subprocess.check_call(["convert", "-delay", "40", "random_*.svg", "randoms.gif"]) print("animation file made as saved as randoms.gif") diff --git a/paramak/neutronics_utils.py b/paramak/neutronics_utils.py index 47b3e816d..00e7aac34 100644 --- a/paramak/neutronics_utils.py +++ b/paramak/neutronics_utils.py @@ -112,7 +112,7 @@ def add_stl_to_moab_core( group_set = moab_core.create_meshset() moab_core.tag_set_data(tags['category'], group_set, "Group") - print("mat:{}".format(material_name)) + moab_core.tag_set_data( tags['name'], group_set, From 441e3b87ceb0503130a8cbc148737a38c63bcdec Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Tue, 9 Feb 2021 20:31:45 +0000 Subject: [PATCH 3/8] renamed function to avoid overwritting test --- tests/test_parametric_reactors/test_BallReactor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_parametric_reactors/test_BallReactor.py b/tests/test_parametric_reactors/test_BallReactor.py index 181d30911..74744fd8f 100644 --- a/tests/test_parametric_reactors/test_BallReactor.py +++ b/tests/test_parametric_reactors/test_BallReactor.py @@ -37,7 +37,7 @@ def test_creation_with_narrow_divertor(self): assert self.test_reactor.solid is not None assert len(self.test_reactor.shapes_and_components) == 7 - def test_creation_with_narrow_divertor(self): + def test_creation_with_wide_divertor(self): """Creates a BallReactor with a wide divertor and checks that the correct number of components are created.""" From 453c9a95ae63a4332a5e3a6e4439afdc1322015c Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Tue, 9 Feb 2021 20:36:36 +0000 Subject: [PATCH 4/8] removed workdir in docker container --- .github/workflows/docker_ci.yml | 2 +- Dockerfile | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/docker_ci.yml b/.github/workflows/docker_ci.yml index d1b1d178b..e1c414a14 100644 --- a/.github/workflows/docker_ci.yml +++ b/.github/workflows/docker_ci.yml @@ -14,4 +14,4 @@ jobs: - name: Build and test with Docker run: | docker build -t paramak --build-arg include_neutronics=true --build-arg cq_version=2.1 --build-arg compile_cores=2 . - docker run --rm paramak /bin/bash -c "cd .. && bash run_tests.sh && curl -s https://codecov.io/bash | bash" + docker run --rm paramak /bin/bash -c "bash run_tests.sh && curl -s https://codecov.io/bash | bash" diff --git a/Dockerfile b/Dockerfile index f9efa9c0e..a5440de05 100644 --- a/Dockerfile +++ b/Dockerfile @@ -213,5 +213,3 @@ COPY README.md README.md # using setup.py instead of pip due to https://github.com/pypa/pip/issues/5816 RUN python setup.py install - -WORKDIR examples From 0e2c2cd98fa2f20ced23122535ce312fdcb7dc3f Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Tue, 9 Feb 2021 20:40:35 +0000 Subject: [PATCH 5/8] added #!bin/bash to header --- run_tests.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/run_tests.sh b/run_tests.sh index 1b40d11d6..231da7447 100644 --- a/run_tests.sh +++ b/run_tests.sh @@ -1,3 +1,5 @@ +#!/bin/bash + pytest tests/test_neutronics_utils.py -v --cov=paramak --cov-append --cov-report term --cov-report xml pytest tests/test_example_neutronics_simulations.py -v --cov=paramak --cov-append --cov-report term --cov-report xml pytest tests/test_utils.py -v --cov=paramak --cov-append --cov-report term --cov-report xml From 8f83d5d4e7c762c1845f8d7592ea800180c692d3 Mon Sep 17 00:00:00 2001 From: autopep8 Date: Tue, 9 Feb 2021 20:42:19 +0000 Subject: [PATCH 6/8] Automated autopep8 fixes --- examples/example_parametric_reactors/make_animation.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/example_parametric_reactors/make_animation.py b/examples/example_parametric_reactors/make_animation.py index 082f4b94e..562388ca3 100644 --- a/examples/example_parametric_reactors/make_animation.py +++ b/examples/example_parametric_reactors/make_animation.py @@ -60,7 +60,8 @@ def rotate_single_reactor(number_of_images=100): print("made", str(i + 1), "models out of", str(number_of_images)) - subprocess.check_call(["convert", "-delay", "15", "rotation_*.svg", "rotated.gif"]) + subprocess.check_call( + ["convert", "-delay", "15", "rotation_*.svg", "rotated.gif"]) print("animation file made as saved as rotated.gif") @@ -102,7 +103,8 @@ def make_random_reactors(number_of_images=11): print("made", str(i + 1), "models out of", str(number_of_images)) - subprocess.check_call(["convert", "-delay", "40", "random_*.svg", "randoms.gif"]) + subprocess.check_call( + ["convert", "-delay", "40", "random_*.svg", "randoms.gif"]) print("animation file made as saved as randoms.gif") From 159c69448ee61d0446f93e45f2a4eeaf013b431d Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Tue, 9 Feb 2021 20:54:13 +0000 Subject: [PATCH 7/8] version bump --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index adce924a6..cb75b1556 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="paramak", - version="0.2.2", + version="0.2.3", author="The Paramak Development Team", author_email="jonathan.shimwell@ukaea.uk", description="Create 3D fusion reactor CAD models based on input parameters", From 912d0b7a1dc1ef2a17dbd3163602eb0922a0e3da Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Wed, 10 Feb 2021 11:30:13 +0000 Subject: [PATCH 8/8] removed first append --- run_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run_tests.sh b/run_tests.sh index 231da7447..a351633a2 100644 --- a/run_tests.sh +++ b/run_tests.sh @@ -1,6 +1,6 @@ #!/bin/bash -pytest tests/test_neutronics_utils.py -v --cov=paramak --cov-append --cov-report term --cov-report xml +pytest tests/test_neutronics_utils.py -v --cov=paramak --cov-report term --cov-report xml pytest tests/test_example_neutronics_simulations.py -v --cov=paramak --cov-append --cov-report term --cov-report xml pytest tests/test_utils.py -v --cov=paramak --cov-append --cov-report term --cov-report xml pytest tests/test_Shape.py -v --cov=paramak --cov-append --cov-report term --cov-report xml