Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 64 additions & 15 deletions models/oktavian/oktavian_al/postprocessing.ipynb

Large diffs are not rendered by default.

Binary file added models/oktavian/oktavian_al/postprocessing.pdf
Binary file not shown.
1 change: 1 addition & 0 deletions src/openmc_fusion_benchmarks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
from openmc_fusion_benchmarks.read_results import *
from openmc_fusion_benchmarks.visualize import *
from openmc_fusion_benchmarks.utils import *
from openmc_fusion_benchmarks.ipynb_to_pdf import *
32 changes: 32 additions & 0 deletions src/openmc_fusion_benchmarks/ipynb_to_pdf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import os


class Report:
def __init__(self):
"""Initializes the Report class with a list of files to convert."""
self.notebook_files = []

def add_ipynb_file(self, notebook_path: str):
"""Adds the path of a jupyter notebook file to the list."""
if notebook_path.endswith(".ipynb"):
self.notebook_files.append(notebook_path)
print(f"File added: {notebook_path}")
else:
print(f"Error: {notebook_path} is not a .ipynb file.")

def convert_to_pdf(self):
"""Converts all jupyter notebook files in the list to PDF."""
if not self.notebook_files:
print("Error: No files to convert.")
return

for notebook_path in self.notebook_files:
print(f"Converting {notebook_path} to PDF...")
os.system(f"jupyter nbconvert --to pdf --no-input {notebook_path}")
print("Conversion completed.")

def modify(self):
"""Method for future modification. Raises a NotImplementedError."""
raise NotImplementedError(
"The modify method is not implemented yet and will be added in the future."
)