Merge branch 'main' of github.com:pim-n/pg-rad

This commit is contained in:
Pim Nelissen
2026-06-02 17:02:30 +02:00
2 changed files with 29 additions and 57 deletions

View File

@ -1,59 +1,32 @@
[![Python 3.12](https://img.shields.io/badge/python-3.12-blue.svg)](https://www.python.org/downloads/release/python-312/)
[![Tests](https://github.com/pim-n/pg-rad/actions/workflows/ci-tests.yml/badge.svg)](https://github.com/pim-n/pg-rad/actions/workflows/ci-tests.yml)
# pg-rad
Primary Gamma RADiation landscape - Development
# PG-RAD - Primary Gamma RADiation landscape simulator
## Clone
```
git clone https://github.com/pim-n/pg-rad
cd pg-rad
git checkout dev
PG-RAD is a command-line software package for simulating localisation of orphan sources using mobile gamma spectrometry. PG-RAD provides a framework for construction road geometries, arbitrary distributions of point sources, modelling the detector response to primary gammas. PG-RAD provides a configurable framework for constructing detector trajectories, defining radioactive source distributions, modelling detector response, and generating synthetic acquisition data. User input is specified through YAML configuration files, which makes simulations reproducible and easily shared.
## Installation
PG-RAD is a Python 3 package and is only tested on x86_64 Linux systems. The following installation instructions were testing for a fresh virtual machine running Ubuntu 26.04 LTS.
## Conda installation (Tested and recommended)
1. Install git by `sudo apt update && sudo apt install git`
2. Install miniforge by following [these](https://conda-forge.org/download/) instructions.
3. Create a file called `environment.yml`, and paste the following in there:
```yaml
name: my-pgrad-env
channels:
- conda-forge
dependencies:
- python=3.12
- pip:
- git+ssh://git@github.com/pim-n/pg-rad.git@v0.1.1
```
4. Run `conda env create -f environment.yml` to create the environment
5. Run `conda activate pg-rad-analysis`. You should now be in the conda environment `my-pgrad-env`.
6. To test if installation was succesful, run `pgrad --example --show`. If this runs without errors and produces visual output, PG-RAD is correctly installed.
or
## Manual installation
```
git@github.com:pim-n/pg-rad.git
cd pg-rad
git checkout dev
```
## Dependencies / venv
With Python verion `>=3.12.4` and `<3.13`, create a virtual environment and install pg-rad.
```
python3 -m venv .venv
source .venv/bin/activate
```
With the virtual environment activated, run:
```
pip install -e .[dev]
```
## Running example landscape
The example landscape can be generated using the command-line interface. Still in the virtual environment, run
```
pgrad --test --loglevel DEBUG
```
## Tests
Tests can be run with `pytest` from the root directory of the repository. With the virtual environment activated, run:
```
pytest
```
## Local viewing of documentation
PG-RAD uses [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) for generating documentation. It can be locally viewed by (in the venv) running:
```
mkdocs serve
```
where you can add the `--livereload` flag to automatically update the documentation as you write to the Markdown files.
If you prefer another virtual environment, you still need git installed. Ensure the Python version of the environment is `>3.12.4` and `<3.13`. Then, with your virtual environment activated, run `pip install git+ssh://git@github.com/pim-n/pg-rad.git@main`. Run `pgrad --example --show` to check if the installation was successful.

View File

@ -78,13 +78,12 @@ def generate_df(sim: SimulationOutput) -> DataFrame:
east_coords = sim.count_rate.x[1:]
north_coords = sim.count_rate.y[1:]
if len(east_coords) != sim.count_rate.integrated_counts.shape:
if len(east_coords) != sim.count_rate.integrated_counts.shape[0]:
east_coords = None
north_coords = None
logger.warning(
"PG-RAD currently does not support interpolation"
" of experimental paths for export. Only ROI_P, ROI_BR and Dist"
" will be saved."
"PG-RAD currently does not support this experimental path."
" Only ROI_P, ROI_BR and Dist will be saved."
)
result_df = DataFrame(