Skip to content
Open
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
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,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_HPGe.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 @@ -32,6 +32,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_HPGe.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,
measurement_directory_path: Path):

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

if measurement_directory_path.exists():
print(f"Directory already exists: {measurement_directory_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)
948 changes: 948 additions & 0 deletions analysis/neutron/foil_analysis_HPGe.ipynb

Large diffs are not rendered by default.

Loading
Loading