-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME.Rmd
118 lines (86 loc) · 4.6 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = NULL
)
```
# gamma <img width=120px src="man/figures/logo.png" align="right" />
<!-- badges: start -->
[![R-CMD-check](https://github.com/crp2a/gamma/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/crp2a/gamma/actions/workflows/R-CMD-check.yaml)
[![codecov](https://codecov.io/gh/crp2a/gamma/branch/master/graph/badge.svg)](https://app.codecov.io/gh/crp2a/gamma)
[![r-universe](https://crp2a.r-universe.dev/badges/gamma)](https://crp2a.r-universe.dev){.pkgdown-devel}
[![CRAN Version](https://www.r-pkg.org/badges/version/gamma)](https://cran.r-project.org/package=gamma){.pkgdown-release}
[![CRAN checks](https://badges.cranchecks.info/worst/gamma.svg)](https://cran.r-project.org/web/checks/check_results_gamma.html){.pkgdown-release}
[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/gamma)](https://cran.r-project.org/package=gamma){.pkgdown-release}
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2652393.svg)](https://doi.org/10.5281/zenodo.2652393)
[![SWH](https://archive.softwareheritage.org/badge/swh:1:dir:459ecf47c4c0bb768732bd56c5c245ddab0d33f9/)](https://archive.softwareheritage.org/swh:1:dir:459ecf47c4c0bb768732bd56c5c245ddab0d33f9;origin=https://github.com/crp2a/gamma;visit=swh:1:snp:10e6be6e5cbe735b58c45abbcbabf20b93019e9c;anchor=swh:1:rev:1b3baf8821267ed656d780ae154d347769141d0c/)
<!-- badges: end -->
## Overview
**gamma** is intended to process in-situ gamma-ray spectrometry measurements for luminescence dating. This package allows to import, inspect and (automatically) correct the energy scale of the spectrum. It provides methods for estimating the gamma dose rate by the use of a calibration curve. This package only supports Canberra CNF and TKA and Kromek SPE files.
The [**gammaShiny**](https://github.com/crp2a/gammaShiny) package provides an enhanced graphical user interface for the main applications of **gamma**.
```{r citation, echo=FALSE, comment=''}
cite <- utils::citation("gamma")
print(cite, bibtex = FALSE)
```
## Installation
You can install the released version of **gamma** from [CRAN](https://CRAN.R-project.org) with:
```{r cran-installation, eval=FALSE}
install.packages("gamma")
```
And the development version from [GitHub](https://github.com/) with:
```{r gh-installation, eval=FALSE}
# install.packages("remotes")
remotes::install_github("crp2a/gamma")
```
## Usage
```{r usage, fig.width=7, fig.height=3.5, fig.align='center'}
## A minimal example
library(gamma)
## Find the full path to the spectrum file
spc_file <- system.file("extdata/LaBr.CNF", package = "gamma")
## Import the spectrum
spectrum <- read(spc_file)
## Set the expected channel/energy peaks for the energy scale calibration
## Spectrum pre-processing and peak detection
peaks <- spectrum |>
signal_slice() |>
signal_stabilize(f = sqrt) |>
signal_smooth(method = "savitzky", m = 21) |>
signal_correct(method = "SNIP", n = 100) |>
peaks_find()
## Set the energy values (in keV)
set_energy(peaks) <- c(238, NA, NA, NA, 1461, NA, NA, 2615)
## Calibrate the energy scale
calib <- energy_calibrate(spectrum, peaks)
## Inspect peaks
plot(calib, peaks)
```
```{r calib, fig.width=3.5, fig.height=3.5, fig.align='center'}
## Estimate the gamma dose rate of a set of spectra
## You may want to give extra attention to the energy calibration step
spc_file <- system.file("extdata/BDX_LaBr_1/test", package = "gamma")
spectra <- read(spc_file)
## Load the calibration curve for the dose rate estimation
## As this curve is instrument specific, you will have to build your own
data("BDX_LaBr_1", package = "gamma")
plot(BDX_LaBr_1)
```
```{r dose, eval=FALSE}
## Estimate the gamma dose rate
(doses <- dose_predict(BDX_LaBr_1, spectra))
```
```{r table, echo=FALSE}
doses <- dose_predict(BDX_LaBr_1, spectra)
knitr::kable(doses)
```
## Contributing
Please note that the **gamma** project is released with a [Contributor Code of Conduct](https://github.com/crp2a/gamma/blob/master/.github/CODE_OF_CONDUCT.md). By contributing to this project, you agree to abide by its terms.
## Acknowledgements
This work received a state financial support managed by the Agence Nationale de la Recherche (France) through the program *Investissements d'avenir* (ref. 10-LABX-0052 and 11-IDEX-0001).