https://github.com/crp2a/gamma
Raw File
Tip revision: 1b3baf8821267ed656d780ae154d347769141d0c authored by nfrerebeau on 02 May 2020, 09:21:12 UTC
Update documentation
Tip revision: 1b3baf8
README.Rmd
---
output: github_document
editor_options: 
  chunk_output_type: console
---

<!-- 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-"
)
```
# gamma <img width=120px src="man/figures/logo.png" align="right" />

[![Appveyor build status](https://ci.appveyor.com/api/projects/status/h7jjppg72oiq9pnf/branch/master?svg=true)](https://ci.appveyor.com/project/nfrerebeau/gamma/branch/master)
[![Travis build Status](https://travis-ci.org/crp2a/gamma.svg?branch=master)](https://travis-ci.org/crp2a/gamma)
[![codecov](https://codecov.io/gh/crp2a/gamma/branch/master/graph/badge.svg)](https://codecov.io/gh/crp2a/gamma)

<!-- CRAN badges
[![CRAN Version](http://www.r-pkg.org/badges/version/gamma)](https://cran.r-project.org/package=gamma)
[![CRAN checks](https://cranchecks.info/badges/worst/gamma)](https://cran.r-project.org/web/checks/check_results_gamma.html)
[![CRAN Downloads](http://cranlogs.r-pkg.org/badges/gamma)](https://cran.r-project.org/package=gamma)
-->

[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
[![lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2652393.svg)](https://doi.org/10.5281/zenodo.2652393)

## 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 files.

The [**gammaShiny**](https://github.com/crp2a/gammaShiny) package provides an exhanced graphical user interface for the main applications of **gamma**.

## Installation

Install the development version from GitHub with:

```{r gh-installation, eval=FALSE}
# install.packages("remotes")
remotes::install_github("crp2a/gamma")
```

## Usage

```{r usage, fig.width=7, fig.height=5, fig.align='center'}
## A minimal example
## You may want to give extra attention to the energy calibration step
library(gamma)
library(magrittr)

## 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 chanel/energy peaks for the energy scale calibration
## Spectrum pre-processing and peak detection
peaks <- spectrum %>%
  slice_signal() %>%
  stabilize_signal(transformation = sqrt) %>%
  smooth_signal(method = "savitzky", m = 21) %>%
  remove_baseline() %>%
  find_peaks()

## Set the energy values (in keV)
set_energy(peaks) <- c(238, NA, NA, NA, 1461, NA, NA, 2615)
peaks

## Inspect peaks
plot(spectrum, peaks)

## Calibrate the energy scale
calib <- calibrate_energy(spectrum, peaks)

## Load the calibration curve for the dose rate estimation
## As this curve is instrument specific, you will have to build your own
## See help(fit_dose)
data("BDX_LaBr_1_curve", package = "gamma")
BDX_LaBr_1_curve

## Estimate the gamma dose rate
(doses <- predict_dose(BDX_LaBr_1_curve, calib, simplify = TRUE))
```

## 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) throught the program *Investissements d'avenir* (ref. [10-LABX-0052](https://lascarbx.labex.u-bordeaux.fr) and [11-IDEX-0001](https://amidex.univ-amu.fr)).
back to top