diff --git a/.circleci/config.yml b/.circleci/config.yml
index 1915508f4..ed706b806 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -23,12 +23,12 @@ jobs:
- run:
name: run shape tests
command:
- pytest tests/test_Shape.py -v --cov=paramak --cov-append --cov-report term --cov-report xml --junitxml=test-reports/junit.xml
+ pytest tests/test_shape.py -v --cov=paramak --cov-append --cov-report term --cov-report xml --junitxml=test-reports/junit.xml
- run:
name: run Reactor tests
command:
- pytest tests/test_Reactor.py -v --cov=paramak --cov-append --cov-report term --cov-report xml --junitxml=test-reports/junit.xml
+ pytest tests/test_reactor.py -v --cov=paramak --cov-append --cov-report term --cov-report xml --junitxml=test-reports/junit.xml
- run:
name: run parametric_shapes tests
diff --git a/.github/workflows/ci_with_install.yml b/.github/workflows/ci_with_install.yml
index 6bbbc4f46..627d30297 100644
--- a/.github/workflows/ci_with_install.yml
+++ b/.github/workflows/ci_with_install.yml
@@ -26,4 +26,3 @@ jobs:
- name: run tests
run: |
bash run_tests.sh
- curl -s https://codecov.io/bash
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
deleted file mode 100644
index 8f87c447d..000000000
--- a/azure-pipelines.yml
+++ /dev/null
@@ -1,29 +0,0 @@
-# Docker
-# Build a Docker image
-# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
-
-trigger:
-- develop
-
-resources:
-- repo: self
-
-variables:
- tag: '$(Build.BuildId)'
-
-stages:
-- stage: Build
- displayName: Build image
- jobs:
- - job: Build
- displayName: Build
- pool:
- vmImage: 'ubuntu-latest'
- steps:
- - task: Docker@2
- displayName: Build an image
- inputs:
- command: build
- dockerfile: '$(Build.SourcesDirectory)/Dockerfile'
- tags: |
- $(tag)
\ No newline at end of file
diff --git a/conda/meta.yaml b/conda/meta.yaml
index 5b180272c..68c0b1a6b 100644
--- a/conda/meta.yaml
+++ b/conda/meta.yaml
@@ -1,9 +1,9 @@
{% set name = "paramak" %}
-{% set version = "0.2.3" %}
+{% set data = load_setup_py_data() %}
package:
name: "{{ name|lower }}"
- version: "{{ version }}"
+ version: {{ data.get('version') }}
source:
path: ..
@@ -14,7 +14,7 @@ build:
requirements:
build:
- - python 3.8
+ - python {{ python }}
- setuptools
run:
- cadquery
@@ -27,10 +27,12 @@ requirements:
- python
- scipy
- sympy
- - remove_dagmc_tags
- nbformat
- nbconvert
- # - jupyter-cadquery
+ - ipywidgets
+ - remove_dagmc_tags
+ - moab
+ # - jupyter-cadquery not avaialbe on conda
test:
imports:
@@ -46,16 +48,25 @@ test:
- tests/
- examples/
commands:
- - pytest -v
+ - pytest -v tests/test_example_components.py
+ - pytest -v tests/test_example_reactors.py
+ - pytest -v tests/test_example_shapes.py
+ - pytest -v tests/test_parametric_components
+ - pytest -v tests/test_parametric_reactors
+ - pytest -v tests/test_parametric_shapes
+ - pytest -v tests/test_reactor.py
+ - pytest -v tests/test_shape.py
+ - pytest -v tests/test_utils.py
+
about:
- home: "https://github.com/ukaea/paramak"
+ home: "https://github.com/fusion-energy/paramak"
license: MIT
license_family: MIT
license_file: LICENSE.txt
summary: "Create 3D fusion reactor CAD models based on input parameters"
doc_url: https://paramak.readthedocs.io/
- dev_url: https://github.com/ukaea/paramak
+ dev_url: https://github.com/fusion-energy/paramak
summary: Paramak - parameter driven fusion reactor model creation
extra:
diff --git a/conda_build.sh b/conda_build.sh
index 0d0c64f62..e127a56be 100644
--- a/conda_build.sh
+++ b/conda_build.sh
@@ -1,38 +1,40 @@
#assumes anaconda-client and conda-build have been installed
-# conda install anaconda-client
-# conda install conda-build
+# conda install -y anaconda-client
+# conda install -y conda-build
# anaconda login
-pkg='paramak'
-array=( 3.6 3.7 3.8 )
+rm -rf /tmp/conda-build
mkdir -p /tmp/conda-build
rm -rf /tmp/conda-build
-for i in "${array[@]}"
-do
- conda-build conda/ -c cadquery -c conda-forge --croot /tmp/conda-build --python $i
- # conda build conda/meta.yaml -c cadquery -c conda-forge --croot /tmp/cbld
-done
-
-
-# # convert package to other platforms
-platforms=( osx-64 linux-32 linux-64 win-32 win-64 )
-platforms=( linux-64 )
-find /tmp/conda-build/linux-64/ -name *.tar.bz2 | while read file
-do
- echo $file
- #conda convert --platform all $file -o $HOME/conda-bld/
- for platform in "${platforms[@]}"
- do
- conda convert --platform $platform $file -o /tmp/conda-build/
- done
-done
-
-
-find /tmp/conda-build/ -name *.tar.bz2 | while read file
-do
- echo $file
- anaconda upload $file
-done
+
+# VERSION=$(echo $GITHUB_REF | sed 's#.*/v##')
+VERSION=0.3.2
+PLACEHOLDER='version="develop"'
+VERSION_FILE='setup.py'
+# Grep checks that the placeholder is in the file. If grep doesn't find
+# the placeholder then it exits with exit code 1 and github actions fails.
+grep "$PLACEHOLDER" "$VERSION_FILE"
+sed -i "s/$PLACEHOLDER/version=\"${VERSION}\"/g" "$VERSION_FILE"
+
+conda-build conda/ -c cadquery -c conda-forge --croot /tmp/conda-build
+
+# converting using all includes quite a few oxs and linux versions (arm arch etc)
+# conda convert /tmp/conda-build/linux-64/*.tar.bz2 --platform all -o /tmp/conda-build
+
+# option for converting package to specified platforms
+# platforms=( osx-64 linux-32 linux-64 win-32 win-64 )
+# find /tmp/conda-build/linux-64/ -name *.tar.bz2 | while read file
+# do
+# echo $file
+# for platform in "${platforms[@]}"
+# do
+# conda convert --platform $platform $file -o /tmp/conda-build/
+# done
+# done
+
+anaconda upload -f /tmp/conda-build/*/*.tar.bz2
+
+sed -i "s/version=\"${VERSION}\"/$PLACEHOLDER/g" "$VERSION_FILE"
diff --git a/conda_build_config.yaml b/conda_build_config.yaml
index 5924f6344..729a21e87 100644
--- a/conda_build_config.yaml
+++ b/conda_build_config.yaml
@@ -1,4 +1,6 @@
python:
- 3.8
+ - 3.7
+ - 3.6
cadquery:
- 2.1
diff --git a/docs/source/conf.py b/docs/source/conf.py
index a1133597b..d13851254 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -35,7 +35,7 @@
# If your documentation needs a minimal Sphinx version, state it here.
#
-needs_sphinx = '3.5.4'
+needs_sphinx = '4.1.2'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
@@ -188,3 +188,5 @@
# -- Extension configuration -------------------------------------------------
+
+html_favicon = 'favicon.ico'
diff --git a/docs/source/favicon.ico b/docs/source/favicon.ico
new file mode 100644
index 000000000..f8aa2c31f
Binary files /dev/null and b/docs/source/favicon.ico differ
diff --git a/docs/source/paramak.install.rst b/docs/source/paramak.install.rst
index 53d2bc85b..c4d4dda6b 100644
--- a/docs/source/paramak.install.rst
+++ b/docs/source/paramak.install.rst
@@ -6,76 +6,80 @@ Installation
Prerequisites
-------------
-To use the paramak tool you will need Python 3 installed using Anaconda or
-Miniconda
+To use the paramak tool you will need Python 3 installed using Miniconda or
+Anaconda
-* `Anaconda `_
-* `Miniconda `_
-Once you have Anaconda or MiniConda installed then CadQuery can be installed
-into a new enviroment. A more detailed description of installing Cadquery 2 can
-be found here:
-
-* `Cadquery 2 installation `_
+* `Miniconda `_
+* `Anaconda `_
+Once you have Anaconda or MiniConda installed then create a new enviroment
+(Python 3.6, 3.7 or 3.8 are supported).
-First create a new enviroment.
-.. code-block:: python
+.. code-block:: bash
conda create --name paramak_env python=3.8
Then activate the new enviroment.
-.. code-block:: python
+.. code-block:: bash
conda activate paramak_env
-Then install CadQuery.
+Then install the Paramak.
-.. code-block:: python
+.. code-block:: bash
- conda install -c conda-forge -c cadquery cadquery=2.1
+ conda install -c fusion-energy -c cadquery -c conda-forge paramak
-Now you are ready to install the Paramak
+Now you should be ready to import paramak from your new python enviroment.
+Optional neutronics install
+---------------------------
-System Installation
--------------------
+You can also install optional dependencies that add neutronics capabilities to
+the paramak. This will install neutronics_material_maker, OpenMC and DAGMC.
+`More details `_
-The quickest way to install the Paramak is to use pip. In the terminal type...
+Developer Installation
+----------------------
-.. code-block:: bash
+If you want to contribute to the paramak or then you might want to install the
+package using setup tools.
- pip install paramak
+Download and install MiniConda, create a new python enviroment and activate the
+enviroment as covered in the installation procedure above.
-Alternatively you can download the repository using the `download link `_ or clone the repository using:
+Then install CadQuery.
.. code-block:: bash
- git clone https://github.com/fusion-energy/paramak.git
+ conda install -c conda-forge -c cadquery cadquery=2.1
-Navigate to the paramak repository and within the terminal install the paramak
-package and the dependencies using pip3.
+
+Then install moab.
.. code-block:: bash
- cd paramak
- pip install .
+ conda install -c conda-forge moab
+
-Alternatively you can install the paramak with the following command.
+Then clone the repository
.. code-block:: bash
- python setup.py install
+ git clone https://github.com/fusion-energy/paramak.git
-You can also install optional dependencies that add some neutronics
-capabilities to the paramak. This will install neutronics_material_maker and
-parametric_plasma_source. In addition to this you would need DAGMC, OpenMC,
-MOAB and Trelis / Cubit.
-`More details `_
+Navigate to the paramak repository and within the terminal install the paramak
+package and the dependencies using pip with e -e (developer option).
+
+.. code-block:: bash
+
+ cd paramak
+ pip install -e .
Docker Image Installation
diff --git a/environment.yml b/environment.yml
index 350c33fc2..5c2f65fcd 100644
--- a/environment.yml
+++ b/environment.yml
@@ -1,8 +1,8 @@
name: docs-environment
channels:
- - cadquery
- conda-forge
+ - cadquery
dependencies:
- cadquery=2.1
@@ -12,12 +12,12 @@ dependencies:
- numpy
- matplotlib
- pillow
- - moab
+ - moab=5.3.0
+ - remove_dagmc_tags
- pip:
- - remove_dagmc_tags
- sympy
- plasmaboundaries
- sphinx-autodoc-typehints
- sphinxcadquery
- defusedxml
-
\ No newline at end of file
+ - jupyter-cadquery
diff --git a/examples/example_parametric_components/make_varible_offset_firstwall.ipynb b/examples/example_parametric_components/make_varible_offset_firstwall.ipynb
index 65447a946..02098fb94 100644
--- a/examples/example_parametric_components/make_varible_offset_firstwall.ipynb
+++ b/examples/example_parametric_components/make_varible_offset_firstwall.ipynb
@@ -3,8 +3,6 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
- "outputs": [],
"source": [
"\n",
"from matplotlib.pyplot import plasma\n",
@@ -50,18 +48,23 @@
" filename=filename,\n",
" projectionDir=(5,-5,0),\n",
" showHidden=True,\n",
- " )\n",
- "\n",
- "subprocess.check_call(\n",
- " [\"convert\", \"-delay\", \"40\", \"random_offset_*.svg\", \"random_offsets.gif\"])\n"
- ]
+ " )\n"
+ ],
+ "outputs": [],
+ "metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "source": [
+ "# The following command requres imagemagick installed to convert the svg files into a gif animation\n",
+ "# further details https://imagemagick.org/index.php\n",
+ "\n",
+ "# subprocess.check_call(\n",
+ "# [\"convert\", \"-delay\", \"40\", \"random_offset_*.svg\", \"random_offsets.gif\"])\n"
+ ],
"outputs": [],
- "source": []
+ "metadata": {}
}
],
"metadata": {
@@ -85,4 +88,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
-}
+}
\ No newline at end of file
diff --git a/examples/example_parametric_reactors/make_animiation.ipynb b/examples/example_parametric_reactors/make_animiation.ipynb
index bb2ee1cff..f9a585b76 100644
--- a/examples/example_parametric_reactors/make_animiation.ipynb
+++ b/examples/example_parametric_reactors/make_animiation.ipynb
@@ -2,25 +2,23 @@
"cells": [
{
"cell_type": "markdown",
- "metadata": {},
"source": [
"Creates a series of images of a ball reactor images and combines\n",
"them into gif animations using the command line tool convert, you will need to\n",
"have imagemagick installed to convert the svg images to a gif animation"
- ]
+ ],
+ "metadata": {}
},
{
"cell_type": "markdown",
- "metadata": {},
"source": [
"Makes a single reactor and exports and svg image with different view angles. Combines the svg images into a gif animation."
- ]
+ ],
+ "metadata": {}
},
{
"cell_type": "code",
"execution_count": 2,
- "metadata": {},
- "outputs": [],
"source": [
"import subprocess\n",
"\n",
@@ -29,13 +27,13 @@
"from scipy.interpolate import interp1d\n",
"\n",
"number_of_images = 5"
- ]
+ ],
+ "outputs": [],
+ "metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
- "outputs": [],
"source": [
"# allows the projection angle for the svg to be found via interpolation\n",
"\n",
@@ -86,59 +84,81 @@
" )\n",
"\n",
" print(\"made\", str(i + 1), \"models out of\", str(number_of_images))"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
+ ],
"outputs": [],
- "source": [
- "# Converts the svg files into a gif using imagemagick. You will need imagemagick installed https://imagemagick.org/index.php"
- ]
+ "metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
- "outputs": [],
"source": [
- "subprocess.check_call(\n",
- " [\"convert\", \"-delay\", \"15\", \"rotation_*.svg\", \"rotated.gif\"])\n",
+ "# Converts the svg files into a gif using imagemagick. You will need imagemagick installed https://imagemagick.org/index.php\n",
+ "# subprocess.check_call(\n",
+ "# [\"convert\", \"-delay\", \"15\", \"rotation_*.svg\", \"rotated.gif\"])\n",
"\n",
- "print(\"animation file made as saved as rotated.gif\")"
- ]
+ "# print(\"animation file made as saved as rotated.gif\")"
+ ],
+ "outputs": [],
+ "metadata": {}
},
{
"cell_type": "markdown",
- "metadata": {},
"source": [
"Makes a series of random sized reactors and exports an svg image for each one. Combines the svg images into a gif animation."
- ]
+ ],
+ "metadata": {}
},
{
"cell_type": "code",
"execution_count": 3,
- "metadata": {},
+ "source": [
+ "# makes a series of reactor models\n",
+ "for i in range(number_of_images):\n",
+ "\n",
+ " my_reactor = paramak.BallReactor(\n",
+ " inner_bore_radial_thickness=50,\n",
+ " inboard_tf_leg_radial_thickness=np.random.uniform(20, 50),\n",
+ " center_column_shield_radial_thickness=np.random.uniform(20, 60),\n",
+ " divertor_radial_thickness=50,\n",
+ " inner_plasma_gap_radial_thickness=50,\n",
+ " plasma_radial_thickness=np.random.uniform(20, 200),\n",
+ " outer_plasma_gap_radial_thickness=50,\n",
+ " firstwall_radial_thickness=5,\n",
+ " blanket_radial_thickness=np.random.uniform(10, 200),\n",
+ " blanket_rear_wall_radial_thickness=10,\n",
+ " elongation=np.random.uniform(1.3, 1.7),\n",
+ " triangularity=np.random.uniform(0.3, 0.55),\n",
+ " rotation_angle=180,\n",
+ " outboard_tf_coil_radial_thickness=100,\n",
+ " outboard_tf_coil_poloidal_thickness=50,\n",
+ " )\n",
+ "\n",
+ " my_reactor.export_svg(\n",
+ " filename=\"random_\" + str(i).zfill(4) + \".svg\",\n",
+ " showHidden=False\n",
+ " )\n",
+ "\n",
+ " print(\"made\", str(i + 1), \"models out of\", str(number_of_images))\n"
+ ],
"outputs": [
{
- "name": "stdout",
"output_type": "stream",
+ "name": "stdout",
"text": [
"pf_coil_vertical_thicknesses, pf_coil_radial_thicknesses, pf_coil_radial_position, pf_coil_vertical_position not so not making pf coils\n"
]
},
{
- "name": "stderr",
"output_type": "stream",
+ "name": "stderr",
"text": [
"/home/jshim/paramak/paramak/parametric_components/blanket_fp.py:226: UserWarning: BlanketFP: Some points with negative R coordinate have been ignored.\n",
" warnings.warn(msg)\n"
]
},
{
- "name": "stdout",
"output_type": "stream",
+ "name": "stdout",
"text": [
"Saved file as random_0000.svg\n",
"made 1 models out of 5\n",
@@ -158,47 +178,20 @@
]
}
],
- "source": [
- "# makes a series of reactor models\n",
- "for i in range(number_of_images):\n",
- "\n",
- " my_reactor = paramak.BallReactor(\n",
- " inner_bore_radial_thickness=50,\n",
- " inboard_tf_leg_radial_thickness=np.random.uniform(20, 50),\n",
- " center_column_shield_radial_thickness=np.random.uniform(20, 60),\n",
- " divertor_radial_thickness=50,\n",
- " inner_plasma_gap_radial_thickness=50,\n",
- " plasma_radial_thickness=np.random.uniform(20, 200),\n",
- " outer_plasma_gap_radial_thickness=50,\n",
- " firstwall_radial_thickness=5,\n",
- " blanket_radial_thickness=np.random.uniform(10, 200),\n",
- " blanket_rear_wall_radial_thickness=10,\n",
- " elongation=np.random.uniform(1.3, 1.7),\n",
- " triangularity=np.random.uniform(0.3, 0.55),\n",
- " rotation_angle=180,\n",
- " outboard_tf_coil_radial_thickness=100,\n",
- " outboard_tf_coil_poloidal_thickness=50,\n",
- " )\n",
- "\n",
- " my_reactor.export_svg(\n",
- " filename=\"random_\" + str(i).zfill(4) + \".svg\",\n",
- " showHidden=False\n",
- " )\n",
- "\n",
- " print(\"made\", str(i + 1), \"models out of\", str(number_of_images))\n",
- "\n",
- "subprocess.check_call(\n",
- " [\"convert\", \"-delay\", \"40\", \"random_*.svg\", \"randoms.gif\"])\n",
- "\n",
- "print(\"animation file made as saved as randoms.gif\")"
- ]
+ "metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "source": [
+ "# Converts the svg files into a gif using imagemagick. You will need imagemagick installed https://imagemagick.org/index.php\n",
+ "# subprocess.check_call(\n",
+ "# [\"convert\", \"-delay\", \"40\", \"random_*.svg\", \"randoms.gif\"])\n",
+ "\n",
+ "# print(\"animation file made as saved as randoms.gif\")"
+ ],
"outputs": [],
- "source": []
+ "metadata": {}
}
],
"metadata": {
@@ -222,4 +215,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
-}
+}
\ No newline at end of file
diff --git a/examples/example_parametric_shapes/make_can_reactor_from_points.ipynb b/examples/example_parametric_shapes/make_can_reactor_from_points.ipynb
index 16382e005..1ea9576f2 100644
--- a/examples/example_parametric_shapes/make_can_reactor_from_points.ipynb
+++ b/examples/example_parametric_shapes/make_can_reactor_from_points.ipynb
@@ -2,21 +2,18 @@
"cells": [
{
"cell_type": "markdown",
- "metadata": {},
"source": [
"\n",
"This python script demonstrates the creation of 3D volumes\n",
"from points to create an example reactor\n"
- ]
+ ],
+ "metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
- "outputs": [],
"source": [
"import paramak\n",
- "from jupyter_cadquery.cadquery import show\n",
"\n",
"plasma = paramak.Plasma(\n",
" major_radius=250,\n",
@@ -134,14 +131,16 @@
"myreactor.export_html(\"can_reactor_from_points/reactor.html\")\n",
"\n",
"myreactor.show()"
- ]
+ ],
+ "outputs": [],
+ "metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "source": [],
"outputs": [],
- "source": []
+ "metadata": {}
}
],
"metadata": {
@@ -165,4 +164,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
-}
+}
\ No newline at end of file
diff --git a/meta.yaml b/meta.yaml
deleted file mode 100644
index e609011f0..000000000
--- a/meta.yaml
+++ /dev/null
@@ -1,61 +0,0 @@
-{% set name = "paramak" %}
-{% set version = "0.0.16" %}
-
-package:
- name: "{{ name|lower }}"
- version: "{{ version }}"
-
-source:
- url: "https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz"
- sha256: 815145a891ad8cab0ddd114dcdbc879522c2b66e287ea3d5d960601510211dbd
-
-build:
- number: 0
- # script: "{{ PYTHON }} -m pip install . -vv"
-
-requirements:
- host:
- - matplotlib
- - numpy
- - pip
- - plasmaboundaries
- - plotly
- - pytest-cov
- - python
- - scipy
- - sympy
- - cadquery
- run:
- - matplotlib
- - numpy
- - plasmaboundaries
- - plotly
- - pytest-cov
- - python
- - scipy
- - sympy
- - cadquery
-
-test:
- imports:
- - paramak
- - paramak.parametric_components
- - paramak.parametric_reactors
- - paramak.parametric_shapes
- - tests
- requires:
- - pytest-cov
- - pytest-runner
-
-about:
- home: "https://github.com/ukaea/paramak"
- license: MIT
- license_family: MIT
- license_file: LICENSE.txt
- summary: "Create 3D fusion reactor CAD models based on input parameters"
- doc_url: https://paramak.readthedocs.io/
- dev_url: https://github.com/ukaea/paramak
-
-extra:
- recipe-maintainers:
- - shimwell
diff --git a/optional-requirements.txt b/optional-requirements.txt
deleted file mode 100644
index 1965e6b10..000000000
--- a/optional-requirements.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-neutronics_material_maker==0.3.2
-parametric_plasma_source
diff --git a/paramak/reactor.py b/paramak/reactor.py
index ad7b3c526..8b41124de 100644
--- a/paramak/reactor.py
+++ b/paramak/reactor.py
@@ -314,7 +314,13 @@ def show(self):
"""Shows / renders the CadQuery the 3d object in Jupyter Lab. Imports
show from jupyter_cadquery.cadquery and returns show(Reactor.solid)"""
- from jupyter_cadquery.cadquery import Part, PartGroup
+ try:
+ from jupyter_cadquery.cadquery import Part, PartGroup
+ except ImportError:
+ print('To use Shape.show() you must install jupyter_cadquery.')
+ print(
+ 'To install jupyter_cadquery type pip install jupyter_cadquery in the terminal')
+ return None
parts = []
for shape_or_compound in self.shapes_and_components:
@@ -1269,13 +1275,18 @@ def export_html_3d(
from ipywidgets.embed import embed_minimal_html
- embed_minimal_html(
- filename,
- views=[self.show().show().cq_view.renderer],
- title='Renderer'
- )
+ view = self.show()
+
+ if view is None:
+ return None
+ else:
+ embed_minimal_html(
+ filename,
+ views=[view.show().cq_view.renderer],
+ title='Renderer'
+ )
- return filename
+ return filename
def export_html(
self,
diff --git a/paramak/shape.py b/paramak/shape.py
index 242b17176..ef8cf5de8 100644
--- a/paramak/shape.py
+++ b/paramak/shape.py
@@ -680,7 +680,13 @@ def show(self):
"""Shows / renders the CadQuery the 3d object in Jupyter Lab. Imports
show from jupyter_cadquery.cadquery and returns show(Shape.solid)"""
- from jupyter_cadquery.cadquery import Part, PartGroup
+ try:
+ from jupyter_cadquery.cadquery import Part, PartGroup
+ except ImportError:
+ print('To use Shape.show() you must install jupyter_cadquery.')
+ print(
+ 'To install jupyter_cadquery type pip install jupyter_cadquery in the terminal')
+ return None
parts = []
if self.name is None:
@@ -1125,13 +1131,18 @@ def export_html_3d(
from ipywidgets.embed import embed_minimal_html
- embed_minimal_html(
- filename,
- views=[self.show().show().cq_view.renderer],
- title='Renderer'
- )
+ view = self.show()
+
+ if view is None:
+ return None
+ else:
+ embed_minimal_html(
+ filename,
+ views=[view.show().cq_view.renderer],
+ title='Renderer'
+ )
- return filename
+ return filename
def export_html(
self,
diff --git a/paramak/utils.py b/paramak/utils.py
index ea2801300..1b1445b68 100644
--- a/paramak/utils.py
+++ b/paramak/utils.py
@@ -16,7 +16,6 @@
import plotly.graph_objects as go
from cadquery import importers
from OCP.GCPnts import GCPnts_QuasiUniformDeflection
-from remove_dagmc_tags import remove_tags
import paramak
@@ -198,7 +197,12 @@ def export_vtk(
Returns:
filename of the vtk file produced
"""
-
+ try:
+ from remove_dagmc_tags import remove_tags
+ except ImportError:
+ msg = ('remove_dagmc_tags not found, export_h5m method is not '
+ 'available. To install enter conda install v into the terminal')
+ raise ImportError(msg)
path_h5m_filename = Path(h5m_filename)
if path_h5m_filename.suffix != ".h5m":
path_h5m_filename = path_h5m_filename.with_suffix(".h5m")
@@ -242,8 +246,9 @@ def define_moab_core_and_tags():
try:
from pymoab import core, types
except ImportError:
- raise ImportError(
- 'PyMoab not found, export_h5m method is not available')
+ msg = ('PyMoab not found, export_h5m method is not available. To '
+ 'install enter conda install moab into the terminal')
+ raise ImportError(msg)
# create pymoab instance
moab_core = core.Core()
diff --git a/tests/notebook_testing.py b/tests/notebook_testing.py
index 450b13403..bd32ba60e 100644
--- a/tests/notebook_testing.py
+++ b/tests/notebook_testing.py
@@ -35,4 +35,4 @@ def notebook_run(path):
else:
raise e
- return note_book, errors
+ return errors
diff --git a/tests/test_example_components.py b/tests/test_example_components.py
index 333f5c5b7..8879323a7 100644
--- a/tests/test_example_components.py
+++ b/tests/test_example_components.py
@@ -14,7 +14,7 @@ class TestExampleComponents(unittest.TestCase):
def test_jupyter_notebooks_example_parametric_components(self):
for notebook in Path().rglob("examples/example_parametric_components/*.ipynb"):
print(notebook)
- nb, errors = notebook_run(notebook)
+ errors = notebook_run(notebook)
assert errors == []
diff --git a/tests/test_example_reactors.py b/tests/test_example_reactors.py
index ecc4c0069..23a2467ff 100644
--- a/tests/test_example_reactors.py
+++ b/tests/test_example_reactors.py
@@ -17,7 +17,7 @@ def test_jupyter_notebooks_example_parametric_reactors(self):
start = time.time()
print(notebook)
- nb, errors = notebook_run(notebook)
+ errors = notebook_run(notebook)
assert errors == []
stop = time.time()
diff --git a/tests/test_example_shapes.py b/tests/test_example_shapes.py
index c6477ec23..af31d045d 100644
--- a/tests/test_example_shapes.py
+++ b/tests/test_example_shapes.py
@@ -14,7 +14,7 @@ class TestExampleShapes(unittest.TestCase):
def test_jupyter_notebooks_example_parametric_shapes(self):
for notebook in Path().rglob("examples/example_parametric_shapes/*.ipynb"):
print(notebook)
- nb, errors = notebook_run(notebook)
+ errors = notebook_run(notebook)
assert errors == []
diff --git a/tests/test_parametric_components/test_BlanketConstantThicknessArcH.py b/tests/test_parametric_components/test_blanket_constant_thickness_arch.py
similarity index 100%
rename from tests/test_parametric_components/test_BlanketConstantThicknessArcH.py
rename to tests/test_parametric_components/test_blanket_constant_thickness_arch.py
diff --git a/tests/test_parametric_components/test_BlanketConstantThicknessArcV.py b/tests/test_parametric_components/test_blanket_constant_thickness_arcv.py
similarity index 100%
rename from tests/test_parametric_components/test_BlanketConstantThicknessArcV.py
rename to tests/test_parametric_components/test_blanket_constant_thickness_arcv.py
diff --git a/tests/test_parametric_components/test_BlanketCutterParallels.py b/tests/test_parametric_components/test_blanket_cutter_parallels.py
similarity index 100%
rename from tests/test_parametric_components/test_BlanketCutterParallels.py
rename to tests/test_parametric_components/test_blanket_cutter_parallels.py
diff --git a/tests/test_parametric_components/test_BlanketCutterStar.py b/tests/test_parametric_components/test_blanket_cutter_star.py
similarity index 100%
rename from tests/test_parametric_components/test_BlanketCutterStar.py
rename to tests/test_parametric_components/test_blanket_cutter_star.py
diff --git a/tests/test_parametric_components/test_BlanketFP.py b/tests/test_parametric_components/test_blanket_fp.py
similarity index 100%
rename from tests/test_parametric_components/test_BlanketFP.py
rename to tests/test_parametric_components/test_blanket_fp.py
diff --git a/tests/test_parametric_components/test_CapsuleVacuumVessel.py b/tests/test_parametric_components/test_capsule_vacuum_vessel.py
similarity index 100%
rename from tests/test_parametric_components/test_CapsuleVacuumVessel.py
rename to tests/test_parametric_components/test_capsule_vacuum_vessel.py
diff --git a/tests/test_parametric_components/test_CenterColumnShieldCircular.py b/tests/test_parametric_components/test_center_column_shield_circular.py
similarity index 100%
rename from tests/test_parametric_components/test_CenterColumnShieldCircular.py
rename to tests/test_parametric_components/test_center_column_shield_circular.py
diff --git a/tests/test_parametric_components/test_CenterColumnShieldCylinder.py b/tests/test_parametric_components/test_center_column_shield_cylinder.py
similarity index 100%
rename from tests/test_parametric_components/test_CenterColumnShieldCylinder.py
rename to tests/test_parametric_components/test_center_column_shield_cylinder.py
diff --git a/tests/test_parametric_components/test_CenterColumnShieldFlatTopCircular.py b/tests/test_parametric_components/test_center_column_shield_flat_top_circular.py
similarity index 100%
rename from tests/test_parametric_components/test_CenterColumnShieldFlatTopCircular.py
rename to tests/test_parametric_components/test_center_column_shield_flat_top_circular.py
diff --git a/tests/test_parametric_components/test_CenterColumnShieldFlatTopHyperbola.py b/tests/test_parametric_components/test_center_column_shield_flat_top_hyperbola.py
similarity index 100%
rename from tests/test_parametric_components/test_CenterColumnShieldFlatTopHyperbola.py
rename to tests/test_parametric_components/test_center_column_shield_flat_top_hyperbola.py
diff --git a/tests/test_parametric_components/test_CenterColumnShieldHyperbola.py b/tests/test_parametric_components/test_center_column_shield_hyperbola.py
similarity index 100%
rename from tests/test_parametric_components/test_CenterColumnShieldHyperbola.py
rename to tests/test_parametric_components/test_center_column_shield_hyperbola.py
diff --git a/tests/test_parametric_components/test_CenterColumnShieldPlasmaHyperbola.py b/tests/test_parametric_components/test_center_column_shield_plasma_hyperbola.py
similarity index 100%
rename from tests/test_parametric_components/test_CenterColumnShieldPlasmaHyperbola.py
rename to tests/test_parametric_components/test_center_column_shield_plasma_hyperbola.py
diff --git a/tests/test_parametric_components/test_CoolantChannelRingCurved.py b/tests/test_parametric_components/test_coolant_channel_ring_curved.py
similarity index 100%
rename from tests/test_parametric_components/test_CoolantChannelRingCurved.py
rename to tests/test_parametric_components/test_coolant_channel_ring_curved.py
diff --git a/tests/test_parametric_components/test_CoolantChannelRingStraight.py b/tests/test_parametric_components/test_coolant_channel_ring_straight.py
similarity index 100%
rename from tests/test_parametric_components/test_CoolantChannelRingStraight.py
rename to tests/test_parametric_components/test_coolant_channel_ring_straight.py
diff --git a/tests/test_parametric_components/test_CuttingWedgeFS.py b/tests/test_parametric_components/test_cutting_wedge_fs.py
similarity index 100%
rename from tests/test_parametric_components/test_CuttingWedgeFS.py
rename to tests/test_parametric_components/test_cutting_wedge_fs.py
diff --git a/tests/test_parametric_components/test_DivertorITER.py b/tests/test_parametric_components/test_divertor_iter.py
similarity index 100%
rename from tests/test_parametric_components/test_DivertorITER.py
rename to tests/test_parametric_components/test_divertor_iter.py
diff --git a/tests/test_parametric_components/test_DivertorITERNoDome.py b/tests/test_parametric_components/test_divertor_iter_no_dome.py
similarity index 100%
rename from tests/test_parametric_components/test_DivertorITERNoDome.py
rename to tests/test_parametric_components/test_divertor_iter_no_dome.py
diff --git a/tests/test_parametric_components/test_ExtrudeRectangle.py b/tests/test_parametric_components/test_extrude_rectangle.py
similarity index 100%
rename from tests/test_parametric_components/test_ExtrudeRectangle.py
rename to tests/test_parametric_components/test_extrude_rectangle.py
diff --git a/tests/test_parametric_components/test_HexagonPin.py b/tests/test_parametric_components/test_hexagon_pin.py
similarity index 100%
rename from tests/test_parametric_components/test_HexagonPin.py
rename to tests/test_parametric_components/test_hexagon_pin.py
diff --git a/tests/test_parametric_components/test_InboardFirstwallFCCS.py b/tests/test_parametric_components/test_inboard_firstwall_fccs.py
similarity index 100%
rename from tests/test_parametric_components/test_InboardFirstwallFCCS.py
rename to tests/test_parametric_components/test_inboard_firstwall_fccs.py
diff --git a/tests/test_Reactor.py b/tests/test_reactor.py
similarity index 99%
rename from tests/test_Reactor.py
rename to tests/test_reactor.py
index 8627c450a..0f8a8a46d 100644
--- a/tests/test_Reactor.py
+++ b/tests/test_reactor.py
@@ -1030,8 +1030,9 @@ def test_export_3d_html(self):
test_reactor = paramak.Reactor([test_shape])
os.system("rm filename.html")
- test_reactor.export_html_3d('filename.html')
- assert Path("filename.html").exists() is True
+ filename = test_reactor.export_html_3d('filename.html')
+ if filename is not None:
+ assert Path("filename.html").exists() is True
def test_tet_meshes_error(self):
test_shape = paramak.RotateStraightShape(
diff --git a/tests/test_Shape.py b/tests/test_shape.py
similarity index 99%
rename from tests/test_Shape.py
rename to tests/test_shape.py
index c1f75113e..716ef1d2a 100644
--- a/tests/test_Shape.py
+++ b/tests/test_shape.py
@@ -469,8 +469,9 @@ def test_export_3d_html(self):
)
os.system("rm filename.html")
- test_shape.export_html_3d('filename.html')
- assert Path("filename.html").exists() is True
+ filename = test_shape.export_html_3d('filename.html')
+ if filename is not None:
+ assert Path("filename.html").exists() is True
def test_invalid_stp_filename(self):
"""Checks ValueError is raised when invalid stp filenames are used."""
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 9d02db665..f48370f4d 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -20,23 +20,23 @@ class TestUtilityFunctions(unittest.TestCase):
# make_watertight command line tool is to be replaced with watertight when outputting from cubit
# make_watertight is a dagmc tool so it is not included in the paramak (geometry only)
# dagmc is included in paramak-neutronics
- def test_make_watertight_cmd_with_example_dagmc_file(self):
- """downloads a h5m and makes it watertight, checks the the watertight
- file is produced."""
+ # def test_make_watertight_cmd_with_example_dagmc_file(self):
+ # """downloads a h5m and makes it watertight, checks the the watertight
+ # file is produced."""
- os.system('rm *.h5m')
+ # os.system('rm *.h5m')
- url = 'https://github.com/Shimwell/fusion_example_for_openmc_using_paramak/raw/main/dagmc.h5m'
- urllib.request.urlretrieve(url, 'not_watertight_dagmc.h5m')
+ # url = 'https://github.com/Shimwell/fusion_example_for_openmc_using_paramak/raw/main/dagmc.h5m'
+ # urllib.request.urlretrieve(url, 'not_watertight_dagmc.h5m')
- output_filename = paramak.utils.make_watertight(
- input_filename="not_watertight_dagmc.h5m",
- output_filename="watertight_dagmc.h5m"
- )
+ # output_filename = paramak.utils.make_watertight(
+ # input_filename="not_watertight_dagmc.h5m",
+ # output_filename="watertight_dagmc.h5m"
+ # )
- assert Path("not_watertight_dagmc.h5m").exists() is True
- assert output_filename == "watertight_dagmc.h5m"
- assert Path("watertight_dagmc.h5m").exists() is True
+ # assert Path("not_watertight_dagmc.h5m").exists() is True
+ # assert output_filename == "watertight_dagmc.h5m"
+ # assert Path("watertight_dagmc.h5m").exists() is True
def test_export_vtk_without_h5m_raises_error(self):
"""exports a vtk file when shapes_and_components is set to a string"""