https://github.com/tzerk/gammaspec
A collection of functions to analyse gamma spectra
https://github.com/tzerk/gammaspec
data-analysis gamma-ray-spectrometry r
Last synced: about 1 month ago
JSON representation
A collection of functions to analyse gamma spectra
- Host: GitHub
- URL: https://github.com/tzerk/gammaspec
- Owner: tzerk
- License: gpl-3.0
- Created: 2016-06-16T14:56:47.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-09-20T13:11:21.000Z (over 2 years ago)
- Last Synced: 2025-03-28T20:37:30.884Z (about 2 months ago)
- Topics: data-analysis, gamma-ray-spectrometry, r
- Language: R
- Size: 652 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)## Examples
library(gammaSpec)
file <- system.file("extdata", "Nievenheim_DORNIE_1.spe", package = "gammaSpec")
```[](https://travis-ci.org/tzerk/gammaSpec)
[](https://ci.appveyor.com/project/tzerk/gammaspec)> [Find a full documentation of the package on the project page](https://tzerk.github.io/gammaSpec/)
## Overview
The **R** package 'gammaSpec' provides a small collection of functions to analyse
gamma spectra of NaI(Tl) scintillation radiation detectors.## Installation
The ‘gammaSpec’ package is not available on the official CRAN servers.
However, the latest development builds can directly be installed from GitHub. Simply run the following from an R console
```{r, eval = FALSE}
if(!require("devtools"))
install.packages("devtools")
devtools::install_github("tzerk/gammaSpec")
```## Features
### Data import
The function `read_SPE()` can be used to import SPE files produces by the
ORTEC application software 'MAESTRO Mulichannel Analyzer Emulation' and
'GammaVision Gamma Spectroscopy'. All meta information in the SPE files
are preserved in the return object.```{r, eval = FALSE}
file <- read_SPE(file = "~/path/to/file.spe")
``````{r, warning=FALSE}
spectrum <- read_SPE(file)
str(spectrum, max.level = 1)
```### Plotting
The package contains a custom S3 method for `plot()` to quickly visualise the
imported spectrum. It further offers to re-calculate the absolute counts per
channel to a count rate per energy (keV).```{r spec_plot, warning = FALSE}
plot(spectrum,
type = c("bar", "line", "point")[2],
xval = c("energy", "channel")[1],
yval = c("rate", "count")[1],
info = TRUE, fill = FALSE)
```### Estimating the gamma dose rate
The function `calc_DoseRate()` estimates the in-situ gamma dose rate of the
provided gamma spectrum based on the recorded count rate and comparing the
integrated sum within a user specified energy range to that of an
internal calibration spectrum.```{r doserate, fig.height=10, fig.width=7}
res <- calc_DoseRate(data = spectrum,
energy.min = 500,
energy.max = 2600,
background.correction = TRUE,
plot = TRUE,
plot.combine = TRUE,
app = FALSE,
cex = 0.8)
```### Shiny application
Finally, the package includes a simple [shiny](https://github.com/rstudio/shiny)
application.```{r, eval = FALSE}
calc_DoseRate(app = TRUE)
```
## Note
This version is a development version and it comes without any guarentee!## License
The gammaSpec package is licensed under the GPLv3. See these files in the main directory for additional details:
* LICENSE - gammaSpec package license (GPLv3)