mirror of
https://github.com/pim-n/pg-rad
synced 2026-04-24 17:58:11 +02:00
update docs. update example configs to latest spec.
This commit is contained in:
@ -2,10 +2,7 @@
|
||||
To get started quickly, you may copy and modify one of the example configs found [here](quickstart.md#example-configs).
|
||||
|
||||
|
||||
The config file must be a [YAML](https://yaml.org/) file. YAML is a serialization language that works with key-value pairs, but in a syntax more readable than some other alternatives. In YAML, the indentation matters. I
|
||||
|
||||
|
||||
The remainder of this chapter will explain the different required and optionals keys, what they represent, and allowed values.
|
||||
The config file must be a [YAML](https://yaml.org/) file. YAML is a serialization language that works with key-value pairs, but in a syntax more readable than some other alternatives. The remainder of this chapter will explain the different required and optionals keys, what they represent, and allowed values.
|
||||
|
||||
## Required keys
|
||||
|
||||
@ -124,11 +121,11 @@ Like with the lengths, if a turn segment has no angle specified, a random one (w
|
||||
Letting PG-RAD randomly assign lengths and angles can cause (expected) issues. That is because of physics restrictions. If the combination of length, angle (radius) and velocity of the vehicle is such that the centrifugal force makes it impossible to take this turn, PG-RAD will raise an error. To fix it, you can 1) reduce the speed; 2) define a smaller angle for the turn; or 3) assign more length to the turn segment.
|
||||
|
||||
!!! info
|
||||
For more information about how procedural roads are generated, including the random sampling of lengths and angles, see X
|
||||
For more information about how procedural roads are generated, including the random sampling of lengths and angles, see [this](explainers/prefab_roads.ipynb) explainer.
|
||||
|
||||
### Sources
|
||||
|
||||
Currently, the only type of source supported is a point source. Point sources can be added under the `sources` key, where the **subkey is the name** of the source:
|
||||
Currently, the only type of source supported is an isotropic point source. However, an arbitrary number of point sources can be added to the landscape. Point sources can be added under the `sources` key, where the **subkey is the name** of the source:
|
||||
|
||||
```yaml
|
||||
sources:
|
||||
@ -190,21 +187,10 @@ Note that side is relative to the direction of travel. The path will by default
|
||||
|
||||
### Detector
|
||||
|
||||
The final required key is the `detector`. Currently, only isotropic detectors are supported. Nonetheless, you must specify it with `name`, `is_isotropic` and `efficiency`:
|
||||
The final required key is the `detector`. Currently, custom detectors are not yet supported and you must choose from a list of existing detectors:
|
||||
|
||||
```yaml
|
||||
detector:
|
||||
name: test
|
||||
is_isotropic: True
|
||||
efficiency: 0.02
|
||||
```
|
||||
|
||||
Note there are some existing detectors available, where efficiency is not required and will be looked up by PG-RAD itself:
|
||||
|
||||
```yaml
|
||||
detector:
|
||||
name: NaIR
|
||||
is_isotropic: True
|
||||
detector: LU_HPGe_90
|
||||
```
|
||||
|
||||
## Optional keys
|
||||
|
||||
121
docs/explainers/count_rate_along_path.ipynb
Normal file
121
docs/explainers/count_rate_along_path.ipynb
Normal file
@ -0,0 +1,121 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "a8d303ad",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Gamma detectors along a path"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "08dda386",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Fluence rate at $\\vec{r}$\n",
|
||||
"\n",
|
||||
"Let $\\vec{r}_{p} = (x_{p},y_{p},z_{p})$ denote the location of a point source $p$. Let $\\vec{r}_{i} = (x_{i},y_{i},z_{i})$ denote an arbitrary point in space. The primary photon fluence rate at $\\vec{r}$ is then given by\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\dot{\\phi}(r) = \\frac{A n_\\gamma \\exp(-\\mu_{air} r)}{4\\pi r^2}\n",
|
||||
"$$\n",
|
||||
"\n",
|
||||
"where $r = ||\\vec{r}_p - \\vec{r}_i ||$. The units are $\\dot{\\phi} \\sim \\frac{\\text{photons}}{s \\cdot m^2}$\n",
|
||||
"\n",
|
||||
"## Count rate\n",
|
||||
"\n",
|
||||
"Gamma detectors are not perfectly efficient and efficiency is dependent on both photon energy $E_\\gamma$ and incident angle $\\theta$ [1].\n",
|
||||
"\n",
|
||||
"- the field efficiency $\\varepsilon_D (E_\\gamma) \\in [0, 1]$, in units of area $\\text{m}^2$,\n",
|
||||
"- the relative angular efficiency $\\varepsilon_\\theta (E_\\gamma, \\theta) \\in [0, 1]$, dimensionless.\n",
|
||||
"\n",
|
||||
"The total efficiency of the detector is then defined as\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\varepsilon(E_\\gamma, \\theta) = \\varepsilon_D (E_\\gamma) \\varepsilon_\\theta (E_\\gamma, \\theta) \\; .\n",
|
||||
"$$\n",
|
||||
"\n",
|
||||
"Where $\\varepsilon(E_\\gamma, \\theta) \\sim \\text{m}^2$.\n",
|
||||
"\n",
|
||||
"If the detector $D$ is positioned at $\\vec{r}_i$, the **count rate** becomes\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\dot{N}(r, E_\\gamma, \\theta) = \\varepsilon(E_\\gamma, \\theta) \\phi(r)\n",
|
||||
"$$\n",
|
||||
"\n",
|
||||
"where $\\dot{N} \\sim \\frac{\\text{counts}}{s}$.\n",
|
||||
"\n",
|
||||
"## Acquisiton time \n",
|
||||
"\n",
|
||||
"The acquisition time window $t_{w}$ is the time during which counts are accumulated in the detector until readout into the digital system. A typical $t_{w}$ in mobile gamma spectrometry is 1 to 10 seconds [2]. \n",
|
||||
"\n",
|
||||
"## Integration of counts\n",
|
||||
"\n",
|
||||
"Suppose an acquisition time of $t_{w}$ seconds and a fixed velocity $v$ in meters per seconds. Let $R(u)$ describe a road of $L$ meters long in the xy-plane, described as a function of arc length $u$ in meters (distance traveled along the road), where $u \\in [0, L]$. The euclidian norm between the point $R(u)$ and point source $\\vec{r}_p$ is then\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"r(u) = || \\vec{r}_p - R(u) ||\n",
|
||||
"$$\n",
|
||||
"\n",
|
||||
"Assuming a fixed velocity $v$, the distance traveled during one acquisition window $t_{w}$ is $\\Delta_s \\equiv vt_{w}$ meters. The path is divided into $K = L/\\Delta s$ segments, where the $k$-th segment represents the interval\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"u \\in [(k-1) \\Delta_s, k\\Delta_s] \\; , \\; k = 1, 2, \\dots, K\n",
|
||||
"$$\n",
|
||||
"\n",
|
||||
"The total count rate acquired during segment $k$-th is then\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"N_{w}(k) = \\frac{1}{v} \\int_{(k-1)\\Delta_s}^{k\\Delta_s} \\underbrace{\\dot{N}(r(u), E_\\gamma, \\theta(u))}_{\\text{CPS}} du\n",
|
||||
"$$\n",
|
||||
"\n",
|
||||
"## Numerical approximation\n",
|
||||
"\n",
|
||||
"Let us divide each segment into $N$ equally spaced points with step size $\\Delta u = \\Delta s / N$. Applying the trapezoidal rule then gives\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"N_w(k) \\approx \\frac{\\Delta u}{v}\n",
|
||||
"\\left[\n",
|
||||
"\\frac{\\dot{N}_0 + \\dot{N}_N}{2}\n",
|
||||
"+ \\sum_{n=1}^{N-1} \\dot{N}_n\n",
|
||||
"\\right],\n",
|
||||
"$$\n",
|
||||
"\n",
|
||||
"where\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\dot{N}_n = \\dot{N}\\big(r(u_n), E_\\gamma, \\theta(u_n)\\big), \\quad\n",
|
||||
"u_n = (k-1)\\Delta s + n \\Delta u.\n",
|
||||
"$$\n",
|
||||
"\n",
|
||||
"## References\n",
|
||||
"\n",
|
||||
"[1] A. Bukartas, ‘Assessment of mobile radiometry data in radiological emergencies using Bayesian statistical methods’, thesis/doccomp, Lund University, 2021. Accessed: Jan. 19, 2026. [Online]. Available: http://lup.lub.lu.se/record/4c298e71-3278-42a7-818a-6f17a5121d56\n",
|
||||
"\n",
|
||||
"[2] R. Finck, A. Bukartas, M. Jönsson, and C. Rääf, ‘Maximum detection distances for gamma emitting point sources in mobile gamma spectrometry’, Applied Radiation and Isotopes, vol. 184, p. 110195, Jun. 2022, doi: 10.1016/j.apradiso.2022.110195.\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": ".venv",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.12.9"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
@ -22,13 +22,18 @@ Primary Gamma RADiation landscape tool
|
||||
|
||||
If you get something like `pgrad: command not found`, please consult the [installation guide](installation.md).
|
||||
|
||||
You can run a quick test scenario as follows:
|
||||
You can run a quick test by running the example landscape as follows:
|
||||
|
||||
```
|
||||
pgrad --test
|
||||
pgrad --example
|
||||
```
|
||||
|
||||
This should produce a plot of a scenario containing a single point source and a path.
|
||||
This should produce an output like
|
||||
|
||||
```
|
||||
INFO: Landscape built successfully: Example landscape
|
||||
WARNING: No output produced. Use --save flag to save outputs and/or --showplots to display interactive plots.
|
||||
```
|
||||
|
||||
## Running PG-RAD
|
||||
|
||||
@ -38,11 +43,11 @@ In order to use the CLI for your own simulations, you need to provide a *config
|
||||
pgrad --config path/to/my_config.yml
|
||||
```
|
||||
|
||||
where `path/to/my_config.yml` points to your config file.
|
||||
where `path/to/my_config.yml` points to your config file. To check the results live, add the `--showplots` flag. If you want to save the results directly, then add the `--save` flag (you can use them at the same time as well).
|
||||
|
||||
## Example configs
|
||||
|
||||
The easiest way is to take one of these example configs, and adjust them as needed. Alternatively, there is a detailed guide on how to write your own config file [here](config-spec.md).
|
||||
The easiest way to get started is to take one of these example configs, and adjust them as needed. Alternatively, there is a detailed guide on how to write your own config file [here](config-spec.md).
|
||||
|
||||
=== "Example 1"
|
||||
|
||||
@ -61,15 +66,14 @@ The easiest way is to take one of these example configs, and adjust them as need
|
||||
sources:
|
||||
source1:
|
||||
activity_MBq: 1000
|
||||
isotope: CS137
|
||||
isotope: Cs137
|
||||
gamma_energy_keV: 662
|
||||
position:
|
||||
along_path: 100
|
||||
dist_from_path: 50
|
||||
side: left
|
||||
|
||||
detector:
|
||||
name: dummy
|
||||
is_isotropic: True
|
||||
detector: dummy
|
||||
```
|
||||
|
||||
=== "Example 2"
|
||||
@ -89,21 +93,21 @@ The easiest way is to take one of these example configs, and adjust them as need
|
||||
sources:
|
||||
source1:
|
||||
activity_MBq: 1000
|
||||
isotope: CS137
|
||||
isotope: Cs137
|
||||
gamma_energy_keV: 662
|
||||
position: [104.3, 32.5, 0]
|
||||
source2:
|
||||
activity_MBq: 100
|
||||
isotope: CS137
|
||||
isotope: Cs137
|
||||
gamma_energy_keV: 662
|
||||
position: [0, 0, 0]
|
||||
|
||||
detector:
|
||||
name: dummy
|
||||
is_isotropic: True
|
||||
detector: dummy
|
||||
```
|
||||
|
||||
=== "Example 3"
|
||||
|
||||
This is an example of a procedural path with random apportionment of total length and random angles being assigned to turns. The parameter `alpha` is optional, and is related to randomness. A higher value leads to more uniform apportionment of lengths and a lower value to more random apportionment. More information about `alpha` can be found [here](pg-rad-config-spec.md).
|
||||
This is an example of a procedural path with random apportionment of total length and random angles being assigned to turns. The parameter `alpha` is optional, and is related to randomness. A higher value leads to more uniform apportionment of lengths and a lower value to more random apportionment. More information about `alpha` can be found [here](explainers/prefab_roads.ipynb).
|
||||
|
||||
``` yaml
|
||||
name: Example 3
|
||||
@ -121,12 +125,11 @@ The easiest way is to take one of these example configs, and adjust them as need
|
||||
sources:
|
||||
source1:
|
||||
activity_MBq: 1000
|
||||
isotope: CS137
|
||||
isotope: Cs137
|
||||
gamma_energy_keV: 662
|
||||
position: [0, 0, 0]
|
||||
|
||||
detector:
|
||||
name: dummy
|
||||
is_isotropic: True
|
||||
|
||||
detector: dummy
|
||||
```
|
||||
|
||||
=== "Example 4"
|
||||
@ -148,12 +151,11 @@ The easiest way is to take one of these example configs, and adjust them as need
|
||||
sources:
|
||||
source1:
|
||||
activity_MBq: 1000
|
||||
isotope: CS137
|
||||
isotope: Cs137
|
||||
gamma_energy_keV: 662
|
||||
position: [0, 0, 0]
|
||||
|
||||
detector:
|
||||
name: dummy
|
||||
is_isotropic: True
|
||||
detector: dummy
|
||||
```
|
||||
|
||||
=== "Example 5"
|
||||
@ -178,10 +180,9 @@ The easiest way is to take one of these example configs, and adjust them as need
|
||||
sources:
|
||||
source1:
|
||||
activity_MBq: 1000
|
||||
isotope: CS137
|
||||
isotope: Cs137
|
||||
gamma_energy_keV: 662
|
||||
position: [0, 0, 0]
|
||||
|
||||
detector:
|
||||
name: dummy
|
||||
is_isotropic: True
|
||||
detector: dummy
|
||||
```
|
||||
Reference in New Issue
Block a user