Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
uses: actions/checkout@v2

- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
environment-file: environment.yml
Expand All @@ -28,6 +28,13 @@ jobs:
run: |
python openmc_model.py
jupyter-nbconvert --to notebook postprocessing.ipynb --execute

- name: Run foil analysis
shell: bash -l {0}
working-directory: analysis/neutron
run: |
papermill foil_analysis.ipynb temp.ipynb -p download_from_raw False
jupyter-nbconvert --to notebook --execute temp.ipynb

- name: Run tritium model
shell: bash -l {0}
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ jobs:
python openmc_model.py
jupyter-nbconvert --to notebook postprocessing.ipynb --execute

- name: Run foil analysis
shell: bash -l {0}
working-directory: analysis/neutron
run: |
papermill foil_analysis.ipynb temp.ipynb -p download_from_raw False
jupyter-nbconvert --to notebook --execute temp.ipynb

- name: Run tritium model
shell: bash -l {0}
working-directory: analysis/tritium
Expand Down
39 changes: 39 additions & 0 deletions analysis/neutron/download_raw_foil_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from pathlib import Path
import zipfile
import requests


def download_and_extract_foil_data(url: str, extracted_path: Path):

output_filepath = Path("../../data/neutron_detection/foil_data.zip")

if extracted_path.exists():
print(f"Directory already exists: {extracted_path}")
else:
# URL of the file

# Download the file
print(f"Downloading data from {url}...")
response = requests.get(url)
if response.status_code == 200:
print("Download successful!")
# Save the file to the specified directory
with open(output_filepath, "wb") as f:
f.write(response.content)
print(f"File saved to: {output_filepath}")
else:
print(f"Failed to download file. HTTP Status Code: {response.status_code}")

# Extract the zip file

# Ensure the extraction directory exists
extracted_path.mkdir(parents=True, exist_ok=True)

# Unzip the file
with zipfile.ZipFile(output_filepath, "r") as zip_ref:
zip_ref.extractall(extracted_path)
print(f"Files extracted to: {extracted_path}")

# Delete the zip file after extraction
output_filepath.unlink(missing_ok=True)

808 changes: 808 additions & 0 deletions analysis/neutron/foil_analysis.ipynb

Large diffs are not rendered by default.

Loading
Loading