fusion-energy / neutronics-workshop

A workshop covering a range of fusion relevant analysis and simulations with OpenMC, DAGMC, Paramak and other open source fusion neutronics tools
MIT License
123 stars 52 forks source link

current bugs #234

Closed shimwell closed 1 month ago

shimwell commented 1 year ago

with the latest docker image there are a few api changes in openmc to accommodate

root ➜ / $ pytest tests
======================================== test session starts ========================================
platform linux -- Python 3.11.2, pytest-7.4.0, pluggy-1.2.0
rootdir: /tests
plugins: anyio-3.7.1
collected 18 items                                                                                  

tests/test_task_1.py .                                                                        [  5%]
tests/test_task_10.py .                                                                       [ 11%]
tests/test_task_11.py .                                                                       [ 16%]
tests/test_task_12.py F                                                                       [ 22%]
tests/test_task_13.py F                                                                       [ 27%]
tests/test_task_14.py .                                                                       [ 33%]
tests/test_task_15.py F                                                                       [ 38%]
tests/test_task_16.py F                                                                       [ 44%]
tests/test_task_17.py .                                                                       [ 50%]
tests/test_task_18.py .                                                                       [ 55%]
tests/test_task_2.py .                                                                        [ 61%]
tests/test_task_3.py F                                                                        [ 66%]
tests/test_task_4.py .                                                                        [ 72%]
tests/test_task_5.py .                                                                        [ 77%]
tests/test_task_6.py .                                                                        [ 83%]
tests/test_task_7.py .                                                                        [ 88%]
tests/test_task_8.py F                                                                        [ 94%]
tests/test_task_9.py .                                                                        [100%]

============================================= FAILURES ==============================================
___________________________________________ test_task_12 ____________________________________________

    def test_task_12():
        for notebook in Path().rglob("tasks/task_16_*/*.ipynb"):
            print(notebook)
>           nb, errors = _notebook_run(notebook)

tests/test_task_12.py:45: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_task_12.py:37: in _notebook_run
    raise e
tests/test_task_12.py:31: in _notebook_run
    ep.preprocess(nb, {'metadata': {'path': this_file_directory}})
opt/venv/lib/python3.11/site-packages/nbconvert/preprocessors/execute.py:89: in preprocess
    self.preprocess_cell(cell, resources, index)
opt/venv/lib/python3.11/site-packages/nbconvert/preprocessors/execute.py:110: in preprocess_cell
    cell = self.execute_cell(cell, index, store_history=True)
opt/venv/lib/python3.11/site-packages/nbclient/util.py:84: in wrapped
    return just_run(coro(*args, **kwargs))
opt/venv/lib/python3.11/site-packages/nbclient/util.py:62: in just_run
    return loop.run_until_complete(coro)
usr/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
    return future.result()
opt/venv/lib/python3.11/site-packages/nbclient/client.py:965: in async_execute_cell
    await self._check_raise_for_error(cell, cell_index, exec_reply)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <nbconvert.preprocessors.execute.ExecutePreprocessor object at 0x7f3c201a6fd0>
cell = {'cell_type': 'code', 'execution_count': 1, 'metadata': {'execution': {'iopub.status.busy': '2023-08-06T19:52:58.47606...ue, exist_ok=True)\n    with open(filename, mode="w", encoding="utf-8") as f:\n        json.dump(result, f, indent=4)'}
cell_index = 1
exec_reply = {'buffers': [], 'content': {'ename': 'ModuleNotFoundError', 'engine_info': {'engine_id': -1, 'engine_uuid': 'f7ab179a-...e, 'engine': 'f7ab179a-839c-4a6f-ac8c-fb8f5cbaee2d', 'started': '2023-08-06T19:52:58.476783Z', 'status': 'error'}, ...}

    async def _check_raise_for_error(
        self, cell: NotebookNode, cell_index: int, exec_reply: t.Optional[t.Dict]
    ) -> None:

        if exec_reply is None:
            return None

        exec_reply_content = exec_reply['content']
        if exec_reply_content['status'] != 'error':
            return None

        cell_allows_errors = (not self.force_raise_errors) and (
            self.allow_errors
            or exec_reply_content.get('ename') in self.allow_error_names
            or "raises-exception" in cell.metadata.get("tags", [])
        )
        await run_hook(self.on_cell_error, cell=cell, cell_index=cell_index)
        if not cell_allows_errors:
>           raise CellExecutionError.from_cell_and_msg(cell, exec_reply_content)
E           nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
E           ------------------
E           # Install dependencies
E           
E           import json
E           import numpy as np
E           import pandas as pd
E           import adaptive
E           import holoviews
E           import ipywidgets
E           import nest_asyncio
E           import plotly.graph_objects as go
E           
E           from tqdm import tqdm
E           from pathlib import Path
E           from skopt import gp_minimize
E           from skopt.utils import dump, load
E           from scipy.interpolate import griddata
E           
E           from openmc_model import objective
E           
E           adaptive.notebook_extension()
E           nest_asyncio.apply()
E           
E           # method for saving results in json file
E           def output_result(filepath, result):
E               filename = filepath
E               Path(filename).parent.mkdir(parents=True, exist_ok=True)
E               with open(filename, mode="w", encoding="utf-8") as f:
E                   json.dump(result, f, indent=4)
E           ------------------
E           
E           ---------------------------------------------------------------------------
E           ModuleNotFoundError                       Traceback (most recent call last)
E           Cell In[1], line 18
E                15 from skopt.utils import dump, load
E                16 from scipy.interpolate import griddata
E           ---> 18 from openmc_model import objective
E                20 adaptive.notebook_extension()
E                21 nest_asyncio.apply()
E           
E           ModuleNotFoundError: No module named 'openmc_model'
E           ModuleNotFoundError: No module named 'openmc_model'

opt/venv/lib/python3.11/site-packages/nbclient/client.py:862: CellExecutionError
--------------------------------------- Captured stdout call ----------------------------------------
tasks/task_16_parameter_study_optimisation/parameter_study_optimisation.ipynb
--------------------------------------- Captured stderr call ----------------------------------------
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
___________________________________________ test_task_13 ____________________________________________

    def test_task_13():
        for notebook in Path().rglob("tasks/task_13_*/*.ipynb"):
            print(f'tests {notebook}')
>           nb, errors = _notebook_run(notebook)

tests/test_task_13.py:41: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_task_13.py:34: in _notebook_run
    raise e
tests/test_task_13.py:29: in _notebook_run
    ep.preprocess(nb, {'metadata': {'path': this_file_directory}})
opt/venv/lib/python3.11/site-packages/nbconvert/preprocessors/execute.py:89: in preprocess
    self.preprocess_cell(cell, resources, index)
opt/venv/lib/python3.11/site-packages/nbconvert/preprocessors/execute.py:110: in preprocess_cell
    cell = self.execute_cell(cell, index, store_history=True)
opt/venv/lib/python3.11/site-packages/nbclient/util.py:84: in wrapped
    return just_run(coro(*args, **kwargs))
opt/venv/lib/python3.11/site-packages/nbclient/util.py:62: in just_run
    return loop.run_until_complete(coro)
usr/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
    return future.result()
opt/venv/lib/python3.11/site-packages/nbclient/client.py:965: in async_execute_cell
    await self._check_raise_for_error(cell, cell_index, exec_reply)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <nbconvert.preprocessors.execute.ExecutePreprocessor object at 0x7f3c1af20190>
cell = {'cell_type': 'code', 'execution_count': 6, 'id': 'a51cd616-b0ff-4322-82db-4608f3082611', 'metadata': {'execution': {'... [surface_filter, energy_filter]\nouter_surface_spectra_tally.id = 12\nmy_tallies.append(outer_surface_spectra_tally)'}
cell_index = 11
exec_reply = {'buffers': [], 'content': {'ename': 'TypeError', 'engine_info': {'engine_id': -1, 'engine_uuid': 'dc1961d4-35e6-4d26-...e, 'engine': 'dc1961d4-35e6-4d26-9a15-e48b55596a68', 'started': '2023-08-06T19:53:16.734360Z', 'status': 'error'}, ...}

    async def _check_raise_for_error(
        self, cell: NotebookNode, cell_index: int, exec_reply: t.Optional[t.Dict]
    ) -> None:

        if exec_reply is None:
            return None

        exec_reply_content = exec_reply['content']
        if exec_reply_content['status'] != 'error':
            return None

        cell_allows_errors = (not self.force_raise_errors) and (
            self.allow_errors
            or exec_reply_content.get('ename') in self.allow_error_names
            or "raises-exception" in cell.metadata.get("tags", [])
        )
        await run_hook(self.on_cell_error, cell=cell, cell_index=cell_index)
        if not cell_allows_errors:
>           raise CellExecutionError.from_cell_and_msg(cell, exec_reply_content)
E           nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
E           ------------------
E           my_tallies = openmc.Tallies()
E           
E           # This spherical mesh tally is used for generating the weight windows.
E           mesh = openmc.SphericalMesh()
E           mesh.r_grid = np.linspace(0, outer_surface.r, 5000)
E           mesh_filter = openmc.MeshFilter(mesh)
E           flux_tally_for_ww = openmc.Tally(name="flux tally")
E           flux_tally_for_ww.filters = [mesh_filter]
E           flux_tally_for_ww.scores = ["flux"]
E           flux_tally_for_ww.id = 42
E           my_tallies.append(flux_tally_for_ww)
E           
E           # This spectrum tally is on the outer shell and shows then energy distribution
E           # of neutrons present in the cell.
E           energy_filter = openmc.EnergyFilter.from_group_structure('CCFE-709')
E           surface_filter = openmc.CellFilter(cell_2)
E           outer_surface_spectra_tally = openmc.Tally(name='outer_surface_spectra_tally')
E           outer_surface_spectra_tally.scores = ['current']
E           outer_surface_spectra_tally.filters = [surface_filter, energy_filter]
E           outer_surface_spectra_tally.id = 12
E           my_tallies.append(outer_surface_spectra_tally)
E           ------------------
E           
E           ---------------------------------------------------------------------------
E           TypeError                                 Traceback (most recent call last)
E           Cell In[6], line 4
E                 1 my_tallies = openmc.Tallies()
E                 3 # This spherical mesh tally is used for generating the weight windows.
E           ----> 4 mesh = openmc.SphericalMesh()
E                 5 mesh.r_grid = np.linspace(0, outer_surface.r, 5000)
E                 6 mesh_filter = openmc.MeshFilter(mesh)
E           
E           TypeError: SphericalMesh.__init__() missing 1 required positional argument: 'r_grid'
E           TypeError: SphericalMesh.__init__() missing 1 required positional argument: 'r_grid'

opt/venv/lib/python3.11/site-packages/nbclient/client.py:862: CellExecutionError
--------------------------------------- Captured stdout call ----------------------------------------
tests tasks/task_13_variance_reduction/1_shielded_room_survival_biasing.ipynb
tests tasks/task_13_variance_reduction/4_sphere_iterative_per_batch_ww.ipynb
--------------------------------------- Captured stderr call ----------------------------------------
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
___________________________________________ test_task_14 ____________________________________________

    def test_task_14():
        for notebook in Path().rglob("tasks/task_15_*/*.ipynb"):
            print(notebook)
>           nb, errors = _notebook_run(notebook)

tests/test_task_15.py:45: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_task_15.py:37: in _notebook_run
    raise e
tests/test_task_15.py:31: in _notebook_run
    ep.preprocess(nb, {'metadata': {'path': this_file_directory}})
opt/venv/lib/python3.11/site-packages/nbconvert/preprocessors/execute.py:89: in preprocess
    self.preprocess_cell(cell, resources, index)
opt/venv/lib/python3.11/site-packages/nbconvert/preprocessors/execute.py:110: in preprocess_cell
    cell = self.execute_cell(cell, index, store_history=True)
opt/venv/lib/python3.11/site-packages/nbclient/util.py:84: in wrapped
    return just_run(coro(*args, **kwargs))
opt/venv/lib/python3.11/site-packages/nbclient/util.py:62: in just_run
    return loop.run_until_complete(coro)
usr/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
    return future.result()
opt/venv/lib/python3.11/site-packages/nbclient/client.py:965: in async_execute_cell
    await self._check_raise_for_error(cell, cell_index, exec_reply)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <nbconvert.preprocessors.execute.ExecutePreprocessor object at 0x7f3c21ad0ad0>
cell = {'cell_type': 'code', 'execution_count': 1, 'metadata': {'execution': {'iopub.status.busy': '2023-08-06T19:58:03.01214... plot_simulation_results(filtered_results_df)\n    fig = go.Figure()\n    fig.add_trace(sample_trace)\n    return fig'}
cell_index = 1
exec_reply = {'buffers': [], 'content': {'ename': 'ModuleNotFoundError', 'engine_info': {'engine_id': -1, 'engine_uuid': '9cbe83ce-...e, 'engine': '9cbe83ce-6661-448f-ae90-24c6d1b76239', 'started': '2023-08-06T19:58:03.012816Z', 'status': 'error'}, ...}

    async def _check_raise_for_error(
        self, cell: NotebookNode, cell_index: int, exec_reply: t.Optional[t.Dict]
    ) -> None:

        if exec_reply is None:
            return None

        exec_reply_content = exec_reply['content']
        if exec_reply_content['status'] != 'error':
            return None

        cell_allows_errors = (not self.force_raise_errors) and (
            self.allow_errors
            or exec_reply_content.get('ename') in self.allow_error_names
            or "raises-exception" in cell.metadata.get("tags", [])
        )
        await run_hook(self.on_cell_error, cell=cell, cell_index=cell_index)
        if not cell_allows_errors:
>           raise CellExecutionError.from_cell_and_msg(cell, exec_reply_content)
E           nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
E           ------------------
E           # import dependencies for sampling and plotting
E           
E           import uuid
E           from pathlib import Path
E           import json
E           import pandas as pd
E           import adaptive
E           import numpy as np
E           import plotly.graph_objects as go
E           from tqdm import tqdm
E           from plotly.subplots import make_subplots
E           from skopt.sampler import Halton
E           from skopt.space import Space
E           from skopt.sampler import Grid
E           
E           import nest_asyncio
E           adaptive.notebook_extension()
E           nest_asyncio.apply()
E           
E           # imports pre-defined neutronics model and plotting tools
E           from openmc_model import * # this is where find_tbr_hcpb is
E           from plotting_tools import read_in_data, plot_simulation_results, plot_interpolated_results
E           
E           # method for saving results in json file
E           def output_result(result):
E               filename = "outputs/" + str(uuid.uuid4()) + ".json"
E               Path(filename).parent.mkdir(parents=True, exist_ok=True)
E               with open(filename, mode="w", encoding="utf-8") as f:
E                   json.dump(result, f, indent=4)
E                   
E           # method for showing results
E           def show_results(filtered_results_df):
E               sample_trace = plot_simulation_results(filtered_results_df)
E               fig = go.Figure()
E               fig.add_trace(sample_trace)
E               return fig
E           ------------------
E           
E           ---------------------------------------------------------------------------
E           ModuleNotFoundError                       Traceback (most recent call last)
E           Cell In[1], line 21
E                18 nest_asyncio.apply()
E                20 # imports pre-defined neutronics model and plotting tools
E           ---> 21 from openmc_model import * # this is where find_tbr_hcpb is
E                22 from plotting_tools import read_in_data, plot_simulation_results, plot_interpolated_results
E                24 # method for saving results in json file
E           
E           ModuleNotFoundError: No module named 'openmc_model'
E           ModuleNotFoundError: No module named 'openmc_model'

opt/venv/lib/python3.11/site-packages/nbclient/client.py:862: CellExecutionError
--------------------------------------- Captured stdout call ----------------------------------------
tasks/task_15_parameter_study_sampling/1_techniques_for_sampling_design_space.ipynb
--------------------------------------- Captured stderr call ----------------------------------------
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
___________________________________________ test_task_14 ____________________________________________

    def test_task_14():
        for notebook in Path().rglob("tasks/task_16_*/*.ipynb"):
            print(notebook)
>           nb, errors = _notebook_run(notebook)

tests/test_task_16.py:45: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_task_16.py:37: in _notebook_run
    raise e
tests/test_task_16.py:31: in _notebook_run
    ep.preprocess(nb, {'metadata': {'path': this_file_directory}})
opt/venv/lib/python3.11/site-packages/nbconvert/preprocessors/execute.py:89: in preprocess
    self.preprocess_cell(cell, resources, index)
opt/venv/lib/python3.11/site-packages/nbconvert/preprocessors/execute.py:110: in preprocess_cell
    cell = self.execute_cell(cell, index, store_history=True)
opt/venv/lib/python3.11/site-packages/nbclient/util.py:84: in wrapped
    return just_run(coro(*args, **kwargs))
opt/venv/lib/python3.11/site-packages/nbclient/util.py:62: in just_run
    return loop.run_until_complete(coro)
usr/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
    return future.result()
opt/venv/lib/python3.11/site-packages/nbclient/client.py:965: in async_execute_cell
    await self._check_raise_for_error(cell, cell_index, exec_reply)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <nbconvert.preprocessors.execute.ExecutePreprocessor object at 0x7f3c21b023d0>
cell = {'cell_type': 'code', 'execution_count': 1, 'metadata': {'execution': {'iopub.status.busy': '2023-08-06T19:58:08.08778...ue, exist_ok=True)\n    with open(filename, mode="w", encoding="utf-8") as f:\n        json.dump(result, f, indent=4)'}
cell_index = 1
exec_reply = {'buffers': [], 'content': {'ename': 'ModuleNotFoundError', 'engine_info': {'engine_id': -1, 'engine_uuid': '1114a438-...e, 'engine': '1114a438-7d1d-4ec4-a425-50a06418d737', 'started': '2023-08-06T19:58:08.088569Z', 'status': 'error'}, ...}

    async def _check_raise_for_error(
        self, cell: NotebookNode, cell_index: int, exec_reply: t.Optional[t.Dict]
    ) -> None:

        if exec_reply is None:
            return None

        exec_reply_content = exec_reply['content']
        if exec_reply_content['status'] != 'error':
            return None

        cell_allows_errors = (not self.force_raise_errors) and (
            self.allow_errors
            or exec_reply_content.get('ename') in self.allow_error_names
            or "raises-exception" in cell.metadata.get("tags", [])
        )
        await run_hook(self.on_cell_error, cell=cell, cell_index=cell_index)
        if not cell_allows_errors:
>           raise CellExecutionError.from_cell_and_msg(cell, exec_reply_content)
E           nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
E           ------------------
E           # Install dependencies
E           
E           import json
E           import numpy as np
E           import pandas as pd
E           import adaptive
E           import holoviews
E           import ipywidgets
E           import nest_asyncio
E           import plotly.graph_objects as go
E           
E           from tqdm import tqdm
E           from pathlib import Path
E           from skopt import gp_minimize
E           from skopt.utils import dump, load
E           from scipy.interpolate import griddata
E           
E           from openmc_model import objective
E           
E           adaptive.notebook_extension()
E           nest_asyncio.apply()
E           
E           # method for saving results in json file
E           def output_result(filepath, result):
E               filename = filepath
E               Path(filename).parent.mkdir(parents=True, exist_ok=True)
E               with open(filename, mode="w", encoding="utf-8") as f:
E                   json.dump(result, f, indent=4)
E           ------------------
E           
E           ---------------------------------------------------------------------------
E           ModuleNotFoundError                       Traceback (most recent call last)
E           Cell In[1], line 18
E                15 from skopt.utils import dump, load
E                16 from scipy.interpolate import griddata
E           ---> 18 from openmc_model import objective
E                20 adaptive.notebook_extension()
E                21 nest_asyncio.apply()
E           
E           ModuleNotFoundError: No module named 'openmc_model'
E           ModuleNotFoundError: No module named 'openmc_model'

opt/venv/lib/python3.11/site-packages/nbclient/client.py:862: CellExecutionError
--------------------------------------- Captured stdout call ----------------------------------------
tasks/task_16_parameter_study_optimisation/parameter_study_optimisation.ipynb
--------------------------------------- Captured stderr call ----------------------------------------
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
____________________________________________ test_task_3 ____________________________________________

    def test_task_3():
        for notebook in Path().rglob("tasks/task_03_*/*.ipynb"):
            print(notebook)
>           nb, errors = _notebook_run(notebook)

tests/test_task_3.py:46: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_task_3.py:38: in _notebook_run
    raise e
tests/test_task_3.py:32: in _notebook_run
    ep.preprocess(nb, {'metadata': {'path': this_file_directory}})
opt/venv/lib/python3.11/site-packages/nbconvert/preprocessors/execute.py:89: in preprocess
    self.preprocess_cell(cell, resources, index)
opt/venv/lib/python3.11/site-packages/nbconvert/preprocessors/execute.py:110: in preprocess_cell
    cell = self.execute_cell(cell, index, store_history=True)
opt/venv/lib/python3.11/site-packages/nbclient/util.py:84: in wrapped
    return just_run(coro(*args, **kwargs))
opt/venv/lib/python3.11/site-packages/nbclient/util.py:62: in just_run
    return loop.run_until_complete(coro)
usr/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
    return future.result()
opt/venv/lib/python3.11/site-packages/nbclient/client.py:965: in async_execute_cell
    await self._check_raise_for_error(cell, cell_index, exec_reply)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <nbconvert.preprocessors.execute.ExecutePreprocessor object at 0x7f3c1af13110>
cell = {'cell_type': 'code', 'execution_count': 2, 'metadata': {'execution': {'iopub.status.busy': '2023-08-06T19:58:38.88470...and the available openmc colors\n# vox_plot.colors = {copper: \'blue\'}\n\nvox_plot.to_vtk(output=\'voxel_plot.vti\')'}
cell_index = 4
exec_reply = {'buffers': [], 'content': {'ename': 'ImportError', 'engine_info': {'engine_id': -1, 'engine_uuid': '9161dac6-f154-405...e, 'engine': '9161dac6-f154-405b-9d6f-956f48cba0a3', 'started': '2023-08-06T19:58:38.885004Z', 'status': 'error'}, ...}

    async def _check_raise_for_error(
        self, cell: NotebookNode, cell_index: int, exec_reply: t.Optional[t.Dict]
    ) -> None:

        if exec_reply is None:
            return None

        exec_reply_content = exec_reply['content']
        if exec_reply_content['status'] != 'error':
            return None

        cell_allows_errors = (not self.force_raise_errors) and (
            self.allow_errors
            or exec_reply_content.get('ename') in self.allow_error_names
            or "raises-exception" in cell.metadata.get("tags", [])
        )
        await run_hook(self.on_cell_error, cell=cell, cell_index=cell_index)
        if not cell_allows_errors:
>           raise CellExecutionError.from_cell_and_msg(cell, exec_reply_content)
E           nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
E           ------------------
E           # makes the 3d "cube" style geometry
E           vox_plot = openmc.Plot()
E           vox_plot.type = 'voxel'
E           
E           # makes sure the bounds of the plot include the whole geometry
E           vox_plot.width = my_geometry.bounding_box.width
E           
E           # makes sure the voxel plot is centered at the center of the geometry
E           vox_plot.origin = my_geometry.bounding_box.center
E           
E           # sets the pixels in each direction to be proportional to the size of the geometry in that direction
E           # Your computer RAM will limit the number of pixels you can set in each direction.
E           # The * 0.1 part of this line reduces the number of pixels in each direction to a reasonable amount but this could be increased if you want more resolution.
E           vox_plot.pixels = [int(w* 0.1) for w in my_geometry.bounding_box.width]
E           
E           vox_plot.color_by = 'material'
E           # materials can be coloured using this command and the available openmc colors
E           # vox_plot.colors = {copper: 'blue'}
E           
E           vox_plot.to_vtk(output='voxel_plot.vti')
E           ------------------
E           
E           ---------------------------------------------------------------------------
E           ImportError                               Traceback (most recent call last)
E           Cell In[2], line 20
E                16 vox_plot.color_by = 'material'
E                17 # materials can be coloured using this command and the available openmc colors
E                18 # vox_plot.colors = {copper: 'blue'}
E           ---> 20 vox_plot.to_vtk(output='voxel_plot.vti')
E           
E           File /opt/venv/lib/python3.11/site-packages/openmc/plots.py:977, in Plot.to_vtk(self, output, openmc_exec, cwd)
E               974 if output is None:
E               975     output = h5_voxel_file.with_suffix('.vti')
E           --> 977 return voxel_to_vtk(h5_voxel_file, output)
E           
E           File /opt/venv/lib/python3.11/site-packages/openmc/plots.py:203, in voxel_to_vtk(voxel_file, output)
E               185 """Converts a voxel HDF5 file to a VTK file
E               186 
E               187 .. versionadded:: 0.13.4
E              (...)
E               199     Path of the .vti file produced
E               200 """
E               202 # imported vtk only if used as vtk is an option dependency
E           --> 203 import vtk
E               205 _min_version = (2, 0)
E               207 # Read data from voxel file
E           
E           File /opt/venv/lib/python3.11/site-packages/vtk.py:5
E                 3 # this module has the same contents as vtkmodules.all
E                 4 from vtkmodules.vtkCommonCore import *
E           ----> 5 from vtkmodules.vtkWebCore import *
E                 6 from vtkmodules.vtkCommonMath import *
E                 7 from vtkmodules.vtkCommonTransforms import *
E           
E           ImportError: Initialization failed for vtkWebCore, not compatible with vtkmodules.vtkCommonCore
E           ImportError: Initialization failed for vtkWebCore, not compatible with vtkmodules.vtkCommonCore

opt/venv/lib/python3.11/site-packages/nbclient/client.py:862: CellExecutionError
--------------------------------------- Captured stdout call ----------------------------------------
tasks/task_03_making_CSG_geometry/3_viewing_the_geometry_as_vtk.ipynb
--------------------------------------- Captured stderr call ----------------------------------------
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
____________________________________________ test_task_8 ____________________________________________

    def test_task_8():
        for notebook in Path().rglob("tasks/task_08_*/*.ipynb"):
            print(notebook)
>           nb, errors = _notebook_run(notebook)

tests/test_task_8.py:45: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_task_8.py:37: in _notebook_run
    raise e
tests/test_task_8.py:31: in _notebook_run
    ep.preprocess(nb, {'metadata': {'path': this_file_directory}})
opt/venv/lib/python3.11/site-packages/nbconvert/preprocessors/execute.py:89: in preprocess
    self.preprocess_cell(cell, resources, index)
opt/venv/lib/python3.11/site-packages/nbconvert/preprocessors/execute.py:110: in preprocess_cell
    cell = self.execute_cell(cell, index, store_history=True)
opt/venv/lib/python3.11/site-packages/nbclient/util.py:84: in wrapped
    return just_run(coro(*args, **kwargs))
opt/venv/lib/python3.11/site-packages/nbclient/util.py:62: in just_run
    return loop.run_until_complete(coro)
usr/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
    return future.result()
opt/venv/lib/python3.11/site-packages/nbclient/client.py:965: in async_execute_cell
    await self._check_raise_for_error(cell, cell_index, exec_reply)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <nbconvert.preprocessors.execute.ExecutePreprocessor object at 0x7f3c201abad0>
cell = {'cell_type': 'code', 'execution_count': 7, 'metadata': {'execution': {'iopub.status.busy': '2023-08-06T20:02:08.01030...y=my_geometry,\n    outline_by='material',\n    outline_kwargs={'colour':['black']}\n)\nplot.figure.savefig('yz.png')"}
cell_index = 14
exec_reply = {'buffers': [], 'content': {'ename': 'AttributeError', 'engine_info': {'engine_id': -1, 'engine_uuid': '1c43a002-b080-...e, 'engine': '1c43a002-b080-4099-b16a-6cfd4351f37b', 'started': '2023-08-06T20:02:08.010804Z', 'status': 'error'}, ...}

    async def _check_raise_for_error(
        self, cell: NotebookNode, cell_index: int, exec_reply: t.Optional[t.Dict]
    ) -> None:

        if exec_reply is None:
            return None

        exec_reply_content = exec_reply['content']
        if exec_reply_content['status'] != 'error':
            return None

        cell_allows_errors = (not self.force_raise_errors) and (
            self.allow_errors
            or exec_reply_content.get('ename') in self.allow_error_names
            or "raises-exception" in cell.metadata.get("tags", [])
        )
        await run_hook(self.on_cell_error, cell=cell, cell_index=cell_index)
        if not cell_allows_errors:
>           raise CellExecutionError.from_cell_and_msg(cell, exec_reply_content)
E           nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
E           ------------------
E           plot = openmc.plot_mesh_tally(
E               tally=my_tbr_tally,
E               basis='xz',
E               axis_units='m',
E               # slice_index=9,  # max value of slice selected
E               value= 'std_dev',
E               outline=True,
E               geometry=my_geometry,
E               outline_by='material',
E               outline_kwargs={'colour':['black']}
E           )
E           plot.figure.savefig('yz.png')
E           ------------------
E           
E           ---------------------------------------------------------------------------
E           AttributeError                            Traceback (most recent call last)
E           Cell In[7], line 1
E           ----> 1 plot = openmc.plot_mesh_tally(
E                 2     tally=my_tbr_tally,
E                 3     basis='xz',
E                 4     axis_units='m',
E                 5     # slice_index=9,  # max value of slice selected
E                 6     value= 'std_dev',
E                 7     outline=True,
E                 8     geometry=my_geometry,
E                 9     outline_by='material',
E                10     outline_kwargs={'colour':['black']}
E                11 )
E                12 plot.figure.savefig('yz.png')
E           
E           AttributeError: module 'openmc' has no attribute 'plot_mesh_tally'
E           AttributeError: module 'openmc' has no attribute 'plot_mesh_tally'

opt/venv/lib/python3.11/site-packages/nbclient/client.py:862: CellExecutionError
--------------------------------------- Captured stdout call ----------------------------------------
tasks/task_08_CSG_mesh_tally/1_example_2d_mesh_tallies.ipynb
tasks/task_08_CSG_mesh_tally/2_example_3d_mesh_tallies.ipynb
--------------------------------------- Captured stderr call ----------------------------------------
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
========================================= warnings summary ==========================================
opt/venv/lib/python3.11/site-packages/jupyter_client/connect.py:28
  /opt/venv/lib/python3.11/site-packages/jupyter_client/connect.py:28: DeprecationWarning: Jupyter is migrating its paths to use standard platformdirs
  given by the platformdirs library.  To remove this warning and
  see the appropriate new directories, set the environment variable
  `JUPYTER_PLATFORM_DIRS=1` and then run `jupyter --paths`.
  The use of platformdirs will be the default in `jupyter_core` v6
    from jupyter_core.paths import jupyter_data_dir, jupyter_runtime_dir, secure_write

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
====================================== short test summary info ======================================
FAILED tests/test_task_12.py::test_task_12 - nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
FAILED tests/test_task_13.py::test_task_13 - nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
FAILED tests/test_task_15.py::test_task_14 - nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
FAILED tests/test_task_16.py::test_task_14 - nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
FAILED tests/test_task_3.py::test_task_3 - nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
FAILED tests/test_task_8.py::test_task_8 - nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
======================== 6 failed, 12 passed, 1 warning in 833.32s (0:13:53) ========================
root ➜ / $ 
shimwell commented 1 year ago

tasks/task_13_variance_reduction/4_sphere_iterative_per_batch_ww.ipynb has been solved

shimwell commented 1 month ago

ci is now reported for each task, so this tracker issue can be closed